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.

160 lines
4.1 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file includes/admin/class_main.php
  5. * @version 1.0.x, 17-03-2007, 19:59
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  8. * @license GNU GPL v3
  9. **/
  10. if ( !defined('IN_uF') )
  11. {
  12. die('Hacking attempt');
  13. }
  14. class Admin_Over
  15. {
  16. function AddPages()
  17. {
  18. global $count;
  19. global $page;
  20. $content = '';
  21. for ($i=1;$i<=$count;$i++)
  22. {
  23. if ($i==$page)
  24. {
  25. $content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  26. }
  27. else
  28. {
  29. $content .= '<option value="'.$i.'">'.$i.'</option>';
  30. }
  31. }
  32. return $content;
  33. unset($content);
  34. }
  35. function AddSkins()
  36. {
  37. global $forum_config;
  38. global $default_skin;
  39. $all='';
  40. $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
  41. while($t = @mysql_fetch_array($query))
  42. {
  43. if ($t['name']==$default_skin)
  44. {
  45. $all .= '<option value="'.$t['s_id'].'" selected="selected">'.$t['name'].'</option>';
  46. }
  47. else
  48. {
  49. $all .= '<option value="'.$t['s_id'].'">'.$t['name'].'</option>';
  50. }
  51. }
  52. return $all;
  53. unset($t, $all);
  54. }
  55. function AddPages2($page)//for edit profile, not used in limit!
  56. {
  57. $content = '';
  58. for ($i=1;$i<=50;$i++)
  59. {
  60. if ($i==$page)
  61. {
  62. $content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  63. }
  64. else
  65. {
  66. $content .= '<option value="'.$i.'">'.$i.'</option>';
  67. }
  68. }
  69. return $content;
  70. unset($content);
  71. }
  72. function AddLangs()
  73. {
  74. global $forum_config;
  75. global $default_lang;
  76. $result='';
  77. $rep=opendir('./../lngs');
  78. $bAuMoinsUnRepertoire = false;
  79. while ($file = readdir($rep))
  80. {
  81. if($file != '..' && $file !='.' && $file !='')
  82. {
  83. if (is_dir('./../lngs/'.$file)){
  84. $bAuMoinsUnRepertoire = true;
  85. if ($file==$default_lang)
  86. {
  87. $result .='<option value="'.$file.'" selected="selected">'.$file.'</option>';
  88. }
  89. else
  90. {
  91. $result .='<option value="'.$file.'">'.$file.'</option>';
  92. }
  93. }
  94. }
  95. }
  96. return $result;
  97. unset($rep, $bAuMoinsUnRepertoire, $file, $result);
  98. }
  99. function ViewSkinName()
  100. {
  101. global $forum_config;
  102. if ($_SESSION['uid']>0)
  103. {
  104. $result = User::UserInformation($_SESSION['uid'],'skin');
  105. $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
  106. $result = mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
  107. return $result['name'];
  108. }
  109. else
  110. {
  111. $result = $forum_config['defaultskin'];
  112. $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
  113. $result = mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
  114. return $result['name'];
  115. }
  116. }
  117. function DefaultLang()
  118. {
  119. global $forum_config;
  120. if ($_SESSION['uid']>0)
  121. {
  122. return User::UserInformation($_SESSION['uid'],'lang');
  123. }
  124. else
  125. {
  126. return $forum_config['defaultlang'];
  127. }
  128. }
  129. function TotalTopics()
  130. {
  131. $sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";";
  132. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
  133. $result = mysql_num_rows($query);
  134. return($result);
  135. }
  136. function TotalPosts()
  137. {
  138. $sql = "SELECT `p_id` FROM ".POSTS_TABLE.";";
  139. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
  140. $result = mysql_num_rows($query);
  141. return($result);
  142. }
  143. function GenerateHeader()
  144. {
  145. global $default_skin;
  146. global $lng;
  147. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  148. <head>
  149. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  150. <link rel="shortcut icon" href="skins/'.$default_skin.'/images/favicon.ico">
  151. <link rel="favicon" href="template/images/favicon.ico">
  152. <link rel="stylesheet" href="template/skin.css" type="text/css">
  153. <title>DSF Administration</title>
  154. </head>
  155. <body class="body">
  156. <div align="center"><span class="pa_h1">'.$lng['uf_pa'].'</span></div>';
  157. }
  158. }
  159. ?>