[fw-general] Re: Plugin Loader problem with File Upload elements

2009-03-11 Thread Tim Nagel
Sorry to reply to my own email - I've narrowed down the problem (as far as I
can see) to Zend/Form/Element/File.php.

I cant really see the exact cause though :|

Tim


[fw-general] Plugin Loader problem with File Upload elements

2009-03-11 Thread Tim Nagel
All,

I am currently using a few Zend_Form_Element_File elements in a few
different forms. Some of these forms work fine.

All of the file elements we've used so far follow the same 'code', which
I'll paste below.

The problem is occuring on one and only one of our form implementations
where I get the exception from Zend_Loader_PluginLoader:

'Plugin by name 'Upload' was not found in the registry; used paths:
Infinite_Validate_: Infinite/Validate/
Zend_Validate_: Zend/Validate/'

The exception is thrown from within isValid() call pathness/stack.

The issue disappears when reverting back to 1.7.0. I have been unable to
determin where the issue is, except that I think it has something to do with
the class being Zend_Validate_File_Upload whereas the pluginloader might be
looking for Zend_Validate_Upload ?



// $addEditForm created above (Zend_Form obj)
$addEditForm->setAttrib('enctype', 'multipart/form-data');
$aes = $addEditForm->getSubForm('addEdit');

$aes->addDisplayGroup(array('coverLetterTA', 'coverLetterFile',
'coverLetterFile_Save', 'coverLetterSaved'), 'coverletter');
$aes->addDisplayGroup(array('resumeFile', 'resumeFile_Save', 'resumeSaved'),
'resume');

//  (irrelevant stuff)

$resumePath = APPLICATION_PATH . Zend_Registry::get('config')->resourcepath
. "/resumes";
$clfile = $aes->getElement('coverLetterFile');
$rfile = $aes->getElement('resumeFile');

$clfile->setDestination($resumePath);
$clfile->addFilter(new Infinite_Filter_File_UniqueUploads('cl' .
($this->_user ? $this->_user->userID : '')));
$rfile->setDestination($resumePath);
$rfile->addFilter(new Infinite_Filter_File_UniqueUploads('r' . ($this->_user
? $this->_user->userID : '')));

if ($this->getRequest()->isPost() AND
$addEditForm->isValid($this->getRequest()->getPost())) *// FAILS HERE.*
{
 $insertData = $addEditForm->getValues();
 $this->fillRowWithData($application, $insertData['addEdit']);

 if ($insertData['addEdit']['coverLetterOpts'] == 'upload' AND
$clfile->receive())
 {
  $path = $clfile->getFileName();
  $application->coverLetterPath = $path;
 }

 if ($insertData['addEdit']['resumeOpts'] == 'upload' AND $rfile->receive())
 {
  $path = $rfile->getFileName();
  $application->resumePath = $path;
 }

 $applicationID = $application->save();
}


Re: [fw-general] Insert HTML / JS in to middle of a zend_form

2008-12-18 Thread Tim Nagel
We've been inserting all javascript after the entire form, or in the head
using the onDOMReady event provided by YUI.

Seems to work well for most things.


T

On Thu, Dec 18, 2008 at 07:59, Bart McLeod  wrote:

