• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP osc_rewrite_enabled函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: osc_user_public_profile_url

/**
 * Gets user's profile url
 *
 * @return string
 */
function osc_user_public_profile_url($id = null)
{
    if ($id == null) {
        $id = osc_user_id();
    }
    if ($id != '') {
        if (osc_rewrite_enabled()) {
            $path = osc_base_url() . 'user/profile/' . $id;
        } else {
            $path = sprintf(osc_base_url(true) . '?page=user&action=pub_profile&id=%d', $id);
        }
    } else {
        $path = '';
    }
    return $path;
}
开发者ID:acharei,项目名称:OSClass,代码行数:21,代码来源:hUsers.php


示例17: osc_route_url

/**
 * @param $id
 * @param $args
 * @since 3.2
 */
function osc_route_url($id, $args = array())
{
    $routes = Rewrite::newInstance()->getRoutes();
    if (!isset($routes[$id])) {
        return '';
    }
    if (osc_rewrite_enabled()) {
        $uri = $routes[$id]['url'];
        $params_url = '';
        foreach ($args as $k => $v) {
            $old_uri = $uri;
            $uri = str_ireplace('{' . $k . '}', $v, $uri);
            if ($old_uri == $uri) {
                $params_url .= '&' . $k . '=' . $v;
            }
        }
        return osc_base_url() . $uri . ($params_url != '' ? '?' . $params_url : '');
    } else {
        $params_url = '';
        foreach ($args as $k => $v) {
            $params_url .= '&' . $k . '=' . $v;
        }
        return osc_base_url(true) . "?page=custom&route=" . $id . $params_url;
    }
}
开发者ID:oanav,项目名称:closetshare,代码行数:30,代码来源:hDefines.php


示例18: 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());
             }
             require_once LIB_PATH . 'osclass/UserActions.php';
             $user = User::newInstance()->findByEmail(Params::getParam('email'));
             $url_redirect = osc_user_dashboard_url();
             $page_redirect = '';
             if (osc_rewrite_enabled()) {
                 if (isset($_SERVER['HTTP_REFERER'])) {
                     $request_uri = urldecode(preg_replace('@^' . osc_base_url() . '@', "", $_SERVER['HTTP_REFERER']));
                     $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];
                             }
                             break;
                         }
                     }
                 }
             } else {
                 if (preg_match('|[\\?&]page=([^&]+)|', $_SERVER['HTTP_REFERER'] . '&', $match)) {
                     $page_redirect = $match[1];
                 }
             }
             if (Params::getParam('http_referer') != '') {
                 Session::newInstance()->_setReferer(Params::getParam('http_referer'));
                 $url_redirect = Params::getParam('http_referer');
             } else {
                 if (Session::newInstance()->_getReferer() != '') {
                     Session::newInstance()->_setReferer(Session::newInstance()->_getReferer());
                     $url_redirect = Session::newInstance()->_getReferer();
                 } else {
                     if ($page_redirect != '' && $page_redirect != 'login') {
                         Session::newInstance()->_setReferer($_SERVER['HTTP_REFERER']);
                         $url_redirect = $_SERVER['HTTP_REFERER'];
                     }
                 }
             }
             if (!$user) {
                 osc_add_flash_error_message(_m('The username doesn\'t exist'));
                 $this->redirectTo(osc_user_login_url());
             }
             if ($user["s_password"] != sha1(Params::getParam('password'))) {
                 osc_add_flash_error_message(_m('The password is incorrect'));
                 $this->redirectTo(osc_user_login_url());
             }
             $uActions = new UserActions(false);
             $logged = $uActions->bootstrap_login($user['pk_i_id']);
             if ($logged == 0) {
                 osc_add_flash_error_message(_m('The username doesn\'t exist'));
             } else {
                 if ($logged == 1) {
                     osc_add_flash_error_message(_m('The user has not been validated yet'));
                 } else {
                     if ($logged == 2) {
                         osc_add_flash_error_message(_m('The user has been suspended'));
                     } else {
                         if ($logged == 3) {
                             if (Params::getParam('remember') == 1) {
                                 //this include contains de osc_genRandomPassword function
                                 require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                                 $secret = osc_genRandomPassword();
                                 User::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $user['pk_i_id']));
                                 Cookie::newInstance()->set_expires(osc_time_cookie());
                                 Cookie::newInstance()->push('oc_userId', $user['pk_i_id']);
                                 Cookie::newInstance()->push('oc_userSecret', $secret);
                                 Cookie::newInstance()->set();
                             }
                             $this->redirectTo($url_redirect);
                         } else {
                             osc_add_flash_error_message(_m('This should never happens'));
                         }
                     }
                 }
             }
             if (!$user['b_enabled']) {
                 $this->redirectTo(osc_user_login_url());
             }
             $this->redirectTo(osc_user_login_url());
             break;
         case 'recover':
             //form to recover the password (in this case we have the form in /gui/)
             $this->doView('user-recover.php');
             break;
         case 'recover_post':
             //post execution to recover the password
             require_once LIB_PATH . 'osclass/UserActions.php';
             // e-mail is incorrect
             if (!preg_match('|^[a-z0-9\\.\\_\\+\\-]+@[a-z0-9\\.\\-]+\\.[a-z]{2,3}$|i', Params::getParam('s_email'))) {
                 osc_add_flash_error_message(_m('Invalid email address'));
//.........这里部分代码省略.........
开发者ID:acharei,项目名称:OSClass,代码行数:101,代码来源:login.php



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP osc_route_url函数代码示例发布时间:2022-05-15
下一篇:
PHP osc_resource_thumbnail_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap