setting.php 8.7 KB

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