예제 #1
0
 /**
  * Returns an instance of Sitengine_Status
  *
  * Singleton pattern implementation
  *
  * @return Sitengine_Status Provides a fluent interface
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #2
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_translate = $this->_getTranslateInstance();
         $this->_templateIndexView = $this->getEnv()->getIncludesDir() . '/Sitengine/Error/_Templates/IndexView.html';
     } catch (Exception $exception) {
         require_once 'Sitengine/Error/Exception.php';
         throw new Sitengine_Error_Exception('object instantiation error', $exception);
     }
 }
예제 #3
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         $this->_logger = $this->getEnv()->getLoggerInstance($this->getEnv()->getMyLogsDir(), gmdate('Ymd') . '-sitengine.log', $this->getEnv()->getLogFilterPriority(), get_class($this));
         $this->_database = $this->getEnv()->getDatabaseInstance('Pdo_Mysql', $this->getEnv()->getDatabaseConfig('default'), $this->getEnv()->getDebugControl());
         $this->getEnv()->startSession($this->getDatabase());
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         require_once 'Sitengine/Env/Preferences.php';
         $this->_preferences = Sitengine_Env_Preferences::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_permiso = $this->getFrontController()->getPermiso()->start($this->getDatabase());
         require_once 'Zend/Session/Namespace.php';
         $this->_namespace = new Zend_Session_Namespace(get_class($this));
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Binaries/Couldies/Uploads/Exception.php';
         throw new Sitengine_Proto_Binaries_Couldies_Uploads_Exception('object instantiation error', $exception);
     }
 }
예제 #4
0
 public function checkUserModifyData(Sitengine_Status $status, Sitengine_Controller_Request_Http $request, Sitengine_Translate $translate)
 {
     require_once 'Sitengine/Validator.php';
     $name = 'name';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsNameRequired');
         $status->addHint($name, $message);
     } else {
         if (!Sitengine_Validator::emailAddress($val)) {
             $message = $translate->translate('hintsNameValidEmailRequired');
             $status->addHint($name, $message);
         }
     }
     $name = 'nickname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsNicknameRequired');
         $status->addHint($name, $message);
     }
     $name = 'firstname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsFirstnameRequired');
         $status->addHint($name, $message);
     }
     $name = 'lastname';
     $val = $request->getPost($name);
     if (Sitengine_Validator::nada($val)) {
         $message = $translate->translate('hintsLastnameRequired');
         $status->addHint($name, $message);
     }
     $name = 'password';
     $val = $request->getPost($name);
     if ($val != $request->getPost('passwordConfirm')) {
         $message = $translate->translate('hintsPasswordsDontMatch');
         $status->addHint($name, $message);
     }
     if ($val != '') {
         require_once 'Zend/Validate/StringLength.php';
         $validator = new Zend_Validate_StringLength($this->getPermiso()->getMinimalPasswordLength());
         $validator->setMessage($translate->translate('hintsPasswordTooShort'), Zend_Validate_StringLength::TOO_SHORT);
         if (!$validator->isValid($val)) {
             $messages = $validator->getMessages();
             $status->addHint($name, $messages);
         }
     }
     $name = 'country';
     if (Sitengine_Validator::nada($request->getPost($name), 'noneSelected')) {
         $message = $translate->translate('hintsCountryRequired');
         $status->addHint($name, $message);
     }
     $name = 'timezone';
     if (Sitengine_Validator::nada($request->getPost($name), 'noneSelected')) {
         $message = $translate->translate('hintsTimezoneRequired');
         #$status->addHint($name, $message);
     }
     $fileId = 'avatarOriginal';
     require_once 'Sitengine/Upload.php';
     $upload = new Sitengine_Upload($fileId);
     if ($upload->isFile()) {
         $messages = array();
         if (!preg_match('/(gif|jpg|jpeg)/i', $upload->getMime())) {
             $messages[] = $translate->translate('hintsAvatarOriginalFiletype');
         }
         if ($upload->getSize() > 1024 * 1024) {
             $messages[] = $translate->translate('hintsAvatarOriginalFilesize');
         }
         if (sizeof($messages)) {
             $status->addHint($fileId, $messages);
         }
     }
     return !$status->hasHints();
 }
예제 #5
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         #$this->_setSelfSubmitUri();
         $this->_logger = $this->getEnv()->getLoggerInstance($this->getEnv()->getMyLogsDir(), gmdate('Ymd') . '-sitengine.log', $this->getEnv()->getLogFilterPriority(), get_class($this));
         $this->_database = $this->getEnv()->getDatabaseInstance('Pdo_Mysql', $this->getEnv()->getDatabaseConfig('default'), $this->getEnv()->getDebugControl());
         $this->getEnv()->startSession($this->getDatabase());
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         require_once 'Sitengine/Env/Preferences.php';
         $this->_preferences = Sitengine_Env_Preferences::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_permiso = $this->getFrontController()->getPermiso()->start($this->getDatabase());
         $this->_translate = $this->_getTranslateInstance();
         require_once 'Zend/Session/Namespace.php';
         $this->_namespace = new Zend_Session_Namespace(get_class($this));
         $this->_templateSubscribeView = $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Templates/SubscribeView.html';
         $this->_templateUnsubscribeView = $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Templates/UnsubscribeView.html';
         $this->_templateConfirmOptinView = $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Templates/ConfirmOptinView.html';
         $this->_templateConfirmFinalView = $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Templates/ConfirmFinalView.html';
         $this->_templateConfirmUnsubscribeView = $this->getEnv()->getIncludesDir() . '/Sitengine/Newsletter/Frontend/Subscriptions/_Templates/ConfirmUnsubscribeView.html';
     } catch (Exception $exception) {
         require_once 'Sitengine/Newsletter/Frontend/Subscriptions/Exception.php';
         throw new Sitengine_Newsletter_Frontend_Subscriptions_Exception('object instantiation error', $exception);
     }
 }
예제 #6
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         #$this->_setSelfSubmitUri();
         $this->_logger = $this->getEnv()->getLoggerInstance($this->getEnv()->getMyLogsDir(), gmdate('Ymd') . '-sitengine.log', $this->getEnv()->getLogFilterPriority(), get_class($this));
         $this->_database = $this->getEnv()->getDatabaseInstance('Pdo_Mysql', $this->getEnv()->getDatabaseConfig('default'), $this->getEnv()->getDebugControl());
         $options = array();
         $routeName = $this->getFrontController()->getRouter()->getCurrentRouteName();
         if ($routeName == Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_UPLOAD) {
             # allow session id to come from GET on uploads from flash application
             $options = array('use_only_cookies' => 0);
         }
         $this->getEnv()->startSession($this->getDatabase(), $options);
         $this->getFrontController()->getProtoPackage()->start($this->getDatabase());
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         require_once 'Sitengine/Env/Preferences.php';
         $this->_preferences = Sitengine_Env_Preferences::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_permiso = $this->getFrontController()->getPermiso()->start($this->getDatabase());
         $this->_translate = $this->_getTranslateInstance();
         $this->_entity = $this->_getEntityModelInstance();
         require_once 'Zend/Session/Namespace.php';
         $this->_namespace = new Zend_Session_Namespace(get_class($this));
         $this->_templateIndexView = $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/Goodies/Shouldies/_Templates/IndexView.html';
         $this->_templateFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/Goodies/Shouldies/_Templates/FormView.html';
         $this->_templateUploadView = $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/Goodies/Shouldies/_Templates/UploadView.html';
         $this->_templateAssignView = $this->getEnv()->getIncludesDir() . '/Sitengine/Proto/Backend/Goodies/Shouldies/_Templates/AssignView.html';
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Exception.php';
         throw new Sitengine_Proto_Backend_Goodies_Shouldies_Exception('object instantiation error', $exception);
     }
 }
예제 #7
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         #$this->_setSelfSubmitUri();
         $this->_logger = $this->getEnv()->getLoggerInstance($this->getEnv()->getMyLogsDir(), gmdate('Ymd') . '-sitengine.log', $this->getEnv()->getLogFilterPriority(), get_class($this));
         $this->_database = $this->getEnv()->getDatabaseInstance('Pdo_Mysql', $this->getEnv()->getDatabaseConfig('default'), $this->getEnv()->getDebugControl());
         $this->getEnv()->startSession($this->getDatabase());
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         require_once 'Sitengine/Env/Preferences.php';
         $this->_preferences = Sitengine_Env_Preferences::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_permiso = $this->getFrontController()->getPermiso()->start($this->getDatabase());
         $this->_translate = $this->_getTranslateInstance();
         $this->_transcripts = $this->_getTranscriptsInstance();
         $this->_entity = $this->_getEntityModelInstance();
         require_once 'Zend/Session/Namespace.php';
         $this->_namespace = new Zend_Session_Namespace(get_class($this));
         $this->_templateIndexView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/IndexView.html';
         $this->_templateSearchView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/SearchView.html';
         $this->_templateFileFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/FileFormView.html';
         $this->_templatePageFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/PageFormView.html';
         $this->_templateMaskFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/MaskFormView.html';
         $this->_templateLayerFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/LayerFormView.html';
         $this->_templateSnippetFormView = $this->getEnv()->getIncludesDir() . '/Sitengine/Sitemap/Backend/_Templates/SnippetFormView.html';
     } catch (Exception $exception) {
         require_once 'Sitengine/Sitemap/Backend/Exception.php';
         throw new Sitengine_Sitemap_Backend_Exception('object instantiation error', $exception);
     }
 }
예제 #8
0
 protected function _save(Sitengine_Permiso_Model_Account_Form $form)
 {
     require_once 'Sitengine/Status.php';
     $status = Sitengine_Status::getInstance();
     if (!$form->isValid($_POST)) {
         foreach ($form->getMessages() as $key => $messages) {
             $status->addHint($key, $messages);
         }
         return false;
     }
     if ($this->_getUserRow() === null) {
         $this->_userRow = $this->getPermiso()->getUsersTable()->createRow($form->getValues());
         $this->_getUserRow()->setId(Sitengine_String::createId());
         $this->_getUserRow()->setCdate($this->getPermiso()->getUsersTable()->getNow());
         $this->_getUserRow()->setPassword($this->_makePasswordHash($form->getPasswordVal()));
     } else {
         $password = $form->getPasswordVal() ? $this->_makePasswordHash($form->getPasswordVal()) : $this->_getUserRow()->getPassword();
         $this->_getUserRow()->setFromArray($form->getValues());
         $this->_getUserRow()->setPassword($password);
     }
     try {
         $this->_getUserRow()->setMdate($this->getPermiso()->getUsersTable()->getNow());
         $this->_getUserRow()->setEnabled(1);
         # TODO - a better way for use in other contexts
         $this->_getUserRow()->save();
     } catch (Exception $exception) {
         if ($this->getPermiso()->getUsersTable()->checkModifyException($exception)) {
             throw $exception;
         }
         switch ($this->getPermiso()->getUsersTable()->getError()) {
             case 'nameExists':
                 $hint = self::HINT_NAME_EXISTS;
                 break;
             case 'nicknameExists':
                 $hint = self::HINT_NICKNAME_EXISTS;
                 break;
             default:
                 $hint = self::HINT_UNKNOWN_ERROR;
                 break;
         }
         $message = $this->_getTranslator()->translate($hint);
         $status->addHint($hint, $message);
         return false;
     }
     return true;
 }
예제 #9
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     try {
         parent::__construct($request, $response, $invokeArgs);
         $this->_mapInvokeArgs($invokeArgs);
         $this->_mapConfig($this->_config);
         #$this->_setSelfSubmitUri();
         $this->_logger = $this->getEnv()->getLoggerInstance($this->getEnv()->getMyLogsDir(), gmdate('Ymd') . '-sitengine.log', $this->getEnv()->getLogFilterPriority(), get_class($this));
         $this->_database = $this->getEnv()->getDatabaseInstance('Pdo_Mysql', $this->getEnv()->getDatabaseConfig('default'), $this->getEnv()->getDebugControl());
         $this->getEnv()->startSession($this->getDatabase());
         $this->getFrontController()->getBlogPackage()->start($this->getDatabase());
         require_once 'Sitengine/Status.php';
         $this->_status = Sitengine_Status::getInstance();
         require_once 'Sitengine/Env/Preferences.php';
         $this->_preferences = Sitengine_Env_Preferences::getInstance();
         $this->_locale = $this->getEnv()->getLocaleInstance();
         $this->_permiso = $this->getFrontController()->getPermiso()->start($this->getDatabase());
         $this->_translate = $this->_getTranslateInstance();
         $this->_entity = $this->_getEntityModelInstance();
         require_once 'Zend/Session/Namespace.php';
         $this->_namespace = new Zend_Session_Namespace(get_class($this));
         $this->_templateIndexView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/IndexView.html';
         $this->_templateTextView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/TextView.html';
         $this->_templatePhotoView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/PhotoView.html';
         $this->_templateGalleryView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/GalleryView.html';
         $this->_templateQuoteView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/QuoteView.html';
         $this->_templateLinkView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/LinkView.html';
         $this->_templateAudioView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/AudioView.html';
         $this->_templateVideoView = $this->getEnv()->getIncludesDir() . '/Sitengine/Blog/Frontend/Blogs/Posts/_Templates/VideoView.html';
     } catch (Exception $exception) {
         require_once 'Sitengine/Blog/Frontend/Blogs/Posts/Exception.php';
         throw new Sitengine_Blog_Frontend_Blogs_Posts_Exception('object instantiation error', $exception);
     }
 }