Beispiel #1
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('catalogues');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_fields');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_categories');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_entries');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_long_trans');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_short_trans');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_long');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_short');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_float');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_efv_integer');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_entry_linkage');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_cat_treecache');
     $GLOBALS['SITE_DB']->drop_if_exists('catalogue_childcountcache');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'catalogues_category'));
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'catalogues_catalogue'));
     $GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'catalogues'));
     deldir_contents(get_custom_file_base() . '/uploads/catalogues', true);
     delete_specific_permission('high_catalogue_entry_timeout');
     delete_menu_item_simple('_SEARCH:catalogues:type=misc');
     $cf = $GLOBALS['SITE_DB']->query_value_null_ok('menu_items', 'id', array('i_menu' => 'collab_features', 'i_url' => ''));
     if (!is_null($cf)) {
         delete_menu_item($cf);
     }
     delete_menu_item_simple('_SEARCH:catalogues:id=projects:type=index');
     delete_menu_item_simple('_SEARCH:cms_catalogues:catalogue_name=projects:type=add_entry');
 }
Beispiel #2
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('transactions');
     $GLOBALS['SITE_DB']->drop_if_exists('trans_expecting');
     delete_config_option('currency');
     delete_config_option('ecommerce_test_mode');
     delete_config_option('ipn_test');
     delete_config_option('ipn');
     delete_config_option('ipn_password');
     delete_config_option('vpn_password');
     delete_config_option('vpn_username');
     delete_config_option('ipn_digest');
     delete_config_option('payment_gateway');
     delete_config_option('use_local_payment');
     delete_config_option('pd_address');
     delete_config_option('pd_email');
     delete_config_option('pd_number');
     delete_config_option('callback_password');
     delete_specific_permission('access_ecommerce_in_test_mode');
     delete_menu_item_simple('_SELF:purchase:type=misc');
     delete_menu_item_simple('_SELF:invoices:type=misc');
     delete_menu_item_simple('_SEARCH:purchase:type=misc');
     delete_menu_item_simple('_SEARCH:invoices:type=misc');
     delete_menu_item_simple('_SEARCH:subscriptions:type=misc');
 }
Beispiel #3
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('chargelog');
     $GLOBALS['SITE_DB']->drop_if_exists('gifts');
     delete_config_option('points_joining');
     delete_config_option('points_posting');
     delete_config_option('points_rating');
     delete_config_option('points_voting');
     delete_config_option('points_per_day');
     delete_config_option('points_per_daily_visit');
     delete_config_option('points_if_liked');
     delete_config_option('points_show_personal_stats_points_left');
     delete_config_option('points_show_personal_stats_points_used');
     delete_config_option('points_show_personal_stats_gift_points_left');
     delete_config_option('points_show_personal_stats_gift_points_used');
     delete_config_option('points_show_personal_stats_total_points');
     delete_config_option('points_show_personal_profile_link');
     delete_specific_permission('give_points_self');
     delete_specific_permission('have_negative_gift_points');
     delete_specific_permission('give_negative_points');
     delete_specific_permission('view_charge_log');
     delete_specific_permission('use_points');
     delete_specific_permission('trace_anonymous_gifts');
     delete_menu_item_simple('_SEARCH:points:type=member:id={$USER_OVERIDE}');
     delete_menu_item_simple('_SEARCH:points:type=member');
 }
Beispiel #4
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('prices');
     $GLOBALS['SITE_DB']->drop_if_exists('sales');
     $GLOBALS['SITE_DB']->drop_if_exists('pstore_customs');
     $GLOBALS['SITE_DB']->drop_if_exists('pstore_permissions');
     delete_config_option('is_on_banner_buy');
     delete_config_option('initial_banner_hits');
     delete_config_option('is_on_pop3_buy');
     delete_config_option('initial_quota');
     delete_config_option('max_quota');
     delete_config_option('mail_server');
     delete_config_option('pop_url');
     delete_config_option('quota_url');
     delete_config_option('is_on_forw_buy');
     delete_config_option('forw_url');
     delete_config_option('highlight_name');
     delete_config_option('topic_pin');
     delete_config_option('maximum_gamble_multiplier');
     delete_config_option('average_gamble_multiplier');
     delete_config_option('banner_setup');
     delete_config_option('banner_imp');
     delete_config_option('banner_hit');
     delete_config_option('quota');
     delete_config_option('text');
     delete_config_option('is_on_flagrant_buy');
     delete_config_option('is_on_highlight_name_buy');
     delete_config_option('is_on_topic_pin_buy');
     delete_config_option('is_on_gambling_buy');
     delete_config_option('minimum_gamble_amount');
     delete_config_option('maximum_gamble_amount');
     delete_menu_item_simple('_SEARCH:pointstore:type=misc');
 }
