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


PHP Search::doSearch方法代码示例

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


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

示例1: show

 function show()
 {
     global $main_smarty, $db;
     include_once mnminclude . 'search.php';
     $search = new Search();
     $search->orderBy = $this->orderBy;
     $search->pagesize = $this->pagesize;
     $search->filterToStatus = $this->filterToStatus;
     $search->filterToTimeFrame = $this->filterToTimeFrame;
     $search->doSearch();
     $linksum_sql = $search->sql;
     $link = new Link();
     $links = $db->get_col($linksum_sql);
     if ($links) {
         foreach ($links as $link_id) {
             $link->id = $link_id;
             $link->read();
             $main_smarty = $link->fill_smarty($main_smarty);
             $main_smarty->display($this->template);
         }
     }
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:22,代码来源:sidebarstories.php

示例2: dirname

     */
    //$_GET = $_POST;
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
    include_once CLASS_PAGINATION;
    $pagination = new pagination(false);
    if (!empty($_GET['search'])) {
        include_once CLASS_SEARCH;
        $search = new Search($_GET['search_folder']);
        $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
        $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
        $search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
        $search->addSearchKeyword('size_from', @$_GET['search_size_from']);
        $search->addSearchKeyword('size_to', @$_GET['search_size_to']);
        $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
        $search->addSearchKeyword('name', @$_GET['search_name']);
        $search->doSearch();
        $fileList = $search->getFoundFiles();
        $folderInfo = $search->getRootFolderInfo();
    } else {
        include_once CLASS_MANAGER;
        include_once CLASS_SESSION_ACTION;
        $sessionAction = new SessionAction();
        include_once DIR_AJAX_INC . "class.manager.php";
        $manager = new manager();
        $manager->setSessionAction($sessionAction);
        $fileList = $manager->getFileList();
        $folderInfo = $manager->getFolderInfo();
    }
    $pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);
} else {
    include_once CLASS_PAGINATION;
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:ajax_get_file_listing.php

示例3: array

 function related_listings()
 {
     View::newInstance()->_exportVariableToView('items', array());
     $mSearch = new Search();
     $mSearch->addCategory(osc_item_category_id());
     $mSearch->addRegion(osc_item_region());
     $mSearch->addItemConditions(sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id()));
     $mSearch->limit('0', '3');
     $aItems = $mSearch->doSearch();
     $iTotalItems = count($aItems);
     if ($iTotalItems == 3) {
         View::newInstance()->_exportVariableToView('items', $aItems);
         return $iTotalItems;
     }
     unset($mSearch);
     $mSearch = new Search();
     $mSearch->addCategory(osc_item_category_id());
     $mSearch->addItemConditions(sprintf("%st_item.pk_i_id != %s ", DB_TABLE_PREFIX, osc_item_id()));
     $mSearch->limit('0', '3');
     $aItems = $mSearch->doSearch();
     $iTotalItems = count($aItems);
     if ($iTotalItems > 0) {
         View::newInstance()->_exportVariableToView('items', $aItems);
         return $iTotalItems;
     }
     unset($mSearch);
     return 0;
 }
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:28,代码来源:functions.php

