コード例 #1
0
ファイル: Create.php プロジェクト: hoalangoc/ftf
 public function init()
 {
     $this->setTitle('Reply')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'post', 'controller' => 'topic'), 'event_extended', true));
     $viewer = Engine_Api::_()->user()->getViewer();
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $allowHtml = (bool) $settings->getSetting('event_html', 0);
     $allowBbcode = (bool) $settings->getSetting('event_bbcode', 0);
     if (!$allowHtml) {
         $filter = new Engine_Filter_HtmlSpecialChars();
     } else {
         $filter = new Engine_Filter_Html();
         $filter->setForbiddenTags();
         $allowed_tags = array_map('trim', explode(',', Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'event', 'commentHtml')));
         $filter->setAllowedTags($allowed_tags);
     }
     if ($allowHtml || $allowBbcode) {
         $upload_url = "";
         if (Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')) {
             $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'upload-photo'), 'event_photo', true);
         }
         $editorOptions = array('upload_url' => $upload_url, 'bbcode' => $settings->getSetting('forum_bbcode', 0), 'html' => $settings->getSetting('forum_html', 0));
         if (!empty($upload_url)) {
             $editorOptions['plugins'] = array('table', 'fullscreen', 'media', 'preview', 'paste', 'code', 'image', 'textcolor', 'jbimages', 'link');
             $editorOptions['toolbar1'] = array('undo', 'redo', 'removeformat', 'pastetext', '|', 'code', 'media', 'image', 'jbimages', 'link', 'fullscreen', 'preview');
         }
         $this->addElement('TinyMce', 'body', array('disableLoadDefaultDecorators' => true, 'editorOptions' => $editorOptions, 'required' => true, 'allowEmpty' => false, 'decorators' => array('ViewHelper'), 'filters' => array($filter, new Engine_Filter_Censor())));
     } else {
         $this->addElement('Textarea', 'body', array('label' => 'Body', 'allowEmpty' => false, 'required' => true, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor())));
     }
     $this->addElement('Checkbox', 'watch', array('label' => 'Send me notifications when other members reply to this topic.', 'value' => '1'));
     $this->addElement('Button', 'submit', array('label' => 'Post Reply', 'ignore' => true, 'type' => 'submit'));
     $this->addElement('Hidden', 'topic_id', array('order' => '920', 'filters' => array('Int')));
     $this->addElement('Hidden', 'ref');
 }
コード例 #2
0
 /**
  * Principal function to build the language navigation
  *
  * 1- Get all links of the current page into other languages than the current one
  * 2- If no links to other language for the current page, show links to the home page
  * 3- Return the result to the main view
  *
  * @author     Alexandre Beaudet <*****@*****.**>
  */
 public function navigationLanguage()
 {
     $_baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     // get all links to the current page in another language
     $Pages = new PagesIndex();
     $Select = $Pages->select()->setIntegrityCheck(false);
     $Select->from('PagesIndex');
     $Select->join('Languages', 'Languages.L_ID = PagesIndex.PI_LanguageID');
     $Select->where('PagesIndex.PI_LanguageID <> ?', Zend_Registry::get("languageID"));
     $Select->where('PagesIndex.PI_PageID = ?', Zend_Registry::get("pageID"));
     $Select->where('PagesIndex.PI_Status = ?', 'en ligne');
     $Select->order('Languages.L_Title ASC');
     $Rows = $Pages->fetchAll($Select);
     // build the language navigation to display
     $navigationlangue = "<ul class='navigationlanguage'>";
     if ($Rows->count() > 0) {
         foreach ($Rows as $Row) {
             $navigationlangue .= "<li><a href='" . $baseUrl . "/" . $Row['PI_PageIndex'] . "'>" . $Row['L_Title'] . "</a></li>";
         }
     } else {
         // get all links to the home page in another language
         $Languages = Zend_Registry::get("db");
         $Select = $Languages->select()->from('Languages')->join('PagesIndex', 'PagesIndex.PI_LanguageID = Languages.L_ID')->where('Languages.L_ID <> ?', Zend_Registry::get("languageID"))->where('PagesIndex.PI_PageID = ?', '0')->where('PagesIndex.PI_Status = ?', 'en ligne')->order('Languages.L_Title');
         $Rows = $Languages->fetchAll($Select);
         foreach ($Rows as $Row) {
             $navigationlangue .= "<li><a href='" . $_baseUrl . "/" . $Row['PI_PageIndex'] . "'>" . $Row['L_Title'] . "</a></li>";
         }
     }
     $navigationlangue .= "</ul>";
     return $navigationlangue;
 }
コード例 #3
0
 public function setUp()
 {
     $this->_controller = Zend_Controller_Front::getInstance();
     $this->_controller->resetInstance();
     $this->_controller->setControllerDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files')->setParam('noErrorHandler', true)->setParam('noViewRenderer', true)->returnResponse(true)->throwExceptions(false);
     Zend_Controller_Action_HelperBroker::resetHelpers();
 }
コード例 #4
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'emailcontacts');
     $this->setAttrib('action', BASE_URL . 'emailcontacts/add/');
     $id = new Zend_Form_Element_Hidden('id');
     $group_id = new Zend_Form_Element_Select("group_id");
     $group_id->setRegisterInArrayValidator(false);
     $group_id->setRequired(true);
     $group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.'));
     $business_unit_id = new Zend_Form_Element_Select("business_unit_id");
     $business_unit_id->setRegisterInArrayValidator(false);
     $business_unit_id->setRequired(true);
     $business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
     $business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');");
     //Group Email....
     $grpEmail = new Zend_Form_Element_Text('groupEmail');
     $grpEmail->addFilters(array('StringTrim', 'StripTags'));
     $grpEmail->setRequired(true);
     $grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.'));
     $grpEmail->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
     $grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.');
     // Form Submit .........
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #5
0
 public function getComments($options = array(), $record_id = null, $record_type = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $params = $request->getParams();
     if (!$record_id) {
         $record_id = $this->_getRecordId($params);
     }
     if (!$record_type) {
         $record_type = $this->_getRecordType($params);
     }
     $db = get_db();
     $commentTable = $db->getTable('Comment');
     $searchParams = array('record_type' => $record_type, 'record_id' => $record_id);
     if (isset($options['approved'])) {
         $searchParams['approved'] = $options['approved'];
     }
     if (!is_allowed('Commenting_Comment', 'update-approved')) {
         $searchParams['flagged'] = 0;
         $searchParams['is_spam'] = 0;
     }
     $select = $commentTable->getSelectForFindBy($searchParams);
     if (isset($options['order'])) {
         $select->order("ORDER BY added " . $options['order']);
     }
     return $commentTable->fetchObjects($select);
 }
コード例 #6
0
ファイル: LdapLogin.php プロジェクト: knatorski/SMS
 public function isValid($value)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $fields = $request->getParams();
     $config = Zend_Registry::get('config');
     $servers = $config['ldap'];
     $valid = false;
     foreach ($servers as $server) {
         try {
             $ldap = new Zend_Ldap($server);
             $ldap->bind($fields['ldapUser'], $fields['ldapPassword']);
             $ldapEntry = $ldap->searchEntries(Zend_Ldap_Filter::equals('samaccountname', $value));
             if (!empty($ldapEntry)) {
                 $valid |= true;
             }
         } catch (Exception $e) {
             $valid |= false;
         }
     }
     if (!$valid) {
         $this->_error(self::NOT_EXISTS);
         return false;
     }
     return true;
 }
コード例 #7
0
ファイル: GetDadosUsuario.php プロジェクト: powman/zfpadrao
 /**
  * Helper para pegar as imagens do webservice
  *
  */
 public function GetDadosUsuario()
 {
     $auth = Zend_Auth::getInstance();
     $db = Zend_Db_Table::getDefaultAdapter();
     $chAction = strtolower(Zend_Controller_Front::getInstance()->getRequest()->getActionName());
     $chController = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $sql = 'select ';
     $sql .= '	u.*, ';
     $sql .= '	a.nm_avatar, ';
     $sql .= '	a.tp_avatar, ';
     $sql .= '	a.sz_avatar, ';
     $sql .= '	a.arquivo ';
     $sql .= 'from ';
     $sql .= '	sca_usuario u ';
     $sql .= '	left join sgg_avatar a on a.id_avatar = u.id_avatar ';
     $sql .= 'where u.st_usuario = 1 ';
     $sql .= 'and u.id_usuario = ' . $auth->getIdentity()->id_usuario;
     $result = $db->fetchRow($sql);
     if ($result) {
         if ($result['arquivo']) {
             $result['arquivo'] = "data:" . $result['tp_avatar'] . ";base64," . base64_encode($result['arquivo']);
         }
     }
     return $result;
 }
コード例 #8
0
 public function authenticate($type, $role, $module, $controller, $action)
 {
     // escape error handler
     $front = Zend_Controller_Front::getInstance();
     $params = array($type, $role, $module, $controller, $action);
     $count = count($params);
     $plugins = new Base_Php_Overloader($front->getParam("bootstrap")->getOption('plugins'));
     $errorModule = $plugins->errorHandler->params->module;
     $errorController = $plugins->errorHandler->params->controller;
     $errorAction = $plugins->errorHandler->params->action;
     $redirecting = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     /*
      * the conditions are for to be passed or redirected, default is passed
      * array(typeCondition, roleCondition, moduleCondition, controllerCondition, actionCondition, redirectOrNot, url)
      * order by typeCondition ASC, roleCondition ASC, moduleCondition ASC, controllerCondition ASC, actionCondition ASC
      */
     $permission = array(array(null, null, $errorModule, $errorController, $errorAction, FALSE, null), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', 'index', 'login', false, null), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', 'index', 'logout', true, '/admin/index/login'), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', null, null, true, '/admin/index/login'), array(Auth_Constant_Server::ADMIN_TYPE, null, 'admin', 'index', 'login', true, '/admin'), array(null, null, 'home', null, null, false, null));
     foreach ($permission as $permission) {
         for ($i = 0; $i <= 4; $i++) {
             if (isset($permission[$i]) && $params[$i] != $permission[$i]) {
                 continue 2;
             }
         }
         if ($permission[5] == true) {
             $redirecting->gotoUrl($permission[6])->redirectAndExit();
         }
         // if a rule is matched, not check remain rules
         return;
     }
 }
コード例 #9
0
ファイル: Action.php プロジェクト: padraic/framework-benchs
    /**
     * Constructor
     *
     * Grab local copies of various MVC objects
     *
     * @return void
     */
    public function __construct()
    {
        $front   = Zend_Controller_Front::getInstance();
        $modules = $front->getControllerDirectory();
        if (empty($modules)) {
            // require_once 'Zend/View/Exception.php';
            $e = new Zend_View_Exception('Action helper depends on valid front controller instance');
            $e->setView($this->view);
            throw $e;
        }

        $request  = $front->getRequest();
        $response = $front->getResponse();

        if (empty($request) || empty($response)) {
            // require_once 'Zend/View/Exception.php';
            $e = new Zend_View_Exception('Action view helper requires both a registered request and response object in the front controller instance');
            $e->setView($this->view);
            throw $e;
        }

        $this->request       = clone $request;
        $this->response      = clone $response;
        $this->dispatcher    = clone $front->getDispatcher();
        $this->defaultModule = $front->getDefaultModule();
    }
コード例 #10
0
ファイル: Admin.php プロジェクト: bokultis/kardiomedika
 /**
  * Check authorization
  */
 protected function _checkAuthorization()
 {
     $routeName = Zend_Controller_Front::getInstance()->getRouter()->hasRoute('admin') ? 'admin' : 'default';
     $lang = $this->_request->getParam('lang');
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         //if ajax request
         if ($this->getRequest()->isXmlHttpRequest()) {
             /*return $this->getHelper('json')->direct(array(
                   'success'   => false,
                   'message'   => $this->view->translate("Please login first")
               ));*/
             throw new Zend_Controller_Action_Exception("Please login first", 403);
         }
         //store to return
         $this->returnHere();
         //redirect to login page
         $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'login', 'module' => 'admin', 'lang' => $lang), $routeName, true));
     }
     $aclLoader = HCMS_Acl_Loader::getInstance();
     //check permission
     if (!$aclLoader->getAcl()->isAllowed($aclLoader->getCurrentRoleCode(), $this->_authResourse, $this->_authPrivilege)) {
         //redirect to login page
         $this->_redirect($this->view->url(array('module' => 'admin', 'controller' => 'index', 'action' => 'login', 'lang' => $lang), $routeName, true));
         throw new Zend_Controller_Action_Exception("You are not allowed to access this page", 403);
     }
 }
コード例 #11
0
ファイル: Filter.php プロジェクト: robeendey/ce
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levelMultiOptions = array(0 => ' ');
     /*      $table = $this->_helper->api()->getItemTable('user');
           $select = $viewer->membership()->getMembersSelect('user_id');
           $friends = $table->fetchAll($select);*/
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll();
     foreach ($levels as $row) {
         $levelMultiOptions[$row->level_id] = $row->getTitle();
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElements(array($username, $email, $level_id, $enabled, $submit));
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
 }
コード例 #12
0
ファイル: Auth.php プロジェクト: kytvi2p/ZettaFramework
 /**
  * Возвращает объект-хранилище данных по авторизации
  *
  * @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();
 }
コード例 #13
0
ファイル: LoggedInAs.php プロジェクト: r1zib/salesforce
    public function loggedInAs()
    {
        $auth = Zend_Auth::getInstance();
        if ($auth->hasIdentity()) {
            $user = $auth->getIdentity();
            if (!isset($user->username)) {
                $auth->clearIdentity();
                $info = 'logout';
                return $info;
            }
            $logoutUrl = $this->view->url(array('controller' => 'auth', 'action' => 'logout'), null, true);
            $url = $this->view->url(array('controller' => 'user', 'action' => 'edit', 'id' => $user->id));
            $info = '<div class ="menuButton"><span class="menu">' . $user->username . '</span>';
            $info .= '<ul> 
					<li><a href="' . $url . '">Mon profil</a></li>
					<li class="separator">​</li>
					<li><a href="' . $logoutUrl . '" class="logout">se déconnecter</a></li>
					</ul></div>';
            return $info;
        }
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $controller = $request->getControllerName();
        $action = $request->getActionName();
        if ($controller == 'auth' && $action == 'index') {
            return '';
        }
        $form = new Application_Form_Login();
        $loginUrl = $this->view->url(array('controller' => 'auth', 'action' => 'index'), null, true);
        $info = '<div class ="menuButton"><span class="menu"> Se connecter </span><ul><li class="form">' . $form->setAction($loginUrl) . '</li></ul></div>';
        return $info;
        //$loginUrl = $this->view->url(array('controller'=>'auth', 'action'=>'index'));
        //return '<a href="'.$loginUrl.'">Login</a>';
    }
コード例 #14
0
 public function loggedInAs()
 {
     $Auth = Zend_Auth::getInstance();
     $Ret = '';
     if ($Auth->hasIdentity()) {
         $Username = $Auth->getIdentity()->Nome . ' ' . $Auth->getIdentity()->Cognome;
         $Module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
         $LogoutURL = $this->view->url(array('controller' => 'login', 'action' => 'logout', 'module' => 'default'), 'default', true);
         $MessaggiURL = $this->view->url(array('controller' => 'messages', 'action' => 'index', 'module' => 'default'), 'default');
         $AdminURL = $this->view->url(array('controller' => 'index', 'action' => 'index', 'module' => $Module == 'admin' ? 'default' : 'admin'), 'default');
         #$Ret .= 'Welcome ' . $Username . ' ';
         $Ret .= '<a href="' . $MessaggiURL . '">' . $this->view->img('images/icons/mail_24x24.png', array('title' => 'Messages', 'alt' => 'Messages')) . '</a> ';
         $Ret .= '<a href="' . $AdminURL . '">' . $this->view->img('images/icons/' . ($Module == 'admin' ? 'magic_wand' : 'wrench') . '_24x24.png', array('title' => $Module == 'admin' ? 'Public' : 'Admin', 'alt' => $Module == 'admin' ? 'Public' : 'Admin')) . '</a> ';
         $Ret .= '<a href="' . $LogoutURL . '">' . $this->view->img('images/icons/lock_24x24.png', array('title' => 'Logout', 'alt' => 'Logout')) . '</a>';
         return $Ret;
     }
     $Request = Zend_Controller_Front::getInstance()->getRequest();
     $Controller = $Request->getControllerName();
     $Action = $Request->getActionName();
     if ($Controller == 'login' && $Action == 'index') {
         return '';
     }
     $LoginURL = $this->view->url(array('controller' => 'login', 'action' => 'index'), 'default');
     $Ret .= '<a href="' . $LoginURL . '">' . $this->view->img('images/icons/unlock_24x24.png', array('title' => 'Login', 'alt' => 'Login')) . '</a>';
     return $Ret;
 }
コード例 #15
0
 /**
  * Return current db adapter.
  */
 protected function _getDbAdapter()
 {
     $front = Zend_Controller_Front::getInstance();
     $bootstrap = $front->getParam("bootstrap");
     $dbResource = $bootstrap->getPluginResource("db");
     return $dbResource->getDbAdapter();
 }
コード例 #16
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     Zend_Layout::getMvcInstance()->setLayout($request->getModuleName());
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/modules/" . $request->getModuleName() . "/layouts/scripts");
     $eh = Zend_Controller_Front::getInstance()->getPlugin("Zend_Controller_Plugin_ErrorHandler");
     $eh->setErrorHandlerModule($request->getModuleName());
 }
コード例 #17
0
ファイル: UrlTest.php プロジェクト: netvlies/zf
 /**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     $this->front = Zend_Controller_Front::getInstance();
     $this->front->resetInstance();
     $this->front->setRequest(new Zend_Controller_Request_Http());
     $this->helper = new Zend_Controller_Action_Helper_Url();
 }
コード例 #18
0
 public function printAction()
 {
     // desabilitando layout
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     if ($this->getRequest()->isPost()) {
         $arrDigitais = $this->getRequest()->getParam('nuEtiquetas', array());
         $arrDigitaisPrint = array();
         $arrDigitaisValidate = array();
         $withNUP = false;
         foreach ($arrDigitais as $key => $value) {
             $aux1 = explode(' - ', $value);
             $arrDigitaisValidate[$key] = trim($aux1[0]);
             if (count($aux1) > 1) {
                 if ($withNUP === false) {
                     $withNUP = true;
                 }
                 $arrDigitaisPrint[$key] = array('nuEtiqueta' => $arrDigitaisValidate[$key], 'nuNupSiorg' => preg_replace('/\\D+/', '', $aux1[1]));
             } else {
                 $arrDigitaisPrint[$key]['nuEtiqueta'] = $arrDigitaisValidate[$key];
             }
         }
         if ($this->getService()->isValidNuEtiqueta($arrDigitaisValidate)) {
             $etiquetaPdf = new Sgdoce_EtiquetaPdf();
             $textoEtiquetaKey = 'textoEtiqueta';
             if ($withNUP) {
                 $textoEtiquetaKey = 'textoEtiquetaComNup';
             }
             $textoEtiqueta = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption($textoEtiquetaKey);
             $etiquetaPdf->setTextoEtiqueta($textoEtiqueta)->setDigitais($arrDigitaisPrint)->setEtiquetaComNUP($withNUP)->generate();
         }
     }
     echo "Número da digital inválida.";
 }
コード例 #19
0
 public function init()
 {
     header('content-type: text/html; charset=utf8');
     defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());
     // clear all other sessions
     Application_Form_FrmSessionManager::clearSessionSearch();
 }
コード例 #20
0
ファイル: Exception.php プロジェクト: rdallasgray/bbx
 public function __construct($message = 'Server Error', $code = 400, $extra = null)
 {
     switch ($code) {
         case 401:
             if (null == $message) {
                 $message = 'Not Authorised';
             }
             break;
         case 403:
             if (null == $message) {
                 $message = 'Forbidden';
             }
             break;
         case 404:
             if (null == $message) {
                 $message = 'Not Found';
             }
             break;
         case 405:
             if (null == $message) {
                 $message = 'Method Not Allowed';
             }
             Zend_Controller_Front::getInstance()->getResponse()->setHeader('Allow', $extra['allowed_methods']);
             break;
     }
     parent::__construct($message, $code);
 }
コード例 #21
0
ファイル: Category.php プロジェクト: hoalangoc/ftf
 public function getHref($params = array())
 {
     $params = array_merge(array('route' => 'ynfeedback_general', 'controller' => 'index', 'action' => 'listing', 'category_id' => $this->getIdentity()), $params);
     $route = $params['route'];
     unset($params['route']);
     return Zend_Controller_Front::getInstance()->getRouter()->assemble($params, $route, true);
 }
コード例 #22
0
 public function init()
 {
     $auth = Zend_Auth::getInstance();
     $this->data_user = $auth->getIdentity();
     if (!$auth->hasIdentity()) {
         $this->redirect('/login');
     } else {
         $this->_acl_model = new Application_Model_Acl_Acl();
         if (!$this->_acl_model->isAllowed()) {
             $this->redirect('/error/forbidden');
         }
     }
     $this->view->user = $this->data_user;
     $this->view->model_user = new Application_Model_Usuarios();
     $this->view->model = new Application_Model_Clientes();
     $this->_modelUsers = new Application_Model_Usuarios();
     $config = Zend_Controller_Front::getInstance()->getParam('bootstrap');
     $this->_custom = $config->getOption('custom');
     // Acessando permissões
     $this->_acl = $config->getOption('acl');
     // Pegando array de configurações para a criação do menu
     $this->view->menu = $config->getOption('menu');
     $this->_FlashMessenger = $this->_helper->getHelper('FlashMessenger');
     $this->view->headTitle(strtoupper($this->getRequest()->getControllerName()) . ' | ' . $this->_custom['company_name']);
     $this->view->controllerName = $this->_controllerName = $this->getRequest()->getControllerName();
     $this->view->actionName = $this->_actionName = $this->getRequest()->getActionName();
     $this->view->user = $this->data_user;
     if ($this->data_user->childrens_ids) {
         $this->_ids = $this->data_user->childrens_ids;
         $this->_ids[] = CURRENT_USER_ID;
     } else {
         $this->_ids = array(CURRENT_USER_ID);
     }
     $this->view->date = new Zend_Date();
 }
コード例 #23
0
ファイル: Archiwum.php プロジェクト: hYOUstone/tsg
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     //$view = Zend_Layout::getMvcInstance()->getView();
     $url = $this->getView()->url(array('controller' => 'archiwum', 'action' => 'search'), 'default', TRUE);
     $this->setAction($url);
     $request = Zend_Controller_Front::getInstance()->getRequest();
     if ($request->isPost()) {
         $search = $request->getPost('search');
     } else {
         $search = "";
     }
     $this->addElement('text', 'search', array('label' => 'fraza', 'required' => true, 'size' => 58, 'value' => $search, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty', true)));
     $this->addElement('multiCheckbox', 'gdzie', array('label' => 'gdzie szukać:', 'multiOptions' => array('art' => 'Artykuły', 'wyw' => 'Wywiady', 'fel' => 'Felietowny', 'oko' => 'Trzecie oko', 'strona' => 'Pozostałe'), 'disableLoadDefaultDecorators' => true, 'separator' => '&nbsp;'));
     if ($request->isPost()) {
         $checked = array();
         foreach ($request->getPost('gdzie') as $value) {
             $checked[] = $value;
         }
     } else {
         $checked = array('art', 'wyw', 'fel', 'oko', 'strona');
     }
     $this->getElement("gdzie")->setValue($checked);
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'szukaj', 'value' => 'szukaj'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'id' => 'archiwum')), 'Form'));
     $this->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     /**/
     $this->getElement("submit")->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'align' => 'left')), array('Label', array('tag' => 'td', 'style' => 'visibility:hidden;')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
 }
