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


PHP request_uri函数代码示例

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


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

示例1: drupalvb_set_login_cookies

/**
 * Set the necessary cookies for the user to be logged into the forum.
 *
 * Frontend cookie names:
 * - lastvisit, lastactivity, sessionhash
 * Backend cookie names:
 * - cpsession, userid, password
 *
 * However, in all cases the cookiedomain is NOT prefixed with a dot unless
 * cookie domain has not been manually altered to either a suggested value or
 * custom value in vB's settings.
 */
function drupalvb_set_login_cookies($userid)
{
    // Load required vB user data.
    $vbuser = db_fetch_array(drupalvb_db_query("SELECT userid, password, salt FROM {user} WHERE userid = %d", $userid));
    if (!$vbuser) {
        return FALSE;
    }
    $vb_config = drupalvb_get('config');
    $vb_options = drupalvb_get('options');
    $cookie_prefix = isset($vb_config['Misc']['cookieprefix']) ? $vb_config['Misc']['cookieprefix'] : 'bb';
    $cookie_path = $vb_options['cookiepath'];
    $cookie_domain = !empty($vb_options['cookiedomain']) ? $vb_options['cookiedomain'] : $GLOBALS['cookie_domain'];
    $now = time();
    $expire = $now + (@ini_get('session.cookie_lifetime') ? ini_get('session.cookie_lifetime') : 60 * 60 * 24 * 365);
    // Clear out old session (if available).
    if (!empty($_COOKIE[$cookie_prefix . 'sessionhash'])) {
        drupalvb_db_query("DELETE FROM {session} WHERE sessionhash = '%s'", $_COOKIE[$cookie_prefix . 'sessionhash']);
    }
    // Setup user session.
    $ip = implode('.', array_slice(explode('.', drupalvb_get_ip()), 0, 4 - $vb_options['ipcheck']));
    $idhash = md5($_SERVER['HTTP_USER_AGENT'] . $ip);
    $sessionhash = md5($now . request_uri() . $idhash . $_SERVER['REMOTE_ADDR'] . user_password(6));
    drupalvb_db_query("REPLACE INTO {session} (sessionhash, userid, host, idhash, lastactivity, location, useragent, loggedin) VALUES ('%s', %d, '%s', '%s', %d, '%s', '%s', %d)", $sessionhash, $vbuser['userid'], substr($_SERVER['REMOTE_ADDR'], 0, 15), $idhash, $now, '/forum/', $_SERVER['HTTP_USER_AGENT'], 2);
    // Setup cookies.
    setcookie($cookie_prefix . 'sessionhash', $sessionhash, $expire, $cookie_path, $cookie_domain);
    setcookie($cookie_prefix . 'lastvisit', $now, $expire, $cookie_path, $cookie_domain);
    setcookie($cookie_prefix . 'lastactivity', $now, $expire, $cookie_path, $cookie_domain);
    setcookie($cookie_prefix . 'userid', $vbuser['userid'], $expire, $cookie_path, $cookie_domain);
    setcookie($cookie_prefix . 'password', md5($vbuser['password'] . variable_get('drupalvb_license', '')), $expire, $cookie_path, $cookie_domain);
    return TRUE;
}
开发者ID:NeformatDev,项目名称:v2,代码行数:43,代码来源:drupalvb.inc.php

示例2: mvp_preprocess_html

function mvp_preprocess_html(&$vars)
{
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/modernizr.min.js', array('scope' => 'header_scripts', 'every_page' => TRUE, 'weight' => 0));
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/jquery-1.8.2.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => 0));
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/jquery-ui-1.10.4.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => 3));
    if (request_uri() == '/content-dashboard') {
        drupal_add_js('(function($) {
      Drupal.behaviors.chosenSelects = {
        attach: function(context, settings) {
          $(".views-widget-filter-edit-type select#edit-type").chosen({
            width: "200px",
            placeholder_text_multiple: "Enter in a Content Type"
          });
          $(".views-widget-filter-edit-status-1 select").chosen({
            width: "200px",
            disable_search_threshold: 3
          });
        }
      };
    })(jQuery);', array('type' => 'inline', 'group' => JS_THEME, 'weight' => 2, 'defer' => TRUE));
    }
    $node = menu_get_object();
    if ($node && $node->nid) {
        $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
    }
}
开发者ID:stevengrimaldo,项目名称:myvoipprovider,代码行数:26,代码来源:template.php

