Esempio n. 1
0
 function testAddbanner()
 {
     $this->banner_name = 'Goodmorning';
     add_banner($this->banner_name, 'http://ocportal.com/themes/ocproducts/images/newlogo.gif', 'Good morning', 'Welcome', 10, 'http://ocportal.com', 3, 'test notes', 1, 1329153480, get_member(), 1, $this->banner_type);
     //make sure the banner is created with given name
     $this->assertTrue('http://ocportal.com/themes/ocproducts/images/newlogo.gif' == $GLOBALS['FORUM_DB']->query_value('banners', 'img_url', array('name' => $this->banner_name)));
 }
Esempio n. 2
0
}
function del_link($k)
{
    global $config, $db;
    $err = array();
    unset($config['aff']['links'][$k]);
    $db->config_set('aff.links', $config['aff']['links'], 1);
    return $err;
}
switch ($vars['action']) {
    // banners
    case 'add_banner':
        if ($vars['save']) {
            $err = validate_banner_form($vars);
            if (!$err) {
                $err = add_banner($vars);
                if (!$err) {
                    display_banners();
                    break;
                }
            }
        }
        display_banner_form($vars, $err);
        break;
    case 'edit_banner':
        if ($vars['save']) {
            $err = validate_banner_form($vars);
            if (!$err) {
                $err = edit_banner($vars, $vars['banner_id']);
                if (!$err) {
                    display_banners();
Esempio n. 3
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_banners($db, $table_prefix, $file_base)
 {
     require_code('banners2');
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'banner_types', NULL, NULL, true);
     if (is_null($rows)) {
         return;
     }
     foreach ($rows as $row) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('banner_types', 'id', array('id' => $row['id']));
         if (is_null($test)) {
             add_banner_type($row['id'], $row['t_is_textual'], $row['t_image_width'], $row['t_image_height'], $row['t_max_file_size'], $row['t_comcode_inline']);
         }
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'banners', NULL, NULL, true);
     if (is_null($rows)) {
         return;
     }
     $on_same_msn = $this->on_same_msn($file_base);
     foreach ($rows as $row) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $row['name']));
         if (is_null($test)) {
             $submitter = $on_same_msn ? $row['submitter'] : import_id_remap_get('member', $row['submitter'], true);
             if (is_null($submitter)) {
                 $submitter = $GLOBALS['FORUM_DRIVER']->get_guest_id();
             }
             add_banner($row['name'], $row['img_url'], array_key_exists('b_title_text', $row) ? $row['b_title_text'] : '', $this->get_lang_string($db, $row['caption']), $row['campaign_remaining'], $row['site_url'], $row['importance_modulus'], $row['notes'], $row['the_type'], $row['expiry_date'], $submitter, $row['validated'], $row['b_type'], $row['add_date'], $row['hits_from'], $row['hits_to'], $row['views_from'], $row['views_to'], $row['edit_date']);
         }
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'banner_clicks', NULL, NULL, true);
     if (is_null($rows)) {
         return;
     }
     foreach ($rows as $row) {
         $c_member_id = $on_same_msn ? $row['c_member_id'] : import_id_remap_get('member', $row['c_member_id'], true);
         if (is_null($c_member_id)) {
             $c_member_id = $GLOBALS['FORUM_DRIVER']->get_guest_id();
         }
         $GLOBALS['SITE_DB']->query_insert('banner_clicks', array('c_date_and_time' => $row['c_date_and_time'], 'c_member_id' => $c_member_id, 'c_ip_address' => $row['c_ip_address'], 'c_source' => $row['c_source'], 'c_banner_id' => $row['c_banner_id']));
     }
 }