コード例 #24
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     parent::routeStartup($request);
     /**
      * 
      * Отключение плагинов Evil_Acces && Evil_Auth 
      * для экономии запросов, при сливе любого трафика на определенные контроллеры
      * Например это нужно чтоб считать какуюнить левую анонимную статистику и не засирать бд
      * ну и для той цели которая нужна мне)
      * @author NuR
      */
     $config = Zend_Registry::get('config');
     $ingore = Evil_Array::get('evil.auth.ignoreControllers', $config);
     if (is_array($ingore)) {
         if (in_array($request->getControllerName(), $ingore)) {
             return null;
         }
     }
     $this->init();
     if (Zend_Controller_Front::getInstance()->getDispatcher()->isDispatchable($request)) {
         if ($this->denied($request->getParam('id'), $request->getControllerName(), $request->getActionName())) {
             /**
              * я считаю что так будет лучше
              * @author NuR
              */
             $this->_response->setRedirect('/');
             //	throw new Evil_Exception ( 'Access Denied for ' . $request->getControllerName () . '::' . $request->getActionName (), 403 );
         }
     } else {
         throw new Evil_Exception('Not found ' . $request->getControllerName() . '::' . $request->getActionName(), 404);
     }
 }
コード例 #25
0
ファイル: Categories.php プロジェクト: rajbrt/sentrifugo
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'pdcategories');
     $this->setAttrib('name', 'pdcategories');
     $categoryName = new Zend_Form_Element_Text('category');
     $categoryName->setAttrib('id', 'category');
     $categoryName->setAttrib('name', 'category');
     $categoryName->setAttrib('maxlength', '30');
     $categoryName->setAttrib('onblur', 'chkCategory()');
     $categoryName->setAttrib('onkeypress', 'chkCategory()');
     $categoryName->addFilter(new Zend_Filter_StringTrim());
     $categoryName->setRequired(true);
     $categoryName->addValidator('NotEmpty', false, array("messages" => 'Please enter category'));
     $categoryName->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9][\\s+[a-zA-Z0-9]+]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid category')));
     $categoryName->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pd_categories', 'field' => 'category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
     $categoryName->getValidator('Db_NoRecordExists')->setMessage('Category already exists');
     $categoryDesc = new Zend_Form_Element_Textarea('description');
     $categoryDesc->setAttrib('id', 'description');
     $categoryDesc->setAttrib('name', 'description');
     $categoryDesc->setAttrib('rows', 10);
     $categoryDesc->setAttrib('cols', 50);
     $categoryDesc->setAttrib('maxlength', 250);
     $submitBtn = new Zend_Form_Element_Submit('submit');
     $submitBtn->setAttrib('id', 'submitBtn');
     $submitBtn->setLabel('Add');
     $this->addElements(array($categoryName, $categoryDesc, $submitBtn));
     $this->setElementDecorators(array('ViewHelper'));
 }