示例3: eu_projects_theme_preprocess_page

/**
 * Implements hook_preprocess_page().
 */
function eu_projects_theme_preprocess_page(&$vars, $hook)
{
    $path_alias = drupal_get_path_alias();
    // Webtools.
    $inline_script = '<script defer src="//europa.eu/webtools/load.js" type="text/javascript"></script>';
    $element = array('#type' => 'markup', '#markup' => $inline_script);
    drupal_add_html_head($element, 'webtools');
    // Apple-touch-icon-precomposed.
    $apple_touch_icon_precomposed = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'apple-touch-icon-precomposed'));
    drupal_add_html_head($apple_touch_icon_precomposed, 'apple-touch-icon-precomposed');
    // Apple-touch-icon.
    $apple_touch_icon = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'icon'));
    drupal_add_html_head($apple_touch_icon, 'apple-touch-icon');
    // Apple-mobile-web-app-capable.
    $apple_mobile_web_app_capable = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes'));
    drupal_add_html_head($apple_mobile_web_app_capable, 'apple-mobile-web-app-capable');
    // Application-name.
    $application_name = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => t('EU Results')));
    drupal_add_html_head($application_name, 'application-name');
    // Apple-mobile-web-app-title.
    $apple_mobile_web_app_title = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-title', 'content' => t('EU Results')));
    drupal_add_html_head($apple_mobile_web_app_title, 'apple-mobile-web-app-title');
    // Apple-touch-startup-image-ec.
    $apple_touch_startup_image_ec = array('#tag' => 'meta', '#attributes' => array('rel' => 'apple-touch-startup-image-ec', 'href' => file_create_url(path_to_theme() . '/images/startup-image.png')));
    drupal_add_html_head($apple_touch_startup_image_ec, 'apple-touch-startup-image-ec');
    // Preload geojson for map
    if ($path_alias == 'search-projects') {
        $path = explode('?', request_uri());
        $var = isset($path[1]) ? '?' . $path[1] : '';
        $preload_geojson = array('#tag' => 'link', '#attributes' => array('rel' => 'prefetch', 'href' => $GLOBALS['base_url'] . '/projects-geojson_' . $GLOBALS['language']->language . $var));
        drupal_add_html_head($preload_geojson, 'preload_geojson');
    }
}
开发者ID:EU-Budget,项目名称:eu_projects_theme,代码行数:36,代码来源:template.php

示例4: parse_params

/**
 * Parse any get params that might be hidden in the URL
 */
function parse_params()
{
    // --[ mod_rewrite code ]--
    if (!isset($_GET[ROSTER_PAGE])) {
        $uri = request_uri();
        $page = substr($uri, strlen(ROSTER_PATH));
        list($page) = explode('.', $page);
        // Build the Roster page var
        $pages = array();
        foreach (explode('/', $page) as $get) {
            if (strpos($get, '=') === false) {
                $pages[] = $get;
            } else {
                parse_str($get, $get);
                if (!get_magic_quotes_gpc()) {
                    $get = escape_array($get);
                }
                $_GET = array_overlay($get, $_GET);
            }
        }
        // Needed in case someone specified www.example.com/roster/index.php.
        // That format is the only one that works in IIS
        if ($pages == array('index')) {
            $pages = array();
        }
        $_GET[ROSTER_PAGE] = implode('-', $pages);
    }
}
开发者ID:Sajaki,项目名称:wowroster,代码行数:31,代码来源:cmslink.lib.php

示例5: brukar_client_oauth_callback

