Changeset 30900 for extensions/greydragon/include
- Timestamp:
- Jan 23, 2015, 7:53:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/greydragon/include/greydragon.class.php
r30783 r30900 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 define('GDTHEME_VERSION', '1.1. 19');5 define('GDTHEME_VERSION', '1.1.20'); 6 6 7 7 define("QUOTES_NONE", FALSE); … … 36 36 37 37 return array( 38 "p_version" => array("value" => "", "quotes" => QUOTES_NONE), 39 38 40 // General Settings 39 41 "p_logo_path" => array("value" => null, "quotes" => QUOTES_NONE), 40 "p_favicon_path" => array("value" => null, "quotes" => QUOTES_NONE),41 "p_apple_path" => array("value" => null, "quotes" => QUOTES_NONE),42 42 "p_header" => array("value" => null, "quotes" => QUOTES_LAZY), 43 43 "p_footer" => array("value" => null, "quotes" => QUOTES_LAZY), 44 44 "p_colorpack" => array("value" => null, "quotes" => QUOTES_NONE), 45 46 "p_favicon_ico" => array("value" => null, "quotes" => QUOTES_NONE), 47 "p_favicon_png" => array("value" => null, "quotes" => QUOTES_NONE), 48 "p_favicon_gif" => array("value" => null, "quotes" => QUOTES_NONE), 49 "p_favicon_apple" => array("value" => null, "quotes" => QUOTES_NONE), 50 "p_favicon_noshine" => array("value" => "off", "quotes" => QUOTES_NONE), 45 51 46 52 // Advanced Options - General … … 80 86 private function loadConfig($ver = '') { 81 87 global $conf, $pwg_loaded_plugins; 88 82 89 $this->themeConfigMin = unserialize($conf['greydragon']); 83 90 $this->themeConfigMin["version"] = $ver; … … 88 95 89 96 private function validateDefault($config) { 97 98 // Check version, perform update if necessary 99 if (!isset($config["p_version"]) || ($this->themeConfigMin["version"] !== $config["p_version"])): 100 101 if (isset($config["p_favicon_path"])): 102 $config["p_favicon_ico"] = $config["p_favicon_path"]; 103 unset($config["p_favicon_path"]); 104 endif; 105 endif; 106 90 107 $theme_default_settings = $this->getDefaults(); 91 108 92 109 foreach ($theme_default_settings as $key => $value): 93 if ( $value["value"]):110 if (isset($value["value"])): 94 111 if (array_key_exists($key, $config)): 95 112 else: … … 100 117 101 118 // Populate some system settings 102 103 119 $url_root = get_root_url(); 104 120 $config['U_SITE_ADMIN'] = $url_root . 'admin.php?page='; … … 120 136 return $this->themeConfig; 121 137 else: 122 return $this->themeConfigMin; 138 $config = $this->themeConfigMin; 139 $config['p_version'] = GDTHEME_VERSION; 140 return $config; 123 141 endif; 124 142 } … … 187 205 if ((isset($_POST["p_reset"])) && ($_POST["p_reset"] == "on")): 188 206 // Reset theme settings 189 conf_update_param('greydragon', pwg_db_real_escape_string(serialize(array()))); 207 $config = array(); 208 conf_update_param('greydragon', pwg_db_real_escape_string(serialize($config))); 190 209 load_conf_from_db(); 191 210 $this->loadConfig(); … … 216 235 else: 217 236 return (array_key_exists($name, $this->themeConfig)); 237 endif; 238 } 239 240 public function deleteOption($name, $isGlobal = FALSE) { 241 global $conf; 242 243 if ($isGlobal): 244 if (array_key_exists($name, $conf) && isset($conf[$name])): 245 unset($conf[$name]); 246 endif; 247 else: 248 if (array_key_exists($name, $this->themeConfig)): 249 unset($this->themeConfig[$name]); 250 endif; 218 251 endif; 219 252 } … … 235 268 endif; 236 269 endif; 270 } 271 272 public function hasCustomFavicon() { 273 return ($this->hasOption("p_logo_path")); 274 } 275 276 public function update($old_version, $new_version) { 277 $this->prepareCustomCSS(); 278 } 279 280 public function uninstall() { 281 // delete configuration 282 $this->deleteCustomCSS(); 283 284 conf_delete_param('greydragon'); 237 285 } 238 286 … … 290 338 } 291 339 292 public function getHeader() { 293 $content = ""; 340 public function getURLRoot() { 294 341 $root_base = get_root_url(); 295 342 if ($root_base): … … 297 344 $root_base = '/'; 298 345 endif; 346 return $root_base; 347 } 348 349 public function getHeader() { 350 global $conf; 351 352 $content = ""; 353 $root_base = $this->getURLRoot(); 299 354 300 355 if ($this->hasOption('p_logo_path')): … … 302 357 endif; 303 358 if ($this->hasOption('p_header')): 304 $ content .= '<a title="Home" id="g-header-text" href="' . $root_base . '">' . $this->getOption('p_header') . '</a>';359 $p_header = $this->getOption('p_header'); 305 360 elseif ($this->hasOption('page_banner', TRUE)): 306 $content .= '<a title="Home" id="g-header-text" href="' . $root_base . '">' . $this->getOption('page_banner', TRUE) . '</a>'; 307 endif; 361 $p_header = $this->getOption('page_banner', TRUE); 362 else: 363 $p_header = ""; 364 endif; 365 $p_header = trim(str_replace('%gallery_title%', $conf['gallery_title'], $p_header)); 366 if (strlen($p_header) > 0): 367 $content .= '<a title="Home" id="g-header-text" href="{$U_HOME}">' . $p_header . '</a>'; 368 endif; 308 369 309 370 return $content;
Note: See TracChangeset
for help on using the changeset viewer.