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

PHP ocp_srv函数代码示例

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

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



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

示例1: _a_tag_link_fixup

/**
 * Used by semihtml_to_comcode to fix <a> tag links. preg_replace_callback callback
 *
 * @param  array			Array of matches
 * @return string			Substituted text
 */
function _a_tag_link_fixup($matches)
{
    $referer = post_param('http_referer', ocp_srv('HTTP_REFERER'));
    $caller_url = looks_like_url($referer) ? preg_replace('#/[^/]*$#', '', $referer) : get_base_url();
    $ret = '<a ' . $matches[1] . 'href="' . qualify_url($matches[2], $caller_url) . '"' . $matches[3] . '>';
    return $ret;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:comcode_from_html.php


示例2: run

 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     if (get_option('is_on_rating') == '0') {
         return do_lang_tempcode('INTERNAL_ERROR');
     }
     // Has there actually been any rating?
     if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST' || ocp_srv('HTTP_REFERER') == '') {
         $rating = either_param_integer('rating', NULL);
     } else {
         $rating = post_param_integer('rating');
         // Will fail
     }
     $content_type = get_param('content_type');
     $type = get_param('type', '');
     $content_id = get_param('id');
     $content_url = get_param('content_url', '', true);
     $content_title = get_param('content_title', '', true);
     require_code('feedback');
     actualise_specific_rating($rating, get_page_name(), get_member(), $content_type, $type, $content_id, $content_url, $content_title);
     actualise_give_rating_points();
     $template = get_param('template', NULL);
     if ($template !== '') {
         if (is_null($template)) {
             $template = 'RATING_BOX';
         }
         return display_rating($content_url, $content_title, $content_type, $content_id, $template);
     }
     return do_lang_tempcode('THANKYOU_FOR_RATING_SHORT');
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:rating.php


