本文整理汇总了PHP中get_base_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_base_url函数的具体用法?PHP get_base_url怎么用?PHP get_base_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_base_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_future_version_information
/**
* Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
*
* @return tempcode Information about the installed ocPortal version
*/
function get_future_version_information()
{
require_lang('version');
$url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
$data = http_download_file($url, NULL, false);
if (!is_null($data)) {
$data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
if ($GLOBALS['XSS_DETECT']) {
ocp_mark_as_escaped($data);
}
require_code('character_sets');
$data = convert_to_internal_encoding($data);
$table = new ocp_tempcode();
$lines = explode(chr(10), $data);
foreach ($lines as $line) {
if (trim($line) != '') {
$table->attach(paragraph($line));
}
}
$table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
} else {
$table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
}
require_code('xhtml');
/*$table->attach('<script type="text/javascript">// <![CDATA[
window.open(\''.$url.'\');
//]]></script>');*/
return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:version2.php
示例2: init__config
/**
* Standard code module initialisation function.
*/
function init__config()
{
global $VALUES, $IN_MINIKERNEL_VERSION;
if ($IN_MINIKERNEL_VERSION == 0) {
load_options();
$VALUES = persistant_cache_get('VALUES');
if (!is_array($VALUES)) {
$VALUES = $GLOBALS['SITE_DB']->query_select('values', array('*'));
$VALUES = list_to_map('the_name', $VALUES);
persistant_cache_set('VALUES', $VALUES);
}
} else {
$VALUES = array();
}
global $GET_OPTION_LOOP;
$GET_OPTION_LOOP = 0;
global $MULTI_LANG;
$MULTI_LANG = NULL;
// Enforce XML db synching
if (get_db_type() == 'xml' && !running_script('xml_db_import') && is_file(get_file_base() . '/data_custom/xml_db_import.php') && is_dir(get_file_base() . '/.svn')) {
$last_xml_import = get_value('last_xml_import');
$mod_time = filemtime(get_file_base() . '/.svn');
if (is_null($last_xml_import) || intval($last_xml_import) < $mod_time) {
set_value('last_xml_import', strval(time()));
header('Location: ' . get_base_url() . '/data_custom/xml_db_import.php');
exit;
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:config.php
示例3: rules
public function rules()
{
// TODO: fix $_GET w/ URL rewriting
global $lang_common, $lang_login, $lang_register;
// If we are logged in, we shouldn't be here
if (!$this->user->is_guest) {
header('Location: ' . get_base_url());
exit;
}
// Display an error message if new registrations are disabled
if ($this->config['o_regs_allow'] == '0') {
message($lang_register['No new regs']);
}
// Load the register.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
// Load the register.php/profile.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
if ($this->config['o_rules'] != '1') {
redirect(get_link('register/agree/'));
}
$page_title = array(feather_escape($this->config['o_board_title']), $lang_register['Register'], $lang_register['Forum rules']);
define('FEATHER_ACTIVE_PAGE', 'register');
$this->header->setTitle($page_title)->display();
$this->feather->render('register/rules.php', array('lang_register' => $lang_register, 'feather_config' => $this->config));
$this->footer->display();
}
开发者ID:beaver-dev,项目名称:featherbb,代码行数:26,代码来源:register.php
示例4: sitemaps_build
/**
* Top level function to (re)generate a Sitemap (xml file, Google-style).
*/
function sitemaps_build()
{
$GLOBALS['NO_QUERY_LIMIT'] = true;
$path = get_custom_file_base() . '/ocp_sitemap.xml';
if (!file_exists($path)) {
if (!is_writable_wrap(dirname($path))) {
warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', escape_html('/')));
}
} else {
if (!is_writable_wrap($path)) {
warn_exit(do_lang_tempcode('WRITE_ERROR', escape_html('ocp_sitemap.xml')));
}
}
// Runs via a callback mechanism, so we don't need to load an arbitrary complex structure into memory.
sitemaps_xml_initialise($path);
spawn_page_crawl('pagelink_to_sitemapsxml', $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, DEPTH__ENTRIES);
sitemaps_xml_finished();
// Ping search engines
if (get_option('auto_submit_sitemap') == '1') {
$ping = true;
$base_url = get_base_url();
$not_local = substr($base_url, 0, 16) != 'http://localhost' && substr($base_url, 0, 16) != 'http://127.0.0.1' && substr($base_url, 0, 15) != 'http://192.168.' && substr($base_url, 0, 10) != 'http://10.';
if ($ping && get_option('site_closed') == '0' && $not_local) {
// Submit to search engines
$services = array('http://www.google.com/webmasters/tools/ping?sitemap=', 'http://submissions.ask.com/ping?sitemap=', 'http://www.bing.com/webmaster/ping.aspx?siteMap=', 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=');
foreach ($services as $service) {
http_download_file($service . urlencode(get_custom_base_url() . '/ocp_sitemap.xml'), NULL, false);
}
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:sitemap.php
示例5: send_email
/**
* send email confirmation.
* invoked by: Model.Player.register()
* @param $email
* @param $name
* @param $key
* @return bool
*/
public function send_email($email, $name, $key)
{
include_once __SITE_PATH . '/library/PHPMailer/PHPMailerAutoload.php';
// get separated .ini configuration from stealing my email and password which used to sent email
$setting = parse_ini_file(get_base_url() . '/setting.ini', true);
$email_address = $setting['email']['email_address'];
$email_password = $setting['email']['email_password'];
// instantiate PHPMailer and setup for configuration
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'ssl://smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = $email_address;
$mail->Password = $email_password;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->From = '[email protected]';
$mail->FromName = 'SeriousGame.Inc';
$mail->addAddress($email, $name);
$mail->addReplyTo('[email protected]', 'SeriousGame.Inc');
$mail->isHTML(true);
$mail->Subject = 'Business Career The Game Registration';
$body = $this->format_email('html', $email, $name, $key);
$mail->msgHTML($body, __SITE_PATH . 'assets/etc/');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
return false;
} else {
echo "Message sent!";
return true;
}
}
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:41,代码来源:Player.class.php
示例6: run
/**
* Standard modular run function for award hooks. Renders a content box for an award/randomisation.
*
* @param array The database row for the content
* @param ID_TEXT The zone to display in
* @return tempcode Results
*/
function run($row, $zone)
{
$url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
$title = get_translated_tempcode($row['title']);
$title_plain = get_translated_text($row['title']);
$news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
if (!array_key_exists(0, $news_cat_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$news_cat_row = $news_cat_rows[0];
$category = get_translated_text($news_cat_row['nc_title']);
$img = find_theme_image($news_cat_row['nc_img']);
if ($row['news_image'] != '') {
$img = $row['news_image'];
if (url_is_local($img)) {
$img = get_base_url() . '/' . $img;
}
}
$news = get_translated_tempcode($row['news']);
if ($news->is_empty()) {
$news = get_translated_tempcode($row['news_article']);
$truncate = true;
} else {
$truncate = false;
}
$author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
$author = $row['author'];
require_css('news');
$seo_bits = seo_meta_get_for('news', strval($row['id']));
$map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
$map['COMMENT_COUNT'] = '1';
}
return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:news.php
示例7: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (get_forum_type() != 'ocf') {
return;
}
$time = time();
$last_time = intval(get_value('last_confirm_reminder_time'));
if ($last_time > time() - 24 * 60 * 60 * 2) {
return;
}
set_value('last_confirm_reminder_time', strval($time));
require_code('mail');
require_lang('ocf');
$GLOBALS['NO_DB_SCOPE_CHECK'] = true;
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_not_equal_to('m_validated_email_confirm_code', '') . ' AND m_join_time>' . strval($last_time));
$GLOBALS['NO_DB_SCOPE_CHECK'] = false;
foreach ($rows as $row) {
$coppa = get_option('is_on_coppa') == '1' && utctime_to_usertime(time() - mktime(0, 0, 0, $row['m_dob_month'], $row['m_dob_day'], $row['m_dob_year'])) / 31536000.0 < 13.0;
if (!$coppa) {
$zone = get_module_zone('join');
if ($zone != '') {
$zone .= '/';
}
$url = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4&email=' . rawurlencode($row['m_email_address']) . '&code=' . $row['m_validated_email_confirm_code'];
$url_simple = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4';
$message = do_lang('OCF_SIGNUP_TEXT', comcode_escape(get_site_name()), comcode_escape($url), array($url_simple, $row['m_email_address'], strval($row['m_validated_email_confirm_code'])), $row['m_language']);
mail_wrap(do_lang('CONFIRM_EMAIL_SUBJECT', get_site_name(), NULL, NULL, $row['m_language']), $message, array($row['m_email_address']), $row['m_username']);
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:ocf_confirm_reminder.php
示例8: url
/**
* Returns absolute URL to the specified file or folder.
*
* @param string $file The path to the file, ex: '/about/thunderbird'
* @param bool $addon_locale Whether the current locale should be included
* in the URL. For example, images and CSS should
* not have the locale. If left empty, add_locale
* will attempt to be detected based on the file
* extension.
* @returns string
*/
function url($file, $add_locale = null) {
// Add beginning slash if left out
if ($file[0] != '/')
$file = '/'.$file;
// Get base URL
$url = get_base_url();
// If add_locale is empty, try to detect whether it should be used
if (!isset($add_locale)) {
$static_extensions = array('jpg', 'png', 'gif', 'css', 'js');
if ($last_position = strrpos($file, '.')) {
$extension = substr($file, $last_position + 1);
$add_locale = !in_array($extension, $static_extensions);
}
else
$add_locale = true;
}
// Add the locale if necessary
if ($add_locale)
$url .= '/'.LANG;
$url .= $file;
return $url;
}
开发者ID:noscripter,项目名称:mozilla.org,代码行数:40,代码来源:functions.inc.php
示例9: 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 (is_null($upgrade_from) || $upgrade_from < 2) {
$GLOBALS['SITE_DB']->create_table('sitewatchlist', array('id' => '*AUTO', 'siteurl' => 'URLPATH', 'site_name' => 'SHORT_TEXT'));
$GLOBALS['SITE_DB']->query_insert('sitewatchlist', array('siteurl' => get_base_url(), 'site_name' => get_site_name()));
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:main_staff_website_monitoring.php
示例10: beginSitemap
protected function beginSitemap()
{
global $pun_config;
$output = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$output .= '<?xml-stylesheet type="text/xsl" href="' . get_base_url() . '/sitemap.xsl"?>' . "\n";
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
$this->addToSitemap($output);
}
开发者ID:raphaelh,项目名称:ardechelibre.org,代码行数:8,代码来源:sitemap.php
示例11: write_php_file
function write_php_file($rewrite_ar, $filename = PHP_OUT_FILE, $http_status = REDIRECT_STATUS)
{
$default_url = get_base_url();
$template = <<<EOT
<?php
/*
Auto-generated! Time: __TIME__ (Via: rewritemap.php)
*/
\$http_status = '{$http_status}';
\$default_url = '{$default_url}';
\$map_count = __COUNT__;
\$map = __MAP__;
\$is_test = filter_input( INPUT_GET, 'test' );
\$host = server_var( 'HTTP_HOST' );
\$path = server_var( 'REDIRECT_URL' ); //REQUEST_URI
\$script = server_var( 'SCRIPT_NAME' );
\$root = str_replace( '/index.php', '', \$script );
\$source = rtrim( str_replace( \$root, '', \$path ), '/' );
if (isset( \$map[ \$source ]) || ! \$path) {
if (! \$path) {
\$dest = \$default_url;
\$source = '/';
} else {
\$dest = \$map[ \$source ];
}
\$dest .= '?from=' . urlencode( 'http://' . \$host . \$path );
if (\$is_test) {
echo "<pre>REDIRECT (test):\\n \$source\\n>>\\n \$dest\\n\\n(\$http_status)" . PHP_EOL;
} else {
header( \$http_status );
header( 'Location: '. \$dest );
}
exit;
}
header( 'HTTP/1.1 503 Service Unavailable' );
var_dump( 'ERROR', \$path, \$root, \$source );
function server_var( \$key ) {
//Was: filter_input( INPUT_SERVER, \$key )
return isset(\$_SERVER[ \$key ]) ? \$_SERVER[ \$key ] : null;
}
#End.
EOT;
$php = strtr($template, array('__MAP__' => var_export($rewrite_ar, true), '__COUNT__' => count($rewrite_ar), '__TIME__' => date('c')));
$bytes = file_put_contents($filename, $php);
return $bytes;
}
开发者ID:nfreear,项目名称:nfreear.github.io,代码行数:58,代码来源:rewritemap.php
示例12: __construct
/**
* Construct and initialize the object.
*
* @param string $file
*/
public function __construct($file)
{
$this->routes = new \SimpleXMLElement($file, NULL, true);
// TODO: Move this function from helpers to a static method in this
// class
$base_uri = \get_base_url();
$requested_uri = $this->getRequestedUri($base_uri);
$GLOBALS['resource'] = $this->getResourceFromUri($requested_uri);
}
开发者ID:rwngallego,项目名称:lat,代码行数:14,代码来源:Router.php
示例13: testAdminZone
function testAdminZone()
{
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$result = http_download_file(get_base_url() . '/_tests/codechecker/phpdoc_parser.php', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
foreach (explode('<br />', $result) as $line) {
$this->assertTrue(trim($line) == '' || substr($line, 0, 4) == 'Done' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc__function_sigs.php
示例14: testDatabase
function testDatabase()
{
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$result = http_download_file(get_base_url() . '/_tests/codechecker/code_quality.php?subdir=sources/database&api=1', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
foreach (explode('<br />', $result) as $line) {
$this->assertTrue(trim($line) == '' || substr($line, 0, 5) == 'SKIP:' || substr($line, 0, 5) == 'DONE ' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc_database.php
示例15: get_html
function get_html($url)
{
while (true) {
try {
$html = file_get_html($url);
break;
} catch (Exception $e) {
echo "\n**Failed to get html. Trying again**\n";
}
}
return replace_links_with_base_url(get_base_url($url), $html);
}
开发者ID:brthiess,项目名称:rockstat_final,代码行数:12,代码来源:web-crawler.php
示例16: markread
public function markread()
{
global $lang_common;
if ($this->user->is_guest) {
message($lang_common['No permission'], '403');
}
// Load the misc.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/misc.php';
$this->model->update_last_visit();
// Reset tracked topics
set_tracked_topics(null);
redirect(get_base_url(), $lang_misc['Mark read redirect']);
}
开发者ID:beaver-dev,项目名称:featherbb,代码行数:13,代码来源:misc.php
示例17: get_file_size
/**
* Get a formatted-string filesize for the specified file. It is formatted as such: x Mb/Kb/Bytes (or unknown). It is assumed that the file exists.
*
* @param URLPATH The URL that the file size of is being worked out for. Should be local.
* @return string The formatted-string file size
*/
function get_file_size($url)
{
if (substr($url, 0, strlen(get_base_url())) == get_base_url()) {
$url = substr($url, strlen(get_base_url()));
}
if (!url_is_local($url)) {
return do_lang('UNKNOWN');
}
$_full = rawurldecode($url);
$_full = get_file_base() . '/' . $_full;
$file_size_bytes = filesize($_full);
return clean_file_size($file_size_bytes);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:19,代码来源:files.php
示例18: etsis_notify_script
/**
* Scripts for desktop notification.
*
* @since 6.2.11
*/
function etsis_notify_script()
{
$script = '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.animate.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.buttons.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.confirm.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.nonblock.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.mobile.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.desktop.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.history.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.callbacks.js"></script>' . "\n";
$script .= '<script type="text/javascript" src="' . get_base_url() . 'static/assets/plugins/pnotify/src/pnotify.reference.js"></script>' . "\n";
echo $script;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:19,代码来源:notify-function.php
示例19: 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 (is_null($upgrade_from)) {
$GLOBALS['SITE_DB']->create_table('banners', array('name' => '*ID_TEXT', 'expiry_date' => '?TIME', 'submitter' => 'USER', 'img_url' => 'URLPATH', 'b_title_text' => 'SHORT_TEXT', 'the_type' => 'SHORT_INTEGER', 'caption' => 'SHORT_TRANS', 'campaign_remaining' => 'INTEGER', 'site_url' => 'URLPATH', 'hits_from' => 'INTEGER', 'views_from' => 'INTEGER', 'hits_to' => 'INTEGER', 'views_to' => 'INTEGER', 'importance_modulus' => 'INTEGER', 'notes' => 'LONG_TEXT', 'validated' => 'BINARY', 'add_date' => 'TIME', 'edit_date' => '?TIME', 'b_type' => 'ID_TEXT'));
$GLOBALS['SITE_DB']->create_index('banners', 'banner_child_find', array('b_type'));
$GLOBALS['SITE_DB']->create_index('banners', 'the_type', array('the_type'));
$GLOBALS['SITE_DB']->create_index('banners', 'expiry_date', array('expiry_date'));
$GLOBALS['SITE_DB']->create_index('banners', 'badd_date', array('add_date'));
$GLOBALS['SITE_DB']->create_index('banners', 'topsites', array('hits_from', 'hits_to'));
$GLOBALS['SITE_DB']->create_index('banners', 'campaign_remaining', array('campaign_remaining'));
$GLOBALS['SITE_DB']->create_index('banners', 'bvalidated', array('validated'));
$GLOBALS['SITE_DB']->query_insert('banners', array('b_title_text' => '', 'name' => 'advertise_here', 'the_type' => 2, 'img_url' => 'data/images/advertise_here.png', 'caption' => lang_code_to_default_content('ADVERTISE_HERE', true, 1), 'campaign_remaining' => 0, 'site_url' => get_base_url() . '/site/index.php?page=advertise', 'hits_from' => 0, 'views_from' => 0, 'hits_to' => 0, 'views_to' => 0, 'importance_modulus' => 10, 'notes' => 'Provided as default. This is a default banner (it shows when others are not available).', 'validated' => 1, 'add_date' => time(), 'submitter' => $GLOBALS['FORUM_DRIVER']->get_guest_id(), 'b_type' => '', 'expiry_date' => NULL, 'edit_date' => NULL));
$GLOBALS['SITE_DB']->query_insert('banners', array('b_title_text' => '', 'name' => 'donate', 'the_type' => 0, 'img_url' => 'data/images/donate.png', 'caption' => lang_code_to_default_content('DONATION', true, 1), 'campaign_remaining' => 0, 'site_url' => get_base_url() . '/site/index.php?page=donate', 'hits_from' => 0, 'views_from' => 0, 'hits_to' => 0, 'views_to' => 0, 'importance_modulus' => 30, 'notes' => 'Provided as default.', 'validated' => 1, 'add_date' => time(), 'submitter' => $GLOBALS['FORUM_DRIVER']->get_guest_id(), 'b_type' => '', 'expiry_date' => NULL, 'edit_date' => NULL));
$banner_a = 'advertise_here';
$banner_c = 'donate';
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
foreach (array_keys($groups) as $group_id) {
$GLOBALS['SITE_DB']->query_insert('group_category_access', array('module_the_name' => 'banners', 'category_name' => $banner_a, 'group_id' => $group_id));
$GLOBALS['SITE_DB']->query_insert('group_category_access', array('module_the_name' => 'banners', 'category_name' => $banner_c, 'group_id' => $group_id));
}
add_config_option('ENABLE_BANNERS', 'is_on_banners', 'tick', 'return \'1\';', 'FEATURE', 'BANNERS');
add_config_option('MONEY_AD_CODE', 'money_ad_code', 'text', 'return \'\';', 'FEATURE', 'BANNERS', 1);
add_config_option('ADVERT_CHANCE', 'advert_chance', 'float', 'return \'5\';', 'FEATURE', 'BANNERS', 1);
add_specific_permission('BANNERS', 'full_banner_setup', false);
add_specific_permission('BANNERS', 'view_anyones_banner_stats', false);
add_config_option('ADD_BANNER', 'points_ADD_BANNER', 'integer', 'return addon_installed(\'points\')?\'0\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
//add_menu_item_simple('main_website',NULL,'DONATE','_SEARCH:donate');
}
if (!is_null($upgrade_from) && $upgrade_from < 3) {
$GLOBALS['SITE_DB']->add_table_field('banners', 'b_type', 'ID_TEXT');
}
if (is_null($upgrade_from) || $upgrade_from < 4) {
$GLOBALS['SITE_DB']->create_table('banner_types', array('id' => '*ID_TEXT', 't_is_textual' => 'BINARY', 't_image_width' => 'INTEGER', 't_image_height' => 'INTEGER', 't_max_file_size' => 'INTEGER', 't_comcode_inline' => 'BINARY'));
$GLOBALS['SITE_DB']->create_index('banner_types', 'hottext', array('t_comcode_inline'));
$GLOBALS['SITE_DB']->query_insert('banner_types', array('id' => '', 't_is_textual' => 0, 't_image_width' => 468, 't_image_height' => 60, 't_max_file_size' => 80, 't_comcode_inline' => 0));
$GLOBALS['SITE_DB']->create_table('banner_clicks', array('id' => '*AUTO', 'c_date_and_time' => 'TIME', 'c_member_id' => 'USER', 'c_ip_address' => 'IP', 'c_source' => 'ID_TEXT', 'c_banner_id' => 'ID_TEXT'));
$GLOBALS['SITE_DB']->create_index('banner_clicks', 'clicker_ip', array('c_ip_address'));
add_specific_permission('BANNERS', 'banner_free', false);
add_config_option('PERMISSIONS', 'use_banner_permissions', 'tick', 'return \'0\';', 'FEATURE', 'BANNERS');
$GLOBALS['SITE_DB']->query_update('banners', array('b_type' => 'BANNERS'), array('b_type' => '_BANNERS'));
}
if (!is_null($upgrade_from) && $upgrade_from < 4) {
$GLOBALS['SITE_DB']->add_table_field('banners', 'b_title_text', 'SHORT_TEXT');
}
if (is_null($upgrade_from) || $upgrade_from < 5) {
add_config_option('BANNER_AUTOSIZE', 'banner_autosize', 'tick', 'return is_null($old=get_value(\'banner_autosize\'))?\'0\':$old;', 'FEATURE', 'BANNERS');
add_config_option('ADMIN_BANNERS', 'admin_banners', 'tick', 'return is_null($old=get_value(\'always_banners\'))?\'0\':$old;', 'FEATURE', 'BANNERS');
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:55,代码来源:banners.php
示例20: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
$bits = new ocp_tempcode();
$map = array();
$url = get_base_url();
list($rank, $links, $speed) = getAlexaRank($url);
$map['Google PageRank'] = getPageRank($url);
$map['Alexa rank'] = $rank;
$map['Back links'] = protect_from_escaping('<a title="Show back links" href="http://www.google.co.uk/search?as_lq=' . urlencode($url) . '">' . $links . '</a>');
$map['Speed'] = $speed;
foreach ($map as $key => $val) {
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => $key, 'VALUE' => is_null($val) ? '' : $val)));
}
$section = do_template('BLOCK_SIDE_STATS_SECTION', array('SECTION' => 'Meta stats', 'CONTENT' => $bits));
return $section;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:stats_external.php
注:本文中的get_base_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论