Example #1
0
function ultimatum_themes()
{
    screen_icon();
    echo '<div class="wrap">';
    if (isset($_REQUEST['task'])) {
        $task = $_REQUEST['task'];
    } else {
        $task = false;
    }
    switch ($task) {
        default:
            themesMainScreen();
            break;
        case 'delete':
            deleteTheme();
            break;
        case 'export':
            exportTheme();
            break;
        case 'import':
            importTheme();
            break;
        case 'edit':
            editTheme();
            break;
        case 'default':
            makeDefault();
            break;
        case 'mobileass':
            mobileAssign();
            break;
    }
    echo '</div>';
}
Example #2
0
<?php

include 'config/autoload.php';
if (!isset($_GET['id'])) {
    header('Location: categories.php');
}
deleteTheme($db, $_GET['id']);
header('Location: categories.php');
Example #3
0
function ultimatum_themes(){
	
	echo '<div class="wrap">';

	$task=false;
	if(isset($_GET['task'])) $task = $_GET['task'];
	switch ($task){ //
		default:
		    if($_POST){
		        global $wpdb;
		        if(isset($_POST['id'])){
		            if($_POST['gridwork']!="tbs3"){
		                $query = "REPLACE INTO `".ULTIMATUM_TABLE_TEMPLATES."` VALUES ('".$_POST['id']."','".$_POST['name']."','".$_POST['width']."','".$_POST['margin']."','".$_POST['mwidth']."','".$_POST['mmargin']."','".$_POST['swidth']."','".$_POST['smargin']."','".$_POST['gridwork']."','".$_POST['swatch']."','".$_POST['type']."','".$_POST['dcss']."','".$_POST['default']."','".$_POST['theme']."','".$_POST['cdn']."')";
		            } else {
		               $query = "REPLACE INTO `".ULTIMATUM_TABLE_TEMPLATES."` VALUES ('".$_POST['id']."','".$_POST['name']."','".$_POST['width']."','".$_POST['margin']."','".$_POST['mwidth']."','".$_POST['mmargin']."','".$_POST['swidth']."','".$_POST['smargin']."','".$_POST['gridwork']."','".$_POST['swatch3']."','".$_POST['type']."','".$_POST['dcss']."','".$_POST['default']."','".$_POST['theme']."','".$_POST['cdn']."')";
		            }
		        } else {
		            if($_POST['gridwork']!="tbs3"){
		                $query = "INSERT INTO `".ULTIMATUM_TABLE_TEMPLATES."` (`name`,`width`,`margin`,`mwidth`,`mmargin`,`swidth`,`smargin`,`gridwork`,`swatch`,`type`,`dcss`,`default`,`theme`) VALUES ('".$_POST['name']."','".$_POST['width']."','".$_POST['margin']."','".$_POST['mwidth']."','".$_POST['mmargin']."','".$_POST['swidth']."','".$_POST['smargin']."','".$_POST['gridwork']."','".$_POST['swatch']."','".$_POST['type']."','".$_POST['dcss']."','".$_POST['default']."','".$_POST['theme']."','".$_POST['cdn']."')";
		            } else {
		                $query = "INSERT INTO `".ULTIMATUM_TABLE_TEMPLATES."` (`name`,`width`,`margin`,`mwidth`,`mmargin`,`swidth`,`smargin`,`gridwork`,`swatch`,`type`,`dcss`,`default`,`theme`) VALUES ('".$_POST['name']."','".$_POST['width']."','".$_POST['margin']."','".$_POST['mwidth']."','".$_POST['mmargin']."','".$_POST['swidth']."','".$_POST['smargin']."','".$_POST['gridwork']."','".$_POST['swatch3']."','".$_POST['type']."','".$_POST['dcss']."','".$_POST['default']."','".$_POST['theme']."','".$_POST['cdn']."')";
		            }
		        }
		    
		        $wpdb->query($query);
		        $template_id =  $wpdb->insert_id;
		        WonderWorksCSS::saveCSS($template_id,'template');
		        ?>
		        <script type="text/javascript">
		        parent.location.href='./admin.php?page=wonder-templates';
		        </script>
		        <?php 
		    }
			themesMainScreen();
		break;
		case 'createChild':
			createChild();
		break;
		case 'deletetemplate':
			deleteTheme();
		break;
		case 'export':
			Ultimatum_Exporter();
		break;
		case 'import':
			importThemeForm();
		break;
		case 'row-edit':
			RowEditor();
			break;
		case 'row-styles':
			RowStyles();
		break;
		case 'edit':
			$template=null;
			if(isset($_REQUEST["template_id"])) $template = getTemplateInfo($_REQUEST["template_id"]);
			ultimatum_editTemplate($template);
		break;
		case 'default':
			makeDefault();
		break;
		case 'mobileass':
			mobileAssign();
		break;
	}
	echo '</div>'; 
	}
 /**
  * Remove a theme from the database in response to an ajax api request
  *
  * What it does:
  * - Removes an installed theme.
  * - Requires an administrator.
  * - Accessed with ?action=admin;area=theme;sa=remove;api
  */
 public function action_remove_api()
 {
     global $modSettings, $context, $txt;
     require_once SUBSDIR . '/Themes.subs.php';
     // Validate what was sent
     if (checkSession('get', '', false)) {
         loadLanguage('Errors');
         $context['xml_data'] = array('error' => 1, 'text' => $txt['session_verify_fail']);
         return;
     }
     // Not just any John Smith can send in a api request
     if (!allowedTo('admin_forum')) {
         loadLanguage('Errors');
         $context['xml_data'] = array('error' => 1, 'text' => $txt['cannot_admin_forum']);
         return;
     }
     // Even if you are John Smith, you still neeed a ticket
     if (!validateToken('admin-tr', 'request', true, false)) {
         loadLanguage('Errors');
         $context['xml_data'] = array('error' => 1, 'text' => $txt['token_verify_fail']);
         return;
     }
     // The theme's ID must be an integer.
     $theme = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id'];
     // You can't delete the default theme!
     if ($theme == 1) {
         loadLanguage('Errors');
         $context['xml_data'] = array('error' => 1, 'text' => $txt['no_access']);
         return;
     }
     // It is a theme we know about?
     $known = explode(',', $modSettings['knownThemes']);
     for ($i = 0, $n = count($known); $i < $n; $i++) {
         if ($known[$i] == $theme) {
             unset($known[$i]);
         }
     }
     // Finally, remove it
     deleteTheme($theme);
     $known = strtr(implode(',', $known), array(',,' => ','));
     // Fix it if the theme was the overall default theme.
     if ($modSettings['theme_guests'] == $theme) {
         updateSettings(array('theme_guests' => '1', 'knownThemes' => $known));
     } else {
         updateSettings(array('knownThemes' => $known));
     }
     // Let them know it worked, all without a page refresh
     createToken('admin-tr', 'request');
     $context['xml_data'] = array('success' => 1, 'token_var' => $context['admin-tr_token_var'], 'token' => $context['admin-tr_token']);
 }