setting.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <?php
  2. #已经废弃
  3. require_once "../config.php";
  4. require_once 'checklogin.inc';
  5. require_once "../public/load_lang.php";
  6. require_once '../public/config.php';
  7. require_once "../public/_pdo.php";
  8. //if(isset($_GET["language"])){$currLanguage=$_GET["language"];}
  9. //else{$currLanguage="en";}
  10. if (isset($_GET["device"])) {$currDevice = $_GET["device"];} else { $currDevice = "computer";}
  11. $menu_active["account"] = "";
  12. $menu_active["general"] = "";
  13. $menu_active["local"] = "";
  14. $menu_active["studio"] = "";
  15. $menu_active["liberay"] = "";
  16. $menu_active["dictionary"] = "";
  17. $menu_active["userdict"] = "";
  18. $menu_active["term"] = "";
  19. $menu_active["message"] = "";
  20. $menu_active["album"] = "";
  21. if (isset($_GET["item"])) {
  22. $currSettingItem = $_GET["item"];
  23. $menu_active[$currSettingItem] = " class='act'";
  24. } else {
  25. $currSettingItem = "home";
  26. }
  27. $album_power["15"] = "超级管理员";
  28. $album_power["1"] = "管理员";
  29. $album_power["2"] = "编辑";
  30. ?>
  31. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  32. <html>
  33. <head>
  34. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  35. <link type="text/css" rel="stylesheet" href="css/main.css"/>
  36. <link type="text/css" rel="stylesheet" href="css/setting.css"/>
  37. <title>PCD Studio</title>
  38. <script src="../public/js/jquery.min.js"></script>
  39. <script type="text/javascript">
  40. $(document).ready(function(){
  41. $(".flip").click(function(){
  42. $(this).next().slideToggle("slow");
  43. });
  44. });
  45. </script>
  46. </head>
  47. <body class="mainbody" id="mbody">
  48. <div class="main">
  49. <!-- content begin-->
  50. <div id="leftmenuinner">
  51. <div class="toolgroup1">
  52. </div>
  53. <div >
  54. <h1>Setting</h1>
  55. </div>
  56. <div class='toc' id='leftmenuinnerinner'>
  57. <ul class="setting_item">
  58. <li <?php echo $menu_active["account"]; ?>><a href="setting.php?item=account"><?php echo $_local->gui->account; ?></a></li>
  59. <li <?php echo $menu_active["general"]; ?>><a href="setting.php?item=general"><?php echo $_local->gui->general; ?></a></li>
  60. <li <?php echo $menu_active["local"]; ?>><a href="setting.php?item=local">Local</a></li>
  61. <li <?php echo $menu_active["studio"]; ?>><a href="setting.php?item=studio"><?php echo $_local->gui->studio; ?></a></li>
  62. <li <?php echo $menu_active["liberay"]; ?>><a href="setting.php?item=liberay"></a><?php echo $_local->gui->library; ?></li>
  63. <li <?php echo $menu_active["dictionary"]; ?>><a href="setting.php?item=dictionary"><?php echo $_local->gui->dictionary; ?></a></li>
  64. <li <?php echo $menu_active["userdict"]; ?>><a href="setting.php?item=userdict"><?php echo $_local->gui->userdict; ?></a></li>
  65. <li <?php echo $menu_active["term"]; ?>><a href="setting.php?item=term"><?php echo $_local->gui->dict_terms; ?></a></li>
  66. <li <?php echo $menu_active["message"]; ?>><a href="setting.php?item=message"><?php echo $_local->gui->message; ?></a></li>
  67. <li <?php echo $menu_active["album"]; ?>><a href="setting.php?item=album">Album</a></li>
  68. <li><a href="../admin/setting.php?item=account">Web Admin</a></li>
  69. </ul>
  70. </div>
  71. </div>
  72. <div id="setting_main_view" class="mainview">
  73. <div class="tool_bar">
  74. <div >
  75. <?php
  76. switch ($currSettingItem) {
  77. case "account":
  78. break;
  79. case "album":
  80. if (isset($_GET["id"])) {
  81. echo "<a href='setting.php?item=album'>返回</a>";
  82. }
  83. break;
  84. }
  85. ?>
  86. </div>
  87. <!--
  88. <div>
  89. <span>Language</span>
  90. <select id="id_language" name="menu" >
  91. <option value="en" >English</option>
  92. <option value="si" >සින‍්හල</option>
  93. <option value="zh-cn" >简体中文</option>
  94. <option value="zh-tw" >正體中文</option>
  95. </select>
  96. </div>-->
  97. </div>
  98. <?php
  99. switch ($currSettingItem) {
  100. case "dictionary":
  101. PDO_Connect("../" . FILE_DB_REF);
  102. $query = "select * from info where 1";
  103. $all = PDO_FetchAll($query);
  104. echo "<h2>参考字典 Refrence Dictionary</h2>";
  105. echo "<table>";
  106. echo "<th>选择</th><th>名称</th><th>语言</th><th>简介</th><th>下载</th><th></th>";
  107. foreach ($all as $dict) {
  108. echo "<tr>";
  109. echo "<td><input type='checkbox' checked /></td><td>{$dict["shortname"]}</td><td>{$dict["language"]}</td><td>{$dict["name"]}</td><td><button>下载</button></td><td><a>管理</a></td>";
  110. echo "</tr>";
  111. }
  112. echo "</table>";
  113. echo "<h2>系统字典System Dictionary</h2>";
  114. break;
  115. case "local":
  116. //语言文件
  117. if (isset($_GET["lang"])) {
  118. $_local = json_decode(file_get_contents("../public/lang/{$_GET["lang"]}.json"));
  119. } else {
  120. $_local = json_decode(file_get_contents("../public/lang/default.json"));
  121. }
  122. echo $_local->gui->pcd_studio;
  123. echo "<button>保存</button>";
  124. foreach ($_local as $x => $value) {
  125. echo "<div>";
  126. $counter = count($value);
  127. echo "<div class='flip'>{$x}({$counter})</div>";
  128. echo "<div class='panel' style='display:none;'>";
  129. if (is_object($value)) {
  130. $counter = 1;
  131. echo "<table>";
  132. foreach ($value as $row => $row_value) {
  133. echo "<tr>";
  134. echo "<td>$counter</td>";
  135. echo "<td>{$row}</td>";
  136. echo "<td><input type='input' value='{$row_value}' /></td>";
  137. echo "</tr>";
  138. $counter++;
  139. }
  140. echo "</table>";
  141. echo "<button>增加</button>";
  142. } else if (is_array($value)) {
  143. $counter = 1;
  144. echo "<table>";
  145. foreach ($value as $row) {
  146. if (is_object($row)) {
  147. echo "<tr>";
  148. echo "<td>$counter</td>";
  149. echo "<td style=\"text-align:right;\">{$row->id}</td>";
  150. echo "<td><input type='input' value='{$row->value}' /></td>";
  151. echo "</tr>";
  152. } else {
  153. echo "unkow<br>";
  154. }
  155. $counter++;
  156. }
  157. echo "</table>";
  158. echo "<button>增加</button>";
  159. } else {
  160. echo "unkow type";
  161. }
  162. echo "</div>";
  163. echo "</div>";
  164. }
  165. break;
  166. case "userdict": //用户字典管理
  167. break;
  168. case "term":
  169. break;
  170. case "account":
  171. echo "<h2>{$_local->gui->account}</h2>";
  172. echo "{$_local->gui->username}:$username<br />";
  173. echo "{$_local->gui->nick_name}:$nickname<br />";
  174. echo "{$_local->gui->e_mail}:$email<br />";
  175. echo "<a href='../ucenter/pwd_set.php'>{$_local->gui->change_password}</a><br>";
  176. echo "<a href='login.php?op=logout'>{$_local->gui->logout}</a>";
  177. break;
  178. case "album":
  179. $db_file = _FILE_DB_RESRES_INDEX_;
  180. PDO_Connect("$db_file");
  181. if (isset($_GET["id"])) {
  182. if (isset($_GET["power"])) {
  183. /*权限管理*/
  184. $query = "select * from 'album' where id='{$_GET["id"]}'";
  185. $album_info = PDO_FetchAll($query);
  186. if (count($album_info) > 0) {
  187. $query = "select * from 'album_power' where album_id='{$album_info[0]["id"]}'";
  188. $Fetch = PDO_FetchAll($query);
  189. echo "<h2>专辑权限管理</h2>";
  190. echo "<div>{$album_info[0]["title"]}-{$album_info[0]["author"]}</div>";
  191. echo "<form>";
  192. ?>
  193. <table>
  194. <tr>
  195. <th>序号</th><th>用户</th><th>密码</th><th>权限</th><th></th><th></th>
  196. </tr>
  197. <?php
  198. $sn = 1;
  199. foreach ($Fetch as $oneline) {
  200. echo "<tr>
  201. <td>{$sn}</td>
  202. <td>{$oneline["user_id"]}</td>
  203. <td><input type='input' value='{$oneline["password"]}' /></td>
  204. <td>
  205. <select>";
  206. foreach ($album_power as $x => $value) {
  207. if ($oneline["power"] == $x) {
  208. $select = "selected";
  209. } else {
  210. $select = "";
  211. }
  212. echo "<option value='{$x}' {$select}>{$value}</option>\r\n";
  213. }
  214. echo "</select>
  215. </td>
  216. <td><button>修改</button></td>
  217. <td><button>删除</button></td>
  218. </tr>";
  219. $sn++;
  220. }
  221. echo "<input type='submit' />";
  222. echo "</form>";
  223. }
  224. } else {
  225. $query = "select * from 'album' where id='{$_GET["id"]}'";
  226. $Fetch = PDO_FetchAll($query);
  227. if (count($Fetch) > 0) {
  228. echo "<h2>{$Fetch[0]["title"]}</h2>";
  229. echo "<form>";
  230. foreach ($Fetch[0] as $x => $value) {
  231. echo "<div><span>{$x}</span><span><input type='input' value='{$value}' /></span></div>";
  232. }
  233. echo "<input type='submit' />";
  234. echo "</form>";
  235. }
  236. }
  237. } else {
  238. echo "<h2>My Album</h2>";
  239. $query = "select * from 'album' where owner='{$UID}'";
  240. $Fetch = PDO_FetchAll($query);
  241. ?>
  242. <table>
  243. <tr>
  244. <th>Book</th><th>Title</th><th>Author</th><th>语言</th><th>媒体</th><th></th><th></th>
  245. </tr>
  246. <?php
  247. foreach ($Fetch as $album) {
  248. echo "<tr><td>{$album["book"]}</td>
  249. <td>{$album["title"]}</td>
  250. <td>{$album["author"]}</td>
  251. <td>{$album["language"]}</td>
  252. <td>{$album["type"]}</td>
  253. <td><a href=\"album.php?op=show_info&album_id={$album["id"]}\" target='_blank'>详情</a></td>
  254. <td><a href=\"album.php?op=export&album_id={$album["id"]}\" target='_blank'>导出</a></td>
  255. </tr>";
  256. }
  257. echo "</table>";
  258. }
  259. break;
  260. }
  261. ?>
  262. </div>
  263. </div>
  264. </body>
  265. </html>