Beispiel #5
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('chat_rooms');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_messages');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_blocking');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_buddies');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_active');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_events');
     $GLOBALS['SITE_DB']->drop_if_exists('chat_sound_effects');
     delete_config_option('is_on_chat');
     delete_config_option('chat_flood_timelimit');
     delete_config_option('chat_default_post_colour');
     delete_config_option('chat_default_post_font');
     delete_config_option('chat_private_room_deletion_time');
     delete_config_option('username_click_im');
     delete_config_option('points_chat');
     delete_config_option('chat_show_stats_count_users');
     delete_config_option('chat_show_stats_count_rooms');
     delete_config_option('chat_show_stats_count_messages');
     delete_config_option('sitewide_im');
     delete_config_option('group_private_chatrooms');
     delete_specific_permission('create_private_room');
     delete_specific_permission('start_im');
     delete_specific_permission('moderate_my_private_rooms');
     delete_specific_permission('ban_chatters_from_rooms');
     $GLOBALS['SITE_DB']->query_delete('group_page_access', array('page_name' => 'cms_chat'));
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'chat'));
     delete_menu_item_simple('_SEARCH:chat:type=misc');
     delete_menu_item_simple('_SEARCH:chat:type=misc:member_id={$USER_OVERIDE}');
 }
Beispiel #6
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('download_categories');
     $GLOBALS['SITE_DB']->drop_if_exists('download_downloads');
     $GLOBALS['SITE_DB']->drop_if_exists('download_logging');
     $GLOBALS['SITE_DB']->drop_if_exists('download_licences');
     delete_config_option('maximum_download');
     delete_config_option('is_on_downloads');
     delete_config_option('show_dload_trees');
     delete_config_option('points_ADD_DOWNLOAD');
     delete_config_option('downloads_show_stats_count_total');
     delete_config_option('downloads_show_stats_count_archive');
     delete_config_option('downloads_show_stats_count_downloads');
     delete_config_option('downloads_show_stats_count_bandwidth');
     delete_config_option('immediate_downloads');
     delete_config_option('download_gallery_root');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'downloads'));
     $GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'downloads'));
     delete_value('download_bandwidth');
     delete_value('archive_size');
     delete_value('num_archive_downloads');
     delete_value('num_downloads_downloaded');
     deldir_contents(get_custom_file_base() . '/uploads/downloads', true);
     delete_menu_item_simple('_SEARCH:downloads:type=misc');
 }
Beispiel #7
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     delete_config_option('supermembers_groups');
     delete_config_option('supermembers_text');
     delete_config_option('is_on_supermember_filter');
     delete_menu_item_simple('_SEARCH:supermembers');
 }
Beispiel #8
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('filedump');
     delete_specific_permission('delete_anything_filedump');
     delete_specific_permission('upload_filedump');
     delete_specific_permission('upload_anything_filedump');
     //deldir_contents(get_custom_file_base().'/uploads/filedump',true);
     delete_menu_item_simple('_SEARCH:filedump:type=misc');
     delete_config_option('filedump_show_stats_count_total_files');
     delete_config_option('filedump_show_stats_count_total_space');
 }