function brukar_client_oauth_callback()
{
    require_once drupal_get_path('module', 'brukar_common') . '/OAuth.php';
    $method = new OAuthSignatureMethod_HMAC_SHA1();
    $consumer = new OAuthConsumer(variable_get('brukar_consumer_key'), variable_get('brukar_consumer_secret'));
    if (isset($_SESSION['auth_oauth']) && $_SESSION['auth_oauth']['oauth_token'] == $_GET['oauth_token']) {
        unset($_GET['oauth_token']);
        $tmp = new OAuthToken($_SESSION['auth_oauth']['oauth_token'], $_SESSION['auth_oauth']['oauth_token_secret']);
        $req = OAuthRequest::from_consumer_and_token($consumer, $tmp, 'GET', variable_get('brukar_url') . 'server/oauth/access_token', array());
        $req->sign_request($method, $consumer, $tmp);
        parse_str(trim(file_get_contents($req->to_url())), $token);
        unset($_SESSION['auth_oauth']);
        if (count($token) > 0) {
            $_SESSION['_brukar_access_token'] = array('token' => $token['oauth_token'], 'token_secret' => $token['oauth_token_secret']);
            $token = new OAuthToken($token['oauth_token'], $token['oauth_token_secret']);
            $req = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', variable_get('brukar_url') . 'server/oauth/user', array());
            $req->sign_request($method, $consumer, $token);
            brukar_client_login((array) json_decode(trim(file_get_contents($req->to_url()))));
        }
    }
    $debug_data = array('cookie' => $_COOKIE, 'request_uri' => request_uri(), 'auth_oauth' => isset($_SESSION['auth_oauth']) ? $_SESSION['auth_oauth'] : 'no auth_oauth');
    watchdog('brukar_client', 'User login failed.<br/>Debug data:<br/><pre>!debug_data</pre><br/>', array('!debug_data' => print_r($debug_data, TRUE)), WATCHDOG_ERROR);
    drupal_set_message(t('Noe gikk feil under innlogging.'), 'warning');
    drupal_goto('<front>');
}
开发者ID:evenos,项目名称:drupal7-module-brukar,代码行数:25,代码来源:brukar_client.oauth.php

示例6: __construct

 /**
  * 构造函数 
  */
 public function __construct()
 {
     parent::__construct();
     //读取语言包
     Language::read('home_cart_index');
     //允许不登录就可以访问的op
     $op_arr = array('ajaxcart', 'add', 'drop');
     $op_str = '';
     $op_str = isset($_GET['op']) ? $_GET['op'] : $_POST['op'];
     if (!in_array($op_str, $op_arr) && !$_SESSION['member_id']) {
         $current_url = request_uri();
         redirect('index.php?act=login&ref_url=' . urlencode($current_url));
     }
     //验证该会员是否禁止购买
     $noallowbuyop_arr = array('step1', 'step2');
     $noallowbuyop_str = '';
     $noallowbuyop_str = isset($_GET['op']) ? $_GET['op'] : $_POST['op'];
     if (in_array($noallowbuyop_str, $noallowbuyop_arr)) {
         $member_model = Model('member');
         $member_id = intval($_SESSION['member_id']);
         $member_info = $member_model->infoMember(array('member_id' => "{$member_id}"));
         if (empty($member_info) || !$member_info['is_buy']) {
             showMessage(Language::get('cart_buy_noallow'), '', 'html', 'error');
         }
         unset($member_id);
         unset($member_info);
         unset($member_model);
     }
 }
开发者ID:my1977,项目名称:shopnc,代码行数:32,代码来源:cart.php

示例7: request_error

 /** 
  * 页面及错误(Exception)
  * 
  * @param Exception $ex 
  * @param mixed $message
  *
  */
 public static function request_error(Exception $ex = null, $message = null)
 {
     $code = 'error';
     if (!is_null($ex)) {
         $message = $ex->getMessage();
         if (false !== stripos($message, 'Unable to find a route to match the URI') || false !== stripos($message, 'not found on this server')) {
             $code = 404;
         }
         // Log the error
         //    if( $GLOBALS['__mogujie']['log_errors'] ){
         //      Kohana::$log->add(Kohana_Log::ERROR, var_export($ex,true) );
         //  }
     }
     if (empty($message)) {
         $message = 'unkown error';
     }
     View::bind_global('message', $message);
     View::bind_global('exception', $ex);
     $msg = $message . '-' . $ex;
     View::bind_global('msg', $msg);
     $uri = request_uri();
     crond_log("uri:{$uri}; code:{$code}; msg:{$msg}; referer:{$_SERVER['HTTP_REFERER']}", 'request_error.log');
     switch ($code) {
         case 404:
             //header("Status: 404 Not Found"); //header("HTTP/1.0 404 Not Found");
             echo Request::factory("error/404")->execute();
             break;
         default:
             echo Request::factory("error/index")->execute();
             break;
     }
     exit;
 }
