Ejemplo n.º 1
0
 /**
  * Uninstaller
  *
  * Will unconditionally reinstall the default media sites
  *
  * @return void
  */
 public static function uninstall()
 {
     try {
         $defaultData = XenForo_Install_Data_MySql::getData();
         $query = preg_replace('(^(\\s*)INSERT)', '$1REPLACE', $defaultData['xf_bb_code_media_site']);
         XenForo_Application::getDb()->query($query);
     } catch (Exception $e) {
         // Nothing to do here
     }
 }
Ejemplo n.º 2
0
 public function insertDefaultData()
 {
     $db = $this->_getDb();
     $insertData = XenForo_Install_Data_MySql::getData();
     foreach ($insertData as $data) {
         $db->query($data);
     }
     return count($data);
 }
Ejemplo n.º 3
0
    public function step1()
    {
        $db = $this->_getDb();
        $tables = XenForo_Install_Data_MySql::getTables();
        $data = XenForo_Install_Data_MySql::getData();
        // new content types
        $db->query("\n\t\t\tINSERT IGNORE INTO xf_content_type\n\t\t\t\t(content_type, addon_id, fields)\n\t\t\tVALUES\n\t\t\t\t('attachment', 'XenForo', ''),\n\t\t\t\t('conversation_message', 'XenForo', '')\n\t\t");
        $db->query("\n\t\t\tINSERT IGNORE INTO xf_content_type_field\n\t\t\t\t(content_type, field_name, field_value)\n\t\t\tVALUES\n\t\t\t\t('attachment', 'stats_handler_class', 'XenForo_StatsHandler_Attachment'),\n\t\t\t\t('conversation', 'stats_handler_class', 'XenForo_StatsHandler_Conversation'),\n\t\t\t\t('conversation_message', 'report_handler_class', 'XenForo_ReportHandler_ConversationMessage'),\n\t\t\t\t('post', 'stats_handler_class', 'XenForo_StatsHandler_Post'),\n\t\t\t\t('thread', 'stats_handler_class', 'XenForo_StatsHandler_Thread'),\n\t\t\t\t('user', 'stats_handler_class', 'XenForo_StatsHandler_User'),\n\t\t\t\t('profile_post', 'stats_handler_class', 'XenForo_StatsHandler_ProfilePost'),\n\n\t\t\t\t('profile_post', 'search_handler_class', 'XenForo_Search_DataHandler_ProfilePost'),\n\n\t\t\t\t('post', 'moderator_log_handler_class', 'XenForo_ModeratorLogHandler_Post'),\n\t\t\t\t('thread', 'moderator_log_handler_class', 'XenForo_ModeratorLogHandler_Thread'),\n\t\t\t\t('profile_post', 'moderator_log_handler_class', 'XenForo_ModeratorLogHandler_ProfilePost'),\n\n\t\t\t\t('user', 'warning_handler_class', 'XenForo_WarningHandler_User'),\n\t\t\t\t('post', 'warning_handler_class', 'XenForo_WarningHandler_Post'),\n\t\t\t\t('profile_post', 'warning_handler_class', 'XenForo_WarningHandler_ProfilePost'),\n\n\t\t\t\t('conversation_message', 'attachment_handler_class', 'XenForo_AttachmentHandler_ConversationMessage')\n\t\t");
        $this->executeUpgradeQuery($tables['xf_stats_daily']);
        $this->executeUpgradeQuery($tables['xf_admin_log']);
        $this->executeUpgradeQuery($tables['xf_moderator_log']);
        // admin search
        $this->executeUpgradeQuery($tables['xf_admin_search_type']);
        $this->executeUpgradeQuery($data['xf_admin_search_type']);
        // misc
        $this->executeUpgradeQuery("ALTER TABLE xf_search ADD user_results MEDIUMBLOB NOT NULL AFTER search_grouping");
        $this->executeUpgradeQuery("ALTER TABLE xf_language ADD text_direction enum('LTR','RTL') NOT NULL DEFAULT 'LTR'");
        $this->executeUpgradeQuery("ALTER TABLE xf_trophy CHANGE criteria user_criteria MEDIUMBLOB NOT NULL");
        // new thread viewing permissions: insert for all groups that can view the board
        $this->applyGlobalPermission('forum', 'viewOthers', 'general', 'view', false);
        $this->applyGlobalPermission('forum', 'viewContent', 'general', 'view', false);
        // new conversation attachment permissions: insert for mods and admins only by default
        $db->query("\n\t\t\tINSERT IGNORE INTO xf_permission_entry\n\t\t\t\t(user_group_id, user_id, permission_group_id, permission_id, permission_value, permission_value_int)\n\t\t\tVALUES\n\t\t\t\t(3, 0, 'conversation', 'uploadAttachment', 'allow', 0),\n\t\t\t\t(4, 0, 'conversation', 'uploadAttachment', 'allow', 0)\n\t\t");
        // user group promotions
        $this->executeUpgradeQuery($tables['xf_user_group_promotion']);
        $this->executeUpgradeQuery($tables['xf_user_group_promotion_log']);
        // notices
        $this->executeUpgradeQuery($tables['xf_notice']);
        $this->executeUpgradeQuery($tables['xf_notice_dismissed']);
        // custom user fields and ignore list
        $this->executeUpgradeQuery($tables['xf_user_field']);
        $this->executeUpgradeQuery($tables['xf_user_field_value']);
        $this->executeUpgradeQuery($tables['xf_user_ignored']);
        $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_user_profile\n\t\t\t\tADD custom_fields MEDIUMBLOB NOT NULL,\n\t\t\t\tADD ignored TEXT NOT NULL COMMENT 'Comma-separated integers from xf_user_ignored'\n\t\t");
        // conversation attachments
        $this->executeUpgradeQuery("ALTER TABLE xf_conversation_message ADD attach_count SMALLINT UNSIGNED NOT NULL DEFAULT 0");
        // bb code media site upgrades
        $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_bb_code_media_site\n\t\t\t\tADD match_is_regex TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'If 1, match_urls will be treated as regular expressions rather than simple URL matches.' AFTER match_urls,\n\t\t\t\tADD match_callback_class VARCHAR(75) NOT NULL DEFAULT '' AFTER match_is_regex,\n\t\t\t\tADD match_callback_method VARCHAR(50) NOT NULL DEFAULT '' AFTER match_callback_class,\n\t\t\t\tADD embed_html_callback_class VARCHAR(75) NOT NULL DEFAULT '' AFTER embed_html,\n\t\t\t\tADD embed_html_callback_method VARCHAR(50) NOT NULL DEFAULT '' AFTER embed_html_callback_class,\n\t\t\t\tADD addon_id VARCHAR(25) NOT NULL DEFAULT ''\n\t\t");
        $this->executeUpgradeQuery('
			INSERT INTO xf_bb_code_media_site
				(media_site_id, site_title, site_url, match_urls, embed_html, match_is_regex)
			VALUES
				(\'metacafe\', \'Metacafe\', \'http://www.metacafe.com\', \'#metacafe\\.com/watch/(?P<id>\\d+\\/[a-z0-9_]+)/#siU\', \'<embed flashVars="playerVars=autoPlay=no"\\n	src="http://www.metacafe.com/fplayer/{$id}.swf"\\n	width="500" height="300" wmode="transparent"\\n	allowFullScreen="true" allowScriptAccess="always"\\n	pluginspage="http://www.macromedia.com/go/getflashplayer"\\n	type="application/x-shockwave-flash">\\n</embed>\', 1),
				(\'dailymotion\', \'Dailymotion\', \'http://www.dailymotion.com\', \'dailymotion.com/video/{$id:alphanum}\', \'<iframe frameborder="0" width="500" height="300" src="http://www.dailymotion.com/embed/video/{$id}?width=500&hideInfos=1"></iframe>\', 0),
				(\'liveleak\', \'Liveleak\', \'http://www.liveleak.com\', \'liveleak.com/view?i={$id}\', \'<object width="500" height="300">\\n	<param name="movie" value="http://www.liveleak.com/e/{$id}"></param>\\n	<param name="wmode" value="transparent"></param>\\n	<param name="allowscriptaccess" value="always"></param>\\n	<embed src="http://www.liveleak.com/e/{$id}" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="500" height="300"></embed>\\n</object>\', 0)
		');
        // basic warning stuff
        $this->executeUpgradeQuery($tables['xf_warning']);
        $this->executeUpgradeQuery($tables['xf_warning_definition']);
        $this->executeUpgradeQuery($tables['xf_warning_action']);
        $this->executeUpgradeQuery($tables['xf_warning_action_trigger']);
        // warning view based on viewing IPs
        $this->applyGlobalPermission('general', 'viewWarning', 'general', 'viewIps');
        // general give/manage warnings based on spam cleaner
        $this->applyGlobalPermission('general', 'warn', 'general', 'cleanSpam');
        $this->applyGlobalPermission('general', 'manageWarning', 'general', 'cleanSpam');
        // forum warning based on deleting posts
        $this->applyGlobalPermission('forum', 'warn', 'forum', 'deleteAnyPost');
        $this->applyContentPermission('forum', 'warn', 'forum', 'deleteAnyPost');
        // profile post warning based on deleting profile posts
        $this->applyGlobalPermission('profilePost', 'warn', 'profilePost', 'deleteAny');
        // default warnings
        $db->query("\n\t\t\tINSERT IGNORE INTO xf_warning_definition\n\t\t\t\t(warning_definition_id, points_default, expiry_type, expiry_default, extra_user_group_ids, is_editable)\n\t\t\tVALUES\n\t\t\t\t(1, 1, 'months', 1, '', 1),\n\t\t\t\t(2, 1, 'months', 1, '', 1),\n\t\t\t\t(3, 1, 'months', 1, '', 1),\n\t\t\t\t(4, 1, 'months', 1, '', 1)\n\t\t");
        $db->query("\n\t\t\tINSERT IGNORE INTO xf_phrase\n\t\t\t\t(language_id, title, phrase_text, global_cache, addon_id)\n\t\t\tVALUES\n\t\t\t\t(0, 'warning_definition_1_title', 'Inappropriate Content', 0, ''),\n\t\t\t\t(0, 'warning_definition_1_conversation_title', 'Inappropriate Content', 0, ''),\n\t\t\t\t(0, 'warning_definition_1_conversation_text', '{name},\n\nYour message ([url={url}]{title}[/url]) contains inappropriate content. Please do not discuss content of this nature on our site. This does not follow our rules. Your message may have been removed or altered.\n\nYour account''s access may be limited based on these actions. Please keep this in mind when posting or using our site.', 0, ''),\n\t\t\t\t(0, 'warning_definition_2_title', 'Inappropriate Behavior', 0, ''),\n\t\t\t\t(0, 'warning_definition_2_conversation_title', 'Inappropriate Behavior', 0, ''),\n\t\t\t\t(0, 'warning_definition_2_conversation_text', '{name},\n\nYour actions in this message ([url={url}]{title}[/url]) are not appropriate. We cannot allow users to be abusive, overly aggressive, threatening, or to \"troll\". This does not follow our rules. Your message may have been removed or altered.\n\nYour account''s access may be limited based on these actions. Please keep this in mind when posting or using our site.', 0, ''),\n\t\t\t\t(0, 'warning_definition_3_title', 'Inappropriate Language', 0, ''),\n\t\t\t\t(0, 'warning_definition_3_conversation_title', 'Inappropriate Language', 0, ''),\n\t\t\t\t(0, 'warning_definition_3_conversation_text', '{name},\n\nYour message ([url={url}]{title}[/url]) contains inappropriate language. This does not follow our rules. Your message may have been removed or altered.\n\nYour account''s access may be limited based on these actions. Please keep this in mind when posting or using our site.', 0, ''),\n\t\t\t\t(0, 'warning_definition_4_title', 'Inappropriate Advertising / Spam', 0, ''),\n\t\t\t\t(0, 'warning_definition_4_conversation_title', 'Inappropriate Advertising / Spam', 0, ''),\n\t\t\t\t(0, 'warning_definition_4_conversation_text', '{name},\n\nYour message ([url={url}]{title}[/url]) contains inappropriate advertising or spam. This does not follow our rules. Your message may have been removed or altered.\n\nYour account''s access may be limited based on these actions. Please keep this in mind when posting or using our site.', 0, '')\n\t\t");
        // smilie sprite mode
        $this->executeUpgradeQuery("\n\t\t\tALTER TABLE xf_smilie\n\t\t\t\tADD sprite_mode TINYINT UNSIGNED NOT NULL DEFAULT 0,\n\t\t\t\tADD sprite_params TEXT NOT NULL\n\t\t");
        return true;
    }