Re: [fw-general] Including Models

2007-06-24 Thread depace

may be you cud use something like this.. in your bootstrap

define('_PATH_MODEL','path/to/model/');// you cud put this in ur config file
or something.. .


/* load Zend Loader */
include_once('Zend/Loader.php');

/* auto load classes */
function __autoload($_class)
{
   try {
   Zend_Loader::loadClass($_class, array(_PATH_MODEL,_OTHER_PATHS));

   } catch (Exception $e) {}
}



On 6/24/07, delsvr <[EMAIL PROTECTED]> wrote:



There are a lot of general, philosophical posts discussing this topic, but
I
haven't found a real answer to this problem, yet.

My directory structure looks something like this:

app
  -modules
-module1
  -controllers
  -models
  -views
-module2
  (etc.)
html
  -index.php (bootstrap)
library

How should I go about adding the models directory to my include path? The
path is set during bootstrap, and it currently includes: './' and
'../library'. For the time-being I've created a "models" directory under
"app," and I've added '../app/models' to the path, but this is not
desirable.

I'm trying to use include models in a controller, under the "controller"
directory, that would look something like:

include_once('../models/Model.php');

and that would reference the model under that specific module's directory.

Thanks,
delsvr
--
View this message in context:
http://www.nabble.com/Including-Models-tf3970638s16154.html#a11270727
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] setting up app dirs is too much work, so...

2007-06-15 Thread depace

may be we can share our ideas...

On 6/16/07, depace <[EMAIL PROTECTED]> wrote:


i was trying to make something similar... actually was inspired by ror
 :-)
may be i'll finish with my first release tomorrow ... too much
distractions with call of duty in our network rite now :-)
actually i was trying to make my life easier basically when creating
modules
so from one place... add module name in bootstrap, create default module
cotnroller and views..
it will also create model for this module... a view file as well.. so that
you can start with ur customising rite away






On 6/15/07, David Mintz < [EMAIL PROTECTED]> wrote:
>
> Someone has probably already done something like this, probably better,
> but if not -- enjoy.
>
> #!/bin/bash
> #
> # zfsetup.sh
> #
> # sets up directory structure and some starter files for a new Zend
> Framework application.
> # first chdir into the dir under which you want to install the app
> files, then run me.
> # by DMintz, in humble gratitude. http://davidmintz.org/
> #
>
> if [ $# -ne 1 ]; then
> echo "usage: $0 app_name" 1>&2
> exit 1
> fi
>
> if [ ! -w . ]; then
> echo "you don't have write permission to `pwd`."
> exit 1;
> fi
>
> mkdir $1
> cd $1
>
> # make directories
> mkdir controllers models views
>
> # write an IndexController class
> cat <controllers/IndexController.php
>  require_once 'Zend/Controller/Action.php';
>
> class IndexController extends Zend_Controller_Action
> {
> public function indexAction()
> {
> }
> }
> EOF
>
> # make more directories
> mkdir views/scripts
> mkdir views/scripts/index
> mkdir views/scripts/error
> mkdir views/helpers
> mkdir views/filters
>
>
> # write out an index.phtml view for indexAction()
>
> cat <views/scripts/index/index.phtml
>  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> 
"http://www.w3.org/TR/xhtml1<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>/DTD/xhtml1-strict.dtd<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
> ">
> 
> 
>   
>   My first Zend Framework App
> 
> 
> Hello, World!
> We are ready to rock.
> 
> 
> EOF
>
> # write an ErrorController
>
> cat <controllers/ErrorController.php
>  /** Zend_Controller_Action */
> require_once 'Zend/Controller/Action.php';
>
> class ErrorController extends Zend_Controller_Action
> {
> public function errorAction()
> {
> }
> }
>
> EOF
>
> # write an ErrorController class
>
> cat <controllers/ErrorController.php
>
>  /** Zend_Controller_Action */
> require_once 'Zend/Controller/Action.php';
>
> class ErrorController extends Zend_Controller_Action
> {
> public function errorAction()
> {
> }
> }
>
> EOF
>
>
> cat <views/scripts/error/error .phtml
>
>  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> " 
http://www.w3.org/TR/xhtml1<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
> /DTD/xhtml1-strict.dtd<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
> ">
> 
> 
>   
>   Error
> 
> 
> An error occurred
> An error occurred; please try again later.
> 
> 
> EOF
>
>
> # write a bootstrap file
>
> CONTROLLER_PATH=`pwd`/controllers
>
> cat <index.php
>
>  require_once 'Zend/Controller/Front.php';
> Zend_Controller_Front::run('$CONTROLLER_PATH');
> EOF
>
> # ... and a .htaccess
>
> cat <.htaccess
> RewriteEngine on
> RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
> EOF
>
> # move both index.ph and .htaccess to the web root dir
>
> echo -n "Enter the full filesystem path to your web doc root (w/o
> trailing slash): ";
> read WEB_ROOT
>
> if mv .htaccess index.php $WEB_ROOT/ ;
> then
> echo "now just hit http://yoursite/ and see if it works!"
> else
> exit 1
> fi;
> exit 0;
>
>
>
> --
> David Mintz
> http://davidmintz.org/
>
> Just a spoonful of sugar helps the medicine go down
> In a most delightful way.