> you will need a decorator on your first element, with placement set to
> 'append' or a decorator on the second element, with placement set to
> 'prepend'.
>
> There is a lot on decorators in the manual and on devzone.
>
> Bart
>
> maxarbos schreef:
>
> I have been through a number of examples, but dont think I have
>> found/understand what i need to do.
>>
>> I have a form that i want the rendered html to look like this (or
>> similar):
>>
>> 
>> First Name:
>>
>> javascript:document.myform.getElementByID('first_name').value click here
>> Last Name:
>> 
>>
>>
>> I have a zend form created by:
>>
>> 
>> class My_Forms_Names extends Zend_Form{
>>
>>public function init()
>>{
>>$this->addElement('text', 'first_name', array(
>>'filters' => array('StringTrim'),
>>'validators' => array(
>>'Alpha',
>>array('StringLength', false, array(2, 50)),
>>),
>>'required' => true,
>>'label' => 'First Name',
>>'class' => 'text',
>>));
>>
>>
>>$this->addElement('text', 'last_name', array(
>>'filters' => array('StringTrim'),
>>'validators' => array(
>>'Alpha',
>>array('StringLength', false, array(2, 50)),
>>),
>>'required' => true,
>>'label' => 'Last Name',
>>'class' => 'text',
>>));
>>
>>
>>$this->addDisplayGroup(
>>array('first_name', 'last_name'),
>>'nameinfo',
>>array(
>>'disableLoadDefaultDecorators' => true,
>>'decorators' => array(
>>'FormElements',
>>array('HtmlTag',
>> array('tag'=>'ol')),
>>'Fieldset' ),
>>'legend' => 'Trips:',
>>)
>>);
>>
>>}
>> }
>> 
>>
>>
>> I want to be able to insert '
>> javascript:document.myform.getElementByID('first_name').value click here '
>> in between the two name fields.
>>
>> Any suggestions or examples would be great.
>>
>> Thank you.
>>
>>
>>
>


[fw-general] 'Normalising' of Controller and Action names

2008-12-08 Thread Tim Nagel
I am trying to create a basic content serving controller where user created
data is served using the action name as a name specified by the user.
(Overridden __call in the controller).

I have hit a bit of a snag in that it looks like Zend is normalising
(lowercasing and doing funky stuff with camelcase and underscores) action
values which isnt ideal for my situation. Is there a way to turn this
behaviour off? Or even a poke in the right direction of where its occuring?
I havent had a chance to delve into the router/front controller/dispatcher
but my quick look didnt uncover anything.



Thanks

Tim


Re: [fw-general] Controller To Controller "Forwarding"

2008-12-06 Thread Tim Nagel
See multi page forms on this manual page:
http://framework.zend.com/manual/en/zend.form.advanced.html


T

On Sat, Dec 6, 2008 at 22:08, MrBrightside <[EMAIL PROTECTED]>wrote:

>
> Hi,
>
> I have a user controller in my site which handles all actions a user can
> perform e.g:
> login
> activation
> forgot password
> etc
>
> However, my registration process is quite long and I was wondering if  I
> should split this into another controller of it's own.
> I'm not sure if that's the best solution, which would mean in my user
> controller I would have something like:
> function registerAction() {
>//code to take me to the registration controller
> }
>
> Is this the best way to do it?
> If so, what code could I use to forward from the User controller, to
> Registration controller?
>
> Thanks in advance for all the help
> --
> View this message in context:
> http://www.nabble.com/Controller-To-Controller-%22Forwarding%22-tp20868955p20868955.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] logging offending queries

2008-12-03 Thread Tim Nagel
Have you looked at the Zend_Db profiler? We use it to log queries to
FirePHP.



T

On Thu, Dec 4, 2008 at 02:25, Daniel Latter <[EMAIL PROTECTED]> wrote:

> Hi,
>
> Just an idea but you could have a base class (maybe extend
> Zend_Db_Table) and put some custom code in here that does the logging,
> that way you would only have to add the logging code in one place.
>
> just my 2p
>
> Thank You
> Daniel Latter
>
>
>
> 2008/12/2 Ralikwen <[EMAIL PROTECTED]>:
>  >
> > Hi,
> > is there a generic way to log all database calls from ZF? Or log all db
> > errors?
> >
> > I know that I can use the profiler - I use it with Firebug and it works
> > nicely with successful queries - but gives me no help when a db error
> > occurs.
> > When a db error occurs I would like to see the offending statement
> without
> > having to write spec code to every db call. Even the stack trace could
> help
> > if only it displayed the whole sql statement instead of just the
> beginning
> > of it. I searched quite a lot now but couldn't find an example of a
> generic
> > way to log sql statement or even sql errors.
> >
> > How would you do this?
> >
> > Thanks for the help.
> > SWK
> > --
> > View this message in context:
> http://www.nabble.com/logging-offending-queries-tp20800359p20800359.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
>


Re: [fw-general] Strategy for "panels" / "blocks"

2008-11-30 Thread Tim Nagel
I made a post to the mailing list last week about this exact problem: a
method of limiting certain actions (or parameters of an action) to internal
calls only.

