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


PHP osc_rewrite_enabled函数代码示例

本文整理汇总了PHP中osc_rewrite_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_rewrite_enabled函数的具体用法?PHP osc_rewrite_enabled怎么用?PHP osc_rewrite_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'login_post':
             //post execution for the login
             if (!osc_users_enabled()) {
                 osc_add_flash_error_message(_m('Users are not enabled'));
                 $this->redirectTo(osc_base_url());
             }
             osc_csrf_check();
             osc_run_hook('before_validating_login');
             // e-mail or/and password is/are empty or incorrect
             $wrongCredentials = false;
             $email = Params::getParam('email');
             $password = Params::getParam('password', false, false);
             if ($email == '') {
                 osc_add_flash_error_message(_m('Please provide an email address'));
                 $wrongCredentials = true;
             }
             if ($password == '') {
                 osc_add_flash_error_message(_m('Empty passwords are not allowed. Please provide a password'));
                 $wrongCredentials = true;
             }
             if ($wrongCredentials) {
                 $this->redirectTo(osc_user_login_url());
             }
             if (osc_validate_email($email)) {
                 $user = User::newInstance()->findByEmail($email);
             }
             if (empty($user)) {
                 $user = User::newInstance()->findByUsername($email);
             }
             if (empty($user)) {
                 osc_add_flash_error_message(_m("The user doesn't exist"));
                 $this->redirectTo(osc_user_login_url());
             }
             if (!osc_verify_password($password, isset($user['s_password']) ? $user['s_password'] : '')) {
                 osc_add_flash_error_message(_m('The password is incorrect'));
                 $this->redirectTo(osc_user_login_url());
                 // @TODO if valid user, send email parameter back to the login form
             } else {
                 if (@$user['s_password'] != '') {
                     if (preg_match('|\\$2y\\$([0-9]{2})\\$|', $user['s_password'], $cost)) {
                         if ($cost[1] != BCRYPT_COST) {
                             User::newInstance()->update(array('s_password' => osc_hash_password($password)), array('pk_i_id' => $user['pk_i_id']));
                         }
                     } else {
                         User::newInstance()->update(array('s_password' => osc_hash_password($password)), array('pk_i_id' => $user['pk_i_id']));
                     }
                 }
             }
             // e-mail or/and IP is/are banned
             $banned = osc_is_banned($email);
             // int 0: not banned or unknown, 1: email is banned, 2: IP is banned, 3: both email & IP are banned
             if ($banned & 1) {
                 osc_add_flash_error_message(_m('Your current email is not allowed'));
             }
             if ($banned & 2) {
                 osc_add_flash_error_message(_m('Your current IP is not allowed'));
             }
             if ($banned !== 0) {
                 $this->redirectTo(osc_user_login_url());
             }
             osc_run_hook('before_login');
             $url_redirect = osc_get_http_referer();
             $page_redirect = '';
             if (osc_rewrite_enabled()) {
                 if ($url_redirect != '') {
                     $request_uri = urldecode(preg_replace('@^' . osc_base_url() . '@', "", $url_redirect));
                     $tmp_ar = explode("?", $request_uri);
                     $request_uri = $tmp_ar[0];
                     $rules = Rewrite::newInstance()->listRules();
                     foreach ($rules as $match => $uri) {
                         if (preg_match('#' . $match . '#', $request_uri, $m)) {
                             $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                             if (preg_match('|([&?]{1})page=([^&]*)|', '&' . $request_uri . '&', $match)) {
                                 $page_redirect = $match[2];
                                 if ($page_redirect == '' || $page_redirect == 'login') {
                                     $url_redirect = osc_user_dashboard_url();
                                 }
                             }
                             break;
                         }
                     }
                 }
             }
             require_once LIB_PATH . 'osclass/UserActions.php';
             $uActions = new UserActions(false);
             $logged = $uActions->bootstrap_login($user['pk_i_id']);
             if ($logged == 0) {
                 osc_add_flash_error_message(_m("The user doesn't exist"));
             } else {
                 if ($logged == 1) {
                     if (time() - strtotime($user['dt_access_date']) > 1200) {
                         // EACH 20 MINUTES
                         osc_add_flash_error_message(sprintf(_m('The user has not been validated yet. Would you like to re-send your <a href="%s">activation?</a>'), osc_user_resend_activation_link($user['pk_i_id'], $user['s_email'])));
                     } else {
                         osc_add_flash_error_message(_m('The user has not been validated yet'));
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:login.php

示例2: init

 public function init()
 {
     // $_SERVER is not supported by Params Class... we should fix that
     if (isset($_SERVER['REQUEST_URI'])) {
         $request_uri = urldecode(preg_replace('@^' . REL_WEB_URL . '@', "", $_SERVER['REQUEST_URI']));
         if (osc_rewrite_enabled()) {
             foreach ($this->rules as $match => $uri) {
                 // UNCOMMENT TO DEBUG
                 //echo 'Request URI: '.$request_uri." # Match : ".$match." # URI to go : ".$uri." <br />";
                 if (preg_match('#' . $match . '#', $request_uri, $m)) {
                     $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                     break;
                 }
             }
         }
         $this->extractParams($request_uri);
         $this->request_uri = $request_uri;
         //$this->uri = $this->extractURL($request_uri);
         //$this->location = str_replace(".php", "", $this->uri);
         if (Params::getParam('page') != '') {
             $this->location = Params::getParam('page');
         }
         if (Params::getParam('action') != '') {
             $this->section = Params::getParam('action');
         }
     }
 }
开发者ID:hashemgamal,项目名称:OSClass,代码行数:27,代码来源:Rewrite.php

示例3: osc_static_page_url

function osc_static_page_url($locale = '')
{
    if ($locale != '') {
        if (osc_rewrite_enabled()) {
            return osc_base_url() . osc_static_page_field("s_internal_name") . "-p" . osc_static_page_field("pk_i_id") . "-" . $locale;
        } else {
            return osc_base_url(true) . "?page=page&id=" . osc_static_page_field("pk_i_id") . "&lang=" . $locale;
        }
    } else {
        if (osc_rewrite_enabled()) {
            return osc_base_url() . osc_static_page_field("s_internal_name") . "-p" . osc_static_page_field("pk_i_id");
        } else {
            return osc_base_url(true) . "?page=page&id=" . osc_static_page_field("pk_i_id");
        }
    }
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:16,代码来源:hPage.php

示例4: pop_init_config

function pop_init_config()
{
    // block send_friend, send_friend_post
    if (Params::getParam('action') == 'send_friend' || Params::getParam('action') == 'send_friend_post') {
        pop_redirect_404();
    }
    if (Params::getParam('action') == 'pub_profile') {
        Params::setParam('itemsPerPage', osc_default_results_per_page_at_search());
    }
    if (!osc_rewrite_enabled()) {
        if (Params::getParam('page') == 'search' && Params::getParam('hook') == 'load_more_listing') {
            // no stdio at search page, only via ajax
            osc_add_hook('after_search', 'pop_echo_pop_print_listing_card');
        }
    }
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:16,代码来源:functions.php

示例5: osc_item_link_expired

/**
 * Gets link for mark as expired the current item
 *
 * @return string
 */
function osc_item_link_expired()
{
    if (!osc_rewrite_enabled()) {
        $url = osc_base_url(true) . "?page=item&action=mark&as=expired&id=" . osc_item_id();
    } else {
        $url = osc_base_url() . osc_get_preference('rewrite_item_mark') . "/expired/" . osc_item_id();
    }
    return (string) $url;
}
开发者ID:randomecho,项目名称:OSClass,代码行数:14,代码来源:hItems.php

示例6: init

 public function init()
 {
     if (Params::existServerParam('REQUEST_URI')) {
         if (preg_match('|[\\?&]{1}http_referer=(.*)$|', urldecode(Params::getServerParam('REQUEST_URI', false, false)), $ref_match)) {
             $this->http_referer = $ref_match[1];
             $_SERVER['REQUEST_URI'] = preg_replace('|[\\?&]{1}http_referer=(.*)$|', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
         }
         $request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
         $this->raw_request_uri = $request_uri;
         $route_used = false;
         foreach ($this->routes as $id => $route) {
             // UNCOMMENT TO DEBUG
             //echo 'Request URI: '.$request_uri." # Match : ".$route['regexp']." # URI to go : ".$route['url']." <br />";
             if (preg_match('#^' . $route['regexp'] . '#', $request_uri, $m)) {
                 if (!preg_match_all('#\\{([^\\}]+)\\}#', $route['url'], $args)) {
                     $args[1] = array();
                 }
                 $l = count($m);
                 for ($p = 1; $p < $l; $p++) {
                     if (isset($args[1][$p - 1])) {
                         Params::setParam($args[1][$p - 1], $m[$p]);
                     } else {
                         Params::setParam('route_param_' . $p, $m[$p]);
                     }
                 }
                 Params::setParam('page', 'custom');
                 Params::setParam('route', $id);
                 $route_used = true;
                 $this->location = $route['location'];
                 $this->section = $route['section'];
                 $this->title = $route['title'];
                 break;
             }
         }
         if (!$route_used) {
             if (osc_rewrite_enabled()) {
                 $tmp_ar = explode("?", $request_uri);
                 $request_uri = $tmp_ar[0];
                 // if try to access directly to a php file
                 if (preg_match('#^(.+?)\\.php(.*)$#', $request_uri)) {
                     $file = explode("?", $request_uri);
                     if (!file_exists(ABS_PATH . $file[0])) {
                         Rewrite::newInstance()->set_location('error');
                         header('HTTP/1.1 404 Not Found');
                         osc_current_web_theme_path('404.php');
                         exit;
                     }
                 }
                 foreach ($this->rules as $match => $uri) {
                     // UNCOMMENT TO DEBUG
                     // echo 'Request URI: '.$request_uri." # Match : ".$match." # URI to go : ".$uri." <br />";
                     if (preg_match('#^' . $match . '#', $request_uri, $m)) {
                         $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                         break;
                     }
                 }
             }
             $this->extractParams($request_uri);
             $this->request_uri = $request_uri;
             if (Params::getParam('page') != '') {
                 $this->location = Params::getParam('page');
             }
             if (Params::getParam('action') != '') {
                 $this->section = Params::getParam('action');
             }
         }
     }
 }
开发者ID:mylastof,项目名称:os-class,代码行数:68,代码来源:Rewrite.php

示例7: osc_list_city_url

/**
 * Gets the url of current "list city""
 *
 * @return string
 */
function osc_list_city_url()
{
    if (osc_rewrite_enabled()) {
        $url = osc_base_url();
        if (osc_get_preference('seo_url_search_prefix') != '') {
            $url .= osc_get_preference('seo_url_search_prefix') . '/';
        }
        $url .= osc_sanitizeString(osc_list_city_name()) . '-c' . osc_list_city_id();
        return $url;
    } else {
        return osc_search_url(array('sCity' => osc_list_city_id()));
    }
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:18,代码来源:hSearch.php

示例8: doModel

 function doModel()
 {
     osc_run_hook('before_search');
     if (osc_rewrite_enabled()) {
         // IF rewrite is not enabled, skip this part, preg_match is always time&resources consuming task
         $p_sParams = "/" . Params::getParam('sParams', false, false);
         if (preg_match_all('|\\/([^,]+),([^\\/]*)|', $p_sParams, $m)) {
             $l = count($m[0]);
             for ($k = 0; $k < $l; $k++) {
                 switch ($m[1][$k]) {
                     case osc_get_preference('rewrite_search_country'):
                         $m[1][$k] = 'sCountry';
                         break;
                     case osc_get_preference('rewrite_search_region'):
                         $m[1][$k] = 'sRegion';
                         break;
                     case osc_get_preference('rewrite_search_city'):
                         $m[1][$k] = 'sCity';
                         break;
                     case osc_get_preference('rewrite_search_city_area'):
                         $m[1][$k] = 'sCityArea';
                         break;
                     case osc_get_preference('rewrite_search_category'):
                         $m[1][$k] = 'sCategory';
                         break;
                     case osc_get_preference('rewrite_search_user'):
                         $m[1][$k] = 'sUser';
                         break;
                     case osc_get_preference('rewrite_search_pattern'):
                         $m[1][$k] = 'sPattern';
                         break;
                     default:
                         // custom fields
                         if (preg_match("/meta(\\d+)-?(.*)?/", $m[1][$k], $results)) {
                             $meta_key = $m[1][$k];
                             $meta_value = $m[2][$k];
                             $array_r = array();
                             if (Params::existParam('meta')) {
                                 $array_r = Params::getParam('meta');
                             }
                             if ($results[2] == '') {
                                 // meta[meta_id] = meta_value
                                 $meta_key = $results[1];
                                 $array_r[$meta_key] = $meta_value;
                             } else {
                                 // meta[meta_id][meta_key] = meta_value
                                 $meta_key = $results[1];
                                 $meta_key2 = $results[2];
                                 $array_r[$meta_key][$meta_key2] = $meta_value;
                             }
                             $m[1][$k] = 'meta';
                             $m[2][$k] = $array_r;
                         }
                         break;
                 }
                 Params::setParam($m[1][$k], $m[2][$k]);
             }
             Params::unsetParam('sParams');
         }
     }
     $uriParams = Params::getParamsAsArray();
     $searchUri = osc_search_url($uriParams);
     if ($this->uri != 'feed') {
         if (str_replace("%20", '+', $searchUri) != str_replace("%20", '+', WEB_PATH . $this->uri)) {
             $this->redirectTo($searchUri, 301);
         }
     }
     ////////////////////////////////
     //GETTING AND FIXING SENT DATA//
     ////////////////////////////////
     $p_sCategory = Params::getParam('sCategory');
     if (!is_array($p_sCategory)) {
         if ($p_sCategory == '') {
             $p_sCategory = array();
         } else {
             $p_sCategory = explode(",", $p_sCategory);
         }
     }
     $p_sCityArea = Params::getParam('sCityArea');
     if (!is_array($p_sCityArea)) {
         if ($p_sCityArea == '') {
             $p_sCityArea = array();
         } else {
             $p_sCityArea = explode(",", $p_sCityArea);
         }
     }
     $p_sCity = Params::getParam('sCity');
     if (!is_array($p_sCity)) {
         if ($p_sCity == '') {
             $p_sCity = array();
         } else {
             $p_sCity = explode(",", $p_sCity);
         }
     }
     $p_sRegion = Params::getParam('sRegion');
     if (!is_array($p_sRegion)) {
         if ($p_sRegion == '') {
             $p_sRegion = array();
         } else {
             $p_sRegion = explode(",", $p_sRegion);
//.........这里部分代码省略.........
开发者ID:mylastof,项目名称:os-class,代码行数:101,代码来源:search.php

示例9: osc_static_page_url

/**
 * Gets current page url
 *
 * @param string $locale
 * @return string
 */
function osc_static_page_url($locale = '')
{
    if (osc_rewrite_enabled()) {
        $sanitized_categories = array();
        $cat = Category::newInstance()->hierarchy(osc_item_category_id());
        for ($i = count($cat); $i > 0; $i--) {
            $sanitized_categories[] = $cat[$i - 1]['s_slug'];
        }
        $url = str_replace('{PAGE_TITLE}', osc_static_page_title(), str_replace('{PAGE_ID}', osc_static_page_id(), str_replace('{PAGE_SLUG}', urlencode(osc_static_page_slug()), osc_get_preference('rewrite_page_url'))));
        if ($locale != '') {
            $path = osc_base_url() . $locale . "/" . $url;
        } else {
            $path = osc_base_url() . $url;
        }
    } else {
        if ($locale != '') {
            $path = osc_base_url(true) . "?page=page&id=" . osc_static_page_id() . "&lang=" . $locale;
        } else {
            $path = osc_base_url(true) . "?page=page&id=" . osc_static_page_id();
        }
    }
    return $path;
}
开发者ID:mylastof,项目名称:os-class,代码行数:29,代码来源:hPage.php

示例10: _e

                                    </div>
                                    <div class="form-row">
                                        <div class="form-label"><?php _e('User change email confirm'); ?></div>
                                        <div class="form-controls">
                                            <input type="text" class="input-large" name="rewrite_user_change_email_confirm" value="<?php echo osc_esc_html(osc_get_preference('rewrite_user_change_email_confirm')); ?>" />
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="form-label"><?php _e('User change username'); ?></div>
                                        <div class="form-controls">
                                            <input type="text" class="input-large" name="rewrite_user_change_username" value="<?php echo osc_esc_html(osc_get_preference('rewrite_user_change_username')); ?>" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php if( osc_rewrite_enabled() ) { ?>
                            <?php if( file_exists(osc_base_path() . '.htaccess') ) { ?>
                            <div class="form-row">
                                <h3 class="separate-top"><?php _e('Your .htaccess file') ?></h3>
                                <pre><?php
                                    $htaccess_content =  file_get_contents(osc_base_path() . '.htaccess');
                                    echo htmlentities($htaccess_content);
                                ?></pre>
                            </div>
                            <div class="form-row">
                                <h3 class="separate-top"><?php _e('What your .htaccess file should look like') ?></h3>
                                <pre><?php
                                    $rewrite_base = REL_WEB_URL;
                                    $htaccess     = <<<HTACCESS
<IfModule mod_rewrite.c>
RewriteEngine On
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:permalinks.php

示例11: doModel


//.........这里部分代码省略.........
             $item = Item::newInstance()->findByPrimaryKey($itemId);
             if (count($item) == 0) {
                 osc_add_flash_error_message(_m("This listing doesn't exist"));
                 $this->redirectTo(osc_base_url(true));
             }
             View::newInstance()->_exportVariableToView('item', $item);
             if ($this->userId == null) {
                 osc_add_flash_error_message(_m('You must be logged in to delete a comment'));
                 $this->redirectTo(osc_item_url());
             }
             $commentManager = ItemComment::newInstance();
             $aComment = $commentManager->findByPrimaryKey($commentId);
             if (count($aComment) == 0) {
                 osc_add_flash_error_message(_m("The comment doesn't exist"));
                 $this->redirectTo(osc_item_url());
             }
             if ($aComment['b_active'] != 1) {
                 osc_add_flash_error_message(_m('The comment is not active, you cannot delete it'));
                 $this->redirectTo(osc_item_url());
             }
             if ($aComment['fk_i_user_id'] != $this->userId) {
                 osc_add_flash_error_message(_m('The comment was not added by you, you cannot delete it'));
                 $this->redirectTo(osc_item_url());
             }
             $commentManager->deleteByPrimaryKey($commentId);
             osc_add_flash_ok_message(_m('The comment has been deleted'));
             $this->redirectTo(osc_item_url());
             break;
         default:
             // if there isn't ID, show an error 404
             if (Params::getParam('id') == '') {
                 $this->do404();
                 return;
             }
             if (Params::getParam('lang') != '') {
                 Session::newInstance()->_set('userLocale', Params::getParam('lang'));
             }
             $item = $this->itemManager->findByPrimaryKey(Params::getParam('id'));
             // if item doesn't exist show an error 404
             if (count($item) == 0) {
                 $this->do404();
                 return;
             }
             if ($item['b_active'] != 1) {
                 if ($this->userId == $item['fk_i_user_id']) {
                     osc_add_flash_warning_message(_m("The listing hasn't been validated. Please validate it in order to make it public"));
                 } else {
                     osc_add_flash_warning_message(_m("This listing hasn't been validated"));
                     $this->redirectTo(osc_base_url(true));
                 }
             } else {
                 if ($item['b_enabled'] == 0) {
                     osc_add_flash_warning_message(_m('The listing has been suspended'));
                     $this->redirectTo(osc_base_url(true));
                 }
             }
             if (!osc_is_admin_user_logged_in()) {
                 require_once osc_lib_path() . 'osclass/user-agents.php';
                 foreach ($user_agents as $ua) {
                     if (preg_match('|' . $ua . '|', @$_SERVER['HTTP_USER_AGENT'])) {
                         $mStats = new ItemStats();
                         $mStats->increase('i_num_views', $item['pk_i_id']);
                         break;
                     }
                 }
             }
             foreach ($item['locale'] as $k => $v) {
                 $item['locale'][$k]['s_title'] = osc_apply_filter('item_title', $v['s_title']);
                 $item['locale'][$k]['s_description'] = nl2br(osc_apply_filter('item_description', $v['s_description']));
             }
             if ($item['fk_i_user_id'] != '') {
                 $user = User::newInstance()->findByPrimaryKey($item['fk_i_user_id']);
                 $this->_exportVariableToView('user', $user);
             }
             $this->_exportVariableToView('item', $item);
             osc_run_hook('show_item', $item);
             // redirect to the correct url just in case it has changed
             $itemURI = str_replace(osc_base_url(), '', osc_item_url());
             $URI = preg_replace('|^' . REL_WEB_URL . '|', '', $_SERVER['REQUEST_URI']);
             // do not clean QUERY_STRING if permalink is not enabled
             if (osc_rewrite_enabled()) {
                 $URI = str_replace('?' . $_SERVER['QUERY_STRING'], '', $URI);
             } else {
                 $params_keep = array('page', 'id');
                 $params = array();
                 foreach (Params::getParamsAsArray('get') as $k => $v) {
                     if (in_array($k, $params_keep)) {
                         $params[] = "{$k}={$v}";
                     }
                 }
                 $URI = 'index.php?' . implode('&', $params);
             }
             // redirect to the correct url
             if ($itemURI != $URI) {
                 $this->redirectTo(osc_base_url() . $itemURI);
             }
             $this->doView('item.php');
             break;
     }
 }
开发者ID:semul,项目名称:Osclass,代码行数:101,代码来源:item.php

示例12: _e

                                    <div class="form-row">
                                        <div class="form-label"><?php 
_e('User change username');
?>
</div>
                                        <div class="form-controls">
                                            <input type="text" class="input-large" name="rewrite_user_change_username" value="<?php 
echo osc_esc_html(osc_get_preference('rewrite_user_change_username'));
?>
" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php 
if (osc_rewrite_enabled()) {
    ?>
                            <?php 
    if (file_exists(osc_base_path() . '.htaccess')) {
        ?>
                            <div class="form-row">
                                <h3 class="separate-top"><?php 
        _e('Your .htaccess file');
        ?>
</h3>
                                <pre><?php 
        $htaccess_content = file_get_contents(osc_base_path() . '.htaccess');
        echo htmlentities($htaccess_content);
        ?>
</pre>
                            </div>
开发者ID:jmcclenon,项目名称:Osclass,代码行数:31,代码来源:permalinks.php

示例13: init

        public function init()
        {
            // $_SERVER is not supported by Params Class... we should fix that
            if(isset($_SERVER['REQUEST_URI'])) {
                if(preg_match('|[\?&]{1}http_referer=(.*)$|', urldecode($_SERVER['REQUEST_URI']), $ref_match)) {
                    $this->http_referer = $ref_match[1];
                    $_SERVER['REQUEST_URI'] = preg_replace('|[\?&]{1}http_referer=(.*)$|', "", urldecode($_SERVER['REQUEST_URI']));
                }
                $request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", urldecode($_SERVER['REQUEST_URI']));
                $this->raw_request_uri = $request_uri;
                $route_used = false;
                foreach($this->routes as $id => $route) {
                    // UNCOMMENT TO DEBUG
                    //echo 'Request URI: '.$request_uri." # Match : ".$route['regexp']." # URI to go : ".$route['url']." <br />";
                    if(preg_match('#^'.$route['regexp'].'#', $request_uri, $m)) {
                        if(!preg_match_all('#\{([^\}]+)\}#', $route['url'], $args)) {
                            $args[1] = array();
                        }
                        $l = count($m);
                        for($p=1;$p<$l;$p++) {
                            if(isset($args[1][$p-1])) {
                                Params::setParam($args[1][$p-1], $m[$p]);
                            } else {
                                Params::setParam('route_param_'.$p, $m[$p]);
                            }
                        }
                        Params::setParam('page', 'custom');
                        Params::setParam('route', $id);
                        $route_used = true;
                        $this->location = $route['location'];
                        $this->section = $route['section'];
                        $this->title = $route['title'];
                        break;
                    }
                }
                if(!$route_used) {
                    if(osc_rewrite_enabled()) {
                        $tmp_ar = explode("?", $request_uri);
                        $request_uri = $tmp_ar[0];
                        foreach($this->rules as $match => $uri) {
                            // UNCOMMENT TO DEBUG
                            //echo 'Request URI: '.$request_uri." # Match : ".$match." # URI to go : ".$uri." <br />";
                            if(preg_match('#^'.$match.'#', $request_uri, $m)) {
                                $request_uri = preg_replace('#'.$match.'#', $uri, $request_uri);
                                break;
                            }
                        }
                    }
                    $this->extractParams($request_uri);
                    $this->request_uri = $request_uri;

                    if(Params::getParam('page')!='') { $this->location = Params::getParam('page'); };
                    if(Params::getParam('action')!='') { $this->section = Params::getParam('action'); };
                }
            }
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:56,代码来源:Rewrite.php

示例14: osc_search_url

/**
 * Gets search url given params
 *
 * @params array $params
 * @return string
 */
function osc_search_url($params = null)
{
    if (osc_rewrite_enabled()) {
        $url = osc_base_url() . osc_get_preference('rewrite_search_url');
        if ($params != null) {
            $url .= "/";
            foreach ($params as $k => $v) {
                switch ($k) {
                    case 'sCountry':
                        $k = osc_get_preference('rewrite_search_country');
                        break;
                    case 'sRegion':
                        $k = osc_get_preference('rewrite_search_region');
                        break;
                    case 'sCity':
                        $k = osc_get_preference('rewrite_search_city');
                        break;
                    case 'sCityArea':
                        $k = osc_get_preference('rewrite_search_city_area');
                        break;
                    case 'sCategory':
                        $k = osc_get_preference('rewrite_search_category');
                        break;
                    case 'sUser':
                        $k = osc_get_preference('rewrite_search_user');
                        break;
                    case 'sPattern':
                        $k = osc_get_preference('rewrite_search_pattern');
                        break;
                    default:
                        break;
                }
                if ($k != 'page') {
                    $url .= $k . "," . $v . "/";
                }
            }
        }
    } else {
        $url = osc_base_url(true) . '?page=search';
        if ($params != null) {
            foreach ($params as $k => $v) {
                $url .= "&" . $k . "=" . $v;
            }
        }
    }
    return $url;
}
开发者ID:randomecho,项目名称:OSClass,代码行数:53,代码来源:hSearch.php

示例15: osc_item_link_expired

function osc_item_link_expired()
{
    if (!osc_rewrite_enabled()) {
        $url = osc_base_url(true) . "?page=item&action=mark&as=expired&id=" . osc_item_id();
    } else {
        $url = osc_base_url() . "item/mark/expired/" . osc_item_id();
    }
    return $url;
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:9,代码来源:hItems.php


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