示例#1
0
	$sql    = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('pref_defaults','{$_config['pref_defaults']}')";
	$result = mysql_query($sql, $db);

	header('Location: '.$_SERVER['PHP_SELF']);
	exit;
} else if (isset($_GET['enable'], $_GET['theme_dir'])) {
	if ($version != VERSION) {
		$str = $theme . ' - version: ' . $version;
		$warnings = array('THEME_VERSION_DIFF', $str);
		$msg->addWarning($warnings);
	}
	enable_theme($theme);
	header('Location: '.$_SERVER['PHP_SELF']);
	exit;
} else if (isset($_GET['disable'], $_GET['theme_dir'])) {
	disable_theme($theme);
	header('Location: '.$_SERVER['PHP_SELF']);
	exit;
} else if (isset($_GET['preview'], $_GET['theme_dir'])) {
	$_SESSION['prefs']['PREF_THEME'] = $_GET['theme_dir'];
	header('Location: '.$_SERVER['PHP_SELF']);
	exit;
} else if (isset($_GET['disable']) || isset($_GET['enable']) || isset($_GET['default']) || isset($_GET['delete']) || isset($_GET['export'])) {
	$msg->addError('NO_ITEM_SELECTED');
}

require(AT_INCLUDE_PATH.'header.inc.php');
?>

<?php if (!is_writeable(realpath('./../../../themes'))): ?>
	<div class="input-form">
示例#2
0
function delete_theme ($theme_dir) {
	global $msg, $db;

	//check status
	$sql    = "SELECT status FROM ".TABLE_PREFIX."themes WHERE dir_name='$theme_dir'";
	$result = mysql_query ($sql, $db);
	$row    = mysql_fetch_assoc($result);
	$status = intval($row['status']);

	//can't delete original default or current default theme
	if (($theme_dir == 'default') || ($status == 2)) {
		$msg->addError('THEME_NOT_DELETED');
		return FALSE;

	} else {	//disable, clear directory and delete theme from db

		require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php'); /* for clr_dir() */
		if ($status != 0) {
			disable_theme($theme_dir);
			$msg->deleteFeedback('THEME_DISABLED');
		}

		$dir = '../../../themes/' . $theme_dir;
		//chmod($dir, 0777);
		@clr_dir($dir);

		$sql1    = "DELETE FROM ".TABLE_PREFIX."themes WHERE dir_name = '$theme_dir'";
		$result1 = mysql_query ($sql1, $db);

		write_to_log(AT_ADMIN_LOG_DELETE, 'themes', mysql_affected_rows($db), $sql);

		$msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
		return TRUE;
	}
}
示例#3
0
function delete_theme($theme_dir)
{
    global $msg, $db;
    $theme_dir = addslashes($theme_dir);
    //check status
    $sql = "SELECT status, customized FROM " . TABLE_PREFIX . "themes WHERE dir_name='" . $theme_dir . "'";
    $result = mysql_query($sql, $db);
    $row = mysql_fetch_assoc($result);
    $status = intval($row['status']);
    $customized = intval($row['customized']);
    //can't delete if
    // 1. a system default
    // 2. current default theme
    // 3. a system level theme
    if ($theme_dir == 'default' || $status == 2 || !$customized) {
        $msg->addError('THEME_NOT_DELETED');
        return FALSE;
    } else {
        //disable, clear directory and delete theme from db
        require_once AT_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php';
        /* for clr_dir() */
        if ($status != 0) {
            disable_theme($theme_dir);
            $msg->deleteFeedback('THEME_DISABLED');
        }
        $dir = get_main_theme_dir($customized) . $theme_dir;
        //chmod($dir, 0777);
        @clr_dir($dir);
        $sql1 = "DELETE FROM " . TABLE_PREFIX . "themes WHERE dir_name = '{$theme_dir}'";
        $result1 = mysql_query($sql1, $db);
        write_to_log(AT_ADMIN_LOG_DELETE, 'themes', mysql_affected_rows($db), $sql);
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        return TRUE;
    }
}
示例#4
0
function delete_theme($theme_dir)
{
    global $msg;
    $theme_dir = addslashes($theme_dir);
    //check status
    $sql = "SELECT status, customized FROM %sthemes WHERE dir_name='%s'";
    $row = queryDB($sql, array(TABLE_PREFIX, $theme_dir), TRUE);
    $status = intval($row['status']);
    $customized = intval($row['customized']);
    //can't delete if
    // 1. a system default
    // 2. current default theme
    // 3. a system level theme
    if ($theme_dir == 'default' || $status == 2 || !$customized && defined('IS_SUBSITE') && IS_SUBSITE) {
        $msg->addError('THEME_NOT_DELETED');
        return FALSE;
    } else {
        //disable, clear directory and delete theme from db
        require_once AT_INCLUDE_PATH . '../mods/_core/file_manager/filemanager.inc.php';
        /* for clr_dir() */
        if ($status != 0) {
            disable_theme($theme_dir);
            $msg->deleteFeedback('THEME_DISABLED');
        }
        $dir = get_main_theme_dir($customized) . $theme_dir;
        //chmod($dir, 0777);
        @clr_dir($dir);
        $sql1 = "DELETE FROM %sthemes WHERE dir_name = '%s'";
        $result1 = queryDB($sql1, array(TABLE_PREFIX, $theme_dir));
        global $sqlout;
        write_to_log(AT_ADMIN_LOG_DELETE, 'themes', $result1, $sqlout);
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        return TRUE;
    }
}