public function photosAction()
 {
     require_once 'Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Http_Client');
     $CLIENT_ID = 'fa2641332bca4ce6bd8f71bd4345cc0f';
     $CLIENT_SECRET = 'c44e29e7449444e3bc1f58ff499f5e8e';
     $user = '******';
     $tag = 'coreprojectua';
     try {
         $client = new Zend_Http_Client('https://api.instagram.com/v1/users/' . $user . '/media/recent');
         $client->setParameterGet('client_id', $CLIENT_ID);
         $response = $client->request();
         $result = json_decode($response->getBody());
         $data = $result->data;
         if (count($data) > 0) {
             $this->view->user = $data;
         }
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . print_r($client);
         exit;
     }
     try {
         $client = new Zend_Http_Client('https://api.instagram.com/v1/tags/' . $tag . '/media/recent');
         $client->setParameterGet('client_id', $CLIENT_ID);
         $response = $client->request();
         $result = json_decode($response->getBody());
         $data = $result->data;
         if (count($data) > 0) {
             $this->view->tag = $data;
         }
     } catch (Exception $e) {
         echo 'ERROR: ' . $e->getMessage() . print_r($client);
         exit;
     }
 }
Пример #2
0
 private function connectToGoogleViaZend()
 {
     set_include_path($this->root_directory . "modules/Calendar4You/");
     require_once 'Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Gdata');
     Zend_Loader::loadClass('Zend_Gdata_AuthSub');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     Zend_Loader::loadClass('Zend_Gdata_Calendar');
     if ($this->user_login != "" && $this->user_password != "") {
         try {
             $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
             $this->gClient = Zend_Gdata_ClientLogin::getHttpClient($this->user_login, $this->user_password, $service);
             $this->status = $this->mod_strings["LBL_OK"];
             $this->is_logged = true;
         } catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
             $this->status = $this->mod_strings["LBL_URL_CAPTCHA_IMAGE"] . ': ' . $cre->getCaptchaUrl() . ', ' . $this->mod_strings["LBL_TOKEN_ID"] . ': ' . $cre->getCaptchaToken();
         } catch (Zend_Gdata_App_AuthException $ae) {
             $this->status = $this->mod_strings["LBL_AUTH_PROBLEM"] . ': ' . $ae->exception() . "\n";
         }
     } else {
         $this->status = $this->mod_strings["LBL_MISSING_AUTH_DATA"];
     }
     if ($this->is_logged) {
         $this->gService = new Zend_Gdata_Calendar($this->gClient);
         try {
             $this->gListFeed = $this->gService->getCalendarListFeed();
         } catch (Zend_Gdata_App_Exception $e) {
             $this->gListFeed = array();
         }
     }
     set_include_path($this->root_directory);
 }
