import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -54,9 +54,9 @@ class FeedbackController extends CommunityID_Controller_Action
|
||||
|
||||
try {
|
||||
$mail->send();
|
||||
$this->_helper->FlashMessenger->addMessage('Thank you for your interest. Your message has been routed.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Thank you for your interest. Your message has been routed.'));
|
||||
} catch (Zend_Mail_Protocol_Exception $e) {
|
||||
$this->_helper->FlashMessenger->addMessage('Sorry, the feedback couldn\'t be delivered. Please try again later.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Sorry, the feedback couldn\'t be delivered. Please try again later.'));
|
||||
if ($this->_config->logging->level == Zend_Log::DEBUG) {
|
||||
$this->_helper->FlashMessenger->addMessage($e->getMessage());
|
||||
}
|
||||
@ -90,7 +90,7 @@ class FeedbackController extends CommunityID_Controller_Action
|
||||
Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail());
|
||||
}
|
||||
|
||||
$mail = new Zend_Mail();
|
||||
$mail = new Zend_Mail('UTF-8');
|
||||
$mail->setBodyText(<<<EOD
|
||||
Dear Administrator,
|
||||
|
||||
|
@ -11,6 +11,13 @@
|
||||
|
||||
class HistoryController 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');
|
||||
|
@ -67,7 +67,7 @@ class MessageusersController extends CommunityID_Controller_Action
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
foreach ($users->getUsers() as $user) {
|
||||
if ($user->role == ROLE_ADMIN) {
|
||||
if ($user->role == Users_Model_User::ROLE_ADMIN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
|
||||
if (!$request) {
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
$this->_response->setRawHeader('HTTP/1.0 403 Forbidden');
|
||||
Zend_Registry::get('logger')->log("OpenIdController::providerAction: FORBIDDEN", Zend_Log::DEBUG);
|
||||
echo 'Forbidden';
|
||||
return;
|
||||
@ -159,7 +159,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$this->view->policyUrl = false;
|
||||
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require 'libs/Auth/OpenID/SReg.php';
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
@ -203,7 +203,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$response = $request->answer(true, null, $id);
|
||||
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require 'libs/Auth/OpenID/SReg.php';
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
@ -226,7 +226,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
|
||||
// not planning on validating stuff here yet, but I call this
|
||||
// for the date element to be filled properly
|
||||
$personalInfoForm->isValid($formData);
|
||||
$foo = $personalInfoForm->isValid($formData);
|
||||
|
||||
$sregResponse = Auth_OpenID_SRegResponse::extractResponse($sregRequest,
|
||||
$personalInfoForm->getUnqualifiedValues());
|
||||
@ -261,11 +261,15 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$webresponse = $server->encodeResponse($response);
|
||||
|
||||
foreach ($webresponse->headers as $k => $v) {
|
||||
header("$k: $v");
|
||||
if ($k == 'location') {
|
||||
$this->_response->setRedirect($v);
|
||||
} else {
|
||||
$this->_response->setHeader($k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
header('Connection: close');
|
||||
echo $webresponse->body;
|
||||
$this->_response->setHeader('Connection', 'close');
|
||||
$this->_response->appendBody($webresponse->body);
|
||||
} elseif ($this->_getParam('deny')) {
|
||||
if ($this->_getParam('forever')) {
|
||||
$sites = new Model_Sites();
|
||||
@ -281,10 +285,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
|
||||
$this->_saveHistory($request->trust_root, Model_History::DENIED);
|
||||
|
||||
header('HTTP/1.1 302 Found');
|
||||
header('Content-Type: text/plain; charset=us-ascii');
|
||||
header('Connection: close');
|
||||
header('Location: ' . $request->getCancelUrl());
|
||||
return $this->_sendResponse($server, $request->answer(false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,16 +318,20 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$webresponse = $server->encodeResponse($response);
|
||||
|
||||
if ($webresponse->code != AUTH_OPENID_HTTP_OK) {
|
||||
header(sprintf("HTTP/1.1 %d ", $webresponse->code), true, $webresponse->code);
|
||||
$this->_response->setRawHeader(sprintf("HTTP/1.1 %d ", $webresponse->code), true, $webresponse->code);
|
||||
}
|
||||
|
||||
foreach ($webresponse->headers as $k => $v) {
|
||||
header("$k: $v");
|
||||
if ($k == 'location') {
|
||||
$this->_response->setRedirect($v);
|
||||
} else {
|
||||
$this->_response->setHeader($k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
header('Connection: close');
|
||||
$this->_response->setHeader('Connection', 'close');
|
||||
|
||||
echo $webresponse->body;
|
||||
$this->_response->appendBody($webresponse->body);
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,13 @@
|
||||
|
||||
class SitesController 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');
|
||||
|
@ -48,7 +48,7 @@ class Form_Feedback extends Zend_Form
|
||||
'captcha' => 'Image',
|
||||
'sessionClass' => get_class(Zend_Registry::get('appSession')),
|
||||
'font' => APP_DIR . '/libs/Monkeys/fonts/Verdana.ttf',
|
||||
'imgDir' => APP_DIR . '/webdir/captchas',
|
||||
'imgDir' => WEB_DIR . '/captchas',
|
||||
'imgUrl' => $this->_baseWebDir . '/captchas',
|
||||
'wordLen' => 4,
|
||||
'fontSize' => 30,
|
||||
|
@ -1,61 +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 Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class FeedbackForm extends Zend_Form
|
||||
{
|
||||
private $_baseWebDir;
|
||||
|
||||
public function __construct($options = null, $baseWebDir = null)
|
||||
{
|
||||
$this->_baseWebDir = $baseWebDir;
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$name = new Monkeys_Form_Element_Text('name');
|
||||
translate('Enter your name');
|
||||
$name->setLabel('Enter your name')
|
||||
->setRequired(true);
|
||||
|
||||
$email = new Monkeys_Form_Element_Text('email');
|
||||
translate('Enter your E-mail');
|
||||
$email->setLabel('Enter your E-mail')
|
||||
->addFilter('StringToLower')
|
||||
->setRequired(true)
|
||||
->addValidator('EmailAddress');
|
||||
|
||||
$feedback = new Monkeys_Form_Element_Textarea('feedback');
|
||||
translate('Enter your questions or comments');
|
||||
$feedback->setLabel('Enter your questions or comments')
|
||||
->setRequired(true)
|
||||
->setAttrib('cols', 60)
|
||||
->setAttrib('rows', 4);
|
||||
|
||||
// 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' => APP_DIR . '/webdir/captchas',
|
||||
'imgUrl' => $this->_baseWebDir . '/captchas',
|
||||
'wordLen' => 4,
|
||||
'fontSize' => 30,
|
||||
'timeout' => 300,
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElements(array($name, $email, $feedback, $captcha));
|
||||
}
|
||||
}
|
@ -14,12 +14,12 @@ class Form_MessageUsers extends Zend_Form
|
||||
public function init()
|
||||
{
|
||||
$subject = new Monkeys_Form_Element_Text('subject');
|
||||
translate('Subject:');
|
||||
translate('Subject');
|
||||
$subject->setLabel('Subject')
|
||||
->setRequired(true);
|
||||
|
||||
$cc = new Monkeys_Form_Element_Text('cc');
|
||||
translate('CC:');
|
||||
translate('CC');
|
||||
$cc->setLabel('CC');
|
||||
|
||||
$bodyPlain = new Monkeys_Form_Element_Textarea('bodyPlain');
|
||||
|
@ -1,34 +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 Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class MessageUsersForm extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$subject = new Zend_Form_Element_Text('subject');
|
||||
translate('Subject:');
|
||||
$subject->setLabel('Subject:')
|
||||
->setRequired(true);
|
||||
|
||||
$cc = new Zend_Form_Element_Text('cc');
|
||||
translate('CC:');
|
||||
$cc->setLabel('CC:');
|
||||
|
||||
$bodyPlain = new Zend_Form_Element_Textarea('bodyPlain');
|
||||
translate('Body:');
|
||||
$bodyPlain->setLabel('Body:');
|
||||
|
||||
$bodyHTML = new Zend_Form_Element_Textarea('bodyHTML');
|
||||
$bodyHTML->setLabel('Body:');
|
||||
|
||||
$this->addElements(array($subject, $cc, $bodyPlain, $bodyHTML));
|
||||
}
|
||||
}
|
@ -1,28 +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 Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class OpenIdLoginForm extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$openIdIdentity = new Zend_Form_Element_Text('openIdIdentity');
|
||||
translate('Username');
|
||||
$openIdIdentity->setLabel('Username')
|
||||
->setRequired(true);
|
||||
|
||||
$password = new Zend_Form_Element_Password('password');
|
||||
translate('Password');
|
||||
$password->setLabel('Password')
|
||||
->setRequired(true);
|
||||
|
||||
$this->addElements(array($openIdIdentity, $password));
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ class Model_Field extends Zend_Db_Table_Row_Abstract
|
||||
break;
|
||||
case self::TYPE_DATE:
|
||||
$el = new Monkeys_Form_Element_Date($varname);
|
||||
$el->addValidator('date')
|
||||
$el->addValidator('date', false, array('format_type' => 'Y-m-d'))
|
||||
->setShowEmptyValues(true)
|
||||
->setStartEndYear(1900, date('Y') - 7)
|
||||
->setReverseYears(true);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h2><?php echo $this->translate('About Community-id') ?></h2>
|
||||
<h2><?php echo $this->translate('About Community-ID') ?></h2>
|
||||
<div>
|
||||
<label><?php echo $this->translate('Version installed:') ?></label>
|
||||
<?php echo $this->version ?>
|
||||
@ -12,7 +12,7 @@
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $item->link ?>"><?= $item->title ?></a>
|
||||
<a href="<?php echo $item->link ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->content ?>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="article">
|
||||
This is the identity page for the Community-ID user identified with:
|
||||
<?= $this->translate('This is the identity page for the Community-ID user identified with:') ?>
|
||||
<h2 style="text-align:center"><?php echo $this->idUrl ?></h2>
|
||||
</div>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?= $item->title ?></a>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?= $item->title ?></a>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<ul>
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?= $item->title ?></a>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?= $item->title ?></a>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
|
@ -51,6 +51,7 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$this->_importDb();
|
||||
$this->_createAdmin($form);
|
||||
|
||||
if (!$this->_writeConfig($form)) {
|
||||
throw new Exception('Couldn\'t write to config file ' . APP_DIR . DIRECTORY_SEPARATOR . 'config.php');
|
||||
@ -142,6 +143,22 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
$this->_runSqlFILE('final.sql');
|
||||
}
|
||||
|
||||
private function _createAdmin(Install_Form_Install $form)
|
||||
{
|
||||
$users = new Users_Model_Users();
|
||||
$user = $users->createRow();
|
||||
$user->username = $form->getValue('adminUsername');
|
||||
$user->accepted_eula = 1;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->openid = '';
|
||||
$user->setClearPassword($form->getValue('password1'));
|
||||
$user->firstname = 'Admin';
|
||||
$user->lastname = 'User';
|
||||
$user->email = $form->getValue('supportemail');
|
||||
$user->role = Users_Model_User::ROLE_ADMIN;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
function _runSqlFile($fileName) {
|
||||
$fp = fopen(APP_DIR . DIRECTORY_SEPARATOR . "/setup/$fileName", 'r');
|
||||
$query = '';
|
||||
|
@ -71,6 +71,11 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
$upgradedVersion = $this->_runUpgrades(false);
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Upgrade was successful. You are now on version %s', $upgradedVersion));
|
||||
|
||||
// we need to logout user in case the user table changed
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
Zend_Session::forgetMe();
|
||||
|
||||
$this->_redirect('/');
|
||||
}
|
||||
|
||||
|
@ -14,31 +14,53 @@ class Install_Form_Install extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$hostname = new Zend_Form_Element_Text('hostname');
|
||||
$hostname->setLabel('Hostname:')
|
||||
$hostname = new Monkeys_Form_Element_Text('hostname');
|
||||
$hostname->setLabel('Hostname')
|
||||
->setDescription('usually localhost')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setValue('localhost');
|
||||
|
||||
$dbname = new Zend_Form_Element_Text('dbname');
|
||||
$dbname->setLabel('Database name:')
|
||||
$dbname = new Monkeys_Form_Element_Text('dbname');
|
||||
$dbname->setLabel('Database name')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setValue(Zend_Registry::get('config')->database->params->dbname);
|
||||
|
||||
$dbusername = new Zend_Form_Element_Text('dbusername');
|
||||
$dbusername->setLabel('Database username:')
|
||||
->setRequired(true);
|
||||
$dbusername = new Monkeys_Form_Element_Text('dbusername');
|
||||
$dbusername->setLabel('Database username')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$dbpassword = new Zend_Form_Element_Password('dbpassword');
|
||||
$dbpassword->setLabel('Database password:');
|
||||
$dbpassword = new Monkeys_Form_Element_Password('dbpassword');
|
||||
$dbpassword->setLabel('Database password');
|
||||
|
||||
$supportemail = new Zend_Form_Element_Text('supportemail');
|
||||
$supportemail->setLabel('Support E-mail:')
|
||||
$supportemail = new Monkeys_Form_Element_Text('supportemail');
|
||||
$supportemail->setLabel('Support E-mail')
|
||||
->setDescription('Will be used as the sender for any message sent by the system, and as the recipient for user feedback')
|
||||
->addFilter('StringToLower')
|
||||
->addValidator('EmailAddress')
|
||||
->setRequired(true);
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$this->addElements(array($hostname, $dbname, $dbusername, $dbpassword, $supportemail));
|
||||
$adminUsername = new Monkeys_Form_Element_Text('adminUsername');
|
||||
$adminUsername->setLabel('Username')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$password1 = new Monkeys_Form_Element_Password('password1');
|
||||
$password1->setLabel('Enter password')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation());
|
||||
|
||||
$password2 = new Monkeys_Form_Element_Password('password2');
|
||||
$password2->setLabel('Enter password again')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
|
||||
$this->addElements(array($hostname, $dbname, $dbusername, $dbpassword, $supportemail,
|
||||
$adminUsername, $password1, $password2));
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +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 InstallForm extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$hostname = new Zend_Form_Element_Text('hostname');
|
||||
$hostname->setLabel('Hostname:')
|
||||
->setDescription('usually localhost')
|
||||
->setRequired(true)
|
||||
->setValue('localhost');
|
||||
|
||||
$dbname = new Zend_Form_Element_Text('dbname');
|
||||
$dbname->setLabel('Database name:')
|
||||
->setRequired(true)
|
||||
->setValue(Zend_Registry::get('config')->database->params->dbname);
|
||||
|
||||
$dbusername = new Zend_Form_Element_Text('dbusername');
|
||||
$dbusername->setLabel('Database username:')
|
||||
->setRequired(true);
|
||||
|
||||
$dbpassword = new Zend_Form_Element_Password('dbpassword');
|
||||
$dbpassword->setLabel('Database password:');
|
||||
|
||||
$supportemail = new Zend_Form_Element_Text('supportemail');
|
||||
$supportemail->setLabel('Support E-mail:')
|
||||
->setDescription('Will be used as the sender for any message sent by the system, and as the recipient for user feedback')
|
||||
->addFilter('StringToLower')
|
||||
->addValidator('EmailAddress')
|
||||
->setRequired(true);
|
||||
|
||||
$this->addElements(array($hostname, $dbname, $dbusername, $dbpassword, $supportemail));
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
<h3>
|
||||
<?php echo $this->translate('The installation was performed successfully') ?>
|
||||
<?= $this->translate('The installation was performed successfully') ?>
|
||||
</h3>
|
||||
<div style="margin-top:20px">
|
||||
<div>
|
||||
You can login as the administrator with the username "admin" and the password "admin"<br />
|
||||
Please note that this user is only meant for administrative tasks, and cannot have an OpenID credential.
|
||||
<?= $this->translate('You can login as the administrator with the username and password you just provided.') ?><br />
|
||||
<?= $this->translate('Please note that this user is only meant for administrative tasks, and cannot have an OpenID credential.') ?>
|
||||
</div>
|
||||
<div style="margin-top:20px">
|
||||
<input type="button" id="start" value="<?php echo $this->translate('Finish') ?>" />
|
||||
@ -13,7 +13,7 @@
|
||||
var oButton = new YAHOO.widget.Button(
|
||||
"start",
|
||||
{
|
||||
onclick: {fn: function() {location.href="<?php echo $this->base ?>"}}
|
||||
onclick: {fn: function() {location.href="<?php echo $this->base ?>/"}}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
@ -1,14 +1,22 @@
|
||||
<h3>
|
||||
<?php echo $this->translate('Database and E-mail information') ?>
|
||||
</h3>
|
||||
<form name="installform" method="post" action="<?php echo $this->base ?>/install/credentials/save" class="longLabelsForm">
|
||||
<dl>
|
||||
<form name="installform" method="post" action="<?php echo $this->base ?>/install/credentials/save" class="formGrid">
|
||||
<h3>
|
||||
<?php echo $this->translate('Database and E-mail information') ?>
|
||||
</h3>
|
||||
<div class="yui-gf" style="margin-top:20px">
|
||||
<?php echo $this->form->hostname ?>
|
||||
<?php echo $this->form->dbname ?>
|
||||
<?php echo $this->form->dbusername ?>
|
||||
<?php echo $this->form->dbpassword ?>
|
||||
<?php echo $this->form->supportemail ?>
|
||||
</dl>
|
||||
</div>
|
||||
<h3>
|
||||
<?php echo $this->translate('Administrator User Information') ?>
|
||||
</h3>
|
||||
<div class="yui-gf" style="margin-top:20px">
|
||||
<?php echo $this->form->adminUsername ?>
|
||||
<?php echo $this->form->password1 ?>
|
||||
<?php echo $this->form->password2 ?>
|
||||
</div>
|
||||
<input type="submit" id="send" value="<?php echo $this->translate('Send') ?>" />
|
||||
<script type="text/javascript">
|
||||
var oButton = new YAHOO.widget.Button("send");
|
||||
|
@ -57,7 +57,7 @@ class News_EditController extends CommunityID_Controller_Action
|
||||
$news = new News_Model_News();
|
||||
if ($this->_getParam('id')) {
|
||||
if (!$article = $news->getRowInstance($this->_getParam('id'))) {
|
||||
$this->_helper->FlashMessenger->addMessage('Article doesn\'t exist.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The article doesn\'t exist.'));
|
||||
$this->_redirect('/news');
|
||||
return;
|
||||
}
|
||||
@ -78,7 +78,7 @@ class News_EditController extends CommunityID_Controller_Action
|
||||
$article->content = $cleanHtml;
|
||||
$article->save();
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage('The article has been saved.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The article has been saved.'));
|
||||
|
||||
$this->_redirect('/news');
|
||||
}
|
||||
@ -87,10 +87,10 @@ class News_EditController extends CommunityID_Controller_Action
|
||||
{
|
||||
$news = new News_Model_News();
|
||||
if (!$article = $news->getRowInstance($this->_getParam('id'))) {
|
||||
$this->_helper->FlashMessenger->addMessage('The article doesn\'t exist.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The article doesn\'t exist.'));
|
||||
} else {
|
||||
$article->delete();
|
||||
$this->_helper->FlashMessenger->addMessage('The article has been deleted.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The article has been deleted.'));
|
||||
}
|
||||
|
||||
$this->_redirect('/news');
|
||||
|
@ -1,5 +1,5 @@
|
||||
<form method="post" action="<?php echo $this->base ?>/news/edit/save" class="formGrid">
|
||||
<input type="hidden" name="id" value="<?= $this->articleId ?>" />
|
||||
<input type="hidden" name="id" value="<?php echo $this->articleId ?>" />
|
||||
<?php echo $this->articleForm->title ?>
|
||||
<?php echo $this->articleForm->excerpt ?>
|
||||
<?php echo $this->articleForm->date ?>
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if (count($this->paginator) == 0): ?>
|
||||
<div><?= $this->translate('There are no news articles yet') ?></div>
|
||||
<div><?php echo $this->translate('There are no news articles yet') ?></div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($this->paginator as $article): ?>
|
||||
<div class="post">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h2><?= $this->escape($this->article->title) ?></h2>
|
||||
<h2><?php echo $this->escape($this->article->title) ?></h2>
|
||||
<div class="article_date">
|
||||
<?php echo $this->translate('Published on %s', $this->article->date) ?>
|
||||
<?php if ($this->user->role == Users_Model_User::ROLE_ADMIN): ?>
|
||||
@ -8,7 +8,7 @@
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<p><?= $this->escape($this->article->excerpt) ?></p>
|
||||
<p><?php echo $this->escape($this->article->excerpt) ?></p>
|
||||
<hr />
|
||||
<div>
|
||||
<?php echo $this->article->content ?>
|
||||
|
@ -79,7 +79,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
|
||||
private function _populateWeekData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time());
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time(), true);
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
@ -96,7 +96,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
|
||||
private function _populateMonthData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'));
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'), true);
|
||||
|
||||
for ($i = -30; $i < -7; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
@ -114,7 +114,7 @@ class Stats_RegistrationsController extends CommunityID_Controller_Action
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
|
||||
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time(), true);
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
|
@ -25,7 +25,7 @@ class Stats_Model_Stats
|
||||
/**
|
||||
* @return Array
|
||||
*/
|
||||
public function getNumRegisteredUsersDays($unixDateStart, $unixDateEnd)
|
||||
public function getNumRegisteredUsersDays($unixDateStart, $unixDateEnd, $countUnconfirmed = false)
|
||||
{
|
||||
$select = $this->_db->select()->from('users', array('registration_date' => 'registration_date', 'users' => 'COUNT(registration_date)'))
|
||||
->where('registration_date >= ?', strftime('%Y-%m-%d', $unixDateStart))
|
||||
@ -33,13 +33,17 @@ class Stats_Model_Stats
|
||||
->group('registration_date')
|
||||
->order('registration_date');
|
||||
|
||||
if (!$countUnconfirmed) {
|
||||
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
|
||||
}
|
||||
|
||||
return $this->_db->fetchAssoc($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Array
|
||||
*/
|
||||
public function getNumRegisteredUsersYear($unixDateStart, $unixDateEnd)
|
||||
public function getNumRegisteredUsersYear($unixDateStart, $unixDateEnd, $countUnconfirmed = false)
|
||||
{
|
||||
$select = $this->_db->select()->from('users', array('registration_date' => 'MONTH(registration_date)', 'users' => 'COUNT(MONTH(registration_date))'))
|
||||
->where('registration_date >= ?', strftime('%Y-%m-%d', $unixDateStart))
|
||||
@ -47,17 +51,25 @@ class Stats_Model_Stats
|
||||
->group('MONTH(registration_date)')
|
||||
->order('registration_date');
|
||||
|
||||
if (!$countUnconfirmed) {
|
||||
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
|
||||
}
|
||||
|
||||
return $this->_db->fetchAssoc($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNumRegisteredUsers($unixDate)
|
||||
public function getNumRegisteredUsers($unixDate, $countUnconfirmed = false)
|
||||
{
|
||||
$select = $this->_db->select()->from('users')
|
||||
->where('registration_date < ?', strftime('%Y-%m-%d', $unixDate));
|
||||
|
||||
if (!$countUnconfirmed) {
|
||||
$select = $select->where('users.role != ?', Users_Model_User::ROLE_GUEST);
|
||||
}
|
||||
|
||||
|
||||
$statement = $this->_db->prepare($select);
|
||||
$statement->execute();
|
||||
|
@ -2,9 +2,9 @@
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('authorizations', 'statsAuths', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/authorizations/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
|
||||
<img src="<?php echo $this->base ?>/stats/authorizations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('registrations', 'statsRegs', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
|
||||
<option value="month" <?php echo $this->monthSelected ?>><?= $this->translate('Last Month') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="month" <?php echo $this->monthSelected ?>><?php echo $this->translate('Last Month') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/registrations/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
|
||||
<img src="<?php echo $this->base ?>/stats/registrations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
||||
|
@ -2,8 +2,8 @@
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('sites', 'statsNumTrustedSites', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?= $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?= $this->translate('Last Year') ?></option>
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/sites/graph?rand=<?= $this->rand ?>&type=<?= $this->type ?>" />
|
||||
<img src="<?php echo $this->base ?>/stats/sites/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
||||
|
@ -80,6 +80,7 @@ class Users_LoginController extends CommunityID_Controller_Action
|
||||
public function logoutAction()
|
||||
{
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
Zend_Session::forgetMe();
|
||||
|
||||
$this->_redirect('');
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -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> <!-- safari bug workaround -->
|
||||
</div>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user