Beispiel #9
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('shopping_cart');
     $GLOBALS['SITE_DB']->drop_if_exists('shopping_order_details');
     $GLOBALS['SITE_DB']->drop_if_exists('shopping_order');
     $GLOBALS['SITE_DB']->drop_if_exists('shopping_logging');
     $GLOBALS['SITE_DB']->drop_if_exists('shopping_order_addresses');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'shopping'));
     delete_config_option('shipping_cost_factor');
     delete_config_option('allow_opting_out_of_tax');
     delete_menu_item_simple('_SEARCH:catalogues:type=category:catalogue_name=products');
 }
Beispiel #10
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('ticket_types');
     $GLOBALS['SITE_DB']->drop_if_exists('tickets');
     delete_config_option('ticket_text');
     delete_config_option('ticket_forum_name');
     delete_config_option('ticket_member_forums');
     delete_config_option('ticket_type_forums');
     delete_specific_permission('view_others_tickets');
     delete_specific_permission('support_operator');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'tickets'));
     delete_menu_item_simple('_SEARCH:tickets:type=misc');
 }
Beispiel #11
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('quizzes');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_questions');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_question_answers');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_entries');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_member_last_visit');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_winner');
     $GLOBALS['SITE_DB']->drop_if_exists('quiz_entry_answer');
     delete_config_option('points_ADD_QUIZ');
     delete_config_option('quiz_show_stats_count_total_open');
     delete_specific_permission('bypass_quiz_repeat_time_restriction');
     delete_menu_item_simple('_SEARCH:quiz:type=misc');
 }
Beispiel #12
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>}');
     }
 }
Beispiel #13
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletters');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_archive');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_subscribe');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_drip_send');
     $GLOBALS['SITE_DB']->drop_if_exists('newsletter_periodic');
     delete_config_option('newsletter_text');
     delete_config_option('newsletter_title');
     delete_config_option('interest_levels');
     delete_value('newsletter_whatsnew');
     delete_value('newsletter_send_time');
     delete_specific_permission('change_newsletter_subscriptions');
     delete_menu_item_simple('_SEARCH:newsletter:type=misc');
 }
Beispiel #14
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('calendar_events');
     $GLOBALS['SITE_DB']->drop_if_exists('calendar_types');
     $GLOBALS['SITE_DB']->drop_if_exists('calendar_reminders');
     $GLOBALS['SITE_DB']->drop_if_exists('calendar_interests');
     $GLOBALS['SITE_DB']->drop_if_exists('calendar_jobs');
     $perms = array('view_event_subscriptions', 'view_calendar', 'add_public_events', 'edit_viewable_events', 'edit_owned_events', 'view_personal_events', 'sense_personal_conflicts');
     foreach ($perms as $perm) {
         delete_specific_permission($perm);
     }
     delete_menu_item_simple('_SEARCH:calendar:type=misc:member_id={$USER_OVERIDE}');
     delete_config_option('calendar_show_stats_count_events');
     delete_config_option('calendar_show_stats_count_events_this_week');
     delete_config_option('calendar_show_stats_count_events_this_month');
     delete_config_option('calendar_show_stats_count_events_this_year');
 }
Beispiel #15
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('news');
     $GLOBALS['SITE_DB']->drop_if_exists('news_categories');
     $GLOBALS['SITE_DB']->drop_if_exists('news_rss_cloud');
     $GLOBALS['SITE_DB']->drop_if_exists('news_category_entries');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'news'));
     $GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'news'));
     $GLOBALS['SITE_DB']->query_delete('rating', array('rating_for_type' => 'news'));
     delete_attachments('news');
     delete_config_option('points_ADD_NEWS');
     delete_config_option('news_update_time');
     delete_config_option('blog_update_time');
     delete_config_option('ping_url');
     delete_config_option('news_show_stats_count_total_posts');
     delete_config_option('news_show_stats_count_blogs');
     delete_menu_item_simple('_SEARCH:cms_news:type=ad');
 }
