示例#1
0
文件: filter.php 项目: nouphet/rata
 /**
  * Execute filter at id_res
  *
  * @param Openid_Context $openid
  * @return boolean
  */
 function postFilter(&$openid)
 {
     if ($GLOBALS['xoopsModuleConfig']['filter_level'] == 0) {
         //Not use filter
         return true;
     }
     $format = "SELECT * FROM `%s` WHERE `pattern`='%s'";
     $sql = sprintf($format, $this->_tableName, $openid->get4Sql('endpoint'));
     if ($filter =& $this->_getOne($sql)) {
         if ($filter->get('auth')) {
             $groupid = $filter->get('groupid');
             if ($groupid) {
                 $openid->set('gid', explode('|', $groupid));
             }
             return true;
         } else {
             return false;
         }
     }
     //No match any filter
     if ($GLOBALS['xoopsModuleConfig']['filter_level'] == 1) {
         return true;
     } else {
         return false;
     }
 }
示例#2
0
文件: abstract.php 项目: nouphet/rata
 /**
  * Enter description here...
  *
  * @param string $sql
  * @param int $limit
  * @param int $start
  * @return array
  */
 function &_getObjects($sql, $limit = 0, $start = 0)
 {
     $ret = array();
     if ($result =& $this->_query($sql, $limit, $start)) {
         require_once XOOPS_ROOT_PATH . '/modules/openid/class/context.php';
         while ($row = $this->_db->fetchArray($result)) {
             $record = new Openid_Context();
             foreach ($row as $key => $value) {
                 $record->set($key, $value);
             }
             $ret[] =& $record;
             unset($record);
         }
     }
     return $ret;
 }
示例#3
0
文件: buttons.php 项目: nouphet/rata
 function generateAction()
 {
     $this->_checkToken();
     global $xoopsConfig;
     $filterItems = array();
     @(include XOOPS_ROOT_PATH . '/modules/openid/language/' . $xoopsConfig['language'] . '/filterItems.php');
     if (isset($_POST['offset']) && ($item = $filterItems[intval($_POST['offset'])])) {
         require_once XOOPS_ROOT_PATH . '/modules/openid/class/context.php';
         $record = new Openid_Context();
         if (isset($item['op_identifier'])) {
             $record->set('type', 0);
             $record->set('identifier', $item['op_identifier']);
         } else {
             if (isset($item['user_identifier'])) {
                 $record->set('type', 1);
                 $record->set('identifier', $item['user_identifier']);
                 $record->set('range', $item['range']);
             } else {
                 redirect_header($this->_url, 2, 'Bad request');
             }
         }
         $record->set('image', $item['image']);
         $record->set('description', $item['description']);
     } else {
         redirect_header($this->_url, 2, 'Bad request');
     }
     if ($this->_handler->insert($record)) {
         redirect_header($this->_url, 2, 'Record insert Success');
     } else {
         $message = 'Record insert Fail<br />' . $this->_handler->getError();
         redirect_header($this->_url, 2, $message);
     }
 }
示例#4
0
文件: filter.php 项目: nouphet/rata
 function generateAction()
 {
     $this->_checkToken();
     require_once XOOPS_ROOT_PATH . '/modules/openid/class/context.php';
     $post = new Openid_Context();
     $post->set('groupid', '0');
     $post->set('auth', OPENID_AUTH_ALLOW);
     $filterItems =& $this->getFilterItems();
     $type = isset($_POST['type']) ? intval($_POST['type']) : 0;
     if (array_key_exists($type, $filterItems)) {
         $item = $filterItems[$type];
         $post->set('pattern', $item['pattern']);
     } else {
         redirect_header($this->_url, 2, 'Bad request');
     }
     if ($this->_handler->insert($post)) {
         redirect_header($this->_url, 2, 'Record insert Success');
     } else {
         $message = 'Record insert Fail<br />' . $filter->getError();
         redirect_header($this->_url, 2, $message);
     }
 }