Пример #3
0
 /**
  * Initialize singleton instance.
  *
  * @param string $class OPTIONAL Subclass of Zend_Wildfire_Channel_HttpHeaders
  * @return Zend_Wildfire_Channel_HttpHeaders Returns the singleton Zend_Wildfire_Channel_HttpHeaders instance
  * @throws Zend_Wildfire_Exception
  */
 public static function init($class = null)
 {
     if (self::$_instance !== null) {
         require_once LIB_DIR . '/Zend/Wildfire/Exception.php';
         throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Channel_HttpHeaders already exists!');
     }
     if ($class !== null) {
         if (!is_string($class)) {
             require_once LIB_DIR . '/Zend/Wildfire/Exception.php';
             throw new Zend_Wildfire_Exception('Third argument is not a class string');
         }
         if (!class_exists($class)) {
             require_once LIB_DIR . '/Zend/Loader.php';
             Zend_Loader::loadClass($class);
         }
         self::$_instance = new $class();
         if (!self::$_instance instanceof Zend_Wildfire_Channel_HttpHeaders) {
             self::$_instance = null;
             require_once LIB_DIR . '/Zend/Wildfire/Exception.php';
             throw new Zend_Wildfire_Exception('Invalid class to third argument. Must be subclass of Zend_Wildfire_Channel_HttpHeaders.');
         }
     } else {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Пример #4
0
 public function fetchTable($table_name, $where = false, $parameters = array())
 {
     $range = isset($parameters['range']) && !empty($parameters['range']) ? $parameters['range'] : " * ";
     $sortColumn = isset($parameters['sortColumn']) && !empty($parameters['sortColumn']) ? $parameters['sortColumn'] : false;
     $sortType = isset($parameters['sortType']) && !empty($parameters['sortType']) ? $parameters['sortType'] : "ASC";
     $limitOffset = isset($parameters['limitOffset']) && !empty($parameters['limitOffset']) ? $parameters['limitOffset'] : false;
     $rowCount = isset($parameters['rowCount']) && !empty($parameters['rowCount']) ? $parameters['rowCount'] : false;
     $queryString = "SELECT {$range} FROM {$table_name} ";
     if ($where !== false) {
         $queryString .= " WHERE " . $where;
     }
     if ($sortColumn !== false) {
         $queryString .= " ORDER BY {$sortColumn} {$sortType} ";
     }
     if ($rowCount !== false) {
         $queryString .= " LIMIT ";
         if ($limitOffset !== false) {
             $queryString .= " {$limitOffset}, ";
         }
         $queryString .= " {$rowCount} ";
     }
     $db = $this->_db->query($queryString);
     $dataFetch = $db->fetchAll(Zend_Db::FETCH_ASSOC);
     $data = array('table' => $this, 'data' => $dataFetch, 'rowClass' => $this->_rowClass, 'stored' => true);
     Zend_Loader::loadClass($this->_rowsetClass);
     if (count($dataFetch) < 1) {
         return false;
     } else {
         return new $this->_rowsetClass($data);
     }
 }
Пример #5
0
 /**
  * Sets new encryption options
  *
  * @param  string|array $options (Optional) Encryption options
  * @return Zend_Filter_Encrypt
  */
 public function setAdapter($options = null)
 {
     if (is_string($options)) {
         $adapter = $options;
     } else {
         if (isset($options['adapter'])) {
             $adapter = $options['adapter'];
             unset($options['adapter']);
         } else {
             $adapter = 'Mcrypt';
         }
     }
     if (!is_array($options)) {
         $options = array();
     }
     if (Zend_Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter) . '.php')) {
         $adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
     }
     Zend_Loader::loadClass($adapter);
     $this->_adapter = new $adapter($options);
     if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
         require_once 'Zend/Filter/Exception.php';
         throw new Zend_Filter_Exception("Encoding adapter '" . $adapter . "' does not implement Zend_Filter_Encrypt_Interface");
     }
     return $this;
 }
Пример #6
0
 /**
  * Get view instance
  *
  * @access public
  * @return Zend_View
  */
 public function getView()
 {
     if (!isset($this->_config)) {
         throw new Gene_View_Exception('Configs does not set.');
     }
     if (!isset($this->_config['className'])) {
         throw new Gene_View_Exception('Invaild class name.');
     }
     $encode = 'UTF-8';
     if (isset($this->_config['encoding'])) {
         $encode = $this->_config['encoding'];
     }
     if (!class_exists($this->_config['className'])) {
         Zend_Loader::loadClass($this->_config['className']);
     }
     $streamWrapperFlag = false;
     if (isset($this->_config['streamWrapperFlag'])) {
         if (strtolower($this->_config['streamWrapperFlag']) === 'on') {
             $streamWrapperFlag = $this->_config['streamWrapperFlag'];
         }
     }
     $class = $this->_config['className'];
     $view = new $class();
     $view->setEncoding($encode)->setUseStreamWrapper($streamWrapperFlag);
     return $view;
 }
Пример #7
0
 public static function unserialize($cached)
 {
     if (isset($cached['_class']) && !class_exists($cached['_class'])) {
         \Zend_Loader::loadClass($cached['_class']);
     }
     return unserialize(gzuncompress($cached['content']));
 }