Beispiel #16
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('galleries');
     $GLOBALS['SITE_DB']->drop_if_exists('images');
     $GLOBALS['SITE_DB']->drop_if_exists('videos');
     $GLOBALS['SITE_DB']->drop_if_exists('video_transcoding');
     delete_config_option('default_video_width');
     delete_config_option('default_video_height');
     delete_config_option('maximum_image_size');
     delete_config_option('max_personal_gallery_images_low');
     delete_config_option('max_personal_gallery_images_high');
     delete_config_option('max_personal_gallery_videos_low');
     delete_config_option('max_personal_gallery_videos_high');
     delete_config_option('points_ADD_IMAGE');
     delete_config_option('points_ADD_VIDEO');
     delete_config_option('galleries_show_stats_count_galleries');
     delete_config_option('galleries_show_stats_count_images');
     delete_config_option('galleries_show_stats_count_videos');
     delete_config_option('show_empty_galleries');
     delete_config_option('gallery_name_order');
     delete_config_option('gallery_selectors');
     delete_config_option('reverse_thumb_order');
     delete_config_option('show_gallery_counts');
     delete_config_option('video_bitrate');
     delete_config_option('audio_bitrate');
     delete_config_option('ffmpeg_path');
     delete_config_option('transcoding_server');
     delete_config_option('transcoding_zencoder_api_key');
     delete_config_option('transcoding_zencoder_ftp_path');
     delete_config_option('video_width_setting');
     delete_config_option('video_height_setting');
     delete_specific_permission('may_download_gallery');
     delete_specific_permission('high_personal_gallery_limit');
     delete_specific_permission('no_personal_gallery_limit');
     $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'galleries'));
     $GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'galleries'));
     deldir_contents(get_custom_file_base() . '/uploads/galleries', true, true);
     deldir_contents(get_custom_file_base() . '/uploads/galleries_thumbs', true);
     delete_menu_item_simple('_SEARCH:galleries:type=misc');
 }
Beispiel #17
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     delete_menu_item_simple('_SEARCH:staff:type=misc');
 }
