예제 #1
0
// $Id$
define('AT_INCLUDE_PATH', '../../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
admin_authenticate(AT_ADMIN_PRIV_COURSES);
$course = intval($_REQUEST['course']);
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: ../../courses/admin/courses.php');
    exit;
} else {
    if (isset($_POST['step']) && $_POST['step'] == 2 && isset($_POST['submit_yes'])) {
        require_once AT_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php';
        require AT_INCLUDE_PATH . '../mods/_core/properties/lib/delete_course.inc.php';
        delete_course($course, $entire_course = true, $rel_path = '../');
        // delete the course
        cache_purge('system_courses', 'system_courses');
        // purge the system_courses cache (if successful)
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: ../../courses/admin/courses.php');
        exit;
    }
}
require AT_INCLUDE_PATH . 'header.inc.php';
if (!isset($_POST['step'])) {
    $hidden_vars['step'] = 1;
    $hidden_vars['course'] = $course;
    $msg->addConfirm(array('DELETE_COURSE_1', $system_courses[$course]['title']), $hidden_vars);
    $msg->printConfirm();
} else {
    if ($_POST['step'] == 1) {
        $hidden_vars['step'] = 2;
예제 #2
0
파일: index.php 프로젝트: phpbb/automod
}
include $phpbb_root_path . 'includes/functions_mods.' . $phpEx;
// The name of the mod to be displayed during installation.
$mod_name = 'AUTOMOD';
/*
* The name of the config variable which will hold the currently installed version
* You do not need to set this yourself, UMIL will handle setting and updating the version itself.
*/
$version_config_name = 'automod_version';
/*
* The language file which will be included when installing
* Language entries that should exist in the language file for UMIL (replace $mod_name with the mod's name you set to $mod_name above)
* $mod_name
* 'INSTALL_' . $mod_name
* 'INSTALL_' . $mod_name . '_CONFIRM'
* 'UPDATE_' . $mod_name
* 'UPDATE_' . $mod_name . '_CONFIRM'
* 'UNINSTALL_' . $mod_name
* 'UNINSTALL_' . $mod_name . '_CONFIRM'
*/
$language_file = 'acp/mods';
// Logo Image
$logo_image = 'install/automod_logo.png';
// Get version info
include $phpbb_root_path . 'install/install_versions.' . $phpEx;
// Include the UMIF Auto file and everything else will be handled automatically.
include $phpbb_root_path . 'umil/umil_auto.' . $phpEx;
// clear cache
cache_purge('', 0);
cache_purge('auth', 0);
/**
* Here is our custom function that will be called for version 3.0.8
* Because this is our first time installing through UMIL,
* we have a lot to check before installing, so use a custom function
*
* @param string $action The action (install|update|uninstall) will be sent through this.
* @param string $version The version this is being run for will be sent through this.
*/
function abbc3_308($action, $version)
{
    global $db, $cache, $user, $umil, $config;
    $message = '';
    // CONFIG TABLE - an array of config entries (check to see if any already exists from prior version)
    $abbc3_config_data = array('ABBC3_MOD' => isset($config['ABBC3_MOD']) ? $config['ABBC3_MOD'] : 1, 'ABBC3_PATH' => isset($config['ABBC3_PATH']) ? $config['ABBC3_PATH'] : 'styles/abbcode', 'ABBC3_BG' => isset($config['ABBC3_BG']) ? $config['ABBC3_BG'] : 'bg_abbc3.gif', 'ABBC3_TAB' => isset($config['ABBC3_TAB']) ? $config['ABBC3_TAB'] : 1, 'ABBC3_BOXRESIZE' => isset($config['ABBC3_BOXRESIZE']) ? $config['ABBC3_BOXRESIZE'] : 1, 'ABBC3_RESIZE' => isset($config['ABBC3_RESIZE']) ? $config['ABBC3_RESIZE'] : 1, 'ABBC3_RESIZE_METHOD' => isset($config['ABBC3_RESIZE_METHOD']) ? $config['ABBC3_RESIZE_METHOD'] : 'prettyPhoto', 'ABBC3_RESIZE_BAR' => isset($config['ABBC3_RESIZE_BAR']) ? $config['ABBC3_RESIZE_BAR'] : 1, 'ABBC3_MAX_IMG_WIDTH' => isset($config['ABBC3_MAX_IMG_WIDTH']) ? $config['ABBC3_MAX_IMG_WIDTH'] : ($config['img_max_width'] ? $config['img_max_width'] : 500), 'ABBC3_MAX_IMG_HEIGHT' => isset($config['ABBC3_MAX_IMG_HEIGHT']) ? $config['ABBC3_MAX_IMG_HEIGHT'] : ($config['img_max_height'] ? $config['img_max_height'] : 0), 'ABBC3_RESIZE_SIGNATURE' => isset($config['ABBC3_RESIZE_SIGNATURE']) ? $config['ABBC3_RESIZE_SIGNATURE'] : 0, 'ABBC3_MAX_SIG_WIDTH' => isset($config['ABBC3_MAX_SIG_WIDTH']) ? $config['ABBC3_MAX_SIG_WIDTH'] : ($config['max_sig_img_width'] ? $config['max_sig_img_width'] : 500), 'ABBC3_MAX_SIG_HEIGHT' => isset($config['ABBC3_MAX_SIG_HEIGHT']) ? $config['ABBC3_MAX_SIG_HEIGHT'] : 100, 'ABBC3_MAX_THUM_WIDTH' => isset($config['ABBC3_MAX_THUM_WIDTH']) ? $config['ABBC3_MAX_THUM_WIDTH'] : ($config['img_max_thumb_width'] ? $config['img_max_thumb_width'] / 2 : 200), 'ABBC3_COLOR_MODE' => isset($config['ABBC3_COLOR_MODE']) ? $config['ABBC3_COLOR_MODE'] : 'phpbb', 'ABBC3_HIGHLIGHT_MODE' => isset($config['ABBC3_HIGHLIGHT_MODE']) ? $config['ABBC3_HIGHLIGHT_MODE'] : 'dropdown', 'ABBC3_WIZARD_MODE' => isset($config['ABBC3_WIZARD_MODE']) ? $config['ABBC3_WIZARD_MODE'] : 2, 'ABBC3_WIZARD_width' => isset($config['ABBC3_WIZARD_width']) ? $config['ABBC3_WIZARD_width'] : 700, 'ABBC3_WIZARD_height' => isset($config['ABBC3_WIZARD_height']) ? $config['ABBC3_WIZARD_height'] : 400, 'ABBC3_VIDEO_width' => isset($config['ABBC3_VIDEO_width']) ? $config['ABBC3_VIDEO_width'] : 560, 'ABBC3_VIDEO_height' => isset($config['ABBC3_VIDEO_height']) ? $config['ABBC3_VIDEO_height'] : 340, 'ABBC3_VIDEO_OPTIONS' => isset($config['ABBC3_VIDEO_OPTIONS']) ? $config['ABBC3_VIDEO_OPTIONS'] : '1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39;40;41;42;43;44;45;46;47;48;49;50;51;52;53;54;55;56;57;58;59;60;61;62;63;64;65;66;207;209', 'ABBC3_VIDEO_WMODE' => isset($config['ABBC3_VIDEO_WMODE']) ? $config['ABBC3_VIDEO_WMODE'] : 0, 'ABBC3_UCP_MODE' => isset($config['ABBC3_UCP_MODE']) ? $config['ABBC3_UCP_MODE'] : 1);
    // CONFIG TABLE - array of config entries that need to be updated
    $abbc3_config_update = array('max_post_font_size' => $config['max_post_font_size'] != 0 ? $config['max_post_font_size'] < 300 ? 300 : $config['max_post_font_size'] : 0);
    // CONFIG TABLE - array of entries from older versions of ABBC3 to remove
    $abbc3_config_deprecated = array('ABBC3_GREYBOX', 'ABBC3_JAVASCRIPT', 'ABBC3_UPLOAD_MAX_SIZE', 'ABBC3_UPLOAD_EXTENSION');
    // MODULES TABLE - array of ACP module settings
    $abbc3_module_data = array(array('acp', 'ACP_CAT_POSTING', 'ACP_ABBCODES'), array('acp', 'ACP_ABBCODES', array('module_basename' => 'abbcodes', 'module_langname' => 'ACP_ABBC3_SETTINGS', 'module_mode' => 'settings', 'module_auth' => 'acl_a_bbcode')), array('acp', 'ACP_ABBCODES', array('module_basename' => 'abbcodes', 'module_langname' => 'ACP_ABBC3_BBCODES', 'module_mode' => 'bbcodes', 'module_auth' => 'acl_a_bbcode')));
    // CLICKS TABLE - array of new phpbb_clicks table settings
    $abbc3_clicks_table = array('COLUMNS' => array('id' => array('UINT', NULL, 'auto_increment'), 'url' => array('VCHAR:255', ''), 'clicks' => array('UINT', 0)), 'PRIMARY_KEY' => 'id', 'KEYS' => array('md5' => array('INDEX', array('url'))));
    // USERS TABLE - array of columns to add to phpbb_users table
    $abbc3_users_column_add = array('user_abbcode_mod' => array('TINT:1', 1), 'user_abbcode_compact' => array('TINT:1', 0));
    // BBCODES TABLE - array of BBCodes to remove from the BBCodes table if they exists from prior version
    $abbc3_bbcode_deprecated = array('upload', 'html');
    // BBCODES TABLE - array of new columns to add to the phpbb_bbcodes table
    $abbc3_bbcodes_column_add = array('display_on_pm' => array('TINT:1', 1), 'display_on_sig' => array('TINT:1', 1), 'abbcode' => array('TINT:1', 0), 'bbcode_image' => array('VCHAR', ''), 'bbcode_order' => array('USINT', 0), 'bbcode_group' => array('VCHAR:255', '0'));
    // let's get to work!
    switch ($action) {
        // This is not supposed to happen, but just in case we also check for “no action”.
        default:
            // This is not possible, just in case we also check for “update”.
        // This is not possible, just in case we also check for “update”.
        case 'update':
        case 'install':
            // CONFIG TABLE - Start
            $config_added = false;
            foreach ($abbc3_config_data as $config_name => $config_value) {
                if (!$umil->config_exists($config_name)) {
                    $config_added = true;
                    $umil->config_add($config_name, $config_value);
                }
            }
            $config_updated = false;
            if ($config['max_post_font_size'] != $abbc3_config_update['max_post_font_size']) {
                $config_updated = true;
                $umil->config_update('max_post_font_size', $abbc3_config_update['max_post_font_size']);
            }
            $config_deleted = false;
            foreach ($abbc3_config_deprecated as $config_name) {
                if ($umil->config_exists($config_name)) {
                    $config_deleted = true;
                    $umil->config_remove($config_name);
                }
            }
            if ($config_added || $config_updated || $config_deleted) {
                $cache->destroy('config');
            }
            // MODULES TABLE - Start
            if (!$umil->module_exists('acp', 'ACP_CAT_POSTING', 'ACP_ABBCODES')) {
                $umil->module_add($abbc3_module_data);
                $cache->destroy('_modules_acp');
            }
            // CLICKS TABLE - Start
            if (!$umil->table_exists('phpbb_clicks')) {
                $umil->table_add('phpbb_clicks', $abbc3_clicks_table);
            }
            // USERS TABLE - Start
            foreach ($abbc3_users_column_add as $abbc3_users_column_name => $abbc3_users_column_data) {
                if (!$umil->table_column_exists('phpbb_users', $abbc3_users_column_name)) {
                    $umil->table_column_add('phpbb_users', $abbc3_users_column_name, $abbc3_users_column_data);
                }
            }
            // BBCODES TABLE - Start
            foreach ($abbc3_bbcodes_column_add as $abbc3_bbcode_column_name => $abbc3_bbcode_column_data) {
                if (!$umil->table_column_exists('phpbb_bbcodes', $abbc3_bbcode_column_name)) {
                    $umil->table_column_add('phpbb_bbcodes', $abbc3_bbcode_column_name, $abbc3_bbcode_column_data);
                }
            }
            // Change the following columns
            $umil->table_column_update('phpbb_bbcodes', 'bbcode_id', array('INT:4', 0));
            // Add indexes ?
            if (!$umil->table_index_exists('phpbb_bbcodes', 'display_order')) {
                $umil->table_index_add('phpbb_bbcodes', 'display_order', 'bbcode_order');
            }
            $abbc3_bbcode_deleted = false;
            foreach ($abbc3_bbcode_deprecated as $bbcode_name) {
                // Check if exist
                $sql = 'SELECT *
						FROM ' . BBCODES_TABLE . "\n\t\t\t\t\t\tWHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($bbcode_name)) . "'";
                $result = $db->sql_query($sql);
                $row_exist = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if ($row_exist) {
                    $abbc3_bbcode_deleted = true;
                    $umil->table_row_remove('phpbb_bbcodes', array('LOWER(bbcode_tag)' => strtolower($bbcode_name)));
                }
            }
            if ($abbc3_bbcode_deleted) {
                $cache->destroy('sql', BBCODES_TABLE);
            }
            // INSTALL ALL ABBC3 BBCODES
            $message .= abbc3_bbcode_handler($action, $version);
            break;
        case 'uninstall':
            // Run this when uninstalling - basically the reverse of the above install case
            // BBCODES TABLE - Start
            // Remove the ABBC3 custom BBCodes first, before uninstalling anything else
            $message .= abbc3_bbcode_handler($action, $version, true);
            // remove the table index
            $umil->table_index_remove('phpbb_bbcodes', 'display_order');
            // Change the following columns back to default
            if (version_compare($config['version'], '3.0.8', '>')) {
                // phpBB 3.0.9 switched bbcode_id to UNSIGNED SMALLINT(4)
                $umil->table_column_update('phpbb_bbcodes', 'bbcode_id', array('USINT', 0));
            } else {
                // phpBB 3.0.8 and older set bbcode_id to TINYINT(3)
                $umil->table_column_update('phpbb_bbcodes', 'bbcode_id', array('TINT:3', 0));
            }
            foreach ($abbc3_bbcodes_column_add as $abbc3_bbcode_column_name => $abbc3_bbcode_column_data) {
                $umil->table_column_remove('phpbb_bbcodes', $abbc3_bbcode_column_name);
            }
            $cache->destroy('sql', BBCODES_TABLE);
            // USERS TABLE - Start
            foreach ($abbc3_users_column_add as $abbc3_users_column_name => $abbc3_users_column_data) {
                $umil->table_column_remove('phpbb_users', $abbc3_users_column_name);
            }
            // CLICKS TABLE - Start
            $umil->table_remove('phpbb_clicks');
            // MODULES TABLE - Start
            $umil->module_remove(array_reverse($abbc3_module_data));
            $cache->destroy('_modules_acp');
            // CONFIG TABLE - Start
            foreach ($abbc3_config_data as $config_name => $config_value) {
                $umil->config_remove($config_name);
            }
            if ($config['max_post_font_size'] != 0 && $config['max_post_font_size'] <= $abbc3_config_update['max_post_font_size']) {
                $umil->config_update('max_post_font_size', 200);
            }
            $cache->destroy('config');
            break;
    }
    // make sure cache is purged
    cache_purge();
    // return a message
    return $message;
}
예제 #4
0
 function deleteLanguage()
 {
     $sql = "DELETE FROM %slanguages WHERE language_code='%s'";
     queryDB($sql, array(TABLE_PREFIX, $this->code));
     $sql = "DELETE FROM %slanguage_text WHERE language_code='%s'";
     queryDB($sql, array(TABLE_PREFIX, $this->code));
     $sql = "UPDATE %smembers SET language='%s', creation_date=creation_date, last_login=last_login WHERE language='%s'";
     queryDB($sql, array(TABLE_PREFIX, DEFAULT_LANGUAGE, $this->code));
     $sql = "UPDATE %scourses SET primary_language='%s' WHERE primary_language='%s'";
     queryDB($sql, array(TABLE_PREFIX, DEFAULT_LANGUAGE, $this->code));
     cache_purge('system_langs', 'system_langs');
 }
예제 #5
0
function get_data($codeid)
{
    if (!preg_match('/^[a-z]+$/', $codeid)) {
        return;
    }
    $data = cache_fetch($codeid, 'code');
    if ($data) {
        return $data;
    }
    $db = getdb();
    if (!$db) {
        return false;
    }
    $res = $db->query('select editid, title, bbcode from ' . DB_TABLE . " where codeid = '{$codeid}'");
    $assoc = $res->num_rows > 0 ? $res->fetch_assoc() : false;
    $res->free();
    cache_put($codeid, 'code', $assoc);
    cache_purge();
    // since we've accessed the db, why not purge the cache?
    return $assoc;
}
예제 #6
0
 function deleteLanguage()
 {
     $sql = "DELETE FROM " . TABLE_PREFIX . "languages WHERE language_code='{$this->code}'";
     mysql_query($sql, $this->db);
     $sql = "DELETE FROM " . TABLE_PREFIX . "language_text WHERE language_code='{$this->code}'";
     mysql_query($sql, $this->db);
     $sql = "UPDATE " . TABLE_PREFIX . "members SET language='" . DEFAULT_LANGUAGE . "', creation_date=creation_date, last_login=last_login WHERE language='{$this->code}'";
     mysql_query($sql, $this->db);
     $sql = "UPDATE " . TABLE_PREFIX . "courses SET primary_language='" . DEFAULT_LANGUAGE . "' WHERE primary_language='{$this->code}'";
     mysql_query($sql, $this->db);
     cache_purge('system_langs', 'system_langs');
 }