I believe I have solved the solution by using a 'secureParam' class, as per
my reply [to my own post ;)]:
http://www.nabble.com/Securely-sending-information-between-actions-td20727566.html#a20727566.
I havent had time to try it yet, but afaik, it should work fine.

Any other guidance if anyone has any other suggestions would be appreciated.


T

On Mon, Dec 1, 2008 at 04:03, Thorsten Ruf <[EMAIL PROTECTED]> wrote:

> The main problem with view action helpers is, you (the user) can access the
> action simply by accessing the appropiate url, too. The access can not be
> restricted in any way. I was looking for a alternative to grant access only
> to "internal" access. Maybe Matthew can say something about handling such a
> requirement?
>
>
>


Re: [fw-general] Zend/Transport/Sendmail.php not auto-included - Wanted behavior?

2008-11-28 Thread Tim Nagel
You should take a look at the documentation for the Auto Loader.

http://framework.zend.com/manual/en/zend.loader.html (the quick start guide
has examples on it as well)


T

On Sat, Nov 29, 2008 at 10:24, Thomas D. <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I am new to Zend Framework.
>
> I tried to send an e-mail using Zend_Mail. I used your example [1], here's
> my code:
>
>  require_once('Zend/Mail.php');
>
> // Set-up transporter
> $tr = new Zend_Mail_Transport_Sendmail('[EMAIL PROTECTED]');
>
> $mail = new Zend_Mail();
> $mail->setBodyText('This is the text of the mail.');
> $mail->setFrom('[EMAIL PROTECTED]', 'Some Sender');
> $mail->addTo('[EMAIL PROTECTED]', 'Some Recipient');
> $mail->setSubject('TestSubject');
> $mail->send($tr);
> ?>
>
> Running this script will end in this error message:
>
> Fatal error: Class 'Zend_Mail_Transport_Sendmail' not found in
> /data/www/testweb/public_html/zendmail-test.php on line 4
>
> When I add the line
>
> require_once('Zend/Mail/Transport/Sendmail.php');
>
> before the "new Zend_Mail_Transport_Sendmail" call, everything is working.
>
> And that's the question:
> Is that a wanted behavior/design?
>
> I am new to Zend Framework, I would expect that it should be enough to just
> include "Zend/Mail.php".
>
> Also in line 723 in "Zend/Mail.php" there is a include... but it's too
> late.
>
> Actual I don't understand, why you didn't include it with the other files
> in
> line 26-41.
>
>
> See also:
> =
> [1] http://framework.zend.com/manual/en/zend.mail.html
>
>
> --
> Regards,
> Thomas
>
>
>


[fw-general] Re: Securely sending information between actions

2008-11-27 Thread Tim Nagel
Just as an addition, I just had a thought of maybe creating a 'secureParam'
object that you could use.

If i had a class that had __get/__set methods (acting as an array) I passed
as a param to the common action, I could then confirm the passed param was
an instance of that class?

Would it be possible to forge such a request?


T

On Fri, Nov 28, 2008 at 11:51, Tim Nagel <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I have been using multiple actions to build some pages by offloading
> common code to their own actions. Works great in most circumstances.
> However, I have come across a "security" issue where when I include an
> action that could reveal sensitive information depending on the conditions
> passed.
>
> If I use $this->_getParam('showDeleted', false); in the common action, so
> that I can pass showDeleted=true in the _forward or actionstack, it can also
> be included in the URL for any action that references the same common
> action.
>
> I guess each action that uses a specific common action should specifically
> set such values, but its a hassle if you've got a huge number of params
> you're sending through.
>
> So, any suggestions? I'd really love to see a way of better communicating
> between actions without relying on the request object, but I've got no idea
> how it would be done, nor how to implement such a beast. (I also remember
> someone from Zend saying that it currently cant be done, but surely some of
> you are doing something similar! :-))
>
>
>
> Thanks
>
> Tim
>


[fw-general] Securely sending information between actions

2008-11-27 Thread Tim Nagel
Hello,