コード例 #26
0
ファイル: Json.php プロジェクト: Cryde/sydney-core
 /**
  * Encode data as JSON, disable layouts, and set response header
  *
  * If $keepLayouts is true, does not disable layouts.
  * If $encodeJson is false, does not JSON-encode $data
  *
  * @param  mixed $data
  * @param  bool $keepLayouts
  * NOTE:   if boolean, establish $keepLayouts to true|false
  *         if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
  *         this array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false
  *         that will not be passed to Zend_Json::encode method but will be used here
  * @param  bool $encodeData
  * @return string|void
  */
 public function json($data, $keepLayouts = false, $encodeData = true)
 {
     $options = array();
     if (is_array($keepLayouts)) {
         $options = $keepLayouts;
         $keepLayouts = false;
         if (array_key_exists('keepLayouts', $options)) {
             $keepLayouts = $options['keepLayouts'];
             unset($options['keepLayouts']);
         }
         if (array_key_exists('encodeData', $options)) {
             $encodeData = $options['encodeData'];
             unset($options['encodeData']);
         }
     }
     if ($encodeData) {
         $data = Zend_Json::encode($data, null, $options);
     }
     if (!$keepLayouts) {
         require_once 'Zend/Layout.php';
         $layout = Zend_Layout::getMvcInstance();
         if ($layout instanceof Zend_Layout) {
             $layout->disableLayout();
         }
     }
     $response = Zend_Controller_Front::getInstance()->getResponse();
     $response->setHeader('Content-Type', 'application/json', true);
     return $data;
 }
