zend-framework

How setCredentialTreatment works in Zend framework

你说的曾经没有我的故事 提交于 2019-12-07 08:39:21
Can anyone tell me what is the use of following statement and how it works in Zend Framework? setCredentialTreatment('SHA1(CONCAT(?, salt ))'); Try like this: $auth = Zend_Auth::getInstance(); $authAdapter = new Zend_Auth_Adapter_DbTable( Zend_Db_Table::getDefaultAdapter(), 'users', 'username', 'password', "CONCAT('$this->_salt', sha(?))" ); $authAdapter->setIdentity($username) ->setCredential($password); setCredentialTreatment tells the auth adapter how to check the user supplied password against the one in the database (or whatever passwords are being checked again). In your example, the ?

Route all requests through PageController except existing controllers (Zend Framework)

旧时模样 提交于 2019-12-07 08:21:58
问题 For a new CMS i've developed a Pages module that allows me to manage the site's tree structure. Each page is reachable from the url http://www.example.com/pageslug/ where pageslug identifies the page being called. What I want to achieve now is a route that allows me to route all incoming requests to a single PagesController unless it's a request to an existing controller (like images for example). It's easy enough to catch all requests to the Pages Controller but how to exclude existing

My Zend Framework 'quoting' mess

耗尽温柔 提交于 2019-12-07 07:49:19
问题 I've got a probably very simple issue to which I can't find a satisfactory (subjectively seen) answer in the Zend Framework manual or elsewhere... There are so many ways how I can hand over my php variables to my sql queries that I lost the overview and probably I lack some understanding about quoting in general. Prepared Statements $sql = "SELECT this, that FROM table WHERE id = ? AND restriction = ?"; $stmt = $this->_db->query($sql, array($myId, $myValue)); $result = $stmt->fetchAll(); I

Zend Framework URL - How to pass a query string?

不想你离开。 提交于 2019-12-07 07:37:39
I have this link: <a href="<?php echo $this->url(array('controller'=>'index','action'=>'form'),NULL,TRUE);?>"> Form </a> With this I get something like: http://foo.com/form I need to pass a param to the URL with this link. So that I can have something like this instead: http://foo.com/form?bar=1231 How can we accomplish this ? Thanks in advance. The URL view helper is used to create links using the Routes setup with your application. If you aren't following the routes setup, then there isn't much point in using the view helper, and instead you could just append the created url you got from the

Creating own Zend_Auth_Adapter

社会主义新天地 提交于 2019-12-07 07:27:25
i am having difficulties creating my own Zend_Auth_Adapter. i am using Doctrine 2 with it also. so far i have ... code below i am getting the error Method "hasIdentity" does not exist and was not trapped in __call() whats wrong? use \Doctrine\ORM; class Application_Auth_Adapter implements Zend_Auth_Adapter_Interface { private $username; private $password; function __construct($username, $password) { $this->username = $username; $this->password = $password; } function authenticate() { $em = Zend_Registry::get('em'); $query = $em->createQuery('select u from Application\Entities\User u WHERE u

Zend db adapter mysqli or PDO_MYSQL

*爱你&永不变心* 提交于 2019-12-07 07:10:18
问题 I've seen several code samples that do this in application.ini resources.db.adapter = mysqli or resources.db.adapter = PDO_MYSQL What is the real difference between the two? Does it impact my code? when should I choose one or the other? 回答1: I developed a lot of the Zend_Db component for Zend Framework through the 1.0 release. It was the goal that the adapters function identically, or as close to it as could be supported by the PHP extension. The same set of unit tests can be run against both

How do I forward errors generated in the Bootstrap to the ErrorController?

喜你入骨 提交于 2019-12-07 07:01:26
I am using the default ErrorController that Zend Tool generated for me. The very first thing my index.php file does is to register an error handler that converts errors and warnings into exceptions: function handleError($errno, $errstr, $errfile, $errline, array $errcontext) { // error was suppressed with the @-operator if (0 === error_reporting()) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler('handleError'); I also have this set up in index.php : $front = Zend_Controller_Front::getInstance(); $front->throwExceptions(false); The problem

(Zend Framework > Zend_Config) How to avoid using .ini or .xml config?

允我心安 提交于 2019-12-07 06:48:02
问题 I don't think that using .ini or .xml file is a good idea with high traffic projects because every page load causes parsing config.ini or .xml file. Is there any way to replace using .ini/.xml with regular php array as config? Now php ini looks like that... [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 phpSettings.date.timezone = "Europe/London" includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

How to detect if iPhone has retina display or not?

南笙酒味 提交于 2019-12-07 06:14:07
问题 How can I detect if an iPhone has a retina display or not? Is there a reliable way? Either pure PHP or preferably Zend Framework way of doing this. 回答1: You must consider the fact that you are trying to get client side information on the server side. It would seem that you are unable to detect the display with pure PHP or Zend framework. It furthermore seems like the UserAgent information from the client, that you might access from PHP is based upon the OS, not the hardware, and thusly does

Getting Zend_GData Feed for a Specific Google Calendar

早过忘川 提交于 2019-12-07 05:59:50
问题 I had a long detailed question about how to get a specific calendar's event feed, but figured (I think) a solution out before I posted. However, even with the solution I'm left wondering what I'm missing about this process. To get a single calendar's event feed (or to search that feed) I do the following: Authenticate (obviously) Get a list of Calendars: getCalendarListFeed(); Get the id property from one of the 'calendar' objects Change: .../calendar/feeds/default/XXX%40YYY To: .../calendar