コード例 #1
0
ファイル: utilities.php プロジェクト: wangshipeng/Php-Online
function getRequestUri($requestUri = null)
{
    if ($requestUri === null) {
        if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
            // check this first so IIS will catch
            $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
        } elseif (isset($_SERVER['IIS_WasUrlRewritten']) && $_SERVER['IIS_WasUrlRewritten'] == '1' && isset($_SERVER['UNENCODED_URL']) && $_SERVER['UNENCODED_URL'] != '') {
            $requestUri = $_SERVER['UNENCODED_URL'];
        } elseif (isset($_SERVER['REQUEST_URI'])) {
            $requestUri = $_SERVER['REQUEST_URI'];
            // Http proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
            $schemeAndHttpHost = getScheme() . '://' . getHttpHost();
            if (strpos($requestUri, $schemeAndHttpHost) === 0) {
                $requestUri = substr($requestUri, strlen($schemeAndHttpHost));
            }
        } elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
            // IIS 5.0, PHP as CGI
            $requestUri = $_SERVER['ORIG_PATH_INFO'];
            if (!empty($_SERVER['QUERY_STRING'])) {
                $requestUri .= '?' . $_SERVER['QUERY_STRING'];
            }
        } else {
            return '';
        }
    } elseif (!is_string($requestUri)) {
        return '';
    } else {
        // Set GET items, if available
        if (false !== ($pos = strpos($requestUri, '?'))) {
            // Get key => value pairs and set $_GET
            $query = substr($requestUri, $pos + 1);
            parse_str($query, $vars);
            $this->setQuery($vars);
        }
    }
    return $requestUri;
}
コード例 #2
0
    //header("HTTP/1.0 500");
    //echo EfrontSystem :: printErrorMessage(_RESOURCEREQUESTEDREQUIRESLOGIN);
    eF_redirect("index.php?message=" . urlencode(_RESOURCEREQUESTEDREQUIRESLOGIN) . "&message_type=failure");
    exit;
}
session_write_close();
//pr($_SERVER);pr($_GET);exit;
try {
    if (isset($_GET['server'])) {
        $url = $_SERVER['REQUEST_URI'];
        if (strpos($url, 'http') !== 0) {
            //Otherwise, depending on the QUERY_STRING, parse_url() may not work
            $url = G_PROTOCOL . '://' . $_SERVER["HTTP_HOST"] . $url;
        }
        $urlParts = parse_url($url);
        $filePath = G_ROOTPATH . 'www/' . str_replace(G_SERVERNAME, '', G_PROTOCOL . '://' . getHttpHost() . $urlParts['path']);
        try {
            $file = new EfrontFile(urldecode($filePath));
        } catch (Exception $e) {
            $file = new EfrontFile($filePath);
        }
    } else {
        $file = new EfrontFile($_GET['file']);
    }
    if (!$bypass_check) {
        if (preg_match("#content/lessons/(\\d+)/#", $file['path'], $matches)) {
            //the file is a content file. Available to any user enrolled to this lesson.
            $result = eF_getTableDataFlat("lessons l, users_to_lessons ul", "id, share_folder", "l.archive=0 and l.id=ul.lessons_ID and ul.archive=0 and ul.users_LOGIN='******'login'] . "'");
            $legalFolders = array_unique(array_merge($result['id'], $result['share_folder']));
            if ($currentUser->user['user_type'] != 'administrator' && $matches[1] && !in_array($matches[1], $legalFolders)) {
                // fix due to ticket #5594
コード例 #3
0
ファイル: tpl_footer.php プロジェクト: wwxgitcat/zencart_v1.0
echo date('Y');
?>
 
				<a href="<?php 
echo zhlink();
?>
" title="<?php 
echo STORE_NAME;
?>
"><?php 
echo STORE_NAME;
?>
</a>&nbsp;Powered by &nbsp;
				<a href="<?php 
echo zhlink();
?>
" title="<?php 
echo STORE_NAME;
?>
"><?php 
echo getHttpHost();
?>
</a>
			</div>
		</div>

<div style="display:none;">
<script language="javascript" type="text/javascript" src="http://js.users.51.la/18729800.js"></script>
<noscript><a href="http://www.51.la/?18729800" target="_blank"><img alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1;" src="http://img.users.51.la/18729800.asp" style="border:none" /></a></noscript>
</div>
コード例 #4
0
/**
 * Setup constants
 *
 * This function serves only as a convenient bundle for
 * all the required defines that must be made during initialization
 *
 * @since 3.6.0
 */
function setDefines()
{
    isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? $protocol = 'https' : ($protocol = 'http');
    /** The protocol currently used*/
    define("G_PROTOCOL", $protocol);
    if (G_VERSIONTYPE == 'enterprise') {
        #cpp#ifdef ENTERPRISE
        /** The server name*/
        $request_uri = $_SERVER['REQUEST_URI'];
        if (!is_file(dirname(G_ROOTPATH) . $request_uri) && basename($_SERVER['PHP_SELF']) != basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) && strpos($request_uri, 'content/lessons') === false) {
            $request_uri .= basename($_SERVER['PHP_SELF']);
        }
        if (!is_file(dirname(G_ROOTPATH) . $request_uri) && dirname($request_uri) != dirname($_SERVER['PHP_SELF']) && strpos($request_uri, 'content/lessons') === false && strpos($request_uri, 'editor/tiny_mce') === false) {
            define("G_BRANCH_URL", basename(dirname($request_uri)) . '/');
        } elseif (strpos($request_uri, 'content/lessons') !== false && strpos($request_uri, 'editor') === false) {
            preg_match("#^" . G_OFFSET . "(.*)content/lessons/#", $_SERVER['REQUEST_URI'], $matches);
            define("G_BRANCH_URL", $matches[1]);
        } elseif (isset($_SESSION['s_current_branch']) && strpos($request_uri, 'editor/tiny_mce') !== false) {
            preg_match("#^" . G_OFFSET . "(.*)editor/tiny_mce#", $_SERVER['REQUEST_URI'], $matches);
            define("G_BRANCH_URL", $matches[1]);
        } else {
            define("G_BRANCH_URL", '');
            //unset($_SESSION['s_theme']);
            if (!empty($_SESSION['s_current_branch'])) {
                unset($_SESSION['s_current_branch']);
                unset($_SESSION['s_theme']);
            }
        }
        if (basename($_SERVER['PHP_SELF']) == 'index.php' && basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) != basename($_SERVER['PHP_SELF']) && mb_substr(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), -1) != '/') {
            header("location:" . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) . '/index.php');
        }
        if (defined('G_OFFSET')) {
            //$_SERVER['PHP_SELF'] = G_OFFSET.G_BRANCH_URL.str_replace(G_OFFSET, '', $_SERVER['PHP_SELF']);
            $_SERVER['PHP_SELF'] = G_OFFSET . G_BRANCH_URL . preg_replace('#^' . G_OFFSET . '#', '', $_SERVER['PHP_SELF']);
        }
        define('G_SERVERNAME', $protocol . '://' . getHttpHost() . G_OFFSET . G_BRANCH_URL);
    } else {
        #cpp#else
        define('G_SERVERNAME', $protocol . '://' . getHttpHost() . G_OFFSET);
    }
    #cpp#endif
    //var_dump($_SERVER);exit;
    /*Define default encoding to be utf-8*/
    mb_internal_encoding('utf-8');
    /** The full filesystem path of the lessons directory*/
    define("G_LESSONSPATH", G_ROOTPATH . "www/content/lessons/");
    is_dir(G_LESSONSPATH) or mkdir(G_LESSONSPATH, 0755);
    /** The full URL to the folder containing the lessons*/
    define("G_LESSONSLINK", G_SERVERNAME . "content/lessons/");
    /** The relative path (URL) to the lessons folder*/
    define("G_RELATIVELESSONSLINK", "content/lessons/");
    /** The backup directory, must be outside the server root for security reasons, and must have proper permissions*/
    define("G_BACKUPPATH", G_ROOTPATH . "backups/");
    is_dir(G_BACKUPPATH) or mkdir(G_BACKUPPATH, 0755);
    /** The users upload directory*/
    define("G_UPLOADPATH", G_ROOTPATH . "upload/");
    is_dir(G_UPLOADPATH) or mkdir(G_UPLOADPATH, 0755);
    /** The modules path */
    define("G_MODULESPATH", G_ROOTPATH . "www/modules/");
    is_dir(G_MODULESPATH) or mkdir(G_MODULESPATH, 0755);
    /** The modules url */
    define("G_MODULESURL", G_SERVERNAME . "modules/");
    //If G_DBPREFIX is not defined, it should be set to the empty string
    defined('G_DBPREFIX') or define('G_DBPREFIX', "");
    /**The salt used for password hashing*/
    define("G_MD5KEY", 'cDWQR#$Rcxsc');
    /** The themes path*/
    define("G_THEMESPATH", G_ROOTPATH . "www/themes/");
    if (G_VERSIONTYPE != 'community') {
        #cpp#ifndef COMMUNITY
        /** The license server for commercial editions */
        define("LICENSE_SERVER", "http://keys.efrontlearning.net/list.php");
        define("CERTIFICATES_MAIN_TEMPLATE_NAME", "Minimum Decoration (Unicode)");
        define("CERTIFICATES_MAIN_TEMPLATES_COUNT", "8");
    }
    #cpp#endif
    /** @deprecated The relative path (URL) to the content folder*/
    define("G_RELATIVECONTENTLINK", "content/");
    /** @deprecated The relative path (URL) to the admin folder*/
    define("G_RELATIVEADMINLINK", G_SERVERNAME . "content/admin/");
    /** @deprecated The full filesystem path of the admin directory*/
    define("G_ADMINPATH", G_ROOTPATH . "www/content/admin/");
    is_dir(G_ADMINPATH) || mkdir(G_ADMINPATH, 0755);
    /** @deprecated The full filesystem path of the content directory*/
    define("G_CONTENTPATH", G_ROOTPATH . "www/content/");
    /** @deprecated The directory where scorm files are uploaded*/
    define("G_SCORMPATH", G_LESSONSPATH . "scorm_uploaded_files/");
    /** @deprecated The course certificate template paths*/
    define("G_CERTIFICATETEMPLATEPATH", G_ROOTPATH . "www/certificate_templates/");
    /** @deprecated */
    define("_CHATROOMDOESNOTEXIST_ERROR", "-2");
    /** @deprecated */
    define("_CHATROOMISNOTENABLED_ERROR", "-3");
    /** @deprecated Maximum file size (in bytes). Attention! it must be: memory_limit > post_max_size > upload_max_filesize > G_MAXFILESIZE*/
    define("G_MAXFILESIZE", 3000000);
    /** @deprecated Maximum number of messages held in the system **/
    define("G_QUOTA_NUM_OF_MESSAGES", 2000);
    /** @deprecated Maximum quota of messages in KB: 100MB **/
    define("G_QUOTA_KB", 102400);
    /** @deprecated*/
    define("G_DEFAULT_TABLE_SIZE", "20");
    //Default table size for sorted table
    define("G_TINYMCE", "Tinymce 3.4.2");
    define("G_NEWTINYMCE", "Tinymce 3.5.8");
}
コード例 #5
0
 protected function createEventContent($event, $cancel = false)
 {
     if ($cancel) {
         $method = "CANCEL";
         $status = "CANCELLED";
     } else {
         $method = "REQUEST";
         $status = "CONFIRMED";
     }
     //$description = str_replace("\n","\\n",str_replace(";","\;",str_replace(",",'\,',$event['description']))) . "\n";
     $end_timestamp = $event['start_date'] + $event['duration'] * 60;
     $created_date = new DateTime('@' . time());
     $start_date = new DateTime('@' . $event['start_date']);
     $end_date = new DateTime('@' . $end_timestamp);
     $created_date->setTimezone(new DateTimeZone('utc'));
     $start_date->setTimezone(new DateTimeZone('utc'));
     $end_date->setTimezone(new DateTimeZone('utc'));
     //$uid = $created_date->format('Ymd\THis\Z').'-'.$event['course_id'].'@'.G_SERVERNAME;
     $uid = 'c' . $event['course_id'] . '@' . str_replace('www.', '', getHttpHost() . G_OFFSET);
     //Based on RFC 5545, http://tools.ietf.org/html/rfc5545
     $components[] = "BEGIN:VCALENDAR";
     $components[] = "PRODID:-//" . G_SERVERNAME . "//eFront " . G_VERSION_NUM . "//EN";
     $components[] = "VERSION:2.0";
     $components[] = "METHOD:{$method}";
     //optional
     $components[] = "BEGIN:VEVENT";
     $components[] = "UID:{$uid}";
     $components[] = "CREATED:{$created_date->format('Ymd\\THis\\Z')}";
     $components[] = "DTSTAMP:{$start_date->format('Ymd\\THis\\Z')}";
     $components[] = "DTSTART:{$start_date->format('Ymd\\THis\\Z')}";
     $components[] = "DTEND:{$end_date->format('Ymd\\THis\\Z')}";
     $components[] = "DESCRIPTION:{$event['description']}";
     //WARNING: exchange server will use the mail body for the calendar body, whereas direct clients will use the $event['description']
     $components[] = "SUMMARY:{$event['subject']}";
     $components[] = "LOCATION:{$event['location']}";
     $components[] = "ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN={$event['email']};RSVP=TRUE:mailto:{$event['email']}";
     $components[] = "LAST-MODIFIED:{$start_date->format('Ymd\\THis\\Z')}";
     $components[] = "PRIORITY:5";
     $components[] = "SEQUENCE:{$event['sequence']}";
     $components[] = "STATUS:{$status}";
     $components[] = "TRANSP:TRANSPARENT";
     $components[] = "END:VEVENT";
     $components[] = "END:VCALENDAR";
     //pr($components);exit;
     $message = implode("\r\n", $components);
     return $message;
 }