コード例 #1
0
 /**
  * Performs the actual search
  *
  * @param	string	Search permissions in query form
  *
  * @return	array	Array of matched IDs
  */
 function perform_search($count_only = false)
 {
     $db =& $this->registry->db;
     if ($this->registry->userinfo['userid'] and empty($this->generator->joins['left_socialgroupmember']) and empty($this->generator->joins['inner_socialgroupmember'])) {
         $this->generator->joins['left_socialgroupmember'] = trim("\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t\t\t(socialgroupmember.userid = " . $this->registry->userinfo['userid'] . " AND socialgroupmember.groupid = socialgroup.groupid)\n\t\t\t");
     }
     $criteria = $this->generator->generate();
     if (!$criteria['where']) {
         $criteria['where'] = '1=1';
     }
     ($hook = vBulletinHook::fetch_hook('group_search_perform')) ? eval($hook) : false;
     if ($count_only) {
         $search_result = $db->query_first_slave("\n\t\t\t\tSELECT COUNT(*) AS count\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\t\t\t" . $criteria['joins'] . "\n\t\t\t\tWHERE " . $criteria['where'] . "\n\t\t\t");
         return $search_result['count'];
     } else {
         $this->search_result = $db->query_read_slave("\n\t\t\t\tSELECT socialgroup.*, socialgroup.dateline AS createdate, user.username AS creatorusername\n\t\t\t\t\t" . ($this->registry->userinfo['userid'] ? ', socialgroupmember.type AS membertype' : '') . "\n\t\t\t\t\t{$criteria['columns']}\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\t\t\t" . $criteria['joins'] . "\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroup.creatoruserid)\n\t\t\t\tWHERE " . $criteria['where'] . "\n\t\t\t\tORDER BY " . $this->sort_criteria . "\n\t\t\t\t" . $criteria['limit'] . "\n\t\t\t");
         return $db->num_rows($this->search_result);
     }
 }
コード例 #2
0
 /**
  * Performs the actual search
  *
  * @param	string	Search permissions in query form
  *
  * @return	array	Array of matched IDs
  */
 function perform_search($count_only = false)
 {
     $db =& $this->registry->db;
     if ($this->registry->userinfo['userid'] and empty($this->generator->joins['left_socialgroupmember']) and empty($this->generator->joins['inner_socialgroupmember'])) {
         $this->generator->joins['left_socialgroupmember'] = trim("\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t\t\t(socialgroupmember.userid = " . $this->registry->userinfo['userid'] . " AND socialgroupmember.groupid = socialgroup.groupid)\n\t\t\t");
     }
     $criteria = $this->generator->generate();
     if (!$criteria['where']) {
         $criteria['where'] = '1=1';
     }
     ($hook = vBulletinHook::fetch_hook('group_search_perform')) ? eval($hook) : false;
     if ($count_only) {
         $search_result = $db->query_first_slave("\n\t\t\t\tSELECT COUNT(*) AS count\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\t\t\t" . $criteria['joins'] . "\n\t\t\t\tWHERE " . $criteria['where'] . "\n\t\t\t");
         return $search_result['count'];
     } else {
         $this->search_result = $db->query_read_slave("\n\t\t\t\tSELECT socialgroup.*, socialgroup.dateline AS createdate, user.username AS creatorusername\n\t\t\t\t\t" . ($this->registry->userinfo['userid'] ? ', socialgroupmember.type AS membertype' : '') . ",\n\t\t\t\t\tsgc.title AS categoryname, sgc.socialgroupcategoryid AS categoryid,\n\t\t\t\t\tsocialgroupicon.dateline AS icondateline, socialgroupicon.thumbnail_width AS iconthumb_width,\n\t\t\t\t\tsocialgroupicon.thumbnail_height AS iconthumb_height\n\t\t\t\t\t" . ($this->check_read ? ', groupread.readtime AS readtime' : '') . "\n\t\t\t\t\t" . (!empty($this->generator->joins['inner_subscribegroup']) ? ', subscribegroup.emailupdate' : '') . "\n\t\t\t\t\t{$criteria['columns']}\n\t\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\t\t\t" . $criteria['joins'] . "\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "socialgroupicon AS socialgroupicon ON socialgroupicon.groupid = socialgroup.groupid\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroup.creatoruserid)" . ($this->check_read ? "\n\t\t\t\t LEFT JOIN " . TABLE_PREFIX . "groupread AS groupread\n\t\t\t\t  ON (groupread.groupid = socialgroup.groupid\n\t\t\t\t      AND groupread.userid = " . intval($this->registry->userinfo['userid']) . ")" : '') . "\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroupcategory AS sgc ON (sgc.socialgroupcategoryid = socialgroup.socialgroupcategoryid)\n\t\t\t\tWHERE " . $criteria['where'] . "\n\t\t\t\tORDER BY " . $this->sort_criteria . "\n\t\t\t\t" . $criteria['limit'] . "\n\t\t\t");
         return $db->num_rows($this->search_result);
     }
 }
コード例 #3
0
ファイル: class_groupmessage.php プロジェクト: 0hyeah/yurivn
 /**
  * Sets a string for searching
  *
  * @access public
  * @param string $searchtext
  */
 function filter_searchtext($text)
 {
     require_once DIR . '/includes/class_socialgroup_search.php';
     $text = vB_SGSearchGenerator::prepare_search_text($text, $errors);
     if (!$errors and $text != $this->filter_searchtext) {
         $this->filter_searchtext = $text;
         $this->reset();
     }
 }