Пример #8
0
 function loginAction()
 {
     $this->view->message = '';
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $f = new Zend_Filter_StripTags();
         $username = $f->filter($this->_request->getPost('username'));
         $password = md5($f->filter($this->_request->getPost('password')));
         if (!empty($username)) {
             Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
             $dbAdapter = Zend_Registry::get('dbAdapter');
             $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
             $authAdapter->setTableName('utilisateur');
             $authAdapter->setIdentityColumn('login_utilisateur');
             $authAdapter->setCredentialColumn('pass_utilisateur');
             $authAdapter->setIdentity($username);
             $authAdapter->setCredential($password);
             $auth = Zend_Auth::getInstance();
             $result = $auth->authenticate($authAdapter);
             if ($result->isValid()) {
                 $data = $authAdapter->getResultRowObject(null, 'password');
                 $auth->getStorage()->write($data);
                 $this->_redirect('/');
             }
         }
         $this->_redirect('auth/loginfail');
     }
 }
 /**
  * Método Construtor
  *
  * @see Contribuinte_Lib_Controller_AbstractController::init()
  */
 public function init()
 {
     parent::init();
     // Carrega as classes para geração do PDF
     Zend_Loader::loadClass('fpdf', APPLICATION_PATH . '/../library/FPDF/');
     Zend_Loader::loadClass('Fpdf2File', APPLICATION_PATH . '/../library/FPDF/');
 }
Пример #10
0
 function init()
 {
     $this->view->baseUrl = $this->_request->getBaseUrl();
     Zend_Loader::loadClass('Utilisateur');
     Zend_Loader::loadClass('Avatar');
     Zend_Loader::loadClass('Classe');
     Zend_Loader::loadClass('Case_');
     Zend_Loader::loadClass('Competence');
     Zend_Loader::loadClass('Zone');
     Zend_Loader::loadClass('Equipement');
     Zend_Loader::loadClass('EquipementArme');
     Zend_Loader::loadClass('EquipementArmure');
     Zend_Loader::loadClass('Objet');
     Zend_Loader::loadClass('ObjetMonstre');
     Zend_Loader::loadClass('ZoneMonstre');
     Zend_Loader::loadClass('Monstre');
     Zend_Loader::loadClass('LigneInventaire');
     Zend_Loader::loadClass('ObjetSoin');
     Zend_Loader::loadClass('Niveau');
     Zend_Loader::loadClass('Pnj');
     Zend_Loader::loadClass('Instructeur');
     Zend_Loader::loadClass('Marchand');
     Zend_Loader::loadClass('Ville');
     $this->view->user = Zend_Auth::getInstance()->getIdentity();
 }
Пример #11
0
 /**
  * Get view
  *
  * @param Zend_Config $config
  * @return Zend_View_Interface
  */
 public function getView(Zend_Config $config)
 {
     if (!($view = $this->getCache('view'))) {
         $isUseViewRenderer = !Zend_Controller_Front::getInstance()->getParam('noViewRenderer');
         $viewRenderer = $isUseViewRenderer ? Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer') : null;
         // Use view from view renderer if possible
         if ($isUseViewRenderer && $viewRenderer->view instanceof Zend_View_Interface) {
             $view = $viewRenderer->view;
         } else {
             $viewClass = $config->get('class');
             Zend_Loader::loadClass($viewClass);
             $view = new $viewClass();
             // Validate object
             if (!$view instanceof Zend_View_Interface) {
                 /**
                  * @see Zym_App_Resource_View_Exception
                  */
                 require_once 'Zym/App/Resource/View/Exception.php';
                 throw new Zym_App_Resource_View_Exception(sprintf('View object must be an instance of Zend_View_Interface an object of %s', get_class($view)));
             }
         }
         // Setup
         $this->_setupView($view, $config);
         // Save
         $this->saveCache($view, 'view');
     }
     return $view;
 }
