当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Hash::getHash方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Hash::getHash方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Hash::getHash方法的具体用法?PHP Zend_Form_Element_Hash::getHash怎么用?PHP Zend_Form_Element_Hash::getHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Hash的用法示例。


在下文中一共展示了Zend_Form_Element_Hash::getHash方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 function indexAction()
 {
     $perpage = 25;
     $page = $this->getRequest()->getParam('page', 1);
     if ($page < 1) {
         $page = 1;
     }
     $counts = Application_Model_FsThumbsMapper::i()->getCount();
     X_Debug::i("Thumbnails count: {$counts}");
     $totalSize = Application_Model_FsThumbsMapper::i()->getTotalSize();
     X_Debug::i("Thumbnails size: {$totalSize}");
     $pages = $counts / $perpage;
     X_Debug::i("Current page: {$page}");
     if ($counts % $perpage > 0 || $pages == 0) {
         $pages = (int) $pages + 1;
     }
     // add an extra page
     X_Debug::i("Total pages: {$pages}");
     if ($page > $pages) {
         throw new Exception(X_Env::_('p_fsthumbs_invalidpage', $page, $pages));
     }
     $csrf = new Zend_Form_Element_Hash('csrf');
     $csrf->setSalt(__CLASS__)->initCsrfToken();
     $thumbs = Application_Model_FsThumbsMapper::i()->fetchPage($page - 1, $perpage);
     $this->view->thumbs = $thumbs;
     $this->view->counts = $counts;
     $this->view->page = $page;
     $this->view->pages = $pages;
     $this->view->perpage = $perpage;
     $this->view->totalSize = $totalSize;
     $this->view->csrf = $csrf->getHash();
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:33,代码来源:FsthumbsController.php

示例2: testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile

 public function testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile()
 {
     $themeName = self::THEME;
     $this->assertEquals('', (string) get_theme_option('logo', $themeName));
     // specify the files array for the post
     $_FILES = array('logo' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), 'header_background' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0));
     // specify the theme options for the post
     $themeOptions = array('display_featured_item' => '1', 'display_featured_collection' => '1', 'display_featured_exhibit' => '1', 'homepage_recent_items' => '', 'homepage_text' => '', 'footer_text' => '', 'display_footer_copyright' => '0');
     $csrf = new Zend_Form_Element_Hash('theme_config_csrf');
     $csrf->initCsrfToken();
     // specify other post data
     $otherPostData = array('hidden_file_logo' => '', 'hidden_file_header_background' => '', 'MAX_FILE_SIZE' => '33554432', 'submit' => 'Save Changes', 'theme_config_csrf' => $csrf->getHash());
     // set the the post data
     $post = array_merge($themeOptions, $otherPostData);
     $this->getRequest()->setParam('name', $themeName);
     $this->getRequest()->setPost($post);
     $this->getRequest()->setMethod('POST');
     // dispatch the controller action
     $this->dispatch('themes/config');
     $actualOptions = Theme::getOptions(self::THEME);
     $this->assertArrayNotHasKey('theme_config_csrf', $actualOptions);
     foreach ($themeOptions as $name => $value) {
         $this->assertArrayHasKey($name, $actualOptions);
         $this->assertEquals($actualOptions[$name], $value, "Option '{$name}' was not correctly set.");
     }
     // verify that logo is empty
     $this->assertEmpty(get_theme_option('logo', $themeName));
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:28,代码来源:ThemesControllerTest.php

