Esempio n. 1
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)
 {
     require_lang('reportcontent');
     $GLOBALS['SITE_DB']->create_table('reported_content', array('r_session_id' => '*AUTO_LINK', 'r_content_type' => '*ID_TEXT', 'r_content_id' => '*ID_TEXT', 'r_counts' => 'BINARY'));
     $GLOBALS['SITE_DB']->create_index('reported_content', 'reported_already', array('r_content_type', 'r_content_id'));
     add_config_option('REPORTED_TIMES', 'reported_times', 'integer', 'return \'3\';', 'FEATURE', 'REPORT_CONTENT');
 }
Esempio n. 2
0
 /**
  * Standard interface stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function action()
 {
     require_code('database_action');
     $class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
     //if (get_option('is_on_'.$class.'_buy')=='0') return new ocp_tempcode();
     $tablename_exists = $GLOBALS['SITE_DB']->table_exists('bank');
     if (!$tablename_exists) {
         $GLOBALS['SITE_DB']->create_table('bank', array('id' => '*AUTO', 'user_id' => 'INTEGER', 'amount' => 'INTEGER', 'divident' => 'INTEGER', 'add_time' => '?TIME'));
     }
     $_bank_dividend = get_option('bank_divident', true);
     if (is_null($_bank_dividend)) {
         //add option and default value
         add_config_option('BANK_DIVIDEND', 'bank_divident', 'integer', 'return \'40\';', 'POINTSTORE', 'BANKING');
         // TODO: Fix spelling
         // IDEA: Make 30 days a config option too, or even have multiple products?
         // IDEA: Send email saying bank returned money?
         // IDEA: Have the bank do marketing to people? http://ocportal.com/forum/topicview/misc/addons/ocbank_4.htm?redirected=1#post_87711
         $bank_dividend = 4;
     } else {
         $bank_dividend = intval($_bank_dividend);
     }
     $title = get_page_title('BANKING');
     $points_left = available_points(get_member());
     $next_url = build_url(array('page' => '_SELF', 'type' => 'action_done', 'id' => $class), '_SELF');
     // Check points
     if ($points_left < 0 && !has_specific_permission(get_member(), 'give_points_self')) {
         return warn_screen($title, do_lang_tempcode('_CANT_AFFORD_BANK'));
     }
     require_code('form_templates');
     $fields = new ocp_tempcode();
     $fields->attach(form_input_integer(do_lang_tempcode('AMOUNT'), do_lang_tempcode('DESCRIPTION_BANK_AMOUNT', integer_format($points_left)), 'amount', $points_left, true));
     $text = do_lang_tempcode('BANK_A', integer_format($points_left));
     return do_template('FORM_SCREEN', array('_GUID' => 'ae703225db618f2bc938290fbae4d6d8', 'TITLE' => $title, 'TEXT' => $text, 'URL' => $next_url, 'FIELDS' => $fields, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('PROCEED')));
 }
Esempio n. 3
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 < 3) {
         add_config_option('SHOW_NEWEST_MEMBER', 'usersonline_show_newest_member', 'tick', 'return ((has_no_forum()) || (get_forum_type()!=\'ocf\'))?NULL:\'0\';', 'BLOCKS', 'USERS_ONLINE_BLOCK');
         add_config_option('BIRTHDAYS', 'usersonline_show_birthdays', 'tick', 'return ((has_no_forum()) || (get_forum_type()!=\'ocf\'))?NULL:\'0\';', 'BLOCKS', 'USERS_ONLINE_BLOCK');
     }
 }
Esempio n. 4
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)) {
         $GLOBALS['SITE_DB']->create_table('leader_board', array('lb_member' => '*USER', 'lb_points' => 'INTEGER', 'date_and_time' => '*TIME'));
     }
     if (is_null($upgrade_from) || $upgrade_from < 3) {
         add_config_option('LEADERBOARD_START_DATE', 'leaderboard_start_date', 'date', 'return strval(filemtime(get_file_base().\'/index.php\'));', 'POINTS', 'POINT_LEADERBOARD');
     }
 }
Esempio n. 5
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 ($upgrade_from == 2) {
         set_option('supermembers_text', '[html]' . get_option('supermembers_text') . '[/html]');
         return;
     }
     add_config_option('PAGE_TEXT', 'supermembers_text', 'transtext', 'return do_lang(\'SUPERMEMBERS_TEXT\');', 'SECURITY', 'SUPER_MEMBERS');
     require_lang('supermembers');
     add_menu_item_simple('collab_website', NULL, 'SUPER_MEMBERS', '_SEARCH:supermembers');
 }
Esempio n. 6
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)
 {
     $GLOBALS['SITE_DB']->create_table('test_sections', array('id' => '*AUTO', 's_section' => 'SHORT_TEXT', 's_notes' => 'LONG_TEXT', 's_inheritable' => 'BINARY', 's_assigned_to' => '?USER'));
     $GLOBALS['SITE_DB']->create_table('tests', array('id' => '*AUTO', 't_section' => 'AUTO_LINK', 't_test' => 'LONG_TEXT', 't_assigned_to' => '?USER', 't_enabled' => 'BINARY', 't_status' => 'INTEGER', 't_inherit_section' => '?AUTO_LINK'));
     add_specific_permission('TESTER', 'perform_tests', false);
     add_specific_permission('TESTER', 'add_tests', true);
     add_specific_permission('TESTER', 'edit_own_tests', true);
     add_config_option('TESTER_FORUM_NAME', 'tester_forum_name', 'forum', 'return do_lang(\'DEFAULT_TESTER_FORUM\');', 'FEATURE', 'TESTER');
     add_config_option('BUG_REPORT_TEXT', 'bug_report_text', 'text', 'return do_lang(\'DEFAULT_BUG_REPORT_TEMPLATE\');', 'FEATURE', 'TESTER');
 }
Esempio n. 7
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)) {
         add_config_option('BLOCK_CACHE', 'is_on_block_cache', 'tick', 'return $GLOBALS[\'SEMI_DEBUG_MODE\']?\'0\':\'1\';', 'SITE', 'CACHES', 1);
         add_config_option('TEMPLATE_CACHE', 'is_on_template_cache', 'tick', 'return \'1\';', 'SITE', 'CACHES', 1);
         add_config_option('COMCODE_PAGE_CACHE', 'is_on_comcode_page_cache', 'tick', 'return \'1\';', 'SITE', 'CACHES', 1);
     }
     if (is_null($upgrade_from) || $upgrade_from < 3) {
         add_config_option('LANGUAGE_CACHE', 'is_on_lang_cache', 'tick', 'return \'1\';', 'SITE', 'CACHES', 1);
     }
 }
Esempio n. 8
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)) {
         $GLOBALS['SITE_DB']->create_table('poll', array('id' => '*AUTO', 'question' => 'SHORT_TRANS', 'option1' => 'SHORT_TRANS', 'option2' => 'SHORT_TRANS', 'option3' => '?SHORT_TRANS', 'option4' => '?SHORT_TRANS', 'option5' => '?SHORT_TRANS', 'option6' => '?SHORT_TRANS', 'option7' => '?SHORT_TRANS', 'option8' => '?SHORT_TRANS', 'option9' => '?SHORT_TRANS', 'option10' => '?SHORT_TRANS', 'votes1' => 'INTEGER', 'votes2' => 'INTEGER', 'votes3' => 'INTEGER', 'votes4' => 'INTEGER', 'votes5' => 'INTEGER', 'votes6' => 'INTEGER', 'votes7' => 'INTEGER', 'votes8' => 'INTEGER', 'votes9' => 'INTEGER', 'votes10' => 'INTEGER', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'allow_trackbacks' => 'BINARY', 'notes' => 'LONG_TEXT', 'num_options' => 'SHORT_INTEGER', 'is_current' => 'BINARY', 'date_and_time' => '?TIME', 'submitter' => 'USER', 'add_time' => 'INTEGER', 'poll_views' => 'INTEGER', 'edit_date' => '?TIME'));
         $GLOBALS['SITE_DB']->create_index('poll', 'poll_views', array('poll_views'));
         $GLOBALS['SITE_DB']->create_index('poll', 'get_current', array('is_current'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ps', array('submitter'));
         $GLOBALS['SITE_DB']->create_index('poll', 'padd_time', array('add_time'));
         $GLOBALS['SITE_DB']->create_index('poll', 'date_and_time', array('date_and_time'));
         add_specific_permission('POLLS', 'choose_poll', false);
         add_config_option('ADD_POLL', 'points_ADD_POLL', 'integer', 'return addon_installed(\'points\')?\'150\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('CHOOSE_POLL', 'points_CHOOSE_POLL', 'integer', 'return addon_installed(\'points\')?\'35\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('POLL_REGULARITY', 'poll_update_time', 'integer', 'return \'168\';', 'ADMIN', 'CHECK_LIST');
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_pq', array('question'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_po1', array('option1'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_po2', array('option2'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_po3', array('option3'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_po4', array('option4'));
         $GLOBALS['SITE_DB']->create_index('poll', 'ftjoin_po5', array('option5'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 3) {
         $GLOBALS['SITE_DB']->add_table_field('poll', 'allow_trackbacks', 'BINARY', 1);
     }
     if (!is_null($upgrade_from) && $upgrade_from < 4) {
         $GLOBALS['SITE_DB']->add_table_field('poll', 'option6', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('poll', 'option7', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('poll', 'option8', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('poll', 'option9', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('poll', 'option10', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('poll', 'votes6', 'INTEGER', 0);
         $GLOBALS['SITE_DB']->add_table_field('poll', 'votes7', 'INTEGER', 0);
         $GLOBALS['SITE_DB']->add_table_field('poll', 'votes8', 'INTEGER', 0);
         $GLOBALS['SITE_DB']->add_table_field('poll', 'votes9', 'INTEGER', 0);
         $GLOBALS['SITE_DB']->add_table_field('poll', 'votes10', 'INTEGER', 0);
     }
     if (is_null($upgrade_from) || $upgrade_from < 5) {
         $GLOBALS['SITE_DB']->create_table('poll_votes', array('id' => '*AUTO', 'v_poll_id' => 'AUTO_LINK', 'v_voter_id' => '?USER', 'v_voter_ip' => 'IP', 'v_vote_for' => '?SHORT_INTEGER'));
         $GLOBALS['SITE_DB']->create_index('poll_votes', 'v_voter_id', array('v_voter_id'));
         $GLOBALS['SITE_DB']->create_index('poll_votes', 'v_voter_ip', array('v_voter_ip'));
         $GLOBALS['SITE_DB']->create_index('poll_votes', 'v_vote_for', array('v_vote_for'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 5) {
         $polls = $GLOBALS['SITE_DB']->query_select('poll', array('id', 'ip'));
         foreach ($polls as $poll) {
             $voters = explode('-', $poll['ip']);
             foreach ($voters as $voter) {
                 $GLOBALS['SITE_DB']->query_insert('poll_votes', array('v_poll_id' => $poll['id'], 'v_voter_id' => is_numeric($voter) ? intval($voter) : NULL, 'v_voter_ip' => is_numeric($voter) ? '' : $voter, 'v_vote_for' => NULL));
             }
         }
         $GLOBALS['SITE_DB']->delete_table_field('poll', 'ip');
     }
 }
Esempio n. 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)) {
         $GLOBALS['SITE_DB']->create_table('text', array('id' => '*AUTO', 'user_id' => 'USER', 'the_message' => 'SHORT_TRANS', 'days' => 'INTEGER', 'order_time' => 'TIME', 'activation_time' => '?TIME', 'active_now' => 'BINARY', 'notes' => 'LONG_TEXT'));
         $GLOBALS['SITE_DB']->create_index('text', 'findflagrant', array('active_now'));
         add_config_option('SYSTEM_FLAGRANT', 'system_flagrant', 'transline', 'return \'\';', 'SITE', 'GENERAL');
     } else {
         if ($upgrade_from < 3) {
             delete_config_option('system_flagrant');
             add_config_option('SYSTEM_FLAGRANT', 'system_flagrant', 'transline', 'return \'\';', 'SITE', 'GENERAL');
         }
     }
 }
Esempio n. 10
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)
 {
     $GLOBALS['SITE_DB']->create_table('bookable', array('id' => '*AUTO', 'title' => 'SHORT_TRANS', 'description' => 'LONG_TRANS', 'price' => 'REAL', 'categorisation' => 'SHORT_TRANS', 'cycle_type' => 'ID_TEXT', 'cycle_pattern' => 'SHORT_TEXT', 'user_may_choose_code' => 'BINARY', 'supports_notes' => 'BINARY', 'dates_are_ranges' => 'BINARY', 'calendar_type' => '?AUTO_LINK', 'add_date' => 'TIME', 'edit_date' => '?TIME', 'submitter' => 'USER', 'sort_order' => 'INTEGER', 'enabled' => 'BINARY', 'active_from_day' => 'SHORT_INTEGER', 'active_from_month' => 'SHORT_INTEGER', 'active_from_year' => 'INTEGER', 'active_to_day' => '?SHORT_INTEGER', 'active_to_month' => '?SHORT_INTEGER', 'active_to_year' => '?INTEGER'));
     $GLOBALS['SITE_DB']->create_table('bookable_blacked', array('id' => '*AUTO', 'blacked_from_day' => 'SHORT_INTEGER', 'blacked_from_month' => 'SHORT_INTEGER', 'blacked_from_year' => 'INTEGER', 'blacked_to_day' => 'SHORT_INTEGER', 'blacked_to_month' => 'SHORT_INTEGER', 'blacked_to_year' => 'INTEGER', 'blacked_explanation' => 'LONG_TRANS'));
     $GLOBALS['SITE_DB']->create_table('bookable_blacked_for', array('bookable_id' => '*AUTO_LINK', 'blacked_id' => '*AUTO_LINK'));
     $GLOBALS['SITE_DB']->create_table('bookable_codes', array('bookable_id' => '*AUTO_LINK', 'code' => '*ID_TEXT'));
     $GLOBALS['SITE_DB']->create_table('bookable_supplement', array('id' => '*AUTO', 'price' => 'REAL', 'price_is_per_period' => 'BINARY', 'supports_quantities' => 'BINARY', 'title' => 'SHORT_TRANS', 'promo_code' => 'ID_TEXT', 'supports_notes' => 'BINARY', 'sort_order' => 'INTEGER'));
     $GLOBALS['SITE_DB']->create_table('bookable_supplement_for', array('supplement_id' => '*AUTO_LINK', 'bookable_id' => '*AUTO_LINK'));
     $GLOBALS['SITE_DB']->create_table('booking', array('id' => '*AUTO', 'bookable_id' => 'AUTO_LINK', 'member_id' => 'USER', 'b_day' => 'SHORT_INTEGER', 'b_month' => 'SHORT_INTEGER', 'b_year' => 'INTEGER', 'code_allocation' => 'ID_TEXT', 'notes' => 'LONG_TEXT', 'booked_at' => 'TIME', 'paid_at' => '?TIME', 'paid_trans_id' => '?AUTO_LINK'));
     $GLOBALS['SITE_DB']->create_table('booking_supplement', array('booking_id' => '*AUTO_LINK', 'supplement_id' => '*AUTO_LINK', 'quantity' => 'INTEGER', 'notes' => 'LONG_TEXT'));
     add_config_option('BOOKINGS_SHOW_WARNINGS_FOR_MONTHS', 'bookings_show_warnings_for_months', 'integer', 'return \'6\';', 'FEATURE', 'BOOKINGS');
     add_config_option('BOOKINGS_MAX_AHEAD_MONTHS', 'bookings_max_ahead_months', 'integer', 'return \'36\';', 'FEATURE', 'BOOKINGS');
 }
Esempio n. 11
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)
 {
     // TODO: This is actually for the 'syndication' addon
     if (is_null($upgrade_from)) {
         add_config_option('ENABLE_RSS', 'is_on_rss', 'tick', 'return \'1\';', 'FEATURE', 'NEWS_AND_RSS');
         add_config_option('UPDATE_TIME', 'rss_update_time', 'integer', 'return \'60\';', 'FEATURE', 'NEWS_AND_RSS');
     }
     if ($upgrade_from < 3 || is_null($upgrade_from)) {
         add_config_option('ENABLE_RSS_ADVERTISING', 'is_rss_advertised', 'tick', 'return \'0\';', 'FEATURE', 'NEWS_AND_RSS');
         delete_config_option('rss_side_max_entries');
         delete_config_option('rss_max_entries');
     }
 }
Esempio n. 12
0
 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     //if (!addon_installed('octhief')) return;
     require_lang('insults');
     // ensure it is done once per week
     $time = time();
     $last_time = intval(get_value('last_insult_time'));
     if ($last_time > time() - 24 * 60 * 60) {
         return;
     }
     // run it once a day
     set_value('last_insult_time', strval($time));
     // how many points a correct response will give
     $_insult_points = get_option('insult_points', true);
     if (is_null($_insult_points)) {
         // add option and default value if not installed yet
         require_code('database_action');
         add_config_option('INSULT_POINTS', 'insult_points', 'integer', 'return \'10\';', 'POINTS', 'INSULT_TITLE');
     }
     $insult_points = isset($_insult_points) && is_numeric($_insult_points) ? intval($_insult_points) : 10;
     // who to insult?
     $selected_members = $GLOBALS['FORUM_DB']->query('SELECT id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE  id <> ' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' ORDER BY RAND( ) ', 2, NULL, true);
     $selected_member1 = isset($selected_members[0]['id']) && $selected_members[0]['id'] > 0 ? $selected_members[0]['id'] : 0;
     $selected_member2 = isset($selected_members[1]['id']) && $selected_members[1]['id'] > 0 ? $selected_members[1]['id'] : 0;
     // send insult to picked members
     if ($selected_member1 != 0 && $selected_member2 != 0) {
         $get_insult = '';
         if (is_file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt')) {
             $insults = file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt');
             $insults_array = array();
             foreach ($insults as $insult) {
                 $x = explode('=', $insult);
                 $insults_array[] = $x[0];
             }
             $rand_key = array_rand($insults_array, 1);
             $rand_key = is_array($rand_key) ? $rand_key[0] : $rand_key;
             $get_insult = $insults_array[$rand_key];
         }
         if ($get_insult != '') {
             global $SITE_INFO;
             $insult_pt_topic_post = do_lang('INSULT_EXPLANATION', get_site_name(), $get_insult, $insult_points);
             $subject = do_lang('INSULT_PT_TOPIC', $GLOBALS['FORUM_DRIVER']->get_username($selected_member2), $GLOBALS['FORUM_DRIVER']->get_username($selected_member1));
             require_code('ocf_topics_action');
             $topic_id = ocf_make_topic(NULL, $subject, '', 1, 1, 0, 0, 0, $selected_member2, $selected_member1, true, 0, NULL, '');
             require_code('ocf_posts_action');
             $post_id = ocf_make_post($topic_id, $subject, $insult_pt_topic_post, 0, true, 1, 0, do_lang('SYSTEM'), NULL, NULL, $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, NULL, NULL, false, true, NULL, true, $subject, 0, NULL, true, true, true);
             require_code('ocf_topics_action2');
             send_pt_notification($post_id, $subject, $topic_id, $selected_member2, $selected_member1);
         }
     }
 }
Esempio n. 13
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)
 {
     require_lang('recommend');
     if (is_null($upgrade_from)) {
         add_config_option('RECOMMEND_SITE', 'points_RECOMMEND_SITE', 'integer', 'return addon_installed(\'points\')?\'350\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 3) {
         delete_menu_item_simple('_SEARCH:recommend:from={$REPLACE&,:,%3A,{$SELF_URL}}');
         delete_menu_item_simple('_SEARCH:recommend:from={$REPLACE,:,%3A,{$SELF_URL&,0,0,0,from=<null>}}');
     }
     if (is_null($upgrade_from) || $upgrade_from < 3) {
         add_menu_item_simple('root_website', NULL, 'RECOMMEND_SITE', '_SEARCH:recommend:from={$SELF_URL&,0,0,0,from=<null>}');
     }
 }
Esempio n. 14
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)) {
         $usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
         foreach (array_keys($usergroups) as $id) {
             $GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'admin_occle', 'zone_name' => 'adminzone', 'group_id' => $id));
             // OcCLE very dangerous
         }
         $GLOBALS['SITE_DB']->create_table('occlechat', array('id' => '*AUTO', 'c_message' => 'LONG_TEXT', 'c_url' => 'URLPATH', 'c_incoming' => 'BINARY', 'c_timestamp' => 'TIME'));
         add_config_option('OCCLE_CHAT_ANNOUNCE', 'occle_chat_announce', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
     }
     if (is_null($upgrade_from) || $upgrade_from < 2) {
         add_config_option('OCCLE_BUTTON', 'bottom_show_occle_button', 'tick', 'return (get_file_base()!=get_custom_file_base())?\'0\':\'1\';', 'FEATURE', 'BOTTOM_LINKS');
     }
 }
Esempio n. 15
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)
 {
     add_config_option('_MESSAGING_FORUM_NAME', 'messaging_forum_name', 'forum', 'return do_lang(\'MESSAGING_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'CONTACT_US_MESSAGING');
     if (get_forum_type() == 'ocf' && !running_script('upgrader')) {
         $moderator_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups();
         $staff_access = array();
         foreach ($moderator_groups as $id) {
             $staff_access[$id] = 5;
         }
         ocf_require_all_forum_stuff();
         require_code('ocf_forums_action');
         require_code('ocf_forums_action2');
         $GLOBALS['OCF_DRIVER'] = $GLOBALS['FORUM_DRIVER'];
         ocf_make_forum(do_lang('MESSAGING_FORUM_NAME'), '', db_get_first_id() + 1, $staff_access, db_get_first_id());
     }
 }
Esempio n. 16
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)) {
         // Note: We have chosen not to create many indices because we want insertion to be very fast
         $GLOBALS['SITE_DB']->create_table('stats', array('id' => '*AUTO', 'the_page' => 'SHORT_TEXT', 'ip' => 'IP', 'the_user' => 'USER', 'date_and_time' => 'TIME', 'referer' => 'URLPATH', 's_get' => 'URLPATH', 'post' => 'LONG_TEXT', 'browser' => 'SHORT_TEXT', 'milliseconds' => 'INTEGER', 'operating_system' => 'SHORT_TEXT', 'access_denied_counter' => 'INTEGER'));
         $GLOBALS['SITE_DB']->create_index('stats', 'member_track_1', array('the_user'));
         $GLOBALS['SITE_DB']->create_index('stats', 'member_track_2', array('ip'));
         $GLOBALS['SITE_DB']->create_index('stats', 'pages', array('the_page'));
         $GLOBALS['SITE_DB']->create_index('stats', 'date_and_time', array('date_and_time'));
         $GLOBALS['SITE_DB']->create_index('stats', 'milliseconds', array('milliseconds'));
         $GLOBALS['SITE_DB']->create_index('stats', 'referer', array('referer'));
         $GLOBALS['SITE_DB']->create_index('stats', 'browser', array('browser'));
         $GLOBALS['SITE_DB']->create_index('stats', 'operating_system', array('operating_system'));
         $GLOBALS['SITE_DB']->create_table('usersonline_track', array('date_and_time' => '*TIME', 'peak' => 'INTEGER'));
         $GLOBALS['SITE_DB']->create_index('usersonline_track', 'peak_track', array('peak'));
         add_config_option('SUPER_LOGGING', 'super_logging', 'tick', 'return \'1\';', 'SITE', 'LOGGING', 1);
     }
     if (is_null($upgrade_from) || $upgrade_from < 5) {
         add_config_option('STORE_TIME', 'stats_store_time', 'integer', 'return \'124\';', 'SITE', 'LOGGING', 1);
         $GLOBALS['SITE_DB']->create_table('ip_country', array('id' => '*AUTO', 'begin_num' => 'UINTEGER', 'end_num' => 'UINTEGER', 'country' => 'SHORT_TEXT'));
     }
     if (!is_null($upgrade_from)) {
         if ($upgrade_from < 3) {
             $GLOBALS['SITE_DB']->add_table_field('stats', 'milliseconds', 'INTEGER');
         }
         if ($upgrade_from < 4) {
             $GLOBALS['SITE_DB']->create_index('stats', 'pages', array('the_page'));
         }
         if ($upgrade_from < 5) {
             $GLOBALS['SITE_DB']->add_table_field('stats', 'browser', 'SHORT_TEXT');
             $GLOBALS['SITE_DB']->add_table_field('stats', 'operating_system', 'SHORT_TEXT');
             $GLOBALS['SITE_DB']->add_table_field('zones', 'access_denied_counter', 'INTEGER');
         }
         if ($upgrade_from < 6) {
             $GLOBALS['SITE_DB']->alter_table_field('stats', 'the_page', 'SHORT_TEXT');
         }
         if ($upgrade_from < 7) {
             $GLOBALS['SITE_DB']->delete_table_field('stats', 'regionality');
         }
         if ($upgrade_from < 8) {
             $GLOBALS['SITE_DB']->alter_table_field('stats', 'get', 'URLPATH', 's_get');
         }
     }
 }
Esempio n. 17
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 ($upgrade_from == 2) {
         $GLOBALS['SITE_DB']->query_update('config', array('eval' => 'return do_lang(\'POST_STAFF\');'), array('the_name' => 'staff_text'), '', 1);
         if ($GLOBALS['OPTIONS']['staff_text']['c_set'] == 1) {
             set_option('staff_text', '[html]' . get_option('staff_text') . '[/html]');
         } else {
             set_option('staff_text', do_lang('POST_STAFF'));
         }
         return;
     }
     add_config_option('PAGE_TEXT', 'staff_text', 'transtext', 'return do_lang(\'POST_STAFF\');', 'SECURITY', 'STAFF');
     add_config_option('MEMBER_FILTER', 'is_on_staff_filter', 'tick', 'return \'0\';', 'SECURITY', 'STAFF', 1);
     add_config_option('SYNCHRONISATION', 'is_on_sync_staff', 'tick', 'return \'0\';', 'SECURITY', 'STAFF', 1);
     $usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
     foreach (array_keys($usergroups) as $id) {
         $GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'admin_staff', 'zone_name' => 'adminzone', 'group_id' => $id));
     }
 }
Esempio n. 18
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)) {
         $GLOBALS['SITE_DB']->create_table('filedump', array('id' => '*AUTO', 'name' => 'ID_TEXT', 'path' => 'URLPATH', 'description' => 'SHORT_TRANS', 'the_member' => 'USER'));
         add_specific_permission('FILE_DUMP', 'upload_anything_filedump', false);
         add_specific_permission('FILE_DUMP', 'upload_filedump', true);
         add_specific_permission('FILE_DUMP', 'delete_anything_filedump', false);
         require_lang('filedump');
         if (addon_installed('collaboration_zone')) {
             add_menu_item_simple('collab_features', NULL, 'FILE_DUMP', '_SEARCH:filedump:type=misc');
         }
     }
     if (is_null($upgrade_from) || $upgrade_from < 3) {
         add_config_option('FILEDUMP_COUNT_FILES', 'filedump_show_stats_count_total_files', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('FILEDUMP_DISK_USAGE', 'filedump_show_stats_count_total_space', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
     }
     if (addon_installed('redirects_editor')) {
         $GLOBALS['SITE_DB']->query_delete('redirects', array('r_from_page' => 'filedump', 'r_from_zone' => 'collaboration', 'r_to_page' => 'filedump', 'r_to_zone' => 'cms', 'r_is_transparent' => 1));
     }
 }
Esempio n. 19
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 < 3) {
         add_config_option('COUNT_MEMBERS', 'forum_show_stats_count_members', 'tick', 'return addon_installed(\'stats_block\')?\'1\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_TOPICS', 'forum_show_stats_count_topics', 'tick', 'return addon_installed(\'stats_block\')?\'1\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_POSTS', 'forum_show_stats_count_posts', 'tick', 'return addon_installed(\'stats_block\')?\'1\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_POSTSTODAY', 'forum_show_stats_count_posts_today', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_ONSITE', 'activity_show_stats_count_users_online', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_ONSITE_RECORD', 'activity_show_stats_count_users_online_record', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('COUNT_ONFORUMS', 'activity_show_stats_count_users_online_forum', 'tick', 'return ((get_forum_type()!=\'ocf\') && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('PAGE_VIEWS_TODAY', 'activity_show_stats_count_page_views_today', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('PAGE_VIEWS_THIS_WEEK', 'activity_show_stats_count_page_views_this_week', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('PAGE_VIEWS_THIS_MONTH', 'activity_show_stats_count_page_views_this_month', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_ACTIVE_TODAY', 'forum_show_stats_count_members_active_today', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_ACTIVE_THIS_WEEK', 'forum_show_stats_count_members_active_this_week', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_ACTIVE_THIS_MONTH', 'forum_show_stats_count_members_active_this_month', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_NEW_TODAY', 'forum_show_stats_count_members_new_today', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_NEW_THIS_WEEK', 'forum_show_stats_count_members_new_this_week', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('MEMBERS_NEW_THIS_MONTH', 'forum_show_stats_count_members_new_this_month', 'tick', 'return ((get_forum_type()==\'ocf\') && (!has_no_forum()) && (addon_installed(\'stats_block\')))?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
     }
 }
Esempio n. 20
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)) {
         $GLOBALS['SITE_DB']->create_table('iotd', array('id' => '*AUTO', 'url' => 'URLPATH', 'i_title' => 'SHORT_TRANS', 'caption' => 'LONG_TRANS', 'thumb_url' => 'URLPATH', 'is_current' => 'BINARY', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'allow_trackbacks' => 'BINARY', 'notes' => 'LONG_TEXT', 'used' => 'BINARY', 'date_and_time' => '?TIME', 'iotd_views' => 'INTEGER', 'submitter' => 'USER', 'add_date' => 'TIME', 'edit_date' => '?TIME'));
         $GLOBALS['SITE_DB']->create_index('iotd', 'iotd_views', array('iotd_views'));
         $GLOBALS['SITE_DB']->create_index('iotd', 'get_current', array('is_current'));
         $GLOBALS['SITE_DB']->create_index('iotd', 'ios', array('submitter'));
         $GLOBALS['SITE_DB']->create_index('iotd', 'iadd_date', array('add_date'));
         $GLOBALS['SITE_DB']->create_index('iotd', 'date_and_time', array('date_and_time'));
         add_specific_permission('IOTDS', 'choose_iotd', false);
         add_config_option('CHOOSE_IOTD', 'points_CHOOSE_IOTD', 'integer', 'return addon_installed(\'points\')?\'35\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('ADD_IOTD', 'points_ADD_IOTD', 'integer', 'return addon_installed(\'points\')?\'150\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('IOTD_REGULARITY', 'iotd_update_time', 'integer', 'return \'24\';', 'ADMIN', 'CHECK_LIST');
         $GLOBALS['SITE_DB']->create_index('iotd', 'ftjoin_icap', array('caption'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 3) {
         $GLOBALS['SITE_DB']->add_table_field('iotd', 'allow_trackbacks', 'BINARY', 1);
     }
     if (!is_null($upgrade_from) && $upgrade_from < 4) {
         $GLOBALS['SITE_DB']->add_table_field('iotd', 'i_title', 'SHORT_TRANS', '');
     }
 }
Esempio n. 21
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 ($upgrade_from < 3 || is_null($upgrade_from)) {
         add_config_option('LDAP_IS_ENABLED', 'ldap_is_enabled', 'tick', 'return \'' . (in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '0') . '\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_IS_WINDOWS', 'ldap_is_windows', 'tick', 'return (DIRECTORY_SEPARATOR==\'/\')?\'0\':\'1\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_ALLOW_JOINING', 'ldap_allow_joining', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_HOSTNAME', 'ldap_hostname', 'line', 'return \'localhost\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('LDAP_BASE_DN', 'ldap_base_dn', 'line', 'return \'' . 'dc=' . str_replace('.', ',dc=', ocp_srv('HTTP_HOST')) . '\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('USERNAME', 'ldap_bind_rdn', 'line', 'return (DIRECTORY_SEPARATOR==\'/\')?\'NotManager\':\'NotAdministrator\';', 'SECTION_FORUMS', 'LDAP', 1);
         add_config_option('PASSWORD', 'ldap_bind_password', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP', 1);
     }
     if ($upgrade_from < 4 || is_null($upgrade_from)) {
         add_config_option('WINDOWS_AUTHENTICATION', 'windows_auth_is_enabled', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_LOGIN_QUALIFIER', 'ldap_login_qualifier', 'line', 'return is_null($old=get_value(\'ldap_login_qualifier\'))?\'\':$old;', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_GROUP_SEARCH_QUALIFIER', 'ldap_group_search_qualifier', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_SEARCH_QUALIFIER', 'ldap_member_search_qualifier', 'line', 'return \'\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_PROPERTY', 'ldap_member_property', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'sAMAccountName\':\'cn\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_NONE_BIND_LOGINS', 'ldap_none_bind_logins', 'tick', 'return \'0\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_VERSION', 'ldap_version', 'integer', 'return \'3\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_GROUP_CLASS', 'ldap_group_class', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'group\':\'posixGroup\';', 'SECTION_FORUMS', 'LDAP');
         add_config_option('LDAP_MEMBER_CLASS', 'ldap_member_class', 'line', 'return (get_option(\'ldap_is_windows\')==\'1\')?\'user\':\'posixAccount\';', 'SECTION_FORUMS', 'LDAP');
     }
 }
Esempio n. 22
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)
 {
     add_config_option('REALTIME_RAIN_BUTTON', 'bottom_show_realtime_rain_button', 'tick', 'return \'0\';', 'FEATURE', 'BOTTOM_LINKS');
 }
function run()
{
    $file = basename(rawurldecode($_GET['url']));
    //get old media file data
    $get_old_file = $GLOBALS['SITE_DB']->query('SELECT url FROM ' . get_table_prefix() . 'videos WHERE url LIKE "uploads/galleries/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
    $type = 'galleries';
    if (!array_key_exists(0, $get_old_file)) {
        $get_old_file = $GLOBALS['SITE_DB']->query('SELECT a_url AS url FROM ' . get_table_prefix() . 'attachments WHERE a_url LIKE "uploads/attachments/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
        $type = 'attachments';
        if (!array_key_exists(0, $get_old_file)) {
            $get_old_file = $GLOBALS['SITE_DB']->query('SELECT cv_value AS url FROM ' . get_table_prefix() . 'catalogue_efv_short WHERE cv_value LIKE "uploads/catalogues/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
            $type = 'catalogues';
        }
    }
    require_code('files');
    $file_handle = @fopen(get_custom_file_base() . '/uploads/' . $type . '/' . $file, 'wb') or intelligent_write_error(get_custom_file_base() . '/uploads/' . $type . '/' . $file);
    http_download_file($_GET['url'], NULL, false, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $file_handle, NULL, NULL, 6.0);
    fclose($file_handle);
    //move the old media file to the archive directory - '/uploads/'.$type.'/archive/'
    $new_url = 'uploads/' . $type . '/' . rawurlencode($file);
    if (isset($get_old_file[0]['url']) && is_string($get_old_file[0]['url']) && $get_old_file[0]['url'] != $new_url && strlen($get_old_file[0]['url']) > 0) {
        $movedir = dirname(str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
        @mkdir($movedir, 0777);
        require_code('files');
        fix_permissions($movedir, 0777);
        rename(str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url']), str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
    }
    switch ($type) {
        case 'galleries':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'videos SET video_width=600,video_height=400,url="' . db_escape_string($new_url) . '" WHERE url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
        case 'attachments':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'attachments SET a_url="' . db_escape_string($new_url) . '" WHERE a_url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
        case 'catalogues':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'catalogue_efv_short SET cv_value="' . db_escape_string($new_url) . '" WHERE cv_value LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
    }
    $transcoding_server = get_option('transcoding_server', true);
    if (is_null($transcoding_server)) {
        //add option and default value
        add_config_option('TRANSCODING_SERVER', 'transcoding_server', 'line', 'return \'http://localhost/convertor\';', 'FEATURE', 'GALLERIES');
        $transcoding_server = get_option('transcoding_server', true);
    }
    file_get_contents($transcoding_server . '/move_to_sent.php?file=' . $_GET['url']);
}
Esempio n. 24
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)
 {
     require_code('galleries');
     require_lang('galleries');
     require_code('galleries2');
     if (is_null($upgrade_from)) {
         $GLOBALS['SITE_DB']->create_table('galleries', array('name' => '*ID_TEXT', 'description' => 'LONG_TRANS', 'teaser' => 'SHORT_TRANS', 'fullname' => 'SHORT_TRANS', 'add_date' => 'TIME', 'rep_image' => 'URLPATH', 'parent_id' => 'ID_TEXT', 'watermark_top_left' => 'URLPATH', 'watermark_top_right' => 'URLPATH', 'watermark_bottom_left' => 'URLPATH', 'watermark_bottom_right' => 'URLPATH', 'accept_images' => 'BINARY', 'accept_videos' => 'BINARY', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'notes' => 'LONG_TEXT', 'is_member_synched' => 'BINARY', 'flow_mode_interface' => 'BINARY', 'gallery_views' => 'INTEGER', 'g_owner' => '?AUTO_LINK'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'watermark_top_left', array('watermark_top_left'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'watermark_top_right', array('watermark_top_right'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'watermark_bottom_left', array('watermark_bottom_left'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'watermark_bottom_right', array('watermark_bottom_right'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'gadd_date', array('add_date'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'parent_id', array('parent_id'));
         $GLOBALS['SITE_DB']->create_table('images', array('id' => '*AUTO', 'cat' => 'ID_TEXT', 'url' => 'URLPATH', 'thumb_url' => 'URLPATH', 'comments' => 'LONG_TRANS', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'allow_trackbacks' => 'BINARY', 'notes' => 'LONG_TEXT', 'submitter' => 'USER', 'validated' => 'BINARY', 'add_date' => 'TIME', 'edit_date' => '?TIME', 'image_views' => 'INTEGER', 'title' => 'SHORT_TRANS'));
         $GLOBALS['SITE_DB']->create_index('images', 'image_views', array('image_views'));
         $GLOBALS['SITE_DB']->create_index('images', 'category_list', array('cat'));
         $GLOBALS['SITE_DB']->create_index('images', 'i_validated', array('validated'));
         $GLOBALS['SITE_DB']->create_index('images', 'xis', array('submitter'));
         $GLOBALS['SITE_DB']->create_index('images', 'iadd_date', array('add_date'));
         add_config_option('ADD_IMAGE', 'points_ADD_IMAGE', 'integer', 'return addon_installed(\'points\')?\'100\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('ADD_VIDEO', 'points_ADD_VIDEO', 'integer', 'return addon_installed(\'points\')?\'100\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         require_lang('galleries');
         add_menu_item_simple('main_content', NULL, 'GALLERIES', '_SEARCH:galleries:type=misc');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 3) {
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'teaser', 'SHORT_TRANS', 2);
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'rep_image', 'URLPATH');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'parent_id', 'ID_TEXT', 'root');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'accept_images', 'BINARY', 1);
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'accept_videos', 'BINARY', 1);
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'watermark_top_left', 'URLPATH');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'watermark_top_right', 'URLPATH');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'watermark_bottom_left', 'URLPATH');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'watermark_bottom_right', 'URLPATH');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'is_member_synched', 'BINARY');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'flow_mode_interface', 'BINARY');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'allow_rating', 'BINARY', 1);
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'allow_comments', 'SHORT_INTEGER', 1);
         $GLOBALS['SITE_DB']->add_table_field('images', 'allow_trackbacks', 'BINARY', 1);
     }
     if (is_null($upgrade_from) || $upgrade_from < 3) {
         add_specific_permission('GALLERIES', 'may_download_gallery', false);
         $GLOBALS['SITE_DB']->create_table('videos', array('id' => '*AUTO', 'cat' => 'ID_TEXT', 'url' => 'URLPATH', 'thumb_url' => 'URLPATH', 'comments' => 'LONG_TRANS', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'allow_trackbacks' => 'BINARY', 'notes' => 'LONG_TEXT', 'submitter' => 'USER', 'validated' => 'BINARY', 'add_date' => 'TIME', 'edit_date' => '?TIME', 'video_views' => 'INTEGER', 'video_width' => 'INTEGER', 'video_height' => 'INTEGER', 'video_length' => 'INTEGER', 'title' => 'SHORT_TRANS'));
         $GLOBALS['SITE_DB']->create_index('videos', 'video_views', array('video_views'));
         $GLOBALS['SITE_DB']->create_index('videos', 'vs', array('submitter'));
         $GLOBALS['SITE_DB']->create_index('videos', 'v_validated', array('validated'));
         $GLOBALS['SITE_DB']->create_index('videos', 'category_list', array('cat'));
         $GLOBALS['SITE_DB']->create_index('videos', 'vadd_date', array('add_date'));
         add_config_option('DEFAULT_VIDEO_WIDTH', 'default_video_width', 'integer', 'return \'320\';', 'FEATURE', 'GALLERIES');
         add_config_option('DEFAULT_VIDEO_HEIGHT', 'default_video_height', 'integer', 'return \'240\';', 'FEATURE', 'GALLERIES');
         add_config_option('MAXIMUM_IMAGE_SIZE', 'maximum_image_size', 'integer', 'return \'1024\';', 'FEATURE', 'GALLERIES');
         add_config_option('GALLERY_IMAGE_LIMIT_LOW', 'max_personal_gallery_images_low', 'integer', 'return \'5\';', 'FEATURE', 'GALLERIES');
         add_config_option('GALLERY_IMAGE_LIMIT_HIGH', 'max_personal_gallery_images_high', 'integer', 'return \'10\';', 'FEATURE', 'GALLERIES');
         add_config_option('GALLERY_VIDEO_LIMIT_LOW', 'max_personal_gallery_videos_low', 'integer', 'return \'2\';', 'FEATURE', 'GALLERIES');
         add_config_option('GALLERY_VIDEO_LIMIT_HIGH', 'max_personal_gallery_videos_high', 'integer', 'return \'5\';', 'FEATURE', 'GALLERIES');
         add_specific_permission('GALLERIES', 'high_personal_gallery_limit', false);
         add_specific_permission('GALLERIES', 'no_personal_gallery_limit', false);
         // Add root gallery
         add_gallery('root', do_lang('GALLERIES_HOME'), '', '', '', '', 1, 1, 0, 1);
         $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' => 'galleries', 'category_name' => 'root', 'group_id' => $group_id));
         }
     }
     if (is_null($upgrade_from) || $upgrade_from < 4) {
         add_config_option('GALLERIES', 'galleries_show_stats_count_galleries', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('IMAGES', 'galleries_show_stats_count_images', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('VIDEOS', 'galleries_show_stats_count_videos', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('SHOW_EMPTY_GALLERIES', 'show_empty_galleries', 'tick', 'return \'1\';', 'FEATURE', 'GALLERIES');
         add_config_option('GALLERY_NAME_ORDER', 'gallery_name_order', 'tick', 'return \'0\';', 'FEATURE', 'GALLERIES');
     }
     if (is_null($upgrade_from) || $upgrade_from < 5) {
         add_config_option('GALLERY_SELECTORS', 'gallery_selectors', 'line', 'return is_null($old=get_value(\'gallery_selectors\'))?\'12,24,36,64,128\':$old;', 'FEATURE', 'GALLERIES');
         add_config_option('REVERSE_THUMB_ORDER', 'reverse_thumb_order', 'tick', 'return is_null($old=get_value(\'reverse_thumb_order\'))?\'0\':$old;', 'FEATURE', 'GALLERIES');
         add_config_option('SHOW_GALLERY_COUNTS', 'show_gallery_counts', 'tick', 'return is_null($old=get_value(\'show_gallery_counts\'))?((get_forum_type()==\'ocf\')?\'0\':NULL):$old;', 'FEATURE', 'GALLERIES');
     }
     if (is_null($upgrade_from) || $upgrade_from < 6) {
         add_config_option('VIDEO_BITRATE', 'video_bitrate', 'integer', 'return \'1000\';', 'FEATURE', 'TRANSCODING');
         add_config_option('AUDIO_BITRATE', 'audio_bitrate', 'integer', 'return \'192\';', 'FEATURE', 'TRANSCODING');
         add_config_option('VIDEO_WIDTH_SETTING', 'video_width_setting', 'integer', 'return \'720\';', 'FEATURE', 'TRANSCODING');
         add_config_option('VIDEO_HEIGHT_SETTING', 'video_height_setting', 'integer', 'return \'480\';', 'FEATURE', 'TRANSCODING');
         $GLOBALS['SITE_DB']->create_index('videos', 'ftjoin_vcomments', array('comments'));
         $GLOBALS['SITE_DB']->create_index('images', 'ftjoin_icomments', array('comments'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'ftjoin_gfullname', array('fullname'));
         $GLOBALS['SITE_DB']->create_index('galleries', 'ftjoin_gdescrip', array('description'));
     }
     if (is_null($upgrade_from) || $upgrade_from < 7) {
         $old_option = get_option('ffmpeg_path', true);
         if (is_null($old_option)) {
             $old_option = '';
         }
         delete_config_option('ffmpeg_path');
         add_config_option('TRANSCODING_ZENCODER_API_KEY', 'transcoding_zencoder_api_key', 'line', 'return \'\';', 'FEATURE', 'TRANSCODING');
         add_config_option('TRANSCODING_ZENCODER_FTP_PATH', 'transcoding_zencoder_ftp_path', 'line', 'return \'\';', 'FEATURE', 'TRANSCODING');
         add_config_option('TRANSCODING_SERVER', 'transcoding_server', 'line', 'return \'\';', 'FEATURE', 'TRANSCODING');
         add_config_option('FFMPEG_PATH', 'ffmpeg_path', 'line', 'return \'' . addslashes($old_option) . '\';', 'FEATURE', 'TRANSCODING');
         $GLOBALS['SITE_DB']->create_table('video_transcoding', array('t_id' => '*ID_TEXT', 't_error' => 'LONG_TEXT', 't_url' => 'URLPATH', 't_table' => 'ID_TEXT', 't_url_field' => 'ID_TEXT', 't_orig_filename_field' => 'ID_TEXT', 't_width_field' => 'ID_TEXT', 't_height_field' => 'ID_TEXT', 't_output_filename' => 'ID_TEXT'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 7) {
         $GLOBALS['SITE_DB']->add_table_field('videos', 'title', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->add_table_field('images', 'title', 'SHORT_TRANS');
         $GLOBALS['SITE_DB']->create_index('images', 'ftjoin_dtitle', array('title'));
         $GLOBALS['SITE_DB']->create_index('videos', 'ftjoin_dtitle', array('title'));
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'gallery_views', 'INTEGER');
         $GLOBALS['SITE_DB']->add_table_field('galleries', 'g_owner', '?USER');
     }
 }
Esempio n. 25
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 ($upgrade_from < 3 || is_null($upgrade_from)) {
         add_config_option('MOD_REWRITE', 'mod_rewrite', 'tick', 'return \'' . (in_array(ocp_srv('HTTP_HOST'), array('test.ocportal.com')) ? '1' : '0') . '\'; /*function_exists(\'apache_get_modules\')?\'1\':\'0\';*/', 'SITE', 'ADVANCED');
     }
     if ($upgrade_from < 4 || is_null($upgrade_from)) {
         add_config_option('SESSION_EXPIRY_TIME', 'session_expiry_time', 'integer', 'return \'1\';', 'SECURITY', 'GENERAL');
     }
     if ($upgrade_from < 5 || is_null($upgrade_from)) {
         add_config_option('TRACKBACKS', 'is_on_trackbacks', 'tick', 'return \'0\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('UNZIP_DIR', 'unzip_dir', 'line', 'return (DIRECTORY_SEPARATOR==\'/\')?\'/tmp/\':ocp_srv(\'TMP\');', 'SITE', 'ARCHIVES', 1);
         add_config_option('UNZIP_CMD', 'unzip_cmd', 'line', 'return \'/usr/bin/unzip -o @_SRC_@ -x -d @_DST_@\';', 'SITE', 'ARCHIVES', 1);
         add_config_option('ENABLED', 'smtp_sockets_use', 'tick', 'return \'0\';', 'SITE', 'SMTP', 1);
         add_config_option('HOST', 'smtp_sockets_host', 'line', 'return \'mail.yourispwhateveritis.net\';', 'SITE', 'SMTP', 1);
         add_config_option('PORT', 'smtp_sockets_port', 'line', 'return \'25\';', 'SITE', 'SMTP', 1);
         add_config_option('USERNAME', 'smtp_sockets_username', 'line', 'return \'\';', 'SITE', 'SMTP', 1);
         add_config_option('PASSWORD', 'smtp_sockets_password', 'line', 'return \'\';', 'SITE', 'SMTP', 1);
         add_config_option('EMAIL_ADDRESS', 'smtp_from_address', 'line', 'return \'\';', 'SITE', 'SMTP', 1);
         add_config_option('USE_SECURITY_IMAGES', 'use_security_images', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'GENERAL');
         add_config_option('HTTPS_SUPPORT', 'enable_https', 'tick', 'return \'0\';', 'SECURITY', 'GENERAL', 1);
         add_config_option('SEND_ERROR_EMAILS_OCPRODUCTS', 'send_error_emails_ocproducts', 'tick', 'return \'' . strval(post_param_integer('allow_reports_default', 0)) . '\';', 'SITE', 'ADVANCED', 1);
         add_config_option('LOW_DISK_SPACE_SUBJECT', 'low_space_check', 'integer', 'return \'20\';', 'SITE', 'GENERAL');
         // 20MB - very very low even for lame web hosts
         add_config_option('DETECT_LANG_FORUM', 'detect_lang_forum', 'tick', 'return \'1\';', 'SITE', 'ADVANCED');
         add_config_option('DETECT_LANG_BROWSER', 'detect_lang_browser', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
     }
     if ($upgrade_from < 7 && !is_null($upgrade_from)) {
         $GLOBALS['SITE_DB']->query_update('config', array('eval' => 'return has_no_forum()?NULL:do_template(\'COMMENTS_DEFAULT_TEXT\');'), array('the_name' => 'comment_text'), '', 1);
         if ($GLOBALS['OPTIONS']['comment_text']['c_set'] == 0) {
             $tpl = do_template('COMMENTS_DEFAULT_TEXT');
             set_option('comment_text', $tpl->evaluate());
         }
         delete_config_option('width_left');
         delete_config_option('width_right');
         set_option('welcome_message', '[html]' . get_option('welcome_message') . '[/html]');
         set_option('closed', '[html]' . get_option('closed') . '[/html]');
         delete_config_option('xhtml_validation');
     }
     if (is_null($upgrade_from) || $upgrade_from < 7) {
         add_config_option('ALLOW_AUDIO_VIDEOS', 'allow_audio_videos', 'tick', 'return \'1\';', 'SITE', 'ADVANCED');
         add_config_option('VALIDATION', 'validation', 'tick', 'return \'0\';', 'SITE', 'VALIDATION', 1);
         /*(((substr(ocp_srv('HTTP_HOST'),0,8)=='192.168.') || (substr(ocp_srv('HTTP_HOST'),0,7)=='10.0.0.') || (in_array(ocp_srv('HTTP_HOST'),array('localhost','test.ocportal.com'))))?'1':'0')*/
         // return (!function_exists(\'memory_get_usage()\') || (ini_get(\'memory_limit\')!=\'8M\'))?\'1\':\'0\';
         add_config_option('VALIDATION_XHTML', 'validation_xhtml', 'tick', 'return \'1\';', 'SITE', 'VALIDATION', 1);
         add_config_option('VALIDATION_WCAG', 'validation_wcag', 'tick', 'return \'1\';', 'SITE', 'VALIDATION', 1);
         add_config_option('VALIDATION_CSS', 'validation_css', 'tick', 'return \'0\';', 'SITE', 'VALIDATION', 1);
         add_config_option('VALIDATION_JAVASCRIPT', 'validation_javascript', 'tick', 'return \'0\';', 'SITE', 'VALIDATION', 1);
         add_config_option('VALIDATION_COMPAT', 'validation_compat', 'tick', 'return \'0\';', 'SITE', 'VALIDATION', 1);
         add_config_option('VALIDATION_EXT_FILES', 'validation_ext_files', 'tick', 'return \'0\';', 'SITE', 'VALIDATION', 1);
         add_config_option('MAX_SIZE', 'max_download_size', 'integer', 'return \'20000\';', 'SITE', 'UPLOAD');
     }
     if (is_null($upgrade_from) || $upgrade_from < 8) {
         // TODO: Move these into sms addon_registry hook, once these hooks support installation
         add_config_option('USERNAME', 'sms_username', 'line', 'return addon_installed(\'sms\')?\'\':NULL;', 'FEATURE', 'SMS');
         add_config_option('PASSWORD', 'sms_password', 'line', 'return addon_installed(\'sms\')?\'\':NULL;', 'FEATURE', 'SMS');
         add_config_option('API_ID', 'sms_api_id', 'integer', 'return addon_installed(\'sms\')?\'\':NULL;', 'FEATURE', 'SMS');
         add_config_option('SMS_LOW_LIMIT', 'sms_low_limit', 'integer', 'return addon_installed(\'sms\')?\'10\':NULL;', 'FEATURE', 'SMS');
         add_config_option('SMS_HIGH_LIMIT', 'sms_high_limit', 'integer', 'return addon_installed(\'sms\')?\'20\':NULL;', 'FEATURE', 'SMS');
         add_config_option('SMS_LOW_TRIGGER_LIMIT', 'sms_low_trigger_limit', 'integer', 'return addon_installed(\'sms\')?\'50\':NULL;', 'FEATURE', 'SMS');
         add_config_option('SMS_HIGH_TRIGGER_LIMIT', 'sms_high_trigger_limit', 'integer', 'return addon_installed(\'sms\')?\'100\':NULL;', 'FEATURE', 'SMS');
         add_config_option('ALLOWED_POST_SUBMITTERS', 'allowed_post_submitters', 'text', 'return \'\';', 'SECURITY', 'ADVANCED', 1);
         add_config_option('STRONG_FORUM_TIE', 'is_on_strong_forum_tie', 'tick', 'return \'0\';', 'FEATURE', 'USER_INTERACTION', 1);
         add_config_option('VALIDATION_ON_PREVIEW', 'is_on_preview_validation', 'tick', 'return \'1\';', 'SITE', 'VALIDATION', 1);
         add_config_option('SHOW_INLINE_STATS', 'show_inline_stats', 'tick', 'return \'1\';', 'SITE', 'GENERAL');
         add_config_option('SIMPLIFIED_DONEXT', 'simplified_donext', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
         add_config_option('ANTI_LEECH', 'anti_leech', 'tick', 'return \'0\';', 'SECURITY', 'GENERAL');
         add_config_option('SSW', 'ssw', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('ADMIN_MENU', 'bottom_show_admin_menu', 'tick', 'return \'1\';', 'FEATURE', 'BOTTOM_LINKS');
         add_config_option('TOP_LINK', 'bottom_show_top_button', 'tick', 'return \'0\';', 'FEATURE', 'BOTTOM_LINKS');
         add_config_option('FEEDBACK_LINK', 'bottom_show_feedback_link', 'tick', 'return \'1\';', 'FEATURE', 'BOTTOM_LINKS');
         add_config_option('PRIVACY_LINK', 'bottom_show_privacy_link', 'tick', 'return \'1\';', 'FEATURE', 'BOTTOM_LINKS');
         add_config_option('SITEMAP_LINK', 'bottom_show_sitemap_button', 'tick', 'return \'1\';', 'FEATURE', 'BOTTOM_LINKS');
         add_config_option('COUNT_POSTSCOUNT', 'forum_show_personal_stats_posts', 'tick', 'return has_no_forum()?NULL:\'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('COUNT_TOPICSCOUNT', 'forum_show_personal_stats_topics', 'tick', 'return ((has_no_forum()) || (get_forum_type()!=\'ocf\'))?NULL:\'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('ADMIN_ZONE_LINK', 'ocp_show_personal_adminzone_link', 'tick', 'return \'1\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('CONCEDED_MODE_LINK', 'ocp_show_conceded_mode_link', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('SU', 'ocp_show_su', 'tick', 'return (get_forum_type()==\'none\')?NULL:\'1\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('PAGE_ACTIONS', 'ocp_show_staff_page_actions', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('MY_PROFILE_LINK', 'ocf_show_profile_link', 'tick', 'return (get_forum_type()==\'none\')?NULL:\'1\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('_USERGROUP', 'ocp_show_personal_usergroup', 'tick', 'return (get_forum_type()==\'none\')?NULL:\'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('LAST_HERE', 'ocp_show_personal_last_visit', 'tick', 'return has_no_forum()?NULL:\'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('AVATAR', 'ocp_show_avatar', 'tick', 'return ((get_forum_type()==\'none\') || ((get_forum_type()==\'ocf\') && (!addon_installed(\'ocf_member_avatars\'))))?NULL:\'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('PANEL_WIDTH', 'panel_width', 'line', 'return \'13.3em\';', 'THEME', 'GENERAL');
         add_config_option('PANEL_WIDTH_SPACED', 'panel_width_spaced', 'line', 'return \'14.3em\';', 'THEME', 'GENERAL');
         add_config_option('ROOT_ZONE_LOGIN_THEME', 'root_zone_login_theme', 'tick', 'return \'0\';', 'THEME', 'GENERAL');
         add_config_option('USE_CUSTOM_ZONE_MENU', 'use_custom_zone_menu', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('TRAY_SUPPORT', 'tray_support', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_DOCS', 'show_docs', 'tick', 'return \'1\';', 'SITE', 'ADVANCED');
         add_config_option('CAPTCHA_NOISE', 'captcha_noise', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('CAPTCHA_ON_FEEDBACK', 'captcha_on_feedback', 'tick', 'return addon_installed(\'captcha\')?\'0\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('SHOW_POST_VALIDATION', 'show_post_validation', 'tick', 'return \'1\';', 'SITE', 'ADVANCED');
         add_config_option('IP_FORWARDING', 'ip_forwarding', 'tick', 'return \'0\';', 'SITE', 'ENVIRONMENT');
         add_config_option('FORCE_META_REFRESH', 'force_meta_refresh', 'tick', 'return \'0\';', 'SITE', 'ENVIRONMENT');
         add_config_option('USE_CONTEXTUAL_DATES', 'use_contextual_dates', 'tick', 'return \'1\';', 'SITE', 'ADVANCED');
         add_config_option('EAGER_WYSIWYG', 'eager_wysiwyg', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
         add_config_option('WEBSITE_EMAIL', 'website_email', 'line', '$staff_address=get_option(\'staff_address\'); $website_email=\'website@\'.get_domain(); if (substr($staff_address,-strlen(get_domain())-1)==\'@\'.get_domain()) $website_email=$staff_address; return $website_email;', 'SITE', 'EMAIL');
         add_config_option('ENVELOPER_OVERRIDE', 'enveloper_override', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('BCC', 'bcc', 'tick', 'return \'1\';', 'SITE', 'EMAIL');
         add_config_option('ALLOW_EXT_IMAGES', 'allow_ext_images', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('HTM_SHORT_URLS', 'htm_short_urls', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
         add_config_option('IP_STRICT_FOR_SESSIONS', 'ip_strict_for_sessions', 'tick', 'return \'1\';', 'SECURITY', 'GENERAL');
         add_config_option('ENABLE_PREVIEWS', 'enable_previews', 'tick', 'return \'1\';', 'SITE', 'PREVIEW');
         add_config_option('ENABLE_KEYWORD_DENSITY_CHECK', 'enable_keyword_density_check', 'tick', 'return \'0\';', 'SITE', 'PREVIEW');
         add_config_option('ENABLE_SPELL_CHECK', 'enable_spell_check', 'tick', 'return function_exists(\'pspell_check\')?\'0\':NULL;', 'SITE', 'PREVIEW');
         add_config_option('ENABLE_MARKUP_VALIDATION', 'enable_markup_validation', 'tick', 'return \'0\';', 'SITE', 'PREVIEW');
         add_config_option('ENABLE_IMAGE_FADING', 'enable_image_fading', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
     }
     if (is_null($upgrade_from) || $upgrade_from < 9) {
         add_config_option('AUTO_SUBMIT_SITEMAP', 'auto_submit_sitemap', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('USER_POSTSIZE_ERRORS', 'user_postsize_errors', 'tick', 'return is_null($old=get_value(\'no_user_postsize_errors\'))?\'1\':invert_value($old);', 'SITE', 'UPLOAD');
         add_config_option('AUTOMATIC_META_EXTRACTION', 'automatic_meta_extraction', 'tick', 'return is_null($old=get_value(\'no_auto_meta\'))?\'1\':invert_value($old);', 'SITE', 'GENERAL');
         add_config_option('IS_ON_EMOTICON_CHOOSERS', 'is_on_emoticon_choosers', 'tick', 'return is_null($old=get_value(\'no_emoticon_choosers\'))?\'1\':invert_value($old);', 'THEME', 'GENERAL');
         add_config_option('DEEPER_ADMIN_BREADCRUMBS', 'deeper_admin_breadcrumbs', 'tick', 'return is_null($old=get_value(\'no_admin_menu_assumption\'))?\'1\':invert_value($old);', 'SITE', 'ADVANCED');
         add_config_option('HAS_LOW_MEMORY_LIMIT', 'has_low_memory_limit', 'tick', 'return is_null($old=get_value(\'has_low_memory_limit\'))?((ini_get(\'memory_limit\')==\'-1\' || ini_get(\'memory_limit\')==\'0\' || ini_get(\'memory_limit\')==\'\')?\'0\':NULL):$old;', 'SITE', 'ADVANCED');
         add_config_option('IS_ON_COMCODE_PAGE_CHILDREN', 'is_on_comcode_page_children', 'tick', 'return is_null($old=get_value(\'disable_comcode_page_children\'))?\'1\':invert_value($old);', 'SITE', 'ADVANCED');
         add_config_option('GLOBAL_DONEXT_ICONS', 'global_donext_icons', 'tick', 'return is_null($old=get_value(\'disable_donext_global\'))?\'1\':invert_value($old);', 'SITE', 'ADVANCED');
         add_config_option('NO_STATS_WHEN_CLOSED', 'no_stats_when_closed', 'tick', 'return \'' . (substr(ocp_srv('HTTP_HOST'), 0, 8) == '192.168.' || substr(ocp_srv('HTTP_HOST'), 0, 7) == '10.0.0.' || in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '1') . '\';', 'SITE', 'CLOSED_SITE');
         add_config_option('NO_BOT_STATS', 'no_bot_stats', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('FILE_SYSTEM_CACHING', 'filesystem_caching', 'tick', 'return \'0\';', 'SITE', 'CACHES');
         // Java/FTP upload
         add_config_option('ENABLE_JAVA_UPLOAD', 'java_upload', 'tick', 'return \'0\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_HOST', 'java_ftp_host', 'line', 'return ocp_srv(\'HTTP_HOST\');', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_USERNAME', 'java_username', 'line', 'return \'anonymous\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_PASSWORD', 'java_password', 'line', 'return \'someone@example.com\';', 'SITE', 'JAVA_UPLOAD');
         add_config_option('JAVA_FTP_PATH', 'java_ftp_path', 'line', 'return \'/public_html/uploads/incoming/\';', 'SITE', 'JAVA_UPLOAD');
     }
     if (is_null($upgrade_from) || $upgrade_from < 10) {
         add_config_option('ADVANCED_ADMIN_CACHE', 'advanced_admin_cache', 'tick', 'return \'0\';', 'SITE', 'CACHES');
         add_config_option('COLLAPSE_USER_ZONES', 'collapse_user_zones', 'tick', 'return \'1\';', 'SITE', 'GENERAL');
         add_config_option('CHECK_BROKEN_URLS', 'check_broken_urls', 'tick', 'return \'1\';', 'SITE', '_COMCODE');
         add_config_option('GOOGLE_ANALYTICS', 'google_analytics', 'line', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('FIXED_WIDTH', 'fixed_width', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_CONTENT_TAGGING', 'show_content_tagging', 'tick', 'return \'0\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_CONTENT_TAGGING_INLINE', 'show_content_tagging_inline', 'tick', 'return \'0\';', 'THEME', 'GENERAL');
         add_config_option('SHOW_SCREEN_ACTIONS', 'show_screen_actions', 'tick', 'return \'1\';', 'THEME', 'GENERAL');
         add_config_option('PERSONAL_SUB_LINKS', 'ocp_show_personal_sub_links', 'tick', 'return \'1\';', 'BLOCKS', 'PERSONAL_BLOCK');
     }
     if (is_null($upgrade_from) || $upgrade_from < 11) {
         add_config_option('LONG_GOOGLE_COOKIES', 'long_google_cookies', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('REMEMBER_ME_BY_DEFAULT', 'remember_me_by_default', 'tick', 'return \'0\';', 'SITE', 'GENERAL');
         add_config_option('DETECT_JAVASCRIPT', 'detect_javascript', 'tick', 'return \'0\';', 'SITE', 'ADVANCED');
         add_config_option('MOBILE_SUPPORT', 'mobile_support', 'tick', 'return \'1\';', 'SITE', 'GENERAL');
     }
     if (is_null($upgrade_from) || $upgrade_from < 12) {
         add_config_option('MAIL_QUEUE', 'mail_queue', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('MAIL_QUEUE_DEBUG', 'mail_queue_debug', 'tick', 'return \'0\';', 'SITE', 'EMAIL');
         add_config_option('COMMENTS_TO_SHOW_IN_THREAD', 'comments_to_show_in_thread', 'integer', 'return \'30\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('MAX_THREAD_DEPTH', 'max_thread_depth', 'integer', 'return \'6\';', 'FEATURE', 'USER_INTERACTION');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 12) {
         foreach (array('send_error_emails', 'ocf_show_personal_myhome_link', 'twitter_login', 'twitter_password', 'facebook_api', 'facebook_appid', 'facebook_secret_code', 'facebook_uid', 'facebook_target_ids') as $option_to_delete) {
             delete_config_option($option_to_delete);
         }
     }
     if (is_null($upgrade_from) || $upgrade_from < 13) {
         add_config_option('COMPLEX_UPLOADER', 'complex_uploader', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('ENABLE_WYSIWYG', 'wysiwyg', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('EDITAREA', 'editarea', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('JS_OVERLAYS', 'js_overlays', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('TREE_LISTS', 'tree_lists', 'tick', 'return \'1\';', 'ACCESSIBILITY', 'GENERAL');
         add_config_option('CSS_CAPTCHA', 'css_captcha', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('CAPTCHA_SINGLE_GUESS', 'captcha_single_guess', 'tick', 'return addon_installed(\'captcha\')?\'1\':NULL;', 'SECURITY', 'SECURITY_IMAGE');
         add_config_option('ENABLE_AUTOBAN', 'autoban', 'tick', 'return \'1\';', 'SECURITY', 'GENERAL');
         add_config_option('ENABLE_LIKES', 'likes', 'tick', 'return \'0\';', 'FEATURE', 'USER_INTERACTION');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 8) {
         delete_config_option('logo_map');
         $GLOBALS['SITE_DB']->query('UPDATE ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'config SET the_type=\'forum\' WHERE the_name LIKE \'' . db_encode_like('%_forum_name') . '\'');
     }
     if (is_null($upgrade_from)) {
         set_value('version', float_to_raw_string(ocp_version_number()));
         set_value('ocf_version', float_to_raw_string(ocp_version_number()));
         // Site Configuration
         //  General
         add_config_option('SITE_NAME', 'site_name', 'line', 'return do_lang(\'UNNAMED\');', 'SITE', 'GENERAL');
         add_config_option('SITE_SCOPE', 'site_scope', 'transline', 'return \'???\';', 'SITE', 'GENERAL');
         add_config_option('DESCRIPTION', 'description', 'transline', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('COPYRIGHT', 'copyright', 'transline', 'return \'Copyright &copy; \'.get_site_name().\' \'.date(\'Y\').\'\';', 'SITE', 'GENERAL');
         add_config_option('WELCOME_MESSAGE', 'welcome_message', 'transtext', 'return \'\';', 'SITE', 'GENERAL');
         add_config_option('MAIN_FORUM_NAME', 'main_forum_name', 'forum', 'return has_no_forum()?NULL:do_lang(\'DEFAULT_FORUM_TITLE\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'USER_INTERACTION');
         add_config_option('KEYWORDS', 'keywords', 'line', 'return \'\';', 'SITE', 'GENERAL');
         //  Advanced
         //add_config_option('LOGO_MAP','logo_map','text','$tpl=do_template(\'IMAGE_MAP\'); return $tpl->evaluate();','SITE','ADVANCED');
         add_config_option('GZIP_OUTPUT', 'gzip_output', 'tick', 'return \'0\';', 'SITE', 'ADVANCED', 1);
         //  Environment
         add_config_option('FORUM_IN_PORTAL', 'forum_in_portal', 'tick', 'return has_no_forum()?NULL:\'0\';', 'SITE', 'ENVIRONMENT', 1);
         add_config_option('EMAIL', 'staff_address', 'line', 'return \'staff@\'.get_domain();', 'SITE', 'EMAIL');
         add_config_option('GD', 'is_on_gd', 'tick', 'return function_exists(\'imagetypes\')?\'1\':\'0\';', 'SITE', 'ENVIRONMENT', 1);
         add_config_option('FOLDER_CREATE', 'is_on_folder_create', 'tick', 'return \'1\';', 'SITE', 'ENVIRONMENT', 1);
         //  Closed Site
         add_config_option('CLOSED_SITE', 'site_closed', 'tick', 'return \'' . (substr(ocp_srv('HTTP_HOST'), 0, 8) == '192.168.' || substr(ocp_srv('HTTP_HOST'), 0, 7) == '10.0.0.' || in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) ? '0' : '1') . '\';', 'SITE', 'CLOSED_SITE');
         add_config_option('MESSAGE', 'closed', 'transtext', 'return do_lang(\'BEING_INSTALLED\');', 'SITE', 'CLOSED_SITE');
         add_config_option('MAXIMUM_USERS', 'maximum_users', 'integer', 'return \'100\';', 'SITE', 'CLOSED_SITE', 1);
         //  Logging
         add_config_option('CC_ADDRESS', 'cc_address', 'line', 'return \'\';', 'SITE', 'EMAIL');
         // \'staff_cc@\'.get_domain()
         add_config_option('LOG_PHP_ERRORS', 'log_php_errors', 'tick', 'return \'1\';', 'SITE', 'LOGGING');
         add_config_option('DISPLAY_PHP_ERRORS', 'display_php_errors', 'tick', 'return \'0\';', 'SITE', 'LOGGING');
         // Security/Usergroup Options
         //  Uploading
         add_config_option('FILE_TYPES', 'valid_types', 'line', 'return \'swf,sql,odg,odp,odt,ods,pdf,pgp,dot,doc,ppt,csv,xls,docx,pptx,xlsx,pub,txt,log,psd,tga,tif,gif,png,ico,bmp,jpg,jpeg,flv,avi,mov,3gp,mpg,mpeg,mp4,webm,asf,wmv,zip,tar,rar,gz,wav,mp3,ogg,ogv,torrent,php,css,tpl,ini,eml,patch,diff,iso,dmg\';', 'SECURITY', 'UPLOADED_FILES');
         // fla,html,htm,svg,xml kept out for security reasons. NB: Can't add any more due to length limit.
         add_config_option('IMAGE_TYPES', 'valid_images', 'line', 'return \'jpg,jpeg,gif,png,ico\';', 'SECURITY', 'UPLOADED_FILES');
         // Feature Options
         //  User Interaction
         add_config_option('RATING', 'is_on_rating', 'tick', 'return \'1\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENTS', 'is_on_comments', 'tick', 'return has_no_forum()?NULL:\'1\';', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENTS_FORUM_NAME', 'comments_forum_name', 'forum', 'return has_no_forum()?NULL:do_lang(\'COMMENT_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'USER_INTERACTION');
         add_config_option('COMMENT_FORM_TEXT', 'comment_text', 'transtext', 'return has_no_forum()?NULL:static_evaluate_tempcode(do_template(\'COMMENTS_DEFAULT_TEXT\'));', 'FEATURE', 'USER_INTERACTION');
         //  Images
         add_config_option('THUMB_WIDTH', 'thumb_width', 'integer', 'return \'200\';', 'FEATURE', 'IMAGES');
         add_config_option('IMAGES', 'max_image_size', 'integer', 'return \'700\';', 'SITE', 'UPLOAD');
         add_config_option('USERS_ONLINE_TIME', 'users_online_time', 'integer', 'return \'5\';', 'SITE', 'LOGGING');
     }
 }
Esempio n. 26
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)) {
         require_lang('downloads');
         $GLOBALS['SITE_DB']->create_table('download_categories', array('id' => '*AUTO', 'category' => 'SHORT_TRANS', 'parent_id' => '?AUTO_LINK', 'add_date' => 'TIME', 'notes' => 'LONG_TEXT', 'description' => 'LONG_TRANS', 'rep_image' => 'URLPATH'));
         $lang_key = lang_code_to_default_content('DOWNLOADS_HOME');
         $id = $GLOBALS['SITE_DB']->query_insert('download_categories', array('rep_image' => '', 'parent_id' => NULL, 'add_date' => time(), 'notes' => '', 'description' => insert_lang_comcode('', 3), 'category' => $lang_key), true);
         $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' => 'downloads', 'category_name' => strval($id), 'group_id' => $group_id));
         }
         $GLOBALS['SITE_DB']->create_index('download_categories', 'child_find', array('parent_id'));
         $GLOBALS['SITE_DB']->create_table('download_downloads', array('id' => '*AUTO', 'category_id' => 'AUTO_LINK', 'name' => 'SHORT_TRANS', 'url' => 'URLPATH', 'description' => 'LONG_TRANS', 'author' => 'ID_TEXT', 'comments' => 'LONG_TRANS', 'num_downloads' => 'INTEGER', 'out_mode_id' => '?AUTO_LINK', 'add_date' => 'TIME', 'edit_date' => '?TIME', 'validated' => 'BINARY', 'default_pic' => 'INTEGER', 'file_size' => '?INTEGER', 'allow_rating' => 'BINARY', 'allow_comments' => 'SHORT_INTEGER', 'allow_trackbacks' => 'BINARY', 'notes' => 'LONG_TEXT', 'download_views' => 'INTEGER', 'download_cost' => 'INTEGER', 'download_submitter_gets_points' => 'BINARY', 'submitter' => 'USER', 'original_filename' => 'SHORT_TEXT', 'rep_image' => 'URLPATH', 'download_licence' => '?AUTO_LINK', 'download_data_mash' => 'LONG_TEXT'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'download_views', array('download_views'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'category_list', array('category_id'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'recent_downloads', array('add_date'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'top_downloads', array('num_downloads'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'downloadauthor', array('author'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'dds', array('submitter'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'ddl', array('download_licence'));
         // For when deleting a download license
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'dvalidated', array('validated'));
         $GLOBALS['SITE_DB']->create_table('download_logging', array('id' => '*AUTO_LINK', 'the_user' => '*USER', 'ip' => 'IP', 'date_and_time' => 'TIME'));
         $GLOBALS['SITE_DB']->create_index('download_logging', 'calculate_bandwidth', array('date_and_time'));
         add_config_option('MAXIMUM_DOWNLOAD', 'maximum_download', 'integer', 'return \'15\';', 'SITE', 'CLOSED_SITE');
         add_config_option('SHOW_DLOAD_TREES', 'show_dload_trees', 'tick', 'return \'0\';', 'FEATURE', 'SECTION_DOWNLOADS', 1);
         add_config_option('ADD_DOWNLOAD', 'points_ADD_DOWNLOAD', 'integer', 'return addon_installed(\'points\')?\'150\':NULL;', 'POINTS', 'COUNT_POINTS_GIVEN');
         require_lang('downloads');
         add_menu_item_simple('main_content', NULL, 'SECTION_DOWNLOADS', '_SEARCH:downloads:type=misc');
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'ftjoin_dname', array('name'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'ftjoin_ddescrip', array('description'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', 'ftjoin_dcomments', array('comments'));
         $GLOBALS['SITE_DB']->create_index('download_categories', 'ftjoin_dccat', array('category'));
         $GLOBALS['SITE_DB']->create_index('download_categories', 'ftjoin_dcdescrip', array('description'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 3) {
         $GLOBALS['SITE_DB']->add_table_field('download_downloads', 'allow_trackbacks', 'BINARY', 1);
         $GLOBALS['SITE_DB']->add_table_field('download_categories', 'rep_image', 'URLPATH');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 5) {
         $GLOBALS['SITE_DB']->add_table_field('download_downloads', 'download_licence', '?AUTO_LINK', NULL);
         $GLOBALS['SITE_DB']->add_table_field('download_downloads', 'download_data_mash', 'LONG_TEXT');
         delete_config_option('is_on_downloads');
     }
     if (is_null($upgrade_from) || $upgrade_from < 5) {
         $GLOBALS['SITE_DB']->create_index('download_downloads', '#download_data_mash', array('download_data_mash'));
         $GLOBALS['SITE_DB']->create_index('download_downloads', '#original_filename', array('original_filename'));
         $GLOBALS['SITE_DB']->create_table('download_licences', array('id' => '*AUTO', 'l_title' => 'SHORT_TEXT', 'l_text' => 'LONG_TEXT'));
         add_config_option('_SECTION_DOWNLOADS', 'downloads_show_stats_count_total', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('TOTAL_DOWNLOADS_IN_ARCHIVE', 'downloads_show_stats_count_archive', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('_COUNT_DOWNLOADS', 'downloads_show_stats_count_downloads', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('_COUNT_BANDWIDTH', 'downloads_show_stats_count_bandwidth', 'tick', 'return addon_installed(\'stats_block\')?\'0\':NULL;', 'BLOCKS', 'STATISTICS');
         add_config_option('IMMEDIATE_DOWNLOADS', 'immediate_downloads', 'tick', 'return \'0\';', 'FEATURE', 'SECTION_DOWNLOADS');
     }
     if (is_null($upgrade_from) || $upgrade_from < 6) {
         add_config_option('DOWNLOAD_GALLERY_ROOT', 'download_gallery_root', 'line', 'return is_null($old=get_value(\'download_gallery_root\'))?(addon_installed(\'galleries\')?\'root\':NULL):$old;', 'FEATURE', 'SECTION_DOWNLOADS');
     }
 }
Esempio n. 27
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)
 {
     add_config_option('NETWORK_LINKS', 'network_links', 'line', 'return get_base_url().\'/netlink.php\';', 'SITE', 'ENVIRONMENT', 1);
 }
Esempio n. 28
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 < 5) {
         $GLOBALS['SITE_DB']->delete_table_field('ticket_types', 'send_sms_to');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 4) {
         $GLOBALS['SITE_DB']->add_table_field('ticket_types', 'guest_emails_mandatory', 'BINARY', 0);
         $GLOBALS['SITE_DB']->add_table_field('ticket_types', 'search_faq', 'BINARY', 0);
         $GLOBALS['SITE_DB']->add_table_field('ticket_types', 'cache_lead_time', '?TIME');
     }
     if ($upgrade_from < 3 || is_null($upgrade_from)) {
         add_specific_permission('SUPPORT_TICKETS', 'support_operator', false);
     }
     if (is_null($upgrade_from) || $upgrade_from < 4) {
         add_config_option('TICKET_MEMBER_FORUMS', 'ticket_member_forums', 'tick', 'return \'0\';', 'FEATURE', 'SUPPORT_TICKETS');
         add_config_option('TICKET_TYPE_FORUMS', 'ticket_type_forums', 'tick', 'return \'0\';', 'FEATURE', 'SUPPORT_TICKETS');
         $GLOBALS['SITE_DB']->create_table('tickets', array('ticket_id' => '*SHORT_TEXT', 'topic_id' => 'AUTO_LINK', 'forum_id' => 'AUTO_LINK', 'ticket_type' => 'SHORT_TRANS'));
     }
     if (!is_null($upgrade_from) && $upgrade_from < 2) {
         $GLOBALS['SITE_DB']->query_update('config', array('eval' => 'return do_lang(\'NEW_TICKET_WELCOME\');'), array('the_name' => 'ticket_text'), '', 1);
         if ($GLOBALS['OPTIONS']['ticket_text']['c_set'] == 1) {
             set_option('ticket_text', '[html]' . get_option('ticket_text') . '[/html]');
         } else {
             set_option('ticket_text', do_lang('NEW_TICKET_WELCOME'));
         }
         return;
     }
     require_lang('tickets');
     if (is_null($upgrade_from)) {
         $GLOBALS['SITE_DB']->create_table('ticket_types', array('ticket_type' => '*SHORT_TRANS', 'guest_emails_mandatory' => 'BINARY', 'search_faq' => 'BINARY', 'cache_lead_time' => '?TIME'));
         $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
         $default_types = array('TT_OTHER', 'TT_COMPLAINT');
         foreach ($default_types as $type) {
             $GLOBALS['SITE_DB']->query_insert('ticket_types', array('ticket_type' => insert_lang(do_lang($type), 1), 'guest_emails_mandatory' => 0, 'search_faq' => 0, 'cache_lead_time' => NULL));
             foreach (array_keys($groups) as $id) {
                 $GLOBALS['SITE_DB']->query_insert('group_category_access', array('module_the_name' => 'tickets', 'category_name' => do_lang($type), 'group_id' => $id));
             }
         }
         add_config_option('PAGE_TEXT', 'ticket_text', 'transtext', 'return do_lang(\'NEW_TICKET_WELCOME\');', 'FEATURE', 'SUPPORT_TICKETS');
         add_config_option('TICKET_FORUM_NAME', 'ticket_forum_name', 'forum', 'require_lang(\'tickets\'); return do_lang(\'TICKET_FORUM_NAME\',\'\',\'\',\'\',get_site_default_lang());', 'FEATURE', 'SUPPORT_TICKETS');
         add_specific_permission('SUPPORT_TICKETS', 'view_others_tickets', false);
         add_menu_item_simple('main_website', NULL, 'SUPPORT_TICKETS', '_SEARCH:tickets:type=misc');
     }
 }
Esempio n. 29
0
<?php

require_code('developer_tools');
destrictify();
require_code('twitter');
require_lang('twitter');
$title = get_page_title('TWITTER_OAUTH');
$api_key = get_option('twitter_api_key', true);
$api_secret = get_option('twitter_api_secret', true);
if (is_null($api_key)) {
    require_code('database_action');
    add_config_option('TWITTER_API_KEY', 'twitter_api_key', 'line', 'return \'\';', 'FEATURE', 'TWITTER_SYNDICATION');
    add_config_option('TWITTER_API_SECRET', 'twitter_api_secret', 'line', 'return \'\';', 'FEATURE', 'TWITTER_SYNDICATION');
    $api_key = '';
    $api_secret = '';
}
if ($api_key == '' || $api_secret == '') {
    $config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => 'FEATURE', 'redirect' => get_self_url(true)), '_SELF', NULL, false, false, false, 'group_TWITTER_SYNDICATION');
    require_code('site2');
    assign_refresh($config_url, 0.0);
    $echo = do_template('REDIRECT_SCREEN', array('URL' => $config_url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('TWITTER_SETUP_FIRST')));
    $echo->evaluate_echo();
    return;
}
require_code('hooks/systems/syndication/twitter');
$ob = new Hook_Syndication_twitter();
$result = $ob->auth_set(NULL, get_self_url(false, false, array('oauth_in_progress' => 1)));
if ($result) {
    $out = do_lang_tempcode('TWITTER_OAUTH_SUCCESS');
} else {
    $out = do_lang_tempcode('SOME_ERRORS_OCCURRED');
Esempio n. 30
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 < 3) {
         add_specific_permission('POINTS', 'use_points', true);
     }
     if (is_null($upgrade_from)) {
         $GLOBALS['SITE_DB']->create_table('chargelog', array('id' => '*AUTO', 'user_id' => 'USER', 'amount' => 'INTEGER', 'reason' => 'SHORT_TRANS', 'date_and_time' => 'TIME'));
         $GLOBALS['SITE_DB']->create_table('gifts', array('id' => '*AUTO', 'date_and_time' => 'TIME', 'amount' => 'INTEGER', 'gift_from' => 'USER', 'gift_to' => 'USER', 'reason' => 'SHORT_TRANS', 'anonymous' => 'BINARY'));
         $GLOBALS['SITE_DB']->create_index('gifts', 'giftsgiven', array('gift_from'));
         $GLOBALS['SITE_DB']->create_index('gifts', 'giftsreceived', array('gift_to'));
         add_config_option('JOINING', 'points_joining', 'integer', 'return \'40\';', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('MAKE_POST', 'points_posting', 'integer', 'return \'5\';', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('RATING', 'points_rating', 'integer', 'return \'5\';', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('VOTING', 'points_voting', 'integer', 'return \'5\';', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_specific_permission('POINTS', 'give_points_self', false);
         add_specific_permission('POINTS', 'have_negative_gift_points', false);
         add_specific_permission('POINTS', 'give_negative_points', false);
         add_specific_permission('POINTS', 'view_charge_log', false);
     }
     if (!is_null($upgrade_from) && $upgrade_from < 5) {
         delete_config_option('is_on_points');
     }
     if (!is_null($upgrade_from) && $upgrade_from < 6) {
         delete_config_option('points_show_personal_profile_link');
     }
     if (is_null($upgrade_from) || $upgrade_from < 7) {
         add_config_option('POINTS_IF_LIKED', 'points_if_liked', 'integer', 'return \'5\';', 'POINTS', 'COUNT_POINTS_GIVEN');
     }
     if (is_null($upgrade_from) || $upgrade_from < 5) {
         add_config_option('COUNT_POINTS_LEFT', 'points_show_personal_stats_points_left', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('COUNT_POINTS_USED', 'points_show_personal_stats_points_used', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('COUNT_GIFT_POINTS_LEFT', 'points_show_personal_stats_gift_points_left', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('COUNT_GIFT_POINTS_USED', 'points_show_personal_stats_gift_points_used', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_config_option('COUNT_POINTS_EVER', 'points_show_personal_stats_total_points', 'tick', 'return \'0\';', 'BLOCKS', 'PERSONAL_BLOCK');
         add_specific_permission('POINTS', 'trace_anonymous_gifts', false);
     }
     if (is_null($upgrade_from) || $upgrade_from < 4) {
         add_config_option('POINTS_PER_DAY', 'points_per_day', 'integer', 'return \'0\';', 'POINTS', 'COUNT_POINTS_GIVEN');
         add_config_option('POINTS_PER_DAILY_VISIT', 'points_per_daily_visit', 'integer', 'return \'0\';', 'POINTS', 'COUNT_POINTS_GIVEN');
     }
 }