コード例 #1
0
ファイル: version2.php プロジェクト: erico-deh/ocPortal
/**
 * 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()));
}
コード例 #2
0
ファイル: config.php プロジェクト: erico-deh/ocPortal
/**
 * 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;
        }
    }
}
コード例 #3
0
ファイル: register.php プロジェクト: beaver-dev/featherbb
 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();
 }
コード例 #4
0
ファイル: sitemap.php プロジェクト: erico-deh/ocPortal
/**
 * 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);
            }
        }
    }
}
コード例 #5
0
 /**
  * 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 = '*****@*****.**';
     $mail->FromName = 'SeriousGame.Inc';
     $mail->addAddress($email, $name);
     $mail->addReplyTo('*****@*****.**', '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;
     }
 }
コード例 #6
0
ファイル: news.php プロジェクト: erico-deh/ocPortal
 /**
  * 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));
 }
コード例 #7
0
 /**
  * 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']);
         }
     }
 }
コード例 #8
0
/**
 * 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;
}
コード例 #9
0
 /**
  * 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()));
     }
 }
コード例 #10
0
ファイル: sitemap.php プロジェクト: raphaelh/ardechelibre.org
 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);
 }
コード例 #11
0
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;
}
コード例 #12
0
ファイル: Router.php プロジェクト: rwngallego/lat
 /**
  * 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);
 }
コード例 #13
0
 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);
     }
 }
コード例 #14
0
ファイル: cqc_database.php プロジェクト: erico-deh/ocPortal
 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);
     }
 }
コード例 #15
0
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);
}
コード例 #16
0
ファイル: misc.php プロジェクト: beaver-dev/featherbb
 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']);
 }
コード例 #17
0
ファイル: files.php プロジェクト: erico-deh/ocPortal
/**
 * 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);
}
コード例 #18
0
/**
 * 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;
}
コード例 #19
0
ファイル: banners.php プロジェクト: erico-deh/ocPortal
 /**
  * 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');
     }
 }
コード例 #20
0
ファイル: stats_external.php プロジェクト: erico-deh/ocPortal
 /**
  * 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;
 }
コード例 #21
0
ファイル: login.php プロジェクト: beaver-dev/featherbb
 public function forget()
 {
     global $lang_common, $lang_login;
     define('FEATHER_QUIET_VISIT', 1);
     if (!$this->user->is_guest) {
         header('Location: ' . get_base_url());
         exit;
     }
     // Load the login.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/login.php';
     $errors = $this->model->password_forgotten();
     $page_title = array(feather_escape($this->config['o_board_title']), $lang_login['Request pass']);
     $required_fields = array('req_email' => $lang_common['Email']);
     $focus_element = array('request_pass', 'req_email');
     define('FEATHER_ACTIVE_PAGE', 'login');
     $this->header->setTitle($page_title)->setFocusElement($focus_element)->setRequiredFields($required_fields)->display();
     $this->feather->render('login/password_forgotten.php', array('errors' => $errors, 'lang_login' => $lang_login, 'lang_common' => $lang_common));
     $this->footer->display();
 }
コード例 #22
0
 /**
  * This will get the XML file from ocportal.com.
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @return string			The XML file
  */
 function get_file($id)
 {
     $stub = get_param_integer('localhost', 0) == 1 ? get_base_url() : 'http://ocportal.com';
     $v = 'Version ' . float_to_raw_string(ocp_version_number(), 1);
     if (!is_null($id)) {
         $v = $id;
     }
     $url = $stub . '/data/ajax_tree.php?hook=choose_download&id=' . rawurlencode($v) . '&file_type=tar';
     require_code('character_sets');
     $contents = http_download_file($url);
     $utf = $GLOBALS['HTTP_CHARSET'] == 'utf-8';
     // We have to use 'U' in the regexp to work around a Chrome parser bug (we can't rely on convert_to_internal_encoding being 100% correct)
     require_code('character_sets');
     $contents = convert_to_internal_encoding($contents);
     $contents = preg_replace('#^\\s*\\<' . '\\?xml version="1.0" encoding="[^"]*"\\?' . '\\>\\<request\\>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#</request>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*has_children="false"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*title="Manual install required"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     return $contents;
 }
コード例 #23
0
ファイル: stats.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_stats')) {
         require_lang('stats');
         $rows = $GLOBALS['SITE_DB']->query('SELECT browser,referer,the_page,ip,the_user AS member_id,date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'stats WHERE date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $page_link = str_replace(':', ': ', page_path_to_pagelink($row['the_page']));
             if ($row['the_page'] == '/access_denied') {
                 $page_link = do_lang('ACCESS_DENIED_SCREEN');
             }
             if ($row['the_page'] == '/closed') {
                 $page_link = do_lang('CLOSED_SITE_SCREEN');
             }
             if ($row['the_page'] == '/flood') {
                 $page_link = do_lang('FLOOD_CONTROL_SCREEN');
             }
             $title = rain_truncate_for_title(do_lang('HIT', $page_link));
             // Show referer domain or Google search keyword
             $referer = @parse_url($row['referer']);
             $base_url = @parse_url(get_base_url());
             if ($referer !== false) {
                 if (!array_key_exists('host', $referer)) {
                     $referer['host'] = do_lang('UNKNOWN');
                 }
                 if ($referer['host'] != $base_url['host']) {
                     $matches = array();
                     if (preg_match('#(&|\\?)q=([^&]*)#', $row['referer'], $matches) != 0) {
                         $title = rain_truncate_for_title(do_lang('HIT', $page_link, $matches[2], $referer['host']));
                     } else {
                         $title = rain_truncate_for_title(do_lang('HIT', $page_link, $referer['host']));
                     }
                 }
             }
             $drops[] = rain_get_special_icons($row['ip'], $timestamp, $row['browser']) + array('TYPE' => 'stats', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => $title, 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => build_url(array('page' => 'admin_lookup', 'id' => $row['ip']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'page_' . $page_link);
         }
     }
     return $drops;
 }
コード例 #24
0
 protected function do_save($action)
 {
     global $user;
     if (!$user->is_logged_in()) {
         if (VISIBILITY == 'private') {
             header('Location: ' . get_login_url($action->page));
         } else {
             header('Location: ' . get_base_url($action->page));
         }
         exit;
     }
     $this->file = new File($this->format_page_name($action->page, true));
     if ($_POST['updated'] == $this->file->time) {
         $this->file->save($_POST['text']);
     } else {
         header('Location: ' . $this->get_base_url(str_replace(DOC, '', rtrim($action->page, '/')) . '/edit/'));
         exit;
     }
     header('Location: ' . $this->get_base_url(str_replace(DOC, '', $action->page)));
     exit;
 }
コード例 #25
0
 public function list_pages($root, $dir = '')
 {
     $root = rtrim($root, '/') . '/' . $dir;
     $pages = array();
     $ret = '';
     if (rtrim($root, '/') == DOC) {
         $pages[] = '<li><a href="' . get_base_url() . '">Home</a></li>';
     }
     $docs = array_diff(scandir($root), array('.', '..'));
     foreach ($docs as $doc) {
         if (is_dir($root . '/' . $doc)) {
             $subpages = '';
             $subpages = $this->list_pages($root, $doc);
             $pages[] = '<li><a href="' . get_base_url($root . '/' . $doc) . '">' . $doc . '</a>' . $subpages . '</li>';
         }
     }
     if (count($pages)) {
         $pages = implode("\n", $pages);
         $ret = '<ul>' . $pages . '</ul>';
     }
     return $ret;
 }
コード例 #26
0
ファイル: admin_phpinfo.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     if (get_file_base() != get_custom_file_base()) {
         warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT'));
     }
     require_lang('menus');
     get_page_title('PHP_INFO');
     $GLOBALS['SCREEN_TEMPLATE_CALLED'] = '';
     $GLOBALS['TITLE_CALLED'] = true;
     require_lang('menus');
     $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_PHP_INFO');
     ob_start();
     phpinfo();
     require_code('xhtml');
     $out = xhtmlise_html(ob_get_contents());
     ob_end_clean();
     $out = preg_replace('#<!DOCTYPE[^>]*>#s', '', preg_replace('#</body[^>]*>#', '', preg_replace('#<body[^>]*>#', '', preg_replace('#</html[^>]*>#', '', preg_replace('#<html[^>]*>#', '', $out)))));
     $matches = array();
     if (preg_match('#<style[^>]*>#', $out, $matches) != 0) {
         $offset = strpos($out, $matches[0]) + strlen($matches[0]);
         $end = strpos($out, '</style>', $offset);
         if ($end !== false) {
             $style = substr($out, $offset - strlen($matches[0]), $end - $offset + strlen('</style>') + strlen($matches[0]));
             //$GLOBALS['EXTRA_HEAD']=make_string_tempcode($style);
             $out = substr($out, 0, $offset) . substr($out, $end);
         }
     }
     $out = preg_replace('#<head[^>]*>.*</head[^>]*>#s', '', $out);
     $out = str_replace(' width="600"', ' width="100%"', $out);
     $out = preg_replace('#([^\\s<>"\']{65}&[^;]+;)#', '${1}<br />', $out);
     $out = preg_replace('#([^\\s<>"\']{95})#', '${1}<br />', $out);
     $url_parts = parse_url(get_base_url());
     $out = str_replace('<img border="0" src="/', '<img border="0" style="padding-top: 20px" src="http://' . escape_html($url_parts['host']) . '/', $out);
     require_css('phpinfo');
     require_code('xhtml');
     $ret = make_string_tempcode(xhtmlise_html($out));
     return $ret;
 }