示例4: show

 function show($fetch = false)
 {
     global $main_smarty, $db, $cached_links, $current_user;
     include_once mnminclude . 'search.php';
     $search = new Search();
     $search->orderBy = $this->orderBy;
     $search->pagesize = $this->pagesize;
     $search->filterToStatus = $this->filterToStatus;
     $search->filterToTimeFrame = $this->filterToTimeFrame;
     if ($this->category) {
         $thecat = get_cached_category_data('category_safe_name', $this->category);
         $search->category = $thecat->category_id;
     }
     $search->doSearch();
     $linksum_sql = $search->sql;
     $link = new Link();
     $links = $db->get_col($linksum_sql);
     $the_results = $links;
     if ($the_results) {
         // find out if the logged in user voted / reported each of
         // the stories that the search found and cache the results
         require_once mnminclude . 'votes.php';
         // DB 03/02/09
         //			$vote = new Vote;
         //			$vote->type='links';
         //			$vote->user=$current_user->user_id;
         //			$vote->link=$the_results;
         //			$results = $vote->user_list_all_votes();
         //////
         $vote = '';
         $results = '';
         // we don't actually need the results
         // we're just calling this to cache the results
         // so when we foreach the links we don't have to
         // run 1 extra query for each story to determine
         // current user votes
         // setup the link cache
         $i = 0;
         // if this query changes also change it in the read() function in /libs/link.php
         $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE ";
         foreach ($the_results as $link_id) {
             // first make sure we don't already have it cached
             if (!isset($cached_links[$link_id])) {
                 if ($i > 0) {
                     $sql .= ' OR ';
                 }
                 $sql .= " link_id = {$link_id} ";
                 $i = $i + 1;
             }
         }
         // if $i = 0 then all the links are already cached
         // so don't touch the db
         // if $i > 0 then there is at least 1 link to get
         // so get the SQL and add results to the cache
         if ($i > 0) {
             $results = $db->get_results($sql);
             // add the results to the cache
             foreach ($results as $row) {
                 $cached_links[$row->link_id] = $row;
             }
         }
         // end link cache setup
     }
     $ssLinks = '';
     if ($links) {
         foreach ($links as $link_id) {
             $link->id = $link_id;
             $link->check_saved = false;
             $link->get_author_info = false;
             $link->check_friends = false;
             $link->read();
             if (is_numeric($this->TitleLengthLimit) && strlen($link->title) > $this->TitleLengthLimit) {
                 $link->title = utf8_substr($link->title, 0, $this->TitleLengthLimit) . '...';
             }
             $main_smarty = $link->fill_smarty($main_smarty);
             $ssLinks .= $main_smarty->fetch($this->template);
         }
     }
     if ($fetch == true) {
         return $ssLinks;
     } else {
         echo $ssLinks;
     }
 }
开发者ID:bklein01,项目名称:pligg-cms,代码行数:84,代码来源:sidebarstories.php

