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


PHP cmsFramework::redirect方法代码示例

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


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

示例1: _installfix

 function _installfix()
 {
     // Load fields model
     App::import('Model', 'field', 'jreviews');
     $FieldModel = new FieldModel();
     $task = Sanitize::getString($this->data, 'task');
     $msg = '';
     $mambot_error = 0;
     switch ($task) {
         case 'fix_install_jreviews':
             if (!$this->_installPlugin()) {
                 $msg = "There was a problem updating the database or copying the plugin files. Make sure the Joomla plugins/content folder is writable.";
             }
             break;
         case 'fix_content_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_content'));
             $columns = array_keys($rows['#__jreviews_content']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'content'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'content');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the content fields";
             }
             break;
         case 'fix_review_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_review_fields'));
             $columns = array_keys($rows['#__jreviews_review_fields']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'review'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'review');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the review fields";
             }
             break;
         default:
             break;
     }
     cmsFramework::redirect("index.php?option=com_jreviews", $msg);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:59,代码来源:install_controller.php

示例2: array

$menu_id = $menu_id == 99999999 ? null : $menu_id;
$menu_params = array();
# Check if this is a custom route
$route['url']['url'] = $url;
$route = S2Router::parse($route, false, 'jreviews');
/*******************************************************************
 *                         ADMIN ROUTING
 ******************************************************************/
if (defined('MVC_FRAMEWORK_ADMIN')) {
    // Ensure user has access to this function
    switch (getCmsVersion()) {
        case 'CMS_JOOMLA15':
            $User =& cmsFramework::getUser();
            $Acl =& cmsFramework::getACL();
            if ($Acl->acl_check('administration', 'manage', 'users', $User->usertype, 'components', S2Paths::get('jreviews', 'S2_CMSCOMP'))) {
                cmsFramework::redirect('index.php', JText::_('ALERTNOTAUTH'));
            }
            break;
        case 'CMS_JOOMLA16':
            if (!JFactory::getUser()->authorise('core.manage', S2Paths::get('jreviews', 'S2_CMSCOMP'))) {
                return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
            }
            break;
        default:
            die('Not authorized');
            break;
    }
    // Controller routing
    $act = Sanitize::getString($_REQUEST, 'act');
    if ($act == 'license') {
        $_GET['url'] = 'license';
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:index.php

示例3: _process

 function _process()
 {
     $urlSeparator = "_";
     $simple_search = Sanitize::getInt($this->data, 'simple_search');
     $keywords = Sanitize::getVar($this->data, 'keywords');
     $criteria = isset($this->data['Search']) ? Sanitize::getInt($this->data['Search'], 'criteria_id') : null;
     $dir = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'dir'));
     $cat = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'cat'));
     $section = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'section'));
     /*J15*/
     $order = Sanitize::getVar($this->data, 'order');
     $query_type = Sanitize::getVar($this->data, 'search_query_type');
     $scope = Sanitize::getVar($this->data, 'contentoptions');
     $author = Sanitize::getString($this->data, 'author');
     $categories = Sanitize::getVar($this->data, 'categories');
     $menu_id = Sanitize::getInt($this->data, 'menu_id');
     $tmpl_suffix = Sanitize::getString($this->data, 'tmpl_suffix');
     $illegal_chars = array('#', '/', '?', ':', urldecode('%E3%80%80'));
     // Last one is japanese double space
     $sort = '';
     # Load Routes helper
     App::import('Helper', 'routes', 'jreviews');
     $Routes = new RoutesHelper();
     // Replace ampersands with temp string to be replaced back as urlencoded ampersand further below
     $keywords = str_replace(array_keys($this->KeywordReplacementMask), array_values($this->KeywordReplacementMask), $keywords);
     # Get the Itemid
     $menu_id_param = $menu_id > 0 ? $menu_id : '';
     $url_params = '';
     # SIMPLE SEARCH
     if ($simple_search) {
         # Build the query string
         if (trim($keywords) != '') {
             $url_params .= (cmsFramework::mosCmsSef() ? '' : '/') . 'keywords' . _PARAM_CHAR . str_replace(' ', '+', urlencode(str_replace($illegal_chars, ' ', $keywords)));
         }
         !empty($dir) and $url_params .= "/dir" . _PARAM_CHAR . $dir;
         !empty($section) and $url_params .= "/cat" . _PARAM_CHAR . 's' . $section;
         /*J15*/
         !empty($cat) and $url_params .= "/cat" . _PARAM_CHAR . $cat;
         !empty($tmpl_suffix) and $url_params .= '/tmpl_suffix' . _PARAM_CHAR . $tmpl_suffix;
         !empty($order) and $sort = '/order' . _PARAM_CHAR . $order;
         # Checks if need to keep the Itemid on the result page
         if ($this->Config->search_itemid && $menu_id) {
             $url = $Routes->search_results($menu_id_param, '');
         } else {
             $url = $Routes->search_results(null, '');
         }
         $url = cmsFramework::route($url . $url_params . $sort);
         $url = str_replace(array_keys($this->KeywordReplacementUrl), array_values($this->KeywordReplacementUrl), $url);
         cmsFramework::redirect($url);
         exit;
     }
     # ADVANCED SEARCH
     $url_params = array();
     $criteria_param = $criteria ? (cmsFramework::mosCmsSef() ? '' : '/') . 'criteria:' . $criteria : '';
     // Search query type
     !empty($query_type) and $url_params[] = "query" . _PARAM_CHAR . $query_type;
     !empty($dir) != '' and $url_params[] = "dir" . _PARAM_CHAR . $dir;
     // Listing and reviews
     if ($keywords) {
         if ($scope) {
             $url_params[] = "scope" . _PARAM_CHAR . urlencode(implode($urlSeparator, $scope));
         }
         $url_params[] = "keywords" . _PARAM_CHAR . urlencode(str_replace($illegal_chars, ' ', $keywords));
     }
     // Author
     !empty($author) and $url_params[] = "author" . _PARAM_CHAR . urlencode($author);
     // Categories
     if (is_array($categories)) {
         // Remove empty values from array
         foreach ($categories as $index => $value) {
             if (empty($value)) {
                 unset($categories[$index]);
             }
         }
         if (!empty($categories)) {
             $cat = urlencode(implode($urlSeparator, $categories));
             !empty($cat) and $url_params[] = "cat" . _PARAM_CHAR . $cat;
         }
     } elseif ($categories != '') {
         // Single select category list
         !empty($categories) and $url_params[] = "cat" . _PARAM_CHAR . $categories;
     }
     // First pass to process numeric values, need to merge operator and operand into one parameter
     if (isset($this->data['Field'])) {
         foreach ($this->data['Field']['Listing'] as $key => $value) {
             if (substr($key, -9, 9) == '_operator') {
                 $operand = substr($key, 0, -9);
                 if (is_array($this->data['Field']['Listing'][$operand]) && is_numeric($this->data['Field']['Listing'][$operand][0]) || is_numeric($this->data['Field']['Listing'][$operand])) {
                     $this->data['Field']['Listing'][$operand] = $value . $urlSeparator . trim(implode('_', $this->data['Field']['Listing'][$operand]));
                 } elseif (is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand][0]) != '' || !is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand]) != '') {
                     // Assume it's a date field
                     $this->data['Field']['Listing'][$operand] = $value . $urlSeparator . "date_" . implode('_', $this->data['Field']['Listing'][$operand]);
                 } else {
                     $this->data['Field']['Listing'][$operand] = '';
                 }
                 // Remove trailing separator char
                 $this->data['Field']['Listing'][$operand] = rtrim($this->data['Field']['Listing'][$operand], $urlSeparator);
             }
         }
         // Second pass to process everything
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:search_controller.php

