Project

General

Profile

« Previous | Next » 

Revision 1648

Added by darkviper over 12 years ago

a litte fix in /admin/addons/index.php.
added unregister_Theme to CopyTheme::_doRollback()
added CopyTheme::_activateTheme()

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
24 Mar-2012 Build 1648 Werner v.d.Decken(DarkViper)
15
# a litte fix in /admin/addons/index.php.
16
+ added unregister_Theme to CopyTheme::_doRollback()
17
+ added CopyTheme::_activateTheme()
14 18
23 Mar-2012 Build 1647 Werner v.d.Decken(DarkViper)
15 19
+ add additional exeptionhandling in globalExceptionHandler
16 20
23 Mar-2012 Build 1646 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/skel/themes/htt/addons.htt
54 54
					<tr>
55 55
						<td class="description" valign="top"><span class="title">{TXT_THEME_COPY_CURRENT}</span>
56 56
							{TXT_THEME_CURRENT}: {CURRENT_THEME}<br />
57
							<i>[{THEME_PATH}]</i><br />
57 58
							{MESSAGE_THEME_COPY_CURRENT}
58 59
							<br style="margin-bottom: 0.5em" />
59 60
							<input type="text" id="theme_newname" name="ThNewTheme" value="{THEME_DEFAULT_NAME}" />
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1647');
54
if(!defined('REVISION')) define('REVISION', '1648');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/admin/addons/CopyTheme.php
38 38
		$this->_aLang = $GLOBALS['MESSAGE'];
39 39
	// import global Consts
40 40
		$this->_aGlobals['TablePrefix']     = TABLE_PREFIX;
41
		$this->_aGlobals['AddonTable']      = 'addons';
42
		$this->_aGlobals['SettingsTable']   = 'settings';
43

  
41 44
		$this->_aGlobals['Debug']           = (defined('DEBUG') && DEBUG === true);
42 45
		$this->_aGlobals['IsLinux']         = ((substr(__FILE__, 0, 1)) == '/');
43 46
		$this->_aGlobals['StringDirMode']   = STRING_DIR_MODE;
......
62 65
		if($this->_copyTree()) {
63 66
			if($this->_modifyInfoFile()) {
64 67
				if($this->_registerNewTheme()) {
65
					return true;
68
					if($this->_activateTheme()) {
69
						return true;
70
					}
66 71
				}
67 72
			}
68 73
		}
......
96 101
		$iCount = '';
97 102
		do {
98 103
			$sSearch = $sName.($iCount ? ' '.$iCount : '');
99
			$sql = 'SELECT COUNT(*) FROM `'.$this->_aGlobals['TablePrefix'].'addons` '
104
			$sql = 'SELECT COUNT(*) '
105
			     . 'FROM `'.$this->_aGlobals['TablePrefix'].$this->_aGlobals['AddonTable'].'` '
100 106
				 . 'WHERE LOWER(`name`)=\''.strtolower($sSearch).'\' AND `function`=\'theme\'';
101 107
			$exists = $this->_oDb->get_one($sql);
102 108
			$iCount = (int)$iCount + 1;
......
118 124
		$iCount = '';
119 125
		do {
120 126
			$sSearch = $sName.($iCount ? '_'.$iCount : '');
121
			$sql = 'SELECT COUNT(*) FROM `'.$this->_aGlobals['TablePrefix'].'addons` '
127
			$sql = 'SELECT COUNT(*) '
128
			     . 'FROM `'.$this->_aGlobals['TablePrefix'].$this->_aGlobals['AddonTable'].'` '
122 129
				 . 'WHERE `directory`=\''.$sSearch.'\' AND `function`=\'theme\'';
123 130
			$exists = $this->_oDb->get_one($sql);
124 131
			$iCount = (int)$iCount + 1;
......
231 238
		$bRetval = true;
232 239
		$sThemeInfoFile = $this->_sThemesBasePath.'/'.$this->_sNewThemeDir.'/info.php';
233 240
		$aVariables = $this->_getThemeInfo($sThemeInfoFile);
234
		$sql = 'INSERT INTO `'.$this->_aGlobals['TablePrefix'].'addons` '
241
		$sql = 'INSERT INTO `'.$this->_aGlobals['TablePrefix'].$this->_aGlobals['AddonTable'].'` '
235 242
		     . 'SET `type`=\'template\', '
236 243
		     .     '`function`=\'theme\', '
237 244
		     .     '`directory`=\''.$aVariables['directory'].'\', '
......
312 319
		}
313 320
	}
314 321
/**
322
 * activates the new theme
323
 * @return boolean
324
 */
325
	private function _activateTheme()
326
	{
327
		$bRetval = true;
328
		if(!db_update_key_value( $this->_aGlobals['SettingsTable'],
329
		                         'default_theme',
330
		                         $value = $this->_sNewThemeDir))
331
		{
332
			$sMsg = 'CopyTheme::activateTheme('.$this->_sNewThemeName.') >> '
333
			        .$this->_aLang['GENERIC_NOT_UPGRADED'];
334
			$sMsg .= (($this->_aGlobals['Debug']) ? '<br />'.$this->_oDb->get_error() : '');
335
			$this->_setError($sMsg);
336
			$bRetval = false;
337
		}
338
		return $bRetval;
339
	}
340
/**
315 341
 * on Error undo all already done copy/create actions
316 342
 * @param string $dir
317 343
 */
......
331 357
		unset($path);
332 358
		unset($iterator);
333 359
		if(file_exists($dir)) { rmdir($dir); }
360
		$sql = 'DELETE FROM `'.$this->_aGlobals['TablePrefix'].$this->_aGlobals['AddonTable'].'` '
361
		     . 'WHERE `directory`=\''.$this->_sNewThemeDir.'\' AND `function`=\'theme\'';
362
		$this->_oDb->query($sql);
334 363
	}
335 364
/**
336 365
 * add a new error message to the queue
branches/2.8.x/wb/admin/addons/index.php
106 106
		 . 'WHERE `directory`=\''.DEFAULT_THEME.'\' AND `function`=\'theme\'';
107 107
	$tmp = $database->get_one($sql);
108 108
	$template->set_var('THEME_DEFAULT_NAME', $tmp);
109
	$template->set_var('THEME_PATH', THEME_PATH);
109 110
// end copy current theme
110 111
// start template import
111 112
	include(dirname(__FILE__).'/CopyThemeHtt.php');
112
	$aTplList = CopyThemeHtt::getDivList(ADMIN_PATH.'/themes/templates',
113
	$aTplList = CopyThemeHtt::getDivList(ADMIN_PATH.'/skel/themes/htt',
113 114
	                                     THEME_PATH.'/templates', 'htt');
114 115
	$sOptionList = '';
115 116
	if(sizeof($aTplList)) {

Also available in: Unified diff