PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/admin/modules/mod_theme.php

http://pixie-cms.googlecode.com/
PHP | 74 lines | 42 code | 0 blank | 32 comment | 21 complexity | c0dc7bd99cd1f3d775cb9660c82ae171 MD5 | raw file
  1. <?php
  2. if (!defined('DIRECT_ACCESS')) {
  3. header('Location: ../../../');
  4. exit();
  5. }
  6. /**
  7. * Pixie: The Small, Simple, Site Maker.
  8. *
  9. * Licence: GNU General Public License v3
  10. * Copyright (C) 2010, Scott Evans
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see http://www.gnu.org/licenses/
  24. *
  25. * Title: Theme Settings
  26. *
  27. * @package Pixie
  28. * @copyright 2008-2010 Scott Evans
  29. * @author Scott Evans
  30. * @author Sam Collett
  31. * @author Tony White
  32. * @author Isa Worcs
  33. * @link http://www.getpixie.co.uk
  34. * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3
  35. * @todo Tag release for Pixie 1.04
  36. *
  37. */
  38. if ($GLOBALS['pixie_user'] && $GLOBALS['pixie_user_privs'] >= 2) {
  39. if ((isset($do)) && ($do)) {
  40. if (file_exists("themes/{$do}")) {
  41. $ok = safe_update("pixie_settings", "site_theme = '$do'", "settings_id ='1'");
  42. }
  43. if ($ok) {
  44. $messageok = $lang['theme_ok'];
  45. } else {
  46. $message = $lang['theme_error'];
  47. }
  48. }
  49. $prefs = get_prefs();
  50. extract($prefs);
  51. echo "<h2>{$lang['nav2_theme']}</h2>\n\t\t\t\t<p>{$lang['theme_info']}</p>";
  52. echo "\n\n\t\t\t\t<div id=\"themes\">\n\t\t\t\t\t<h3>{$lang['theme_pick']}</h3>\n";
  53. $dir = 'themes/';
  54. if (is_dir($dir)) {
  55. $fd = @opendir($dir);
  56. if ($fd) {
  57. while (($part = @readdir($fd)) == true) {
  58. if ($part != "." && $part != "..") {
  59. $newdir = $dir.$part;
  60. if (is_dir($newdir) && preg_match('/^[A-Za-z].*[A-Za-z]$/', $part)) {
  61. include "themes/$part/settings.php";
  62. if ($part == $site_theme) {
  63. echo "\t\t\t\t\t<div class=\"atheme currenttheme\"><a href=\"?s=$s&amp;x=$x&amp;do=$part\" title=\"".$lang['theme_apply']."\"><img src=\"themes/$part/thumb.jpg\" alt=\"".$lang['nav2_theme'].": $theme_name\" class=\"ticon\"/></a><span class=\"tname\">$theme_name</span><span class=\"tcreator\">".$lang['by']." <a href=\"$theme_link\">$theme_creator</a></span><span class=\"tselect\">Current theme</span></div>\n";
  64. } else {
  65. echo "\t\t\t\t\t<div class=\"atheme\"><a href=\"?s=$s&amp;x=$x&amp;do=$part\" title=\"".$lang['theme_apply']."\"><img src=\"themes/$part/thumb.jpg\" alt=\"".$lang['nav2_theme'].": $theme_name\" class=\"ticon\"/></a><span class=\"tname\">$theme_name</span><span class=\"tcreator\">".$lang['by']." <a href=\"$theme_link\">$theme_creator</a></span><span class=\"tselect\"><a href=\"?s=$s&amp;x=$x&amp;do=$part\" title=\"".$lang['theme_apply']."\">".$lang['theme_apply']."</a></span></div>\n";
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
  72. echo "\t\t\t\t</div>";
  73. }
  74. ?>