コード例 #27
0
ファイル: Filter.php プロジェクト: hoalangoc/ftf
 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $displayname = new Zend_Form_Element_Text('displayname');
     $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc();
     $levelMultiOptions = array(0 => ' ');
     foreach ($levels as $key => $value) {
         $levelMultiOptions[$key] = $value;
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElement('Hidden', 'user_id', array('order' => 10003));
     $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
コード例 #28
0
ファイル: Recover.php プロジェクト: bersace/strass
    function render()
    {
        $fc = Zend_Controller_Front::getInstance();
        $router = $fc->getRouter();
        $request = $fc->getRequest();
        $url = $router->assemble(array('controller' => 'membres', 'action' => 'recouvrir', 'confirmer' => $this->user->recover_token));
        $url = "http://" . $request->getServer('HTTP_HOST') . $url;
        $individu = $this->user->findParentIndividus();
        $config = Zend_Registry::get('config');
        $this->_doc->addText(<<<EOS

Bonjour {$individu->getFullName(false)},

Vous avez demandé à récupérer l'accès à votre compte sur {$config->system->short_title}.

**Si vous n'avez pas fait cette demande, ignorez ce message ou contactez l'administrateur du site !**

Pour récupérer l'accès à votre compte, réinitialisez votre mot de passe en suivant ce lien :

= [{$url} {$url}]

À bientôt sur {$config->system->short_title} !

FSS,
L'automate du site {$config->system->short_title}.
EOS
);
    }
コード例 #29
-1
ファイル: Create.php プロジェクト: hoalangoc/ftf
 public function init()
 {
     $this->setAttrib('id', 'ynevent_review_create')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('id' => $this->_event->getIdentity(), 'tab' => $this->_tab), 'event_profile', true))->setAttrib('onsubmit', 'return checkReviewBody();')->setAttrib('class', '');
     // Review content body
     $this->addElement('Textarea', 'body', array('label' => 'Write Review', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'style' => "width:100%"));
     $this->addElement('Button', 'submit', array('label' => 'Submit', 'ignore' => true, 'type' => 'submit', 'decorators' => array('ViewHelper'), 'style' => 'margin-top:6px'));
 }
コード例 #30
-1
ファイル: Exception.php プロジェクト: josmel/adminwap
 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     $response = Zend_Controller_Front::getInstance()->getResponse();
     $errorCount = count(self::$errors);
     if (!$response->isException() && !$errorCount) {
         return '';
     }
     $html = '';
     foreach ($response->getException() as $e) {
         $html .= '<h4>' . get_class($e) . ': ' . $e->getMessage() . '</h4><p>thrown in ' . $e->getFile() . ' on line ' . $e->getLine() . '</p>';
         $html .= '<h4>Call Stack</h4><ol>';
         foreach ($e->getTrace() as $t) {
             $func = $t['function'] . '()';
             if (isset($t['class'])) {
                 $func = $t['class'] . $t['type'] . $func;
             }
             if (!isset($t['file'])) {
                 $t['file'] = 'unknown';
             }
             if (!isset($t['line'])) {
                 $t['line'] = 'n/a';
             }
             $html .= '<li>' . $func . '<br>in ' . str_replace($_SERVER['DOCUMENT_ROOT'], '', $t['file']) . ' on line ' . $t['line'] . '</li>';
         }
         $html .= '</ol>';
     }
     if ($errorCount) {
         $html .= '<h4>Errors</h4><ol>';
         foreach (self::$errors as $error) {
             $html .= '<li>' . sprintf("%s: %s in %s on line %d", $error['type'], $error['message'], str_replace($_SERVER['DOCUMENT_ROOT'], '', $error['file']), $error['line']) . '</li>';
         }
         $html .= '</ol>';
     }
     return $html;
 }