Пример #12
0
 function resetAction()
 {
     Zend_Loader::loadClass("UserModel");
     $userm = new UserModel();
     $user = $this->_request->get("user");
     $key = $this->_request->get("key");
     $obj = $userm->getRow($user);
     if (empty($obj) or empty($key)) {
         $this->_redirect("/");
     }
     $savedkey = $this->cache->load($user);
     if ($savedkey != $key) {
         $this->_redirect("/");
     }
     $this->cache->remove($user);
     $pass = "";
     for ($i = 0; $i < 8; $i++) {
         $pass = $pass . mt_rand(0, 9);
     }
     /* send email */
     $mail = Mailer::get_mailer();
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     if ($baseurl == "/") {
         $baseurl = "";
     }
     $mail->setBodyText("\n\nYou are receiving this email because you wished to reset your password\non http://{$_SERVER['SERVER_NAME']}{$baseurl}.\n\nWe have changed your password to: {$pass}\n\nPlease try logging in using this password and change it as soon as\npossible.\n\n");
     $mail->addTo($userm->getMember($obj, 0)->email, $userm->getMember($obj, 0)->name);
     $mail->setSubject("Password Reset");
     $mail->send();
     $obj->setPassword($pass);
 }
 function addEvent($title = 'Новый заказ', $desc = 'Описание заказа', $where = 'интернет-магазин', $startDate, $endDate, $sms_reminder)
 {
     try {
         set_include_path('.' . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/modules/gcalendar/' . PATH_SEPARATOR . get_include_path());
         include_once 'Zend/Loader.php';
         Zend_Loader::loadClass('Zend_Gdata');
         Zend_Loader::loadClass('Zend_Gdata_AuthSub');
         Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
         Zend_Loader::loadClass('Zend_Gdata_HttpClient');
         Zend_Loader::loadClass('Zend_Gdata_Calendar');
         $client = Zend_Gdata_ClientLogin::getHttpClient($this->_user, $this->_pass, "cl");
         $gdataCal = new Zend_Gdata_Calendar($client);
         $newEvent = $gdataCal->newEventEntry();
         $newEvent->title = $gdataCal->newTitle($title);
         $newEvent->where = array($gdataCal->newWhere($where));
         $newEvent->content = $gdataCal->newContent($desc);
         $when = $gdataCal->newWhen();
         $when->startTime = $startDate;
         $when->endTime = $endDate;
         if (intval($sms_reminder)) {
             $reminder = $gdataCal->newReminder();
             $reminder->method = "sms";
             $reminder->minutes = "0";
             $when->reminders = array($reminder);
         }
         $newEvent->when = array($when);
         $createdEvent = $gdataCal->insertEvent($newEvent);
         return $createdEvent->id->text;
     } catch (Exception $ex) {
         // Report the exception to the user
     }
 }
 /**
  * Cascade delete Role
  * @group admin
  * @group admin-role-cascade-delete
  */
 public function testRoleCascadeDelete()
 {
     print "\n" . __METHOD__ . ' ';
     $role_id = 6;
     $this->_rootLogin();
     $this->request->setPost(array('role_id' => $role_id));
     $this->request->setMethod('POST');
     $this->dispatch('admin/role-delete');
     $this->logBody($this->response->outputBody());
     // debug log
     $this->assertController('admin');
     $this->assertAction('role-index');
     $this->assertNotQueryContentRegex('table', self::ZF_pattern);
     // Zend Framework
     // check role
     Zend_Loader::loadClass('Wbroles');
     $table = new Wbroles();
     $row = $table->fetchRow("id = {$role_id}");
     if ($row != null) {
         $this->assertTrue(FALSE, "\nRole delete fail!\n");
     }
     unset($table);
     // check ACLs tables
     $arr_table = array('WbCommandACL', 'Wbresources', 'WbStorageACL', 'WbPoolACL', 'WbClientACL', 'WbFilesetACL', 'WbJobACL', 'WbWhereACL');
     foreach ($arr_table as $tbl) {
         Zend_Loader::loadClass($tbl);
         $table = new $tbl();
         $row = $table->fetchRow("role_id = {$role_id}");
         if ($row != null) {
             $this->assertTrue(FALSE, "\nRole cascade delete fail!\n");
         }
         echo "0";
         unset($table);
     }
 }
Пример #15
0
    /**
     * Converts a DOMElement object into the specific class
     *
     * @throws Zend_InfoCard_Xml_Exception
     * @param DOMElement $e The DOMElement object to convert
     * @param string $classname The name of the class to convert it to (must inhert from Zend_InfoCard_Xml_Element)
     * @return Zend_InfoCard_Xml_Element a Xml Element object from the DOM element
     */
    static public function convertToObject(DOMElement $e, $classname)
    {
        if (!class_exists($classname)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($classname);
        }

        $reflection = new ReflectionClass($classname);

        if(!$reflection->isSubclassOf('Zend_InfoCard_Xml_Element')) {
            require_once 'Zend/InfoCard/Xml/Exception.php';
            throw new Zend_InfoCard_Xml_Exception("DOM element must be converted to an instance of Zend_InfoCard_Xml_Element");
        }

        $sxe = simplexml_import_dom($e, $classname);

        if(!($sxe instanceof Zend_InfoCard_Xml_Element)) {
            // Since we just checked to see if this was a subclass of Zend_infoCard_Xml_Element this shoudl never fail
            // @codeCoverageIgnoreStart
            require_once 'Zend/InfoCard/Xml/Exception.php';
            throw new Zend_InfoCard_Xml_Exception("Failed to convert between DOM and SimpleXML");
            // @codeCoverageIgnoreEnd
        }

        return $sxe;
    }
Пример #16
0
 function getById($jobid)
 {
     // do Bacula ACLs
     Zend_Loader::loadClass('Job');
     $table = new Job();
     if (!$table->isJobIdExists($jobid)) {
         return FALSE;
     }
     $select = new Zend_Db_Select($this->db);
     switch ($this->db_adapter) {
         case 'PDO_SQLITE':
             // bug http://framework.zend.com/issues/browse/ZF-884
             $select->distinct();
             $select->from(array('l' => 'Log'), array('logid' => 'LogId', 'jobid' => 'JobId', 'LogTime' => 'Time', 'logtext' => 'LogText'));
             $select->where("JobId = ?", $jobid);
             $select->order(array('LogId', 'LogTime'));
             break;
         default:
             // mysql, postgresql
             $select->distinct();
             $select->from(array('l' => 'Log'), array('LogId', 'JobId', 'LogTime' => 'Time', 'LogText'));
             $select->where("JobId = ?", $jobid);
             $select->order(array('LogId', 'LogTime'));
     }
     //$sql = $select->__toString(); echo "<pre>$sql</pre>"; exit; // for !!!debug!!!
     $stmt = $select->query();
     return $stmt->fetchAll();
 }
Пример #17
0
 public function loginAction()
 {
     $this->view->status = "";
     if ($this->_request->isPost() && $this->_request->getPost('openid_action') == 'login' && $this->_request->getPost('openid_identifier', '') !== '' || $this->_request->isPost() && $this->_request->getPost('openid_mode') !== null || !$this->_request->isPost() && $this->_request->getQuery('openid_mode') != null) {
         // Begin If.
         Zend_Loader::loadClass('Zend_Auth_Adapter_OpenId');
         $auth = Zend_Auth::getInstance();
         $result = $auth->authenticate(new Zend_Auth_Adapter_OpenId($this->_request->getPost('openid_identifier')));
         if ($result->isValid()) {
             $user = User::find($result->getIdentity());
             if (!$user) {
                 $user = new User();
                 $user->setUid($result->getIdentity());
                 $this->getEntityManager()->persist($user);
             }
             $user->setLastLogin();
             $this->getEntityManager()->flush();
             $this->_redirect('admin/index');
         } else {
             $auth->clearIdentity();
             foreach ($result->getMessages() as $message) {
                 $this->view->status .= "{$message}<br>\n";
             }
         }
     }
     $this->render();
 }
Пример #18
0
 function init()
 {
     parent::init();
     $this->view->baseUrl = $this->_request->getBaseUrl();
     Zend_Loader::loadClass('Pages');
     Zend_Loader::loadClass('Produkty');
 }
 /**
  * Método construtor da classe
  */
 public function init()
 {
     parent::init();
     $oEntityManager = Zend_Registry::get('em');
     $this->oConexao = $oEntityManager->getConnection();
     Zend_Loader::loadClass('Fpdf2File', APPLICATION_PATH . '/../library/FPDF/');
 }
Пример #20
0
 public function init()
 {
     Zend_Loader::loadClass('Zend_Validate_Regex');
     // translate
     $this->translate = Zend_Registry::get('translate');
     //Zend_Form::setDefaultTranslator( Zend_Registry::get('translate') );
     // login attempt
     $defNamespace = new Zend_Session_Namespace('Default');
     $use_captcha = $defNamespace->numLoginFails >= self::MAX_LOGIN_ATTEMPT ? TRUE : FALSE;
     $this->setMethod('post');
     // username
     $login = $this->createElement('text', 'login', array('decorators' => $this->elDecorators, 'required' => true, 'label' => $this->translate->_('Username'), 'size' => 25, 'maxlength' => 50));
     $login->addDecorator('FormElements', array('tag' => 'div', 'style' => 'width:10em; background-color:#E0F0FF;'));
     $login_validator = new Zend_Validate_Regex('/^[a-z0-9\\-_@\\.]+$/i');
     $login_validator->setMessage($this->translate->_('Login characters incorrect. Allowed: alphabetical characters, digits, and "- . _ @" characters.'));
     $login->addValidator($login_validator)->addValidator('stringLength', false, array(1, 50))->setRequired(true);
     // password
     $password = $this->createElement('password', 'pwd', array('decorators' => $this->elDecorators, 'required' => true, 'label' => $this->translate->_('Password'), 'size' => 25, 'maxlength' => 50));
     $password->addValidator('StringLength', false, array(1, 50))->setRequired(true);
     // remember me
     $checkbox = $this->createElement('checkbox', 'rememberme', array('decorators' => $this->elDecorators, 'label' => $this->translate->_('Remember me'), 'checked' => 1));
     // login
     $submit = $this->createElement('submit', 'submit', array('decorators' => array('ViewHelper', 'Errors'), 'class' => 'login-btn', 'id' => 'submit', 'label' => $this->translate->_('Log In')));
     // add elements to form
     $this->addElement($login)->addElement($password)->addElement($checkbox)->addElement($submit);
     if ($use_captcha) {
         // create captcha
         $captcha = $this->createElement('captcha', 'captcha', array('label' => $this->translate->_('Type the characters:'), 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 3, 'timeout' => 120)));
         // And finally add some CSRF protection
         $csrf = $this->createElement('hash', 'csrf', array('ignore' => true));
         // add captcha to form
         $this->addElement($captcha)->addElement($csrf);
     }
 }