Beispiel #18
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('searches_saved');
     $GLOBALS['SITE_DB']->drop_if_exists('searches_logged');
     delete_menu_item_simple('_SEARCH:search:type=misc:id=ocf_posts');
 }
 /**
  * UI for a setup wizard step (done).
  *
  * @return tempcode		The UI
  */
 function step10()
 {
     $title = get_page_title('SETUP_WIZARD_STEP', true, array(integer_format(10), integer_format(10)));
     $GLOBALS['NO_QUERY_LIMIT'] = true;
     require_code('abstract_file_manager');
     force_have_afm_details();
     if (function_exists('set_time_limit')) {
         @set_time_limit(600);
     }
     require_code('config2');
     require_code('menus2');
     require_code('themes2');
     require_lang('zones');
     $header_text = post_param('header_text');
     $name = post_param('site_name');
     $theme = substr(preg_replace('#[^A-Za-z\\d]#', '_', $name), 0, 40);
     $installprofile = post_param('installprofile', '');
     if ($installprofile != '') {
         // Simplify down to a single menu
         foreach (array('main_community', 'main_content', 'main_features', 'main_website', 'root_website') as $merge_item) {
             $GLOBALS['SITE_DB']->query_update('menu_items', array('i_menu' => 'site'), array('i_menu' => $merge_item));
         }
         $duplicates = $GLOBALS['SITE_DB']->query_select('menu_items', array('id', 'COUNT(*) AS cnt'), array('i_menu' => 'site'), 'GROUP BY i_url');
         foreach ($duplicates as $duplicate) {
             if ($duplicate['cnt'] > 1) {
                 delete_menu_item($duplicate['id']);
             }
         }
         delete_menu_item_simple('site:');
         // Remove panel_top
         if (addon_installed('redirects_editor')) {
             $GLOBALS['SITE_DB']->query_delete('redirects', array('r_to_page' => 'panel_top'));
         }
         $fullpath = get_custom_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/panel_top.txt';
         if (file_exists($fullpath)) {
             @copy($fullpath, $fullpath . '.' . strval(time()));
         }
         $myfile = @fopen($fullpath, 'wt');
         if ($myfile !== false) {
             fwrite($myfile, '');
             fclose($myfile);
             fix_permissions($fullpath);
             sync_file($fullpath);
         }
         // Run any specific code for the profile
         $object = mixed();
         if (is_file(get_file_base() . '/sources/hooks/modules/admin_setupwizard_installprofiles/' . $installprofile . '.php') || is_file(get_file_base() . '/sources_custom/hooks/modules/admin_setupwizard_installprofiles/' . $installprofile . '.php')) {
             require_code('hooks/modules/admin_setupwizard_installprofiles/' . $installprofile);
             $object = object_factory('Hook_admin_setupwizard_installprofiles_' . $installprofile, true);
         }
         if (!is_null($object)) {
             $object->install_code();
             $installprofileblocks = $object->default_blocks();
         } else {
             $installprofileblocks = array();
         }
     } else {
         $installprofileblocks = array();
     }
     if (post_param_integer('skip_8', 0) == 0 && function_exists('imagecreatefromstring') && addon_installed('themewizard')) {
         require_code('themewizard');
         // Make theme
         global $IMG_CODES;
         $old_img_codes_site = $GLOBALS['SITE_DB']->query_select('theme_images', array('id', 'path'), array('theme' => $GLOBALS['FORUM_DRIVER']->get_theme(), 'lang' => user_lang()));
         if (!file_exists(get_custom_file_base() . '/themes/' . $theme)) {
             make_theme($theme, 'default', 'equations', post_param('seed_hex'), true, post_param_integer('dark', 0) == 1);
         }
         foreach (array($theme, 'default') as $logo_save_theme) {
             $logo = generate_logo($name, $header_text, false, $logo_save_theme, 'logo-template');
             $path = 'themes/' . $logo_save_theme . '/images_custom/-logo.png';
             @imagepng($logo, get_custom_file_base() . '/' . $path) or intelligent_write_error($path);
             actual_edit_theme_image('logo/-logo', $logo_save_theme, get_site_default_lang(), 'logo/-logo', $path, true);
             if (addon_installed('collaboration_zone')) {
                 actual_edit_theme_image('logo/collaboration-logo', $logo_save_theme, get_site_default_lang(), 'logo/collaboration-logo', $path, true);
             }
             imagedestroy($logo);
             $logo = generate_logo($name, $header_text, false, $logo_save_theme, 'trimmed-logo-template');
             $path = 'themes/' . $logo_save_theme . '/images_custom/trimmed-logo.png';
             @imagepng($logo, get_custom_file_base() . '/' . $path) or intelligent_write_error($path);
             actual_edit_theme_image('logo/trimmed-logo', $logo_save_theme, get_site_default_lang(), 'logo/trimmed-logo', $path, true);
             imagedestroy($logo);
         }
         $myfile = fopen(get_custom_file_base() . '/themes/' . filter_naughty($theme) . '/theme.ini', 'wt');
         fwrite($myfile, 'title=' . $name . chr(10));
         fwrite($myfile, 'description=' . do_lang('NA') . chr(10));
         if (fwrite($myfile, 'author=ocPortal' . chr(10)) == 0) {
             warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
         }
         fclose($myfile);
         sync_file(get_custom_file_base() . '/themes/' . filter_naughty($theme) . '/theme.ini');
         $IMG_CODES['site'] = $old_img_codes_site;
         // Just so it renders with the old theme
     }
     // Set options
     if (post_param_integer('skip_3', 0) == 0) {
         set_option('site_name', $name);
         set_option('copyright', 'Copyright &copy; ' . $name . ' ' . date('Y'));
         set_option('description', post_param('description'));
         set_option('site_scope', post_param('site_scope'));
         set_option('copyright', post_param('copyright'));
         set_option('staff_address', post_param('staff_address'));
         set_option('keywords', post_param('keywords'));
         set_option('google_analytics', post_param('google_analytics'));
         set_option('fixed_width', post_param('fixed_width', '0'));
         $a = $GLOBALS['SITE_DB']->query_value('zones', 'zone_header_text', array('zone_name' => ''));
         lang_remap($a, $header_text);
         $b = $GLOBALS['SITE_DB']->query_value_null_ok('zones', 'zone_header_text', array('zone_name' => 'site'));
         if (!is_null($b)) {
             lang_remap($b, $header_text);
         }
     }
     if (post_param_integer('skip_9', 0) == 0) {
         set_option('site_closed', strval(post_param_integer('site_closed', 0)));
         set_option('closed', post_param('closed', ''));
     }
     // Set addons
     if (post_param_integer('skip_4', 0) == 0 && get_file_base() == get_custom_file_base()) {
         require_lang('addons');
         require_code('addons');
         $addons_installed = find_installed_addons();
         $uninstalling = array();
         foreach ($addons_installed as $addon_row) {
             if (post_param_integer('addon_' . $addon_row['addon_name'], 0) == 0) {
                 $uninstalling[$addon_row['addon_name']] = $addon_row;
             }
         }
         if (!file_exists(get_file_base() . '/.svn')) {
             do {
                 $cnt = count($uninstalling);
                 foreach ($addons_installed as $addon_row) {
                     if (array_key_exists($addon_row['addon_name'], $uninstalling)) {
                         $addon_row += read_addon_info($addon_row['addon_name']);
                         $addon_row['addon_author'] = '';
                         // Fudge, to stop it dying on warnings for official addons
                         // Check dependencies
                         $dependencies = $addon_row['addon_dependencies_on_this'];
                         foreach (array_keys($uninstalling) as $d) {
                             if (in_array($d, $dependencies)) {
                                 // Can mark this dependency as irrelevant, as we are uninstalling the addon for it anyway
                                 unset($dependencies[array_search($d, $dependencies)]);
                             }
                         }
                         if (count($dependencies) != 0) {
                             unset($uninstalling[$addon_row['addon_name']]);
                         }
                     }
                 }
             } while ($cnt != count($uninstalling));
             // Dependency chains can be complex, so loop until we're stopped finding anything changing
             foreach ($uninstalling as $addon_row) {
                 // Archive it off to exports/addons
                 if ($addon_row['addon_files'] != '') {
                     $file = preg_replace('#^[\\_\\.\\-]#', 'x', preg_replace('#[^\\w\\.\\-]#', '_', $addon_row['addon_name'])) . '.tar';
                     create_addon($file, explode(chr(10), $addon_row['addon_files']), $addon_row['addon_name'], implode(',', $addon_row['addon_incompatibilities']), implode(',', $addon_row['addon_dependencies']), $addon_row['addon_author'], $addon_row['addon_organisation'], $addon_row['addon_version'], $addon_row['addon_description'], 'imports/addons');
                 }
                 uninstall_addon($addon_row['addon_name']);
             }
         }
     }
     // Set features
     if (post_param_integer('skip_5', 0) == 0) {
         $hooks = find_all_hooks('modules', 'admin_setupwizard');
         foreach (array_keys($hooks) as $hook) {
             if (post_param_integer('addon_' . $hook, 0) == 1) {
                 $path = get_file_base() . '/sources_custom/modules/systems/admin_setupwizard/' . filter_naughty_harsh($hook) . '.php';
                 if (!file_exists($path)) {
                     $path = get_file_base() . '/sources/hooks/modules/admin_setupwizard/' . filter_naughty_harsh($hook) . '.php';
                 }
                 $_hook_bits = extract_module_functions($path, array('set_fields'));
                 if (is_array($_hook_bits[0])) {
                     call_user_func_array($_hook_bits[0][0], $_hook_bits[0][1]);
                 } else {
                     @eval($_hook_bits[0]);
                 }
             }
         }
         set_option('show_content_tagging', post_param('show_content_tagging', '0'));
         set_option('show_content_tagging_inline', post_param('show_content_tagging_inline', '0'));
         set_option('show_screen_actions', post_param('show_screen_actions', '0'));
     }
     // Zone structure
     $collapse_zones = post_param_integer('collapse_user_zones', 0) == 1;
     if (post_param_integer('skip_5', 0) == 0) {
         require_code('config2');
         set_option('collapse_user_zones', strval($collapse_zones));
         /*if (addon_installed('redirects_editor')) Old method
         		{
         			if ($collapse_zones)
         			{
         				$test=$GLOBALS['SITE_DB']->query_value_null_ok('redirects','r_from_page',array('r_from_page'=>'panel_left','r_from_zone'=>'site'));
         				if (is_null($test)) $GLOBALS['SITE_DB']->query_insert('redirects',array('r_from_page'=>'panel_left','r_from_zone'=>'site','r_to_page'=>'panel_left','r_to_zone'=>'','r_is_transparent'=>1));
         				$test=$GLOBALS['SITE_DB']->query_value_null_ok('redirects','r_from_page',array('r_from_page'=>'panel_right','r_from_zone'=>'site'));
         				if (is_null($test)) $GLOBALS['SITE_DB']->query_insert('redirects',array('r_from_page'=>'panel_right','r_from_zone'=>'site','r_to_page'=>'panel_right','r_to_zone'=>'','r_is_transparent'=>1));
         				$test=$GLOBALS['SITE_DB']->query_value_null_ok('redirects','r_from_page',array('r_from_page'=>'start','r_from_zone'=>'site'));
         				if (is_null($test)) $GLOBALS['SITE_DB']->query_insert('redirects',array('r_from_page'=>'start','r_from_zone'=>'site','r_to_page'=>'start','r_to_zone'=>'','r_is_transparent'=>1));
         			} else
         			{
         				$GLOBALS['SITE_DB']->query_delete('redirects',array('r_from_page'=>'panel_left','r_from_zone'=>'site','r_to_page'=>'panel_left','r_to_zone'=>''),'',1);
         				$GLOBALS['SITE_DB']->query_delete('redirects',array('r_from_page'=>'panel_right','r_from_zone'=>'site','r_to_page'=>'panel_right','r_to_zone'=>''),'',1);
         				$GLOBALS['SITE_DB']->query_delete('redirects',array('r_from_page'=>'start','r_from_zone'=>'site','r_to_page'=>'start','r_to_zone'=>''),'',1);
         			}
         		}*/
         if (post_param_integer('guest_zone_access', 0) == 1) {
             $guest_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups($GLOBALS['FORUM_DRIVER']->get_guest_id());
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('group_zone_access', 'zone_name', array('zone_name' => 'site', 'group_id' => $guest_groups[0]));
             if (is_null($test)) {
                 $GLOBALS['SITE_DB']->query_insert('group_zone_access', array('zone_name' => 'site', 'group_id' => $guest_groups[0]));
             }
         }
     }
     // Rules
     if (post_param_integer('skip_7', 0) == 0) {
         $fullpath = get_custom_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/rules.txt';
         if (file_exists($fullpath)) {
             @copy($fullpath, $fullpath . '.' . strval(time()));
             fix_permissions($fullpath . '.' . strval(time()));
             sync_file($fullpath . '.' . strval(time()));
         }
         $myfile = @fopen($fullpath, 'wt') or intelligent_write_error(get_custom_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/rules.txt');
         $rf = $this->get_rules_file(post_param('rules'));
         if (fwrite($myfile, $rf) < strlen($rf)) {
             warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
         }
         fclose($myfile);
         fix_permissions($fullpath);
         sync_file($fullpath);
     }
     $block_options = mixed();
     if ($installprofile != '' && !is_null($object)) {
         $block_options = $object->block_options();
     }
     // Blocks
     if (post_param_integer('skip_6', 0) == 0) {
         require_code('setupwizard');
         $page_structure = _get_zone_pages($installprofileblocks, $block_options, $collapse_zones, $installprofile);
         foreach ($page_structure as $zone => $zone_pages) {
             // Start
             $fullpath = get_custom_file_base() . '/' . $zone . '/pages/comcode_custom/' . get_site_default_lang() . '/start.txt';
             if (file_exists($fullpath)) {
                 @copy($fullpath, $fullpath . '.' . strval(time()));
             }
             $myfile = @fopen($fullpath, 'wt') or intelligent_write_error($fullpath);
             if ($myfile !== false) {
                 if ($zone_pages['start'] != '') {
                     if (fwrite($myfile, $zone_pages['start']) == 0) {
                         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
                     }
                 }
                 fclose($myfile);
                 fix_permissions($fullpath);
                 sync_file($fullpath);
             }
             // Left
             $fullpath = get_custom_file_base() . '/' . $zone . '/pages/comcode_custom/' . get_site_default_lang() . '/panel_left.txt';
             if (file_exists($fullpath)) {
                 @copy($fullpath, $fullpath . '.' . strval(time()));
             }
             $myfile = @fopen($fullpath, 'wt');
             if ($myfile !== false) {
                 if ($zone_pages['left'] != '') {
                     if (fwrite($myfile, $zone_pages['left']) == 0) {
                         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
                     }
                 }
                 fclose($myfile);
                 fix_permissions($fullpath);
                 sync_file($fullpath);
             }
             // Right
             $fullpath = get_custom_file_base() . '/' . $zone . '/pages/comcode_custom/' . get_site_default_lang() . '/panel_right.txt';
             if (file_exists($fullpath)) {
                 @copy($fullpath, $fullpath . '.' . strval(time()));
             }
             $myfile = fopen($fullpath, 'wt');
             if ($myfile !== false) {
                 if ($zone_pages['right'] != '') {
                     if (fwrite($myfile, $zone_pages['right']) == 0) {
                         warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
                     }
                 }
                 fclose($myfile);
                 fix_permissions($fullpath);
                 sync_file($fullpath);
             }
         }
     }
     // We're done
     set_value('setup_wizard_completed', '1');
     // Clear some cacheing
     require_code('view_modes');
     require_code('zones3');
     erase_comcode_page_cache();
     erase_tempcode_cache();
     //persistant_cache_delete('OPTIONS');  Done by set_option
     persistant_cache_empty();
     erase_cached_templates();
     //breadcrumb_set_parents(array(array('_SELF:_SELF:misc',do_lang_tempcode('START'))));
     //breadcrumb_set_self(do_lang_tempcode('SETUP_WIZARD_STEP',integer_format(10),integer_format(10)));
     $url = build_url(array('page' => '_SELF', 'type' => 'step11'), '_SELF');
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Beispiel #20
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     $GLOBALS['SITE_DB']->drop_if_exists('authors');
     delete_menu_item_simple('_SELF:authors:type=misc');
     delete_menu_item_simple('_SEARCH:cms_authors:type=_ad');
 }
Beispiel #21
0
 /**
  * Standard modular run function for setting features from the setup wizard.
  */
 function set_fields()
 {
     if (!addon_installed('catalogues')) {
         return;
     }
     if (post_param_integer('have_default_catalogues_hosting', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'hosted'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('hosted');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=hosted');
         }
     }
     if (post_param_integer('have_default_catalogues_projects', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'projects'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('projects');
             require_lang('catalogues');
             delete_menu_item_simple(do_lang('DEFAULT_CATALOGUE_PROJECTS_TITLE'));
             delete_menu_item_simple('_SEARCH:catalogues:id=projects:type=index');
             delete_menu_item_simple('_SEARCH:cms_catalogues:type=add_entry:catalogue_name=projects');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=projects');
         }
     }
     if (post_param_integer('have_default_catalogues_faqs', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'faqs'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('faqs');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=faqs');
         }
     }
     if (post_param_integer('have_default_catalogues_links', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'links'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('links');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=links');
         }
     }
     if (post_param_integer('have_default_catalogues_modifications', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'modifications'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('modifications');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=modifications');
         }
     }
     if (post_param_integer('have_default_catalogues_contacts', 0) == 0) {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'c_name', array('c_name' => 'contacts'));
         if (!is_null($test)) {
             require_code('catalogues2');
             actual_delete_catalogue('contacts');
             delete_menu_item_simple('_SEARCH:catalogues:type=index:id=contacts');
         }
     }
 }
Beispiel #22
0
 /**
  * Standard modular uninstall function.
  */
 function uninstall()
 {
     delete_menu_item_simple('_SEARCH:forumview:type=misc');
     delete_menu_item_simple('_SEARCH:forumview:type=pt:id={$USER_OVERIDE}');
     delete_menu_item_simple('_SEARCH:forumview:type=pt');
     delete_menu_item_simple('_SEARCH:vforums:type=misc');
     delete_menu_item_simple('_SEARCH:vforums:type=unread');
 }