コード例 #1
0
ファイル: Plugin.php プロジェクト: richjoslin/rivety
 public static function getInstance() {
   if (!self::$instance instanceof self) {
     RivetyCore_Log::info("Creating plugin manager"); 
     self::$instance = new self;
   }
   return self::$instance;
 }
コード例 #2
0
ファイル: Acl.php プロジェクト: richjoslin/rivety
	function addRoles($parent_role = null)
	{
		$roles_table = new Roles();

		// we start this recursive funtion by looking for roles with no parent.

		if (is_null($parent_role)) $roles = $roles_table->fetchParentless();
		else $roles = $roles_table->fetchImmediateChildren($parent_role);

		foreach ($roles as $role)
		{
			// Add the role and specifiy that as the parent. On the first pass, this is null.

			if (!$this->hasRole($role->id))
			{
				RivetyCore_Log::info("Adding role ".$role->shortname);
				$this->addRole(new Zend_Acl_Role($role->id), $parent_role);
			}
			if (count($roles_table->fetchImmediateChildren($role->id)) > 0)
			{
				$this->addRoles($role->id);
			}
		}
	}
コード例 #3
0
	public function write($id, $value) {
		$sessions_table = new Sessions();
		$lifetime = (int)RivetyCore_Registry::get('session_timeout');
		$expiration = time() + $lifetime;
		
		$data = array(
			'id' => $id,
			'value' => $value,
			'expiration' => $expiration,
		);
		
		$where = $sessions_table->getAdapter()->quoteInto('id = ?', $id);
		if($sessions_table->getCountByWhereClause($where) > 0){
			
			$sessions_table->update($data, $where);
			RivetyCore_Log::info("Session handler: updated session " .$id);
		} else {			
			$id = $sessions_table->insert($data);
			RivetyCore_Log::info("Session handler: updating session " .$id);
		}
	}