Пример #21
0
 protected function _traverseFolder($folderGuid, $sGuid, $level)
 {
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Folder');
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $sGuid = '';
     if (count($rowSet)) {
         $sGuid = '<li>' . "<a href='" . KUTU_ROOT_URL . "/pages/g/{$row->guid}/h/1'>" . $row->title . '</a><ul>';
     } else {
         $sGuid = '<li>' . "<a href='" . KUTU_ROOT_URL . "/pages/g/{$row->guid}/h/1'>" . $row->title . '</a>';
     }
     if (true) {
         //echo $level;
         foreach ($rowSet as $row) {
             //$sTab = '<ul>';
             //$sTab = '';
             //for($i=0;$i<$level;$i++)
             //$sTab .= '<li>';
             //$option = '<option value="'.$row->guid.'">'.$sTab.$row->title.'</option>';
             //$option = '"'.$row->guid.'" :'.'"'.$sTab.$row->title.'",';
             //$option = $sTab.$row->title;
             $sGuid .= $this->_traverseFolder($row->guid, '', $level + 1) . "";
             //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1);
         }
         if (count($rowSet)) {
             return $sGuid . '</ul></li>';
         } else {
             return $sGuid . '</li>';
         }
     }
 }
Пример #22
0
 public function newAction()
 {
     $this->view->message = "Nothing is saved";
     $req = $this->getRequest();
     $item = $req->getParam('guid');
     $relatedItem = $req->getParam('relatedGuid');
     $as = $req->getParam('relateAs');
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Catalog');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     if (empty($relatedItem)) {
         $this->view->message = "No relatedGuid specified!";
     }
     //check if $guid is an array
     if (is_array($item)) {
         foreach ($item as $guid) {
             echo "<br>" . $guid;
             $rowCatalog = $tblCatalog->find($guid)->current();
             echo $rowCatalog->guid;
             $rowCatalog->relateTo($relatedItem, $as);
         }
     } else {
         $rowCatalog = $tblCatalog->find($item)->current();
         $rowCatalog->relateTo($relatedItem, $as);
         $this->view->message = "Data was successfully saved";
     }
 }
