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

PHP Rewrite类代码示例

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

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



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

示例1: osc_get_osclass_section

/**
 * Get section
 *
 * @return string
 */
function osc_get_osclass_section()
{
    return Rewrite::newInstance()->get_section();
}
开发者ID:randomecho,项目名称:OSClass,代码行数:9,代码来源:hDefines.php


示例2: 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


示例3: analyzeUrl

 public function analyzeUrl()
 {
     // Check if URL is set in general
     if (is_null($this->url)) {
         throw new Exception("No request URL set!");
         return;
     }
     // Check for rewrtite rules
     $rewrite = new Rewrite($this->url);
     $rewrite->applyRules();
     if ($rewrite->getTargetUrl() != $this->url) {
         if (!$rewrite->transportQueryParameter()) {
             $_GET = array();
             $_POST = array();
         }
         if ($rewrite->isRedirect()) {
             $this->redirectToUrl($rewrite->getTargetUrl(), $_POST);
         }
         $this->setUrl($rewrite->getTargetUrl());
         $this->analyzeRequest(!$rewrite->isLastForward());
     }
     // Check access rights to requested content
     $access = new AccessOfficer("content", $this->content_id, $this->session->getUser(), $this->content_parents);
     if (!$access->check()) {
         // Access denied
         if (!$access->getDeniedContentID()) {
             // No content to be shown as 403 page set
             // TODO set up default 403 (and 404) templates
             throw new Exception("Access denied and no denied content defined!");
             return;
         }
         // Should parameters be transported through the redirects / rewrites
         if (!$access->transportQueryParameter()) {
             $_GET = array();
             $_POST = array();
         }
         // Show 403 error page or redirect if neccessary
         $newcontent = new Content($access->getDeniedContentID());
         if ($access->isRedirect() && $newcontent->getID() != $this->content_id) {
             // Redirect, but keep requested URL as origin parameter
             // TODO: keep origin request parameters as well!
             $this->redirectToUrl("/" . $newcontent->getUrl() . "?origin=" . $this->url, $_POST);
         }
         $this->setUrl($newcontent->getUrl());
         $this->analyzeRequest(!$access->isLastForward());
     }
     // TODO: HookPoints to manipulate this behaviour
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:48,代码来源:Controller.php


示例4: addTableHeader

 private function addTableHeader()
 {
     $arg_date = '&sort=date';
     if (Params::getParam('sort') == 'date') {
         if (Params::getParam('direction') == 'desc') {
             $arg_date .= '&direction=asc';
         }
     }
     $arg_item = '&sort=attached_to';
     if (Params::getParam('sort') == 'attached_to') {
         if (Params::getParam('direction') == 'desc') {
             $arg_item .= '&direction=asc';
         }
     }
     Rewrite::newInstance()->init();
     $page = (int) Params::getParam('iPage');
     if ($page == 0) {
         $page = 1;
     }
     Params::setParam('iPage', $page);
     $url_base = preg_replace('|&direction=([^&]*)|', '', preg_replace('|&sort=([^&]*)|', '', osc_base_url() . Rewrite::newInstance()->get_raw_request_uri()));
     $this->addColumn('bulkactions', '<input id="check_all" type="checkbox" />');
     $this->addColumn('file', __('File'));
     $this->addColumn('action', __('Action'));
     $this->addColumn('attached_to', '<a href="' . osc_esc_html($url_base . $arg_item) . '">' . __('Attached to') . '</a>');
     $this->addColumn('date', '<a href="' . osc_esc_html($url_base . $arg_date) . '">' . __('Date') . '</a>');
     $dummy =& $this;
     osc_run_hook("admin_media_table", $dummy);
 }
开发者ID:mylastof,项目名称:os-class,代码行数:29,代码来源:MediaDataTable.php


示例5: do410

 function do410()
 {
     Rewrite::newInstance()->set_location('error');
     header('HTTP/1.1 410 Gone');
     osc_current_web_theme_path('404.php');
     exit;
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:7,代码来源:BaseModel.php


示例6: _init

 public static function _init()
 {
     date_default_timezone_set(Conf::param('timezone'));
     //设置默认时区
     //地址重写
     Rewrite::init();
 }
开发者ID:beelibrary820145,项目名称:tanxiongfeng,代码行数:7,代码来源:App.class.php


示例7: item_success_item_validate

function item_success_item_validate()
{
    if (Params::getParam('page') == 'item' && Params::getParam('action') == 'activate') {
        $secret = Params::getParam('secret');
        $id = Params::getParam('id');
        $item = Item::newInstance()->listWhere("i.pk_i_id = '%s' AND ((i.s_secret = '%s') OR (i.fk_i_user_id = '%d'))", addslashes($id), addslashes($secret), addslashes(osc_logged_user_id()));
        // item doesn't exist
        if (count($item) == 0) {
            Rewrite::newInstance()->set_location('error');
            header('HTTP/1.1 404 Not Found');
            osc_current_web_theme_path('404.php');
            exit;
        }
        View::newInstance()->_exportVariableToView('item', $item[0]);
        if ($item[0]['b_active'] == 0) {
            // ACTIVETE ITEM
            $mItems = new ItemActions(false);
            $success = $mItems->activate($item[0]['pk_i_id'], $item[0]['s_secret']);
            if ($success) {
                osc_add_flash_ok_message(_m('The listing has been validated'));
                item_success_redirect(Item::newInstance()->findByPrimaryKey($item[0]['pk_i_id']));
                exit;
            } else {
                osc_add_flash_error_message(_m("The listing can't be validated"));
            }
        } else {
            osc_add_flash_warning_message(_m('The listing has already been validated'));
        }
        osc_redirect_to(osc_item_url());
    }
}
开发者ID:oanav,项目名称:closetshare,代码行数:31,代码来源:index.php


示例8: __construct

 public function __construct($lang = array())
 {
     $this->location = Rewrite::newInstance()->get_location();
     $this->section = Rewrite::newInstance()->get_section();
     $this->aLevel = array();
     $this->setTitles($lang);
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:7,代码来源:Breadcrumb.php


示例9: social_bookmarks_header

function social_bookmarks_header()
{
    $location = Rewrite::newInstance()->get_location();
    $section = Rewrite::newInstance()->get_section();
    if ($location == 'item' && $section == '') {
        echo '
            <style type="text/css">
                .social-bookmarks ul { margin: 10px 0; list-style: none; }
                .social-bookmarks ul li { float: left; }
                .social-bookmarks .clear { clear:both; }
            </style>';
    }
}
开发者ID:oanav,项目名称:closetshare,代码行数:13,代码来源:index.php


示例10: doModel

        function doModel()
        {
            $user_menu = false;
            if(Params::existParam('route')) {
                $routes = Rewrite::newInstance()->getRoutes();
                $rid = Params::getParam('route');
                $file = '../';
                if(isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                    $file = $routes[$rid]['file'];
                    $user_menu = $routes[$rid]['user_menu'];
                }
            } else {
                // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                // This will be REMOVED in 3.4
                $file = Params::getParam('file');
            }

            // valid file?
            if( strpos($file, '../') !== false || strpos($file, '..\\') !==false || stripos($file, '/admin/') !== false ) { //If the file is inside an "admin" folder, it should NOT be opened in frontend
                $this->do404();
                return;
            }

            // check if the file exists
            if( !file_exists(osc_plugins_path() . $file) ) {
                $this->do404();
                return;
            }

            osc_run_hook('custom_controller');

            $this->_exportVariableToView('file', $file);
            if($user_menu) {
                if(osc_is_web_user_logged_in()) {
                    Params::setParam('in_user_menu', true);
                    $this->doView('user-custom.php');
                } else {
                    $this->redirectTo(osc_user_login_url());
                }
            } else {
                $this->doView('custom.php');
            }
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:43,代码来源:custom.php


示例11: pop_redirect_404

function pop_redirect_404($header_text = '')
{
    if ($header_text != '') {
        View::newInstance()->_exportVariableToView('pop_404_header_text', $header_text);
    }
    Rewrite::newInstance()->set_location('error');
    header('HTTP/1.1 404 Not Found');
    osc_current_web_theme_path('404.php');
    exit;
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:10,代码来源:functions.php


示例12: define

<?php

define('WWW_ROOT', __DIR__);
require __DIR__ . '/../log/Log.class.php';
require __DIR__ . '/Rewrite.class.php';
Log::getLogger(array('level' => Log::ALL));
class Render implements RewriteHandle
{
    public function process($file)
    {
        echo file_get_contents($file);
    }
}
$rewrite = new Rewrite(__DIR__ . '/test');
$rewrite->addConfigFile('home.conf');
$rewrite->addConfigFile('common.conf');
$rewrite->addRewriteHandle('tpl', new Render());
$rewrite->dispatch('/home/test');
开发者ID:kxbrand,项目名称:php-simulation-env,代码行数:18,代码来源:TestRewrite.php


示例13:

 *       This program is free software: you can redistribute it and/or
 *     modify it under the terms of the GNU Affero General Public License
 *     as published by the Free Software Foundation, either version 3 of
 *            the License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful, but
 *         WITHOUT ANY WARRANTY; without even the implied warranty of
 *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *             GNU Affero General Public License for more details.
 *
 *      You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'oc-load.php';
//create object
$rewrite = Rewrite::newInstance();
$rewrite->clearRules();
/*****************************
 ********* Add rules *********
 *****************************/
// Contact rules
$rewrite->addRule('^contact/?$', 'index.php?page=contact');
// Feed rules
$rewrite->addRule('^feed$', 'index.php?page=search&sFeed=rss');
$rewrite->addRule('^feed/(.+)$', 'index.php?page=search&sFeed=$1');
// Language rules
$rewrite->addRule('^language/(.*?)/?$', 'index.php?page=language&locale=$1');
// Search rules
$rewrite->addRule('^search/(.*)$', 'index.php?page=search&sPattern=$1');
$rewrite->addRule('^s/(.*)$', 'index.php?page=search&sPattern=$1');
// Item rules
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:generate_rules.php


示例14: do404

 function do404()
 {
     Rewrite::newInstance()->set_location('error');
     header('HTTP/1.1 404 Not Found');
     osc_current_web_theme_path('404.php');
 }
开发者ID:nsswaga,项目名称:OSClass,代码行数:6,代码来源:BaseModel.php


示例15: allSeo_title_filter

function allSeo_title_filter($text)
{
    $location = Rewrite::newInstance()->get_location();
    $section = Rewrite::newInstance()->get_section();
    switch ($location) {
        // Listing page and page related to listings
        case 'item':
            switch ($section) {
                case 'item_add':
                    $text = __('Publish a listing', 'all_in_one');
                    break;
                case 'item_edit':
                    $text = __('Edit your listing', 'all_in_one');
                    break;
                case 'send_friend':
                    $text = __('Send to a friend', 'all_in_one') . Delimiter() . osc_item_title();
                    break;
                case 'contact':
                    $text = __('Contact seller', 'all_in_one') . Delimiter() . osc_item_title();
                    break;
                default:
                    $text = SeoGenerateTitleListing();
                    break;
            }
            break;
            // Static page
        // Static page
        case 'page':
            if (GetPageTitle() == '') {
                $text = osc_static_page_title();
            } else {
                $text = GetPageTitle();
            }
            break;
            // Error page
        // Error page
        case 'error':
            $text = __('Page not found', 'all_in_one');
            break;
            // Search & Category page
        // Search & Category page
        case 'search':
            $region = osc_search_region();
            $city = osc_search_city();
            $pattern = osc_search_pattern();
            $category = osc_search_category_id();
            $s_page = '';
            $i_page = Params::getParam('iPage');
            if ($i_page != '' && $i_page > 1) {
                $s_page = Delimiter() . __('page', 'all_in_one') . ' ' . $i_page;
            }
            $result = SeoGenerateTitleCategory();
            if ($result == '') {
                $result = __('Search result', 'all_in_one');
            }
            $text = $result . $s_page;
            break;
            // Login page
        // Login page
        case 'login':
            switch ($section) {
                case 'recover':
                    $text = __('Recover your password', 'all_in_one');
                default:
                    $text = __('Login into your account', 'all_in_one');
            }
            break;
            // Registration page
        // Registration page
        case 'register':
            $text = __('Create a new account', 'all_in_one');
            break;
            // User page and pages related to user
        // User page and pages related to user
        case 'user':
            switch ($section) {
                case 'dashboard':
                    $text = __('Dashboard', 'all_in_one');
                    break;
                case 'items':
                    $text = __('Manage my listings', 'all_in_one');
                    break;
                case 'alerts':
                    $text = __('Manage my alerts', 'all_in_one');
                    break;
                case 'profile':
                    $text = __('Update my profile', 'all_in_one');
                    break;
                case 'pub_profile':
                    $text = __('Public profile of', 'all_in_one') . ' ' . ucfirst(osc_user_name());
                    break;
                case 'change_email':
                    $text = __('Change my email', 'all_in_one');
                    break;
                case 'change_password':
                    $text = __('Change my password', 'all_in_one');
                    break;
                case 'forgot':
                    $text = __('Recover my password', 'all_in_one');
                    break;
//.........这里部分代码省略.........
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:101,代码来源:index.php


示例16: meta_title

function meta_title()
{
    $location = Rewrite::newInstance()->get_location();
    $section = Rewrite::newInstance()->get_section();
    $text = '';
    switch ($location) {
        case 'item':
            switch ($section) {
                case 'item_add':
                    $text = __('Publish a listing');
                    break;
                case 'item_edit':
                    $text = __('Edit your listing');
                    break;
                case 'send_friend':
                    $text = __('Send to a friend') . ' - ' . osc_item_title();
                    break;
                case 'contact':
                    $text = __('Contact seller') . ' - ' . osc_item_title();
                    break;
                default:
                    $text = osc_item_title() . ' ' . osc_item_city();
                    break;
            }
            break;
        case 'page':
            $text = osc_static_page_title();
            break;
        case 'error':
            $text = __('Error');
            break;
        case 'search':
            $region = osc_search_region();
            $city = osc_search_city();
            $pattern = osc_search_pattern();
            $category = osc_search_category_id();
            $s_page = '';
            $i_page = Params::getParam('iPage');
            if ($i_page != '' && $i_page > 1) {
                $s_page = ' - ' . __('page') . ' ' . $i_page;
            }
            $b_show_all = $region == '' && $city == '' && $pattern == '' && empty($category);
            $b_category = !empty($category);
            $b_pattern = $pattern != '';
            $b_city = $city != '';
            $b_region = $region != '';
            if ($b_show_all) {
                $text = __('Show all listings') . ' - ' . $s_page . osc_page_title();
            }
            $result = '';
            if ($b_pattern) {
                $result .= $pattern . ' &raquo; ';
            }
            if ($b_category && is_array($category) && count($category) > 0) {
                $cat = Category::newInstance()->findByPrimaryKey($category[0]);
                if ($cat) {
                    $result .= $cat['s_name'] . ' ';
                }
            }
            if ($b_city) {
                $result .= $city . ' &raquo; ';
            } else {
                if ($b_region) {
                    $result .= $region . ' &raquo; ';
                }
            }
            $result = preg_replace('|\\s?&raquo;\\s$|', '', $result);
            if ($result == '') {
                $result = __('Search results');
            }
            $text = '';
            if (osc_get_preference('seo_title_keyword') != '') {
                $text .= osc_get_preference('seo_title_keyword') . ' ';
            }
            $text .= $result . $s_page;
            break;
        case 'login':
            switch ($section) {
                case 'recover':
                    $text = __('Recover your password');
                default:
                    $text = __('Login');
            }
            break;
        case 'register':
            $text = __('Create a new account');
            break;
        case 'user':
            switch ($section) {
                case 'dashboard':
                    $text = __('Dashboard');
                    break;
                case 'items':
                    $text = __('Manage my listings');
                    break;
                case 'alerts':
                    $text = __('Manage my alerts');
                    break;
                case 'profile':
                    $text = __('Update my profile');
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:functions.php


示例17: generateDownloadLinkForExisting

 /**
  * Generate a download link for an exisiting file in the cache.
  *
  * @param  string $strCachedName The name of the file in the cache
  * @param  string $strFilename File name
  * @return string The generated download link
  */
 public static function generateDownloadLinkForExisting($strCachedName, $strFilename, $strDownloadUrl = null)
 {
     // Save in session
     $_SESSION["documents"][$strCachedName] = $strFilename;
     if (is_null($strDownloadUrl)) {
         $objRewrite = Rewrite::getInstance();
         $strDownloadUrl = $objRewrite->getUrl(SECTION_DOCUMENT, CMD_DOWNLOAD, null, null, SUB_SECTION_EMPTY, array("t" => $strCachedName));
     } else {
         $strDownloadUrl .= "/t/" . Rewrite::encode($strCachedName);
     }
     $strReturn = Request::getRootURI() . $strDownloadUrl;
     return $strReturn;
 }
开发者ID:rvanbaalen,项目名称:bili,代码行数:20,代码来源:Response.php


示例18: doModel


//.........这里部分代码省略.........
                     return true;
                 } else {
                     echo '-1';
                     return false;
                 }
             }
             echo '0';
             return false;
             break;
         case 'runhook':
             // run hooks
             $hook = Params::getParam('hook');
             if ($hook == '') {
                 echo json_encode(array('error' => 'hook parameter not defined'));
                 break;
             }
             switch ($hook) {
                 case 'item_form':
                     osc_run_hook('item_form', Params::getParam('catId'));
                     break;
                 case 'item_edit':
                     $catId = Params::getParam("catId");
                     $itemId = Params::getParam("itemId");
                     osc_run_hook("item_edit", $catId, $itemId);
                     break;
                 default:
                     osc_run_hook('ajax_' . $hook);
                     break;
             }
             break;
         case 'custom':
             // Execute via AJAX custom file
             if (Params::existParam('route')) {
                 $routes = Rewrite::newInstance()->getRoutes();
                 $rid = Params::getParam('route');
                 $file = '../';
                 if (isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                     $file = $routes[$rid]['file'];
                 }
             } else {
                 // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                 // This will be REMOVED in 3.4
                 $file = Params::getParam('ajaxfile');
             }
             if ($file == '') {
                 echo json_encode(array('error' => 'no action defined'));
                 break;
             }
             // valid file?
             if (strpos($file, '../') !== false || strpos($file, '..\\') !== false || stripos($file, '/admin/') !== false) {
                 //If the file is inside an "admin" folder, it should NOT be opened in frontend
                 echo json_encode(array('error' => 'no valid ajaxFile'));
                 break;
             }
             if (!file_exists(osc_plugins_path() . $file)) {
                 echo json_encode(array('error' => "ajaxFile doesn't exist"));
                 break;
             }
             require_once osc_plugins_path() . $file;
             break;
         case 'check_username_availability':
             $username = osc_sanitize_username(Params::getParam('s_username'));
             if (!osc_is_username_blacklisted($username)) {
                 $user = User::newInstance()->findByUsername($username);
                 if (isset($user['s_username'])) {
                     echo json_encode(array('exists' => 1, 's_username' => $username));
开发者ID:oanav,项目名称:closetshare,代码行数:67,代码来源:ajax.php


示例19: doModel


//.........这里部分代码省略.........
                        $cityId = Params::getParam('id');
                        Item::newInstance()->deleteByCity($cityId);
                        $aCity = $mCities->findByPrimaryKey($cityId);
                        // remove region_stats
                        $region = $mRegion->findByPrimaryKey($aCity['fk_i_region_id']);
                        $country = Country::newInstance()->findByCode($region['fk_c_country_code']);
                        CityStats::newInstance()->delete(array('fk_i_city_id' => $cityId));
                        $mCities->delete(array('pk_i_id' => $cityId));
                        osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCity['s_name']), 'admin');
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name'] . "&region=" . @$region['pk_i_id']);
                        break;
                }
                $aCountries = $mCountries->listAll();
                $this->_exportVariableToView('aCountries', $aCountries);
                $this->doView('settings/locations.php');
                break;
            case 'permalinks':
                // calling the permalinks view
                $htaccess = Params::getParam('htaccess_status');
                $file = Params::getParam('file_status');
                $this->_exportVariableToView('htaccess', $htaccess);
                $this->_exportVariableToView('file', $file);
                $this->doView('settings/permalinks.php');
                break;
            case 'permalinks_post':
                // updating permalinks option
                $htaccess_file = osc_base_path() . '.htaccess';
                $rewriteEnabled = Params::getParam('rewrite_enabled') ? true : false;
                if ($rewriteEnabled) {
                    Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'rewriteEnabled'));
                    $rewrite_base = REL_WEB_URL;
                    $htaccess = <<<HTACCESS
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase {$rewrite_base}
    RewriteRule ^index\\.php\$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . {$rewrite_base}index.php [L]
</IfModule>
HTACCESS;
                    // 1. OK (ok)
                    // 2. OK no apache module detected (warning)
                    // 3. No se puede crear + apache
                    // 4. No se puede crear + no apache
                    $status = 3;
                    if (file_exists($htaccess_file)) {
                        if (is_writable($htaccess_file) && file_put_contents($htaccess_file, $htaccess)) {
                            $status = 1;
                        }
                    } else {
                        if (is_writable(osc_base_path()) && file_put_contents($htaccess_file, $htaccess)) {
                            $status = 1;
                        }
                    }
                    if (!@apache_mod_loaded('mod_rewrite')) {
                        $status++;
                    }
                    $errors = 0;
                    $item_url = substr(str_replace('//', '/', Params::getParam('rewrite_item_url') . '/'), 0, -1);
                    if (!osc_validate_text($item_url)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $item_url), array('s_name' => 'rewrite_item_url'));
                    }
                    $page_url = substr(str_replace('//', '/', Params::getParam('rewrite_page_url') . '/'), 0, -1);
开发者ID:semul,项目名称:Osclass,代码行数:67,代码来源:settings.php


示例20: define

require_once LIB_PATH . 'osclass/frm/Category.form.class.php';
require_once LIB_PATH . 'osclass/frm/Item.form.class.php';
require_once LIB_PATH . 'osclass/frm/Contact.form.class.php';
require_once LIB_PATH . 'osclass/frm/Comment.form.class.php';
require_once LIB_PATH . 'osclass/frm/User.form.class.php';
require_once LIB_PATH . 'osclass/frm/Language.form.class.php';
require_once LIB_PATH . 'osclass/frm/SendFriend.form.class.php';
require_once LIB_PATH . 'osclass/frm/Alert.form.class.php';
require_once LIB_PATH . 'osclass/frm/Field.form.class.php';
require_once LIB_PATH . 'osclass/frm/Admin.form.class.php';
require_once LIB_PATH . 'osclass/functions.php';
define('__OSC_LOADED__', true);
Plugins::init();
// init Rewrite class only iif it's the frontend
if (!OC_ADMIN) {
    Rewrite::newInstance()->init();
}
// Moved from BaseModel, since we need some session magic on index.php ;)
Session::newInstance()->session_start();
if (osc_timezone() != '') {
    date_default_timezone_set(osc_timezone());
}
function osc_show_maintenance()
{
    if (defined('__OSC_MAINTENANCE__')) {
        ?>
        <div id="maintenance" name="maintenance">
             <?php 
        _e("The website is currently under maintenance mode");
        ?>
        </div>
开发者ID:randomecho,项目名称:OSClass,代码行数:31,代码来源:oc-load.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Rights类代码示例发布时间:2022-05-23
下一篇:
PHP Revision类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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