plugin.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. [UCenter] (C)2001-2099 Comsenz Inc.
  4. This is NOT a freeware, use is subject to license terms
  5. $Id: plugin.php 1059 2011-03-01 07:25:09Z monkey $
  6. */
  7. !defined('IN_UC') && exit('Access Denied');
  8. class pluginbase extends adminbase {
  9. public function serialize($s, $htmlon = 0) {
  10. parent::serialize($s, $htmlon);
  11. }
  12. var $plugin = array();
  13. var $plugins = array();
  14. function __construct() {
  15. $this->control();
  16. }
  17. function pluginbase() {
  18. parent::__construct();
  19. $this->check_priv();
  20. if(!$this->user['isfounder']) {
  21. $this->message('no_permission_for_this_module');
  22. }
  23. $a = getgpc('a');
  24. $this->load('plugin');
  25. $this->plugin = $_ENV['plugin']->get_plugin($a);
  26. $this->plugins = $_ENV['plugin']->get_plugins();
  27. if(empty($this->plugin)) {
  28. $this->message('read_plugin_invalid');
  29. }
  30. $this->view->assign('plugin', $this->plugin);
  31. $this->view->assign('plugins', $this->plugins);
  32. $this->view->languages = $this->plugin['lang'];
  33. $this->view->tpldir = UC_ROOT.'./plugin/'.$a;
  34. $this->view->objdir = UC_DATADIR.'./view';
  35. }
  36. function _call($a, $arg) {
  37. $do = getgpc('do');
  38. $do = empty($do) ? 'onindex' : 'on'.$do;
  39. if(method_exists($this, $do) && $do{0} != '_') {
  40. $this->$do();
  41. } else {
  42. exit('Plugin module not found');
  43. }
  44. }
  45. }
  46. $a = getgpc('a');
  47. $do = getgpc('do');
  48. if(!preg_match("/^[\w]{1,64}$/", $a)) {
  49. exit('Argument Invalid');
  50. }
  51. if(!@require_once UC_ROOT."./plugin/$a/plugin.php") {
  52. exit('Plugin not found');
  53. }
  54. ?>