コード例 #27
0
ファイル: fix_perms.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     require_code('xhtml');
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('fix_perms', array('h'), array(true, true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'fix_perms'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'fix_perms'));
         }
         if (!array_key_exists(2, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '3', 'fix_perms'));
         }
         $return = http_download_file(get_base_url() . '/upgrader.php?check_perms=1&user='******'&pass='******'&root=' . $parameters[2], NULL, false);
         if (is_null($return)) {
             return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', get_base_url() . '/upgrader.php?check_perms=1'));
         } else {
             return array('', occle_make_normal_html_visible(extract_html_body($return)), '', '');
         }
     }
 }
コード例 #28
0
ファイル: occlechat.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('occlechat', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'occlechat'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'occlechat'));
         }
         $GLOBALS['SITE_DB']->query_insert('occlechat', array('c_message' => $parameters[1], 'c_url' => $parameters[0], 'c_incoming' => 0, 'c_timestamp' => time()));
         $url = $parameters[0] . '/data/occle.php?action=message&base_url=' . urlencode(get_base_url()) . '&message=' . urlencode($parameters[1]);
         $return = http_download_file($url, NULL, false);
         if (is_null($return)) {
             return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', $parameters[0]));
         } elseif ($return == '1') {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
コード例 #29
0
ファイル: register.php プロジェクト: rakete/affenbande-fluxbb
                pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message);
            }
        }
        // Must the user verify the registration or do we log him/her in right now?
        if ($pun_config['o_regs_verify'] == '1') {
            // Load the "welcome" template
            $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/' . $pun_user['language'] . '/mail_templates/welcome.tpl'));
            // The first row contains the subject
            $first_crlf = strpos($mail_tpl, "\n");
            $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
            $mail_message = trim(substr($mail_tpl, $first_crlf));
            $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
            $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
            $mail_message = str_replace('<username>', $username, $mail_message);
            $mail_message = str_replace('<password>', $password1, $mail_message);
            $mail_message = str_replace('<login_url>', get_base_url() . '/login.php', $mail_message);
            $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'], $mail_message);
            pun_mail($email1, $mail_subject, $mail_message);
            message($lang->t('Reg email') . ' <a href="mailto:' . $pun_config['o_admin_email'] . '">' . $pun_config['o_admin_email'] . '</a>.', true);
        }
        // Regenerate the users info cache
        $cache->delete('boardstats');
        pun_setcookie($new_uid, $password_hash, time() + $pun_config['o_timeout_visit']);
        redirect('index.php', $lang->t('Reg complete'));
    }
}
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang->t('Register'));
$required_fields = array('req_user' => $lang->t('Username'), 'req_password1' => $lang->t('Password'), 'req_password2' => $lang->t('Confirm pass'), 'req_email1' => $lang->t('Email'), 'req_email2' => $lang->t('Email') . ' 2');
$focus_element = array('register', 'req_user');
define('PUN_ACTIVE_PAGE', 'register');
require PUN_ROOT . 'header.php';
コード例 #30
0
                    // Email the user alerting them of the change
                    if (file_exists(PUN_ROOT . 'lang/' . $cur_user['language'] . '/mail_templates/rename.tpl')) {
                        $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/' . $cur_user['language'] . '/mail_templates/rename.tpl'));
                    } else {
                        if (file_exists(PUN_ROOT . 'lang/' . $pun_config['o_default_lang'] . '/mail_templates/rename.tpl')) {
                            $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/' . $pun_config['o_default_lang'] . '/mail_templates/rename.tpl'));
                        } else {
                            $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/English/mail_templates/rename.tpl'));
                        }
                    }
                    // The first row contains the subject
                    $first_crlf = strpos($mail_tpl, "\n");
                    $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
                    $mail_message = trim(substr($mail_tpl, $first_crlf));
                    $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
                    $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
                    $mail_message = str_replace('<old_username>', $old_username, $mail_message);
                    $mail_message = str_replace('<new_username>', $username, $mail_message);
                    $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'], $mail_message);
                    pun_mail($cur_user['email'], $mail_subject, $mail_message);
                    unset($_SESSION['dupe_users'][$id]);
                }
            }
        }
        if (!empty($_SESSION['dupe_users'])) {
            $query_str = '';
            ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
            echo $lang_common['lang_identifier'];