Пример #23
0
 /**
  * Get a TestUtil class for the current RDBMS brand.
  */
 protected function _setUpTestUtil()
 {
     $driver = $this->getDriver();
     $utilClass = "ZendX_Db_TestUtil_{$driver}";
     Zend_Loader::loadClass($utilClass);
     $this->_util = new $utilClass();
 }
Пример #24
0
 /**
  * recurses through the Test subdir and includes classes in each test group subdir,
  * then builds an array of classnames for the tests that will be run
  *
  */
 public function loadTests($test_path = NULL)
 {
     $this->resetStats();
     if ($test_path === NULL) {
         // this seems hackey.  is it?  dunno.
         $test_path = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Security' . DIRECTORY_SEPARATOR . 'Test';
     }
     $test_root = dir($test_path);
     while (false !== ($entry = $test_root->read())) {
         if (is_dir($test_root->path . DIRECTORY_SEPARATOR . $entry) && !preg_match('|^\\.(.*)$|', $entry)) {
             $test_dirs[] = $entry;
         }
     }
     // include_once all files in each test dir
     foreach ($test_dirs as $test_dir) {
         $this_dir = dir($test_root->path . DIRECTORY_SEPARATOR . $test_dir);
         while (false !== ($entry = $this_dir->read())) {
             if (!is_dir($this_dir->path . DIRECTORY_SEPARATOR . $entry) && preg_match('/[A-Za-z]+\\.php/i', $entry)) {
                 $className = "Zend_Environment_Security_Test_" . $test_dir . "_" . basename($entry, '.php');
                 Zend_Loader::loadClass($className);
                 $classNames[] = $className;
             }
         }
     }
     $this->_tests_to_run = $classNames;
 }