Esempio n. 4
0
 /**
  * Standard aed_module add actualiser.
  *
  * @return array			A pair: The entry added, Description about usage
  */
 function add_actualisation()
 {
     $name = post_param('name');
     $caption = post_param('caption');
     $campaignremaining = post_param_integer('campaignremaining', 0);
     $siteurl = fixup_protocolless_urls(post_param('site_url', ''));
     $importancemodulus = post_param_integer('importancemodulus', 3);
     $notes = post_param('notes', '');
     $the_type = post_param_integer('the_type', 1);
     $expiry_date = get_input_date('expiry_date');
     $_submitter = post_param('submitter', strval(get_member()));
     $submitter = !is_numeric($_submitter) ? $GLOBALS['FORUM_DRIVER']->get_member_from_username($_submitter) : intval($_submitter);
     $validated = post_param_integer('validated', 0);
     $b_type = post_param('b_type');
     $title_text = post_param('title_text', '');
     $b_type = post_param('b_type');
     $this->donext_type = $b_type;
     list($url, $title_text) = check_banner($title_text, $b_type);
     add_banner($name, $url, $title_text, $caption, $campaignremaining, $siteurl, $importancemodulus, $notes, $the_type, $expiry_date, $submitter, $validated, $b_type);
     $_banner_type_row = $GLOBALS['SITE_DB']->query_select('banner_types', array('t_image_width', 't_image_height'), array('id' => $b_type), '', 1);
     if (array_key_exists(0, $_banner_type_row)) {
         $banner_type_row = $_banner_type_row[0];
     } else {
         $banner_type_row = array('t_image_width' => 468, 't_image_height' => 60);
     }
     $stats_url = build_url(array('page' => '_SELF', 'type' => 'view', 'source' => $name), '_SELF');
     $banner_code = do_template('BANNER_SHOW_CODE', array('_GUID' => '745d555fcca3a1320123ad3a5a04418b', 'TYPE' => $b_type, 'NAME' => $name, 'WIDTH' => strval($banner_type_row['t_image_width']), 'HEIGHT' => strval($banner_type_row['t_image_height'])));
     $tpl = do_template('BANNER_ADDED_SCREEN', array('_GUID' => '897bab3e444f0d3c909e7a95b84d4396', 'DO_NEXT' => '', 'TEXT' => '', 'TITLE' => '', 'BANNER_CODE' => $banner_code, 'STATS_URL' => $stats_url));
     if (get_option('use_banner_permissions') == '1') {
         $this->set_permissions($name);
     }
     return array($name, $tpl);
 }
Esempio n. 5
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_banners($db, $table_prefix, $old_base_dir)
 {
     require_code('banners2');
     $categories = $db->query("SELECT title,id FROM " . $table_prefix . "categories WHERE section='com_banner'");
     foreach ($categories as $category) {
         $cat_title = $category['title'];
         $category_exist = $GLOBALS['SITE_DB']->query_value_null_ok('banner_types', 'id', array('id' => $category['title']));
         if (is_null($category_exist)) {
             add_banner_type($cat_title, 1, 160, 600, 70, 1);
         }
         $rows = $db->query("SELECT b.publish_down ,b.bid,c.title,b.name, b.clickurl, b.imageurl,b.date,bc.contact,bc.extrainfo,bc.email,b.showBanner,b.clicks,b.impmade FROM " . $table_prefix . "banner b INNER JOIN " . $table_prefix . "bannerclient bc ON b.cid=bc.cid INNER JOIN " . $table_prefix . "categories c ON b.catid=c.id AND c.title='" . db_escape_string($cat_title) . "' AND c.title <> ''");
         foreach ($rows as $row) {
             $name = $row['name'] . strval($row['bid']);
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $name));
             if (is_null($test)) {
                 if ($row['imageurl'] != '') {
                     $newimagepath = get_custom_file_base() . '/uploads/banners/' . rawurldecode($row['imageurl']);
                     $newimage = $row['imageurl'];
                     $oldimagepath = $old_base_dir . "/images/banners/" . rawurldecode($row['imageurl']);
                     @copy($oldimagepath, $newimagepath);
                 } else {
                     $newimage = '';
                 }
                 $type = 0;
                 // Permanent
                 $campaignremaining = 0;
                 // Irrelevant
                 $caption = $row['name'];
                 $end_date = $this->mysql_time_to_timestamp($row['publish_down']);
                 if ($end_date === false) {
                     $end_date = NULL;
                 }
                 $url = $row['clickurl'];
                 $image_url = $newimage;
                 $member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($row['contact']);
                 if (is_null($member)) {
                     $member = get_member();
                 }
                 $desc = $row['email'] . chr(10) . $row['extrainfo'];
                 $desc = html_to_comcode($desc);
                 add_banner($name, $image_url, '', $caption, $campaignremaining, $url, 10, $desc, $type, $end_date, $member, 1, $cat_title, NULL, 0, 0, $row['clicks'], 0, $row['impmade']);
             }
         }
     }
     $row_start = 0;
     $rows = array();
     do {
         $rows = $db->query("SELECT u.id, u.username, u.password, u.email, u.id, u.registerDate, u.lastvisitDate, u.sendEmail FROM " . $table_prefix . "bannerclient AS b INNER JOIN " . $table_prefix . "users AS u ON b.contact=u.name", 200, $row_start);
         foreach ($rows as $row) {
             if (import_check_if_imported('member', strval($row['id']))) {
                 continue;
             }
             $test = $GLOBALS['OCF_DRIVER']->get_member_from_username($row['username']);
             if (!is_null($test)) {
                 import_id_remap_put('member', strval($row['id']), $test);
                 continue;
             }
             $primary_group = get_first_default_group();
             $custom_fields = array();
             $datetimearr = explode(' ', $row['registerDate']);
             $datearr = explode('-', $datetimearr[0]);
             $timearr = explode(':', $datetimearr[1]);
             $date = $datearr[2];
             $month = $datearr[1];
             $year = $datearr[0];
             $hour = $timearr[0];
             $min = $timearr[1];
             $sec = $timearr[2];
             $register_date = mktime($hour, $min, $sec, $month, $date, $year);
             $datetimearr = explode(' ', $row['lastvisitDate']);
             $datearr = explode('-', $datetimearr[0]);
             $timearr = explode(':', $datetimearr[1]);
             $date = $datearr[2];
             $month = $datearr[1];
             $year = $datearr[0];
             $hour = $timearr[0];
             $min = $timearr[1];
             $sec = $timearr[2];
             $last_visit_date = mktime($hour, $min, $sec, $month, $date, $year);
             $id = get_param_integer('keep_preserve_ids', 0) == 0 ? NULL : $row['id'];
             $id_new = ocf_make_member($row['username'], $row['password'], $row['email'], NULL, NULL, NULL, NULL, $custom_fields, NULL, $primary_group, 1, $register_date, $last_visit_date, '', NULL, '', 0, 0, 1, $row['name'], '', '', 1, 1, NULL, $row['sendEmail'], $row['sendEmail'], '', NULL, '', FALSE, NULL, '', 1, $last_visit_date, $id, 0, '*', '');
             import_id_remap_put('member', strval($row['id']), $id_new);
         }
         $row_start += 200;
     } while (count($rows) > 0);
 }
