/** * */ public function checkSkinStyles($name, $values) { $config = Zend_Registry::get('config'); $basePath = $config->design->pathToSkins; $xhtml = array(); $this->view->name = $name; $this->view->selectedStyles = $values; //load the skin folders if (is_dir('./' . $basePath)) { $folders = Digitalus_Filesystem_Dir::getDirectories('./' . $basePath); if (count($folders) > 0) { foreach ($folders as $folder) { $this->view->skin = $folder; $styles = Digitalus_Filesystem_File::getFilesByType('./' . $basePath . '/' . $folder . '/styles', 'css'); if (is_array($styles)) { foreach ($styles as $style) { //add each style sheet to the hash // key = path / value = filename $hashStyles[$style] = $style; } $this->view->styles = $hashStyles; $xhtml[] = $this->view->render($this->partialFile); unset($hashStyles); } } } } else { throw new Zend_Acl_Exception('Unable to locate skin folder'); } return implode(null, $xhtml); }
public function init() { $view = Zend_Registry::get('Zend_View'); $this->setTitle('Delete Sub Library'); $this->setAttrib('class', 'global_form_popup'); $this->setDescription('Are you sure that you want to delete this library? It will not be recoverable after being deleted.'); //get table $mappingTable = Engine_Api::_()->getDbTable('mappings', 'user'); //get videos mapping of library $params = array(); $params['owner_type'] = $this->_library->getType(); $params['owner_id'] = $this->_library->getIdentity(); $videoMappings = $mappingTable->getItemsMapping('video', $params); if (count($this->_subs) && count($videoMappings)) { //get main Library $viewer = Engine_Api::_()->user()->getViewer(); $mainLibrary = $viewer->getMainLibrary(); $arrValue = array(); $arrValue[0] = $view->translate('None'); $arrValue[$mainLibrary->getIdentity()] = $view->translate($mainLibrary->getTitle()); foreach ($this->_subs as $sub) { if ($sub->isSelf($this->_library)) { continue; } $arrValue[$sub->getIdentity()] = $view->translate($sub->getTitle()); } $this->addElement('Select', 'move_to', array('label' => 'Move to Library?', 'description' => 'If you delete this library, all existing content will be moved to another one.', 'multiOptions' => $arrValue)); } $this->addElement('Button', 'submit_button', array('value' => 'submit_button', 'label' => 'Delete', 'onclick' => 'removeSubmit()', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper'))); $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => '', 'onclick' => 'parent.Smoothbox.close();', 'decorators' => array('ViewHelper'))); $this->addDisplayGroup(array('submit_button', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper'))); }
/** * Callback to check extra-parameters. * * @internal The availability will be ckecked just before import. * * @param string $value The value to check. * @return boolean */ public static function validateUri($uri) { if (empty($uri)) { return false; } $scheme = parse_url($uri, PHP_URL_SCHEME); // The check is done via the server for external urls. if (in_array($scheme, array('http', 'https', 'ftp', 'sftp'))) { return Zend_Uri::check($uri); } // Unknown or unmanaged scheme. if ($scheme != 'file' && $uri[0] != '/') { return false; } // Check the security setting. $settings = Zend_Registry::get('archive_folder'); if ($settings->local_folders->allow != '1') { return false; } // Check the base path. $basepath = $settings->local_folders->base_path; $realpath = realpath($basepath); if ($basepath !== $realpath || strlen($realpath) <= 2) { return false; } // Check the uri. if ($settings->local_folders->check_realpath == '1') { if (strpos(realpath($uri), $realpath) !== 0 || !in_array(substr($uri, strlen($realpath), 1), array('', '/'))) { return false; } } // The uri is allowed. return true; }
public function __construct($messageId = null) { $container = \Zend_Registry::get('container'); $repository = $container->getService('em')->getRepository('Newscoop\\Entity\\Comment'); if (is_null($messageId)) { $this->m_dbObject = $repository->getPrototype(); } else { $this->m_dbObject = $repository->find($messageId); } $this->m_properties = self::$m_baseProperties; $this->m_customProperties['level'] = 'getThreadDepth'; $this->m_customProperties['identifier'] = 'getId'; $this->m_customProperties['subject'] = 'getSubject'; $this->m_customProperties['content'] = 'getMessage'; $this->m_customProperties['content_real'] = 'getMessage'; $this->m_customProperties['nickname'] = 'getCommenter'; $this->m_customProperties['reader_email'] = 'getEmail'; $this->m_customProperties['real_name'] = 'getRealName'; $this->m_customProperties['anonymous_author'] = 'isAuthorAnonymous'; $this->m_customProperties['submit_date'] = 'getSubmitDate'; $this->m_customProperties['article'] = 'getArticle'; $this->m_customProperties['defined'] = 'defined'; $this->m_customProperties['user'] = '******'; $this->m_customProperties['source'] = 'getSource'; $this->m_customProperties['parent'] = 'getParent'; $this->m_customProperties['has_parent'] = 'hasParent'; $this->m_customProperties['thread_level'] = 'threadLevel'; $this->m_customProperties['status'] = 'getStatus'; $this->m_skipFilter = array('content_real'); }
public function preDispatch(Zend_Controller_Request_Abstract $request) { $auth = Zend_Auth::getInstance(); $isAllowed = false; $controller = $request->getControllerName(); $action = $request->getActionName(); // Generate the resource name $resourceName = $controller . '/' . $action; // Don't block errors if ($resourceName == 'error/error') { return; } $resources = $this->acl->getResources(); if (!in_array($resourceName, $resources)) { $request->setControllerName('error')->setActionName('error')->setDispatched(true); throw new Zend_Controller_Action_Exception('This page does not exist', 404); return; } // Check if user can access this resource or not $isAllowed = $this->acl->isAllowed(Zend_Registry::get('role'), $resourceName); // Forward user to access denied or login page if this is guest if (!$isAllowed) { if (!Zend_Auth::getInstance()->hasIdentity()) { $forwardAction = 'login'; } else { $forwardAction = 'deny'; } $request->setControllerName('index')->setActionName($forwardAction)->setDispatched(true); } }
public function getLogger() { if (is_null($this->_logger)) { $this->_logger = Zend_Registry::get('Zend_Log'); } return $this->_logger; }
public function init($styles = array()) { // Init messages $this->view->message = array(); $this->view->infoMessage = array(); $this->view->errorMessage = array(); $this->messenger = new Zend_Controller_Action_Helper_FlashMessenger(); $this->messenger->setNamespace('messages'); $this->_helper->addHelper($this->messenger); $this->errorMessenger = new Zend_Controller_Action_Helper_FlashMessenger(); $this->errorMessenger->setNamespace('errorMessages'); $this->_helper->addHelper($this->errorMessenger); $this->infoMessenger = new Zend_Controller_Action_Helper_FlashMessenger(); $this->infoMessenger->setNamespace('infoMessages'); $this->_helper->addHelper($this->infoMessenger); // Setup breadcrumbs $this->view->breadcrumbs = $this->buildBreadcrumbs($this->getRequest()->getRequestUri()); $this->view->user = Zend_Auth::getInstance()->getIdentity(); // Set the menu active element $uri = $this->getRequest()->getPathInfo(); if (strrpos($uri, '/') === strlen($uri) - 1) { $uri = substr($uri, 0, -1); } if (!is_null($this->view->navigation()->findByUri($uri))) { $this->view->navigation()->findByUri($uri)->active = true; } $this->view->styleSheets = array_merge(array('css/styles.css'), $styles); $translate = Zend_Registry::get('tr'); $this->view->tr = $translate; $this->view->setEscape(array('Lupin_Security', 'escape')); }
public function init() { $this->setMethod('post'); // Set Decorators $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'dl', 'class' => 'form')), 'Form')); // Add Elements $this->addElement('text', 'name', array('label' => 'Your name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(3)), array('Regex', false, array('/^\\pL[\\pL\\pN]*(?:[ .\\-_\']\\pL[\\pL\\pN]*)*$/uD'))), 'description' => 'Please enter your name - this will be displayed next to your comment')); $this->addElement('text', 'email', array('label' => 'Your Email', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('emailaddress')), 'description' => 'Your Email will not be shared with anyone or displayed to other users')); $this->addElement('textarea', 'comment', array('label' => 'Comment', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(10))), 'rows' => 12)); $captchaConfig = Zend_Registry::get('config')->captcha; if ($captchaConfig) { $captchaOptions = $captchaConfig->options->toArray(); if ($captchaConfig->type == 'recaptcha') { $reCaptcha = new Zend_Service_ReCaptcha($captchaConfig->service->publickey, $captchaConfig->service->privatekey); $captchaOptions['service'] = $reCaptcha; } $this->addElement('captcha', 'challenge', array('captcha' => $captchaConfig->type, 'captchaOptions' => $captchaOptions, 'label' => 'Are you human?', 'description' => 'Please verify that you are a real person by typing in the two words above')); } // $book = new Zend_Form_Element('hidden', 'book'); // $book->clearDecorators(); // $this->addElement($book); // // $page = new Zend_Form_Element('hidden', 'page'); // $page->clearDecorators(); // $this->addElement($page); $this->addElement('submit', 'submit', array('label' => 'Send Comment')); }
public function init() { $languageFile = Zend_Registry::get('languageFile'); $translate = new Zend_Translate('array', $languageFile, 'zh_CN'); $this->setTranslator($translate); $this->setMethod('POST'); $this->setName('contactForm'); $element = new Zend_Form_Element_Text('name'); $element->setLabel('怎么称呼您'); $this->addElement($element); $element = new Zend_Form_Element_Text('email'); $element->setLabel('您的Email'); //$element->setRequired(true); $this->addElement($element); $element = new Elements(); $element->addReCaptcha($this); $this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection'); $this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Textarea('body'); $element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍'); $element->addPrefixPath('My_Validator', 'My/Validator/', 'validate'); $element->addValidator('FormValueNotNull', true); //$element->setRequired(true); $element->setAttrib('rows', 13); $this->addElement($element); $this->addDisplayGroup(array('body'), 'rightSection'); $this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper'); $element = new Zend_Form_Element_Submit('post'); $element->removeDecorator('Label'); $this->addElement($element); }
public function init() { $em = EntityManager::getInstance(); $element = $this->createElement("text", "street"); $element->setRequired()->addValidator(new Zend_Validate_StringLength(array("max" => 255)))->addFilter(new Zend_Filter_StringTrim())->setLabel("Ulica")->setValue($this->getModel()->street); $this->addElement($element); $element = $this->createElement("text", "house_number"); $element->setRequired()->addFilter(new Zend_Filter_StringTrim())->setLabel("Nr domu")->setValue($this->getModel()->houseNumber); $this->addElement($element); $element = $this->createElement("text", "flat_number"); $element->addFilter(new Zend_Filter_StringTrim())->setLabel("Nr mieszkania")->setValue($this->getModel()->flatNumber); $this->addElement($element); $element = $this->createElement("text", "city"); $element->setRequired()->addValidator(new Zend_Validate_StringLength(array("max" => 255)))->addFilter(new Zend_Filter_StringTrim())->setLabel("Miasto")->setValue($this->getModel()->city); $this->addElement($element); $element = $this->createElement("text", "postcode"); $element->setRequired()->addValidator(new Zend_Validate_PostCode(Zend_Registry::get(\Application\Registry\Registry::LOCALE)))->addFilter(new Zend_Filter_StringTrim())->setLabel("Kod pocztowy")->setValue($this->getModel()->postcode); $this->addElement($element); $states = $em->findAll("State"); $element = $this->createElement("select", "state"); $element->setRequired()->addValidator(new Zend_Validate_Int())->addFilter(new Zend_Filter_Null())->setLabel("Województwo")->setValue($this->getModel()->state->getIdentifier())->setMultiOptions($this->getMultiOptions($states, "name")); $this->addElement($element); $element = $this->createElement("select", "address_type"); $element->setRequired()->setMultiOptions(array(\Model\EmployeeAddress::BILLING_ADDRESS => "do płatności", \Model\EmployeeAddress::SHIPPING_ADDRESS => "do wysyłki"))->setLabel("Typ adresu")->setValue($this->getModel()->type); $this->addElement($element); }
/** * List of subscriptions */ public function indexAction() { $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table(); $this->view->subscriptionPlan = $subscriptionPlansTable->fetchAll(); //Get user $identity = Zend_Auth::getInstance()->getIdentity(); if ($identity) { $userId = $identity->id; //Get current subscription $subscriptionManager = new Subscriptions_Model_Subscription_Manager(); $currentSubscription = $subscriptionManager->getCurrentSubscription($userId); if ($currentSubscription) { $subscriptionPlansTable = new Subscriptions_Model_SubscriptionPlans_Table(); $currentSubscriptionPlan = $subscriptionPlansTable->getById($currentSubscription->subscriptionPlanId); $paypalHost = false; if (Zend_Registry::isRegistered('payments')) { $payments = Zend_Registry::get('payments'); if (isset($payments['gateways']) && $payments['gateways'] && isset($payments['gateways']['paypal']) && $payments['gateways']['paypal']) { $paypalHost = $payments['gateways']['paypal']['paypalHost']; } } if (!$paypalHost) { if (Zend_Registry::isRegistered('Log')) { $log = Zend_Registry::get('Log'); $log->log("PayPal is not configured.", Zend_Log::CRIT); } throw new Exception($this->__("Paypal is not configured.")); } $this->view->paypalHost = $paypalHost; $this->view->currentSubscription = $currentSubscription; $this->view->currentSubscriptionPlan = $currentSubscriptionPlan; } } }
public function send($encodedJob, array $metadata) { $job = Zend_Registry::get('job_factory')->from($encodedJob); $job->perform(); // Return the job for test purposes. return $job; }
public function init() { $bootstrap = $this->getBootstrap(); $bootstrap->bootstrap('FrontController'); $bootstrap->bootstrap('View'); $bootstrap->bootstrap('Layout'); $front = $bootstrap->getResource('FronController'); Zend_Controller_Action_HelperBroker::addPrefix('Bc_Controller_Action_Helper'); $bootstrap->bootstrap('Doctrine'); $manager = Zend_Registry::get('db_manager'); $options = $this->getOptions(); if (!isset($options[self::OPTION_PLUGINS_PATH])) { throw new Exception('Bad Config! pluginsPath shoud be setted'); } $pluginManager = Bc_Application_Plugin_Manager::getInstance(); $pluginManager->setPluginsPath($options[self::OPTION_PLUGINS_PATH]); $pluginManager->initializePlugins(); if (!isset($options[self::OPTION_THEMES_PATH])) { throw new Exception('Bad Config! themesPath shoud be setted'); } $themesManager = Bc_Application_Theme_Manager::getInstance(); $themesManager->setThemesPath($options[self::OPTION_THEMES_PATH]); $themesManager->setView($bootstrap->getResource('View')); $themesManager->setActiveThemeName('minimal'); $themesManager->setLayout($bootstrap->getResource('Layout')); $themesManager->initializeTheme(); }
function check($user, $passwd) { $db = Zend_Registry::get('connectDb'); $select = $db->select()->from(array('ue' => 'user'), array('id', 'user_name'))->where('ue.user_name = ?', $user)->where('ue.password = ?', $passwd)->where('ue.activi = ?', 1); $result = $db->fetchAll($select); return $result; }
/** Set up the ACL and contexts * @access public * @return void */ public function init() { $this->_helper->_acl->allow('public', array('forgotten', 'register', 'activate', 'index', 'logout', 'edit', 'forgotusername', 'success', 'resetpassword')); $this->_helper->_acl->allow('member', null); $this->_auth = Zend_Registry::get('auth'); $this->_users = new Users(); }
/** * Get logger * * @return Zend_Log */ public function getLogger() { if (null === $this->logger) { $this->setLogger(Zend_Registry::get('logger')); } return $this->logger; }
/** * Fetch class students from core server. * * @param Acad_Model_Class $class * @param string $group that belongs to class. * @throws Zend_Exception * @return array class students. */ public static function fetchSemesterStudents(Acad_Model_Class $class, $group) { $department = $class->getDepartment(); $degree = $class->getDegree(); $semester = $class->getSemester(); $cacheManager = Zend_Registry::get('cacheManager'); $cache = $cacheManager->getCache('remote'); if (isset($group)) { $stuCache = strtolower($department . $degree . $semester . $group); } else { $stuCache = strtolower($department . $degree . $semester); } $students = $cache->load($stuCache); // see if a cache already exists: if ($students === false) { $semesterStuURL = 'http://' . CORE_SERVER . '/semester/getstudents'; $client = new Zend_Http_Client($semesterStuURL); $client->setCookie('PHPSESSID', $_COOKIE['PHPSESSID'])->setParameterGet('department_id', $department)->setParameterGet('degree_id', $degree)->setParameterGet('semester_id', $semester); if (isset($group)) { $client->setParameterGet('group_id', $group); } $response = $client->request(); if ($response->isError()) { $remoteErr = 'REMOTE ERROR: (' . $response->getStatus() . ') ' . $response->getMessage(); throw new Zend_Exception($remoteErr, Zend_Log::ERR); } else { $jsonContent = $response->getBody(); $students = Zend_Json_Decoder::decode($jsonContent); $cache->save($students, $stuCache); } } return $students; }
/** * Enter description here... * */ public function createAction() { $this->requirePost(); $form = $this->getNewResidentForm(); if ($form->isValid($_POST)) { if (!Table_Residents::getInstance()->residentExists($form->getValue('email'))) { $data = $form->getValues(); $password = rand(10000, 9999999); $data['password_hash'] = md5($password); unset($data['aufnehmen']); $newResident = Table_Residents::getInstance()->createRow($data); if ($newResident && $newResident->save()) { $websiteUrl = Zend_Registry::get('configuration')->basepath; $mailText = "Du wurdest in die WG aufgenommen.\n\t\t\t\t\tDu kannst dich nun unter {$websiteUrl}/session/new anmelden.\n\n\t\t\t\t\tDeine Zugangsdaten:\n\n\t\t\t\t\tEmail Addresse = {$newResident->email}\n\t\t\t\t\tPassword = {$password}"; $mail = new Zend_Mail(); $mail->addTo($newResident->email)->setSubject("Du wurdest in der WG aufgenomme!")->setBodyText($mailText); $mail->send(); $this->flash('Der Bewohner mit der Email Addresse ' . $newResident->email . ' wurde erfolgreich eingetragen.'); $this->flash('Ein generiertes Passwort wurde per Email zugeschickt.'); $this->redirect('index'); } else { $this->flash('Es trat ein Fehler beim speichern des neuen Bewohners auf.'); $this->redirect('new'); } } else { $this->flash('Ein Bewohner mit der Emailaddresse ' . $form->getValue('email') . ' existiert bereits.'); $this->redirect('new'); } } else { $this->redirect('new'); } }
public function work(Pheanstalk_Job $pJob) { try { $omekaJob = $this->_jobFactory->from($pJob->getData()); if (!$omekaJob) { throw new UnexpectedValueException("Job factory returned null (should never happen)."); } if ($omekaJob instanceof Omeka_Job_AbstractJob) { $user = $omekaJob->getUser(); if ($user) { Zend_Registry::get('bootstrap')->getContainer()->currentuser = $user; } } $omekaJob->perform(); $this->_pheanstalk->delete($pJob); } catch (Zend_Db_Exception $e) { // Bury any jobs with database problems aside from stale // connections, which should indicate to try the job a second time. if (strpos($e->getMessage(), 'MySQL server has gone away') === false) { $this->_pheanstalk->bury($pJob); } else { $this->_pheanstalk->release($pJob); } throw $e; } catch (Omeka_Job_Worker_InterruptException $e) { $this->_interrupt($omekaJob); $this->_pheanstalk->release($pJob); throw $e; } catch (Exception $e) { $this->_pheanstalk->bury($pJob); throw $e; } }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { $this->_view = Zend_Registry::get('view'); $currentUrl = $this->_view->currentUrl('currentUrl'); $model = new Modules_Seo_Model_Seo(); $this->_data = $model->findByUrl($currentUrl); }
/** * Initialize controller * * @return void */ function init() { $this->db = Zend_Registry::get('db'); $this->logger = Zend_Registry::get('logger'); $this->config = Zend_Registry::get('config'); $this->viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); }
public function init() { $categories = Axis::single('catalog/category')->select('*')->addName(Axis_Locale::getLanguageId())->addKeyWord()->order('cc.lft')->addSiteFilter(Axis::getSiteId())->addDisabledFilter()->fetchAll(); if (!is_array($this->_activeCategories)) { $this->_activeCategories = array(); if (Zend_Registry::isRegistered('catalog/current_category')) { $this->_activeCategories = array_keys(Zend_Registry::get('catalog/current_category')->cache()->getParentItems()); } } $container = $_container = new Zend_Navigation(); $lvl = 0; $view = $this->getView(); foreach ($categories as $_category) { $uri = $view->hurl(array('cat' => array('value' => $_category['id'], 'seo' => $_category['key_word']), 'controller' => 'catalog', 'action' => 'view'), false, true); $class = 'nav-' . str_replace('.', '-', $_category['key_word']); $page = new Zend_Navigation_Page_Uri(array('label' => $_category['name'], 'title' => $_category['name'], 'uri' => $uri, 'order' => $_category['lft'], 'class' => $class, 'visible' => 'enabled' === $_category['status'] ? true : false, 'active' => in_array($_category['id'], $this->_activeCategories))); $lvl = $lvl - $_category['lvl'] + 1; for ($i = 0; $i < $lvl; $i++) { $_container = $_container->getParent(); } $lvl = $_category['lvl']; $_container->addPage($page); $_container = $page; } $this->setData('menu', $container); return true; }
/** * Creates the PSR-6 cache pool based on the application.ini config * and sets it in the Zend_Registry * * @throws Zend_Exception */ public function init() { /** @var Zend_Config $config */ $config = Zend_Registry::get('config'); if (!$config instanceof Zend_Config) { throw new Exception(Factory::EXCEPTION_CONFIG_AND_CONFIG_FILE_NOT_SET); } try { $config = $config->resources->CachePool; } catch (Exception $e) { throw new Exception(Factory::EXCEPTION_CONFIG_AND_CONFIG_FILE_NOT_SET); } $adapterIndex = Config::INDEX_ADAPTER; $defaultAdapterIndex = Config::INDEX_DEFAULT_ADAPTER; /** @var array $config */ $config = $config->toArray(); if (empty($config[$adapterIndex]) || !is_array($config[$adapterIndex])) { throw new Exception(Factory::EXCEPTION_BAD_CONFIG); } $defaultAdapter = !empty($config[$defaultAdapterIndex]) ? $config[$defaultAdapterIndex] : null; $cachePoolFactory = new Factory(); $adaptersConfig = $config[$adapterIndex]; foreach ($adaptersConfig as $adapterName => $config) { $cachePoolConfig = array(Config::INDEX_CACHE => array($adapterIndex => array($adapterName => $config))); $cachePoolFactory->setConfig($cachePoolConfig); $cachePool = $cachePoolFactory->makeTaggable($adapterName); Zend_Registry::set($adapterName, $cachePool); if ($adapterName === $defaultAdapter) { Zend_Registry::set($defaultAdapterIndex, $cachePool); } } }
public function setLink($link) { $db = Zend_Registry::get('database'); $sql = "UPDATE `scrnshots_data` SET `link`=:link " . "WHERE source_id = :source_id AND id = :item_id "; $data = array("source_id" => $this->getSource(), "item_id" => $this->getID(), "link" => $link); return $db->query($sql, $data); }
/** * Возвращает объект-хранилище данных по авторизации * * @return Zend_Auth_Storage_Interface */ public function getStorage() { if (true == Zend_Registry::get('config')->Access->cookie && Zend_Controller_Front::getInstance()->getRequest()->getParam('use_cookie')) { $this->setStorage(new Modules_Access_Framework_Auth_Storage_Cookie()); } return parent::getStorage(); }
public function postAction() { $email = $this->_request->getParam('email'); $response = $this->_helper->response(); if (Kebab_Validation_Email::isValid($email)) { // Create user object $user = Doctrine_Core::getTable('Model_Entity_User')->findOneBy('email', $email); $password = Kebab_Security::createPassword(); if ($user !== false) { $user->password = md5($password); $user->save(); $configParam = Zend_Registry::get('config')->kebab->mail; $smtpServer = $configParam->smtpServer; $config = $configParam->config->toArray(); // Mail phtml $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/views/mails/'); $view->assign('password', $password); $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config); $mail = new Zend_Mail('UTF-8'); $mail->setFrom($configParam->from, 'Kebab Project'); $mail->addTo($user->email, $user->fullName); $mail->setSubject('Reset Password'); $mail->setBodyHtml($view->render('forgot-password.phtml')); $mail->send($transport); $response->setSuccess(true)->getResponse(); } else { $response->addNotification(Kebab_Notification::ERR, 'There isn\'t user with this email')->getResponse(); } } else { $response->addError('email', 'Invalid email format')->getResponse(); } }
public function workflowListAction() { /*--search---*/ $search = trim($this->_getParam('search')); /*---sorting ----*/ $order = trim($this->_getParam('order', "")); $col = trim($this->_getParam('col', "")); if ($order != "" && $col != "") { $strOrderBy = "w.{$col} {$order}"; } else { $strOrderBy = "w.workflow_name asc"; } $this->view->sortOptions = array(); /*-----sorting----------*/ $where = "w.id<>'-2147483648' and w.is_deleted<>1"; $this->view->linkArray = array(); $this->view->search = ""; if ($search != "") { $where = "w.workflow_name like '%{$search}%' and {$where} "; $this->view->linkArray = array('search' => $search); $this->view->search = $search; $this->view->sortOptions['search'] = $search; } $model = new Security_Model_User(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("w" => 'workflow_master'), array("id", "workflow_name", "row_guid", "is_deleted"))->order($strOrderBy)->where($where); //echo $sql = $select->__toString(); exit; $page_size = Zend_Registry::get('page_size'); $page = $this->_getParam('page', 1); $paginator = Base_Paginator::factory($select); $paginator->setItemCountPerPage($page_size); $paginator->setCurrentPageNumber($page); $this->view->totalItems = $paginator->getTotalItemCount(); $this->view->paginator = $paginator; }
/** */ public function init() { $translator = \Zend_Registry::get('container')->getService('translator'); $this->addElement('hash', 'csrf'); $this->addElement('text', 'title', array('label' => $translator->trans('Title', array(), 'api'), 'required' => TRUE, 'filters' => array('stringTrim'))); $this->addElement('submit', 'submit', array('label' => $translator->trans('Create', array(), 'home'), 'ignore' => true)); }
/** * */ public function init() { $this->_mapper = new Report_Model_Mapper_Sms(); $this->_config = Zend_Registry::get('config'); $stepBreadCrumb = array('label' => 'Sms', 'url' => '/report/sms/campaign'); $this->view->breadcrumb()->addStep($stepBreadCrumb); }
public function processAction() { $authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('dbAdapter')); $authAdapter->setTableName('user')->setIdentityColumn('username')->setCredentialColumn('password')->setIdentity($_POST['username'])->setCredential($_POST['password']); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); $data = array(); if ($result->isValid()) { unset($this->_session->messages); $identity = $auth->getIdentity(); $user = new User(); $user->username = $identity; $user->populateWithUsername(); Zend_Auth::getInstance()->getStorage()->write($user); //$this->_redirect('login/complete'); //$this->_forward('index','main'); $data['msg'] = __("Login successful."); $data['code'] = 200; } else { $auth->clearIdentity(); $this->_session->messages = $result->getMessages(); //$this->_redirect('login'); $data['err'] = __("Invalid username/password."); $data['code'] = 404; } header('Content-Type: application/xml;'); $this->view->data = $data; $this->completeAction(); //$this->render(); }