I have been using multiple actions to build some pages by offloading
common code to their own actions. Works great in most circumstances.
However, I have come across a "security" issue where when I include an
action that could reveal sensitive information depending on the conditions
passed.

If I use $this->_getParam('showDeleted', false); in the common action, so
that I can pass showDeleted=true in the _forward or actionstack, it can also
be included in the URL for any action that references the same common
action.

I guess each action that uses a specific common action should specifically
set such values, but its a hassle if you've got a huge number of params
you're sending through.

So, any suggestions? I'd really love to see a way of better communicating
between actions without relying on the request object, but I've got no idea
how it would be done, nor how to implement such a beast. (I also remember
someone from Zend saying that it currently cant be done, but surely some of
you are doing something similar! :-))



Thanks

Tim


Re: [fw-general] Zend_Session and rememberMe();

2008-11-27 Thread Tim Nagel
I added the following as a test to my bootstrap: (the default, and used
namespace for Zend_Auth is 'Zend_Auth')


 $namespace = new Zend_Session_NameSpace('Zend_Auth');
 $namespace->setExpirationSeconds(32473289748392);

Where that is significantly larger than the rememberMe() call. It doesnt
work unfortunately, the cookie lifetime stays the same. Im not worried about
the session expiring, im worried about the cookie expiring.

Thanks for your suggestion though.


Tim

On Thu, Nov 27, 2008 at 14:15, Kevin McArthur <[EMAIL PROTECTED]> wrote:

> You just need to call setExpirationSeconds again.
>
>
>
>
> Tim Nagel wrote:
>
>> Hello,
>>  I am trying to set sessions to be remembered for 2 weeks. I have set
>> remember_me_seconds to 1209600. I call Zend_Session::rememberMe() once the
>> user is authenticated.
>>  Works great.
>>  The problem occurs that the cookie expiry time is never updated after
>> this point and will expire in 2 weeks regardless of how much activity. I
>> want to be able to extend this to current activity + 2 weeks, but using
>> Zend_Session::rememberMe() in the bootstrap calls regenerateId() and changes
>> the session id on every pageload which will break some code I am using that
>> needs a steady session id.
>>  The question is: IS there a way to call rememberMe() without it calling
>> regenerateId(), should I request a new feature? I know I can override the
>> session object to do what I want without too much trouble, but I believe I
>> might be missing something in my application design? How do you guys deal
>> with remembering sessions?
>>Tim
>>
>
> --
>
> Kevin McArthur
>
> StormTide Digital Studios Inc.
> Author of the recently published book, "Pro PHP"
> http://www.stormtide.ca
>
>


[fw-general] Zend_Session and rememberMe();

2008-11-26 Thread Tim Nagel
Hello,

I am trying to set sessions to be remembered for 2 weeks. I have set
remember_me_seconds to 1209600. I call Zend_Session::rememberMe() once the
user is authenticated.

Works great.

The problem occurs that the cookie expiry time is never updated after this
point and will expire in 2 weeks regardless of how much activity. I want to
be able to extend this to current activity + 2 weeks, but using
Zend_Session::rememberMe() in the bootstrap calls regenerateId() and changes
the session id on every pageload which will break some code I am using that
needs a steady session id.

The question is: IS there a way to call rememberMe() without it calling
regenerateId(), should I request a new feature? I know I can override the
session object to do what I want without too much trouble, but I believe I
might be missing something in my application design? How do you guys deal
with remembering sessions?



Tim


Re: [fw-general] ActionStack and _forward()

2008-11-16 Thread Tim Nagel
You could store something in Zend_Registry, or Zend_Cache (and then wrap the
init logic in an if statement)?


T

On Sun, Nov 16, 2008 at 09:43, drj201 <[EMAIL PROTECTED]> wrote:

