import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -80,6 +80,7 @@ class Users_LoginController extends CommunityID_Controller_Action
public function logoutAction()
{
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::forgetMe();
$this->_redirect('');
}

View File

@ -42,6 +42,8 @@ class Users_ManageusersController extends CommunityID_Controller_Action
$mail = self::getMail($user, $this->view->translate('Community-ID registration reminder'));
try {
$mail->send();
$user->reminders++;
$user->save();
} catch (Zend_Mail_Protocol_Exception $e) {
Zend_Registry::get('logger')->log($e->getMessage(), Zend_Log::ERR);
}
@ -52,7 +54,7 @@ class Users_ManageusersController extends CommunityID_Controller_Action
* @return Zend_Mail
* @throws Zend_Mail_Protocol_Exception
*/
public static function getMail(User $user, $subject)
public static function getMail(Users_Model_User $user, $subject)
{
$locale = Zend_Registry::get('Zend_Locale');
$localeElements = explode('_', $locale);

View File

@ -11,6 +11,13 @@
class Users_PersonalinfoController extends CommunityID_Controller_Action
{
public function preDispatch()
{
if ($this->user->role == Users_Model_User::ROLE_ADMIN) {
throw new Monkeys_AccessDeniedException();
}
}
public function indexAction()
{
$this->_helper->actionStack('index', 'login', 'users');

View File

@ -182,6 +182,10 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
public function confirmdeleteAction()
{
if ($this->user->role == Users_Model_User::ROLE_ADMIN) {
throw new Monkeys_AccessDeniedException();
}
$this->_helper->actionStack('index', 'login', 'users');
}

View File

@ -120,6 +120,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
|| !($user = $users->getUserWithToken($this->_request->getParam('token')))) {
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid token'));
$this->_redirect('');
return;
}
$this->view->token = $user->token;
@ -148,6 +149,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
Zend_Registry::get('logger')->log('invalid token', Zend_Log::DEBUG);
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid token'));
$this->_redirect('');
return;
}
$user->delete();
@ -162,6 +164,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
|| !($user = $users->getUserWithToken($this->_request->getParam('token')))) {
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid token'));
$this->_redirect('');
return;
}
$user->role = Users_Model_User::ROLE_REGISTERED;

View File

@ -1,4 +1,4 @@
<?
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
@ -61,6 +61,7 @@ class Users_UserslistController extends CommunityID_Controller_Action
$jsonObjUser->registration = $user->registration_date;
$jsonObjUser->role = $user->role;
$jsonObjUser->status = $status;
$jsonObjUser->reminders = $user->reminders;
$jsonObj->records[] = $jsonObjUser;
}

View File

@ -1,63 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class AccountInfoForm extends Zend_Form
{
private $_targetUser;
public function __construct($options = null, $user = null)
{
$this->_targetUser = $user;
parent::__construct($options);
}
public function init()
{
$username = new Monkeys_Form_Element_Text('username');
translate('Username');
$username->setLabel('Username');
$firstname = new Monkeys_Form_Element_Text('firstname');
translate('First Name');
$firstname->setLabel('First Name')
->setRequired(true);
$lastname = new Monkeys_Form_Element_Text('lastname');
translate('Last Name');
$lastname->setLabel('Last Name')
->setRequired(true);
$email = new Monkeys_Form_Element_Text('email');
translate('E-mail');
$email->setLabel('E-mail')
->addFilter('StringToLower')
->setRequired(true)
->addValidator('EmailAddress');
$this->addElements(array($username, $firstname, $lastname, $email));
if (!$this->_targetUser->id) {
$password1 = new Monkeys_Form_Element_Password('password1');
translate('Enter password');
$password1->setLabel('Enter password')
->setRequired(true)
->addValidator(new Monkeys_Validate_PasswordConfirmation());
$password2 = new Monkeys_Form_Element_Password('password2');
translate('Enter password again');
$password2->setLabel('Enter password again')
->setRequired(true);
$this->addElements(array($password1, $password2));
}
}
}

View File

@ -1,30 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class ChangePasswordForm extends Zend_Form
{
public function init()
{
$password1 = new Monkeys_Form_Element_Password('password1');
translate('Enter password');
$password1->setLabel('Enter password')
->setRequired(true)
->addValidator(new Monkeys_Validate_PasswordConfirmation());
$password2 = new Monkeys_Form_Element_Password('password2');
translate('Enter password again');
$password2->setLabel('Enter password again')
->setRequired(true);
$this->addElements(array($password1, $password2));
}
}