开发者ID:slumbersoul,项目名称:gnw-weixin,代码行数:40,代码来源:error.php

示例8: check_login

 protected function check_login()
 {
     if (!isset($_SESSION['is_login'])) {
         $ref_url = MICROSHOP_SITE_URL . request_uri();
         header('location: ' . SHOP_SITE_URL . '/index.php?act=login&ref_url=' . getRefUrl());
         die;
     }
 }
开发者ID:bubargaininc,项目名称:oak_oak,代码行数:8,代码来源:control.php

示例9: check_login

 protected function check_login()
 {
     if (!isset($_SESSION['is_login'])) {
         $ref_url = MICROSHOP_SITEURL . request_uri();
         header("location: " . SiteUrl . "/index.php?act=login&ref_url=" . getrefurl());
         exit;
     }
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:8,代码来源:control.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     // Log execution time.
     $start_time = microtime(TRUE);
     // Try to load the files count from cache. This function will accept two
     // arguments:
     // - cache object name (cid)
     // - cache bin, the (optional) cache bin (most often a database table) where
     //   the object is to be saved.
     //
     // cache_get() returns the cached object or FALSE if object does not exist.
     if ($cache = \Drupal::cache()->get('cache_example_files_count')) {
         /*
          * Get cached data. Complex data types will be unserialized automatically.
          */
         $files_count = $cache->data;
     } else {
         // If there was no cached data available we have to search filesystem.
         // Recursively get all files from Drupal's folder.
         $files_count = count(file_scan_directory('.', '/.*/'));
         // Since we have recalculated, we now need to store the new data into
         // cache. Complex data types will be automatically serialized before
         // being saved into cache.
         // Here we use the default setting and create an unexpiring cache item.
         // See below for an example that creates an expiring cache item.
         \Drupal::cache()->set('cache_example_files_count', $files_count, CacheBackendInterface::CACHE_PERMANENT);
     }
     $end_time = microtime(TRUE);
     $duration = $end_time - $start_time;
     // Format intro message.
     $intro_message = '<p>' . t('This example will search the entire drupal folder and display a count of the files in it.') . ' ';
     $intro_message .= t('This can take a while, since there are a lot of files to be searched.') . ' ';
     $intro_message .= t('We will search filesystem just once and save output to the cache. We will use cached data for later requests.') . '</p>';
     $intro_message .= '<p>' . t('<a href="@url">Reload this page</a> to see cache in action.', array('@url' => request_uri())) . ' ';
     $intro_message .= t('You can use the button below to remove cached data.') . '</p>';
     $form['file_search'] = array('#type' => 'fieldset', '#title' => t('File search caching'));
     $form['file_search']['introduction'] = array('#markup' => $intro_message);
     $color = empty($cache) ? 'red' : 'green';
     $retrieval = empty($cache) ? t('calculated by traversing the filesystem') : t('retrieved from cache');
     $form['file_search']['statistics'] = array('#type' => 'item', '#markup' => t('%count files exist in this Drupal installation; @retrieval in @time ms. <br/>(Source: <span style="color:@color;">@source</span>)', array('%count' => $files_count, '@retrieval' => $retrieval, '@time' => number_format($duration * 1000, 2), '@color' => $color, '@source' => empty($cache) ? t('actual file search') : t('cached'))));
     $form['file_search']['remove_file_count'] = array('#type' => 'submit', '#submit' => array(array($this, 'expireFiles')), '#value' => t('Explicitly remove cached file count'));
     $form['expiration_demo'] = array('#type' => 'fieldset', '#title' => t('Cache expiration settings'));
     $form['expiration_demo']['explanation'] = array('#markup' => t('A cache item can be set as CACHE_PERMANENT, meaning that it will only be removed when explicitly cleared, or it can have an expiration time (a Unix timestamp).'));
     $item = \Drupal::cache()->get('cache_example_expiring_item', TRUE);
     if ($item == FALSE) {
         $item_status = t('Cache item does not exist');
     } else {
         $item_status = $item->valid ? t('Cache item exists and is set to expire at %time', array('%time' => $item->data)) : t('Cache_item is invalid');
     }
     $form['expiration_demo']['current_status'] = array('#type' => 'item', '#title' => t('Current status of cache item "cache_example_expiring_item"'), '#markup' => $item_status);
     $form['expiration_demo']['expiration'] = array('#type' => 'select', '#title' => t('Time before cache expiration'), '#options' => array('never_remove' => t('CACHE_PERMANENT'), -10 => t('Immediate expiration'), 10 => t('10 seconds from form submission'), 60 => t('1 minute from form submission'), 300 => t('5 minutes from form submission')), '#default_value' => -10, '#description' => t('Any cache item can be set to only expire when explicitly cleared, or to expire at a given time.'));
     $form['expiration_demo']['create_cache_item'] = array('#type' => 'submit', '#value' => t('Create a cache item with this expiration'), '#submit' => array(array($this, 'createExpiringItem')));
     $form['cache_clearing'] = array('#type' => 'fieldset', '#title' => t('Expire and remove options'), '#description' => t("We have APIs to expire cached items and also to just remove them. Unfortunately, they're all the same API, cache_clear_all"));
     $form['cache_clearing']['cache_clear_type'] = array('#type' => 'radios', '#title' => t('Type of cache clearing to do'), '#options' => array('expire' => t('Remove items from the "cache" bin that have expired'), 'remove_all' => t('Remove all items from the "cache" bin regardless of expiration'), 'remove_tag' => t('Remove all items in the "cache" bin with the tag "cache_example" set to 1')), '#default_value' => 'expire');
     // Submit button to clear cached data.
     $form['cache_clearing']['clear_expired'] = array('#type' => 'submit', '#value' => t('Clear or expire cache'), '#submit' => array(array($this, 'cacheClearing')), '#access' => \Drupal::currentUser()->hasPermission('administer site configuration'));
     return $form;
 }
