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.

77 lines
2.0 KiB

10 years ago
  1. <?php
  2. class AdminMain extends \Movim\Widget\Base
  3. {
  4. function load() {
  5. $this->addjs('admin.js');
  6. $form = $_POST;
  7. $cd = new \Modl\ConfigDAO();
  8. $config = $cd->get();
  9. if(isset($form) && !empty($form)) {
  10. if(isset($form['password'])
  11. && $form['password'] != '' && $form['repassword'] != ''
  12. && $form['password'] == $form['repassword']) {
  13. $form['password'] = sha1($form['password']);
  14. } else {
  15. $form['password'] = $config->password;
  16. }
  17. unset($form['repassword']);
  18. foreach($form as $key => $value) {
  19. $config->$key = $value;
  20. }
  21. $cd->set($config);
  22. //set timezone
  23. if(isset($form['timezone'])) {
  24. date_default_timezone_set($form['timezone']);
  25. }
  26. }
  27. }
  28. public function testBosh($url)
  29. {
  30. return requestURL($url, 1);
  31. }
  32. public function date($timezone)
  33. {
  34. $t = new DateTimeZone($timezone);
  35. $c = new DateTime(null, $t);
  36. $current_time = $c->format('D M j Y G:i:s');
  37. return $current_time;
  38. }
  39. function display()
  40. {
  41. $cd = new \Modl\ConfigDAO;
  42. $l = Movim\i18n\Locale::start();
  43. $this->view->assign('conf', $cd->get());
  44. $this->view->assign('logs',
  45. array(
  46. 0 => $this->__('log.empty'),
  47. 1 => $this->__('log.syslog'),
  48. 2 => $this->__('log.syslog_files'))
  49. );
  50. $this->view->assign('bosh_info4',
  51. $this->__('bosh.info4', '<a href="http://wiki.movim.eu/en:install">', '</a>'));
  52. $json = requestURL(MOVIM_API.'websockets', 3);
  53. $json = json_decode($json);
  54. if(isset($json) && $json->status != 404) {
  55. $this->view->assign('websockets', $json);
  56. }
  57. $this->view->assign('timezones', getTimezoneList());
  58. $this->view->assign('langs', $l->getList());
  59. $this->view->assign('countries', getCountries());
  60. }
  61. }