>
>
> Goran Juric wrote:
> >
> >
> >
> > drj201 wrote:
> >>
> >> Hi all,
> >>
> >> Ive been following the method outlined here to add Controller specific
> >> navigation menus to my layout view:
> >>
> >> http://teethgrinder.co.uk/perm.php?a=Zend-Framework-Menus-Navigation
> >>
> >> Firstly, what is your view on this approach? Adding an actionStack call
> >> to every controller seems long winded especially if the majority use a
> >> standard menu i.e. defaultmenuAction in the NavController.
> >>
> >> Also using this method I am encountering a problem with the use of
> >> _forward() in my actions.
> >>
> >> When calling a _forward from one action to another within the same
> >> controller the menu action is added to the actionStack twice (once for
> >> initial init() and then for each forward). How would you propose I stop
> >> this easily? Is there a way of detecting if the actionStack currently
> has
> >> the call to the action in the NavController and thus doesnt add it
> again?
> >> Back to my original question... is there a better way entirely?
> >>
> >> Thanks for your help.
> >>
> >> David
> >>
> >
> >
> > Why don't you use a view helper for this task? You can define and pass
> > controller specific actions in the init() method of the controller and
> > display them in a view.
> >
> > Regards,
> >
> > Goran Juric
> > http://gogs.info/
> >
>
> Thanks for your reply. Im not sure I follow your suggestion? What are you
> proposing with the use of a view helper?
>
> Im trying to follow the example from the Zend_Layout documentation that
> states:
>
> 
>
> "As an example, let's say your code first hits
> FooController::indexAction(),
> which renders some content to the default response segment, and then
> forwards to NavController::menuAction(), which renders content to the 'nav'
> response segment. Finally, you forward to CommentController::fetchAction()
> and fetch some comments, but render those to the default response segment
> as
> well (which appends content to that segment). Your view script could then
> render each separately:
>
> 
>
>layout()->nav ?>
>
>
>layout()->content ?>
> 
>
> This feature is particularly useful when used in conjunction with the
> ActionStack action helper and plugin, which you can use to setup a stack of
> actions through which to loop, and thus create widgetized pages. "
>
> 
>
> I have this working based on an example here:
>
> http://teethgrinder.co.uk/perm.php?a=Zend-Framework-Menus-Navigation
>
> The problem is that when using a _forward() to another action within the
> same controller the init() gets called every forward thus resulting in the
> $this->_helper->actionStack('menu', 'navigation') getting called every
> time.
> This means the navigation menuAction gets rendered a number of times when
> obviously it only wants to render once...
>
> So ultimately how can I detect if the current controller init() has been
> called as the result of  a _forward() and thus then not add the menuAction
> to the stack...?
>
> Also if there is a better simplified way of doing this i'd be enlightened
> to
> know!
>
> Thanks,
>
> David
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/ActionStack-and-_forward%28%29-tp20469986p20520241.html
>  Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Zend_File_Transfer

2008-11-04 Thread Tim Nagel
Thomas,

Thanks for the response. While going through the
Zend_File_Transfer_Adapter_Abstract looking for the appropriate function, I
noticed that setDestination() is depreciated in favour of using a filter.

How do I set the destination path for the adapter if the method is
depreciated? Or, has it not yet been depreciated and I should continue to
use it until such time as the rename filter will deal with this itself?

Or am I missing something else? :-)



Tim

On Mon, Nov 3, 2008 at 18:19, Thomas Weidner <[EMAIL PROTECTED]> wrote:

> First the files are uploaded to the destination path using
> move_uploaded_file.
> This is done in background when you use receive() or any method which calls
> receive() in background.
> Afterwards the filters are applied, and the file will be renamed.
>
> The warning itself is thrown by php and means that it is not allowed to
> move (rename) the file from it's destination directory to the defined
> resourcepath.
>
> I think that even if the directory is world wide accessable, there seems to
> be a problem with the file permission itself.
> You can simply test this out, by not applying the filter and then
> rename/move the file from within the same script "manually" from the
> destination path to the resourcepath.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
>
> - Original Message - From: "Tim Nagel" <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, November 03, 2008 1:59 AM
> Subject: [fw-general] Zend_File_Transfer
>
>
>   Hello,
>>
>> I am trying to write the server side component of a file uploading form,
>> which worked fine in its previous version with nothing to do with zend.
>> (using move_uploaded_file, rather than rename())
>>
>> At this point, the front end is done and posts files as expected, the php
>> code:
>>
>>  public function imageuploadAction()
>>  {
>>  if ($this->getRequest()->isPost())
>>  {
>>   $uploadAdapter = new Zend_File_Transfer_Adapter_Http(); // TODO: change
>> to Zend_File_Transfer when the factory is stable
>>   $resourcePath = APPLICATION_PATH .
>> Zend_Registry::get('config')->resourcepath . "/images";
>>   if (!is_dir($resourcePath))
>>   {
>>throw new Exception('Savepath not found in config.ini or it isnt a
>> directory: ' . $resourcePath);
>>   }
>>
>>   $uploadAdapter->addFilter('Rename', $resourcePath);
>>   if (!$uploadAdapter->receive())
>>   {
>>$messages = $uploadAdapter->getMessages();
>>echo implode('', $messages); die;
>>//throw new Infinite_Exception_SystemError('receive returned false');
>>   }
>>   echo "redirect to edit screen"; die;
>>  }
>>  }
>>
>> Results in the file ending up in the appropriate location at the end,
>> however it results in the output:
>>
>>
>> *Warning*:
>>
>> rename(/var/tmp/AccessibleMarshal.dll,/usr/home/share/webdocs/tnagel/project/application/resources/images/filename.jpg)
>> [function.rename <http://formalcars.tnagel/ad/imageupload/function.rename>]:
>>
>> Operation not permitted in *
>>
>> /usr/home/share/webdocs/tnagel/project/library/Zend/Filter/File/Rename.php*on
>> line
>> *206*
>> redirect to edit screen
>>
>> The resource directory is world writable.
>>
>> It does seem 'safe' to ignore the warning, I assume move_uploaded_file is
>> where the file is getting copied rather than rename?
>>
>>
>> Tim
>>
>>
>


[fw-general] Zend_File_Transfer

2008-11-02 Thread Tim Nagel
Hello,

I am trying to write the server side component of a file uploading form,
which worked fine in its previous version with nothing to do with zend.
(using move_uploaded_file, rather than rename())

At this point, the front end is done and posts files as expected, the php
code:

  public function imageuploadAction()
  {
   if ($this->getRequest()->isPost())
   {
$uploadAdapter = new Zend_File_Transfer_Adapter_Http(); // TODO: change
to Zend_File_Transfer when the factory is stable
$resourcePath = APPLICATION_PATH .
Zend_Registry::get('config')->resourcepath . "/images";
if (!is_dir($resourcePath))
{
 throw new Exception('Savepath not found in config.ini or it isnt a
directory: ' . $resourcePath);
}

$uploadAdapter->addFilter('Rename', $resourcePath);
if (!$uploadAdapter->receive())
{
 $messages = $uploadAdapter->getMessages();
 echo implode('', $messages); die;
 //throw new Infinite_Exception_SystemError('receive returned false');
}
echo "redirect to edit screen"; die;
   }
  }

Results in the file ending up in the appropriate location at the end,
however it results in the output:


*Warning*:
rename(/var/tmp/AccessibleMarshal.dll,/usr/home/share/webdocs/tnagel/project/application/resources/images/filename.jpg)
[function.rename ]:
Operation not permitted in *
/usr/home/share/webdocs/tnagel/project/library/Zend/Filter/File/Rename.php*on
line
*206*
redirect to edit screen

The resource directory is world writable.

It does seem 'safe' to ignore the warning, I assume move_uploaded_file is
where the file is getting copied rather than rename?


Tim


[fw-general] Overriding Zend_Controller_Plugin_ErrorHandler

2008-10-26 Thread Tim Nagel
Hello,

I am trying to override the ErrorHandler plugin and I have run into an
issue:

I have created a plugin, Infinite_Controller_Plugin_ErrorHandler, derived
from Zend's copy, and if i register the plugin at stack position 100 (as the
current one is done in the Front Controller), I'll get an exception thrown
that there is already a plugin registered there when I dispatch.

So:

1) Am I doing it wrong? Should I be registering it earlier? 99 instead of
100? Seems an aweful waste to load 2 ErrorHandlers.
2) Should I be setting noErrorHandler to avoid the Front Controller from
creating a Zend_Controller_Plugin_ErrorHandler? Seems like this wouldnt be
the solution to me
3) Should I be overriding the Front Controller as well? Also seems a bit
much to change the ErrorHandler.
4) Is there an issue with the Plugin Broker that it is purely checking the
class type in hasPlugin, rather than checking for instanceof?
4.1) Should there be a feature or bug request to modify the dispatch
function in the Front Controller to use a class variable for where it should
look for the ErrorHandler?

