Exemplo n.º 1
0
 /**
  * 初始化
  */
 public function init()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'chat'));
     $this->view->LANG = $this->lang;
     $this->_helper->viewRenderer->view->setBasePath(APPLICATION_PATH . '/modules/public/views');
     $this->_helper->viewRenderer->setViewScriptPathSpec(':module#:controller#:action.:suffix');
 }
Exemplo n.º 2
0
 /**
  * 初始化函数
  * 子类继承可通过重写本函数实现自己的初始化流程
  */
 public function init()
 {
     $this->view = $this->_this->view;
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu', 'attend'));
     $this->view->LANG = $this->lang;
     $this->checkApp();
 }
Exemplo n.º 3
0
 /**
  * Returns an instance of Lang
  *
  * Singleton pattern implementation
  *
  * @return Lang Provides a fluent interface
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 4
0
 /**
  *
  */
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common'));
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
 }
Exemplo n.º 5
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     $this->view->LANG = $this->lang;
     if (null === $this->_tudu || null === $this->_user) {
         return $this->json(false, $this->lang['tudu_not_exists']);
     }
 }
Exemplo n.º 6
0
 /**
  * 初始化
  */
 public function init()
 {
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'setting'));
     $this->_access = array('skin' => $this->_user->getAccess()->isAllowed(Tudu_Access::PERM_CUSTOM_SKIN));
     $this->view->access = $this->_access;
     $this->view->LANG = $this->lang;
 }
Exemplo n.º 7
0
 public function init()
 {
     parent::init();
     $this->_helper->viewRenderer->setNeverRender();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
 }
Exemplo n.º 8
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     $this->view->LANG = $this->lang;
     if (null === $this->_tudu || null === $this->_user) {
         $this->jump('/foreign/index/invalid');
     }
     if (!$this->_isValid()) {
         $this->jump("/foreign/index/?tid={$this->_tudu->tuduId}&fid={$this->_user['uniqueid']}&ts={$this->_tsId}");
     }
 }
Exemplo n.º 9
0
 public function indexAction()
 {
     $error = $this->_request->getQuery('error');
     $redirect = $this->_request->getQuery('redirect');
     $lang = Tudu_Lang::getInstance()->load('login');
     $orgInfo = array();
     // 使用SSL登陆
     if ('http:' == PROTOCOL && strpos($this->options['sites']['www'], 'https:') === 0) {
         if (preg_replace('/^https:\\/\\//', '', $this->options['sites']['www']) == $this->_host) {
             $this->_redirect($this->options['sites']['www'] . $this->_request->getServer('REQUEST_URI'));
         } else {
             $this->_redirect('https://' . $this->_host . $this->_request->getServer('REQUEST_URI'));
         }
     }
     $memcache = $this->getInvokeArg('bootstrap')->getResource('memcache');
     $orgInfo = $memcache->get('TUDU-HOST-' . $this->_host);
     if (!empty($this->session->auth['appinvoker'])) {
         return;
     }
     if (!$orgInfo) {
         /* @var $daoOrg Dao_Md_Org_Org */
         $daoOrg = Oray_Dao::factory('Dao_Md_Org_Org', $this->bootstrap->getResource('multidb')->getDefaultDb());
         $orgInfo = $daoOrg->getOrgByHost($this->_host);
         $flag = null;
         $memcache->set('TUDU-HOST-' . $this->_host, $orgInfo, $flag, 3600);
     }
     if ($this->_user && $this->_user->isLogined() && $this->_user->orgId == $orgInfo->orgId) {
         return $this->_redirect(PROTOCOL . '//' . $this->_request->getServer('HTTP_HOST') . '/frame');
     }
     if ($orgInfo instanceof Dao_Md_Org_Record_Org) {
         $orgInfo = $orgInfo->toArray();
         if (!empty($this->options['tudu']['customdomain'])) {
             $this->options['sites']['tudu'] = PROTOCOL . '//' . $orgInfo['orgid'] . '.' . $this->options['tudu']['domain'];
         }
     }
     if (in_array($error, array('params', 'failure', 'locked', 'unsupport', 'timeout', 'notexist', 'seccode', 'forbid')) && array_key_exists($error, $lang)) {
         $this->view->error = $error;
     }
     if ($error == 'admin') {
         $this->view->fromadmin = true;
     }
     $this->view->org = $orgInfo;
     $this->view->lang = $lang;
     $this->view->redirect = $redirect;
     $this->view->options = array('sites' => $this->options['sites'], 'tudu' => $this->options['tudu']);
     // 选择登陆模板
     if (!empty($orgInfo) && !empty($orgInfo['loginskin'])) {
         $loginSkin = $orgInfo['loginskin'];
         if (!empty($loginSkin['selected']) && !empty($loginSkin['selected']['value']) && $loginSkin['selected']['value'] != 'SYS:default') {
             $this->view->loginskin = $orgInfo['loginskin'];
             $this->render('custom');
         }
     }
 }