Пример #25
0
 public function setUp()
 {
     if (!class_exists('Archive_Tar')) {
         // require_once 'Zend/Loader.php';
         try {
             Zend_Loader::loadClass('Archive_Tar');
         } catch (Zend_Exception $e) {
             $this->markTestSkipped('This filter needs PEARs Archive_Tar');
         }
     }
     $files = array(dirname(__FILE__) . '/../_files/zipextracted.txt', dirname(__FILE__) . '/../_files/_compress/Compress/First/Second/zipextracted.txt', dirname(__FILE__) . '/../_files/_compress/Compress/First/Second', dirname(__FILE__) . '/../_files/_compress/Compress/First/zipextracted.txt', dirname(__FILE__) . '/../_files/_compress/Compress/First', dirname(__FILE__) . '/../_files/_compress/Compress/zipextracted.txt', dirname(__FILE__) . '/../_files/_compress/Compress', dirname(__FILE__) . '/../_files/_compress/zipextracted.txt', dirname(__FILE__) . '/../_files/_compress', dirname(__FILE__) . '/../_files/compressed.tar');
     foreach ($files as $file) {
         if (file_exists($file)) {
             if (is_dir($file)) {
                 rmdir($file);
             } else {
                 unlink($file);
             }
         }
     }
     if (!file_exists(dirname(__FILE__) . '/../_files/Compress/First/Second')) {
         mkdir(dirname(__FILE__) . '/../_files/Compress/First/Second', 0777, true);
         file_put_contents(dirname(__FILE__) . '/../_files/Compress/First/Second/zipextracted.txt', 'compress me');
         file_put_contents(dirname(__FILE__) . '/../_files/Compress/First/zipextracted.txt', 'compress me');
         file_put_contents(dirname(__FILE__) . '/../_files/Compress/zipextracted.txt', 'compress me');
     }
 }
Пример #26
0
 /**
  * Setup db
  *
  */
 public function setup(Zend_Config $config)
 {
     $sessionConfig = $config->get('config');
     $configArray = $sessionConfig->toArray();
     // save_path handler
     $configArray = $this->_prependSavePath($configArray);
     // name handler
     $configArray = $this->_parseName($configArray);
     // Setup config
     Zend_Session::setOptions($configArray);
     // Setup save handling?
     $saveHandlerConfig = $config->get('save_handler');
     if ($className = $saveHandlerConfig->get('class_name')) {
         if ($args = $saveHandlerConfig->get('constructor_args')) {
             if ($args instanceof Zend_Config) {
                 $args = $args->toArray();
             } else {
                 $args = (array) $args;
             }
         } else {
             $args = array();
         }
         require_once 'Zend/Loader.php';
         Zend_Loader::loadClass($className);
         $saveHandler = new ReflectionClass($className);
         $saveHandler = $saveHandler->newInstanceArgs($args);
         Zend_Session::setSaveHandler($saveHandler);
     }
     // Autostart session?
     if ($config->get('auto_start')) {
         // Start session
         Zend_Session::start();
     }
 }