Esempio n. 6
0
 /**
  * Standard stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function __newbanner()
 {
     if (get_option('is_on_banner_buy') == '0') {
         return new ocp_tempcode();
     }
     $this->check_afford_banner();
     // So we don't need to call these big ugly names, again...
     $image_url = post_param('image_url');
     $site_url = post_param('site_url');
     $caption = post_param('caption');
     $notes = post_param('notes', '');
     $name = post_param('name');
     $cost = intval(get_option('banner_setup'));
     $this->handle_has_banner_already();
     check_banner();
     add_banner($name, $image_url, '', $caption, intval(get_option('initial_banner_hits')), $site_url, 3, $notes, 1, NULL, get_member(), 0);
     $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => time(), 'memberid' => get_member(), 'purchasetype' => 'banner', 'details' => $name, 'details2' => ''));
     require_code('points2');
     charge_member(get_member(), $cost, do_lang('ADD_BANNER'));
     // Send mail to staff
     require_code('submit');
     $edit_url = build_url(array('page' => 'cms_banners', 'type' => '_ed', 'name' => $name), get_module_zone('cms_banners'), NULL, false, false, true);
     if (addon_installed('unvalidated')) {
         send_validation_request('ADD_BANNER', 'banners', true, $name, $edit_url);
     }
     $title = get_page_title('ADD_BANNER');
     $stats_url = build_url(array('page' => 'banners', 'type' => 'misc'), get_module_zone('banners'));
     $text = do_lang_tempcode('PURCHASED_BANNER');
     $_banner_type_row = $GLOBALS['SITE_DB']->query_select('banner_types', array('t_image_width', 't_image_height'), array('id' => ''), '', 1);
     if (array_key_exists(0, $_banner_type_row)) {
         $banner_type_row = $_banner_type_row[0];
     } else {
         $banner_type_row = array('t_image_width' => 468, 't_image_height' => 60);
     }
     $banner_code = do_template('BANNER_SHOW_CODE', array('_GUID' => 'c96f0ce22de97782b1ab9bee3f43c0ba', 'TYPE' => '', 'NAME' => $name, 'WIDTH' => strval($banner_type_row['t_image_width']), 'HEIGHT' => strval($banner_type_row['t_image_height'])));
     return do_template('BANNER_ADDED_SCREEN', array('_GUID' => '68725923b19d3df71c72276ada826183', 'TITLE' => $title, 'TEXT' => $text, 'BANNER_CODE' => $banner_code, 'STATS_URL' => $stats_url, 'DO_NEXT' => ''));
 }
Esempio n. 7
0
    /**
     * Standard import function.
     *
     * @param  object			The DB connection to import from
     * @param  string			The table prefix the target prefix is using
     * @param  PATH			The base directory we are importing from
     */
    function import_banners($db, $table_prefix, $old_base_dir)
    {
        require_code('banners2');
        require_code('menus2');
        $topsites_standard_type = $this->custom_add_banner_type('topsites_standard', 0, 478, 60, 0, 0);
        $topsites_button_type = $this->custom_add_banner_type('topsites_button', 0, 120, 60, 0, 0);
        $rows = $db->query('SELECT * FROM ' . $table_prefix . 'topsite');
        foreach ($rows as $row) {
            $row['title'] = @html_entity_decode($row['title'], ENT_QUOTES, get_charset());
            $name = $row['title'] . strval($row['id']);
            $name = preg_replace('#^[\\_\\.\\-]#', 'x', preg_replace('#[^\\w\\.\\-]#', '_', $name));
            $name2 = $row['title'] . strval($row['id'] + 1);
            $test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $name));
            if (is_null($test)) {
                $type = 0;
                // Permanent
                $campaignremaining = 0;
                // Irrelevant
                $caption = $row['title'];
                $end_date = NULL;
                $old_url = $row['link'];
                $image_url = $row['banner'];
                $image_button_url = $row['banner2'];
                $site_email = $row['email'];
                if (get_forum_type() != 'ocf') {
                    ocf_over_msn();
                    $all_members = $GLOBALS['FORUM_DRIVER']->get_matching_members('');
                    ocf_over_local();
                    $email_address_map = array();
                    foreach ($all_members as $member) {
                        $email_address_map[$GLOBALS['FORUM_DRIVER']->pname_email($member)] = $GLOBALS['FORUM_DRIVER']->pname_id($member);
                    }
                    if (array_key_exists($site_email, $email_address_map)) {
                        $member = $email_address_map[$site_email];
                    } else {
                        $member = NULL;
                    }
                } else {
                    $member = $GLOBALS['FORUM_DB']->query_value_null_ok('f_members', 'id', array('m_email_address' => $site_email));
                }
                if (is_null($member)) {
                    $member = $row['id_member'];
                }
                ocf_over_msn();
                if (strlen($image_url) > 0) {
                    add_banner($name, $image_url, $caption, $caption, $campaignremaining, $old_url, 10, html_to_comcode($row['description']), 0, $end_date, $member, $row['validate'], $topsites_standard_type, NULL, 0, $row['click'], 0);
                }
                if (strlen($image_button_url) > 0) {
                    add_banner($name2, $image_button_url, $caption, $caption, $campaignremaining, $old_url, 10, html_to_comcode($row['description']), 0, $end_date, $member, $row['validate'], $topsites_button_type, NULL, 0, $row['click'], 0);
                }
                ocf_over_local();
            }
        }
        //create Top Sites page if it is not already created
        $topsites_panel = get_file_base() . '/site/pages/comcode_custom/' . get_site_default_lang() . '/topsites.txt';
        require_lang('banners');
        //ensure that there is custom left panel
        if (!file_exists($topsites_panel)) {
            $source_path = get_file_base() . '/site/pages/comcode/' . get_site_default_lang() . '/topsites.txt';
            if (file_exists($source_path)) {
                copy($source_path, $topsites_panel);
                fix_permissions($topsites_panel);
                sync_file($topsites_panel);
            } else {
                //create file
                $myfile = @fopen($topsites_panel, 'w');
                if ($myfile !== false) {
                    $page = <<<END
[title]{!banners:TOP_SITES}[/title]

[block="topsites_standard"]main_topsites[/block]

END;
                    fwrite($myfile, $page);
                    fclose($myfile);
                    fix_permissions($topsites_panel);
                    sync_file($topsites_panel);
                }
            }
        }
        add_menu_item_simple('main_features', NULL, 'TOP_SITES', 'site:topsites');
    }