示例5: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'dashboard':
             //dashboard...
             $max_items = Params::getParam('max_items') != '' ? Params::getParam('max_items') : 5;
             $aItems = Item::newInstance()->findByUserIDEnabled(osc_logged_user_id(), 0, $max_items);
             //calling the view...
             $this->_exportVariableToView('items', $aItems);
             $this->_exportVariableToView('max_items', $max_items);
             $this->doView('user-dashboard.php');
             break;
         case 'profile':
             //profile...
             $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
             $aCountries = Country::newInstance()->listAll();
             $aRegions = array();
             if ($user['fk_c_country_code'] != '') {
                 $aRegions = Region::newInstance()->findByCountry($user['fk_c_country_code']);
             } elseif (count($aCountries) > 0) {
                 $aRegions = Region::newInstance()->findByCountry($aCountries[0]['pk_c_code']);
             }
             $aCities = array();
             if ($user['fk_i_region_id'] != '') {
                 $aCities = City::newInstance()->findByRegion($user['fk_i_region_id']);
             } else {
                 if (count($aRegions) > 0) {
                     $aCities = City::newInstance()->findByRegion($aRegions[0]['pk_i_id']);
                 }
             }
             //calling the view...
             $this->_exportVariableToView('countries', $aCountries);
             $this->_exportVariableToView('regions', $aRegions);
             $this->_exportVariableToView('cities', $aCities);
             $this->_exportVariableToView('user', $user);
             $this->_exportVariableToView('locales', OSCLocale::newInstance()->listAllEnabled());
             $this->doView('user-profile.php');
             break;
         case 'profile_post':
             //profile post...
             osc_csrf_check();
             $userId = Session::newInstance()->_get('userId');
             require_once LIB_PATH . 'osclass/UserActions.php';
             $userActions = new UserActions(false);
             $success = $userActions->edit($userId);
             if ($success == 1 || $success == 2) {
                 osc_add_flash_ok_message(_m('Your profile has been updated successfully'));
             } else {
                 osc_add_flash_error_message($success);
             }
             $this->redirectTo(osc_user_profile_url());
             break;
         case 'alerts':
             //alerts
             $aAlerts = Alerts::newInstance()->findByUser(Session::newInstance()->_get('userId'), false);
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             foreach ($aAlerts as $k => $a) {
                 $array_conditions = (array) json_decode($a['s_search']);
                 //                                            $search = Search::newInstance();
                 $search = new Search();
                 $search->setJsonAlert($array_conditions);
                 $search->limit(0, 3);
                 $aAlerts[$k]['items'] = $search->doSearch();
             }
             $this->_exportVariableToView('alerts', $aAlerts);
             View::newInstance()->_reset('alerts');
             $this->_exportVariableToView('user', $user);
             $this->doView('user-alerts.php');
             break;
         case 'change_email':
             //change email
             $this->doView('user-change_email.php');
             break;
         case 'change_email_post':
             //change email post
             osc_csrf_check();
             if (!osc_validate_email(Params::getParam('new_email'))) {
                 osc_add_flash_error_message(_m('The specified e-mail is not valid'));
                 $this->redirectTo(osc_change_user_email_url());
             } else {
                 $user = User::newInstance()->findByEmail(Params::getParam('new_email'));
                 if (!isset($user['pk_i_id'])) {
                     $userEmailTmp = array();
                     $userEmailTmp['fk_i_user_id'] = Session::newInstance()->_get('userId');
                     $userEmailTmp['s_new_email'] = Params::getParam('new_email');
                     UserEmailTmp::newInstance()->insertOrUpdate($userEmailTmp);
                     $code = osc_genRandomPassword(30);
                     $date = date('Y-m-d H:i:s');
                     $userManager = new User();
                     $userManager->update(array('s_pass_code' => $code, 's_pass_date' => $date, 's_pass_ip' => $_SERVER['REMOTE_ADDR']), array('pk_i_id' => Session::newInstance()->_get('userId')));
                     $validation_url = osc_change_user_email_confirm_url(Session::newInstance()->_get('userId'), $code);
                     osc_run_hook('hook_email_new_email', Params::getParam('new_email'), $validation_url);
                     $this->redirectTo(osc_user_profile_url());
                 } else {
                     osc_add_flash_error_message(_m('The specified e-mail is already in use'));
                     $this->redirectTo(osc_change_user_email_url());
                 }
             }
             break;
         case 'change_username':
//.........这里部分代码省略.........
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:user.php

示例6: Search

            <ul id="error_list"></ul>
            <form>
                <div class="form-horizontal">
                    <h3 class="render-title"><?php 
    _e('Alerts');
    ?>
