2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or*/
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /****************************************************************/
\r
15 $_user_location = 'admin';
\r
17 define('AT_INCLUDE_PATH', '../../../include/');
\r
19 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
20 require(AT_INCLUDE_PATH.'../mods/_core/themes/lib/themes.inc.php');
\r
21 admin_authenticate(AT_ADMIN_PRIV_THEMES);
\r
23 $theme = $addslashes($_GET['theme_dir']);
\r
24 $version = $addslashes($_GET[$theme.'_version']);
\r
26 if (isset($_GET['export'], $_GET['theme_dir'])) {
\r
27 export_theme($theme);
\r
28 } else if (isset($_GET['delete'], $_GET['theme_dir'])) {
\r
29 header('Location: delete.php?theme_code='.urlencode($theme));
\r
31 } else if (isset($_GET['default'], $_GET['theme_dir'])) {
\r
32 set_theme_as_default($theme, $_GET['type']);
\r
33 $_config['pref_defaults'] = unserialize($_config['pref_defaults']);
\r
34 if ($_GET['type']==MOBILE_DEVICE) {
\r
35 $_config['pref_defaults']['PREF_MOBILE_THEME'] = $theme;
\r
37 $_config['pref_defaults']['PREF_THEME'] = $theme;
\r
39 $_config['pref_defaults'] = serialize($_config['pref_defaults']);
\r
41 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('pref_defaults','{$_config['pref_defaults']}')";
\r
42 $result = mysql_query($sql, $db);
\r
44 header('Location: '.$_SERVER['PHP_SELF']);
\r
46 } else if (isset($_GET['enable'], $_GET['theme_dir'])) {
\r
47 if ($version != VERSION) {
\r
48 $str = $theme . ' - version: ' . $version;
\r
49 $warnings = array('THEME_VERSION_DIFF', $str);
\r
50 $msg->addWarning($warnings);
\r
52 enable_theme($theme);
\r
53 header('Location: '.$_SERVER['PHP_SELF']);
\r
55 } else if (isset($_GET['disable'], $_GET['theme_dir'])) {
\r
56 disable_theme($theme);
\r
57 header('Location: '.$_SERVER['PHP_SELF']);
\r
59 } else if (isset($_GET['preview'], $_GET['theme_dir'])) {
\r
60 $_SESSION['prefs']['PREF_THEME'] = $_GET['theme_dir'];
\r
61 header('Location: '.$_SERVER['PHP_SELF']);
\r
63 } else if (isset($_GET['disable']) || isset($_GET['enable']) || isset($_GET['default']) || isset($_GET['delete']) || isset($_GET['export'])) {
\r
64 $msg->addError('NO_ITEM_SELECTED');
\r
67 require(AT_INCLUDE_PATH.'header.inc.php');
\r
70 <?php if (!is_writeable(realpath('./../../../themes'))): ?>
\r
71 <div class="input-form">
\r
73 <?php echo _AT('install_themes_text', realpath('./../../../themes')); ?>
\r
77 <form name="importForm" method="post" action="mods/_core/themes/import.php" enctype="multipart/form-data">
\r
78 <div class="input-form" style="width:95%;">
\r
80 <h3><?php echo _AT('import_theme'); ?></h3>
\r
84 <label for="file"><?php echo _AT('upload_theme_package'); ?></label><br />
\r
85 <input type="file" name="file" size="40" id="file" />
\r
89 <label for="url"><?php echo _AT('specify_url_to_theme_package'); ?></label><br />
\r
90 <input type="text" name="url" value="http://" size="40" id="url" />
\r
93 <div class="row buttons">
\r
94 <input type= "submit" name="import" value="<?php echo _AT('import'); ?>" />
\r
101 $sql = "SELECT * FROM " . TABLE_PREFIX . "themes WHERE type='".DESKTOP_DEVICE."' ORDER BY title ASC";
\r
102 $result = mysql_query($sql, $db);
\r
103 print_data_table($result, DESKTOP_DEVICE);
\r
104 echo '<br /><br />';
\r
105 $sql = "SELECT * FROM " . TABLE_PREFIX . "themes WHERE type='".MOBILE_DEVICE."' ORDER BY title ASC";
\r
106 $result = mysql_query($sql, $db);
\r
107 print_data_table($result, MOBILE_DEVICE);
\r
110 <?php function print_data_table($result, $type) {
\r
111 if (@mysql_num_rows($result) == 0) return;
\r
113 <h3><?php if ($type == DESKTOP_DEVICE) echo _AT('themes_for_desktop'); else echo _AT('themes_for_mobile');?></h3><br />
\r
114 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" name="form_<?php echo $type; ?>">
\r
115 <input type="hidden" name="type" value="<?php echo $type; ?>" />
\r
116 <table class="data" summary="" rules="cols">
\r
119 <th scope="col"> </th>
\r
120 <th scope="col"><?php echo _AT('title'); ?></th>
\r
121 <th scope="col"><?php echo _AT('status'); ?></th>
\r
122 <th scope="col"><?php echo _AT('version'); ?></th>
\r
123 <th scope="col"><?php echo _AT('directory_name'); ?></th>
\r
124 <th scope="col"><?php echo _AT('description'); ?></th>
\r
125 <th scope="col"><?php echo _AT('theme_screenshot'); ?></th>
\r
131 <input type="submit" name="preview" value="<?php echo _AT('preview'); ?>" />
\r
132 <input type="submit" name="enable" value="<?php echo _AT('enable'); ?>" />
\r
133 <input type="submit" name="disable" value="<?php echo _AT('disable'); ?>" />
\r
134 <input type="submit" name="default" value="<?php echo _AT('set_default').' '; if ($type == DESKTOP_DEVICE) echo _AT('desktop_theme'); else echo _AT('mobile_theme'); ?>" />
\r
135 <input type="submit" name="export" value="<?php echo _AT('export'); ?>" />
\r
136 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
\r
140 <?php while($row = mysql_fetch_assoc($result)) : ?>
\r
142 <tr onmousedown="document.form_<?php echo $type; ?>['t_<?php echo $row['dir_name']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['dir_name']; ?>">
\r
144 <input type="radio" id="t_<?php echo $row['dir_name']; ?>" name="theme_dir" value="<?php echo $row['dir_name']; ?>" />
\r
145 <input type="hidden" name="<?php echo $row['dir_name']; ?>_version" value="<?php echo $row['version']; ?>" />
\r
147 <td nowrap="nowrap" valign="top"><label for="t_<?php echo $row['dir_name']; ?>"><?php echo AT_print($row['title'], 'themes.title'); ?></label></td>
\r
148 <td valign="top"><?php
\r
149 if ($row['status'] == 0) {
\r
150 echo _AT('disabled');
\r
151 } else if ($row['status'] == 1) {
\r
152 echo _AT('enabled');
\r
153 } else if (($type == DESKTOP_DEVICE && $row['status'] == 2) || ($type == MOBILE_DEVICE && $row['status'] == 3)) {
\r
154 echo '<strong>'._AT('default').'</strong>';
\r
158 <td valign="top"><?php echo $row['version']; ?></td>
\r
159 <td valign="top"><code><?php echo $row['dir_name']; ?>/</code></td>
\r
160 <td valign="top"><?php echo $row['extra_info']; ?></td>
\r
161 <td valign="top"><?php
\r
162 if (file_exists('../../../themes/'.$row['dir_name'].'/screenshot.jpg')) { ?>
\r
163 <img src="<?php echo AT_BASE_HREF; ?>themes/<?php echo $row['dir_name']; ?>/screenshot.jpg" border="1" alt="<?php echo _AT('theme_screenshot'); ?>" />
\r
165 } else if (file_exists('../../../themes/'.$row['dir_name'].'/screenshot.gif')) { ?>
\r
166 <img src="<?php echo AT_BASE_HREF; ?>themes/<?php echo $row['dir_name']; ?>/screenshot.gif" border="1" alt="<?php echo _AT('theme_screenshot'); ?>" />
\r
177 require(AT_INCLUDE_PATH.'footer.inc.php');
\r