View File

@ -1,22 +0,0 @@
<?php
class LoginForm extends Zend_Form
{
public function init()
{
$username = new Zend_Form_Element_Text('username');
translate('USERNAME');
$username->setLabel('USERNAME')
->setRequired(true);
$password = new Zend_Form_Element_Password('password');
translate('PASSWORD');
$password->setLabel('PASSWORD')
->setRequired(true);
$rememberme = new Zend_Form_Element_Checkbox('rememberme');
$rememberme->setLabel('Remember me');
$this->addElements(array($username, $password, $rememberme));
}
}

View File

@ -1,65 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class PersonalInfoForm extends Zend_Form
{
private $_sregProps;
private $_formElements = array();
public function __construct($options = null, $user = null, $sregProps = null)
{
$this->_sregProps = $sregProps;
$fields = new Fields();
$fieldsArr = $fields->getValues($user);
for ($i = 0; $i < count($fieldsArr); $i++) {
$this->_formElements[$fieldsArr[$i]->openid] = array(
'field' => $fieldsArr[$i],
'element' => $fieldsArr[$i]->getFormElement(),
);
}
parent::__construct($options);
}
public function init()
{
if ($this->_sregProps) {
foreach ($this->_sregProps as $fieldName => $mandatory) {
if (isset($this->_formElements[$fieldName])) {
$element = $this->_formElements[$fieldName]['element'];
if ($mandatory) {
// override label
$element->setLabel($this->_formElements[$fieldName]['field']->name);
$element->setRequired(true);
}
} else {
$element = new Monkeys_Form_Element_Text("openid.sreg.$fieldName");
$element->setLabel($fieldName);
if ($mandatory) {
$element->setRequired(true);
}
}
// user openid standard notation for the field names, instead of
// our field IDs.
$element->setName('openid_sreg_' . $fieldName);
$this->addElement($element);
}
} else {
foreach ($this->_formElements as $formElement) {
$this->addElement($formElement['element']);
}
}
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class RecoverPasswordForm extends Zend_Form
{
public function init()
{
$email = new Zend_Form_Element_Text('email');
$email->setLabel('')
->addFilter('StringToLower')
->setRequired(true)
->addValidator('EmailAddress');
$this->addElement($email);
}
}

View File

@ -1,76 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class RegisterForm extends Zend_Form
{
private $_baseWebDir;
public function __construct($options = null, $baseWebDir = null)
{
$this->_baseWebDir = $baseWebDir;
parent::__construct($options);
}
public function init()
{
$firstName = new Monkeys_Form_Element_Text('firstname');
translate('First Name');
$firstName->setLabel('First Name')
->setRequired(true);
$lastName = new Monkeys_Form_Element_Text('lastname');
translate('Last Name');
$lastName->setLabel('Last Name')
->setRequired(true);
$email = new Monkeys_Form_Element_Text('email');
translate('E-mail');
$email->setLabel('E-mail')
->addFilter('StringToLower')
->setRequired(true)
->addValidator('EmailAddress');
$username = new Monkeys_Form_Element_Text('username');
translate('Username');
$username->setLabel('Username')
->setRequired(true);
$password1 = new Monkeys_Form_Element_Password('password1');
translate('Enter desired password');
$password1->setLabel('Enter desired password')
->setRequired(true)
->addValidator(new Monkeys_Validate_PasswordConfirmation());
$password2 = new Monkeys_Form_Element_Password('password2');
translate('Enter password again');
$password2->setLabel('Enter password again')
->setRequired(true);
// ZF has some bugs when using mutators here, so I have to use the config array
translate('Please enter the text below');
$captcha = new Monkeys_Form_Element_Captcha('captcha', array(
'label' => 'Please enter the text below',
'captcha' => array(
'captcha' => 'Image',
'sessionClass' => get_class(Zend_Registry::get('appSession')),
'font' => APP_DIR . '/libs/Monkeys/fonts/Verdana.ttf',
'imgDir' => WEB_DIR. '/captchas',
'imgUrl' => $this->_baseWebDir . '/captchas',
'wordLen' => 4,
'fontSize' => 30,
'timeout' => 300,
)
));
$this->addElements(array($firstName, $lastName, $email, $username, $password1, $password2, $captcha));
}
}

View File

@ -1,53 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
* @license http://creativecommons.org/licenses/BSD/ BSD License
* @author Keyboard Monkeys Ltd.
* @since Textroller 0.9
* @package TextRoller
* @packager Keyboard Monkeys
*/
class OpenIdUser extends Zend_OpenId_Provider_User
{
private $_auth;
private $_user;
public function __construct()
{
$this->_auth = Zend_Auth::getInstance();
}
public function setLoggedInUser($id)
{
$users = new Users();
$this->_user = $users->getuserWithOpenId($id);
$this->_auth->getStorage()->write($this->_user);
}
public function getLoggedInUser()
{
$users = new Users();
if ($this->_auth->hasIdentity()) {
$user = $this->_auth->getStorage()->read();
$user->init();
// reactivate row as live data
$user->setTable($users);
return $user->openid;
}
return false;
}
public function delLoggedInUser()
{
$this->_auth->clearIdentity();
return true;
}
}

View File

@ -27,7 +27,7 @@ class Users_Model_Users extends Monkeys_Db_Table_Gateway
'status' => array('accepted_eula', 'registration_date', 'firstname', 'lastname'),
);
public function createRow()
public function createRow(array $data = array(), $defaultSource = null)
{
return parent::createRow(array(
'openid' => '',
@ -176,7 +176,7 @@ class Users_Model_Users extends Monkeys_Db_Table_Gateway
public function getUnconfirmedUsers($olderThanDays)
{
$date = date('Y-m-d', strtotime("$olderThanDays days ago"));
$date = date('Y-m-d 23:59:59', strtotime("$olderThanDays days ago"));
$select = $this->select()
->where('accepted_eula=0')
->where('registration_date < ?', $date);
@ -184,7 +184,7 @@ class Users_Model_Users extends Monkeys_Db_Table_Gateway
return $this->fetchAll($select);
}
public function deleteUser(User $user)
public function deleteUser(Users_Model_User $user)
{
$where = $this->getAdapter()->quoteInto('id=?', $user->id);
$this->delete($where);
@ -424,5 +424,22 @@ class Users_Model_Users extends Monkeys_Db_Table_Gateway
'PRIMARY_POSITION' => NULL,
'IDENTITY' => false,
),
'reminders' =>
array (
'SCHEMA_NAME' => NULL,
'TABLE_NAME' => 'users',
'COLUMN_NAME' => 'reminders',
'COLUMN_POSITION' => 14,
'DATA_TYPE' => 'int',
'DEFAULT' => '0',
'NULLABLE' => false,
'LENGTH' => NULL,
'SCALE' => NULL,
'PRECISION' => NULL,
'UNSIGNED' => NULL,
'PRIMARY' => false,
'PRIMARY_POSITION' => NULL,
'IDENTITY' => false,
),
);
}

View File

@ -4,19 +4,21 @@
</h3>
<ul>
<li>
<a href="<?php echo $this->base ?>/users/profile"><?= $this->translate('Account') ?></a>
<a href="<?php echo $this->base ?>/users/profile"><?php echo $this->translate('Account') ?></a>
</li>
<?php if ($this->user->role == Users_Model_User::ROLE_REGISTERED): ?>
<li>
<a href="<?php echo $this->base ?>/users/personalinfo"><?php echo $this->translate('Personal Info') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/sites"><?php echo $this->translate('Sites database') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/history"><?php echo $this->translate('History Log') ?></a>
</li>
<?php endif ?>
<li>
<a href="<?php echo $this->base ?>/users/personalinfo"><?= $this->translate('Personal Info') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/sites"><?= $this->translate('Sites database') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/history"><?= $this->translate('History Log') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/users/login/logout"><?= $this->translate('Logout') ?></a>
<a href="<?php echo $this->base ?>/users/login/logout"><?php echo $this->translate('Logout') ?></a>
</li>
</ul>
<?php if ($this->user->role == Users_Model_User::ROLE_ADMIN): ?>
@ -24,23 +26,23 @@
<h3><?php echo $this->translate('Admin options') ?></h3>
<ul>
<li>
<a href="<?php echo $this->base ?>/users/manageusers"><?= $this->translate('Manage Users') ?></a>
<a href="<?php echo $this->base ?>/users/manageusers"><?php echo $this->translate('Manage Users') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/messageusers"><?= $this->translate('Message Users') ?></a>
<a href="<?php echo $this->base ?>/messageusers"><?php echo $this->translate('Message Users') ?></a>
</li>
<li>
<?php if ($this->maintenanceEnabled): ?>
<a href="<?php echo $this->base ?>/maintenancemode/disable"><?= $this->translate('Disable Maintenance Mode') ?></a>
<a href="<?php echo $this->base ?>/maintenancemode/disable"><?php echo $this->translate('Disable Maintenance Mode') ?></a>
<?php else: ?>
<a href="<?php echo $this->base ?>/maintenancemode/enable"><?= $this->translate('Enable Maintenance Mode') ?></a>
<a href="<?php echo $this->base ?>/maintenancemode/enable"><?php echo $this->translate('Enable Maintenance Mode') ?></a>
<?php endif ?>
</li>
<li>
<a href="<?php echo $this->base ?>/stats"><?= $this->translate('Statistics') ?></a>
<a href="<?php echo $this->base ?>/stats"><?php echo $this->translate('Statistics') ?></a>
</li>
<li>
<a href="<?php echo $this->base ?>/cid"><?= $this->translate('About Community-ID') ?></a>
<a href="<?php echo $this->base ?>/cid"><?php echo $this->translate('About Community-ID') ?></a>
</li>
</ul>
<?php endif ?>
@ -70,7 +72,7 @@
</script>
</div>
<p>
<a href="<?php echo $this->base ?>/users/recoverpassword" class="panel_link"><?= $this->translate('Forgot you password?') ?></a>
<a href="<?php echo $this->base ?>/users/recoverpassword" class="panel_link"><?php echo $this->translate('Forgot you password?') ?></a>
</p>
</form>
<hr/>
@ -78,7 +80,7 @@
<p>
<?php echo $this->translate('You don\'t have an account?') ?>
<div>
<a href="<?php echo $this->base ?>/users/register"><?= $this->translate('REGISTER NOW!') ?></a>
<a href="<?php echo $this->base ?>/users/register"><?php echo $this->translate('REGISTER NOW!') ?></a>
</div>
</p>&nbsp;<!-- safari bug workaround -->
</div>

View File

@ -31,7 +31,7 @@ YAHOO.util.Event.onDOMReady(function () {
<?php echo $this->translate('Total unconfirmed users:') ?> <span id="totalUnconfirmedUsers"></span><br />
</div>
<div style="margin-top:10px">
<input type="button" id="addUser" value="<?php echo $this->translate('Add User') ?>" onclick="location.href='<?= $this->base ?>/users/profile?userid=0'" />
<input type="button" id="addUser" value="<?php echo $this->translate('Add User') ?>" onclick="location.href='<?php echo $this->base ?>/users/profile?userid=0'" />
<span id="deleteUnconfirmedSpan">
<input type="button" id="deleteUnconfirmed" value="<?php echo $this->translate('Delete Unconfirmed Users') ?>" />
</span>

View File

@ -34,9 +34,11 @@ YAHOO.util.Event.onDOMReady(function () {
<?php if ($this->targetUser->id && $this->targetUser->id == $this->user->id): ?>
<div class="accountForm">
<div class="linksTopRight" >
<a href="<?php echo $this->base ?>/users/profilegeneral/confirmdelete">
<?php echo $this->translate('Delete Account') ?>
</a>
<?php if ($this->user->role == Users_Model_User::ROLE_REGISTERED): ?>
<a href="<?php echo $this->base ?>/users/profilegeneral/confirmdelete">
<?php echo $this->translate('Delete Account') ?>
</a>
<?php endif ?>
<img id="loadingAccountInfoDummy" src="<?php echo $this->base ?>/images/progress.gif" style="visibility:hidden" /><!-- just for layout -->
</div>
</div>

View File

@ -20,7 +20,7 @@
<label for="reason_comments"><?php echo $this->translate('Additional comments:') ?></label>
<textarea id="reason_comments" name="reason_comments"></textarea><br />
<input type="submit" id="delete" value="<?php echo $this->translate('Delete Account') ?>" />
<input type="button" id="cancel" value="<?php echo $this->translate('Cancel') ?>" onclick="location.href='<?= $this->base ?>/users/profile'" />
<input type="button" id="cancel" value="<?php echo $this->translate('Cancel') ?>" onclick="location.href='<?php echo $this->base ?>/users/profile'" />
<script type="text/javascript">
var oButton = new YAHOO.widget.Button("delete");
var oButton = new YAHOO.widget.Button(