Re: [fw-general] setting up app dirs is too much work, so...

2007-06-15 Thread depace

i was trying to make something similar... actually was inspired by ror  :-)
may be i'll finish with my first release tomorrow ... too much distractions
with call of duty in our network rite now :-)
actually i was trying to make my life easier basically when creating
modules
so from one place... add module name in bootstrap, create default module
cotnroller and views..
it will also create model for this module... a view file as well.. so that
you can start with ur customising rite away




On 6/15/07, David Mintz <[EMAIL PROTECTED]> wrote:


Someone has probably already done something like this, probably better,
but if not -- enjoy.

#!/bin/bash
#
# zfsetup.sh
#
# sets up directory structure and some starter files for a new Zend
Framework application.
# first chdir into the dir under which you want to install the app files,
then run me.
# by DMintz, in humble gratitude. http://davidmintz.org/
#

if [ $# -ne 1 ]; then
echo "usage: $0 app_name" 1>&2
exit 1
fi

if [ ! -w . ]; then
echo "you don't have write permission to `pwd`."
exit 1;
fi

mkdir $1
cd $1

# make directories
mkdir controllers models views

# write an IndexController class
cat 
/DTD/xhtml1-strict.dtd 
">


  
  My first Zend Framework App


Hello, World!
We are ready to rock.


EOF

# write an ErrorController

cat 
/DTD/xhtml1-strict.dtd 
">


  
  Error


An error occurred
An error occurred; please try again later.


EOF


# write a bootstrap file

CONTROLLER_PATH=`pwd`/controllers

cat 

Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-13 Thread depace

thank you guys..
lets c wat can be done..
at the moment the best way i can see is through education...
i hope that doesn't end up bring a guerrilla  :-)


[fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread depace

This sounds little stupid but if it is possible then it will save my ass
being skinned..

the problem is while working in a team... the programmers instead of
displaying the data through template they have a habit of echoing from the
method itself...
have to trace where are all those crazy echosss .
so it has been a lil pain in ass ...

it really is a pain to make people work in MVC .. dunno why is it so hard
for people to understand it..


Re: [fw-general] Controller problem 0.8.0

2007-05-17 Thread depace

hello guys

i got another problem with isapi_rewrite..

i have a rule to redirect everything to index.php file..  this works fine..
but when i pass on a query string.. it gives 404 error

[ISAPI_Rewrite]

RepeatLimit 20
RewriteRule ^[\w/\%]*(?:\.(?!(?:js|ico|gif|jpg|png|css|swf)$)[\w\%]*$)?
/index.php [I]


Re: [fw-general] Registry object

2007-03-21 Thread depace

ok guys i have one question...
please let me know if its possible or not...  (in ZF 0.9 beta)

I want to initialize object in one controller and want to use it in another
... is it possible??/

AbcController:
$obj_abc = new AbcClass();
$obj_abc->doSomething();
Zend_Registry::set('obj',$obj_abc);
(Works if i move this to boostrap file and if i call from some controller)

XyzController:
$obj_abc = Zend_Registry::get('obj');





On 12/19/06, Gavin Vess <[EMAIL PROTECTED]> wrote:


Try "$registry = Zend::registry();"

Moving discussion to [EMAIL PROTECTED]

Fábio T. da Costa wrote:
> Zend_Registry :: getInstance() not work in 0.6.
> The tutorial " AJAX Chat Tutorial" not work:
> http://devzone.zend.com/node/view/id/1387
>
>
> Bill Karwin wrote:
>
>> Yann Nave wrote:
>>
>>> I would like to use Registry object, But it seems not in 0.6 preview.
>>>
>> Zend_Registry moved from incubator to core in 0.6
--
Cheers,
Gavin

Which ZF List?
=
Everything, except the topics below: fw-general@lists.zend.com

Authorization, Authentication, ACL, Access Control, Session Management
[EMAIL PROTECTED]

Tests, Caching, Configuration, Environment, Logging
[EMAIL PROTECTED]

All things related to databases
[EMAIL PROTECTED]

Documentation, Translations, Wiki Manual / Tutorials
[EMAIL PROTECTED]

Internationalization & Localization, Dates, Calendar, Currency, Measure
[EMAIL PROTECTED]

Mail, MIME, PDF, Search, data formats (JSON, ...)
[EMAIL PROTECTED]

MVC, Controller, Router, Views, Zend_Request*
[EMAIL PROTECTED]

Community Servers/Services (shell account, PEAR channel, Jabber)
[EMAIL PROTECTED]

Web Services & Servers (HTTP, SOAP, Feeds, XMLRPC, REST)
[EMAIL PROTECTED]


How to un/subscribe:  http://framework.zend.com/wiki/x/GgE





Re: [fw-general] Routing

2007-03-15 Thread depace

Hello guys,

we have one strange problem win zf 0.8...

i'm using module based structure... and everything working fine..
but the problem is everytime its looking for modules...

for example..

host.com/abc/
host.com/xyz/
host.com/ppp/

here abc, and xyz are module names
and are working kul... but the third one ppp is a PppController.php in the
main controller directory...

everytime i access host.com/ppp/ it looks for module name ppp and give
exception (the module ppp not found).

can anybody help in this ...

thanx...


Re: [fw-general] Controller problem 0.8.0

2007-03-14 Thread depace

umm

thankx guys..

i found out one solution...

i just added unset($_SERVER['REQUEST_URI']);
in the index.php file.. and things work kul in IIS...


[fw-general] Controller problem 0.8.0

2007-03-12 Thread depace

Hi..

i'm using zf 0.8.0 and i ran into a strange problem when deploying into an
IIS 6 server...

i'm using ISAPI_rewrite...

the problem is , only the indexController is called for no matter wat url

for example even if i type http://host/controller_1/action_1/ ... only the
default controller is called  :-(

can somebody please tell me what mistakes i have done here...

thankx..

my httpd.ini file

[ISAPI_Rewrite]

RepeatLimit 20
RewriteRule ^[\w/\%]*(?:\.(?!(?:js|ico|gif|jpg|png|css)$)[\w\%]*$)?
/index.php [I]

index.php

setControllerDirectory( "./controllers/" );


   try {
   $objZend->throwExceptions(true);
   $objZend->dispatch();
   } catch (Exception $e) {
   header('Location: '._URL.'errors/');
   //echo $e->getMessage();
   die();
   }
?>


[fw-general] Zend_Search & controllers

2007-03-02 Thread depace

Hi,

I'm new with Zend_Search but have been using zf since 0.1 preview ...
never had a requirement to use zend seach :-)

for couple of days i'm going thru the mailing list and zf manual .. but
still i can't get my head straight...

insize ZendFramework-0.8.0\demos\Zend\Search there is a
CreateIndex.phpfile going thru the file ... in order to index  i
have to give the
source folder name where the pages are...
but my application doesn't have any folder.. its in mvc with controlers n'
actions n' view (i've replace with smarty) ..

so now confusion is how i can create an index of my site ?? :-o

i'm on a suicide mission now !!!


Re: [fw-general] Zend Session issues

2007-01-25 Thread depace
  $str_hash=
md5($str_username.$this->_hash_key.$_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR']);

   /* add md5 hash string in session */
   $this->setValue('_s_hash',$str_hash);

   /* return true */
   return true;
   }
   }

   /**
* perform logout
* delete session namespace with its content and also delete user
agent's session id cookie
*
* @return true
*/
   public function logout()
   {
   /* unset entire session namespace and its contents */
   Zend_Session_Core::namespaceUnset($this->_namespace);

   /**
* it complements rememberMe() by changing the session cookie
back to a lifetime
* ending when the user agent ends its session (i.e. user closes
their browser window)
*/
   Zend_Session_Core::forgetMe();

   /**
* destroys all the persistent data assiciated with the current
session.
* remove session namespace and also delete user agent's session
id cookie
*/
   Zend_Session_Core::destroy(true,true);

   /* return true */
   return true;
   }

   public function authenticate()
   {
   /* get username from session */
   $str_username=$this->getValue('_s_username');

   /* check md5 hash string */
   $str_hash=
md5($str_username.$this->_hash_key.$_SERVER['HTTP_USER_AGENT'].$_SERVER['REMOTE_ADDR']);

   /* check if this md5 hash string is same as in session or not */
   /* if yes, continue */
   /* if no, end session and force the user to login again
(redirect to login screen) */
   if ($str_hash != $this->getValue('_s_hash')) {
   /* end session */
   $this->logout();

   /* redirect to login screen */
   /* TODO */
   echo "login again";die();
   }
   else {
   return true;
   }
   }

   /**
* class destructor
*
*/
   public function __destruct()
   {
   /* do nothing */
   }
   } /* end of clas */