Exemplo n.º 10
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load('common');
     if (!$this->_user->isLogined()) {
         $this->jump(null, array('error' => 'timeout'));
     }
     // IP或登录时间无效
     if (!empty($this->session->auth['invalid'])) {
         $this->jump('/forbid/');
     }
 }
Exemplo n.º 11
0
 /**
  * 
  */
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common'));
     if (null === $this->_tudu || null === $this->_user) {
         $this->jump('/foreign/index/invalid');
     }
     if (!$this->_isValid()) {
         $this->jump("/foreign/index/?tid={$this->_tudu->tuduId}&fid={$this->_user['uniqueid']}&ts={$this->_tsId}");
     }
     $this->_daoFile = $this->getDao('Dao_Td_Attachment_File');
 }
Exemplo n.º 12
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     $this->view->LANG = $this->lang;
     if (!$this->_user->isLogined()) {
         $this->jump(null, array('error' => 'timeout'));
     }
     // IP或登录时间无效
     if (!empty($this->session->auth['invalid'])) {
         $this->jump('/forbid/');
     }
     $this->view->uploadsizelimit = $this->options['upload']['sizelimit'] / 1024;
 }
Exemplo n.º 13
0
 /**
  * 初始化
  */
 public function init()
 {
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'label'));
     if (!$this->_user->isLogined()) {
         $this->jump(null, array('error' => 'timeout'));
     }
     // IP或登录时间无效
     if (!empty($this->session->auth['invalid'])) {
         $this->jump('/forbid/');
     }
     $this->view->LANG = $this->lang;
 }
Exemplo n.º 14
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     if (!$this->_tudu) {
         $this->json(false, 'error');
     }
     if (null === $this->_tudu || null === $this->_user) {
         $this->json(false, $this->lang['tudu_not_exists']);
     }
     if (!$this->_isValid()) {
         $this->json(false, $this->lang['foreign_access_invalided']);
     }
 }
Exemplo n.º 15
0
 public function init()
 {
     if ($cookies = $this->_request->getParam('cookies')) {
         if ($cookies = @unserialize($cookies)) {
             foreach ($cookies as $key => $val) {
                 $_COOKIE[$key] = $val;
             }
         }
     }
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common'));
     $this->view->LANG = $this->lang;
 }
Exemplo n.º 16
0
 /**
  * 初始化
  */
 public function init()
 {
     parent::init();
     $action = strtolower($this->_request->getActionName());
     if ($action !== 'status') {
         $this->lang = Tudu_Lang::getInstance()->load(array('common', 'email'));
         $this->view->access = array('skin' => $this->_user->getAccess()->isAllowed(Tudu_Access::PERM_CUSTOM_SKIN));
         $this->view->LANG = $this->lang;
     } else {
         $this->lang = Tudu_Lang::getInstance()->load(array('common'));
     }
     $this->_daoEmail = $this->getMdDao('Dao_Md_User_Email');
 }
Exemplo n.º 17
0
 public function init()
 {
     parent::init();
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
     Tudu_AddressBook::getInstance()->setCache($this->cache);
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
     $resourceManager = new Tudu_Model_ResourceManager_Registry();
     $resourceManager->setResource(Tudu_Model::RESOURCE_CONFIG, $this->bootstrap->getOptions());
     Tudu_Model::setResourceManager($resourceManager);
 }
Exemplo n.º 18
0
 public function init()
 {
     if ($cookies = $this->_request->getParam('cookies')) {
         if ($cookies = @unserialize($cookies)) {
             foreach ($cookies as $key => $val) {
                 $_COOKIE[$key] = $val;
             }
         }
     }
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'user'));
     $this->view->LANG = $this->lang;
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->getDb('ts1')));
 }