Пример #27
0
 protected function _initView()
 {
     // Start initail view
     $this->bootstrap('layout');
     $config = $this->getOption('views');
     $resources = $this->getOption('resources');
     $view = new Zend_View();
     if (isset($resources['layout']['layoutPath'])) {
         $view->assign('layoutRootPath', $resources['layout']['layoutPath']);
     }
     $this->bootstrap('db');
     Zend_Loader::loadClass('Ht_Utils_SystemSetting');
     $sysSetting = Ht_Utils_SystemSetting::getSettings();
     $view->assign('sysSetting', $sysSetting);
     $view->assign('profile', Zend_Auth::getInstance()->getIdentity());
     Zend_Loader::loadClass("Ht_Model_SystemSetting");
     $this->setSystemLogConfiguration($sysSetting);
     // use the viewrenderer to keep the code DRY
     // instantiate and add the helper in one go
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     $viewRenderer->setViewSuffix('phtml');
     // add it to the action helper broker
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     /**
      * Set inflector for Zend_Layout
      */
     $inflector = new Zend_Filter_Inflector(':script.:suffix');
     $inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml'));
     // Initialise Zend_Layout's MVC helpers
     $this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector);
     return $this->getResource('layout')->getView();
 }
 function modificarAction()
 {
     $this->view->subtitle = "Modificar Configuración";
     $configuracion = new Configuracion();
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_StripTags');
         $filter = new Zend_Filter_StripTags();
         $id = (int) $this->_request->getPost('id');
         $sitio_color_fondo = trim($filter->filter($this->_request->getPost('sitio_color_fondo')));
         $sitio_color_cabezal = trim($filter->filter($this->_request->getPost('sitio_color_cabezal')));
         $sitio_color_pie = trim($filter->filter($this->_request->getPost('sitio_color_pie')));
         if ($id !== false) {
             $data = array('sitio_color_fondo' => $sitio_color_fondo, 'sitio_color_cabezal' => $sitio_color_cabezal, 'sitio_color_pie' => $sitio_color_pie, 'id_sitio' => $this->session->sitio->id);
             $where = 'id = ' . $id;
             $configuracion->update($data, $where);
             $this->_redirect('/admin/configuracion/');
             return;
         }
     } else {
         $id = (int) $this->_request->getParam('id', 0);
         if ($id > 0) {
             $this->view->configuracion = Configuracion::getConfiguracionSitio($id);
         }
     }
     $this->view->action = "modificar";
     $this->view->buttonText = "Modificar";
     $this->view->scriptJs = "mooRainbow";
 }
Пример #29
0
 function clientLogin($username, $password, $source)
 {
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     $authenticationURL = 'https://www.google.com/accounts/ClientLogin';
     $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, 'youtube', null, $source, null, null, $authenticationURL);
     return $httpClient;
 }
Пример #30
-1
 /**
  * Factory method to return a preconfigured Zend_Service_StrikeIron_*
  * instance.
  *
  * @param  null|string  $options  Service options
  * @return object       Zend_Service_StrikeIron_* instance
  * @throws Zend_Service_StrikeIron_Exception
  */
 public function getService($options = array())
 {
     $class = isset($options['class']) ? $options['class'] : 'Base';
     unset($options['class']);
     if (strpos($class, '_') === false) {
         $class = "Zend_Service_StrikeIron_{$class}";
     }
     try {
         if (!class_exists($class)) {
             // require_once 'Zend/Loader.php';
             @Zend_Loader::loadClass($class);
         }
         if (!class_exists($class, false)) {
             throw new Exception('Class file not found');
         }
     } catch (Exception $e) {
         $msg = "Service '{$class}' could not be loaded: " . $e->getMessage();
         /**
          * @see Zend_Service_StrikeIron_Exception
          */
         // require_once 'Zend/Service/StrikeIron/Exception.php';
         throw new Zend_Service_StrikeIron_Exception($msg, $e->getCode(), $e);
     }
     // instantiate and return the service
     $service = new $class(array_merge($this->_options, $options));
     return $service;
 }