示例3: render_tab

 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('EDIT_EM');
     require_lang('ocf');
     require_css('ocf');
     $order = 200;
     if ($leave_to_ajax_if_possible && strtoupper(ocp_srv('REQUEST_METHOD')) != 'POST') {
         return array($title, NULL, $order);
     }
     $tabs = array();
     $hooks = find_all_hooks('systems', 'profiles_tabs_edit');
     if (isset($hooks['settings'])) {
         $hooks = array('settings' => $hooks['settings']) + $hooks;
     }
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/systems/profiles_tabs_edit/' . $hook);
         $ob = object_factory('Hook_Profiles_Tabs_Edit_' . $hook);
         if ($ob->is_active($member_id_of, $member_id_viewing)) {
             $tabs[] = $ob->render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible);
         }
     }
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     global $M_SORT_KEY;
     $M_SORT_KEY = 4;
     usort($tabs, 'multi_sort');
     $javascript = '';
     $hidden = new ocp_tempcode();
     // Session ID check, if saving
     if (count($_POST) != 0 && count($tabs) != 0) {
         global $SESSION_CONFIRMED;
         if ($SESSION_CONFIRMED == 0) {
             access_denied('SESSION', '', true);
         }
     }
     $_tabs = array();
     $first = true;
     foreach ($tabs as $i => $tab) {
         if (is_null($tab)) {
             continue;
         }
         $javascript .= $tab[3];
         if (isset($tab[5])) {
             $hidden->attach($tab[5]);
         }
         $_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_FIELDS' => $tab[1], 'TAB_TEXT' => $tab[2], 'TAB_FIRST' => $first, 'TAB_LAST' => !array_key_exists($i + 1, $tabs));
         $first = false;
     }
     $url = build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, false);
     $content = do_template('OCF_MEMBER_PROFILE_EDIT', array('JAVASCRIPT' => $javascript, 'HIDDEN' => $hidden, 'URL' => $url, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'), 'AUTOCOMPLETE' => false, 'SKIP_VALIDATION' => true, 'TABS' => $_tabs));
     return array($title, $content, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:61,代码来源:edit.php


示例4: internalise_own_screen

/**
 * Put the contents of a page inside an iframe. This is typically used when a page is being used to traverse a result-set that spans multiple screens.
 *
 * @param  tempcode		The title
 * @param  ?integer		The time between refreshes (NULL: do not refresh)
 * @param  ?mixed			Data. A refresh will only happen if an AJAX-check indicates this data has changed (NULL: no check)
 * @return ?tempcode		The page output to finish off our current page stream such that it will spawn the iframe (NULL: not internalised)
 */
function internalise_own_screen($title, $refresh_time = NULL, $refresh_if_changed = NULL)
{
    if (get_value('no_frames') === '1' || get_param_integer('no_frames', 0) == 1 || get_param_integer('keep_no_frames', 0) == 1) {
        return NULL;
    }
    if (!has_js()) {
        return NULL;
    }
    // We need JS to make this a seamless process
    if (strpos(ocp_srv('REQUEST_URI'), '/iframe.php') !== false) {
        return NULL;
    }
    // This is already in the iframe
    require_javascript('javascript_ajax');
    require_javascript('javascript_iframe_screen');
    $url = find_script('iframe') . '?zone=' . rawurlencode(get_zone_name()) . '&wide_high=1&utheme=' . rawurlencode($GLOBALS['FORUM_DRIVER']->get_theme());
    foreach (array_merge($_GET, $_POST) as $key => $param) {
        if (!is_string($param)) {
            continue;
        }
        if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
            continue;
        }
        if (get_magic_quotes_gpc()) {
            $param = stripslashes($param);
        }
        $url .= '&' . $key . '=' . urlencode($param);
    }
    if (!is_null($refresh_if_changed)) {
        require_javascript('javascript_sound');
        $change_detection_url = find_script('change_detection') . '?whatever=1';
        foreach ($_GET as $key => $param) {
            if (!is_string($param)) {
                continue;
            }
            if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
                continue;
            }
            if (get_magic_quotes_gpc()) {
                $param = stripslashes($param);
            }
            $change_detection_url .= '&' . $key . '=' . urlencode($param);
        }
    } else {
        $refresh_if_changed = '';
        $change_detection_url = '';
    }
    return do_template('IFRAME_SCREEN', array('_GUID' => '06554eb227428fd5c648dee3c5b38185', 'TITLE' => $title, 'REFRESH_IF_CHANGED' => md5(serialize($refresh_if_changed)), 'CHANGE_DETECTION_URL' => $change_detection_url, 'REFRESH_TIME' => is_null($refresh_time) ? '' : strval($refresh_time), 'IFRAME_URL' => $url));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:57,代码来源:templates_internalise_screen.php


示例5: install

 /**
  * Standard modular install function.
  *
  * @param  ?integer	What version we're upgrading from (NULL: new install)
  * @param  ?integer	What hack version we're upgrading from (NULL: new-install/not-upgrading-from-a-hacked-version)
  */
 function install($upgrade_from = NULL, $upgrade_from_hack = NULL)
 {
     if ($upgrade_from < 3 || is_null($upgrade_from)) {
         add_config_option('LDAP_IS_ENABLED', 'ldap_is_enabled', 'tick', 'return \'' . (in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '0') . '\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_IS_WINDOWS', 'ldap_is_windows', 'tick', 'return (DIRECTORY_SEPARATOR==\'/\')?\'0\':\'1\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_ALLOW_JOINING', 'ldap_allow_joining', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_HOSTNAME', 'ldap_hostname', 'line', 'return \'localhost\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_BASE_DN', 'ldap_base_dn', 'line', 'return \'' . 'dc=' . str_replace('.', ',dc=', ocp_srv('HTTP_HOST')) . '\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('USERNAME', 'ldap_bind_rdn', 'line', 'return (DIRECTORY_SEPARATOR==\'/\')?\'NotManager\':\'NotAdministrator\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('PASSWORD', 'ldap_bind_password', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP', 1);
     }
     if ($upgrade_from < 4 || is_null($upgrade_from)) {
         add_config_option('WINDOWS_AUTHENTICATION', 'windows_auth_is_enabled', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_LOGIN_QUALIFIER', 'ldap_login_qualifier', 'line', 'return is_null($old=get_value(\'ldap_login_qualifier\'))?\'\':$old;', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_GROUP_SEARCH_QUALIFIER', 'ldap_group_search_qualifier', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_SEARCH_QUALIFIER', 'ldap_member_search_qualifier', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_PROPERTY', 'ldap_member_property', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'sAMAccountName\':\'cn\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_NONE_BIND_LOGINS', 'ldap_none_bind_logins', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_VERSION', 'ldap_version', 'integer', 'return \'3\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_GROUP_CLASS', 'ldap_group_class', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'group\':\'posixGroup\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_CLASS', 'ldap_member_class', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'user\':\'posixAccount\';', 'SECTION_FORUMS', 'LDAP');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:admin_ocf_ldap.php


示例6: render_tab

 /**
  * Standard modular render function for profile tabs edit hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return ?array			A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     require_lang('notifications');
     $title = do_lang_tempcode('NOTIFICATIONS');
     $order = 100;
     if (strtoupper(ocp_srv('REQUEST_METHOD')) == 'POST') {
         $auto_monitor_contrib_content = post_param_integer('auto_monitor_contrib_content', 0);
         $GLOBALS['FORUM_DB']->query_update('f_members', array('m_auto_monitor_contrib_content' => $auto_monitor_contrib_content), array('id' => $member_id_of), '', 1);
         // Decache from run-time cache
         unset($GLOBALS['FORUM_DRIVER']->MEMBER_ROWS_CACHED[$member_id_of]);
         unset($GLOBALS['MEMBER_CACHE_FIELD_MAPPINGS'][$member_id_of]);
     }
     if ($leave_to_ajax_if_possible && strtoupper(ocp_srv('REQUEST_METHOD')) != 'POST') {
         return NULL;
     }
     require_code('notifications2');
     $text = notifications_ui($member_id_of);
     if ($text->is_empty()) {
         return NULL;
     }
     $javascript = '';
     return array($title, new ocp_tempcode(), $text, $javascript, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:notifications.php


示例7: critical_error

    /**
     * Exit with a nicely formatted critical error.
     *
     * @param  string			The error message code
     * @param  ?string		Relayed additional details (NULL: nothing relayed)
     * @param  boolean		Whether to actually exit
     */
    function critical_error($code, $relay = NULL, $exit = true)
    {
        error_reporting(0);
        if (!headers_sent()) {
            if (function_exists('browser_matches') && (is_null($relay) || strpos($relay, 'Allowed memory') === false)) {
                if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) {
                    header('HTTP/1.0 500 Internal server error');
                }
            }
        }
        $error = 'Unknown critical error type: this should not happen, so please report this to ocProducts.';
        switch ($code) {
            case 'MISSING_SOURCE':
                $error = 'A source-code (' . $relay . ') file is missing.';
                break;
            case 'PASSON':
                $error = $relay;
                break;
            case 'MEMBER_BANNED':
                $error = 'The member you are masquerading as has been banned. We cannot finish initialising the virtualised environment for this reason.';
                break;
            case 'BANNED':
                $error = 'The IP address you are accessing this website from (' . get_ip_address() . ') has been banished from this website. If you believe this is a mistake, contact the staff to have it resolved (typically, postmaster@' . get_domain() . ' will be able to reach them).</div>' . chr(10) . '<div>If you are yourself staff, you should be able to unban yourself by editing the <kbd>usersubmitban_ip</kbd> table in a database administation tool, by removing rows that qualify against yourself. This error is raised to a critical error to reduce the chance of this IP address being able to further consume server resources.';
                break;
                /*		case 'PHP':
                				$error='<p>This is a PHP error.</div>'.chr(10).'<div style="padding-left: 50px">'.$relay;
                				break;
                	*/
            /*		case 'PHP':
            				$error='<p>This is a PHP error.</div>'.chr(10).'<div style="padding-left: 50px">'.$relay;
            				break;
            	*/
            case 'TEST':
                $error = 'This is a test error.';
                break;
            case 'BUSY':
                $error = 'This is a less-critical error that has been elevated for quick dismissal due to high server load.</div>' . chr(10) . '<div style="padding-left: 50px">' . $relay;
                break;
            case 'EMERGENCY':
                $error = 'This is an error that has been elevated to critical error status because it occurred during the primary error mechanism reporting system itself (possibly due to it occuring within the standard output framework). It may be masking a secondary error that occurred before this, but was never output - if so, it is likely strongly related to this one, thus fixing this will fix the other.</div>' . chr(10) . '<div style="padding-left: 50px">' . $relay;
                break;
            case 'RELAY':
                $error = 'This is a relayed critical error, which means that this less-critical error has occurred during startup, and thus halted startup.</div>' . chr(10) . '<div style="padding-left: 50px">' . $relay;
                break;
            case 'FILE_DOS':
                $error = 'This website was prompted to download a file (' . htmlentities($relay) . ') which seemingly has a never-ending chain of redirections. Because this could be a denial of service attack, execution has been terminated.';
                break;
            case 'DATABASE_FAIL':
                $error = 'The website\'s first database query (checking the page request is not from a banned IP address) has failed. This almost always means that the database is not set up correctly, which in turns means that either backend database configuration has changed (perhaps the database has been emptied), or the configuration file (info.php) has been incorrectly altered (perhaps to point to an empty database), or you have moved servers and not updated your info.php settings properly or placed your database. It could also mean that the <kbd>' . get_table_prefix() . 'usersubmitban_ip</kbd> table or <kbd>' . get_table_prefix() . 'config</kbd> table alone is missing or corrupt, but this is unlikely. As this is an error due to the website\'s environment being externally altered by unknown means, the website cannot continue to function or solve the problem itself.';
                break;
            case 'INFO.PHP':
                $install_url = 'install.php';
                if (!file_exists($install_url)) {
                    $install_url = '../install.php';
                }
                if (file_exists($install_url)) {
                    $likely = 'ocPortal files have been placed, yet installation not completed. To install ocPortal, <a href="' . $install_url . '">run the installer</a>.';
                } else {
                    $likely = 'ocPortal files have been placed by direct copying from a non-standard source that included neither a configuration file nor installation script, or info.php has become corrupt after installation. The installer (install.php) is not present: it is advised that you replace info.php from backup, or if you have not yet installed, use an official ocProducts installation package.';
                }
                $error = 'The top-level configuration file (info.php) is either not-present or empty. This file is created upon installation, and the likely cause of this error is that ' . $likely;
                break;
            case 'INFO.PHP_CORRUPTED':
                $error = 'The top-level configuration file (info.php) appears to be corrupt. Perhaps it was incorrectly uploaded, or a typo was made. It must be valid PHP code.';
                break;
            case 'CRIT_LANG':
                $error = 'The most basic critical error language file (lang/' . fallback_lang() . '/critical_error.ini) is missing. It is likely that other files are also, for whatever reason, missing from this ocPortal installation.';
                break;
        }
        $edit_url = 'config_editor.php';
        if (!file_exists($edit_url)) {
            $edit_url = '../' . $edit_url;
        }
        if (isset($GLOBALS['SITE_INFO']['base_url'])) {
            $edit_url = $GLOBALS['SITE_INFO']['base_url'] . '/config_editor.php';
        }
        $extra = '';
        if (function_exists('debug_backtrace') && strpos($error, 'Allowed memory') === false && (is_null($relay) || strpos($relay, 'Stack trace') === false) && function_exists('ocp_srv') && (ocp_srv('REMOTE_ADDR') == ocp_srv('SERVER_ADDR') && ocp_srv('HTTP_X_FORWARDED_FOR') == '' || preg_match('#^localhost(\\.|\\:|$)#', ocp_srv('HTTP_HOST')) != 0 && function_exists('get_base_url') && substr(get_base_url(), 0, 16) == 'http://localhost')) {
            $_trace = debug_backtrace();
            $extra = '<div class="medborder medborder_box"><h2>Stack trace&hellip;</h2>';
            foreach ($_trace as $stage) {
                $traces = '';
                foreach ($stage as $key => $value) {
                    if (is_object($value) && is_a($value, 'ocp_tempcode') || is_array($value) && strlen(serialize($value)) > 500) {
                        $_value = gettype($value);
                    } else {
                        if (strpos($error, 'Allowed memory') !== false) {
                            $_value = gettype($value);
                            switch ($_value) {
                                case 'integer':
                                    $_value = strval($value);
                                    break;
                                case 'string':
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:critical_errors.php


示例8: test_htaccess

/**
 * Try and get a good .htaccess file built.
 * @param  resource		FTP connection to server
 */
function test_htaccess($conn)
{
    $clauses = array();
    $clauses[] = <<<END
# Disable inaccurate security scanning (ocPortal has it's own)
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
END;
    $php_value_ok = substr(ocp_srv('SERVER_SOFTWARE'), 0, 10) != 'LightSpeed';
    if ($php_value_ok) {
        $clauses[] = <<<END
# ocPortal needs uploads; many hosts leave these low
php_value post_max_size "16M"
php_value upload_max_filesize "16M"
END;
    }
    if ($php_value_ok) {
        $clauses[] = <<<END
# Turn insecure things off
php_flag allow_url_fopen off
END;
    }
    if ($php_value_ok) {
        $clauses[] = <<<END
php_flag register_globals off
END;
    }
    if ($php_value_ok) {
        $clauses[] = <<<END
php_value max_input_vars "2000"
php_value mbstring.func_overload "0"
# Suhosin can cause problems on configuration and Catalogue forms, which use a lot of fields
php_value suhosin.post.max_vars "2000"
php_value suhosin.request.max_vars "2000"
php_value suhosin.cookie.max_vars "400"
php_value suhosin.cookie.max_name_length "150"
php_value suhosin.post.max_value_length "100000000"
php_value suhosin.request.max_value_length "100000000"
php_value suhosin.post.max_totalname_length "10000"
php_value suhosin.request.max_totalname_length "10000"
php_flag suhosin.cookie.encrypt off
php_flag suhosin.sql.union off
END;
    }
    if ($php_value_ok) {
        $clauses[] = <<<END
# Put some limits up. ocPortal is stable enough not to cause problems- it'll only use higher limits when it really needs them
php_value memory_limit "128M"
END;
    }
    if ($php_value_ok) {
        $clauses[] = <<<END
php_value max_input_time "60"
END;
    }
    /*// NB: This'll only work in PHP6+   Bad idea, will miss temp directory
    $file_base=$GLOBALS['FILE_BASE'];
    $clauses[]=<<<END
    # Sandbox ocPortal to it's own directory
    php_value open_basedir "{$file_base}"
    END;
    */
    $clauses[] = <<<END
Options +FollowSymLinks
END;
    $clauses[] = <<<END
RewriteEngine on

# Redirect away from modules called directly by URL. Helpful as it allows you to "run" a module file in a debugger and still see it running.
RewriteRule ^([^=]*)webdav.php/([^=]*)pages/(modules|modules\\_custom)/([^/]*)\\.php\$ - [L]
RewriteRule ^([^=]*)pages/(modules|modules\\_custom)/([^/]*)\\.php\$ \$1index.php\\?page=\$3 [L,QSA,R]

# These have a specially reduced form (no need to make it too explicit that these are CEDI)
#  We shouldn't shorten them too much, or the actual zone or base url might conflict
RewriteRule ^([^=]*)pg/s/([^\\&\\?]*)/index\\.php\$ \$1index.php\\?page=cedi&id=\$2 [L,QSA]

# These have a specially reduce form (wide is implied)
RewriteRule ^([^=]*)pg/galleries/image/([^\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=galleries&type=image&id=\$2&wide=1\$3 [L,QSA]
RewriteRule ^([^=]*)pg/galleries/video/([^\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=galleries&type=video&id=\$2&wide=1\$3 [L,QSA]
RewriteRule ^([^=]*)pg/iotds/view/([^\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=iotds&type=view&id=\$2&wide=1\$3 [L,QSA]

# These are standard patterns
RewriteRule ^([^=]*)pg/([^/\\&\\?]*)/([^/\\&\\?]*)/([^\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=\$2&type=\$3&id=\$4\$5 [L,QSA]
RewriteRule ^([^=]*)pg/([^/\\&\\?]*)/([^/\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=\$2&type=\$3\$4 [L,QSA]
RewriteRule ^([^=]*)pg/([^/\\&\\?]*)/index\\.php(.*)\$ \$1index.php\\?page=\$2\$3 [L,QSA]
# This one is weird... apache strips out // and turns to /, thus requiring an extra pattern...
RewriteRule ^([^=]*)pg/index\\.php(.*)\$ \$1index.php\\?page=\$3 [L,QSA]

# Now the same, but without any additional parameters (and thus no index.php)
RewriteRule ^([^=]*)pg/s/([^\\&\\?]*)\$ \$1index.php\\?page=cedi&id=\$2 [L,QSA]
RewriteRule ^([^=]*)pg/galleries/image/([^\\&\\?]*)\$ \$1index.php\\?page=galleries&type=image&id=\$2&wide=1\$3 [L,QSA]
RewriteRule ^([^=]*)pg/galleries/video/([^\\&\\?]*)\$ \$1index.php\\?page=galleries&type=video&id=\$2&wide=1\$3 [L,QSA]
RewriteRule ^([^=]*)pg/iotds/view/([^\\&\\?]*)\$ \$1index.php\\?page=iotds&type=view&id=\$2&wide=1 [L,QSA]
RewriteRule ^([^=]*)pg/([^/\\&\\?]*)/([^/\\&\\?]*)/([^\\&\\?]*)/\$ \$1index.php\\?page=\$2&type=\$3&id=\$4 [L,QSA]
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:install.php


示例9: attachments_script

/**
 * Show the image of an attachment/thumbnail.
 */
function attachments_script()
{
    // Closed site
    $site_closed = get_option('site_closed');
    if ($site_closed == '1' && !has_specific_permission(get_member(), 'access_closed_site') && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
        header('Content-Type: text/plain');
        @exit(get_option('closed'));
    }
    $id = get_param_integer('id', 0);
    $connection = $GLOBALS[get_param_integer('forum_db', 0) == 1 ? 'FORUM_DB' : 'SITE_DB'];
    $has_no_restricts = !is_null($connection->query_value_null_ok('attachment_refs', 'id', array('r_referer_type' => 'null', 'a_id' => $id)));
    if (!$has_no_restricts) {
        global $SITE_INFO;
        if (!is_guest() || !isset($SITE_INFO['any_guest_cached_too']) || $SITE_INFO['any_guest_cached_too'] == '0') {
            if (get_param('for_session', '-1') != md5(strval(get_session_id())) && get_option('anti_leech') == '1' && ocp_srv('HTTP_REFERER') != '') {
                warn_exit(do_lang_tempcode('LEECH_BLOCK'));
            }
        }
    }
    require_lang('comcode');
    // Lookup
    $rows = $connection->query_select('attachments', array('*'), array('id' => $id), 'ORDER BY a_add_time DESC');
    if (!array_key_exists(0, $rows)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    $myrow = $rows[0];
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $myrow['a_add_time']));
    if ($myrow['a_url'] == '') {
        warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    if (!$has_no_restricts) {
        // Permission
        if (substr($myrow['a_url'], 0, 20) == 'uploads/attachments/') {
            if (!has_attachment_access(get_member(), $id, $connection)) {
                access_denied('ATTACHMENT_ACCESS');
            }
        }
    }
    $thumb = get_param_integer('thumb', 0);
    if ($thumb == 1) {
        $full = $myrow['a_thumb_url'];
        require_code('images');
        $myrow['a_thumb_url'] = ensure_thumbnail($myrow['a_url'], $myrow['a_thumb_url'], 'attachments', 'attachments', intval($myrow['id']), 'a_thumb_url');
    } else {
        $full = $myrow['a_url'];
        if (get_param_integer('no_count', 0) == 0) {
            // Update download count
            if (ocp_srv('HTTP_RANGE') == '') {
                $connection->query_update('attachments', array('a_num_downloads' => $myrow['a_num_downloads'] + 1, 'a_last_downloaded_time' => time()), array('id' => $id), '', 1, NULL, false, true);
            }
        }
    }
    // Is it non-local? If so, redirect
    if (!url_is_local($full)) {
        if (strpos($full, chr(10)) !== false || strpos($full, chr(13)) !== false) {
            log_hack_attack_and_exit('HEADER_SPLIT_HACK');
        }
        header('Location: ' . $full);
        return;
    }
    //	$breakdown=pathinfo($full);
    //	$filename=$breakdown['basename'];
    $_full = get_custom_file_base() . '/' . rawurldecode($full);
    if (!file_exists($_full)) {
        warn_exit(do_lang_tempcode('_MISSING_RESOURCE', 'url:' . escape_html($full)));
    }
    // File is missing, we can't do anything
    $size = filesize($_full);
    $original_filename = $myrow['a_original_filename'];
    $extension = get_file_extension($original_filename);
    require_code('files2');
    check_shared_bandwidth_usage($size);
    require_code('mime_types');
    $mime_type = get_mime_type($extension);
    /*$myfile2=fopen('test','wb');
    	fwrite($myfile2,var_export($_SERVER,true));
    	fwrite($myfile2,var_export($_ENV,true));
    	fclose($myfile2);*/
    // Send header
    if (strpos($original_filename, chr(10)) !== false || strpos($original_filename, chr(13)) !== false) {
        log_hack_attack_and_exit('HEADER_SPLIT_HACK');
    }
    header('Content-Type: ' . $mime_type . '; authoritative=true;');
    if (strstr(ocp_srv('HTTP_USER_AGENT'), 'MSIE') !== false) {
        header('Content-Disposition: filename="' . $original_filename . '"');
    } else {
        header('Content-Disposition: inline; filename="' . $original_filename . '"');
    }
    header('Accept-Ranges: bytes');
    // Caching
    header("Pragma: private");
    header("Cache-Control: private");
    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24 * 365) . ' GMT');
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $myrow['a_add_time']) . ' GMT');
    // Default to no resume
    $from = 0;
    $new_length = $size;
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:attachments.php


示例10: export_po

    /**
     * The actualiser to create a .po TAR.
     *
     * @return tempcode		The UI
     */
    function export_po()
    {
        $lang = filter_naughty(get_param('id'));
        // Send header
        header('Content-Type: application/octet-stream' . '; authoritative=true;');
        if (strstr(ocp_srv('HTTP_USER_AGENT'), 'MSIE') !== false) {
            header('Content-Disposition: filename="ocportal-' . $lang . '.tar"');
        } else {
            header('Content-Disposition: attachment; filename="ocportal-' . $lang . '.tar"');
        }
        require_code('tar');
        require_code('lang_compile');
        require_code('character_sets');
        $tempfile = ocp_tempnam('po');
        $tar = tar_open($tempfile, 'wb');
        $dh = @opendir(get_custom_file_base() . '/lang_custom/' . $lang);
        if ($dh !== false) {
            $charset = do_lang('charset', NULL, NULL, NULL, $lang);
            $english_charset = do_lang('charset', NULL, NULL, NULL, fallback_lang());
            while (($f = readdir($dh)) !== false) {
                if (substr($f, -4) == '.ini') {
                    $path = get_custom_file_base() . '/lang_custom/' . $lang . '/' . $f;
                    $entries = array();
                    _get_lang_file_map($path, $entries, false, false);
                    $mtime = filemtime($path);
                    $data = '
msgid ""
msgstr ""
"Project-Id-Version: ocportal\\n"
"PO-Revision-Date: ' . gmdate('Y-m-d H:i', $mtime) . '+0000\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: FULL NAME <EMAIL@ADDRESS>\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"X-ocPortal-Export-Date: ' . gmdate('Y-m-d H:i', $mtime) . '+0000\\n"
"X-Generator: ocPortal (' . ocp_version_full() . ')\\n"

';
                    $entries2 = array();
                    $en_seen_before = array();
                    foreach ($entries as $key => $val) {
                        $english = do_lang($key, NULL, NULL, NULL, fallback_lang(), false);
                        if (is_null($english)) {
                            continue;
                        }
                        if ($english == '') {
                            continue;
                        }
                        $val = convert_to_internal_encoding($val, $charset, 'utf-8');
                        $val = str_replace(chr(10), '\\n', $val);
                        $english = convert_to_internal_encoding($english, $english_charset, 'utf-8');
                        $english = str_replace(chr(10), '\\n', $english);
                        $seen_before = false;
                        if (isset($en_seen_before[$val])) {
                            $seen_before = true;
                            foreach ($entries2 as $_key => $_val) {
                                if ($entries2[$_key][2] == $val) {
                                    $entries2[$_key][1] = true;
                                }
                            }
                        }
                        $entries2[$key] = array($val, $seen_before, $english);
                        $en_seen_before[$val] = 1;
                    }
                    require_code('support2');
                    foreach ($entries2 as $key => $_val) {
                        list($val, $seen_before, $english) = $_val;
                        $data .= '#: [strings]' . $key . chr(10);
                        if ($seen_before) {
                            $data .= 'msgctxt "[strings]' . $key . '"' . chr(10);
                        }
                        $wrapped = preg_replace('#"\\n"$#', '', ocp_mb_chunk_split(str_replace('"', '\\"', $english), 76, '"' . chr(10) . '"'));
                        if (strpos($wrapped, chr(10)) !== false) {
                            $data .= 'msgid ""' . chr(10) . '"' . $wrapped . '"' . chr(10);
                        } else {
                            $data .= 'msgid "' . $wrapped . '"' . chr(10);
                        }
                        $wrapped = preg_replace('#"\\n"$#', '', ocp_mb_chunk_split(str_replace('"', '\\"', $val), 76, '"' . chr(10) . '"'));
                        if (strpos($wrapped, chr(10)) !== false) {
                            $data .= 'msgstr ""' . chr(10) . '"' . $wrapped . '"' . chr(10);
                        } else {
                            $data .= 'msgstr "' . $wrapped . '"' . chr(10);
                        }
                        $data .= chr(10);
                    }
                    tar_add_file($tar, basename($f, '.ini') . '/' . basename($f, '.ini') . '-' . strtolower($lang) . '.po', $data, 0666, $mtime);
                }
            }
        }
        tar_close($tar);
        readfile($tempfile);
        @unlink($tempfile);
        $GLOBALS['SCREEN_TEMPLATE_CALLED'] = '';
        exit;
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_lang.php


示例11: dispatch

 /**
  * Send out a notification to members enabled.
  */
 function dispatch()
 {
     if (running_script('stress_test_loader')) {
         return;
     }
     if (get_page_name() == 'admin_import') {
         return;
     }
     $subject = $this->subject;
     $message = $this->message;
     $no_cc = $this->no_cc;
     if ($GLOBALS['DEBUG_MODE']) {
         if (strpos($this->message, 'keep_devtest') !== false && $this->notification_code != 'hack_attack' && $this->notification_code != 'auto_ban' && strpos($this->message, running_script('index') ? static_evaluate_tempcode(build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, true)) : get_self_url_easy()) === false && (strpos(ocp_srv('HTTP_REFERER'), 'keep_devtest') === false || strpos($this->message, ocp_srv('HTTP_REFERER')) === false)) {
             // Bad URL - it has to be general, not session-specific
             fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
         }
     }
     $ob = _get_notification_ob_for_code($this->notification_code);
     if (is_null($ob)) {
         if (get_page_name() != 'admin_setupwizard') {
             // Setupwizard may have removed after register_shutdown_function was called
             fatal_exit('Missing notification code: ' . $this->notification_code);
         }
         return;
     }
     require_lang('notifications');
     require_code('mail');
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     if ($this->store_in_staff_messaging_system && addon_installed('staff_messaging')) {
         require_lang('messaging');
         list($type, $id) = explode('_', $this->code_category, 2);
         $message_url = build_url(array('page' => 'admin_messaging', 'type' => 'view', 'id' => $id, 'message_type' => $type), get_module_zone('admin_messaging'), NULL, false, false, true);
         $message = do_lang('MESSAGING_NOTIFICATION_WRAPPER', $message, $message_url->evaluate());
         require_code('feedback');
         actualise_post_comment(true, $type, $id, $message_url, $subject, get_option('messaging_forum_name'), true, 1, true, true, true);
     }
     $testing = get_param_integer('keep_debug_notifications', 0) == 1;
     $start = 0;
     $max = 300;
     do {
         list($members, $possibly_has_more) = $ob->list_members_who_have_enabled($this->notification_code, $this->code_category, $this->to_member_ids, $start, $max);
         if (get_value('notification_safety_testing') === '1') {
             if (count($members) > 20) {
                 $members = array(6 => A_INSTANT_EMAIL);
                 // This is just for testing on ocportal.com, if lots of notifications going out it's probably a scary bug, so send just to Chris (#6) with a note
                 $message = 'OVER-ADDRESSED?' . "\n\n" . $message;
             }
         }
         foreach ($members as $to_member_id => $setting) {
             if (!is_null($this->no_notify_for__notification_code)) {
                 if (notifications_enabled($this->no_notify_for__notification_code, $this->no_notify_for__code_category, $to_member_id)) {
                     continue;
                 }
                 // Signal they are getting some other notification for this
             }
             if ($to_member_id !== $this->from_member_id || $testing) {
                 $no_cc = _dispatch_notification_to_member($to_member_id, $setting, $this->notification_code, $this->code_category, $subject, $message, $this->from_member_id, $this->priority, $no_cc);
             }
         }
         $start += $max;
     } while ($possibly_has_more);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:notifications.php


示例12: init__validation


//.........这里部分代码省略.........
         * @param  ?LANGUAGE_NAME The language to use (NULL: users language)
         * @param  boolean		Whether to cause ocPortal to exit if the lookup does not succeed
         * @return ?mixed			The human-readable content (NULL: not found). String normally. Tempcode if tempcode parameters.
         */
        function do_lang($a, $param_a = NULL, $param_b = NULL, $param_c = NULL, $lang = NULL, $require_result = true)
        {
            if (function_exists('_do_lang')) {
                return _do_lang($a, $param_a, $param_b, $param_c, $lang, $require_result);
            }
            unset($lang);
            unset($allow_fail);
            switch ($a) {
                case 'LINK_NEW_WINDOW':
                    return 'new window';
                case 'SPREAD_TABLE':
                    return 'Spread table';
                case 'MAP_TABLE':
                    return 'Item to value mapper table';
            }
            return array($a, $param_a, $param_b, $param_c);
        }
    }
    if (!function_exists('get_forum_type')) {
        /**
         * Get the type of forums installed.
         *
         * @return string			The type of forum installed
         */
        function get_forum_type()
        {
            return 'none';
        }
    }
    if (!function_exists('ocp_srv')) {
        /**
         * Get server environment variables. (STUB)
         *
         * @param  string			The variable name
         * @return string			The variable value ('' means unknown)
         */
        function ocp_srv($value)
        {
            return '';
        }
    }
    if (!function_exists('mailto_obfuscated')) {
        /**
         * Get obfuscate version of 'mailto:' (which'll hopefully fool e-mail scavengers to not pick up these e-mail addresses).
         *
         * @return string		The obfuscated 'mailto:' string
         */
        function mailto_obfuscated()
        {
            return 'mailto:';
        }
    }
    if (!function_exists('mixed')) {
        /**
         * Assign this to explicitly declare that a variable may be of mixed type, and initialise to NULL.
         *
         * @return ?mixed	Of mixed type (NULL: default)
         */
        function mixed()
        {
            return NULL;
        }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:67,代码来源:validation.php


示例13: reprocess_url

/**
 * Take a URL and process it to make a hard include. We'll get the HTML and we'll also load up some global stuff for 'do_header' to use.
 *
 * @param  URLPATH	The URL that we're operating on.
 * @param  URLPATH	We open up linked URLs under this recursively.
 * @return string		The cleaned up contents at the URL, set up for the recursive integrator usage.
 */
function reprocess_url($url, $operation_base_url)
{
    if (url_is_local($url)) {
        return '';
    }
    $trail_end = strrpos($url, '/');
    if ($trail_end !== false) {
        $url_base = substr($url, 0, $trail_end);
    }
    $val = mixed();
    // Cookie relaying from client through to server
    $url_bits = @parse_url($url) or warn_exit(do_lang_tempcode('HTTP_DOWNLOAD_NO_SERVER', $url));
    $url_bits_2 = parse_url(get_base_url());
    $cookies_relayed = NULL;
    if (!array_key_exists('host', $url_bits)) {
        $url_bits['host'] = 'localhost';
    }
    if (!array_key_exists('host', $url_bits_2)) {
        $url_bits_2['host'] = 'localhost';
    }
    if ($url_bits['host'] == $url_bits_2['host']) {
        $cookies_relayed = array();
        foreach ($_COOKIE as $key => $val) {
            if (is_array($val)) {
                $cookies_relayed[$key] = array();
                foreach ($val as $_val) {
                    if (get_magic_quotes_gpc()) {
                        $_val = stripslashes($_val);
                    }
                    $cookies_relayed[$key][] = $_val;
                }
            } else {
                if (get_magic_quotes_gpc()) {
                    $val = stripslashes($val);
                }
                $cookies_relayed[$key] = $val;
            }
        }
    }
    // Download the document
    $ua = ocp_srv('HTTP_USER_AGENT');
    if ($ua == '') {
        $ua = 'ocP-integrator';
    }
    $accept = ocp_srv('HTTP_ACCEPT');
    if ($accept == '') {
        $accept = NULL;
    }
    $accept_charset = ocp_srv('HTTP_ACCEPT_CHARSET');
    if ($accept_charset == '') {
        $accept_charset = NULL;
    }
    $accept_language = ocp_srv('HTTP_ACCEPT_LANGUAGE');
    if ($accept_language == '') {
        $accept_language = NULL;
    }
    $post_relayed = NULL;
    if (count($_POST) != 0) {
        $post_relayed = array();
        foreach ($_POST as $key => $val) {
            if (is_array($val)) {
                $post_relayed[$key] = array();
                foreach ($val as $_val) {
                    if (get_magic_quotes_gpc()) {
                        $_val = stripslashes($_val);
                    }
                    $post_relayed[$key] = $val;
                }
            } else {
                if (get_magic_quotes_gpc()) {
                    $val = stripslashes($val);
                }
                $post_relayed[$key] = $val;
            }
        }
    }
    require_code('character_sets');
    $document = convert_to_internal_encoding(http_download_file($url, NULL, true, false, $ua, $post_relayed, $cookies_relayed, $accept, $accept_charset, $accept_language));
    global $HTTP_DOWNLOAD_MIME_TYPE;
    if ($HTTP_DOWNLOAD_MIME_TYPE != 'text/html' && $HTTP_DOWNLOAD_MIME_TYPE != 'application/xhtml+xml') {
        header('Location: ' . str_replace("\r", '', str_replace(chr(10), '', $url)));
        return '';
    }
    // Were we asked to set any cookies?
    if ($url_bits['host'] == $url_bits_2['host']) {
        global $HTTP_NEW_COOKIES;
        if (!is_null($HTTP_NEW_COOKIES)) {
            foreach ($HTTP_NEW_COOKIES as $key => $val) {
                $parts = explode('; ', $val);
                foreach ($parts as $i => $part) {
                    if ($i != 0) {
                        $temp = explode('=', $part, 2);
                        if (array_key_exists(1, $temp)) {
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:integrator.php


示例14: _build_results_browser_cat_url

/**
 * Helper function to work out a results browser URL.
 *
 * @param  array			Map of GET array segments to use (others will be added by this function)
 * @param  array			Map of POST array segments (relayed as GET) to use
 * @param  ?ID_TEXT		The page type t 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ocp_version_number函数代码示例发布时间:2022-05-15
下一篇:
PHP ocp_mark_as_escaped函数代码示例发布时间: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