?>


On 1/25/07, Gavin Vess <[EMAIL PROTECTED]> wrote:


Moving discussion to fw-auth.

Hi Depace,

Is there a specific section, paragraph, or example that is confusing?

For each risk relating to session hijacking and session fixation, a
suggestion has been included in the manual to minimize the risk.  I've
scanned through docs, and added additional content (
http://framework.zend.com/wiki/x/ikI ), which will become live within an
hour.  For example, avoiding XSS vulnerabilities helps preventing
session hijacking:
  http://en.wikipedia.org/wiki/Cross_site_scripting

As another example, the risk posed by sharing "save_path" between PHP
applications is addressed by simply setting the save_path to a unique
value for each PHP application, where the value corresponds to a
protected directory that can not be read or viewed by potential
attackers, just like we protect our home directories on shared web hosts
by removing world read/write/execute permissions.

We do not yet have an official tutorial for the Zend Framework at the
moment that covers Zend_Session, although this is planned :)

I do not like to give the following summary without the detailed
explanations in the manual, since security precautions often depend on
the circumstances, and "one size" certainly does not work for everyone.
Briefly, we could summarize one possible scenario with:

myapp.ini
===
[sandbox : live]
save_path = /some/thing/protected/from/other/apps/and/user

name = name_unique_to_your_installed_app_and_server

use_only_cookies = on
remember_me_seconds = 864000


/index.php

require_once 'Zend/Session.php';

$config = new Zend_Config_Ini('myapp.ini', 'sandbox');
require_once 'Zend/Session.php';
Zend_Session_Core::setOptions($config->asArray());

Zend_Session_Core::regenerateId(); // more bandwidth, but extra cautious


In actions
==
$userProfileNamespace = new Zend_Session('profile');
echo $userProfileNamespace->name;
$userProfileNamespace->lastRequest = time();
// etc.


depace wrote:
> hi
> is there a good tutorial for zend_session which also shows how to
> protect against the session hijacking (security)?
> zf manual is very confusing... and i'm confused how to use it.
>
> thankx
--
Cheers,
Gavin

Which ZF List?
=
Everything, except the topics below: fw-general@lists.zend.com

Authorization, Authentication, ACL, Access Control, Session Management
[EMAIL PROTECTED]

Tests, Caching, Configuration, Environment, Logging
[EMAIL PROTECTED]

All things related

Re: [fw-general] Zend Session issues

2007-01-24 Thread depace

hi
is there a good tutorial for zend_session which also shows how to protect
against the session hijacking (security)?
zf manual is very confusing... and i'm confused how to use it.

thankx