Example #1
0
require_once 'includes/cp-global.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $DB = GetDB();
    $tables = GetDBTables();
    $reset = true;
    $settings = array('cookie_path' => '/', 'dec_point' => '.', 'thousands_sep' => ',', 'timezone' => 'America/Chicago', 'template' => 'Default-Blue-Rewrite', 'language' => 'en_US', 'video_extensions' => 'avi,mpg,mpeg,flv,f4v,rm,asf,wmv,mov,mp4,ts,m2t', 'video_size' => '512x384', 'video_bitrate' => '26', 'audio_bitrate' => '128', 'thumb_size' => '120x90', 'thumb_quality' => '90', 'thumb_amount' => '15', 'max_upload_size' => '50MB', 'max_upload_duration' => '00:20:00', 'flag_mod_rewrite' => '1', 'mailer' => 'mail', 'flag_user_confirm_email' => '0', 'date_format' => 'm-d-Y', 'time_format' => 'h:i:s', 'avatar_dimensions' => '200x200', 'avatar_filesize' => '100KB', 'avatar_extensions' => 'jpg,gif,png', 'flag_user_strip_tags' => '1', 'video_format' => '0', 'flag_allow_uploads' => '1', 'flag_upload_reject_duplicates' => '1', 'flag_upload_allow_private' => '1', 'flag_upload_convert' => '', 'flag_upload_review' => '', 'upload_extensions' => 'avi,mpg,mpeg,flv,f4v,rm,asf,wmv,mov,mp4,ts,m2t', 'title_min_length' => '10', 'title_max_length' => '100', 'description_min_length' => '10', 'description_max_length' => '500', 'tags_min' => '1', 'tags_max' => '10', 'flag_video_strip_tags' => '1', 'comment_max_length' => '500', 'comment_throttle_period' => '120', 'flag_comment_strip_tags' => '1', 'captcha_min_length' => '4', 'captcha_max_length' => '6', 'flag_captcha_words' => '1', 'flag_captcha_on_signup' => '1', 'flag_captcha_on_upload' => '0', 'flag_captcha_on_comment' => '1', 'cache_main' => '3600', 'cache_search' => '3600', 'cache_categories' => '3600', 'cache_browse' => '3600', 'cache_video' => '3600', 'cache_profile' => '3600', 'cache_comments' => '3600', 'cache_custom' => '3600');
    // Reset Config.php file
    Config::Save($settings, true);
    // Reset database.xml file
    $schema = GetDBSchema();
    $custom_tables = array(array('name' => 'tbx_user_custom', 'field' => 'username'), array('name' => 'tbx_video_custom', 'field' => 'video_id'), array('name' => 'tbx_category_custom', 'field' => 'category_id'), array('name' => 'tbx_sponsor_custom', 'field' => 'sponsor_id'));
    foreach ($custom_tables as $table) {
        $xtable = $schema->el('//table[name="' . $table['name'] . '"]');
        foreach ($xtable->xpath('./columns/column') as $xcolumn) {
            if ($xcolumn->name->val() != $table['field']) {
                XML_Schema::DeleteColumn($table['name'], $xcolumn->name->val());
            }
        }
    }
    // Remove all database tables
    foreach ($tables as $table) {
        $DB->Update('DROP TABLE IF EXISTS #', array($table));
    }
    // Clear out directories
    $dirs = array('temp', 'uploads', 'videos', 'templates/_cache');
    foreach ($dirs as $dir) {
        $dir = BASE_DIR . '/' . $dir;
        // Remove sub-directories and their contents
        $removals = Dir::ReadDirectories($dir, '~^[^.]~');
        foreach ($removals as $removal) {
            Dir::Remove($dir . '/' . $removal);
Example #2
0
function tbxGenericCustomFieldDelete($item, $custom_table)
{
    // Delete column from XML schema
    XML_Schema::DeleteColumn($custom_table, $item['name']);
    // Remove column from the database
    $DB = GetDB();
    $DB->Update('DELETE FROM # WHERE `name`=?', array($custom_table . '_schema', $item['name']));
    $DB->Update('ALTER TABLE # DROP COLUMN #', array($custom_table, $item['name']));
}