示例4: listings


//.........这里部分代码省略.........
         } else {
             $conditions[] = 'Listing.state = 1';
             $conditions[] = '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )';
             $conditions[] = '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )';
         }
         # Shows only links users can access
         if ($this->cmsVersion == CMS_JOOMLA15) {
             //                $conditions[] = 'Section.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Category.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Listing.access <= ' . $this->Access->getAccessId();
         } else {
             $conditions[] = 'Category.access IN ( ' . $this->Access->getAccessLevels() . ')';
             $conditions[] = 'Listing.access IN ( ' . $this->Access->getAccessLevels() . ')';
         }
         $queryData = array('joins' => $joins, 'conditions' => $conditions, 'limit' => $this->limit, 'offset' => $this->offset);
         # Modify query for correct ordering. Change FIELDS, ORDER BY and HAVING BY directly in Listing Model variables
         if ($this->action != 'custom' || $this->action == 'custom' && empty($this->Listing->order)) {
             $this->Listing->processSorting($action, $sort);
         }
         // This is used in Listings model to know whether this is a list page to remove the plugin tags
         $this->Listing->controller = 'categories';
         // Check if review scope checked in advancd search
         $scope = explode('_', Sanitize::getString($this->params, 'scope'));
         if ($this->action == 'search' && in_array('reviews', $scope)) {
             $queryData['joins'][] = "LEFT JOIN #__jreviews_comments AS Review ON Listing.id = Review.pid AND Review.published = 1 AND Review.mode = 'com_content'";
             $queryData['group'][] = "Listing.id";
             // Group By required due to one to many relationship between listings => reviews table
         }
         $query_listings and $listings = $this->Listing->findAll($queryData);
         # If only one result then redirect to it
         if ($this->Config->search_one_result && count($listings) == 1 && $this->action == 'search' && $this->page == 1) {
             $listing = array_shift($listings);
             $url = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true));
             cmsFramework::redirect($url);
         }
         # Get the listing count
         if (in_array($action, array('section', 'category'))) {
             unset($queryData['joins']);
             $this->Listing->joins = array("INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.catid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_content'", 'Category' => "LEFT JOIN #__categories AS Category ON JreviewsCategory.id = Category.id", 'ParentCategory' => "LEFT JOIN #__categories AS ParentCategory ON Category.lft BETWEEN ParentCategory.lft AND ParentCategory.rgt", "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_content'", "LEFT JOIN #__jreviews_content AS Field ON Field.contentid = Listing.id", "LEFT JOIN #__jreviews_directories AS Directory ON JreviewsCategory.dirid = Directory.id");
         } elseif ($action != 'favorites') {
             unset($queryData['joins']);
             $this->Listing->joins = array("INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.catid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_content'", 'Category' => "LEFT JOIN #__categories AS Category ON JreviewsCategory.id = Category.id", 'ParentCategory' => "LEFT JOIN #__categories AS ParentCategory ON Category.lft BETWEEN ParentCategory.lft AND ParentCategory.rgt", "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_content'", "LEFT JOIN #__jreviews_content AS Field ON Field.contentid = Listing.id", "LEFT JOIN #__jreviews_directories AS Directory ON JreviewsCategory.dirid = Directory.id");
             if ($this->action == 'search' && in_array('reviews', $scope)) {
                 $queryData['joins'][] = "LEFT JOIN #__jreviews_comments AS Review ON Listing.id = Review.pid AND Review.published = 1 AND Review.mode = 'com_content'";
             }
         }
         if ($this->cmsVersion == CMS_JOOMLA15 || empty($cat_id)) {
             unset($this->Listing->joins['ParentCategory']);
             // Exclude listings from child categories
         }
         // Need to add user table join for author searches
         if (isset($this->params['author'])) {
             $queryData['joins'][] = "LEFT JOIN #__users AS User ON User.id = Listing.created_by";
         }
         if ($query_listings && !isset($this->Listing->count)) {
             $count = $this->Listing->findCount($queryData, $this->action == 'search' && in_array('reviews', $scope) ? 'DISTINCT Listing.id' : '*');
         } else {
             $count = $this->Listing->count;
         }
         if ($total_special > 0 && $total_special < $count) {
             $count = Sanitize::getInt($this->data, 'total_special');
         }
     }
     # Get directory info for breadcrumb if dir id is a url parameter
     $directory = array();
     if (is_numeric($dir_id)) {
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:67,代码来源:categories_controller.php

示例5: loadListingModel

 /**
  * Dynamic Listing Model Loading for jReviewsEverywhere extensions
  * Detects which extension is being used to load the correct Listing model
  *
  * @param object $controller
  * @param string $extension
  */
 function loadListingModel(&$controller, $extension = null)
 {
     if (in_array($controller->name, array('admin/reviews', 'reviews')) && $controller->action == '_save') {
         $extension = Sanitize::getString($controller->data['Review'], 'mode');
         !$extension and isset($controller->data['Listing']) and $extension = Sanitize::getString($controller->data['Listing'], 'extension');
     } else {
         $extension = $extension ? $extension : Sanitize::getString($controller->params, 'extension', Sanitize::getString($controller->data, 'extension'));
     }
     if (!$extension && isset($controller->params['module'])) {
         // Final check for module parameter
         $extension = Sanitize::getString($controller->params['module'], 'extension');
     }
     $extension == '' and $controller->name != 'facebook' and $controller->name != 'reviews' and $controller->name != 'community_reviews' and $controller->name != 'module_reviews' and $controller->name != 'discussions' and $controller->name != 'admin/reviews' and $controller->name != 'admin/admin_owner_replies' and $controller->name != 'admin/admin_reports' and $controller->name != 'admin/admin_discussions' and $extension = 'com_content';
     // Check if in listing detail page and it's a 3rd party component to dynamically load it's Listing model
     if ($extension) {
         $name = $this->name . '_' . $extension;
         App::import('Model', $name, 'jreviews');
         $class_name = inflector::camelize($this->name . '_' . $extension) . 'Model';
         if ($extension != '' && class_exists($class_name)) {
             $controller->Listing = new $class_name($controller->params);
             if (isset($controller->Review) && $controller->action != '_save') {
                 unset($controller->Review->joins['listings'], $controller->Review->joins['jreviews_categories'], $controller->Review->joins['criteria']);
                 $controller->Review->joins = array_merge($controller->Review->joins, $controller->Listing->joinsReviews);
             }
         } else {
             // Extension used in url doesn't have a plugin so we redirect to 404 error page
             $controller->autoLayout = false;
             $controller->autoRender = true;
             cmsFramework::redirect(cmsFramework::route('index.php?option=com_jreviews&url=404'));
         }
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:39,代码来源:everywhere.php

示例6: _installfix


//.........这里部分代码省略.........
     $mambot_error = 0;
     switch ($task) {
         case 'fix_install_jreviews':
             $query = "SELECT id,published FROM #__" . _PLUGIN_DIR_NAME . " WHERE element = 'jreviews' AND folder = 'content'";
             $this->_db->setQuery($query);
             $jReviewsMambot = $this->_db->loadObjectList();
             if (!$jReviewsMambot || empty($jReviewsMambot)) {
                 // Install in DB
                 $this->_db->setQuery("INSERT INTO #__" . _PLUGIN_DIR_NAME . " (`name`, `element`, `folder`, `access`, `ordering`, `published`, `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`) VALUES ('jReviews Comment Plugin', 'jreviews', 'content', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '');");
                 $this->_db->query();
             } else {
                 // Publish
                 $jReviewsMambot = $jReviewsMambot[0];
                 if (!$jReviewsMambot->published) {
                     $this->_db->setQuery("UPDATE #__" . _PLUGIN_DIR_NAME . " SET published = '1' WHERE id='{$jReviewsMambot->id}'");
                     $this->_db->query();
                 }
             }
             if (!file_exists(PATH_ROOT . _PLUGIN_DIR_NAME . DS . 'content' . DS . 'jreviews.php')) {
                 $package = PATH_ROOT . 'administrator' . DS . 'components' . DS . 'com_jreviews' . DS . 'jreviews.plugin.s2';
                 $target = PATH_ROOT . _PLUGIN_DIR_NAME . DS . 'content';
                 $target_file = $target . DS . 'jreviews.php';
                 if (getCmsVersion() == CMS_JOOMLA15) {
                     jimport('joomla.filesystem.file');
                     jimport('joomla.filesystem.folder');
                     jimport('joomla.filesystem.archive');
                     jimport('joomla.filesystem.path');
                     $adapter =& JArchive::getAdapter('zip');
                     $result = $adapter->extract($package, $target);
                 }
                 if (!file_exists($target_file)) {
                     require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
                     require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclerror.lib.php';
                     $extract = new PclZip($package);
                     if (substr(PHP_OS, 0, 3) == 'WIN') {
                         if (!defined('OS_WINDOWS')) {
                             define('OS_WINDOWS', 1);
                         }
                     } else {
                         if (!defined('OS_WINDOWS')) {
                             define('OS_WINDOWS', 0);
                         }
                     }
                     $result = $extract->extract(PCLZIP_OPT_PATH, $target);
                 }
                 if (!$result) {
                     $mambot_error = true;
                 } else {
                     $mambot_error = false;
                 }
             }
             if ($mambot_error) {
                 $msg = "It was not possible to copy the mambot/plugin files. Make sure the /" . _PLUGIN_DIR_NAME . "/content folder is writable and try again.";
             }
             break;
         case 'fix_content_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_content'));
             $columns = array_keys($rows['#__jreviews_content']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'content'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'content');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the content fields";
             }
             break;
         case 'fix_review_fields':
             $output = '';
             $rows = $this->_db->getTableFields(array('#__jreviews_review_fields'));
             $columns = array_keys($rows['#__jreviews_review_fields']);
             $sql = "SELECT name,type FROM #__jreviews_fields WHERE location = 'review'";
             $this->_db->setQuery($sql);
             $fields = $this->_db->loadObjectList('name');
             $missing = array();
             foreach ($fields as $field) {
                 if (!in_array($field->name, $columns)) {
                     $output = $FieldModel->addTableColumn($field->name, $field->type, 'review');
                 }
             }
             $query = "DELETE FROM #__jreviews_fields WHERE name = ''";
             $this->_db->setQuery($query);
             $output = $this->_db->query();
             if ($output != '') {
                 $msg = "There was a problem fixing one or more of the review fields";
             }
             break;
         default:
             break;
     }
     cmsFramework::redirect("index.php?option=com_jreviews", $msg);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:install_controller.php


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