A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.1 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file admin/styles.php
  5. * @version $Id$
  6. * @copyright 2009(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/
  8. * @license GNU GPL v3
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. include('./../config.php');
  13. include('./../includes/constants.php');
  14. include('./../includes/db.php');
  15. include('./../includes/errors.php');
  16. include('./../includes/classes/class_pms.php');
  17. //connect to database
  18. DataBase::db_connect();
  19. include('./../includes/sessions.php');
  20. include('./../includes/classes/class_user.php');
  21. include('./../common.php');
  22. include('./../includes/admin/class_main.php');
  23. include('./../includes/classes/class_forum.php');
  24. include('./../includes/admin/class_forum.php');
  25. include('./../includes/classes/secure.php');
  26. include('./../lngs/'.Admin_Over::DefaultLang().'/admin.php');
  27. SessDelInvalid();
  28. SessRegister();
  29. SessDeleteOld();
  30. if (User::UserInformation($_SESSION['uid'],'rank')!=2)
  31. {
  32. admin_message_forum($lng['yournotadmin'],'../index.php');
  33. }
  34. if (!isset($_GET['mode']))
  35. {
  36. header('Location: styles.php?mode=view');
  37. }
  38. switch($_GET['mode'])
  39. {
  40. case 'delete':
  41. {
  42. $sid = intval($_GET['id']);
  43. if ($sid!=$forum_config['defaultskin'])
  44. {
  45. $sql = "DELETE FROM ".SKINS_TABLE." WHERE `s_id`='$sid'";
  46. DataBase::sql_query($sql,'GENERAL','Could not delete skin');
  47. $sql = "UPDATE ".USERS_TABLE." SET `skin`='".$forum_config['defaultskin']."' WHERE `skin`='$sid'";
  48. DataBase::sql_query($sql,'GENERAL','Could not update user');
  49. admin_message_forum($lng['skins_deleted'],'styles.php?mode=view');
  50. }
  51. else
  52. {
  53. admin_message_forum($lng['styles_info_1'],'styles.php?mode=view');
  54. }
  55. break;
  56. }
  57. case 'view':
  58. {
  59. if (isset($_POST['skin']))
  60. {
  61. if(strlen(trim($_POST['skin']))>3)
  62. {
  63. if (is_dir('./../skins/'.$_POST['skin']))
  64. {
  65. $last = DataBase::new_id(SKINS_TABLE);
  66. DataBase::sql_query("INSERT INTO ".SKINS_TABLE." VALUES ('$last','".strip_tags($_POST['skin'])."')",'GENERAL','Could not add skin');
  67. $_POST['skin']='';
  68. admin_message_forum($lng['skins_added'],'styles.php?mode=view');
  69. }
  70. else
  71. {
  72. $_POST['skin']='';
  73. admin_message_forum($lng['invalid_skin'],'styles.php?mode=view');
  74. }
  75. }
  76. }
  77. else
  78. {
  79. $_POST['skin']='';
  80. }
  81. $skin = array(
  82. 'L.main_beam'=>$lng['admin_styles'],
  83. 'L.install'=>$lng['install'],
  84. 'L.new_skin'=>$lng['new_skin'],
  85. 'L.delete'=>$lng['delete'],
  86. 'L.actual_skins'=>$lng['actual_skins']
  87. );
  88. Admin_Over::GenerateHeader();
  89. include('./template/skins_beam_body.tpl');
  90. $sql = "SELECT * FROM ".SKINS_TABLE;
  91. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain skins information');
  92. while ($item = @mysql_fetch_array($query))
  93. {
  94. $skin=array(
  95. 'L.delete' => $lng['delete'],
  96. 'skin_name' => $item['name'],
  97. 's_id' => $item['s_id']
  98. );
  99. include('./template/skins_item_add.tpl');
  100. }
  101. echo '</table>';
  102. include('./template/overall_footer.tpl');
  103. break;
  104. }
  105. default:
  106. {
  107. header('Location: styles.php?mode=view');
  108. break;
  109. }
  110. }
  111. ?>