开发者ID:njcameron,项目名称:ncmd,代码行数:61,代码来源:CacheExampleForm.php

示例11: xssAttackDetected

function xssAttackDetected()
{
    @ob_end_clean();
    while (@ob_end_clean()) {
    }
    @file_put_contents('sites/default/files/debugXSS.log', "========== XSS ATTACK BLOCKED ==========" . "\nURL: " . request_uri() . "\nPOST: " . print_r($_POST, true) . "\n", FILE_APPEND);
    header("HTTP/1.0 403 Forbidden - XSS Detected");
    exit('Exiting - Cross-site-scripting or injection attempt detected.');
}
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:9,代码来源:Security-CrossSiteScripting.php

示例12: bootstrapactency_preprocess_page

/**
 * @file
 * template.php
 */
function bootstrapactency_preprocess_page(&$vars)
{
    /**
     * Special Front page ()
     */
    if (request_uri() === "/") {
        //$vars['theme_hook_suggestions'][] = "page__frontpage";
    }
}
开发者ID:acteg,项目名称:model_bo,代码行数:13,代码来源:template.php

示例13: _get_sections

function _get_sections()
{
    $site = array_slice(split('/', request_uri()), 1);
    if ($site[2] == 'admin') {
        return array($site[1]);
    } else {
        return array_filter($site, create_function('$a', 'return !empty($a);'));
    }
}
开发者ID:upei,项目名称:drupal6-cms,代码行数:9,代码来源:functions.php