Any guidance would be appreciated.


Regards
Tim


Re: [fw-general] Setting default auth object

2008-10-23 Thread Tim Nagel
You should be able to set up a guest role and assign that to any user not
logged in. Not sure how you've set up Zend_Auth and Zend_Acl, but thats what
we've been doing.

Every action we define in our projects has an ->allow() call even if
everyone is able to access it.


Tim

On Fri, Oct 24, 2008 at 09:54, tony stamp <[EMAIL PROTECTED]> wrote:

>
> Hello
>
> I have a controller that displays the latest news on the index page on my
> site. Obviously, its called newsController that has the action latestNews
> (called from the view's action helper).
>
> Now i am developing the admin side of the site, it makes sense that i put
> the add/edit/delete actions in the same newscontroller. However, if i
> define
> access rules for these actions via zend_acl, it rules out the chance of
> calling the latestAction for users not logged in.
>
> Ideally, in the acl, i would like to define something like:
> $this->allow(null, 'news', array('latest'));
> ...meaning that users with no role can only view the latestAction on the
> news controller. Futher refinement of add/edit/delete can be defined for
> mods/admins etc.
> But the above is not possible, so i (think) i have two options - split the
> functionality into two separate controllers - a latest news controller
> (containing just the latestAction), accessible by non-logged in users,
> followed by a news manager type of controller (for the crud actions for
> logged in users) which is governed by the acl.
>
> Alternatively, if there is a way of setting a sort of base credential using
> zend_auth ie guest or siteVisitor, which can then be defined to view only
> the latestAction on a single news controller?
>
> hmmm...
> --
> View this message in context:
> http://www.nabble.com/Setting-default-auth-object-tp20141150p20141150.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] How do I factor out tasks common to every action controller?

2008-10-15 Thread Tim Nagel
Sorry my mistake, I need to learn how to read better ;)

On Thu, Oct 16, 2008 at 12:04, Tim Nagel <[EMAIL PROTECTED]> wrote:

>  I created my own controller, derived from Zend_Controller_Action, calling
> it Tim_Controller_Action and all of my controllers derive from my
> controller. (putting it in Library/Tim/Controller/Action.php)
>
> Dont forget to call parent::init(); if you override the init in the real
> controllers.
>
>   On Thu, Oct 16, 2008 at 10:15, gerardroche <[EMAIL PROTECTED]>wrote:
>
>>
>> you could do it in your bootstrap.
>>
>>
>>
>>
>> Steven Szymczak wrote:
>> >
>> > Every one of my action controllers has an init() function that pulls a
>> > config object from the registry and uses it to set some paths used
>> > throughout the site (e.g.):
>> >
>> > public function init() {
>> >   $view_cfg = Zend_Registry::get('SITE_CFG');
>> >
>> >   $this->view->__set('pubImages', $view_cfg->dirs->images);
>> >   $this->view->__set('jsDir', $view_cfg->dirs->js);
>> >   $this->view->__set('cssDir', $view_cfg->dirs->css);
>> > }
>> >
>> > How can factor out this functionality without resorting to a parent
>> > class for all my action controllers?  I seem to recall a similar post to
>> > the list, several months ago, that suggested utilizing a helper
>> somehow...
>> >
>> > Suggestions?
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-do-I-factor-out-tasks-common-to-every-action-controller--tp20003502p20004290.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>


Re: [fw-general] How do I factor out tasks common to every action controller?

2008-10-15 Thread Tim Nagel
I created my own controller, derived from Zend_Controller_Action, calling it
Tim_Controller_Action and all of my controllers derive from my controller.
(putting it in Library/Tim/Controller/Action.php)

Dont forget to call parent::init(); if you override the init in the real
controllers.

On Thu, Oct 16, 2008 at 10:15, gerardroche <[EMAIL PROTECTED]> wrote:

>
> you could do it in your bootstrap.
>
>
>
>
> Steven Szymczak wrote:
> >
> > Every one of my action controllers has an init() function that pulls a
> > config object from the registry and uses it to set some paths used
> > throughout the site (e.g.):
> >
> > public function init() {
> >   $view_cfg = Zend_Registry::get('SITE_CFG');
> >
> >   $this->view->__set('pubImages', $view_cfg->dirs->images);
> >   $this->view->__set('jsDir', $view_cfg->dirs->js);
> >   $this->view->__set('cssDir', $view_cfg->dirs->css);
> > }
> >
> > How can factor out this functionality without resorting to a parent
> > class for all my action controllers?  I seem to recall a similar post to
> > the list, several months ago, that suggested utilizing a helper
> somehow...
> >
> > Suggestions?
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-do-I-factor-out-tasks-common-to-every-action-controller--tp20003502p20004290.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] I can't access other controllers

2008-10-14 Thread Tim Nagel
Have you set up the rewrites properly?

On Wed, Oct 15, 2008 at 16:54, Bobby703 <[EMAIL PROTECTED]> wrote:

>
> Hi all,
>
> I just start learning zend and created a very simple hello world app.
> So when I access http://localhost/zendtest/web_root, it will go to default
> indextAction of IndexController
> That works.
> However, I can get my TestController working as when I access
> http://localhost/zendtest/web_root/test
> it should go to find TestController and indextAction inside it. But I got
> "Not Found
> The requested URL /zendtest/web_root/test was not found on this server."
>
> It should map this url to TestController and indexAction, shouldn't it? I
> tried to creat and access other
> controllers other than IndexController, they did not work at all. It seems
> only the default IndexController works
> for me and all actions in IndexController work too. What is the cause? Did
> I
> miss anything? I can only use IndexController so far.
> Other controllers I created all return "Not Found" error messages.
> I can't figure out why the other controllers dont work as I can see they
> are
> in the controllers dir and I typed in the right url which should be mapped
> to them.
> Why it always complains "Not Found"? Anyone can give me some ideas?
>
> Sorry, it might be a very easy question  but I am new to Zend Framework.
> Thank you very much in advance.
>
>
>
> Here is my index.php in my web_root
>
> 
> date_default_timezone_set('Australia/Sydney');
>
> set_include_path('../library'.PATH_SEPARATOR.'../application/models/'.PATH_SEPARATOR.get_include_path());
> require_once"Zend/Loader.php";
> Zend_Loader::registerAutoload();
>
> $frontController=Zend_Controller_Front::getInstance();
> $frontController->setControllerDirectory('../application/controllers');
> $frontController->setBaseUrl('/zendtest/web_root');
> $frontController->throwExceptions(true);
>
> try{
>$frontController->dispatch();
> }catch(Exception $e){
>echo nl2br($e->__toString());
> }
>
>
> Here is my .htaccess file
>
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} -s [OR]
> RewriteCond %{REQUEST_FILENAME} -l [OR]
> RewriteCond %{REQUEST_FILENAME} -d
> RewriteRule ^.*$ - [NC,L]
> RewriteRule ^.*$ index.php [NC,L]
>
> I created two controllers which are IndexController.php and
> TestController.php  They are identical and just have indexAction functions
> inside.
>
>  class IndexController extends Zend_Controller_Action
> {
>
>public function indexAction()
>{
>
>
>}
>
> }
>
>  class TestController extends Zend_Controller_Action
> {
>
>public function indexAction()
>{
>
>
>}
>
> }
>
> Here is the index.phtml under /views/test dir
>
> This is a test page.
>
>
>
>
> My web root is /var/www/zendtest/web_root
> The dir structure under /var/www/zendtest is as follow:
> ./application
> /controllers
>IndexController.php
>TestController.php
> /models
> /views
>/helpers
>/layouts
>/scripts
>/index
>index.phtml
>/test
>index.phtml
> ./library
>/Zend
> ./web_root
>/css
>/img
>/js
>index.php
>.htaccess
>
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/I-can%27t-access-other-controllers-tp19987183p19987183.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>