</h3>
                    <div class="form-row">
                        <?php 
    for ($k = 0; $k < count($aux['alerts']); $k++) {
        $array_conditions = (array) json_decode(base64_decode($aux['alerts'][$k]['s_search']), true);
        $raw_data = osc_get_raw_search($array_conditions);
        $new_search = new Search();
        $new_search->setJsonAlert($array_conditions);
        $new_search->limit(0, 2);
        $results = $new_search->doSearch();
        ?>
                            <div class="form-label">
                                <?php 
        echo sprintf(__('Alert #%d'), $k + 1);
        ?>
                                <br/>
                                <?php 
        if (isset($raw_data['sPattern']) && $raw_data['sPattern'] != '') {
            ?>
                                    <?php 
            echo sprintf(__("<b>Pattern:</b> %s"), $raw_data['sPattern']);
            ?>
<br/>
                                <?php 
        }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:31,代码来源:frm.php

示例7: Search

 function __construct($params)
 {
     $this->_get = $params;
     $this->getDBParams();
     $mSearch = new Search(true);
     $mSearch->limit($this->start, $this->limit);
     $mSearch->order($this->order_by['column_name'], $this->order_by['type'], $this->order_by['table_name']);
     if (Params::getParam("catId") != "") {
         $mSearch->addCategory(Params::getParam("catId"));
     }
     if ($this->search) {
         //$mSearch->addConditions(sprintf("(d.s_title LIKE '%%%s%%' OR d.s_description LIKE '%%%s%%')", $this->search, $this->search));
         $mSearch->addConditions(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->search));
     }
     if (@$this->stat['spam']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_spam'] = true;
         $mSearch->addField('SUM(s.`i_num_spam`) as i_num_spam');
         $mSearch->addConditions("s.`i_num_spam` > 0");
         $mSearch->addConditions(sprintf("%st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['duplicated']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_repeated'] = true;
         $mSearch->addField('SUM(s.`i_num_repeated`) as i_num_repeated');
         $mSearch->addConditions("s.`i_num_repeated` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['bad']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_bad_classified'] = true;
         $mSearch->addField('SUM(s.`i_num_bad_classified`) as i_num_bad_classified');
         $mSearch->addConditions("s.`i_num_bad_classified` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['offensive']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_offensive'] = true;
         $mSearch->addField('SUM(s.`i_num_offensive`) as i_num_offensive');
         $mSearch->addConditions("s.`i_num_offensive` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     if (@$this->stat['expired']) {
         $this->extraCols++;
         $this->sExtraCol['i_num_expired'] = true;
         $mSearch->addField('SUM(s.`i_num_expired`) as i_num_expired');
         $mSearch->addConditions("s.`i_num_expired` > 0");
         $mSearch->addConditions(sprintf(" %st_item.pk_i_id = s.fk_i_item_id", DB_TABLE_PREFIX));
         $mSearch->addTable(sprintf("%st_item_stats s", DB_TABLE_PREFIX));
     }
     foreach ($this->filters as $aFilter) {
         $sFilter = "";
         if ($aFilter[1] == 'NULL') {
             $sFilter .= $aFilter[0] . " IS NULL";
         } else {
             $sFilter .= $aFilter[0] . " = '" . $aFilter[1] . "'";
         }
         $sFilter = sprintf($sFilter, DB_TABLE_PREFIX);
         $mSearch->addConditions($sFilter);
     }
     // do Search
     $list_items = $mSearch->doSearch(true);
     $this->result = Item::newInstance()->extendCategoryName(Item::newInstance()->extendData($list_items));
     $this->filtered_total = $mSearch->count();
     $this->total = count($list_items);
     //TEMPORARY FIX
     $this->toDatatablesFormat();
     $this->dumpToDatatables();
 }
开发者ID:acharei,项目名称:OSClass,代码行数:73,代码来源:items_processing.php

示例8: postItemSearch

 /**
  * Search
  * 
  * @url POST /search/item
  */
 public function postItemSearch()
 {
     $id = $_POST['id'];
     $category = $_POST['category'];
     $country = $_POST['country'];
     $city = $_POST['city'];
     $lang = $_POST['lang'];
     $counter = 0;
     $mSearch = new Search();
     if ($id) {
         $mSearch->addItemId($id);
         $counter++;
     }
     if ($category) {
         if ($mSearch->addCategory($category)) {
             $counter++;
         }
     }
     if ($counter == 0) {
         return FALSE;
     }
     $items = $mSearch->doSearch(FALSE, TRUE);
     return $items;
 }
开发者ID:xop32,项目名称:aRestAPI4Osclass,代码行数:29,代码来源:apiServer.php

示例9: Search

// |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
// |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
require_once 'lib-common.php';
require_once $_CONF['path_system'] . 'classes/search.class.php';
$searchObj = new Search();
if (isset($_GET['mode']) && $_GET['mode'] == 'search') {
    $display = COM_siteHeader('menu', $LANG09[11]);
    $display .= $searchObj->doSearch();
} else {
    $display = COM_siteHeader('menu', $LANG09[1]);
    $display .= $searchObj->showForm();
}
$display .= COM_siteFooter();
COM_output($display);
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:31,代码来源:search.php

示例10: Search

// |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
// |          Jason Whittenburg - jwhitten AT securitygeeks DOT com            |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
require_once __DIR__ . '/lib-common.php';
$searchObj = new Search();
// Figure out topic to display
TOPIC_getTopic();
if (isset($_GET['mode']) && $_GET['mode'] === 'search') {
    $content = $searchObj->doSearch();
    $display = COM_createHTMLDocument($content, array('pagetitle' => $LANG09[11]));
} else {
    $content = $searchObj->showForm();
    $display = COM_createHTMLDocument($content, array('pagetitle' => $LANG09[1]));
}
COM_output($display);
开发者ID:mystralkk,项目名称:geeklog,代码行数:31,代码来源:search.php

示例11: Search

<?php

// meta tag robots
osc_add_hook('header', 'pop_follow_construct');
pop_add_body_class('home');
$listClass = '';
osc_current_web_theme_path('header.php');
?>

<?php 
$mSearch = new Search();
$aItems = $mSearch->doSearch();
$iTotalItems = $mSearch->count();
$iNumPages = ceil($iTotalItems / osc_default_results_per_page_at_search());
View::newInstance()->_exportVariableToView('search_total_pages', $iNumPages);
View::newInstance()->_exportVariableToView('items', $aItems);
if (osc_count_items() == 0) {
    ?>
    <div class="clear"></div>
    <p class="empty"><?php 
    _e("There aren't listings available at this moment", 'pop');
    ?>
</p>
<?php 
} else {
    ?>
    <?php 
    View::newInstance()->_exportVariableToView("listType", 'latestItems');
    View::newInstance()->_exportVariableToView("listClass", $listClass);
    osc_current_web_theme_path('loop.php');
    ?>
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:31,代码来源:main.php

示例12: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'dashboard':
             //dashboard...
             $max_items = Params::getParam('max_items') != '' ? Params::getParam('max_items') : 5;
             $aItems = Item::newInstance()->findByUserIDEnabled(Session::newInstance()->_get('userId'), 0, $max_items);
             //calling the view...
             $this->_exportVariableToView('items', $aItems);
             $this->_exportVariableToView('max_items', $max_items);
             $this->doView('user-dashboard.php');
             break;
         case 'profile':
             //profile...
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             $aCountries = Country::newInstance()->listAll();
             $aRegions = array();
             if ($user['fk_c_country_code'] != '') {
                 $aRegions = Region::newInstance()->findByCountry($user['fk_c_country_code']);
             } elseif (count($aCountries) > 0) {
                 $aRegions = Region::newInstance()->findByCountry($aCountries[0]['pk_c_code']);
             }
             $aCities = array();
             if ($user['fk_i_region_id'] != '') {
                 $aCities = City::newInstance()->findByRegion($user['fk_i_region_id']);
             } else {
                 if (count($aRegions) > 0) {
                     $aCities = City::newInstance()->findByRegion($aRegions[0]['pk_i_id']);
                 }
             }
             //calling the view...
             $this->_exportVariableToView('countries', $aCountries);
             $this->_exportVariableToView('regions', $aRegions);
             $this->_exportVariableToView('cities', $aCities);
             $this->_exportVariableToView('user', $user);
             $this->_exportVariableToView('locales', OSCLocale::newInstance()->listAllEnabled());
             $this->doView('user-profile.php');
             break;
         case 'profile_post':
             //profile post...
             $userId = Session::newInstance()->_get('userId');
             require_once LIB_PATH . 'osclass/UserActions.php';
             $userActions = new UserActions(false);
             $success = $userActions->edit($userId);
             osc_add_flash_ok_message(_m('Your profile has been updated successfully'));
             $this->redirectTo(osc_user_profile_url());
             break;
         case 'alerts':
             //alerts
             $aAlerts = Alerts::newInstance()->findByUser(Session::newInstance()->_get('userId'));
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             foreach ($aAlerts as $k => $a) {
                 $json = base64_decode($a['s_search']);
                 $array_conditions = (array) json_decode($json);
                 //                                            $search = Search::newInstance();
                 $search = new Search();
                 $search->setJsonAlert($array_conditions);
                 $search->limit(0, 3);
                 $aAlerts[$k]['items'] = $search->doSearch();
             }
             $this->_exportVariableToView('alerts', $aAlerts);
             View::newInstance()->_reset('alerts');
             $this->_exportVariableToView('user', $user);
             $this->doView('user-alerts.php');
             break;
         case 'change_email':
             //change email
             $this->doView('user-change_email.php');
             break;
         case 'change_email_post':
             //change email post
             if (!preg_match("/^[_a-z0-9-\\+]+(\\.[_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/", Params::getParam('new_email'))) {
                 osc_add_flash_error_message(_m('The specified e-mail is not valid'));
                 $this->redirectTo(osc_change_user_email_url());
             } else {
                 $user = User::newInstance()->findByEmail(Params::getParam('new_email'));
                 if (!isset($user['pk_i_id'])) {
                     $userEmailTmp = array();
                     $userEmailTmp['fk_i_user_id'] = Session::newInstance()->_get('userId');
                     $userEmailTmp['s_new_email'] = Params::getParam('new_email');
                     UserEmailTmp::newInstance()->insertOrUpdate($userEmailTmp);
                     $code = osc_genRandomPassword(30);
                     $date = date('Y-m-d H:i:s');
                     $userManager = new User();
                     $userManager->update(array('s_pass_code' => $code, 's_pass_date' => $date, 's_pass_ip' => $_SERVER['REMOTE_ADDR']), array('pk_i_id' => Session::newInstance()->_get('userId')));
                     $validation_url = osc_change_user_email_confirm_url(Session::newInstance()->_get('userId'), $code);
                     osc_run_hook('hook_email_new_email', Params::getParam('new_email'), $validation_url);
                     $this->redirectTo(osc_user_profile_url());
                 } else {
                     osc_add_flash_error_message(_m('The specified e-mail is already in use'));
                     $this->redirectTo(osc_change_user_email_url());
                 }
             }
             break;
         case 'change_password':
             //change password
             $this->doView('user-change_password.php');
             break;
         case 'change_password_post':
             //change password post
//.........这里部分代码省略.........
开发者ID:semul,项目名称:Osclass,代码行数:101,代码来源:user.php

示例13: seo_sitemap_generator

function seo_sitemap_generator()
{
    $start_time = microtime(true);
    $min = 1;
    $show_items = '';
    if (Params::getParam('sitemap_items') != '') {
        $show_items = Params::getParam('sitemap_items');
    } else {
        $show_items = osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') : '';
    }
    $limit_items = '';
    if (Params::getParam('sitemap_items_limit') != '') {
        $limit_items = Params::getParam('sitemap_items_limit');
    } else {
        $limit_items = osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') : '';
    }
    $limit_items = intval($limit_items);
    $locales = osc_get_locales();
    $filename = osc_base_path() . 'sitemap.xml';
    //link sitemap
    @unlink($filename);
    //remove original sitemap
    $start_xml = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
    file_put_contents($filename, $start_xml);
    // INDEX
    seo_sitemap_add_url(osc_base_url(), date('Y-m-d'), 'always');
    $categories = Category::newInstance()->listAll(false);
    $countries = Country::newInstance()->listAll();
    foreach ($categories as $c) {
        $search = new Search();
        $search->addCategory($c['pk_i_id']);
        if ($search->count() >= $min) {
            seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'])), date('Y-m-d'), 'hourly');
            foreach ($countries as $country) {
                if (count($countries) > 1) {
                    $search = new Search();
                    $search->addCategory($c['pk_i_id']);
                    $search->addCountry($country['pk_c_code']);
                    if ($search->count() > $min) {
                        seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'])), date('Y-m-d'), 'hourly');
                    }
                }
                $regions = Region::newInstance()->findByCountry($country['pk_c_code']);
                foreach ($regions as $region) {
                    $search = new Search();
                    $search->addCategory($c['pk_i_id']);
                    $search->addCountry($country['pk_c_code']);
                    $search->addRegion($region['pk_i_id']);
                    if ($search->count() > $min) {
                        seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'], 'sRegion' => $region['s_name'])), date('Y-m-d'), 'hourly');
                        $cities = City::newInstance()->findByRegion($region['pk_i_id']);
                        foreach ($cities as $city) {
                            $search = new Search();
                            $search->addCategory($c['pk_i_id']);
                            $search->addCountry($country['pk_c_code']);
                            $search->addRegion($region['pk_i_id']);
                            $search->addCity($city['pk_i_id']);
                            if ($search->count() > $min) {
                                seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'], 'sRegion' => $region['s_name'], 'sCity' => $city['s_name'])), date('Y-m-d'), 'hourly');
                            }
                        }
                    }
                }
            }
        }
    }
    foreach ($countries as $country) {
        $regions = Region::newInstance()->findByCountry($country['pk_c_code']);
        foreach ($regions as $region) {
            $cities = CityStats::newInstance()->listCities($region['pk_i_id']);
            $l = min(count($cities), 30);
            for ($k = 0; $k < $l; $k++) {
                if ($cities[$k]['items'] > $min) {
                    seo_sitemap_add_url(osc_search_url(array('sCountry' => $country['s_name'], 'sRegion' => $region['s_name'], 'sCity' => $cities[$k]['city_name'])), date('Y-m-d'), 'hourly');
                }
            }
        }
    }
    // ITEMS
    if ($show_items == 1) {
        $max_secure = 10000;
        $mSearch = new Search();
        $mSearch->limit(0, $limit_items);
        // fetch number of item for sitemap
        $aItems = $mSearch->doSearch();
        View::newInstance()->_exportVariableToView('items', $aItems);
        //exporting our searched item array
        if (osc_count_items() > 0) {
            $i = 0;
            while (osc_has_items() and $i < $limit_items and $i < $max_secure) {
                seo_sitemap_add_url(osc_item_url(), substr(osc_item_mod_date() != '' ? osc_item_mod_date() : osc_item_pub_date(), 0, 10), 'daily');
                $i++;
            }
        }
    }
    $end_xml = '</urlset>';
    file_put_contents($filename, $end_xml, FILE_APPEND);
    // PING SEARCH ENGINES
    seo_sitemap_ping_engines();
    $time_elapsed = microtime(true) - $start_time;
//.........这里部分代码省略.........
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:101,代码来源:sitemap.php

示例14: osc_count_latest_items

/**
 * Gets number of latest items
 *
 * @return int
 */
function osc_count_latest_items()
{
    if (!View::newInstance()->_exists('items')) {
        $search = new Search();
        $search->limit(0, osc_max_latest_items());
        View::newInstance()->_exportVariableToView('items', $search->doSearch(true));
    }
    return osc_priv_count_items();
}
开发者ID:nsswaga,项目名称:OSClass,代码行数:14,代码来源:hItems.php

示例15: Search

    if (ApiHandler::validKey()) {
        $search = new Search();
        $base->getUser()->getUserByApiKey($_GET['apikey']);
        echo ApiHandler::sendResponse(200, true, $search->doArtistSearch($id, $base->getUser()));
    } else {
        ApiHandler::notAuthenticated();
    }
});
/**
 * Search for a given query
 */
$app->get('/api/v1/search/:query(/:count(/:page))', function ($query, $count = 30, $page = 1) use($base) {
    if (ApiHandler::validKey()) {
        $search = new Search();
        $base->getUser()->getUserByApiKey($_GET['apikey']);
        echo ApiHandler::sendResponse(200, true, $search->doSearch($query, $count, $page, $base->getUser()));
    } else {
        ApiHandler::notAuthenticated();
    }
});
/**
 * Player
 */
$app->get('/api/v1/player/next', function () {
    $player = new Player();
    $song = $player->playNextSong();
    if ($song !== false) {
        ApiHandler::sendResponse(200, true, array('token' => $song));
    } else {
        ApiHandler::sendResponse(200, false);
    }
开发者ID:nbar1,项目名称:gs,代码行数:31,代码来源:routes.php


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