示例3: tasksAction

 function tasksAction()
 {
     $id = $this->getRequest()->getParam('id', false);
     if (!$id) {
         throw new Exception("Invalid thread");
     }
     $thread = X_Threads_Manager::instance()->getMonitor()->getThread($id);
     $queue = X_Threads_Manager::instance()->getMessenger()->showQueue($thread);
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $csrf->initCsrfToken();
     $this->view->thread = $thread;
     $this->view->queue = $queue;
     $this->view->csrf = $csrf->getHash();
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:15,代码来源:TmanagerController.php

示例4: indexAction

 public function indexAction()
 {
     $configs = Application_Model_ConfigsMapper::i()->fetchAll();
     $form = $this->_initConfigsForm($configs);
     $defaultValues = array();
     foreach ($configs as $config) {
         /* @var $config Application_Model_Config */
         $elementName = $config->getSection() . '_' . str_replace('.', '_', $config->getKey());
         $defaultValues[$elementName] = $config->getValue();
     }
     $form->setDefaults($defaultValues);
     $plugins = Application_Model_PluginsMapper::i()->fetchAll();
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $csrf->initCsrfToken();
     $this->view->csrf = $csrf->getHash();
     $this->view->plugins = $plugins;
     $this->view->form = $form;
     $this->view->messages = array_merge($this->_helper->flashMessenger->getMessages(), $this->_helper->flashMessenger->getCurrentMessages());
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:19,代码来源:ConfigsController.php

示例5: indexAction

 function indexAction()
 {
     $filter = $this->getRequest()->getParam('filter', 'all');
     $plugins = array();
     switch ($filter) {
         case 'installed':
             $plugins = Application_Model_PluginsMapper::i()->fetchByType(Application_Model_Plugin::USER);
             break;
         case 'disabled':
             $plugins = Application_Model_PluginsMapper::i()->fetchAll();
             // filter out disabled
             foreach ($plugins as $key => $value) {
                 /* @var $value Application_Model_Plugin */
                 if ($value->isEnabled()) {
                     unset($plugins[$key]);
                 }
             }
             break;
         case 'enabled':
             $plugins = Application_Model_PluginsMapper::i()->fetchAll();
             // filter out disabled
             foreach ($plugins as $key => $value) {
                 /* @var $value Application_Model_Plugin */
                 if (!$value->isEnabled()) {
                     unset($plugins[$key]);
                 }
             }
             break;
         case 'all':
         default:
             $plugins = Application_Model_PluginsMapper::i()->fetchAll();
             break;
     }
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $csrf->initCsrfToken();
     $this->view->csrf = $csrf->getHash();
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
     $this->view->plugins = $plugins;
     $this->view->filter = $filter;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:40,代码来源:PluginController.php

示例6: changeAction

 function changeAction()
 {
     $key = $this->getRequest()->getParam('key', false);
     $class = $this->getRequest()->getParam('class', false);
     $csrf = $this->getRequest()->getParam('csrf', false);
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout->disableLayout();
     if (!$key) {
         $this->_helper->json(array('success' => false, 'message' => X_Env::_("p_auth_acl_err_missingkey")), true, false);
         return;
     }
     $key = X_Env::decode($key);
     if (!$class) {
         $this->_helper->json(array('success' => false, 'message' => X_Env::_("p_auth_acl_err_missingclass")), true, false);
         return;
     }
     $hash = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     if (!$hash->isValid($csrf)) {
         $this->_helper->json(array('success' => false, 'message' => X_Env::_("p_auth_acl_err_invalidcsrf")), true, false);
         return;
     }
     $hash->initCsrfToken();
     $resource = X_VlcShares_Plugins::helpers()->acl()->getResourceDescriptor($key);
     if ($resource->isNew()) {
         $this->_helper->json(array('success' => false, 'message' => X_Env::_("p_auth_acl_err_invalidkey")), true, false);
         return;
     }
     $resource->setClass($class);
     try {
         Application_Model_AclResourcesMapper::i()->save($resource);
         $this->_helper->json(array('success' => true, 'csrf' => $hash->getHash()), true, false);
         return;
     } catch (Exception $e) {
         $this->_helper->json(array('success' => false, 'message' => $e->getMessage()), true, false);
         return;
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:37,代码来源:AclController.php

示例7: _getCsrfToken

 private function _getCsrfToken()
 {
     $hash = new Zend_Form_Element_Hash('user_csrf');
     $hash->initCsrfToken();
     return $hash->getHash();
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:6,代码来源:UsersFormTest.php

示例8: _makePost

 protected function _makePost($post = null)
 {
     $this->request->setMethod('POST');
     if (!$post) {
         $hash = new Zend_Form_Element_Hash('batch_edit_hash');
         $hash->initCsrfToken();
         $itemIds = array();
         foreach ($this->_items as $item) {
             $itemIds[] = $item->id;
         }
         $post = array('items' => $itemIds, 'metadata' => array('public' => 1, 'featured' => 1, 'item_type_id' => 1, 'tags' => 'lorem,ipsum,dolor'), 'batch_edit_hash' => $hash->getHash());
     }
     $this->request->setPost($post);
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:14,代码来源:BatchEditTest.php

示例9: accountsAction

 function accountsAction()
 {
     $accounts = Application_Model_AuthAccountsMapper::i()->fetchAll();
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $csrf->initCsrfToken();
     $this->view->ip = '%IP_ADDRESS%';
     $this->view->csrf = $csrf->getHash();
     $this->view->accounts = $accounts;
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:10,代码来源:AuthController.php

示例10: testDelete

 public function testDelete()
 {
     $hash = new Zend_Form_Element_Hash('confirm_delete_hash');
     $hash->initCsrfToken();
     $this->_makePost(array('confirm_delete_hash' => $hash->getHash()));
     $this->dispatch('/items/delete/1');
     $this->assertEquals(0, $this->db->getTable('Item')->count());
     $this->assertRedirectTo('/items/browse');
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:9,代码来源:ItemsControllerTest.php

示例11: bookmarkAction

 public function bookmarkAction()
 {
     $csrf = new Zend_Form_Element_Hash('csrf', array('salt' => __CLASS__));
     $validCheck = $csrf->isValid($this->getRequest()->getParam('csrf', false));
     $csrf->initCsrfToken();
     $hash = $csrf->getHash();
     $return = array('success' => true, 'api' => array('resolver' => $this->_helper->url->url(array('controller' => 'bookmarklets', 'action' => 'resolver', 'csrf' => $hash)), 'adder' => $this->_helper->url->url(array('controller' => 'bookmarklets', 'action' => 'add', 'csrf' => $hash)), 'bookmark' => $this->_helper->url->url(array('controller' => 'bookmarklets', 'action' => 'bookmark', 'csrf' => $hash))));
     if ($validCheck) {
         $url = $this->getRequest()->getParam("url", false);
         $title = strip_tags($this->getRequest()->getParam("title", false));
         $description = strip_tags($this->getRequest()->getParam("description", false));
         $thumbnail = $this->getRequest()->getParam("thumbnail", false);
         $ua = $this->getRequest()->getParam("ua", false);
         $cookies = $this->getRequest()->getParam("cookies", false);
         if ($url && $title) {
             $model = new Application_Model_Bookmark();
             $model->setUrl($url);
             $model->setTitle($title);
             if ($thumbnail) {
                 $model->setThumbnail($thumbnail);
             }
             if ($description) {
                 $model->setDescription($description);
             }
             if ($ua) {
                 $model->setUa($ua);
             }
             if ($cookies) {
                 $model->setCookies($cookies);
             }
             try {
                 Application_Model_BookmarksMapper::i()->save($model);
             } catch (Exception $e) {
                 X_Debug::e("DB Error: {$e->getMessage()}");
                 $return['success'] = false;
             }
         } else {
             X_Debug::e("Missing data");
             $return['success'] = false;
         }
     } else {
         X_Debug::e("Invalid CSRF");
         $return['success'] = false;
     }
     $this->_helper->json($return, true, false);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:46,代码来源:BookmarkletsController.php

示例12: _dispatchChangePassword

 private function _dispatchChangePassword(array $form)
 {
     $hash = new Zend_Form_Element_Hash('password_csrf');
     $hash->initCsrfToken();
     $form['password_csrf'] = $hash->getHash();
     $this->getRequest()->setPost($form);
     $this->getRequest()->setMethod('post');
     $this->dispatch(self::FORM_URL);
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:9,代码来源:ChangePasswordTest.php


注:本文中的Zend_Form_Element_Hash::getHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。