Esempio n. 8
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_banners($db, $table_prefix, $old_base_dir)
 {
     require_code('banners');
     require_code('banners2');
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'banner b LEFT JOIN ' . $table_prefix . 'bannerclient c ON b.cid=c.cid');
     foreach ($rows as $row) {
         $name = $row['name'] . $row['bid'];
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $name));
         if (is_null($test)) {
             $type = 0;
             // Permanent
             $campaignremaining = 0;
             // Irrelevant
             $caption = $row['alttext'];
             $end_date = $this->mysql_time_to_timestamp($row['date']);
             $old_url = $row['clickurl'];
             $image_url = $row['imageurl'];
             $member = $GLOBALS['FORUM_DRIVER']->get_member_from_username($row['contact']);
             if (is_null($member)) {
                 $member = get_member();
             }
             add_banner($name, $image_url, '', $caption, $campaignremaining, $old_url, 10, $row['email'] . chr(10) . $row['extrainfo'], $type, $end_date, $member, $row['active'], '', NULL, 0, $row['clicks'], 0, $row['impmade']);
         }
     }
 }
Esempio n. 9
0
function do_work()
{
    $num_wanted = 100000;
    require_code('config2');
    set_option('post_history_days', '0');
    // Needed for a little sanity in recent post retrieval
    set_value('disable_sunk', '1');
    // members (remember to test the username autocompleter, and birthdays)
    // authors (remember to check author autocompleter and popup author list)
    // lots of people getting notifications on a forum
    // lots of people getting notifications on a topic
    require_code('authors');
    require_code('ocf_members_action');
    require_code('notifications');
    for ($i = $GLOBALS['FORUM_DB']->query_value('f_members', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $member_id = ocf_make_member(uniqid('', true), uniqid('', true), uniqid('', true) . '@example.com', array(), intval(date('d')), intval(date('m')), intval(date('Y')), array(), NULL, NULL, 1, NULL, NULL, '', NULL, '', 0, 0, 1, '', '', '', 1, 1, NULL, 1, 1, '', NULL, '', false);
        add_author(random_line(), '', $member_id, random_text(), random_text());
        enable_notifications('ocf_topic', 'forum:' . strval(db_get_first_id()), $member_id);
        enable_notifications('ocf_topic', strval(db_get_first_id()), $member_id);
        // number of friends to a single member
        $GLOBALS['SITE_DB']->query_insert('chat_buddies', array('member_likes' => $member_id, 'member_liked' => db_get_first_id() + 1, 'date_and_time' => time()), false, true);
    }
    $member_id = db_get_first_id() + 2;
    // point earn list / gift points to a single member
    require_code('points2');
    for ($j = $GLOBALS['SITE_DB']->query_value('gifts', 'COUNT(*)'); $j < $num_wanted; $j++) {
        give_points(10, $member_id, mt_rand(db_get_first_id(), min(100, $num_wanted - 1)), random_line(), false, false);
    }
    // number of friends of a single member
    for ($j = intval(floatval($GLOBALS['SITE_DB']->query_value('chat_buddies', 'COUNT(*)')) / 2.0); $j < $num_wanted; $j++) {
        $GLOBALS['SITE_DB']->query_insert('chat_buddies', array('member_likes' => $member_id, 'member_liked' => $j + db_get_first_id(), 'date_and_time' => time()), false, true);
    }
    echo 'done member/authors/points/notifications/friends stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // banners
    require_code('banners2');
    for ($i = $GLOBALS['SITE_DB']->query_value('banners', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_banner(uniqid('', true), get_logo_url(), random_line(), random_text(), 100, get_base_url(), 3, '', db_get_first_id(), NULL, db_get_first_id() + 1, 1);
    }
    echo 'done banner stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // comcode pages
    require_code('files');
    require_code('files2');
    for ($i = $GLOBALS['SITE_DB']->query_value('comcode_pages', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $file = uniqid('', true);
        /*$path=get_custom_file_base().'/site/pages/comcode_custom/'.fallback_lang().'/'.$file.'.txt';
        		$myfile=fopen($path,'wt');
        		fwrite($myfile,random_text());
        		fclose($myfile);
        		sync_file($path);
        		fix_permissions($path);*/
        $GLOBALS['SITE_DB']->query_insert('comcode_pages', array('the_zone' => 'site', 'the_page' => $file, 'p_parent_page' => '', 'p_validated' => 1, 'p_edit_date' => NULL, 'p_add_date' => time(), 'p_submitter' => db_get_first_id(), 'p_show_as_edit' => 0));
    }
    echo 'done comcode stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // zones
    require_code('zones2');
    require_code('abstract_file_manager');
    for ($i = $GLOBALS['SITE_DB']->query_value('zones', 'COUNT(*)'); $i < min($num_wanted, 1000); $i++) {
        actual_add_zone(uniqid('', true), random_line(), 'start', random_line(), 'default', 0, 0, 0);
    }
    echo 'done zone stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // calendar events
    require_code('calendar2');
    for ($i = $GLOBALS['SITE_DB']->query_value('calendar_events', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_calendar_event(db_get_first_id(), '', NULL, 0, random_line(), random_text(), 1, 1, intval(date('Y')), intval(date('m')), intval(date('d')), 0, 0);
    }
    echo 'done event stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // chat rooms
    require_code('chat2');
    require_code('chat');
    for ($i = $GLOBALS['SITE_DB']->query_value('chat_rooms', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $room_id = add_chatroom(random_text(), random_line(), mt_rand(db_get_first_id() + 1, $num_wanted - 1), strval(db_get_first_id() + 1), '', '', '', fallback_lang());
    }
    $room_id = db_get_first_id() + 1;
    // messages in chat room
    for ($j = $GLOBALS['SITE_DB']->query_value('chat_messages', 'COUNT(*)'); $j < $num_wanted; $j++) {
        $_message_parsed = insert_lang_comcode(random_text(), 4);
        $GLOBALS['SITE_DB']->query_insert('chat_messages', array('system_message' => 0, 'ip_address' => '', 'room_id' => $room_id, 'user_id' => db_get_first_id(), 'date_and_time' => time(), 'the_message' => $_message_parsed, 'text_colour' => get_option('chat_default_post_colour'), 'font_name' => get_option('chat_default_post_font')));
    }
    echo 'done chat stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // download categories under a subcategory
    require_code('downloads2');
    $subcat_id = add_download_category(random_line(), db_get_first_id(), random_text(), '');
    for ($i = $GLOBALS['SITE_DB']->query_value('download_categories', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_download_category(random_line(), $subcat_id, random_text(), '');
    }
    // downloads (remember to test content by the single author)
    require_code('downloads2');
    require_code('awards');
    $time = time();
    for ($i = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $content_id = add_download(db_get_first_id(), random_line(), get_logo_url(), random_text(), 'admin', random_text(), NULL, 1, 1, 1, 1, '', uniqid('', true) . '.jpg', 100, 110, 1);
        give_award(db_get_first_id(), strval($content_id), $time - $i);
    }
    $content_id = db_get_first_id();
    $content_url = build_url(array('page' => 'downloads', 'type' => 'entry', 'id' => $content_id), 'site');
    for ($j = $GLOBALS['SITE_DB']->query_value('trackbacks', 'COUNT(*)'); $j < $num_wanted; $j++) {
        // trackbacks
        $GLOBALS['SITE_DB']->query_insert('trackbacks', array('trackback_for_type' => 'downloads', 'trackback_for_id' => $content_id, 'trackback_ip' => '', 'trackback_time' => time(), 'trackback_url' => '', 'trackback_title' => random_line(), 'trackback_excerpt' => random_text(), 'trackback_name' => random_line()));
        // ratings
        $GLOBALS['SITE_DB']->query_insert('rating', array('rating_for_type' => 'downloads', 'rating_for_id' => $content_id, 'rating_member' => $j + 1, 'rating_ip' => '', 'rating_time' => time(), 'rating' => 3));
        // posts in a comment topic
        $GLOBALS['FORUM_DRIVER']->make_post_forum_topic(get_option('comments_forum_name'), 'downloads_' . strval($content_id), get_member(), random_text(), random_line(), '', do_lang('COMMENT'), $content_url->evaluate(), NULL, NULL, 1, 1);
    }
    echo 'done download stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // forums under a forum (don't test it can display, just make sure the main index still works)
    require_code('ocf_forums_action');
    for ($i = $GLOBALS['FORUM_DB']->query_value('f_forums', 'COUNT(*)'); $i < $num_wanted; $i++) {
        ocf_make_forum(random_line(), random_text(), db_get_first_id(), array(), db_get_first_id() + 3);
    }
    // forum topics
    require_code('ocf_topics_action');
    require_code('ocf_posts_action');
    require_code('ocf_forums');
    require_code('ocf_topics');
    for ($i = intval(floatval($GLOBALS['FORUM_DB']->query_value('f_topics', 'COUNT(*)')) / 2.0); $i < $num_wanted; $i++) {
        $topic_id = ocf_make_topic(db_get_first_id(), '', '', NULL, 1, 0, 0, 0, NULL, NULL, false);
        ocf_make_post($topic_id, random_line(), random_text(), 0, true, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, false, false);
    }
    // forum posts in a topic
    require_code('ocf_topics_action');
    require_code('ocf_posts_action');
    $topic_id = ocf_make_topic(db_get_first_id() + 1, '', '', NULL, 1, 0, 0, 0, NULL, NULL, false);
    for ($i = intval(floatval($GLOBALS['FORUM_DB']->query_value('f_posts', 'COUNT(*)')) / 3.0); $i < $num_wanted; $i++) {
        ocf_make_post($topic_id, random_line(), random_text(), 0, true, 0, 0, NULL, NULL, NULL, mt_rand(db_get_first_id(), $num_wanted - 1), NULL, NULL, NULL, false, false);
    }
    echo 'done forum stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // clubs
    require_code('ocf_groups_action');
    require_code('ocf_groups');
    for ($i = $GLOBALS['FORUM_DB']->query_value('f_groups', 'COUNT(*)'); $i < $num_wanted; $i++) {
        ocf_make_group(random_line(), 0, 0, 0, random_line(), '', NULL, NULL, NULL, 5, 0, 70, 50, 100, 100, 30000, 700, 25, 1, 0, 0, 0, $i, 1, 0, 1);
    }
    echo 'done club stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // galleries under a subcategory
    require_code('galleries2');
    $xsubcat_id = uniqid('', true);
    add_gallery($xsubcat_id, random_line(), random_text(), '', '', 'root');
    for ($i = $GLOBALS['SITE_DB']->query_value('galleries', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_gallery(uniqid('', true), random_line(), random_text(), '', '', $xsubcat_id);
    }
    // images
    require_code('galleries2');
    for ($i = $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_image('', 'root', random_text(), get_logo_url(), get_logo_url(), 1, 1, 1, 1, '');
    }
    // videos / validation queue
    require_code('galleries2');
    for ($i = $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_video('', 'root', random_text(), get_logo_url(), get_logo_url(), 0, 1, 1, 1, '', 0, 0, 0);
    }
    echo 'done galleries stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // newsletter subscribers
    require_code('newsletter');
    for ($i = $GLOBALS['SITE_DB']->query_value('newsletter', 'COUNT(*)'); $i < $num_wanted; $i++) {
        basic_newsletter_join(uniqid('', true) . '@example.com');
    }
    echo 'done newsletter stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // polls (remember to test poll archive)
    require_code('polls');
    for ($i = $GLOBALS['SITE_DB']->query_value('poll', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $poll_id = add_poll(random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), random_line(), 10, 0, 0, 0, 0, '');
    }
    // votes on a poll
    $poll_id = db_get_first_id();
    for ($j = $GLOBALS['SITE_DB']->query_value('poll_votes', 'COUNT(*)'); $j < $num_wanted; $j++) {
        $cast = mt_rand(1, 6);
        $ip = uniqid('', true);
        $GLOBALS['SITE_DB']->query_insert('poll_votes', array('v_poll_id' => $poll_id, 'v_voter_id' => 2, 'v_voter_ip' => $ip, 'v_vote_for' => $cast));
    }
    echo 'done polls stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // quizzes
    require_code('quiz');
    for ($i = $GLOBALS['SITE_DB']->query_value('quizzes', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_quiz(random_line(), 0, random_text(), random_text(), random_text(), '', 0, time(), NULL, 3, 300, 'SURVEY', 1, '1) Some question');
    }
    echo 'done quizzes stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // successful searches (to test the search recommender)
    // ACTUALLY: I have manually verified the code, it is an isolated portion
    // cedi pages (do a long descendant tree for some, and orphans for others)
    // cedi posts (remember to test cedi changes screen)
    require_code('cedi');
    for ($i = $GLOBALS['SITE_DB']->query_value('seedy_pages', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $page_id = cedi_add_page(random_line(), random_text(), '', 1);
        cedi_add_post($page_id, random_text(), 1, NULL, false);
    }
    echo 'done cedi stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // iotds
    require_code('iotds');
    for ($i = $GLOBALS['SITE_DB']->query_value('iotd', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_iotd(get_logo_url(), random_line(), random_text(), get_logo_url(), 1, 0, 0, 0, '');
    }
    echo 'done iotd stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // logged hack attempts
    for ($i = $GLOBALS['SITE_DB']->query_value('hackattack', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $GLOBALS['SITE_DB']->query_insert('hackattack', array('url' => get_base_url(), 'data_post' => '', 'user_agent' => '', 'referer' => '', 'user_os' => '', 'the_user' => db_get_first_id(), 'date_and_time' => time(), 'ip' => uniqid('', true), 'reason' => 'ASCII_ENTITY_URL_HACK', 'reason_param_a' => '', 'reason_param_b' => ''));
    }
    // logged hits in one day
    require_code('site');
    for ($i = $GLOBALS['SITE_DB']->query_value('stats', 'COUNT(*)'); $i < $num_wanted; $i++) {
        log_stats('/testing' . uniqid('', true), mt_rand(100, 2000));
    }
    echo 'done logs stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // blogs and news entries (remember to test both blogs [categories] list, and a list of all news entries)
    require_code('news');
    for ($i = $GLOBALS['SITE_DB']->query_value('news', 'COUNT(*)'); $i < $num_wanted; $i++) {
        add_news(random_line(), random_text(), 'admin', 1, 1, 1, 1, '', random_text(), NULL, NULL, NULL, db_get_first_id() + $i);
    }
    echo 'done news stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // support tickets
    require_code('tickets');
    require_code('tickets2');
    for ($i = intval(floatval($GLOBALS['FORUM_DB']->query_value('f_topics', 'COUNT(*)')) / 2.0); $i < $num_wanted; $i++) {
        ticket_add_post(mt_rand(db_get_first_id(), $num_wanted - 1), uniqid('', true), db_get_first_id(), random_line(), random_text(), '', '');
    }
    echo 'done tickets stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // catalogues
    require_code('catalogues2');
    $root_id = db_get_first_id();
    for ($i = $GLOBALS['SITE_DB']->query_value('catalogues', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $catalogue_name = uniqid('', true);
        $root_id = actual_add_catalogue($catalogue_name, random_line(), random_text(), mt_rand(0, 3), 1, '', 30);
    }
    // catalogue categories under a subcategory (remember to test all catalogue views: atoz, index, and root cat)
    $catalogue_name = 'products';
    $subcat_id = actual_add_catalogue_category($catalogue_name, random_line(), random_text(), '', $root_id);
    for ($j = $GLOBALS['SITE_DB']->query_value('catalogue_categories', 'COUNT(*)'); $j < $num_wanted; $j++) {
        actual_add_catalogue_category($catalogue_name, random_line(), random_text(), '', $subcat_id);
    }
    echo 'done catalogue stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    // items in ecommerce store
    require_code('catalogues2');
    $cat_id = $GLOBALS['SITE_DB']->query_value('catalogue_categories', 'MIN(id)', array('c_name' => 'products'));
    $fields = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query_select('catalogue_fields', array('id'), array('c_name' => 'products')));
    for ($i = $GLOBALS['SITE_DB']->query_value('catalogue_entries', 'COUNT(*)'); $i < $num_wanted; $i++) {
        $map = array($fields[0] => random_line(), $fields[1] => uniqid('', true), $fields[2] => '1.0', $fields[3] => '1', $fields[4] => '0', $fields[5] => '1', $fields[6] => '0%', $fields[7] => get_logo_url(), $fields[8] => '2.0', $fields[9] => random_text());
        $pid = actual_add_catalogue_entry($cat_id, 1, '', 1, 1, 1, $map);
        unset($map);
    }
    // outstanding ecommerce orders
    $pid = $GLOBALS['SITE_DB']->query_value('catalogue_entries', 'MIN(id)', array('c_name' => 'products'));
    require_code('shopping');
    for ($j = $GLOBALS['SITE_DB']->query_value('shopping_cart', 'COUNT(*)'); $j < $num_wanted; $j++) {
        $product_det = array('product_id' => $pid, 'product_name' => $fields[0], 'product_code' => $fields[1], 'price' => $fields[2], 'tax' => preg_replace('#[^\\d\\.]#', '', $fields[6]), 'description' => $fields[9], 'quantity' => mt_rand(1, 20), 'product_type' => 'catalogue_items', 'product_weight' => $fields[8]);
        $GLOBALS['SITE_DB']->query_insert('shopping_cart', array('session_id' => mt_rand(0, 1000000), 'ordered_by' => mt_rand(db_get_first_id() + 1, $num_wanted - 1), 'product_id' => $product_det['product_id'], 'product_name' => $product_det['product_name'], 'product_code' => $product_det['product_code'], 'quantity' => $product_det['quantity'], 'price' => round(floatval($product_det['price']), 2), 'price_pre_tax' => $product_det['tax'], 'product_description' => $product_det['description'], 'product_type' => $product_det['product_type'], 'product_weight' => $product_det['product_weight'], 'is_deleted' => 0));
    }
    for ($j = $GLOBALS['SITE_DB']->query_value('shopping_order', 'COUNT(*)'); $j < $num_wanted; $j++) {
        $order_id = $GLOBALS['SITE_DB']->query_insert('shopping_order', array('c_member' => mt_rand(db_get_first_id() + 1, $num_wanted - 1), 'session_id' => mt_rand(0, 1000000), 'add_date' => time(), 'tot_price' => '123.00', 'order_status' => 'ORDER_STATUS_awaiting_payment', 'notes' => '', 'purchase_through' => 'purchase_module', 'transaction_id' => '', 'tax_opted_out' => 0), true);
        $GLOBALS['SITE_DB']->query_insert('shopping_order_details', array('p_id' => 123, 'p_name' => random_line(), 'p_code' => 123, 'p_type' => 'catalogue_items', 'p_quantity' => 1, 'p_price' => '12.00', 'order_id' => $order_id, 'dispatch_status' => '', 'included_tax' => '1.00'));
    }
    echo 'done store stuff' . chr(10);
    if (function_exists('gc_collect_cycles')) {
        gc_enable();
    }
    echo '{{DONE}}' . chr(10);
}
Esempio n. 10
0
################ Banner Löschen ################
if($subpage=="del") {
include("core/del_banner.htm");
if($pagesite=="YES") {
del_banner($pageid);
echo"<meta http-equiv='refresh' content='0; URL=index.php?s=banner'>";
}
}


################ Banner hinzufügen #############
if($subpage=="add") {
include("core/add_banner.htm");
if($pagesite=="YES") {
add_banner($bt,$bc,$ba,$bn,$bp);
echo"<meta http-equiv='refresh' content='0; URL=index.php?s=banner'>";
}
}


################ Banner bearbeiten ############
if($subpage=="work") {
$bid=get_banner_data_id("bannerid",$pageid);
$baktiv=get_banner_data_id("aktiv",$pageid);
$btyp=get_banner_data_id("bannertyp",$pageid);
$bname=get_banner_data_id("name",$pageid);
$bpartner=get_banner_data_id("partner",$pageid);
$bcode=get_banner_data_id("bannercode",$pageid);
include("core/work_banner.htm");
if($pagesite=="YES") {
Esempio n. 11
0
     BannerChange($bid, $cid, $adname, $imptotal, $impadded, $imageurl, $clickurl, $alttext, $position, $active, $ad_code, $ad_width, $ad_height, $impmade);
     break;
 case "BannerClientDelete":
     BannerClientDelete($cid, $ok);
     break;
 case "BannerClientEdit":
     BannerClientEdit($cid);
     break;
 case "BannerClientChange":
     BannerClientChange($cid, $name, $contact, $email, $extrainfo, $login, $passwd);
     break;
 case "BannerStatus":
     BannerStatus($bid, $status);
     break;
 case "add_banner":
     add_banner();
     break;
 case "add_client":
     add_client();
     break;
 case "ad_positions":
     ad_positions();
     break;
 case "position_save":
     position_save($apid, $ad_position_number, $ad_position_name, $position_new);
     break;
 case "position_edit":
     position_edit($apid);
     break;
 case "position_delete":
     position_delete($apid, $ok, $active, $new_pos);