示例14: dispatchEmail

 function dispatchEmail($to, $sendermail, $subject, $message, $files = array())
 {
     // Debugging verbosity
     if (strpos($_SERVER['REQUEST_URI'], '-DEBUG-DISPATCHEMAIL-STARTFIN-WATCH-') !== false) {
         dsm("dispatchEmail triggered");
     }
     // State if this message is comming from an REI environment or not
     if (function_exists('version_awareness_environment_isproduction') && version_awareness_environment_isproduction() !== true) {
         $message = '<span style="color: red;">NOTICE: The following message was dispatched from the ' . version_awareness_env() . ' environment.<br/>' . 'This notice will not be prepended when the message comes from the production/staging environment</span>' . '<br/><hr/><br/>' . $message;
     }
     ini_set('sendmail_from', $sendermail);
     // email fields: to, from, subject, and so on
     $from = "BusinessUSA <" . $sendermail . ">";
     $headers = "From: {$sendermail}";
     if (!function_exists('version_awareness_environment_isproduction') || version_awareness_environment_isproduction() === true) {
         if (strpos(request_uri(), '-DEBUG-EMAIL-NOADDITIONALHEADERS-') === false) {
             $headers .= "\r\nReply-To: {$sendermail}";
             $headers .= "\r\nX-Mailer: PHP/" . phpversion();
             $headers .= "\r\nReturn-Path: {$sendermail}";
         }
     }
     // boundary
     $semi_rand = md5(time());
     $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
     // headers for attachment
     $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
     // multipart boundary
     $message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
     // preparing attachments
     for ($i = 0; $i < count($files); $i++) {
         if (is_file($files[$i])) {
             $message .= "--{$mime_boundary}\n";
             $fp = @fopen($files[$i], "rb");
             $data = @fread($fp, filesize($files[$i]));
             @fclose($fp);
             $data = chunk_split(base64_encode($data));
             $message .= "Content-Type: application/octet-stream; name=\"" . basename($files[$i]) . "\"\n" . "Content-Description: " . basename($files[$i]) . "\n" . "Content-Disposition: attachment;\n" . " filename=\"" . basename($files[$i]) . "\"; size=" . filesize($files[$i]) . ";\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
         }
     }
     $message .= "--{$mime_boundary}--";
     if (!function_exists('version_awareness_environment_isproduction') || version_awareness_environment_isproduction() !== true) {
         $returnpath = "-f" . $sendermail;
     }
     // Dispatch email - debugging and verbosity
     $debug['mail-arguments'] = array('to' => $to, 'subject' => $subject, 'message' => $message, 'headers' => $headers, 'returnpath' => $returnpath);
     // Dispatch email - trigger the native PHP function: mail()
     $ok = @mail($to, $subject, $message, $headers, $returnpath);
     $debug['mail-return'] = $ok;
     // Further debug and verbosity
     if (strpos($_SERVER['REQUEST_URI'], '-DEBUG-DISPATCHEMAIL-VERBOSE-') !== false) {
         dsm($debug);
     }
     if (strpos($_SERVER['REQUEST_URI'], '-DEBUG-DISPATCHEMAIL-STARTFIN-WATCH-') !== false) {
         dsm("dispatchEmail will return {$ok}");
     }
     return $debug;
 }
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:57,代码来源:dispatchEmail.php

示例15: track

function track($request_uri = false, $track_agent = false)
{
    global $track_log, $track_db;
    global $track_agent_blacklist;
    if (!($track_log or $track_db)) {
        return true;
    }
    if (!$request_uri) {
        $request_uri = request_uri();
    }
    if (!$request_uri) {
        return false;
    }
    $user_agent = false;
    if ($track_agent or $track_agent_blacklist) {
        $user_agent = user_agent();
        if (!validate_user_agent($user_agent)) {
            $user_agent = false;
        }
        if ($user_agent and $track_agent_blacklist) {
            $reg = '/' . implode('|', $track_agent_blacklist) . '/i';
            if (preg_match($reg, $user_agent)) {
                return true;
            }
        }
    }
    $r = true;
    if ($track_log) {
        require_once 'log.php';
        $logmsg = $request_uri;
        if ($user_agent) {
            $logmsg .= "\t" . $user_agent;
        }
        $r = write_log($track_log === true ? 'track.log' : $track_log, $logmsg);
        if (!$r) {
            return false;
        }
    }
    if ($track_db) {
        $ip_address = client_ip_address();
        if (!validate_ip_address($ip_address)) {
            return false;
        }
        $sqlipaddress = db_sql_arg($ip_address, false);
        $sqlrequesturi = db_sql_arg($request_uri, true);
        $sqluseragent = db_sql_arg($user_agent, true, true);
        $tabtrack = db_prefix_table($track_db === true ? 'track' : $track_db);
        $sql = "INSERT INTO {$tabtrack} (ip_address, request_uri, user_agent) VALUES (INET_ATON({$sqlipaddress}), {$sqlrequesturi}, {$sqluseragent})";
        $r = db_insert($sql);
        if (!$r) {
            return false;
        }
    }
    return true;
}
开发者ID:RazorMarx,项目名称:izend,代码行数:55,代码来源:track.php


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