import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
15
modules/default/controllers/ErrorController.php
Executable file → Normal file
15
modules/default/controllers/ErrorController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -11,4 +11,17 @@
|
||||
|
||||
class ErrorController extends Monkeys_Controller_Error
|
||||
{
|
||||
protected function _getTranslationForException($ex)
|
||||
{
|
||||
switch ($ex) {
|
||||
case 'Monkeys_BadUrlException':
|
||||
return $this->view->translate('The URL you entered is incorrect. Please correct and try again.');
|
||||
break;
|
||||
case 'Monkeys_AccessDeniedException':
|
||||
return $this->view->translate('Access Denied - Maybe your session has expired? Try logging-in again.');
|
||||
break;
|
||||
default:
|
||||
return $ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
2
modules/default/controllers/HistoryController.php
Executable file → Normal file
2
modules/default/controllers/HistoryController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -66,6 +66,9 @@ class MessageusersController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
|
||||
// here we get the users emails stored in the users table, even if using LDAP, for performance reasons.
|
||||
// Do know however, that a user email is synced with the LDAP repository every time he logs in.
|
||||
foreach ($users->getUsers() as $user) {
|
||||
if ($user->role == Users_Model_User::ROLE_ADMIN) {
|
||||
continue;
|
||||
@ -80,9 +83,9 @@ class MessageusersController extends CommunityID_Controller_Action
|
||||
|
||||
try {
|
||||
$mail->send();
|
||||
$this->_helper->FlashMessenger->addMessage('Message has been sent');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Message has been sent'));
|
||||
} catch (Zend_Mail_Protocol_Exception $e) {
|
||||
$this->_helper->FlashMessenger->addMessage('There was an error trying to send the message');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('There was an error trying to send the message'));
|
||||
if ($this->_config->logging->level == Zend_Log::DEBUG) {
|
||||
$this->_helper->FlashMessenger->addMessage($e->getMessage());
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -23,7 +23,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_response->setRawHeader('HTTP/1.0 403 Forbidden');
|
||||
Zend_Registry::get('logger')->log("OpenIdController::providerAction: FORBIDDEN", Zend_Log::DEBUG);
|
||||
echo 'Forbidden';
|
||||
echo $this->view->translate('Forbidden');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -37,13 +37,15 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
return $this->_sendResponse($server, $request->answer(false));
|
||||
}
|
||||
|
||||
$trustRoot = $this->_getTrustRoot($request);
|
||||
|
||||
if ($request->idSelect()) {
|
||||
if ($this->user->role == Users_Model_User::ROLE_GUEST) {
|
||||
$this->_forward('login');
|
||||
} else {
|
||||
if ($sites->isTrusted($this->user, $request->trust_root)) {
|
||||
if ($sites->isTrusted($this->user, $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('allow' => true));
|
||||
} elseif ($sites->isNeverTrusted($this->user, $request->trust_root)) {
|
||||
} elseif ($sites->isNeverTrusted($this->user, $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('allow' => false));
|
||||
} else {
|
||||
if ($request->immediate) {
|
||||
@ -69,15 +71,28 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$this->_forward('login');
|
||||
} else {
|
||||
if ($sites->isTrusted($this->user, $request->trust_root)) {
|
||||
$this->_forward('proceed', null, null, array('allow' => true));
|
||||
} elseif ($sites->isNeverTrusted($this->user, $request->trust_root)) {
|
||||
$this->_forward('proceed', null, null, array('deny' => true));
|
||||
} else {
|
||||
$this->_forward('trust');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if max_auth_age is requested through the PAPE extension
|
||||
require_once 'libs/Auth/OpenID/PAPE.php';
|
||||
if ($papeRequest = Auth_OpenID_PAPE_Request::fromOpenIDRequest($request)) {
|
||||
$extensionArgs = $papeRequest->getExtensionArgs();
|
||||
if (isset($extensionArgs['max_auth_age'])
|
||||
&& $extensionArgs['max_auth_age'] < $this->user->getSecondsSinceLastLogin())
|
||||
{
|
||||
$this->_forward('login');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sites->isTrusted($this->user, $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('allow' => true));
|
||||
} elseif ($sites->isNeverTrusted($this->user, $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('deny' => true));
|
||||
} else {
|
||||
$this->_forward('trust');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,16 +105,36 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$server = $this->_getOpenIdProvider();
|
||||
$request = $server->decodeRequest();
|
||||
|
||||
$this->view->yubikey = $this->_config->yubikey;
|
||||
|
||||
$authAttempts = new Users_Model_AuthAttempts();
|
||||
$attempt = $authAttempts->get();
|
||||
$this->view->useCaptcha = $attempt && $attempt->surpassedMaxAllowed();
|
||||
$this->view->form = new Form_OpenidLogin(null, $this->view->base, $attempt && $attempt->surpassedMaxAllowed());
|
||||
|
||||
if (!$request->idSelect()) {
|
||||
$this->view->form->openIdIdentity->setValue(htmlspecialchars($request->identity));
|
||||
if ($this->_getParam('invalidCaptcha')) {
|
||||
$this->view->form->captcha->addError($this->view->translate('Captcha value is wrong'));
|
||||
}
|
||||
|
||||
if ($this->_getParam('invalidLogin')) {
|
||||
$this->view->form->addError($this->view->translate('Invalid credentials'));
|
||||
}
|
||||
|
||||
if ($request->idSelect()) {
|
||||
$this->view->identity = false;
|
||||
$this->view->form->openIdIdentity->setRequired(true);
|
||||
} else {
|
||||
$this->view->identity = $request->identity;
|
||||
}
|
||||
|
||||
$this->view->queryString = $this->_queryString();
|
||||
|
||||
if ($this->user->role == Users_Model_User::ROLE_GUEST && @$_COOKIE['image']) {
|
||||
$images = new Users_Model_SigninImages();
|
||||
$this->view->image = $images->getByCookie($_COOKIE['image']);
|
||||
} else {
|
||||
$this->view->image = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function authenticateAction()
|
||||
@ -115,22 +150,35 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$form->populate($formData);
|
||||
|
||||
if (!$form->isValid($formData)) {
|
||||
$this->_forward('login');
|
||||
$formErrors = $form->getErrors();
|
||||
// gotta resort to pass errors as params because we don't use the session here
|
||||
if (@$formErrors['captcha']) {
|
||||
$this->_forward('login', null, null, array('invalidCaptcha' => true));
|
||||
} else {
|
||||
$this->_forward('login');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
$result = $users->authenticate($form->getValue('openIdIdentity'),
|
||||
$form->getValue('password'), true);
|
||||
$result = $users->authenticate(
|
||||
$request->idSelect()? $form->getValue('openIdIdentity') : $request->identity,
|
||||
$this->_config->yubikey->enabled && $this->_config->yubikey->force?
|
||||
$form->getValue('yubikey')
|
||||
: $form->getValue('password'),
|
||||
true,
|
||||
$this->view
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
if ($attempt) {
|
||||
$attempt->delete();
|
||||
}
|
||||
$sites = new Model_Sites();
|
||||
if ($sites->isTrusted($users->getUser(), $request->trust_root)) {
|
||||
$trustRoot = $this->_getTrustRoot($request);
|
||||
if ($sites->isTrusted($users->getUser(), $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('allow' => true));
|
||||
} elseif ($sites->isNeverTrusted($users->getUser(), $request->trust_root)) {
|
||||
} elseif ($sites->isNeverTrusted($users->getUser(), $trustRoot)) {
|
||||
$this->_forward('proceed', null, null, array('deny' => true));
|
||||
} else {
|
||||
$this->_forward('trust');
|
||||
@ -142,7 +190,7 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$attempt->addFailure();
|
||||
$attempt->save();
|
||||
}
|
||||
$this->_forward('login');
|
||||
$this->_forward('login', null, null, array('invalidLogin' => true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,38 +199,11 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$server = $this->_getOpenIdProvider();
|
||||
$request = $server->decodeRequest();
|
||||
|
||||
$this->view->siteRoot = $request->trust_root;
|
||||
$this->view->siteRoot = $this->_getTrustRoot($request);
|
||||
$this->view->identityUrl = $this->user->openid;
|
||||
$this->view->queryString = $this->_queryString();
|
||||
|
||||
$this->view->fields = array();
|
||||
$this->view->policyUrl = false;
|
||||
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
$args = $sregRequest->getExtensionArgs();
|
||||
if (isset($args['required'])) {
|
||||
$required = explode(',', $args['required']);
|
||||
} else {
|
||||
$required = false;
|
||||
}
|
||||
|
||||
if (is_array($props) && count($props) > 0) {
|
||||
$sregProps = array();
|
||||
foreach ($props as $field) {
|
||||
$sregProps[$field] = $required && in_array($field, $required);
|
||||
}
|
||||
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $this->user, $sregProps);
|
||||
$this->view->fields = $personalInfoForm->getElements();
|
||||
|
||||
if (isset($args['policy_url'])) {
|
||||
$this->view->policyUrl = $args['policy_url'];
|
||||
}
|
||||
}
|
||||
$this->view->showProfileForm = $this->_hasSreg($request);
|
||||
}
|
||||
|
||||
public function proceedAction()
|
||||
@ -202,25 +223,12 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
|
||||
$response = $request->answer(true, null, $id);
|
||||
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
$args = $sregRequest->getExtensionArgs();
|
||||
if (isset($args['required'])) {
|
||||
$required = explode(',', $args['required']);
|
||||
} else {
|
||||
$required = false;
|
||||
}
|
||||
|
||||
if (is_array($props) && count($props) > 0) {
|
||||
$sregProps = array();
|
||||
foreach ($props as $field) {
|
||||
$sregProps[$field] = $required && in_array($field, $required);
|
||||
}
|
||||
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $this->user, $sregProps);
|
||||
if ($this->_hasSreg($request)
|
||||
// profileId will be null if site is already trusted
|
||||
&& $this->_getParam('profileId')) {
|
||||
$profiles = new Users_Model_Profiles();
|
||||
$profile = $profiles->getRowInstance($this->_getParam('profileId'));
|
||||
$personalInfoForm = Users_Form_PersonalInfo::getForm($request, $profile);
|
||||
$formData = $this->_request->getPost();
|
||||
$personalInfoForm->populate($formData);
|
||||
|
||||
@ -228,20 +236,23 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
// for the date element to be filled properly
|
||||
$foo = $personalInfoForm->isValid($formData);
|
||||
|
||||
$sregResponse = Auth_OpenID_SRegResponse::extractResponse($sregRequest,
|
||||
$sregResponse = Auth_OpenID_SRegResponse::extractResponse(
|
||||
$personalInfoForm->getSregRequest(),
|
||||
$personalInfoForm->getUnqualifiedValues());
|
||||
$sregResponse->toMessage($response->fields);
|
||||
}
|
||||
|
||||
$trustRoot= $this->_getTrustRoot($request);
|
||||
|
||||
if ($this->_getParam('allow')) {
|
||||
if ($this->_getParam('forever')) {
|
||||
|
||||
$sites = new Model_Sites();
|
||||
$sites->deleteForUserSite($this->user, $request->trust_root);
|
||||
$sites->deleteForUserSite($this->user, $trustRoot);
|
||||
|
||||
$siteObj = $sites->createRow();
|
||||
$siteObj->user_id = $this->user->id;
|
||||
$siteObj->site = $request->trust_root;
|
||||
$siteObj->site = $trustRoot;
|
||||
$siteObj->creation_date = date('Y-m-d');
|
||||
|
||||
if (isset($personalInfoForm)) {
|
||||
@ -256,7 +267,12 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$siteObj->save();
|
||||
}
|
||||
|
||||
$this->_saveHistory($request->trust_root, Model_History::AUTHORIZED);
|
||||
$this->_saveHistory($trustRoot, Model_History::AUTHORIZED);
|
||||
|
||||
require_once 'libs/Auth/OpenID/PAPE.php';
|
||||
if ($papeRequest = Auth_OpenID_PAPE_Request::fromOpenIDRequest($request)) {
|
||||
$this->_processPape($papeRequest, $response);
|
||||
}
|
||||
|
||||
$webresponse = $server->encodeResponse($response);
|
||||
|
||||
@ -273,17 +289,17 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
} elseif ($this->_getParam('deny')) {
|
||||
if ($this->_getParam('forever')) {
|
||||
$sites = new Model_Sites();
|
||||
$sites->deleteForUserSite($this->user, $request->trust_root);
|
||||
$sites->deleteForUserSite($this->user, $trustRoot);
|
||||
|
||||
$siteObj = $sites->createRow();
|
||||
$siteObj->user_id = $this->user->id;
|
||||
$siteObj->site = $request->trust_root;
|
||||
$siteObj->site = $trustRoot;
|
||||
$siteObj->creation_date = date('Y-m-d');
|
||||
$siteObj->trusted = serialize(false);
|
||||
$siteObj->save();
|
||||
}
|
||||
|
||||
$this->_saveHistory($request->trust_root, Model_History::DENIED);
|
||||
$this->_saveHistory($trustRoot, Model_History::DENIED);
|
||||
|
||||
return $this->_sendResponse($server, $request->answer(false));
|
||||
}
|
||||
@ -301,15 +317,6 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$history->save();
|
||||
}
|
||||
|
||||
private function _getOpenIdProvider()
|
||||
{
|
||||
$connection = new CommunityID_OpenId_DatabaseConnection(Zend_Registry::get('db'));
|
||||
$store = new Auth_OpenID_MySQLStore($connection, 'associations', 'nonces');
|
||||
$server = new Auth_OpenID_Server($store, $this->_helper->ProviderUrl($this->_config));
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
private function _sendResponse(Auth_OpenID_Server $server, Auth_OpenID_ServerResponse $response)
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
@ -334,37 +341,37 @@ class OpenidController extends CommunityID_Controller_Action
|
||||
$this->_response->appendBody($webresponse->body);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Circumvent PHP's automatic replacement of dots by underscore in var names in $_GET and $_POST
|
||||
*/
|
||||
private function _queryString()
|
||||
private function _getTrustRoot(Auth_OpenID_Request $request)
|
||||
{
|
||||
$unfilteredVars = array_merge($_GET, $_POST);
|
||||
$varsTemp = array();
|
||||
$vars = array();
|
||||
$extensions = array();
|
||||
foreach ($unfilteredVars as $key => $value) {
|
||||
if (substr($key, 0, 10) == 'openid_ns_') {
|
||||
$extensions[] = substr($key, 10);
|
||||
$varsTemp[str_replace('openid_ns_', 'openid.ns.', $key)] = $value;
|
||||
} else {
|
||||
$varsTemp[str_replace('openid_', 'openid.', $key)] = $value;
|
||||
}
|
||||
}
|
||||
foreach ($extensions as $extension) {
|
||||
foreach ($varsTemp as $key => $value) {
|
||||
if (strpos($key, "openid.$extension") === 0) {
|
||||
$prefix = "openid.$extension.";
|
||||
$key = $prefix . substr($key, strlen($prefix));
|
||||
}
|
||||
$vars[$key] = $value;
|
||||
}
|
||||
}
|
||||
if (!$extensions) {
|
||||
$vars = $varsTemp;
|
||||
}
|
||||
$trustRoot = $request->trust_root;
|
||||
Zend_OpenId::normalizeUrl($trustRoot);
|
||||
|
||||
return '?' . http_build_query($vars);
|
||||
return $trustRoot;
|
||||
}
|
||||
|
||||
private function _hasSreg(Auth_OpenID_Request $request)
|
||||
{
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
|
||||
return (is_array($props) && count($props) > 0);
|
||||
}
|
||||
|
||||
private function _processPape(Auth_OpenID_PAPE_Request $papeRequest, $response)
|
||||
{
|
||||
if (($image = $this->user->getImage()) && @$_COOKIE['image']) {
|
||||
$cidSupportedPolicies = array(PAPE_AUTH_PHISHING_RESISTANT);
|
||||
if ($RPPreferredTypes = $papeRequest->preferredTypes($cidSupportedPolicies)) {
|
||||
$this->user->getLastLoginUtc();
|
||||
$papeResponse = new Auth_OpenID_PAPE_Response(
|
||||
$cidSupportedPolicies,
|
||||
$this->user->getLastLoginUtc()
|
||||
);
|
||||
$papeResponse->toMessage($response->fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -15,18 +15,22 @@ class PrivacyController extends CommunityID_Controller_Action
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
$scriptsDir = $this->view->getScriptPath('privacy');
|
||||
|
||||
if (file_exists(APP_DIR . "/resources/$locale/privacy.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/privacy.txt";
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
// render() changes _ to -
|
||||
$locale = str_replace('_', '-', $locale);
|
||||
$localeElements = explode('-', $locale);
|
||||
|
||||
if (file_exists("$scriptsDir/index-$locale.phtml")) {
|
||||
$view = "index-$locale";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/privacy.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/privacy.txt";
|
||||
&& file_exists("$scriptsDir/index-".$localeElements[0].".phtml")) {
|
||||
$view = 'index-'.$localeElements[0];
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/privacy.txt";
|
||||
$view = 'index-en';
|
||||
}
|
||||
|
||||
$this->view->privacyPolicy = nl2br(file_get_contents($file));
|
||||
$this->render($view);
|
||||
}
|
||||
}
|
||||
|
40
modules/default/controllers/ProfileController.php
Normal file
40
modules/default/controllers/ProfileController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 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 ProfileController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->queryString = $this->_queryString();
|
||||
|
||||
$server = $this->_getOpenIdProvider();
|
||||
$request = $server->decodeRequest();
|
||||
|
||||
$this->view->fields = array();
|
||||
$this->view->policyUrl = false;
|
||||
|
||||
$profiles = new Users_Model_Profiles();
|
||||
$this->view->profiles = $profiles->getForUser($this->user);
|
||||
$requestedProfileId = $this->_getParam('profile');
|
||||
foreach ($this->view->profiles as $profile) {
|
||||
if ($requestedProfileId == 0 || $requestedProfileId == $profile->id) {
|
||||
$this->view->profileId = $profile->id;
|
||||
$personalInfoForm = Users_Form_PersonalInfo::getForm($request, $profile);
|
||||
$this->view->fields = $personalInfoForm->getElements();
|
||||
if ($personalInfoForm->getPolicyUrl()) {
|
||||
$this->view->policyUrl = $personalInfoForm->getPolicyUrl();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//$this->view->profiles->rewind();
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -18,12 +18,22 @@ class Form_ErrorMessages
|
||||
private function _messages()
|
||||
{
|
||||
translate('Value is empty, but a non-empty value is required');
|
||||
translate('Value is required and can\'t be empty');
|
||||
translate('\'%value%\' is not a valid email address in the basic format local-part@hostname');
|
||||
translate('\'%hostname%\' is not a valid hostname for email address \'%value%\'');
|
||||
translate('\'%value%\' does not match the expected structure for a DNS hostname');
|
||||
translate('\'%value%\' appears to be a DNS hostname but cannot match TLD against known list');
|
||||
translate('\'%value%\' appears to be a local network name but local network names are not allowed');
|
||||
translate('Captcha value is wrong');
|
||||
translate('Password confirmation does not match');
|
||||
translate('Username can only contain US-ASCII alphanumeric characters, plus any of the symbols $-_.+!*\'(), and "');
|
||||
translate('Username is invalid');
|
||||
translate('The file \'%value%\' was not uploaded');
|
||||
translate('Password can\'t be a dictionary word');
|
||||
translate('Password can\'t contain the username');
|
||||
translate('Password must be longer than %minLength% characters');
|
||||
translate('Password must contain numbers');
|
||||
translate('Password must contain symbols');
|
||||
translate('Password needs to have lowercase and uppercase characters');
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -23,21 +23,24 @@ class Form_OpenIdLogin extends Zend_Form
|
||||
|
||||
public function init()
|
||||
{
|
||||
$openIdIdentity = new Monkeys_Form_Element_Text('openIdIdentity');
|
||||
translate('OpenID URL');
|
||||
$openIdIdentity->setLabel('OpenID URL')
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setAttrib('style', 'width:300px')
|
||||
->setRequired(true);
|
||||
|
||||
$openIdIdentity = new Monkeys_Form_Element_Text('openIdIdentity');
|
||||
translate('OpenID URL');
|
||||
$openIdIdentity->setLabel('OpenID URL')
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setAttrib('style', 'width:300px')
|
||||
->setRequired(false);
|
||||
|
||||
$password = new Monkeys_Form_Element_Password('password');
|
||||
translate('Password');
|
||||
$password->setLabel('Password')
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setAttrib('style', 'width:300px')
|
||||
->setRequired(true);
|
||||
->setAttrib('style', 'width:300px');
|
||||
|
||||
$this->addElements(array($openIdIdentity, $password));
|
||||
$yubikey = new Monkeys_Form_Element_Text('yubikey');
|
||||
$yubikey->setLabel('YubiKey')
|
||||
->setAttrib('class', 'yubiKeyInput');
|
||||
|
||||
$this->addElements(array($openIdIdentity, $password, $yubikey));
|
||||
|
||||
if ($this->_useCaptcha) {
|
||||
$captcha = new Monkeys_Form_Element_Captcha('captcha', array(
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -18,13 +18,22 @@ class Model_Fields extends Monkeys_Db_Table_Gateway
|
||||
|
||||
private $_fieldsNames= array();
|
||||
|
||||
public function getValues(Users_Model_User $user)
|
||||
public function getAll()
|
||||
{
|
||||
$select = $this->select();
|
||||
|
||||
return $this->fetchAll($select);
|
||||
}
|
||||
|
||||
public function getValues(Users_Model_Profile $profile)
|
||||
{
|
||||
$userId = (int)$user->id;
|
||||
$select = $this->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from('fields')
|
||||
->joinLeft('fields_values', "fields_values.field_id=fields.id AND fields_values.user_id=".$user->id);
|
||||
->joinLeft('fields_values',
|
||||
$this->getAdapter()->quoteInto("fields_values.field_id=fields.id AND fields_values.profile_id=?", $profile->id),
|
||||
array('user_id', 'profile_id', 'field_id', 'value')
|
||||
);
|
||||
|
||||
return $this->fetchAll($select);
|
||||
}
|
||||
@ -40,6 +49,14 @@ class Model_Fields extends Monkeys_Db_Table_Gateway
|
||||
return $this->_fieldsNames[$fieldIdentifier];
|
||||
}
|
||||
|
||||
public function getByOpenIdIdentifier($openid)
|
||||
{
|
||||
$select = $this->select()
|
||||
->where('openid=?', $openid);
|
||||
|
||||
return $this->fetchRow($select);
|
||||
}
|
||||
|
||||
private function _translationPlaceholders()
|
||||
{
|
||||
translate('Nickname');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -16,9 +16,17 @@ class Model_FieldsValues extends Monkeys_Db_Table_Gateway
|
||||
protected $_primary = array('user_id', 'field_id');
|
||||
protected $_rowClass = 'Model_FieldsValue';
|
||||
|
||||
public function deleteForUser(Users_Model_User $user)
|
||||
public function getForUser(Users_Model_User $user)
|
||||
{
|
||||
$where = $this->getAdapter()->quoteInto('user_id=?', $user->id);
|
||||
$select = $this->select()
|
||||
->where('user_id=?', $user->id);
|
||||
|
||||
return $this->fetchAll($select);
|
||||
}
|
||||
|
||||
public function deleteForProfile(Users_Model_Profile $profile)
|
||||
{
|
||||
$where = $this->getAdapter()->quoteInto('profile_id=?', $profile->id);
|
||||
$this->delete($where);
|
||||
}
|
||||
}
|
||||
|
2
modules/default/models/Histories.php
Executable file → Normal file
2
modules/default/models/Histories.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
2
modules/default/models/History.php
Executable file → Normal file
2
modules/default/models/History.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
22
modules/default/views/scripts/about/index-it.phtml
Normal file
22
modules/default/views/scripts/about/index-it.phtml
Normal file
@ -0,0 +1,22 @@
|
||||
<p>
|
||||
Community-ID è un servizio fornito da Keyboard Monkeys Ltd., Community as a Service ™.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Keyboard Monkeys Ltd. si concentra sul fornire soluzioni open source e prodotti mirati a rendere più forti le community su Internet. Forniamo inoltre consulenza, con un ampio supporto per le tecnologie open source, sopratutto soluzioni e prodotti per le community.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Questi sono i nostri prodotti e servizi attualmente forniti o in corso di sviluppo:
|
||||
<ul>
|
||||
<li>
|
||||
<b><a href="http://sourceforge.net/projects/sciret">Sciret</a></b> - Enterprise Knowledge Base System
|
||||
</li>
|
||||
<li>
|
||||
<b><a href="http://sourceforge.net/projects/textroller">TextRoller</a></b> - Piattaforma per blog
|
||||
</li>
|
||||
<li>
|
||||
<b>Community Solutions</b> - Open Source Project Collaboration (Attualmente in sviluppo)
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
23
modules/default/views/scripts/about/index-ja.phtml
Normal file
23
modules/default/views/scripts/about/index-ja.phtml
Normal file
@ -0,0 +1,23 @@
|
||||
<p>
|
||||
Community-IDは、Keyboard Monkeys Ltd., Community as a Service ™によって提供されるサービスです。
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Keyboard Monkeys Ltd. は、インターネットのコミュニティに対して貢献できるオープンソースのソリューションや製品を提供することに力を注いでおります。 私どもは個別のコンサルティングに加え幅広いオープンソース技術に関するサポートを行っております。なかでもコミュニティを基本としたソリューションや製品を得意としています。
|
||||
</p>
|
||||
|
||||
<p>
|
||||
その他のサービスや製品(計画中を含みます)には以下の様なものがあります:
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><a href="http://sourceforge.net/projects/sciret">Sciret</a></b> - Enterprise Knowledge Base System
|
||||
</li>
|
||||
<li>
|
||||
<b><a href="http://sourceforge.net/projects/textroller">TextRoller</a></b> - Blogging platform
|
||||
</li>
|
||||
<li>
|
||||
<b>Community Solutions</b> - Open Source Project Collaboration (Currently under initial development stages)
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
0
modules/default/views/scripts/error/error.phtml
Executable file → Normal file
0
modules/default/views/scripts/error/error.phtml
Executable file → Normal file
0
modules/default/views/scripts/history/index.phtml
Executable file → Normal file
0
modules/default/views/scripts/history/index.phtml
Executable file → Normal file
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforech ?>
|
||||
<?php endforeach ?>
|
||||
<?php if (count($this->news) == 0): ?>
|
||||
<div>
|
||||
<?php echo $this->translate('There are no news articles yet') ?>
|
||||
|
59
modules/default/views/scripts/index/index-it.phtml
Normal file
59
modules/default/views/scripts/index/index-it.phtml
Normal file
@ -0,0 +1,59 @@
|
||||
<div id="home">
|
||||
<h2>
|
||||
Community ID: Autenticazione OpenID gratuita<br />
|
||||
Completamente basato su tecnologie Open Source
|
||||
</h2>
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
<p>
|
||||
Sin dalla fase di progettazione, Community-ID è stato costruito con la massima attenzione alla sicurezza. Ogni elemento della nostra piattaforma è stato scelto considerando la sua storia di sicurezza e, più importante, tutto è Open Source.
|
||||
</p>
|
||||
<p>
|
||||
Questo vuol dire che siamo aperti ai controlli di chiunque nel mondo. E' un dato provato che "security by obscurity" non funziona, e quando si usa un prodotto o servizio il cui meccanismo di funzionamento è tenuto segreto, si espone sè stessi e i propri dati ad un grande rischio.
|
||||
</p>
|
||||
<p style="font-weight: bold; text-align:center">
|
||||
Perchè aspettare ancora?<br />
|
||||
Semplifica la tua vita e riduci il rischio.<br /><br />
|
||||
<a href="<?php echo $this->base ?>/users/register">APRI UN ACCOUNT ADESSO</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<div id="homeNews">
|
||||
<h3>Latest News</h3>
|
||||
<ul>
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
<div>
|
||||
<a class="readMore" href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $this->translate('Read More') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
<?php if (count($this->news) == 0): ?>
|
||||
<div>
|
||||
<?php echo $this->translate('There are no news articles yet') ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</ul> <!-- FF bug -->
|
||||
<div style="position:relative">
|
||||
<div class="linksTopRight">
|
||||
<?php if (count($this->news) > 0): ?>
|
||||
<a href="<?php echo $this->base ?>/news"><?php echo $this->translate('View All') ?></a>
|
||||
<?php endif ?>
|
||||
<?php if ($this->user->role == Users_Model_User::ROLE_ADMIN): ?>
|
||||
|
|
||||
<a href="<?php echo $this->base ?>/news/edit/add"><?php echo $this->translate('Add New Article') ?></a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="borderFadingLeft">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
59
modules/default/views/scripts/index/index-ja.phtml
Normal file
59
modules/default/views/scripts/index/index-ja.phtml
Normal file
@ -0,0 +1,59 @@
|
||||
<div id="home">
|
||||
<h2>
|
||||
Community ID: 無料のOpenID認証<br />
|
||||
100%オープンソース技術で構築
|
||||
</h2>
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
<p>
|
||||
Community-IDは、開発当初からセキュリティを最も重要な事項と位置づけて開発されてきました。技術要素の選定にあたっては、そのセキュリティ関係の問題がこれまでどうなのかを十分に吟味し、すべてオープンソースであることを重要視してきました。
|
||||
</p>
|
||||
<p>
|
||||
つまり我々の技術はどなたでも精査していただいて構わないということです。 内容が不明なセキュリティというものは使い物にならないことはよく知られています。もし内容がブラックボックスのままの製品やサービスを使うということは、あなたのデータ(そしてあなた自身を)危険にさらしてしまうことにつながります。
|
||||
</p>
|
||||
<p style="font-weight: bold; text-align:center">
|
||||
さあ今すぐに簡単にリスクを軽減する方法をとりましょう。<br />
|
||||
<br />
|
||||
<a href="<?php echo $this->base ?>/users/register">アカウントを登録</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<div id="homeNews">
|
||||
<h3>最新ニュース</h3>
|
||||
<ul>
|
||||
<?php foreach ($this->news as $item): ?>
|
||||
<li>
|
||||
<div>
|
||||
<a href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $item->title ?></a>
|
||||
</div>
|
||||
<div class="newsExcerpt">
|
||||
<?php echo $item->excerpt ?>
|
||||
<div>
|
||||
<a class="readMore" href="<?php echo $this->base . '/news/' . $item->id ?>"><?php echo $this->translate('Read More') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
<?php if (count($this->news) == 0): ?>
|
||||
<div>
|
||||
<?php echo $this->translate('There are no news articles yet') ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</ul> <!-- FF bug -->
|
||||
<div style="position:relative">
|
||||
<div class="linksTopRight">
|
||||
<?php if (count($this->news) > 0): ?>
|
||||
<a href="<?php echo $this->base ?>/news"><?php echo $this->translate('View All') ?></a>
|
||||
<?php endif ?>
|
||||
<?php if ($this->user->role == Users_Model_User::ROLE_ADMIN): ?>
|
||||
|
|
||||
<a href="<?php echo $this->base ?>/news/edit/add"><?php echo $this->translate('Add New Article') ?></a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="borderFadingLeft">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
0
modules/default/views/scripts/index/subheader-de.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-de.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-en.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-en.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-es.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-es.phtml
Executable file → Normal file
1
modules/default/views/scripts/index/subheader-it.phtml
Normal file
1
modules/default/views/scripts/index/subheader-it.phtml
Normal file
@ -0,0 +1 @@
|
||||
<!-- placeholder for home subheader -->
|
1
modules/default/views/scripts/index/subheader-ja.phtml
Normal file
1
modules/default/views/scripts/index/subheader-ja.phtml
Normal file
@ -0,0 +1 @@
|
||||
<!-- placeholder for home subheader -->
|
0
modules/default/views/scripts/index/subheader-sv.phtml
Executable file → Normal file
0
modules/default/views/scripts/index/subheader-sv.phtml
Executable file → Normal file
@ -1,16 +1,50 @@
|
||||
<form action="authenticate<?php echo $this->queryString ?>" method="post" class="formGrid">
|
||||
<?php echo $this->form->openIdIdentity ?>
|
||||
<?php echo $this->form->password ?>
|
||||
<?php if ($this->useCaptcha): ?>
|
||||
<?php echo $this->form->captcha ?>
|
||||
<?php endif ?>
|
||||
<div class="yui-gf">
|
||||
<div class="yui-u first">
|
||||
<input type="submit" id="login" value="<?php echo $this->translate('Login') ?>" />
|
||||
<script type="text/javascript">
|
||||
var oButton = new YAHOO.widget.Button("login");
|
||||
</script>
|
||||
<div style="position:relative">
|
||||
<? if ($this->form->getErrorMessages()): ?>
|
||||
<div class="messages" style="margin-bottom:20px">
|
||||
<?= implode('<br />', $this->form->getErrorMessages()) ?>
|
||||
</div>
|
||||
<div class="yui-u"> </div>
|
||||
</div>
|
||||
</form>
|
||||
<? endif ?>
|
||||
<form name="openidAuthenticate" action="authenticate<?php echo $this->queryString ?>" method="post" class="formGrid">
|
||||
<? if ($this->identity): ?>
|
||||
<div class="yui-gf" style="padding:10px 0">
|
||||
<div class="yui first"><?= $this->translate('OpenID URL') ?>:</div>
|
||||
<div class="yui-u"><?= $this->escape($this->identity) ?></div>
|
||||
</div>
|
||||
<? else: ?>
|
||||
<?= $this->form->openIdIdentity ?>
|
||||
<? endif ?>
|
||||
<? if ($this->yubikey->enabled && $this->yubikey->force): ?>
|
||||
<?= $this->form->yubikey ?>
|
||||
<? else: ?>
|
||||
<?= $this->form->password ?>
|
||||
<? endif ?>
|
||||
<?php if ($this->useCaptcha): ?>
|
||||
<?php echo $this->form->captcha ?>
|
||||
<?php endif ?>
|
||||
<div class="yui-gf">
|
||||
<div class="yui-u first">
|
||||
<input type="submit" id="login" value="<?php echo $this->translate('Login') ?>" />
|
||||
<script type="text/javascript">
|
||||
var oButton = new YAHOO.widget.Button("login");
|
||||
</script>
|
||||
</div>
|
||||
<div class="yui-u"> </div>
|
||||
</div>
|
||||
</form>
|
||||
<? if ($this->image): ?>
|
||||
<div style="position:absolute; right:-100px; top:-40px">
|
||||
<img src="<?= $this->base ?>/users/signinimage/image/id/<?= $this->image->cookie ?>"
|
||||
width="<?= $this->image->getWidth() ?>"
|
||||
height="<?= $this->image->getHeight() ?>"
|
||||
title="<?= $this->translate('This is the image that identifies your account in this computer') ?>"
|
||||
alt="<?= $this->translate('This is the image that identifies your account in this computer') ?>" />
|
||||
</div>
|
||||
<? endif ?>
|
||||
<script>
|
||||
try {
|
||||
document.openidAuthenticate.password.focus();
|
||||
document.openidAuthenticate.yubikey.focus();
|
||||
} catch(e) {
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
@ -4,21 +4,20 @@
|
||||
</div>
|
||||
<form method="post" action="proceed<?php echo $this->queryString ?>" class="formGrid">
|
||||
<input type="hidden" name="action" value="proceed">
|
||||
<?php if ($this->fields): ?>
|
||||
<? if ($this->showProfileForm): ?>
|
||||
<br />
|
||||
<?php echo $this->translate('It also requests this additional information about you:') ?><br /><br />
|
||||
<?php echo $this->translate('Fields are automatically filled according to the personal info stored in your community-id account.') ?><br />
|
||||
<?php echo $this->translate('Fields marked with * are required.') ?>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<?php foreach ($this->fields as $field): ?>
|
||||
<?php echo $field ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($this->policyUrl): ?>
|
||||
<?php echo $this->translate('The private policy can be found at %s',
|
||||
'<a href="'.$this->policyUrl.'">'.$this->policyUrl.'</a>'); ?><br /><br />
|
||||
<?php endif ?>
|
||||
<div id="profileForm">
|
||||
<? if ($this->showProfileForm): ?>
|
||||
<div style="text-align:center; margin:20px 0; font-weight:bold">
|
||||
<?= $this->translate('Please wait') ?>
|
||||
<img src="<?= $this->base ?>/images/progress.gif" style="margin-left:15px" />
|
||||
</div>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div style="margin-top:20px">
|
||||
<input type="checkbox" name="forever" style="top:0" /> <?php echo $this->translate('Forever') ?>
|
||||
@ -29,6 +28,11 @@
|
||||
<script type="text/javascript">
|
||||
var oButton1 = new YAHOO.widget.Button("allow");
|
||||
var oButton2 = new YAHOO.widget.Button("deny");
|
||||
<? if ($this->showProfileForm): ?>
|
||||
YAHOO.util.Event.onDOMReady(function() {
|
||||
COMMID.profileForm.fetch("<?= $this->queryString ?>", 0);
|
||||
});
|
||||
<? endif ?>
|
||||
</script>
|
||||
</div>
|
||||
</form>
|
||||
|
18
modules/default/views/scripts/privacy/index-de.phtml
Normal file
18
modules/default/views/scripts/privacy/index-de.phtml
Normal file
@ -0,0 +1,18 @@
|
||||
<h2>Datenschutzrichtlinie</h2>
|
||||
<div>
|
||||
<h3>Einleitung</h3>
|
||||
<p>Community-ID.org respektiert jedermann Recht bezüglich des Eigentums seiner privaten Daten. Erfasste und gesammelte Daten durch dieser Webseite werden nur verwendet wie in dieser Erklärung beschreiben. Diese Erklärung gilt ausschließlich für Informationen welche erfasst wurden durch die Community-ID.org Webseite. </p>
|
||||
|
||||
|
||||
<h3>Erfassen von Daten</h3>
|
||||
<p>Community-ID.org erfasst Informationen über diese Webseite um den Benutzern einen besseren Service anbieten zu können. Erfasst werden die persönlichen Daten, einschließlich E-Mail-Adressen von registrierten Nutzern. Gespeichert wird auch die IP-Adresse und die Aktivität von Benutzern. Diese Informationen werden verwendet zur Diagnose oder zum Debuggen unserer Systeme oder zum verbessern unserer Dienstleistungen. Es können zusätzliche Nutzungsdaten gespeichert werden inklusive von Verweisen, Zugriffszeiten oder die Art der besuchten Plattform welche durch Benutzer verbreitet werden während des Besuchs der Seite. </p>
|
||||
|
||||
<p>Community-ID.org benutzt Cookies. Ein Cookie ist eine kleine Textdatei, welche der Webserver auf der Festplatte des Computer eines Benutzers speichert zum Zwecke einer eindeutigen Kennung. Cookies ermöglichen Community-ID.org ein Nutzungsmuster zu erstellen und maßgeschneiderte Inhalte für die Nutzer bereitzustellen. Unsere Cookies haben ein Ablaufdatum, und sammeln keine persönlich identifizierbaren Informationen.</p>
|
||||
|
||||
|
||||
<h3>Verwendung von Informationen</h3>
|
||||
<p>Wir werden Ihre persönlichen Daten nicht verkaufen oder vermieten oder an Dritte weitergegeben. Wir werden persönliche Daten nur weitergeben in folgenden Fällen: 1) Geschaftsübergabe: Wenn Community-ID.org übernommen wird durch dritte, können persönliche Informationen übertragen werden im Einklang mit den Vereinbarungen der Übernahme. 2) Rechtssicherheit: Falls eine gesetzliche Verpflichtung vorliegt diese Informationen weiterzugeben wurde Community-ID.org diesen Folge leisten.</p>
|
||||
|
||||
<h3>Kontroller und Speichern von Informationen</h3>
|
||||
<p>Wenn ein Benutzer sein Benutzerkonto in Community-ID.org löscht, werden alle im System gespeicherten Informationen entfernt. Natürlich können unsere Backups altere Kopien Ihrer Informationen enthalten, jedoch werden diese Backups regelmäßig gelöscht. Wir glauben, das Sie die Kontrolle über Ihre Informationen haben sollen und wir respektieren dies. </p>
|
||||
</div>
|
16
modules/default/views/scripts/privacy/index-en.phtml
Normal file
16
modules/default/views/scripts/privacy/index-en.phtml
Normal file
@ -0,0 +1,16 @@
|
||||
<h2>Privacy Policy</h2>
|
||||
<div>
|
||||
<h3>Introduction</h3>
|
||||
<p>Community-ID.org respects each individual's right to personal privacy. We will collect and use information through our Web site only in the ways disclosed in this statement. This statement applies solely to information collected at Community-ID.org's Web site.</p>
|
||||
|
||||
<h3>Information Collection</h3>
|
||||
<p>Community-ID.org collects information through our Web site in order to provide users an efficient experience. We collect the personal information, including email addresses, of registered users. We also collect the IP address and use activity of visitors to our website, in order to diagnose and debug our systems and services. We may also collect ancillary usage information, including referrals, access times and platform type, which our users divulge through visiting the site.</p>
|
||||
|
||||
<p>Community-ID.org employs cookies. A cookie is a small text file that our Web server places on a user's computer hard drive to be a unique identifier. Cookies enable Community-ID.org to track usage patterns and deliver customized content to users. Our cookies have an expiration date, and do not collect personally identifiable information.</p>
|
||||
|
||||
<h3>Information Usage</h3>
|
||||
<p>We will not rent or sell your personal information to third parties. We will share personal information only in the following cases: 1) Business Transfer: If Community-ID.org were acquired, personal information would be transferred forward in accordance with acquisition agreements. 2) Legal Compliance: If compelled by law to share information, Community-ID.org would be required to do so.</p>
|
||||
|
||||
<h3>Information Storage and Control</h3>
|
||||
<p>When a user deletes their account from Community-ID.org, all of their information is expunged from our systems. Of course, our backups may contain older copies of the information, but we expunge backups regularly. We believe that you control your information, and we absolutely respect that.</p>
|
||||
</div>
|
17
modules/default/views/scripts/privacy/index-es.phtml
Normal file
17
modules/default/views/scripts/privacy/index-es.phtml
Normal file
@ -0,0 +1,17 @@
|
||||
<h2>Política de Privacidad</h2>
|
||||
<div>
|
||||
<h3>Introducción</h3>
|
||||
<p>Community-ID.org respeta el derecho individual a la privacidad. Recuperaremos y usaremos información a través de nuestro sitio Web solamente como se describe en este documento. Este documento solo aplica a la información recolectada a través del sitio Web Community-ID.org.</p>
|
||||
|
||||
<h3>Recolección de Información</h3>
|
||||
<p>Community-ID.org recolecta información a través de nuestro sitio Web con el fin de proveer a nuestros usuarios una experiencia eficiente. Recolectamos la información, incluyendo direcciones de correo electrónico, de los usuarios registrados. También recolectamos las direcciones IP y la actividad de uso de los visitantes a nuestro sitio, con el fin de diagnosticar y depurar nuestros sistemas y servicios. Podremos también recolectar alguna información extra, tal como remisiones, tiempos de acceso y tipo de plataforma, que nuestros usuarios divulgan cuando visitan el sitio.</p>
|
||||
|
||||
<p>Community-ID.org utiliza cookies. Una cookie es un pequeño archivo de texto que nuestro servidor Web coloca en el disco duro del computador del usuario. Las cookies permiten a Community-ID.org llevar un registro de los patrones de uso y entregar contenido personalizado a los usuarios. Nuestras cookies tienen una fecha de expiración, y no recolectan información personal identificable.</p>
|
||||
|
||||
|
||||
<h3>Uso de la Información</h3>
|
||||
<p>No rentamos ni vendemos información personal de nuestros usuarios a terceros. Solamente entregaremos información personal en los siguientes casos: 1) Transferencia patrimonial: Si Community-ID.org fuera adquirido, la información personal sería transferida de acuerdo con el contrato de adquisición. 2) Cumplimiento legal: Si obligados por ley a revelar información, Community-ID.org estará obligada a entregarla.</p>
|
||||
|
||||
<h3>Almacenamiento y Control de la Información</h3>
|
||||
<p>Cuando un usuario borra su cuenta de Community-ID.org, toda su información es borrada de nuestros sistemas. Por supuesto, nuestras copias de respaldo pueden contener copias antiguas de dicha información, pero rotamos estas copias regularmente. Creemos que nuestros usuarios son dueños de su información, y respetamos eso.</p>
|
||||
</div>
|
17
modules/default/views/scripts/privacy/index-ja.phtml
Normal file
17
modules/default/views/scripts/privacy/index-ja.phtml
Normal file
@ -0,0 +1,17 @@
|
||||
<h2>Privacy Policy</h2>
|
||||
<div>
|
||||
<h3>Introduction</h3>
|
||||
<p>Community-ID.org respects each individual's right to personal privacy. We will collect and use information through our Web site only in the ways disclosed in this statement. This statement applies solely to information collected at Community-ID.org's Web site.</p>
|
||||
|
||||
<h3>Information Collection</h3>
|
||||
<p>Community-ID.org collects information through our Web site in order to provide users an efficient experience. We collect the personal information, including email addresses, of registered users. We also collect the IP address and use activity of visitors to our website, in order to diagnose and debug our systems and services. We may also collect ancillary usage information, including referrals, access times and platform type, which our users divulge through visiting the site.</p>
|
||||
|
||||
<p>Community-ID.org employs cookies. A cookie is a small text file that our Web server places on a user's computer hard drive to be a unique identifier. Cookies enable Community-ID.org to track usage patterns and deliver customized content to users. Our cookies have an expiration date, and do not collect personally identifiable information.</p>
|
||||
|
||||
<h3>Information Usage</h3>
|
||||
<p>We will not rent or sell your personal information to third parties. We will share personal information only in the following cases: 1) Business Transfer: If Community-ID.org were acquired, personal information would be transferred forward in accordance with acquisition agreements. 2) Legal Compliance: If compelled by law to share information, Community-ID.org would be required to do so.</p>
|
||||
|
||||
<h3>Information Storage and Control</h3>
|
||||
<p>When a user deletes their account from Community-ID.org, all of their information is expunged from our systems. Of course, our backups may contain older copies of the information, but we expunge backups regularly. We believe that you control your information, and we absolutely respect that.</p>
|
||||
</div>
|
||||
|
17
modules/default/views/scripts/privacy/index-nl.phtml
Normal file
17
modules/default/views/scripts/privacy/index-nl.phtml
Normal file
@ -0,0 +1,17 @@
|
||||
<h2>Privacy Policy</h2>
|
||||
<div>
|
||||
<h3>Introduction</h3>
|
||||
<p>Community-ID.org respects each individual's right to personal privacy. We will collect and use information through our Web site only in the ways disclosed in this statement. This statement applies solely to information collected at Community-ID.org's Web site.</p>
|
||||
|
||||
<h3>Information Collection</h3>
|
||||
<p>Community-ID.org collects information through our Web site in order to provide users an efficient experience. We collect the personal information, including email addresses, of registered users. We also collect the IP address and use activity of visitors to our website, in order to diagnose and debug our systems and services. We may also collect ancillary usage information, including referrals, access times and platform type, which our users divulge through visiting the site.</p>
|
||||
|
||||
<p>Community-ID.org employs cookies. A cookie is a small text file that our Web server places on a user's computer hard drive to be a unique identifier. Cookies enable Community-ID.org to track usage patterns and deliver customized content to users. Our cookies have an expiration date, and do not collect personally identifiable information.</p>
|
||||
|
||||
<h3>Information Usage</h3>
|
||||
<p>We will not rent or sell your personal information to third parties. We will share personal information only in the following cases: 1) Business Transfer: If Community-ID.org were acquired, personal information would be transferred forward in accordance with acquisition agreements. 2) Legal Compliance: If compelled by law to share information, Community-ID.org would be required to do so.</p>
|
||||
|
||||
<h3>Information Storage and Control</h3>
|
||||
<p>When a user deletes their account from Community-ID.org, all of their information is expunged from our systems. Of course, our backups may contain older copies of the information, but we expunge backups regularly. We believe that you control your information, and we absolutely respect that.</p>
|
||||
</div>
|
||||
|
17
modules/default/views/scripts/privacy/index-pl.phtml
Normal file
17
modules/default/views/scripts/privacy/index-pl.phtml
Normal file
@ -0,0 +1,17 @@
|
||||
<h2>Privacy Policy</h2>
|
||||
<div>
|
||||
<h3>Introduction</h3>
|
||||
<p>Community-ID.org respects each individual's right to personal privacy. We will collect and use information through our Web site only in the ways disclosed in this statement. This statement applies solely to information collected at Community-ID.org's Web site.</p>
|
||||
|
||||
<h3>Information Collection</h3>
|
||||
<p>Community-ID.org collects information through our Web site in order to provide users an efficient experience. We collect the personal information, including email addresses, of registered users. We also collect the IP address and use activity of visitors to our website, in order to diagnose and debug our systems and services. We may also collect ancillary usage information, including referrals, access times and platform type, which our users divulge through visiting the site.</p>
|
||||
|
||||
<p>Community-ID.org employs cookies. A cookie is a small text file that our Web server places on a user's computer hard drive to be a unique identifier. Cookies enable Community-ID.org to track usage patterns and deliver customized content to users. Our cookies have an expiration date, and do not collect personally identifiable information.</p>
|
||||
|
||||
<h3>Information Usage</h3>
|
||||
<p>We will not rent or sell your personal information to third parties. We will share personal information only in the following cases: 1) Business Transfer: If Community-ID.org were acquired, personal information would be transferred forward in accordance with acquisition agreements. 2) Legal Compliance: If compelled by law to share information, Community-ID.org would be required to do so.</p>
|
||||
|
||||
<h3>Information Storage and Control</h3>
|
||||
<p>When a user deletes their account from Community-ID.org, all of their information is expunged from our systems. Of course, our backups may contain older copies of the information, but we expunge backups regularly. We believe that you control your information, and we absolutely respect that.</p>
|
||||
</div>
|
||||
|
18
modules/default/views/scripts/privacy/index-sv.phtml
Normal file
18
modules/default/views/scripts/privacy/index-sv.phtml
Normal file
@ -0,0 +1,18 @@
|
||||
<h2>Policy för personlig integritet</h2>
|
||||
<div>
|
||||
<h3>Introduktion</h3>
|
||||
<p>Community-ID.org respekterar varje individs rätt till personlig integritet. Vi samlar och använder därför bara den information som anges i denna policy. Policyn gäller all information på Community-ID.org's webbplats.</p>
|
||||
|
||||
<h3>Informationsinsamling</h3>
|
||||
<p>Community-ID.org samlar information via webbplatsen för att kunna ge användarna en effektiv upplevelse. Vi samlar personlig information, inklusive e-postadresser, från registrerade användare. Vi samlar även in IP-addresser och hur besökarna använder vår webbplats, för att kunna felsöka och förbättra vårt system och våra tjänster. We may also collect ancillary usage information, including referrals, access times and platform type, which our users divulge through visiting the site.</p>
|
||||
|
||||
<h3>Cookies</h3>
|
||||
<p>Community-ID.org använder cookies. En cookie är en liten textfile som vår webbserver lägger i användarens dator för unik identifiering. Cookies gör det möjligt för Community-ID.org att spåra användningsmönster och leverera anpassat innehåll till användaren. Våra cookies har ett bäst-före-datum och används inte för att samla personrelaterad information.</p>
|
||||
<p>Vill du inte acceptera cookies kan din webbläsare ställas in så att du automatiskt nekar till lagring av cookies eller informeras varje gång en webbplats begär att få lagra en cookie. Genom webbläsaren kan också tidigare lagrade cookies raderas. Se webbläsarens hjälpsidor för mer information.</p>
|
||||
|
||||
<h3>Informationsanvändning</h3>
|
||||
<p>Vi kommer inte att hyra ut eller sälja din personliga information till tredje part. Vi kommer endast att dela med oss av personlig information i följande fall: 1) Affärstransaktioner: Om Community-ID.org blir uppköpt kommer den personliga informationen följa med om det framgår i kontraktet. 2) Lagkrav: Om det enligt lag krävs att information ska lämnas ut, så kommer Community-ID.org att göra det.</p>
|
||||
|
||||
<h3>Informationsförvaring och - Kontroll</h3>
|
||||
<p>När en användare raderar sitt konto från Community-ID.org, kommer all deras information raderas fullständigt. Naturligtvis kan det finnas kvar äldre säkerhetskopior av informationen, men dessa raderas regelbundet. Vi anser att du ska kontrollera din egen information och respekterar det fullt ut.</p>
|
||||
</div>
|
@ -1,4 +0,0 @@
|
||||
<h2><?php echo $this->translate('Privacy Policy') ?></h2>
|
||||
<div>
|
||||
<?php echo $this->privacyPolicy ?>
|
||||
</div>
|
22
modules/default/views/scripts/profile/index.phtml
Normal file
22
modules/default/views/scripts/profile/index.phtml
Normal file
@ -0,0 +1,22 @@
|
||||
<br />
|
||||
<br />
|
||||
<? if (count($this->profiles) > 0): ?>
|
||||
<div style="margin-bottom:20px">
|
||||
<?= $this->translate('Please select the profile you want to use:') ?>
|
||||
<select onchange="COMMID.profileForm.fetch('<?= $this->queryString ?>', this.value, true)"
|
||||
<?= $this->profileId == $profile->id? 'selected="true"' : '' ?>>
|
||||
<? foreach ($this->profiles as $profile): ?>
|
||||
<option value="<?= $profile->id ?>"><?= $profile->name ?></option>
|
||||
<? endforeach ?>
|
||||
</select>
|
||||
<img id="loadingPersonalInfo" src="<?= $this->base ?>/images/progress.gif" style="visibility:hidden"/>
|
||||
</div>
|
||||
<? endif ?>
|
||||
<input type="hidden" name="profileId" value="<?= $this->profileId ?>" />
|
||||
<? foreach ($this->fields as $field): ?>
|
||||
<? echo $field ?>
|
||||
<? endforeach ?>
|
||||
<? if ($this->policyUrl): ?>
|
||||
<? echo $this->translate('The privacy policy can be found at %s',
|
||||
'<a href="'.$this->policyUrl.'">'.$this->policyUrl.'</a>'); ?><br /><br />
|
||||
<? endif ?>
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
{
|
||||
const PHP_MINIMAL_VERSION_REQUIRED = '5.2.4';
|
||||
|
||||
protected $_numCols = 1;
|
||||
|
||||
public function indexAction()
|
||||
@ -39,14 +41,14 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
if (!$this->_connectToDbEngine($form)) {
|
||||
$this->_helper->FlashMessenger->addMessage('We couldn\'t connect to the database using those credentials.');
|
||||
$this->_helper->FlashMessenger->addMessage('Please verify and try again.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('We couldn\'t connect to the database using those credentials.'));
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Please verify and try again.'));
|
||||
return $this->_forwardFormError($form);
|
||||
}
|
||||
|
||||
if (!$this->_createDbIfMissing($form)) {
|
||||
$this->_helper->FlashMessenger->addMessage(
|
||||
'The connection to the database engine worked, but the database "' . $form->getValue('dbname') . '" doesn\'t exist or the provided user doesn\'t have access to it. An attempt was made to create it, but the provided user doesn\'t have permissions to do so either. Please create it yourself and try again.');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate(
|
||||
'The connection to the database engine worked, but the database %s doesn\'t exist or the provided user doesn\'t have access to it. An attempt was made to create it, but the provided user doesn\'t have permissions to do so either. Please create it yourself and try again.', $form->getValue('dbname')));
|
||||
return $this->_forwardFormError($form);
|
||||
}
|
||||
|
||||
@ -57,7 +59,7 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
throw new Exception('Couldn\'t write to config file ' . APP_DIR . DIRECTORY_SEPARATOR . 'config.php');
|
||||
}
|
||||
|
||||
$this->_forward('index', 'complete');
|
||||
$this->_redirect('/install/complete');
|
||||
}
|
||||
|
||||
private function _connectToDbEngine(Install_Form_Install $form)
|
||||
@ -111,9 +113,12 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
'{environment.YDN}' => $this->_config->environment->YDN? 'true' : 'false',
|
||||
'{environment.ajax_slowdown}' => $this->_config->environment->ajax_slowdown,
|
||||
'{environment.keep_history_days}' => $this->_config->environment->keep_history_days,
|
||||
'{environment.unconfirmed_accounts_days_expire}' => $this->_config->environment->unconfirmed_accounts_days_expire,
|
||||
'{environment.registrations_enabled}' => $this->_config->environment->registrations_enabled? 'true' : 'false',
|
||||
'{environment.locale}' => $this->_config->environment->locale,
|
||||
'{environment.template}' => $this->_config->environment->template,
|
||||
'{metadata.description}' => $this->_config->metadata->description,
|
||||
'{metadata.keywords}' => $this->_config->metadata->keywords,
|
||||
'{logging.location}' => $this->_config->logging->location,
|
||||
'{logging.level}' => $this->_config->logging->level,
|
||||
'{subdomain.enabled}' => $this->_config->subdomain->enabled? 'true' : 'false',
|
||||
@ -125,6 +130,31 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
'{database.params.dbname}' => $this->_config->database->params->dbname,
|
||||
'{database.params.username}' => $this->_config->database->params->username,
|
||||
'{database.params.password}' => $this->_config->database->params->password,
|
||||
'{security.passwords.dictionary}' => $this->_config->security->passwords->dictionary,
|
||||
'{security.passwords.username_different}' => $this->_config->security->passwords->username_different? 'true' : 'false',
|
||||
'{security.passwords.minimum_length}' => $this->_config->security->passwords->minimum_length,
|
||||
'{security.passwords.include_numbers}'=> $this->_config->security->passwords->include_numbers? 'true' : 'false',
|
||||
'{security.passwords.include_symbols}'=> $this->_config->security->passwords->include_symbols? 'true' : 'false',
|
||||
'{security.passwords.lowercase_and_uppercase}' => $this->_config->security->passwords->lowercase_and_uppercase? 'true' : 'false',
|
||||
'{security.usernames.exclude}' => $this->_config->security->usernames->exclude->current(),
|
||||
'{ldap.enabled}' => $this->_config->ldap->enabled? 'true' : 'false',
|
||||
'{ldap.host}' => $this->_config->ldap->host,
|
||||
'{ldap.baseDn}' => $this->_config->ldap->baseDn,
|
||||
'{ldap.bindRequiresDn}' => $this->_config->ldap->bindRequiresDn? 'true' : 'false',
|
||||
'{ldap.username}' => $this->_config->ldap->username,
|
||||
'{ldap.password}' => $this->_config->ldap->password,
|
||||
'{ldap.admin}' => $this->_config->ldap->admin,
|
||||
'{ldap.keepRecordsSynced}' => $this->_config->ldap->keepRecordsSynced? 'true' : 'false',
|
||||
'{ldap.canChangePassword}' => $this->_config->ldap->canChangePassword? 'true' : 'false',
|
||||
'{ldap.passwordHashing}' => $this->_config->ldap->passwordHashing,
|
||||
'{ldap.fields.nickname}' => $this->_config->ldap->fields->nickname,
|
||||
'{ldap.fields.email}' => $this->_config->ldap->fields->email,
|
||||
'{ldap.fields.fullname}' => $this->_config->ldap->fields->fullname,
|
||||
'{ldap.fields.postcode}' => $this->_config->ldap->fields->postcode,
|
||||
'{yubikey.enabled}' => $this->_config->yubikey->enabled? 'true' : 'false',
|
||||
'{yubikey.force}' => $this->_config->yubikey->force? 'true' : 'false',
|
||||
'{yubikey.api_id}' => $this->_config->yubikey->api_id,
|
||||
'{yubikey.api_key}' => $this->_config->yubikey->api_key,
|
||||
'{email.supportemail}' => $this->_config->email->supportemail,
|
||||
'{email.adminemail}' => $this->_config->email->adminemail,
|
||||
'{email.transport}' => $this->_config->email->transport,
|
||||
@ -147,7 +177,7 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
{
|
||||
$users = new Users_Model_Users();
|
||||
$user = $users->createRow();
|
||||
$user->username = $form->getValue('adminUsername');
|
||||
$user->username = $form->getValue('username');
|
||||
$user->accepted_eula = 1;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->openid = '';
|
||||
@ -196,6 +226,10 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
$errors = array();
|
||||
$webServerUser = $this->_getProcessUser();
|
||||
|
||||
if (version_compare(PHP_VERSION, self::PHP_MINIMAL_VERSION_REQUIRED, '<')) {
|
||||
$errors[] = $this->view->translate('PHP version %s or greater is required',
|
||||
self::PHP_MINIMAL_VERSION_REQUIRED);
|
||||
}
|
||||
if (!is_writable(APP_DIR) && !is_writable(APP_DIR . DIRECTORY_SEPARATOR . 'config.php')) {
|
||||
$errors[] = $this->view->translate('The directory where Community-ID is installed must be writable by the web server user (%s). Another option is to create an EMPTY config.php file that is writable by that user.', $webServerUser);
|
||||
}
|
||||
@ -205,6 +239,18 @@ class Install_CredentialsController extends CommunityID_Controller_Action
|
||||
if (!extension_loaded('mysqli')) {
|
||||
$errors[] = $this->view->translate('You need to have the %s extension installed', '<a href="http://www.php.net/manual/en/mysqli.installation.php">MySQLi</a>');
|
||||
}
|
||||
if (!extension_loaded('gd')) {
|
||||
$errors[] = $this->view->translate('You need to have the %s extension installed', '<a href="http://www.php.net/manual/en/image.installation.php">GD</a>');
|
||||
}
|
||||
if (!function_exists('imagepng')) {
|
||||
$errors[] = $this->view->translate('You need to have <a href="http://www.php.net/manual/en/image.installation.php">PNG support in your GD configuration</a>');
|
||||
}
|
||||
if (!function_exists('imageftbbox')) {
|
||||
$errors[] = $this->view->translate('You need to have <a href="http://www.php.net/manual/en/image.installation.php">Freetype support in your GD configuration</a>');
|
||||
}
|
||||
if (!function_exists('curl_init')) {
|
||||
$errors[] = $this->view->translate('You need to have the %s extension installed', '<a href="http://co.php.net/manual/en/curl.setup.php">cURL</a>');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -50,8 +50,15 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
$result = $users->authenticate($this->_request->getPost('username'),
|
||||
$this->_request->getPost('password'));
|
||||
list($super, $mayor, $minor) = explode('.', $this->_getDbVersion());
|
||||
$greaterThan2 = $super >= 2;
|
||||
$result = $users->authenticate(
|
||||
$this->_request->getPost('username'),
|
||||
$this->_request->getPost('password'),
|
||||
false,
|
||||
$this->view,
|
||||
!$greaterThan2 // bypass mark successfull login 'cause last_login field only exists after v.2
|
||||
);
|
||||
|
||||
if (!$result) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid credentials'));
|
||||
@ -72,6 +79,11 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Upgrade was successful. You are now on version %s', $upgradedVersion));
|
||||
|
||||
$missingConfigs = $this->_checkMissingConfigDirectives();
|
||||
if ($missingConfigs) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('WARNING: there are some new configuration settings. To override their default values (as set in config.default.php) add them to your config.php file. The new settings correspond to the following directives: %s.', implode(', ', $missingConfigs)));
|
||||
}
|
||||
|
||||
// we need to logout user in case the user table changed
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
Zend_Session::forgetMe();
|
||||
@ -85,6 +97,7 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
|
||||
$includeFiles = false;
|
||||
$db = Zend_Registry::get('db');
|
||||
$errors = array();
|
||||
foreach ($versions as $version) {
|
||||
if ($version == $this->_getDbVersion()) {
|
||||
$includeFiles = true;
|
||||
@ -95,19 +108,29 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
continue;
|
||||
}
|
||||
|
||||
$fileName = APP_DIR . '/setup/upgrade_'.$version.'.sql';
|
||||
$sqlFileName = APP_DIR . '/setup/upgrade_'.$version.'.sql';
|
||||
$phpFileName = APP_DIR . '/setup/upgrade_'.$version.'.php';
|
||||
$className = 'Upgrade_' . strtr($version, '.', '_');
|
||||
|
||||
if ($onlyCheckFiles) {
|
||||
if (!file_exists($fileName)) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Correct before upgrading: File %s is required to proceed', $fileName));
|
||||
if (!file_exists($sqlFileName)) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Correct before upgrading: File %s is required to proceed', $sqlFileName));
|
||||
$this->_redirect('index');
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists($phpFileName)) {
|
||||
require_once $phpFileName;
|
||||
$upgradeStage = new $className($this->user, $db, $this->view);
|
||||
$errors = array_merge($errors, $upgradeStage->requirements());
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = '';
|
||||
$lines = file($fileName);
|
||||
$lines = file($sqlFileName);
|
||||
Zend_Registry::get('logger')->log("Running upgrade file $sqlFileName", Zend_Log::DEBUG);
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line != '') {
|
||||
@ -123,8 +146,47 @@ class Install_UpgradeController extends CommunityID_Controller_Action
|
||||
$query = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($phpFileName)) {
|
||||
Zend_Registry::get('logger')->log("Running upgrade file $phpFileName", Zend_Log::DEBUG);
|
||||
$upgradeStage = new $className($this->user, $db, $this->view);
|
||||
$upgradeStage->proceed();
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errorMessages = join('<br />', $errors);
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Please address the following requirements before proceeding with the upgrade:') . '<br />' . $errorMessages);
|
||||
$this->_redirect('index');
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
private function _checkMissingConfigDirectives()
|
||||
{
|
||||
require 'config.default.php';
|
||||
$defaultConfig = $config;
|
||||
unset($config);
|
||||
require 'config.php';
|
||||
$missingConfigs = $this->_getMissingConfigs($defaultConfig, $config);
|
||||
return $missingConfigs;
|
||||
}
|
||||
|
||||
private function _getMissingConfigs($defaultConfig, $config, $baseKey = false)
|
||||
{
|
||||
$missingConfigs = array();
|
||||
|
||||
foreach ($defaultConfig as $key => $value) {
|
||||
if (!isset($config[$key])) {
|
||||
$missingConfigs[] = $key;
|
||||
} else if (is_array($value)) {
|
||||
if ($this->_getMissingConfigs($defaultConfig[$key], $config[$key], $baseKey)) {
|
||||
$missingConfigs[] = $baseKey? $baseKey : $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $missingConfigs;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -15,6 +15,8 @@ class Install_Form_Install extends Zend_Form
|
||||
public function init()
|
||||
{
|
||||
$hostname = new Monkeys_Form_Element_Text('hostname');
|
||||
translate('Hostname');
|
||||
translate('usually localhost');
|
||||
$hostname->setLabel('Hostname')
|
||||
->setDescription('usually localhost')
|
||||
->setRequired(true)
|
||||
@ -22,20 +24,25 @@ class Install_Form_Install extends Zend_Form
|
||||
->setValue('localhost');
|
||||
|
||||
$dbname = new Monkeys_Form_Element_Text('dbname');
|
||||
translate('Database name');
|
||||
$dbname->setLabel('Database name')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->setValue(Zend_Registry::get('config')->database->params->dbname);
|
||||
|
||||
$dbusername = new Monkeys_Form_Element_Text('dbusername');
|
||||
translate('Database username');
|
||||
$dbusername->setLabel('Database username')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$dbpassword = new Monkeys_Form_Element_Password('dbpassword');
|
||||
translate('Database password');
|
||||
$dbpassword->setLabel('Database password');
|
||||
|
||||
$supportemail = new Monkeys_Form_Element_Text('supportemail');
|
||||
translate('Support E-mail');
|
||||
translate('Will be used as the sender for any message sent by the system, and as the recipient for user feedback');
|
||||
$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')
|
||||
@ -43,24 +50,32 @@ class Install_Form_Install extends Zend_Form
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$adminUsername = new Monkeys_Form_Element_Text('adminUsername');
|
||||
$adminUsername->setLabel('Username')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
$username = new Monkeys_Form_Element_Text('username');
|
||||
$username->setLabel('Username')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
$password1 = new Monkeys_Form_Element_Password('password1');
|
||||
translate('Enter password');
|
||||
$passwordValidator = new Monkeys_Validate_Password();
|
||||
$password1->setLabel('Enter password')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true))
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation());
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation())
|
||||
->addValidator($passwordValidator);
|
||||
|
||||
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
|
||||
$password1->setDescription($restrictions);
|
||||
}
|
||||
|
||||
$password2 = new Monkeys_Form_Element_Password('password2');
|
||||
translate('Enter password again');
|
||||
$password2->setLabel('Enter password again')
|
||||
->setRequired(true)
|
||||
->setDecoratorOptions(array('dontMarkRequired' => true));
|
||||
|
||||
|
||||
$this->addElements(array($hostname, $dbname, $dbusername, $dbpassword, $supportemail,
|
||||
$adminUsername, $password1, $password2));
|
||||
$username, $password1, $password2));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -21,6 +21,7 @@ class Install_Form_UpgradeLogin extends Zend_Form
|
||||
->setRequired(true);
|
||||
|
||||
$password = new Monkeys_Form_Element_Password('password');
|
||||
translate('Password');
|
||||
$password->setLabel('Password')
|
||||
->setRequired(true);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<?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->username ?>
|
||||
<?php echo $this->form->password1 ?>
|
||||
<?php echo $this->form->password2 ?>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,106 +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 Stats_AuthorizationsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph(300,200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->img->SetMargin(0,30,20,40);
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
$bplot = new BarPlot($datay);
|
||||
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
$graph->Add($bplot);
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$authorizations = $stats->getNumAuthorizationsDays(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
if (isset($authorizations[$date])) {
|
||||
$datay[] = $authorizations[$date]['entry'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
$authorizations = $stats->getNumAuthorizationsYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
if (isset($authorizations[$monthNumber])) {
|
||||
$datay[] = $authorizations[$monthNumber]['entry'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -11,9 +11,52 @@
|
||||
|
||||
class Stats_IndexController extends CommunityID_Controller_Action
|
||||
{
|
||||
const LOCATION_LEFT = 0;
|
||||
const LOCATION_RIGHT = 1;
|
||||
|
||||
protected $_numCols = 1;
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$statPlugins = array();
|
||||
$this->view->pluginsLeft = array();
|
||||
$this->view->pluginsRight = array();
|
||||
|
||||
$dir = dir(APP_DIR . Stats_Model_Report::STATS_PLUGIN_DIR);
|
||||
$i = 0;
|
||||
while (false !== ($entry = $dir->read())) {
|
||||
if (in_array($entry, array('.', '..'))
|
||||
|| substr($entry, -4) != '.php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$reportName = substr($entry, 0, -4);
|
||||
$statPlugins[$i] = Stats_Model_Report::getReportInstance($reportName);
|
||||
$statPlugins[$i]->setView($this->view);
|
||||
} catch (Monkeys_AccessDeniedException $ex) {
|
||||
Zend_Registry::get('logger')->log("Unable to open Stats plugin: $entry", Zend_Log::WARN);
|
||||
continue;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$dir->close();
|
||||
usort($statPlugins, array($this, '_sortPlugins'));
|
||||
|
||||
$location = self::LOCATION_LEFT;
|
||||
foreach ($statPlugins as $statPlugin) {
|
||||
if ($location == self::LOCATION_LEFT) {
|
||||
$this->view->pluginsLeft[] = $statPlugin;
|
||||
$location = self::LOCATION_RIGHT;
|
||||
} else {
|
||||
$this->view->pluginsRight[] = $statPlugin;
|
||||
$location = self::LOCATION_LEFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _sortPlugins(Stats_Model_Report $pluginA, Stats_Model_Report $pluginB)
|
||||
{
|
||||
return $pluginA->getPriority() - $pluginB->getPriority();
|
||||
}
|
||||
}
|
||||
|
@ -1,130 +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 Stats_RegistrationsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'month':
|
||||
$this->view->monthSelected = 'selected="true"';
|
||||
$this->view->type = 'month';
|
||||
break;
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph($this->_getParam('type') == 'month'? 400 : 300, 200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->img->SetMargin(0,30,20,40);
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'month':
|
||||
$this->_populateMonthData($labelsy, $datay);
|
||||
break;
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
$bplot = new BarPlot($datay);
|
||||
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
$graph->Add($bplot);
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time(), true);
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
if (isset($registeredUsers[$date])) {
|
||||
$datay[] = $registeredUsers[$date]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateMonthData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'), true);
|
||||
|
||||
for ($i = -30; $i < -7; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = date('j', $time);
|
||||
if (isset($registeredUsers[$date])) {
|
||||
$datay[] = $registeredUsers[$date]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time(), true);
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
if (isset($registeredUsers[$monthNumber])) {
|
||||
$datay[] = $registeredUsers[$monthNumber]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
modules/stats/controllers/ReportsController.php
Normal file
50
modules/stats/controllers/ReportsController.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 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 Stats_ReportsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$statPlugin = $this->_getPlugin();
|
||||
$statPlugin->setTemplateVars();
|
||||
|
||||
$pluginView = clone $this->view;
|
||||
$pluginView->plugin = $statPlugin;
|
||||
$pluginView->setScriptPath(APP_DIR . Stats_Model_Report::STATS_PLUGIN_DIR);
|
||||
$this->view->reportTitle = $statPlugin->getTitle();
|
||||
$this->view->content = $pluginView->render($statPlugin->getClassName().'.phtml');
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
$statPlugin = $this->_getPlugin();
|
||||
$statPlugin->renderGraph();
|
||||
}
|
||||
|
||||
private function _getPlugin()
|
||||
{
|
||||
$reportName = $this->_getParam('report');
|
||||
|
||||
try {
|
||||
$statPlugin = Stats_Model_Report::getReportInstance($reportName);
|
||||
} catch (Monkeys_AccessDeniedException $ex) {
|
||||
throw new Exception("Unable to open Stats plugin: $entry");
|
||||
}
|
||||
|
||||
$statPlugin->setControllerAction($this);
|
||||
$statPlugin->setView($this->view);
|
||||
|
||||
return $statPlugin;
|
||||
}
|
||||
}
|
||||
|
@ -1,168 +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 Stats_SitesController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
require_once 'libs/jpgraph/jpgraph_line.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph(300,200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->SetY2Scale("lin");
|
||||
$graph->img->SetMargin(0,30,20,50);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->y2axis->SetColor("black","red");
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
$datay2 = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay, $datay2);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay, $datay2);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
|
||||
$bplot = new BarPlot($datay);
|
||||
$bplot->setLegend(utf8_decode($this->view->translate('Trusted sites')));
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
|
||||
$p1 = new LinePlot($datay2);
|
||||
$p1->SetColor("red");
|
||||
$p1->SetLegend(utf8_decode($this->view->translate('Sites per user')));
|
||||
|
||||
$graph->Add($bplot);
|
||||
$graph->AddY2($p1);
|
||||
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->Pos(0.5,0.99,"center","bottom");
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay, &$datay2)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$initialTrustedSites = $stats->getNumTrustedSites(strtotime('-1 week'));
|
||||
$initialRegisteredUsers = $stats->getNumRegisteredUsers(strtotime('-1 week'));
|
||||
|
||||
$sites = $stats->getNumTrustedSitesDays(strtotime('-1 week'), time());
|
||||
$numUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
|
||||
if (isset($sites[$date])) {
|
||||
$sitesPeriod = $sites[$date]['site'];
|
||||
} else {
|
||||
$sitesPeriod = 0;
|
||||
}
|
||||
|
||||
if (isset($numUsers[$date])) {
|
||||
$usersPeriod = $numUsers[$date]['users'];
|
||||
} else {
|
||||
$usersPeriod = 0;
|
||||
}
|
||||
|
||||
if ($i > -7) {
|
||||
$datay[] = $datay[$i + 6] + $sitesPeriod;
|
||||
$datay2[] = $datay2[$i + 6] + $usersPeriod;
|
||||
} else {
|
||||
$datay[] = $initialTrustedSites + $sitesPeriod;
|
||||
$datay2[] = $initialRegisteredUsers + $usersPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($datay2); $i++) {
|
||||
$datay2[$i] = round($datay[$i] / $datay2[$i], 2);
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay, &$datay2)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$initialTrustedSites = $stats->getNumTrustedSites(strtotime('-1 week'));
|
||||
$initialRegisteredUsers = $stats->getNumRegisteredUsers(strtotime('-1 week'));
|
||||
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
|
||||
$sites = $stats->getNumTrustedSitesYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
|
||||
$numUsers = $stats->getNumRegisteredUsersYear(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
|
||||
if (isset($sites[$monthNumber])) {
|
||||
$sitesPeriod = $sites[$monthNumber]['site'];
|
||||
} else {
|
||||
$sitesPeriod = 0;
|
||||
}
|
||||
|
||||
if (isset($numUsers[$monthNumber])) {
|
||||
$usersPeriod = $numUsers[$monthNumber]['users'];
|
||||
} else {
|
||||
$usersPeriod = 0;
|
||||
}
|
||||
|
||||
if ($i > -11) {
|
||||
$datay[] = $datay[$i + 10] + $sitesPeriod;
|
||||
$datay2[] = $datay2[$i + 10] + $usersPeriod;
|
||||
} else {
|
||||
$datay[] = $initialTrustedSites + $sitesPeriod;
|
||||
$datay2[] = $initialRegisteredUsers + $usersPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($datay2); $i++) {
|
||||
$datay2[$i] = round($datay[$i] / $datay2[$i], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +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 Stats_TopController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$this->view->sites = $stats->getTopTenSites();
|
||||
}
|
||||
}
|
65
modules/stats/models/Report.php
Normal file
65
modules/stats/models/Report.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
abstract class Stats_Model_Report
|
||||
{
|
||||
const STATS_PLUGIN_DIR = '/plugins/stats';
|
||||
|
||||
protected $_controllerAction;
|
||||
protected $view;
|
||||
|
||||
public abstract function getTitle();
|
||||
|
||||
public abstract function getPriority();
|
||||
|
||||
public abstract function setTemplateVars();
|
||||
|
||||
public function renderGraph() {}
|
||||
|
||||
public function setView(Zend_View $view)
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function setControllerAction(CommunityID_Controller_Action $controllerAction)
|
||||
{
|
||||
$this->_controllerAction = $controllerAction;
|
||||
}
|
||||
|
||||
public function getIdentifier()
|
||||
{
|
||||
return md5($this->getTitle());
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return get_class($this);
|
||||
}
|
||||
|
||||
public static function getReportInstance($reportName)
|
||||
{
|
||||
$statPath = APP_DIR . self::STATS_PLUGIN_DIR . "/$reportName.php";
|
||||
if (Zend_Registry::get('config')->environment->production) {
|
||||
$includeResult = @include $statPath;
|
||||
} else {
|
||||
$includeResult = include $statPath;
|
||||
}
|
||||
if (!$includeResult) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
Zend_Registry::get('logger')->log("Unable to open Stats plugin: $statPath", Zend_Log::WARN);
|
||||
continue;
|
||||
}
|
||||
|
||||
$statPlugin = new $reportName();
|
||||
|
||||
return $statPlugin;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Authorizations per day') ?></h3>
|
||||
<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 ?>><?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=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
||||
|
@ -1,12 +1,12 @@
|
||||
<script>
|
||||
var reports = new Array();
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
COMMID.loader.insert(
|
||||
["connection"],
|
||||
function() {
|
||||
COMMID.stats.loadReport("registrations", "statsRegs");
|
||||
COMMID.stats.loadReport("authorizations", "statsAuths");
|
||||
COMMID.stats.loadReport("sites", "statsNumTrustedSites");
|
||||
COMMID.stats.loadReport("top", "statsTopTen");
|
||||
for (var i = 0; i < reports.length; i++) {
|
||||
COMMID.stats.loadReport(reports[i].name, reports[i].location);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -14,11 +14,19 @@ YAHOO.util.Event.onDOMReady(function () {
|
||||
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
<div id="statsRegs"></div>
|
||||
<div id="statsNumTrustedSites"></div>
|
||||
<? foreach ($this->pluginsLeft as $plugin): ?>
|
||||
<div id="stats_<?= $plugin->getIdentifier() ?>"></div>
|
||||
<script>
|
||||
reports.push({name: "<?= $plugin->getClassName() ?>", location: "stats_<?= $plugin->getIdentifier() ?>"});
|
||||
</script>
|
||||
<? endforeach ?>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<div id="statsAuths"></div>
|
||||
<div id="statsTopTen"></div>
|
||||
<? foreach ($this->pluginsRight as $plugin): ?>
|
||||
<div id="stats_<?= $plugin->getIdentifier() ?>"></div>
|
||||
<script>
|
||||
reports.push({name: "<?= $plugin->getClassName() ?>", location: "stats_<?= $plugin->getIdentifier() ?>"});
|
||||
</script>
|
||||
<? endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Registrations per day') ?></h3>
|
||||
<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 ?>><?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=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
2
modules/stats/views/scripts/reports/index.phtml
Normal file
2
modules/stats/views/scripts/reports/index.phtml
Normal file
@ -0,0 +1,2 @@
|
||||
<h3><?= $this->reportTitle ?></h3>
|
||||
<?= $this->content ?>
|
@ -1,9 +0,0 @@
|
||||
<h3><?php echo $this->translate('Trusted Sites') ?></h3>
|
||||
<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 ?>><?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=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Top 10 Trusted Sites') ?></h3>
|
||||
<table id="topTenTable">
|
||||
<?php foreach ($this->sites as $num => $siteInfo): ?>
|
||||
<tr>
|
||||
<td><?php echo $num + 1 ?></td>
|
||||
<td><?php echo $siteInfo['site'] ?></td>
|
||||
<td>(<?php echo $this->translate('%s users', $siteInfo['num']) ?>)</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
33
modules/users/controllers/LoginController.php
Executable file → Normal file
33
modules/users/controllers/LoginController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -25,11 +25,28 @@ class Users_LoginController extends CommunityID_Controller_Action
|
||||
$this->view->loginForm = new Users_Form_Login(null, $this->view->base, $this->view->useCaptcha);
|
||||
|
||||
if ($this->_config->SSL->enable_mixed_mode) {
|
||||
$this->view->loginTargetBase = 'https://' . $_SERVER['HTTP_HOST'] . $this->view->base;
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
// in this case $this->view->base contains the full URL, so we just gotta replace the protocol
|
||||
$this->view->loginTargetBase = 'https' . substr($this->view->base, strpos($this->view->base, '://'));
|
||||
} else {
|
||||
$this->view->loginTargetBase = 'https://' . $_SERVER['HTTP_HOST'] . $this->view->base;
|
||||
}
|
||||
} else {
|
||||
$this->view->loginTargetBase = $this->view->base;
|
||||
}
|
||||
|
||||
$this->view->allowRegistrations = $this->_config->environment->registrations_enabled;
|
||||
|
||||
|
||||
if ($this->user->role == Users_Model_User::ROLE_GUEST && @$_COOKIE['image']) {
|
||||
$images = new Users_Model_SigninImages();
|
||||
$this->view->image = $images->getByCookie($_COOKIE['image']);
|
||||
} else {
|
||||
$this->view->image = false;
|
||||
}
|
||||
|
||||
$this->view->yubikey = $this->_config->yubikey;
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('sidebar');
|
||||
}
|
||||
|
||||
@ -48,9 +65,15 @@ class Users_LoginController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
$result = $users->authenticate($this->_request->getPost('username'),
|
||||
$this->_request->getPost('password'));
|
||||
|
||||
$result = $users->authenticate(
|
||||
$this->_request->getPost('username'),
|
||||
$this->_config->yubikey->enabled && $this->_config->yubikey->force?
|
||||
$this->_request->getPost('yubikey')
|
||||
: $this->_request->getPost('password'),
|
||||
false,
|
||||
$this->view
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
$user = $users->getUser();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -21,7 +21,13 @@ class Users_ManageusersController extends CommunityID_Controller_Action
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
|
||||
if ($this->_config->ldap->enabled && $this->_config->ldap->keepRecordsSynced) {
|
||||
$ldap = Monkeys_Ldap::getInstance();
|
||||
$ldap->delete($this->targetUser);
|
||||
}
|
||||
|
||||
$this->targetUser->delete();
|
||||
|
||||
echo $this->view->translate('User has been deleted successfully');
|
||||
}
|
||||
|
||||
@ -42,31 +48,30 @@ 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) {
|
||||
$this->_increaseReminderCount($user);
|
||||
} catch (Zend_Mail_Exception $e) {
|
||||
Zend_Registry::get('logger')->log($e->getMessage(), Zend_Log::ERR);
|
||||
if (!$this->_config->environment->production) {
|
||||
// still increase the reminder counter when testing
|
||||
$this->_increaseReminderCount($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _increaseReminderCount(Users_Model_User $user)
|
||||
{
|
||||
$user->reminders++;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Mail
|
||||
* @throws Zend_Mail_Protocol_Exception
|
||||
*/
|
||||
public static function getMail(Users_Model_User $user, $subject)
|
||||
{
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
if (file_exists(APP_DIR . "/resources/$locale/reminder_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/reminder_mail.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/reminder_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/reminder_mail.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/reminder_mail.txt";
|
||||
}
|
||||
|
||||
$file = CommunityID_Resources::getResourcePath('reminder_mail.txt');
|
||||
$emailTemplate = file_get_contents($file);
|
||||
$emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
|
||||
|
||||
@ -74,7 +79,7 @@ class Users_ManageusersController extends CommunityID_Controller_Action
|
||||
preg_match('#(.*)/manageusers/sendreminder#', $currentUrl, $matches);
|
||||
$emailTemplate = str_replace('{registrationURL}', $matches[1] . '/register/eula?token=' . $user->token, $emailTemplate);
|
||||
|
||||
// can't use $this-_config 'cause it's a static function
|
||||
// can't use $this->_config 'cause it's a static function
|
||||
$configEmail = Zend_Registry::get('config')->email;
|
||||
|
||||
switch (strtolower($configEmail->transport)) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -20,30 +20,33 @@ class Users_PersonalinfoController extends CommunityID_Controller_Action
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
}
|
||||
$profiles = new Users_Model_Profiles();
|
||||
$this->view->profiles = $profiles->getForUser($this->user);
|
||||
|
||||
public function showAction()
|
||||
{
|
||||
$fields = new Model_Fields();
|
||||
$this->view->fields = $fields->getValues($this->user);
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
}
|
||||
|
||||
public function editAction()
|
||||
{
|
||||
$this->view->profile = $this->_getProfile();
|
||||
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
if (isset($appSession->personalInfoForm)) {
|
||||
$this->view->fields = $appSession->personalInfoForm->getElements();
|
||||
unset($appSession->personalInfoForm);
|
||||
} else {
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $this->user);
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $this->view->profile);
|
||||
$this->view->fields = $personalInfoForm->getElements();
|
||||
}
|
||||
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$form = new Users_Form_PersonalInfo(null, $this->user);
|
||||
$profile = $this->_getProfile();
|
||||
|
||||
$form = new Users_Form_PersonalInfo(null, $profile);
|
||||
$formData = $this->_request->getPost();
|
||||
|
||||
$form->populate($formData);
|
||||
@ -55,15 +58,23 @@ class Users_PersonalinfoController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$fieldsValues = new Model_FieldsValues();
|
||||
$fieldsValues->deleteForUser($this->user);
|
||||
|
||||
if ($this->_getParam('profile')) {
|
||||
$fieldsValues->deleteForProfile($profile);
|
||||
} else {
|
||||
$profile->user_id = $this->user->id;
|
||||
$profile->name = $form->getValue('profileName');
|
||||
$profile->save();
|
||||
}
|
||||
|
||||
foreach ($form->getValues() as $fieldName => $fieldValue) {
|
||||
if (!$fieldValue) {
|
||||
if ($fieldName == 'profileName' || !$fieldValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fieldsValue = $fieldsValues->createRow();
|
||||
$fieldsValue->user_id = $this->user->id;
|
||||
$fieldsValue->profile_id = $profile->id;
|
||||
|
||||
list(, $fieldId) = explode('_', $fieldName);
|
||||
$fieldsValue->field_id = $fieldId;
|
||||
@ -73,7 +84,34 @@ class Users_PersonalinfoController extends CommunityID_Controller_Action
|
||||
$fieldsValue->save();
|
||||
}
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Profile has been saved'));
|
||||
$this->_redirect('/users/personalinfo');
|
||||
}
|
||||
|
||||
$this->_forward('show');
|
||||
public function deleteAction()
|
||||
{
|
||||
$profile = $this->_getProfile();
|
||||
if ($profile->id) {
|
||||
$profile->delete();
|
||||
}
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Profile has been deleted'));
|
||||
$this->_redirect('/users/personalinfo');
|
||||
}
|
||||
|
||||
private function _getProfile()
|
||||
{
|
||||
$profiles = new Users_Model_Profiles();
|
||||
|
||||
if (!$this->_getParam('profile')) {
|
||||
return $profiles->createRow();
|
||||
}
|
||||
|
||||
$profile = $profiles->getRowInstance($this->_getParam('profile'));
|
||||
if (!$profile || $profile->user_id != $this->user->id) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
return $profile;
|
||||
}
|
||||
}
|
||||
|
9
modules/users/controllers/ProfileController.php
Executable file → Normal file
9
modules/users/controllers/ProfileController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -17,6 +17,13 @@ class Users_ProfileController extends CommunityID_Controller_Action
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
$this->view->canEditAccountInfo = !$this->_config->ldap->enabled
|
||||
|| ($this->_config->ldap->enabled && $this->_config->ldap->keepRecordsSynced);
|
||||
$this->view->canChangePassword = !$this->_config->ldap->enabled
|
||||
|| ($this->_config->ldap->enabled && $this->_config->ldap->canChangePassword);
|
||||
|
||||
$this->view->yubikey = $this->_config->yubikey;
|
||||
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -24,13 +24,15 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
|
||||
public function accountinfoAction()
|
||||
{
|
||||
$this->view->yubikey = $this->_config->yubikey;
|
||||
}
|
||||
|
||||
public function editaccountinfoAction()
|
||||
{
|
||||
if ($this->targetUser->id != $this->user->id
|
||||
// this condition checks for an non-admin trying to add a new user
|
||||
&& ($this->targetUser->id != 0 || $this->user->role != Users_Model_User::ROLE_ADMIN))
|
||||
if (($this->targetUser->id != $this->user->id
|
||||
// this condition checks for an non-admin trying to add a new user
|
||||
&& ($this->targetUser->id != 0 || $this->user->role != Users_Model_User::ROLE_ADMIN))
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->keepRecordsSynced))
|
||||
{
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
@ -46,16 +48,22 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
'firstname' => $this->targetUser->firstname,
|
||||
'lastname' => $this->targetUser->lastname,
|
||||
'email' => $this->targetUser->email,
|
||||
'authMethod' => $this->targetUser->auth_type,
|
||||
'yubikey' => '' // of course empty
|
||||
));
|
||||
}
|
||||
|
||||
$this->view->yubikey = $this->_config->yubikey;
|
||||
}
|
||||
|
||||
public function saveaccountinfoAction()
|
||||
{
|
||||
$isNewUser = is_null($this->targetUser->id)? true : false;
|
||||
|
||||
if (!$isNewUser && $this->targetUser->id != $this->user->id) {
|
||||
// admins can add new users, but not edit existing ones
|
||||
if (
|
||||
// admins can add new users, but not edit existing ones
|
||||
(!$isNewUser && $this->targetUser->id != $this->user->id)
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->keepRecordsSynced)) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
@ -68,9 +76,10 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$existingUsernameOrEmail = false;
|
||||
$oldUsername = $this->targetUser->username;
|
||||
$newUsername = $form->getValue('username');
|
||||
if (($isNewUser && $this->_usernameAlreadyExists($newUsername))
|
||||
|| (!$isNewUser && ($this->targetUser->username != $newUsername)
|
||||
|| (!$isNewUser && ($oldUsername != $newUsername)
|
||||
&& $this->_usernameAlreadyExists($newUsername)))
|
||||
{
|
||||
$form->username->addError($this->view->translate('This username is already in use'));
|
||||
@ -90,6 +99,21 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
return $this->_redirectInvalidForm($form);
|
||||
}
|
||||
|
||||
if ($this->_config->yubikey->enabled) {
|
||||
$this->targetUser->auth_type = $form->getValue('authMethod');
|
||||
$yubikey = trim($form->getValue('yubikey'));
|
||||
if ($form->getValue('authMethod') == Users_Model_User::AUTH_YUBIKEY) {
|
||||
// only store or update yubikey for new users or existing that filled in something
|
||||
if ($isNewUser || $yubikey) {
|
||||
if (!$publicId = $this->_getYubikeyPublicId($yubikey)) {
|
||||
$form->yubikey->addError($this->view->translate('Could not validate Yubikey'));
|
||||
return $this->_redirectInvalidForm($form);
|
||||
}
|
||||
$this->targetUser->yubikey_publicid = $publicId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->targetUser->username = $newUsername;
|
||||
$this->targetUser->firstname = $form->getValue('firstname');
|
||||
$this->targetUser->lastname = $form->getValue('lastname');
|
||||
@ -97,11 +121,35 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
if ($isNewUser) {
|
||||
$this->targetUser->accepted_eula = 1;
|
||||
$this->targetUser->registration_date = date('Y-m-d');
|
||||
$this->targetUser->openid = $this->_generateOpenId($this->targetUser->username);
|
||||
|
||||
preg_match('#(.*)/users/profile.*#', Zend_OpenId::selfURL(), $matches);
|
||||
$this->targetUser->generateOpenId($matches[1]);
|
||||
|
||||
$this->targetUser->role = Users_Model_User::ROLE_REGISTERED;
|
||||
$this->targetUser->setClearPassword($form->getValue('password1'));
|
||||
}
|
||||
|
||||
if ($this->_config->ldap->enabled && $this->_config->ldap->keepRecordsSynced) {
|
||||
$ldap = Monkeys_Ldap::getInstance();
|
||||
|
||||
if ($isNewUser) {
|
||||
$this->targetUser->setPassword($form->getValue('password1'));
|
||||
$ldap->add($this->targetUser);
|
||||
} else {
|
||||
if ($oldUsername != $newUsername) {
|
||||
$ldap->modifyUsername($this->targetUser, $oldUsername);
|
||||
}
|
||||
$ldap->modify($this->targetUser);
|
||||
}
|
||||
|
||||
// LDAP passwords must not be stored in the DB
|
||||
$this->targetUser->setPassword('');
|
||||
}
|
||||
|
||||
$this->targetUser->save();
|
||||
if ($isNewUser) {
|
||||
$this->targetUser->createDefaultProfile($this->view);
|
||||
}
|
||||
|
||||
/**
|
||||
* When the form is submitted through a YUI request using a file, an iframe is used,
|
||||
@ -115,7 +163,7 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
private function _usernameAlreadyExists($username)
|
||||
{
|
||||
$users = $this->_getUsers();
|
||||
return $users->getUserWithUsername($username);
|
||||
return $users->getUserWithUsername($username, false, $this->view);
|
||||
}
|
||||
|
||||
private function _emailAlreadyExists($email)
|
||||
@ -144,8 +192,9 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
*/
|
||||
public function changepasswordAction()
|
||||
{
|
||||
if ($this->targetUser->id != $this->user->id)
|
||||
{
|
||||
if (($this->targetUser->id != $this->user->id)
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->canChangePassword)
|
||||
|| ($this->_config->yubikey->enabled && $this->_config->yubikey->force)) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
@ -154,18 +203,19 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
$this->view->changePasswordForm = $appSession->changePasswordForm;
|
||||
unset($appSession->changePasswordForm);
|
||||
} else {
|
||||
$this->view->changePasswordForm = new Users_Form_ChangePassword();
|
||||
$this->view->changePasswordForm = new Users_Form_ChangePassword(null, $this->user->username);
|
||||
}
|
||||
}
|
||||
|
||||
public function savepasswordAction()
|
||||
{
|
||||
if ($this->targetUser->id != $this->user->id)
|
||||
{
|
||||
if (($this->targetUser->id != $this->user->id)
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->canChangePassword)
|
||||
|| ($this->_config->yubikey->enabled && $this->_config->yubikey->force)) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
$form = new Users_Form_ChangePassword();
|
||||
$form = new Users_Form_ChangePassword(null, $this->user->username);
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
if (!$form->isValid($formData)) {
|
||||
@ -175,14 +225,21 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
}
|
||||
|
||||
$this->targetUser->setClearPassword($form->getValue('password1'));
|
||||
$this->targetUser->save();
|
||||
|
||||
if ($this->_config->ldap->enabled && $this->_config->ldap->canChangePassword) {
|
||||
$ldap = Monkeys_Ldap::getInstance();
|
||||
$ldap->modify($this->targetUser, $form->getValue('password1'));
|
||||
} else {
|
||||
$this->targetUser->save();
|
||||
}
|
||||
|
||||
return $this->_forward('accountinfo', null , null, array('userid' => $this->targetUser->id));
|
||||
}
|
||||
|
||||
public function confirmdeleteAction()
|
||||
{
|
||||
if ($this->user->role == Users_Model_User::ROLE_ADMIN) {
|
||||
if ($this->user->role == Users_Model_User::ROLE_ADMIN
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->keepRecordsSynced)) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
@ -191,6 +248,11 @@ class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if ($this->user->role == Users_Model_User::ROLE_ADMIN
|
||||
|| ($this->_config->ldap->enabled && !$this->_config->ldap->keepRecordsSynced)) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
$mail = self::getMail();
|
||||
$mail->setFrom($this->_config->email->supportemail);
|
||||
$mail->addTo($this->_config->email->supportemail);
|
||||
@ -234,42 +296,26 @@ EOT;
|
||||
$mail->setBodyText($body);
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Zend_Mail_Protocol_Exception $e) {
|
||||
} catch (Zend_Mail_Exception $e) {
|
||||
if ($this->_config->logging->level == Zend_Log::DEBUG) {
|
||||
$this->_helper->FlashMessenger->addMessage('Account was deleted, but feedback form couldn\'t be sent to admins');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Account was deleted, but feedback form couldn\'t be sent to admins'));
|
||||
}
|
||||
}
|
||||
|
||||
$users = $this->_getUsers();
|
||||
$users->deleteUser($this->user);
|
||||
|
||||
if ($this->_config->ldap->enabled && $this->_config->ldap->keepRecordsSynced) {
|
||||
$ldap = Monkeys_Ldap::getInstance();
|
||||
$ldap->delete($this->user);
|
||||
}
|
||||
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Your acccount has been successfully deleted'));
|
||||
$this->_redirect('');
|
||||
}
|
||||
|
||||
private function _generateOpenId($username)
|
||||
{
|
||||
$selfUrl = Zend_OpenId::selfUrl();
|
||||
if (!preg_match('#(.*)/users/profile.*#', $selfUrl, $matches)) {
|
||||
throw new Exception('Couldn\'t retrieve current URL');
|
||||
}
|
||||
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
$openid = $this->getProtocol() . '://' . $username . '.' . $this->_config->subdomain->hostname;
|
||||
} else {
|
||||
$openid = $matches[1] . "/identity/$username";
|
||||
}
|
||||
|
||||
if ($this->_config->SSL->enable_mixed_mode) {
|
||||
$openid = str_replace('http://', 'https://', $openid);
|
||||
}
|
||||
|
||||
Zend_OpenId::normalizeUrl($openid);
|
||||
|
||||
return $openid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Mail
|
||||
* @throws Zend_Mail_Protocol_Exception
|
||||
@ -308,4 +354,33 @@ EOT;
|
||||
|
||||
return $this->_users;
|
||||
}
|
||||
|
||||
private function _getYubikeyPublicId($yubikey)
|
||||
{
|
||||
$authAdapter = new Monkeys_Auth_Adapter_Yubikey(
|
||||
array(
|
||||
'api_id' => $this->_config->yubikey->api_id,
|
||||
'api_key' => $this->_config->yubikey->api_key
|
||||
),
|
||||
null,
|
||||
$yubikey
|
||||
);
|
||||
|
||||
// do not go through Zend_Auth::getInstance() to avoid losing the session if
|
||||
// the yubikey is invalid
|
||||
$result = $authAdapter->authenticate($authAdapter);
|
||||
if ($result->isValid()) {
|
||||
$parts = Yubico_Auth::parsePasswordOTP($yubikey);
|
||||
return $parts['prefix'];
|
||||
}
|
||||
|
||||
$logger = Zend_Registry::get('logger');
|
||||
$logger->log("Invalid authentication: " . implode(' - ', $result->getMessages()), Zend_Log::DEBUG);
|
||||
$authOptions = $authAdapter->getOptions();
|
||||
if ($yubi = @$authOptions['yubiClient']) {
|
||||
$logger->log("Yubi request was: " . $yubi->getlastQuery(), Zend_Log::DEBUG);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
30
modules/users/controllers/RecoverpasswordController.php
Executable file → Normal file
30
modules/users/controllers/RecoverpasswordController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -57,23 +57,13 @@ class Users_RecoverpasswordController extends CommunityID_Controller_Action
|
||||
$user->token = Users_Model_User::generateToken();
|
||||
$user->save();
|
||||
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
if (file_exists(APP_DIR . "/resources/$locale/passwordreset_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/passwordreset_mail.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/passwordreset_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/passwordreset_mail.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/passwordreset_mail.txt";
|
||||
}
|
||||
|
||||
$file = CommunityID_Resources::getResourcePath('passwordreset_mail.txt');
|
||||
$emailTemplate = file_get_contents($file);
|
||||
$emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
|
||||
$emailTemplate = str_replace('{IP}', $_SERVER['REMOTE_ADDR'], $emailTemplate);
|
||||
|
||||
// $_SERVER['SCRIPT_URI'] is not always available
|
||||
$URI = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$URI = self::getProtocol() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
preg_match('#(.*)/users/recoverpassword#', $URI, $matches);
|
||||
$emailTemplate = str_replace('{passwordResetURL}',
|
||||
$matches[1] . '/users/recoverpassword/reset?token=' . $user->token,
|
||||
@ -90,7 +80,7 @@ class Users_RecoverpasswordController extends CommunityID_Controller_Action
|
||||
$users = new Users_Model_Users();
|
||||
$user = $users->getUserWithToken($this->_getParam('token'));
|
||||
if (!$user) {
|
||||
$this->_helper->FlashMessenger->addMessage('Wrong Token');
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Wrong Token'));
|
||||
$this->_redirect('');
|
||||
return;
|
||||
}
|
||||
@ -103,17 +93,7 @@ class Users_RecoverpasswordController extends CommunityID_Controller_Action
|
||||
|
||||
$user->save();
|
||||
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
if (file_exists(APP_DIR . "/resources/$locale/passwordreset2_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/passwordreset2_mail.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/passwordreset2_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/passwordreset2_mail.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/passwordreset2_mail.txt";
|
||||
}
|
||||
|
||||
$file = CommunityID_Resources::getResourcePath('passwordreset2_mail.txt');
|
||||
$emailTemplate = file_get_contents($file);
|
||||
$emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
|
||||
$emailTemplate = str_replace('{password}', $newPassword, $emailTemplate);
|
||||
|
74
modules/users/controllers/RegisterController.php
Executable file → Normal file
74
modules/users/controllers/RegisterController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -55,7 +55,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
|
||||
if ($users->getUserWithUsername($form->getValue('username'))) {
|
||||
if ($users->getUserWithUsername($form->getValue('username'), false, $this->view)) {
|
||||
$form->username->addError($this->view->translate('This username is already in use'));
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
$appSession->registerForm = $form;
|
||||
@ -76,35 +76,37 @@ class Users_RegisterController extends CommunityID_Controller_Action
|
||||
$user->email = $form->getValue('email');
|
||||
$user->username = $form->getValue('username');
|
||||
|
||||
$currentUrl = Zend_OpenId::selfURL();
|
||||
preg_match('#(.*)/users/register/save#', $currentUrl, $matches);
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
$openid = $this->getProtocol() . '://' . $user->username . '.' . $this->_config->subdomain->hostname;
|
||||
preg_match('#(.*)/users/register/save#', Zend_OpenId::selfURL(), $matches);
|
||||
$user->generateOpenId($matches[1]);
|
||||
|
||||
if ($this->_config->ldap->enabled) {
|
||||
// when using ldap, unconfirmed users' password is saved unhashed temporarily, while he registers,
|
||||
// and then it's stored in LDAP and cleared from the db
|
||||
$user->setPassword($form->getValue('password1'));
|
||||
} else {
|
||||
$openid = $matches[1] . '/identity/' . $user->username;
|
||||
$user->setClearPassword($form->getValue('password1'));
|
||||
}
|
||||
|
||||
if ($this->_config->SSL->enable_mixed_mode) {
|
||||
$openid = str_replace('http://', 'https://', $openid);
|
||||
}
|
||||
Zend_OpenId::normalizeUrl($openid);
|
||||
$user->openid = $openid;
|
||||
|
||||
$user->setClearPassword($form->getValue('password1'));
|
||||
$user->role = Users_Model_User::ROLE_GUEST;
|
||||
$registrationToken = Users_Model_User::generateToken();
|
||||
$user->token = $registrationToken;
|
||||
$user->token = Users_Model_User::generateToken();
|
||||
$user->accepted_eula = 0;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->save();
|
||||
|
||||
$mail = self::getMail($user, $this->view->translate('Community-ID registration confirmation'));
|
||||
try {
|
||||
$mail->send();
|
||||
$user->save();
|
||||
$user->createDefaultProfile($this->view);
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Thank you.'));
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('You will receive an E-mail with instructions to activate the account.'));
|
||||
} catch (Zend_Mail_Protocol_Exception $e) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The account was created but the E-mail could not be sent'));
|
||||
} catch (Zend_Mail_Exception $e) {
|
||||
if ($this->_config->environment->production) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The confirmation E-mail could not be sent, so the account creation was cancelled. Please contact support.'));
|
||||
} else {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('The account was created but the E-mail could not be sent'));
|
||||
// I still wanna create the user when in development mode
|
||||
$user->save();
|
||||
}
|
||||
if ($this->_config->logging->level == Zend_Log::DEBUG) {
|
||||
$this->_helper->FlashMessenger->addMessage($e->getMessage());
|
||||
}
|
||||
@ -125,18 +127,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
|
||||
|
||||
$this->view->token = $user->token;
|
||||
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
|
||||
if (file_exists(APP_DIR . "/resources/$locale/eula.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/eula.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/eula.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/eula.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/eula.txt";
|
||||
}
|
||||
|
||||
$file = CommunityID_Resources::getResourcePath('eula.txt');
|
||||
$this->view->eula = file_get_contents($file);
|
||||
}
|
||||
|
||||
@ -171,6 +162,15 @@ class Users_RegisterController extends CommunityID_Controller_Action
|
||||
$user->accepted_eula = 1;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->token = '';
|
||||
|
||||
if ($this->_config->ldap->enabled) {
|
||||
$ldap = Monkeys_Ldap::getInstance();
|
||||
$ldap->add($user);
|
||||
|
||||
// clear unencrypted password
|
||||
$user->setPassword('');
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
@ -185,17 +185,7 @@ class Users_RegisterController extends CommunityID_Controller_Action
|
||||
*/
|
||||
public static function getMail(Users_Model_User $user, $subject)
|
||||
{
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
if (file_exists(APP_DIR . "/resources/$locale/registration_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/registration_mail.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/registration_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/registration_mail.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/registration_mail.txt";
|
||||
}
|
||||
|
||||
$file = CommunityID_Resources::getResourcePath('registration_mail.txt');
|
||||
$emailTemplate = file_get_contents($file);
|
||||
$emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
|
||||
|
||||
|
119
modules/users/controllers/SigninimageController.php
Normal file
119
modules/users/controllers/SigninimageController.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 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 Users_SigninimageController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
if (isset($appSession->signinImageForm)) {
|
||||
$this->view->signinImageForm = $appSession->signinImageForm;
|
||||
unset($appSession->signinImageForm);
|
||||
} else {
|
||||
$this->view->signinImageForm = new Users_Form_SigninImage();
|
||||
}
|
||||
|
||||
if (@$_COOKIE['image']) {
|
||||
$this->view->enabled = true;
|
||||
} else {
|
||||
$this->view->enabled = false;
|
||||
}
|
||||
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
}
|
||||
|
||||
public function saveimageAction()
|
||||
{
|
||||
$form = new Users_Form_SigninImage();
|
||||
$formData = $this->_request->getPost();
|
||||
|
||||
// the framework doesn't allow doing this cleanly yet
|
||||
$formData = array_merge($formData, array('image' => $_FILES['image']['name']));
|
||||
|
||||
$form->populate($formData);
|
||||
if (!$form->isValid($formData)) {
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
$appSession->signinImageForm = $form;
|
||||
|
||||
$this->_forward('index');
|
||||
return;
|
||||
}
|
||||
|
||||
$fileInfo = $form->image->getFileInfo();
|
||||
$images = new Users_Model_SigninImages();
|
||||
$images->deleteForUser($this->user);
|
||||
$image = $images->createRow();
|
||||
$image->user_id = $this->user->id;
|
||||
$image->image = file_get_contents($fileInfo['image']['tmp_name']);
|
||||
$image->mime = $fileInfo['image']['type'];
|
||||
$image->cookie = $images->generateCookieId($this->user);
|
||||
$image->save();
|
||||
|
||||
// delete cookie
|
||||
setcookie('image', $image->cookie, time() - 3600, '/', $this->_getCookieDomain());
|
||||
|
||||
$this->_redirect('/users/signinimage');
|
||||
}
|
||||
|
||||
public function setcookieAction()
|
||||
{
|
||||
if ($this->_request->getParam('enable')) {
|
||||
$images = new Users_Model_SigninImages();
|
||||
if (!$image = $images->getForUser($this->user)) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('There is no image uploaded'));
|
||||
$this->_redirect('/users/signinimage');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!setcookie('image', $image->cookie, time() + 24*60*60*10000, '/', $this->_getCookieDomain())) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('There was a problem setting the cookie'));
|
||||
$this->_redirect('/users/signinimage');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Image has been set successfully on this computer/browser'));
|
||||
} else {
|
||||
setcookie('image', $image->cookie, time() - 3600, '/', $this->_getCookieDomain());
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Image has been disabled successfully on this computer/browser'));
|
||||
}
|
||||
|
||||
$this->_redirect('/users/signinimage');
|
||||
}
|
||||
|
||||
public function imageAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$images = new Users_Model_SigninImages();
|
||||
|
||||
if ($cookie = $this->_request->getParam('id')) {
|
||||
$image = $images->getByCookie($cookie);
|
||||
} else if ($this->user->role != Users_Model_User::ROLE_GUEST) {
|
||||
$image = $images->getForUser($this->user);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_response->setHeader('Content-type', $image->mime);
|
||||
echo $image->image;
|
||||
}
|
||||
|
||||
private function _getCookieDomain()
|
||||
{
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
$domain = '.' . $this->_config->subdomain->hostname;
|
||||
} else {
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
}
|
||||
}
|
||||
}
|
11
modules/users/controllers/UserslistController.php
Executable file → Normal file
11
modules/users/controllers/UserslistController.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -29,6 +29,9 @@ class Users_UserslistController extends CommunityID_Controller_Action
|
||||
break;
|
||||
}
|
||||
|
||||
// This retrieves user data from the users table, even if using LDAP. This means the user's full name
|
||||
// might be out of sync with what it's in LDAP. No biggie since user's names rarely change ;)
|
||||
// However do know that a given user name is synced with LDAP every time he logs in.
|
||||
$usersRows = $users->getUsers(
|
||||
$this->_getParam('startIndex'),
|
||||
$this->_getParam('results'),
|
||||
@ -49,6 +52,10 @@ class Users_UserslistController extends CommunityID_Controller_Action
|
||||
|
||||
foreach ($usersRows as $user) {
|
||||
if ($user->role == Users_Model_User::ROLE_ADMIN) {
|
||||
if ($this->_config->ldap->enabled && $user->username != $this->_config->ldap->admin) {
|
||||
// this is the admin created during the installation, that is not used when ldap is enabled
|
||||
continue;
|
||||
}
|
||||
$status = $this->view->translate('admin');
|
||||
} else if ($user->accepted_eula) {
|
||||
$status = $this->view->translate('confirmed');
|
||||
@ -61,7 +68,7 @@ class Users_UserslistController extends CommunityID_Controller_Action
|
||||
$jsonObjUser->registration = $user->registration_date;
|
||||
$jsonObjUser->role = $user->role;
|
||||
$jsonObjUser->status = $status;
|
||||
$jsonObjUser->reminders = $user->reminders;
|
||||
$jsonObjUser->reminders = $user->accepted_eula? 0 : $user->reminders;
|
||||
$jsonObj->records[] = $jsonObjUser;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -45,14 +45,32 @@ class Users_Form_AccountInfo extends Zend_Form
|
||||
->setRequired(true)
|
||||
->addValidator('EmailAddress');
|
||||
|
||||
$this->addElements(array($username, $firstname, $lastname, $email));
|
||||
$authMethod = new Monkeys_Form_Element_Select('authMethod');
|
||||
translate('Auth Method');
|
||||
$authMethod->setLabel('Auth Method')
|
||||
->addMultiOption(Users_Model_User::AUTH_PASSWORD, 'Password')
|
||||
->addMultiOption(Users_Model_User::AUTH_YUBIKEY, 'YubiKey')
|
||||
->setAttrib('onchange', 'COMMID.general.toggleYubikey()');
|
||||
|
||||
$yubikey = new Monkeys_Form_Element_Text('yubikey');
|
||||
translate('Associated YubiKey');
|
||||
$yubikey->setLabel('Associated YubiKey')
|
||||
->setAttrib('class', 'yubiKeyInput');
|
||||
|
||||
$this->addElements(array($username, $firstname, $lastname, $email, $authMethod, $yubikey));
|
||||
|
||||
if (!$this->_targetUser->id) {
|
||||
$password1 = new Monkeys_Form_Element_Password('password1');
|
||||
translate('Enter password');
|
||||
$passwordValidator = new Monkeys_Validate_Password();
|
||||
$password1->setLabel('Enter password')
|
||||
->setRequired(true)
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation());
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation())
|
||||
->addValidator($passwordValidator);
|
||||
|
||||
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
|
||||
$password1->setDescription($restrictions);
|
||||
}
|
||||
|
||||
$password2 = new Monkeys_Form_Element_Password('password2');
|
||||
translate('Enter password again');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -12,13 +12,27 @@
|
||||
|
||||
class Users_Form_ChangePassword extends Zend_Form
|
||||
{
|
||||
private $_username;
|
||||
|
||||
public function __construct($options = null, $username = null)
|
||||
{
|
||||
$this->_username = $username;
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$password1 = new Monkeys_Form_Element_Password('password1');
|
||||
translate('Enter password');
|
||||
$passwordValidator = new Monkeys_Validate_Password($this->_username);
|
||||
$password1->setLabel('Enter password')
|
||||
->setRequired(true)
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation());
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation())
|
||||
->addValidator($passwordValidator);
|
||||
|
||||
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
|
||||
$password1->setDescription($restrictions);
|
||||
}
|
||||
|
||||
$password2 = new Monkeys_Form_Element_Password('password2');
|
||||
translate('Enter password again');
|
||||
|
13
modules/users/forms/Login.php
Executable file → Normal file
13
modules/users/forms/Login.php
Executable file → Normal file
@ -28,14 +28,19 @@ class Users_Form_Login extends Zend_Form
|
||||
$password->setLabel('PASSWORD')
|
||||
->setDecoratorOptions(array(
|
||||
'separateLine' => true,
|
||||
'dontMarkRequired' => true,
|
||||
))
|
||||
->setRequired(true);
|
||||
));
|
||||
|
||||
$yubikey = new Monkeys_Form_Element_Text('yubikey');
|
||||
$yubikey->setLabel('YUBIKEY')
|
||||
->setDecoratorOptions(array(
|
||||
'separateLine' => true,
|
||||
))
|
||||
->setAttrib('class', 'yubiKeyInput');
|
||||
|
||||
$rememberme = new Monkeys_Form_Element_Checkbox('rememberme');
|
||||
$rememberme->setLabel('Remember me');
|
||||
|
||||
$this->addElements(array($username, $password, $rememberme));
|
||||
$this->addElements(array($username, $password, $yubikey, $rememberme));
|
||||
|
||||
if ($this->_useCaptcha) {
|
||||
$captcha = new Monkeys_Form_Element_Captcha('captcha', array(
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -12,15 +12,19 @@
|
||||
|
||||
class Users_Form_PersonalInfo extends Zend_Form
|
||||
{
|
||||
private $_profile;
|
||||
private $_sregRequest;
|
||||
private $_sregProps;
|
||||
private $_formElements = array();
|
||||
|
||||
public function __construct($options = null, $user = null, $sregProps = null)
|
||||
public function __construct($options = null, Users_Model_Profile $profile = null, $sregRequest = null, $sregProps = null)
|
||||
{
|
||||
$this->_profile = $profile;
|
||||
$this->_sregRequest= $sregRequest;
|
||||
$this->_sregProps = $sregProps;
|
||||
|
||||
$fields = new Model_Fields();
|
||||
$fieldsArr = $fields->getValues($user);
|
||||
$fieldsArr = $fields->getValues($this->_profile);
|
||||
for ($i = 0; $i < count($fieldsArr); $i++) {
|
||||
$this->_formElements[$fieldsArr[$i]->openid] = array(
|
||||
'field' => $fieldsArr[$i],
|
||||
@ -57,6 +61,14 @@ class Users_Form_PersonalInfo extends Zend_Form
|
||||
$this->addElement($element);
|
||||
}
|
||||
} else {
|
||||
$profileName = new Monkeys_Form_Element_Text('profileName');
|
||||
translate('Profile Name');
|
||||
$profileName->setLabel('Profile Name')
|
||||
->setRequired(true)
|
||||
->setValue($this->_profile->name);
|
||||
|
||||
$this->addElement($profileName);
|
||||
|
||||
foreach ($this->_formElements as $formElement) {
|
||||
$this->addElement($formElement['element']);
|
||||
}
|
||||
@ -75,4 +87,44 @@ class Users_Form_PersonalInfo extends Zend_Form
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function getSregRequest()
|
||||
{
|
||||
return $this->_sregRequest;
|
||||
}
|
||||
|
||||
public function getPolicyUrl()
|
||||
{
|
||||
$args = $this->_sregRequest->getExtensionArgs();
|
||||
|
||||
if (!$args || !isset($args['policy_url'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $args['policy_url'];
|
||||
}
|
||||
|
||||
public static function getForm(Auth_OpenID_Request $request, Users_Model_Profile $profile)
|
||||
{
|
||||
// The class Auth_OpenID_SRegRequest is included in the following file
|
||||
require_once 'libs/Auth/OpenID/SReg.php';
|
||||
|
||||
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($request);
|
||||
$props = $sregRequest->allRequestedFields();
|
||||
$args = $sregRequest->getExtensionArgs();
|
||||
if (isset($args['required'])) {
|
||||
$required = explode(',', $args['required']);
|
||||
} else {
|
||||
$required = false;
|
||||
}
|
||||
|
||||
$sregProps = array();
|
||||
foreach ($props as $field) {
|
||||
$sregProps[$field] = $required && in_array($field, $required);
|
||||
}
|
||||
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $profile, $sregRequest, $sregProps);
|
||||
|
||||
return $personalInfoForm;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
12
modules/users/forms/Register.php
Executable file → Normal file
12
modules/users/forms/Register.php
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
@ -13,10 +13,12 @@
|
||||
class Users_Form_Register extends Zend_Form
|
||||
{
|
||||
private $_baseWebDir;
|
||||
private $_config;
|
||||
|
||||
public function __construct($options = null, $baseWebDir = null)
|
||||
{
|
||||
$this->_baseWebDir = $baseWebDir;
|
||||
$this->_config = Zend_Registry::get('config');
|
||||
parent::__construct($options);
|
||||
}
|
||||
|
||||
@ -47,9 +49,15 @@ class Users_Form_Register extends Zend_Form
|
||||
|
||||
$password1 = new Monkeys_Form_Element_Password('password1');
|
||||
translate('Enter desired password');
|
||||
$passwordValidator = new Monkeys_Validate_Password();
|
||||
$password1->setLabel('Enter desired password')
|
||||
->setRequired(true)
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation());
|
||||
->addValidator(new Monkeys_Validate_PasswordConfirmation())
|
||||
->addValidator($passwordValidator);
|
||||
|
||||
if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
|
||||
$password1->setDescription($restrictions);
|
||||
}
|
||||
|
||||
$password2 = new Monkeys_Form_Element_Password('password2');
|
||||
translate('Enter password again');
|
||||
|
30
modules/users/forms/SigninImage.php
Normal file
30
modules/users/forms/SigninImage.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
|
||||
class Users_Form_SigninImage extends Zend_Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$image = new Monkeys_Form_Element_File('image');
|
||||
$image->setLabel('')
|
||||
->setRequired(true)
|
||||
->setDescription('Only files of type jpg, jpeg, png and gif are allowed.<br />Maximum size is 2 MB.')
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Size', false, 2097152) // 2 MB
|
||||
->addValidator('Extension', false, 'jpg, jpeg, png, gif')
|
||||
->addFilter('StripNewlines'); // just a hack to circumvent ZF bug
|
||||
translate('Only files of type jpg, jpeg, png and gif are allowed.<br />Maximum size is 2 MB.');
|
||||
|
||||
$this->addElements(array($image));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
20
modules/users/models/Profile.php
Normal file
20
modules/users/models/Profile.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
|
||||
class Users_Model_Profile extends Zend_Db_Table_Row_Abstract
|
||||
{
|
||||
public function getFields()
|
||||
{
|
||||
$fields = new Model_Fields();
|
||||
return $fields->getValues($this);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user