public function preRender() { if (Zend_Auth::getInstance()->hasIdentity()) { $controller = sgContext::getInstance()->getController(); if ($controller instanceof FlatCMSPluginController) { $session = new Zend_Session_Namespace(Zend_Auth::getInstance()->getStorage()->getNamespace()); $session->FlatCMSEditorPluginFileMTime = filemtime(FlatCMSPluginPageModel::getPagePath(sgContext::getInstance()->getCurrentPath())); //figure out better way to handle this so libraries aren't double loaded $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/jquery.min.js'); $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/jquery.jeditable.mini.js'); $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/jquery.jeditable.autogrow.js'); $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/tinymce/jscripts/tiny_mce/jquery.tinymce.js'); $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/jquery.jeditable.tinymce.js'); $controller->scripts[] = sgToolkit::url('/js/FlatCMSEditorPlugin/init.js'); $controller->js_settings['FlatCMSEditorPlugin'] = array('saveURL' => sgToolkit::url(sgConfiguration::get('routing.FlatCMSEditorPlugin_save.path')), 'currentPath' => sgContext::getInstance()->getCurrentPath()); if (isset($controller->content) && is_array($controller->content)) { $textarea_fields = sgConfiguration::get('settings.FlatCMSEditorPlugin.textarea_fields', array()); foreach ($controller->content as $key => &$field) { if (in_array($key, $textarea_fields)) { $field = '<div class="editable-area" id="' . $key . '">' . $field . '</div>'; } else { $field = '<div class="editable" id="' . $key . '">' . $field . '</div>'; } } } } } }
public function POST() { $data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $adapter = new Zend_Auth_Adapter_Digest(sgConfiguration::get('settings.ZendAuthPlugin.passwd_path'), '*', $data['username'], $data['password']); $result = Zend_Auth::getInstance()->authenticate($adapter); if ($result && $result->isValid()) { if (isset($data['destination'])) { header('Location: ' . sgToolkit::url(filter_var($data['destination'], FILTER_SANITIZE_URL))); exit; } header('Location: ' . sgContext::getRelativeBaseUrl()); exit; } else { $this->errors = $result->getMessages(); if (isset($data['destination'])) { $_GET['destination'] = $data['destination']; } return self::GET(); } }
public static function redirectIfNotAuth() { if (!Zend_Auth::getInstance()->hasIdentity()) { header('Location: ' . sgToolkit::url(sgConfiguration::get('routing.ZendAuthPlugin_login.path') . '?destination=' . urlencode($route['path']))); } }