import v1.1.0_RC2 | 2009-09-20

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

View File

@ -42,6 +42,7 @@ abstract class Monkeys_Controller_Action extends Zend_Controller_Action
$this->view->controller = $this;
$this->view->addHelperPath('libs/Monkeys/View/Helper', 'Monkeys_View_Helper');
$this->view->setUseStreamWrapper(true);
$this->_setScriptPaths();
$this->_setBase();
$this->view->numCols = $this->_numCols;

View File

@ -1,4 +1,4 @@
<?
<?php
abstract class Monkeys_Controller_Error extends Monkeys_Controller_Action
{

View File

@ -1,4 +1,4 @@
<?
<?php
class Monkeys_Form_Decorator_Composite extends Zend_Form_Decorator_Abstract
implements Zend_Form_Decorator_Marker_File_Interface // to avoid Zend_Form_Element_File to whine

View File

@ -35,7 +35,7 @@ class Monkeys_Form_Element_Country extends Zend_Form_Element_Select
translate('-- Select a Country --');
$this->addMultiOption(0, '-- Select a Country --');
$this->addMultiOptions(Zend_Locale::getCountryTranslationList(Zend_Registry::get('Zend_Locale')));
$this->addMultiOptions(Zend_Locale::getTranslationList('territory', Zend_Registry::get('Zend_Locale')));
asort($this->options);
}
}

View File

@ -35,7 +35,7 @@ class Monkeys_Form_Element_Language extends Zend_Form_Element_Select
translate('-- Select a Language --');
$this->addMultiOption(0, '-- Select a Language --');
$this->addMultiOptions(Zend_Locale::getLanguageTranslationList(Zend_Registry::get('Zend_Locale')));
$this->addMultiOptions(Zend_Locale::getTranslationList('language', Zend_Registry::get('Zend_Locale')));
asort($this->options);
}
}

View File

@ -1,129 +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 Monkeys_OpenId_Provider_Storage_Database extends Zend_OpenId_Provider_Storage
{
public function addAssociation($handle, $macFunc, $secret, $expires)
{
$associations = new Model_Associations();
$association = $associations->createRow();
$association->handle = $handle;
$association->macfunc = $macFunc;
$association->secret = $secret;
$association->expires = $expires;
$association->save();
return true;
}
public function getAssociation($handle, &$macFunc, &$secret, &$expires)
{
$associations = new Model_Associations();
$association = $associations->getAssociationGivenHandle($handle);
if (!$association) {
return false;
}
if ($association->expires < time()) {
return false;
}
$macFunc = $association->macfunc;
$secret = $association->secret;
$expires = $association->expires;
return true;
}
/**
* Always returns false, since we'll be adding user through the GUI interface only
*/
public function addUser($id, $password)
{
return false;
}
public function hasUser($id)
{
$users = new Users_Model_Users();
$user = $users->getUserWithOpenId($id);
return $user? true : false;
}
public function checkUser($id, $password)
{
$auth = Zend_Auth::getInstance();
$db = Zend_Db::factory(Zend_Registry::get('config')->database);
$authAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'openid', 'password');
$authAdapter->setIdentity($id);
$authAdapter->setCredential($password);
$result = $auth->authenticate($authAdapter);
if ($result->isValid()) {
// we don't wanna login into community-id
Zend_Auth::getInstance()->clearIdentity();
return true;
}
return false;
}
/**
* Returns array of all trusted/untrusted sites for given user identified
* by $id
*
* @param string $id user identity URL
* @return array
*/
public function getTrustedSites($id)
{
$users = new Users_Model_Users();
$user = $users->getUserWithOpenId($id);
$sites = new Model_Sites();
$trustedSites = array();
foreach ($sites->getTrusted($user) as $site) {
$trustedSites[$site->site] = unserialize($site->trusted);
}
return $trustedSites;
}
/**
* Stores information about trusted/untrusted site for given user
*
* @param string $id user identity URL
* @param string $site site URL
* @param mixed $trusted trust data from extension or just a boolean value. If null, delete site. I know, bad desing. Blame it on ZF.
* @return bool
*/
public function addSite($id, $site, $trusted)
{
$users = new Users_Model_Users();
$user = $users->getUserWithOpenId($id);
$sites = new Model_Sites();
$sites->deleteForUserSite($user, $site);
if (!is_null($trusted)) {
$siteObj = $sites->createRow();
$siteObj->user_id = $user->id;
$siteObj->site = $site;
$siteObj->creation_date = date('Y-m-d');
$siteObj->trusted = serialize($trusted);
$siteObj->save();
}
return true;
}
}