module.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. namespace app\admin;
  4. class module extends Base
  5. {
  6. public function initialize()
  7. {
  8. parent::initialize();
  9. $this->Administrator(7);
  10. $this->header();
  11. }
  12. public function __destruct()
  13. {
  14. $this->footer();
  15. }
  16. function index()
  17. {
  18. ?><div class="container"><?php
  19. $this->nav3();
  20. ?><table class="tb tb2">
  21. <tr><th class="partition">插件列表</th></tr>
  22. </table>
  23. <table class="tb tb2">
  24. <?php
  25. global $develop_auth;
  26. $query = db('plugin')->where('in_type', '>', 0)->order('in_id desc')->select();
  27. $count = db('plugin')->where('in_type', '>', 0)->count();
  28. if ($count == 0) {
  29. ?><tr><td colspan="2" class="td27">暂无插件</td></tr><?php
  30. } else {
  31. foreach ($query as $row) {
  32. ?><tr class="hover hover"><td valign="top" style="width:45px"><img src="source/plugin/<?php echo $row['in_dir'];?>/preview.jpg" onerror="this.src='static/admincp/image/preview.png'" style="cursor:pointer" onclick="location.href='plugin.php/<?php echo $row['in_dir'];?>/<?php echo $row['in_file'];?>/';" width="40" height="40" align="left" /></td><td class="light" valign="top" style="width:200px"><?php echo $row['in_name'];?><br /><span class="sml"><?php echo $row['in_dir'];?></span><br /></td><td valign="bottom"><span class="light">作者: <?php echo $row['in_author'];?></span><div class="psetting"><a href="<?php echo $row['in_address'];?>" target="_blank">查看</a></div></td><td align="right" valign="bottom" style="width:160px"><?php echo $row['in_addtime'];?><br /><br /><a style="cursor:pointer" onclick="del_msg('?c=module&a=uninst&id=<?php echo $row['in_id'];?>&dir=<?php echo $row['in_dir'];?>');">卸载</a>&nbsp;&nbsp;</td></tr><?php
  33. }
  34. }
  35. ?></table>
  36. <table class="tb tb2">
  37. <tr><th class="partition">扩展列表</th></tr>
  38. </table>
  39. <table class="tb tb2">
  40. <?php
  41. $query = db('plugin')->where('in_type', '<', 1)->order('in_addtime desc')->select();
  42. $count = db('plugin')->where('in_type', '<', 1)->count();
  43. if ($count == 0) {
  44. ?><tr><td colspan="2" class="td27">暂无扩展</td></tr><?php
  45. } else {
  46. foreach ($query as $row) {
  47. ?><tr class="hover hover"><td valign="top" style="width:45px"><img src="source/plugin/<?php echo $row['in_dir'];?>/preview.jpg" onerror="this.src='static/admincp/image/preview.png'" width="40" height="40" align="left" /></td><td class="light" valign="top" style="width:200px"><?php echo $row['in_name'];?><br /><span class="sml"><?php echo $row['in_dir'];?></span><br /></td><td valign="bottom"><span class="light">作者: <?php echo $row['in_author'];?></span><div class="psetting"><a href="<?php echo $row['in_address'];?>" target="_blank">查看</a></div></td><td align="right" valign="bottom" style="width:160px"><?php echo $row['in_addtime'];?><br /><br /><a style="cursor:pointer" onclick="del_msg('?c=module&a=uninst&id=<?php echo $row['in_id'];?>&dir=<?php echo $row['in_dir'];?>');">卸载</a>&nbsp;&nbsp;</td></tr><?php
  48. }
  49. }
  50. ?></table>
  51. <table class="tb tb2">
  52. <tr><td colspan="15"><div class="fixsel"><a href="<?php echo is_ssl() ? str_replace('http://', 'https://', $develop_auth) : $develop_auth;?>">获取更多应用</a></div></td></tr>
  53. </table>
  54. </div><?php
  55. }
  56. function uninst()
  57. {
  58. $this->del_plugin($_GET['id'], $_GET['dir']);
  59. }
  60. function del_plugin($id, $dir)
  61. {
  62. if (@(include_once 'source/plugin/' . $dir . '/function.php')) {
  63. plugin_uninstall();
  64. }
  65. if (db('plugin')->where('in_id', $id)->delete()) {
  66. echo "<script type=\"text/javascript\">parent.\$('menu_app').innerHTML='" . $this->Menu_App() . "';</script>";
  67. destroyDir('source/plugin/' . $dir . '/');
  68. $this->ShowMessage("恭喜您,应用卸载成功!", "?c=module", "infotitle2", 3000, 1);
  69. }
  70. }
  71. }