Exemplo n.º 19
0
 public function init()
 {
     $this->_helper->viewRenderer->setNeverRender();
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
     // IP或登录时间无效
     if (!empty($this->session->auth['invalid'])) {
         return $this->json(false, $this->lang['forbid_access']);
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
     $this->manager = Tudu_Tudu_Manager::getInstance();
 }
Exemplo n.º 20
0
 public function init()
 {
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common'));
     $this->view->LANG = $this->lang;
 }
Exemplo n.º 21
0
 /**
  * 初始化
  */
 public function init()
 {
     $this->bootstrap = $this->getInvokeArg('bootstrap');
     $this->multidb = $this->bootstrap->getResource('multidb');
     $this->cache = $this->bootstrap->getResource('memcache');
     $this->options = $this->bootstrap->getOptions();
     $this->_user = Tudu_User::getInstance();
     $this->_timestamp = time();
     if (Zend_Session::sessionExists() || !empty($this->_sessionId)) {
         if (!$this->session) {
             $this->session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, false);
         }
         $this->_sessionId = Zend_Session::getId();
         do {
             // 登陆信息验证
             $names = $this->options['cookies'];
             if (!isset($this->session->auth) || !$this->_request->getCookie($names['username'])) {
                 $this->_destroySession();
                 break;
             }
             if (isset($this->session->auth['referer'])) {
                 $this->_refererUrl = $this->session->auth['referer'];
             }
             if ($this->session->auth['username'] != $this->_request->getCookie($names['username'])) {
                 $this->_destroySession();
                 break;
             }
             $this->session->auth['lasttime'] = $this->_timestamp;
             $this->_user->init($this->session->auth);
             if (!$this->_user->isLogined()) {
                 $this->_destroySession();
             }
             // 体验帐号
             if (in_array($this->_user->orgId, array('win', 'tuduoffice'))) {
                 $this->session->isdemo = true;
             }
             if ($this->_user->orgId == 'online-app') {
                 header('P3P: CP=”CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR”');
             }
             $this->org = $this->getOrg($this->_user->orgId);
             $this->_user->setOptions(array('timezone' => !empty($this->org['timezone']) ? $this->org['timezone'] : 'Etc/GMT-8', 'dateformat' => !empty($this->org['dateformat']) ? $this->org['dateformat'] : '%Y-%m-%d %H:%M:%S', 'passwordlevel' => $this->org['passwordlevel'], 'skin' => $this->org['skin']));
             if (!empty($this->_user->option['language'])) {
                 Tudu_Lang::getInstance()->setLanguage($this->_user->option['language']);
             }
             // 禁止访问
             if (Dao_Md_Org_Org::STATUS_FORBID == $this->org['status']) {
                 $controllerName = $this->_request->getControllerName();
                 if ($controllerName != 'forbid') {
                     $this->jump('/forbid');
                 }
             }
             // 设置默认时区
             if (!empty($this->_user->option['timezone'])) {
                 date_default_timezone_set($this->_user->option['timezone']);
             }
             // 注册TS数据库
             Tudu_Dao_Manager::setDb(Tudu_Dao_Manager::DB_TS, $this->multidb->getDb('ts' . $this->org['tsid']), true);
         } while (false);
     } else {
         $authId = $this->_request->getCookie($this->options['cookies']['auth']);
         if (!empty($authId)) {
             $query = $this->_request->getServer('HTTP_QUERY_STRING');
             return $this->jump($this->options['sites']['www'] . '/login/auto?referer=%referer', array(), array('referer' => true));
         }
     }
     $this->view->version = self::TUDU_VERSION;
     $this->view->user = $this->_user->toArray();
     $this->view->options = array('sites' => $this->options['sites'], 'tudu' => $this->options['tudu']);
 }
Exemplo n.º 22
0
 public function preDispatch()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->lang = Tudu_Lang::getInstance()->load('login');
 }
Exemplo n.º 23
0
 public function indexAction()
 {
     $this->lang = Tudu_Lang::getInstance()->load('common');
     $this->view->LANG = $this->lang;
     $this->view->forbid = $this->session->auth['invalid'];
 }
Exemplo n.º 24
0
 /**
  *
  */
 public function initpwdUpdateAction()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'setting'));
     $pwd = $this->_request->getPost('password');
     $repwd = $this->_request->getPost('repassword');
     if ($pwd != $repwd) {
         return $this->json(false, $this->lang['confirm_password_unmatch']);
     }
     // 安全级别匹配
     $regs = array(1 => '/[0-9a-zA-Z]/', 2 => '/[0-9a-zA-Z^a-zA-Z0-9]/');
     $pwdLevel = isset($this->_user->option['passwordlevel']) ? $this->_user->option['passwordlevel'] : 0;
     if ($pwdLevel > 0 && !preg_match($regs[$pwdLevel], $pwd)) {
         return $this->json(false, $this->lang['password_level_not_match_' . $pwdLevel]);
     }
     $daoUser = Oray_Dao::factory('Dao_Md_User_User', $this->multidb->getDb());
     $params = array('password' => $pwd);
     $ret = $daoUser->updateUserInfo($this->_user->orgId, $this->_user->userId, $params);
     $ret = $daoUser->updateUser($this->_user->orgId, $this->_user->userId, array('initpassword' => 0));
     $this->_user->clearCache($this->_user->userName);
     if (!$ret) {
         return $this->json(false, $this->lang['password_update_failure']);
     }
     // 消息队列
     $config = $this->bootstrap->getOption('httpsqs');
     $httpsqs = new Oray_Httpsqs($config['host'], $config['port'], $config['chartset'], $config['name']);
     $httpsqs->put(implode(' ', array('user', 'create', '', implode(':', array($this->_user->orgId, $this->_user->userName, $this->_user->uniqueId, $this->_user->trueName)))), 'admin');
     return $this->json(true, $this->lang['password_update_success']);
 }
Exemplo n.º 25
0
 public function preDispatch()
 {
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     $this->view->LANG = $this->lang;
 }