当前位置: 首页>>代码示例>>PHP>>正文


PHP FSS_Helper::contains方法代码示例

本文整理汇总了PHP中FSS_Helper::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::contains方法的具体用法?PHP FSS_Helper::contains怎么用?PHP FSS_Helper::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSS_Helper的用法示例。


在下文中一共展示了FSS_Helper::contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadTicketsBySearch

 function loadTicketsBySearch()
 {
     $db = JFactory::getDBO();
     $query = "SELECT t.*, s.title as status, s.color, u.name, au.name as assigned, u.email as useremail, u.username as username, au.email as handleremail, au.username as handlerusername, \n";
     $query .= " dept.title as department, cat.title as category, prod.title as product, pri.title as priority, pri.color as pricolor, \n";
     $query .= " grp.groupname as groupname, grp.id as group_id \n";
     $query .= " , pri.translation as ptl, dept.translation as dtr, s.translation as str, cat.translation as ctr, prod.translation as prtr\n";
     $query .= " FROM #__fss_ticket_ticket as t \n";
     $query .= " LEFT JOIN #__fss_ticket_status as s ON t.ticket_status_id = s.id \n";
     $query .= " LEFT JOIN #__users as u ON t.user_id = u.id \n";
     $query .= " LEFT JOIN #__users as au ON t.admin_id = au.id \n";
     $query .= " LEFT JOIN #__fss_ticket_dept as dept ON t.ticket_dept_id = dept.id \n";
     $query .= " LEFT JOIN #__fss_ticket_cat as cat ON t.ticket_cat_id = cat.id \n";
     $query .= " LEFT JOIN #__fss_prod as prod ON t.prod_id = prod.id \n";
     $query .= " LEFT JOIN #__fss_ticket_pri as pri ON t.ticket_pri_id = pri.id \n";
     $query .= " LEFT JOIN (SELECT group_id, user_id FROM #__fss_ticket_group_members GROUP BY user_id) as mem ON t.user_id = mem.user_id \n";
     $query .= " LEFT JOIN #__fss_ticket_group as grp ON grp.id = mem.group_id \n";
     // add custom fields to the sql
     foreach (FSSCF::GetAllCustomFields() as $field) {
         if (!$field['inlist']) {
             continue;
         }
         $id = $field['id'];
         if ($field['peruser']) {
             $query .= " LEFT JOIN #__fss_ticket_user_field as cf{$id} ON cf{$id}.user_id = t.user_id AND cf{$id}.field_id = {$id} \n";
         } else {
             $query .= " LEFT JOIN #__fss_ticket_field as cf{$id} ON cf{$id}.ticket_id = t.id AND cf{$id}.field_id = {$id} \n";
         }
     }
     $searchtype = FSS_Input::getCmd('searchtype', 'basic');
     $wherebits = array();
     if ($searchtype == "basic") {
         $search = FSS_Input::getString('search', '');
         if ($search != "") {
             $mode = "";
             if (FSS_Helper::contains($search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) {
                 $mode = "IN BOOLEAN MODE";
             }
             //$wherebits[] = " t.title LIKE '%".FSSJ3Helper::getEscaped($db, $search)."%' ";
             $wherebits[] = " MATCH (t.title) AGAINST ('" . $db->escape($search) . "' {$mode}) /* Title */ ";
             $wherebits[] = " t.reference LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* Reference */ ";
             // search custom fields that are set to be searched
             $this->searchFields($wherebits, "basicsearch");
             // basic search optional fields
             if (FSS_Settings::get('support_basic_name')) {
                 $wherebits[] = " u.name LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* Name */ ";
                 $wherebits[] = " unregname LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* UnReg Name */ ";
             }
             if (FSS_Settings::get('support_basic_username')) {
                 $wherebits[] = " u.username LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* Username */ ";
             }
             if (FSS_Settings::get('support_basic_email')) {
                 $wherebits[] = " u.email LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* User email */ ";
                 $wherebits[] = " t.email LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' /* Unreg Email */ ";
             }
             if (FSS_Settings::get('support_basic_messages')) {
                 $qry = "SELECT ticket_ticket_id FROM #__fss_ticket_messages WHERE subject LIKE '%" . FSSJ3Helper::getEscaped($db, $search) . "%' OR ";
                 $qry .= " MATCH (body) AGAINST ('" . $db->escape($search) . "' {$mode}) GROUP BY ticket_ticket_id";
                 $qry .= " AND admin IN (0, 1, 2, 4) ";
                 $db->setQuery($qry);
                 $wherebits[] = $this->TicketIDsToWhere($db->loadObjectList(), "ticket_ticket_id") . " /* Messages */ ";
             }
         }
         if (count($wherebits) == 0) {
             $wherebits[] = "1 /* Catch All */";
         }
         $query .= "\n WHERE (" . implode("\n OR ", $wherebits) . ")";
     } else {
         if ($searchtype == "advanced") {
             $search = FSS_Input::getString('search', '');
             $wherebits = array();
             $subject = FSS_Input::getString('subject', '');
             if ($subject) {
                 $wherebits[] = " t.title LIKE '%" . FSSJ3Helper::getEscaped($db, $subject) . "%' /* Title */ ";
             }
             $reference = FSS_Input::getString('reference', '');
             if ($reference) {
                 $wherebits[] = " t.reference LIKE '%" . FSSJ3Helper::getEscaped($db, $reference) . "%' /* Reference */ ";
             }
             $username = FSS_Input::getString('username', '');
             if ($username) {
                 $wherebits[] = " u.username LIKE '%" . FSSJ3Helper::getEscaped($db, $username) . "%' /* Username */ ";
             }
             $useremail = FSS_Input::getString('useremail', '');
             if ($useremail) {
                 $wherebits[] = " ( u.email LIKE '%" . FSSJ3Helper::getEscaped($db, $useremail) . "%' OR t.email LIKE '%" . FSSJ3Helper::getEscaped($db, $useremail) . "%' ) /* EMail */";
             }
             $userfullname = FSS_Input::getString('userfullname', '');
             if ($userfullname) {
                 $wherebits[] = " ( u.name LIKE '%" . FSSJ3Helper::getEscaped($db, $userfullname) . "%' OR unregname LIKE '%" . FSSJ3Helper::getEscaped($db, $userfullname) . "%' ) /* Name */";
             }
             $content = FSS_Input::getString('content', '');
             if ($content) {
                 $mode = "";
                 if (FSS_Helper::contains($search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) {
                     $mode = "IN BOOLEAN MODE";
                 }
                 $qry = "SELECT ticket_ticket_id FROM #__fss_ticket_messages WHERE subject LIKE '%" . FSSJ3Helper::getEscaped($db, $content) . "%' OR ";
                 $qry .= " MATCH (body) AGAINST ('" . $db->escape($content) . "' {$mode})";
                 $qry .= " AND admin IN (0, 1, 2, 4) ";
//.........这里部分代码省略.........
开发者ID:vstorm83,项目名称:propertease,代码行数:101,代码来源:support_tickets.php

示例2: _buildArtQuery

 function _buildArtQuery()
 {
     $db = JFactory::getDBO();
     $catid = FSS_Input::getInt('catid');
     $prodid = FSS_Input::getInt('prodid');
     $search = FSS_Input::getString('kbsearch');
     $query1 = "SELECT a.* FROM #__fss_kb_art as a WHERE 1 ";
     if ($catid > 0) {
         $query1 .= " AND kb_cat_id = " . FSSJ3Helper::getEscaped($db, $catid);
     }
     if ($prodid > 0) {
         $query1 .= " AND a.id IN (SELECT kb_art_id FROM #__fss_kb_art_prod WHERE prod_id = " . FSSJ3Helper::getEscaped($db, $prodid) . ") ";
     }
     // stuff to show extra arts when have edit permission
     $where = array();
     if (FSS_Permission::auth("core.edit", "com_fss.kb")) {
     } else {
         if (FSS_Permission::auth("core.edit.own", "com_fss.kb")) {
             $where[] = " ( published = 1 OR author = {$this->content->userid} ) ";
         } else {
             $where[] = "published = 1";
         }
     }
     $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
     $where[] = 'access IN (' . implode(',', JFactory::getUser()->getAuthorisedViewLevels()) . ')';
     $mode = "";
     if (FSS_Helper::contains($search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) {
         $mode = "IN BOOLEAN MODE";
     }
     // search
     if ($search != '') {
         $query1 .= " AND MATCH (title, body) AGAINST ('" . $db->escape($search) . "' {$mode}) ";
     }
     if (count($where) > 0) {
         $query1 .= " AND " . implode(" AND ", $where);
     }
     $query2 = "SELECT a.* FROM #__fss_kb_art as a WHERE 1 ";
     if ($catid > 0) {
         $query2 .= " AND kb_cat_id = " . FSSJ3Helper::getEscaped($db, $catid);
     }
     if ($search != '') {
         $query2 .= " AND MATCH (title, body) AGAINST ('" . $db->escape($search) . "' {$mode}) ";
     }
     $query2 .= " AND a.allprods = 1";
     // AND published = 1 ";
     if (count($where) > 0) {
         $query2 .= " AND " . implode(" AND ", $where);
     }
     if ($search) {
         $query = "(" . $query1 . ") UNION (" . $query2 . ")";
     } else {
         $query = "(" . $query1 . ") UNION (" . $query2 . ") ORDER BY ordering";
     }
     //echo $query."<br>";
     return $query;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:56,代码来源:kb.php

示例3: JOIN

 function &getTickets()
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $userid = $user->get('id');
     $uidlist = $this->getUIDS($userid);
     $tidlist = $this->getTIDS($userid);
     $query = "SELECT t.*, s.title as status, s.color, u.name, au.name as assigned, u.email as useremail, u.username as username, au.email as handleremail, au.username as handlerusername, ";
     $query .= " dept.title as department, cat.title as category, prod.title as product, pri.title as priority, pri.color as pricolor, ";
     $query .= " grp.groupname as groupname, grp.id as group_id ";
     $query .= " , pri.translation as ptl, dept.translation as dtr, s.translation as str, cat.translation as ctr, prod.translation as prtr";
     $query .= " FROM #__fss_ticket_ticket as t ";
     $query .= " LEFT JOIN #__fss_ticket_status as s ON t.ticket_status_id = s.id ";
     $query .= " LEFT JOIN #__users as u ON t.user_id = u.id ";
     $query .= " LEFT JOIN #__users as au ON t.admin_id = au.id ";
     $query .= " LEFT JOIN #__fss_ticket_dept as dept ON t.ticket_dept_id = dept.id ";
     $query .= " LEFT JOIN #__fss_ticket_cat as cat ON t.ticket_cat_id = cat.id ";
     $query .= " LEFT JOIN #__fss_prod as prod ON t.prod_id = prod.id ";
     $query .= " LEFT JOIN #__fss_ticket_pri as pri ON t.ticket_pri_id = pri.id ";
     $query .= " LEFT JOIN (SELECT group_id, user_id FROM #__fss_ticket_group_members GROUP BY user_id) as mem ON t.user_id = mem.user_id ";
     $query .= " LEFT JOIN #__fss_ticket_group as grp ON grp.id = mem.group_id ";
     // add product, department and category
     $query .= " WHERE ( t.user_id IN (" . implode(", ", $uidlist) . ") OR t.id IN (" . implode(", ", $tidlist) . ") ) ";
     $query .= " AND " . SupportSource::user_list_sql();
     $tickets = FSS_Input::getCmd('tickets', 'open');
     if (FSS_Settings::get('support_simple_userlist_tabs')) {
         $tickets = "all";
     }
     if (FSS_Input::getCmd('search_all')) {
         $tickets = "";
     }
     if ($tickets == 'open') {
         $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true);
         // tickets that arent closed
         $query .= " AND ticket_status_id IN ( " . implode(", ", $allopen) . ") ";
     }
     if ($tickets == 'closed') {
         $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed");
         // remove the archived tickets from the list to deal with
         $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive');
         foreach ($allopen as $offset => $value) {
             if ($value == $def_archive) {
                 unset($allopen[$offset]);
             }
         }
         // tickets that are closed
         $query .= " AND ticket_status_id IN ( " . implode(", ", $allopen) . ") ";
     } else {
         if ($tickets > 0) {
             $statuss = SupportHelper::getStatuss(false);
             $status_list = array();
             $status_list[] = (int) $tickets;
             foreach ($statuss as $status) {
                 if ($status->combine_with == (int) $tickets) {
                     $status_list[] = $status->id;
                 }
             }
             $query .= " AND ticket_status_id IN (" . implode(", ", $status_list) . ")";
         }
     }
     $search = FSS_Input::getString('search');
     if ($search != "") {
         FSS_Helper::AllowCache();
         // We have the nearly full query here, so use it to get a list of ticket ids
         $db->setQuery($query);
         $recs = $db->loadObjectList();
         $ids = array();
         $ids[] = 0;
         foreach ($recs as $rec) {
             $ids[] = $rec->id;
         }
         $mode = "";
         if (FSS_Helper::contains($search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) {
             $mode = "IN BOOLEAN MODE";
         }
         $msgsrch = "SELECT ticket_ticket_id FROM #__fss_ticket_messages WHERE ticket_ticket_id IN (" . implode(", ", $ids) . ") AND admin < 3 AND ";
         $msgsrch .= " MATCH (body) AGAINST ('" . $db->escape($search) . "' {$mode}) ";
         $db->setQuery($msgsrch);
         $results = $db->loadObjectList();
         $ids = array();
         $ids[] = 0;
         foreach ($results as $rec) {
             $ids[] = $rec->ticket_ticket_id;
         }
         // search custom fields that are set to be searched
         $fields = FSSCF::GetAllCustomFields(true);
         foreach ($fields as $field) {
             if (!$field["basicsearch"]) {
                 continue;
             }
             if ($field['permissions'] > 1 && $field['permissions'] < 5) {
                 continue;
             }
             $fieldid = $field['id'];
             if ($field['type'] == "checkbox") {
                 if ($search == "1") {
                     $search = "on";
                 } else {
                     $search = "";
                 }
//.........这里部分代码省略.........
开发者ID:vstorm83,项目名称:propertease,代码行数:101,代码来源:ticket.php

示例4: _buildQuery

 function _buildQuery()
 {
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__fss_faq_faq";
     $where = array();
     if ($this->_search != "") {
         $mode = "";
         if (FSS_Helper::contains($this->_search, array('*', '+', '-', '<', '>', '(', ')', '~', '"'))) {
             $mode = "IN BOOLEAN MODE";
         }
         $where[] = "MATCH (question, answer) AGAINST ('" . $db->escape($this->_search) . "' {$mode})";
     } else {
         if ($this->_curcatid > 0) {
             $where[] = "faq_cat_id = '" . FSSJ3Helper::getEscaped($db, $this->_curcatid) . "'";
         }
     }
     if ($this->_curcatid == -5) {
         $where[] = "featured = 1";
     }
     if (FSS_Permission::auth("core.edit", "com_fss.faq")) {
     } else {
         if (FSS_Permission::auth("core.edit.own", "com_fss.faq")) {
             $where[] = " ( published = 1 OR author = {$this->content->userid} ) ";
         } else {
             $where[] = "published = 1";
         }
     }
     $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
     $user = JFactory::getUser();
     $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     $tag = FSS_Input::getString('tag');
     if ($tag) {
         $qry2 = "SELECT faq_id FROM #__fss_faq_tags WHERE tag = '" . FSSJ3Helper::getEscaped($db, $tag) . "'";
         $db->setQuery($qry2);
         $rows = $db->loadObjectList();
         $ids = array();
         foreach ($rows as &$row) {
             $ids[] = $row->faq_id;
         }
         if (count($ids) > 0) {
             $where[] = "id IN (" . implode(", ", $ids) . ")";
         } else {
             $where[] = "id = 0";
         }
     }
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= " ORDER BY ordering";
     //echo $query."<br>";
     return $query;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:52,代码来源:faq.php


注:本文中的FSS_Helper::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。