Changeset 56
- Timestamp:
- 05/30/08 09:40:43
- Files:
-
- trunk/apps/main/config/mainConfiguration.class.php (modified) (1 diff)
- trunk/apps/main/config/settings.yml (modified) (5 diffs)
- trunk/apps/main/lib/FormTemplateListener.class.php (added)
- trunk/apps/main/modules/applications/actions/actions.class.php (modified) (16 diffs)
- trunk/apps/main/modules/applications/templates/_filterForm.php (modified) (2 diffs)
- trunk/apps/main/modules/applications/templates/_form.php (modified) (5 diffs)
- trunk/apps/main/modules/applications/templates/addSuccess.php (modified) (1 diff)
- trunk/apps/main/modules/mail/actions/actions.class.php (modified) (1 diff)
- trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php (modified) (6 diffs)
- trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php (modified) (1 diff)
- trunk/apps/main/modules/sfGuardAuth/templates/resendActivationSuccess.php (modified) (1 diff)
- trunk/apps/main/templates/_messages.php (modified) (1 diff)
- trunk/apps/main/templates/layout.php (modified) (1 diff)
- trunk/config/app.yml-dist (modified) (3 diffs)
- trunk/lib/form/BaseFormPropel.class.php (modified) (1 diff)
- trunk/lib/form/application (added)
- trunk/lib/form/application/ApplicationCompanyForm.class.php (moved) (moved from trunk/lib/form/ApplicationCompanyForm.class.php)
- trunk/lib/form/application/ApplicationDeveloperForm.class.php (moved) (moved from trunk/lib/form/ApplicationDeveloperForm.class.php)
- trunk/lib/form/application/ApplicationForm.class.php (moved) (moved from trunk/lib/form/ApplicationForm.class.php) (2 diffs)
- trunk/lib/form/blog (added)
- trunk/lib/form/blog/BlogPostForm.class.php (moved) (moved from trunk/lib/form/BlogPostForm.class.php)
- trunk/lib/form/company (added)
- trunk/lib/form/company/CompanyForm.class.php (moved) (moved from trunk/lib/form/CompanyForm.class.php)
- trunk/lib/form/company/CompanyPersonForm.class.php (moved) (moved from trunk/lib/form/CompanyPersonForm.class.php)
- trunk/lib/form/event (added)
- trunk/lib/form/event/EventForm.class.php (moved) (moved from trunk/lib/form/EventForm.class.php)
- trunk/lib/form/job (added)
- trunk/lib/form/job/JobForm.class.php (moved) (moved from trunk/lib/form/JobForm.class.php)
- trunk/lib/form/localEvent (added)
- trunk/lib/form/localEvent/LocalEventForm.class.php (moved) (moved from trunk/lib/form/LocalEventForm.class.php)
- trunk/lib/form/sfFormReCaptcha.class.php (added)
- trunk/lib/form/user/RecommendationForm.class.php (moved) (moved from trunk/lib/form/RecommendationForm.class.php)
- trunk/lib/form/user/RegisterForm.class.php (modified) (1 diff)
- trunk/lib/form/user/ResendActivationForm.class.php (modified) (2 diffs)
- trunk/lib/form/user/SigninForm.class.php (modified) (1 diff)
- trunk/lib/helper/jQueryDateHelper.php (deleted)
- trunk/lib/validator/sfValidatorBlacklist.class.php (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/apps/main/config/mainConfiguration.class.php
r48 r56 5 5 public function configure() 6 6 { 7 require_once(dirname(__FILE__).'/../lib/FormTemplateListener.class.php'); 8 FormTemplateListener::register($this->dispatcher); 7 9 } 8 10 } trunk/apps/main/config/settings.yml
r49 r56 7 7 dev: 8 8 .settings: 9 error_reporting: <?php echo E_ALL | E_STRICT."\n"?>9 error_reporting: <?php echoln(E_ALL | E_STRICT) ?> 10 10 web_debug: on 11 11 cache: off … … 15 15 search: 16 16 .settings: 17 error_reporting: <?php echo E_ALL | E_STRICT."\n"?>17 error_reporting: <?php echoln(E_ALL | E_STRICT) ?> 18 18 web_debug: off 19 19 cache: off … … 23 23 staging: 24 24 .settings: 25 error_reporting: <?php echo E_ALL | E_STRICT."\n"?>25 error_reporting: <?php echoln(E_ALL | E_STRICT) ?> 26 26 web_debug: on 27 27 cache: on … … 31 31 test: 32 32 .settings: 33 error_reporting: <?php echo E_ALL | E_STRICT & ~E_NOTICE."\n"?>33 error_reporting: <?php echoln(E_ALL | E_STRICT & ~E_NOTICE) ?> 34 34 cache: on 35 35 web_debug: off … … 66 66 enabled_modules: [cryptographp, sfGuardAuth, sfLucene] 67 67 charset: utf-8 68 csrf_secret: symf0n14n5 trunk/apps/main/modules/applications/actions/actions.class.php
r48 r56 9 9 { 10 10 11 public function executeAdd() 12 { 13 $this->application = new Application(); 14 if ($this->getRequest()->getMethod() == sfRequest::POST) 15 { 16 $this->updateFromRequest(); 17 parent::purgeObjectRelatedCache($this->application); 11 public function executeAdd(sfWebRequest $request) 12 { 13 $this->form = new ApplicationForm(); 14 15 if ($request->isMethod('post') && $this->form->bindAndSave($request->getParameter('application'))) 16 { 17 //$this->updateFromRequest(); 18 parent::purgeObjectRelatedCache($this->form->getObject()); 18 19 $this->getUser()->setFlash('notice', $this->__('Application added')); 19 20 $this->getUser()->setAttribute('from_app_creation', true, 'symfonians'); … … 22 23 } 23 24 24 public function executeCountries( )25 public function executeCountries(sfWebRequest $request) 25 26 { 26 27 $this->countries = ApplicationPeer::retrieveCountriesWithCount(); 27 28 } 28 29 29 public function executeEdit( )30 public function executeEdit(sfWebRequest $request) 30 31 { 31 32 $this->application = $this->getFromSlug(); … … 37 38 } 38 39 39 if ($ this->getRequest()->getMethod() == sfRequest::POST)40 if ($request->isMethod('post')) 40 41 { 41 42 $this->updateFromRequest(); … … 47 48 } 48 49 49 public function executeEditCompanyConnection( )50 public function executeEditCompanyConnection(sfWebRequest $request) 50 51 { 51 52 $this->application = $this->getFromSlug(); … … 53 54 $this->forward404Unless($this->connection, 'ApplicationCompany not found'); 54 55 55 if ($ this->getRequest()->getMethod() == sfRequest::POST)56 if ($request->isMethod('post')) 56 57 { 57 58 $this->updateCompanyConnectionFromRequest(); … … 67 68 } 68 69 69 public function executeEditDeveloperConnection( )70 public function executeEditDeveloperConnection(sfWebRequest $request) 70 71 { 71 72 $this->application = $this->getFromSlug(); … … 73 74 $this->forward404Unless($this->connection, 'ApplicationDeveloper not found'); 74 75 75 if ($ this->getRequest()->getMethod() == sfRequest::POST)76 if ($request->isMethod('post')) 76 77 { 77 78 $this->updateDeveloperConnectionFromRequest(); … … 87 88 } 88 89 89 public function executeConnectAsCompany( )90 public function executeConnectAsCompany(sfWebRequest $request) 90 91 { 91 92 $this->connection = new ApplicationCompany(); … … 101 102 102 103 // Form has been submitted 103 if ($ this->getRequest()->getMethod() == sfRequest::POST)104 if ($request->isMethod('post')) 104 105 { 105 106 $this->updateCompanyConnectionFromRequest(); … … 113 114 } 114 115 115 public function executeConnectAsDeveloper( )116 public function executeConnectAsDeveloper(sfWebRequest $request) 116 117 { 117 118 $this->connection = new ApplicationDeveloper(); … … 130 131 131 132 // Form has been submitted 132 if ($ this->getRequest()->getMethod() == sfRequest::POST)133 if ($request->isMethod('post')) 133 134 { 134 135 $this->updateDeveloperConnectionFromRequest(); … … 142 143 } 143 144 144 public function executeDelete( )145 public function executeDelete(sfWebRequest $request) 145 146 { 146 147 $this->application = $this->getFromSlug(); … … 158 159 } 159 160 160 public function executeDetails( )161 public function executeDetails(sfWebRequest $request) 161 162 { 162 163 $this->application = $this->getFromSlug(); … … 194 195 } 195 196 196 public function executeHome( )197 public function executeHome(sfWebRequest $request) 197 198 { 198 199 $pager_route_params = array(); … … 246 247 } 247 248 248 public function executePromote( )249 public function executePromote(sfWebRequest $request) 249 250 { 250 251 $this->application = $this->getFromSlug(); … … 261 262 } 262 263 263 public function executeTags( )264 public function executeTags(sfWebRequest $request) 264 265 { 265 266 $c = new Criteria; trunk/apps/main/modules/applications/templates/_filterForm.php
r50 r56 1 1 <form action="<?php echo url_for('@application_home') ?>" method="get" id="country_form"> 2 <?php /* 2 3 <p> 3 < ?php echo label_for('country', __('Filter by country')) ?>4 <label for="country"><?php echo __('Filter by country') ?></label> 4 5 <?php echo select_tag('country', 5 6 options_for_select($countries, … … 14 15 <?php echo submit_tag(__('Filter')) ?> 15 16 </p> 17 */ ?> 16 18 </form> trunk/apps/main/modules/applications/templates/_form.php
r50 r56 1 <?php use_helper('Object', 'Validation' , 'jQueryDate') ?>1 <?php use_helper('Object', 'Validation') ?> 2 2 3 3 <?php echo breadcrumb(array(array(__('Applications'), '@application_home'), … … 14 14 <fieldset> 15 15 <legend><?php echo __('Application informations') ?></legend> 16 <?php echo $form ?> 17 <?php /* 16 18 <div class="form-row required"> 17 19 <label for="name"><?php echo __('Application name') ?></label> … … 34 36 <?php echo form_error('application[tags]') ?> 35 37 </div> 38 */ ?> 36 39 </fieldset> 37 40 </div> … … 39 42 <fieldset> 40 43 <legend><?php echo __('Other informations') ?></legend> 44 <?php /* 41 45 <div class="form-row"> 42 46 <label for="country"><?php echo __('Country') ?></label> … … 76 80 <?php echo form_error('application[released_at]') ?> 77 81 </div> 82 */ ?> 78 83 </fieldset> 79 84 </div> 80 85 <div class="form-row" style="text-align:center;clear:left;"> 81 86 <p> 82 < ?php echo submit_tag($submit_label) ?>87 <input type="submit" value="<?php echo $submit_label ?>" /> 83 88 </p> 84 89 </div> trunk/apps/main/modules/applications/templates/addSuccess.php
r2 r56 5 5 6 6 <?php include_partial('applications/form', 7 array('application' => $application, 7 array('application' => $application, 8 'form' => $form, 8 9 'title' => $page_title, 9 10 'form_route' => '@application_add', trunk/apps/main/modules/mail/actions/actions.class.php
r2 r56 9 9 { 10 10 11 public function executeContact( )11 public function executeContact(sfWebRequest $request) 12 12 { 13 $this->message = $ this->getRequest()->getAttribute('message');13 $this->message = $request->getAttribute('message'); 14 14 } 15 15 16 public function executeForgotPassword( )16 public function executeForgotPassword(sfWebRequest $request) 17 17 { 18 $this->password = $ this->getRequest()->getAttribute('password');18 $this->password = $request->getAttribute('password'); 19 19 } 20 20 21 public function executeRegister( )21 public function executeRegister(sfWebRequest $request) 22 22 { 23 $this->user = $ this->getRequest()->getAttribute('user');24 $this->activation = $ this->getRequest()->getAttribute('activation');23 $this->user = $request->getAttribute('user'); 24 $this->activation = $request->getAttribute('activation'); 25 25 } 26 26 27 public function executeResendActivation( )27 public function executeResendActivation(sfWebRequest $request) 28 28 { 29 $this->activation = $ this->getRequest()->getAttribute('activation');29 $this->activation = $request->getAttribute('activation'); 30 30 } 31 31 32 public function executeCompanyContact( )32 public function executeCompanyContact(sfWebRequest $request) 33 33 { 34 34 $this->user = $this->getUser()->getGuardUser(); 35 $this->message = $ this->getRequest()->getAttribute('message');36 $this->company = $ this->getRequest()->getAttribute('company');35 $this->message = $request->getAttribute('message'); 36 $this->company = $request->getAttribute('company'); 37 37 } 38 38 39 public function executePersonContact( )39 public function executePersonContact(sfWebRequest $request) 40 40 { 41 41 $this->user = $this->getUser()->getGuardUser(); 42 $this->recipient = $ this->getRequest()->getAttribute('recipient');43 $this->message = $ this->getRequest()->getAttribute('message');42 $this->recipient = $request->getAttribute('recipient'); 43 $this->message = $request->getAttribute('message'); 44 44 } 45 45 46 public function executeRecommendationReceived( )46 public function executeRecommendationReceived(sfWebRequest $request) 47 47 { 48 $this->recommender = $ this->getRequest()->getAttribute('recommender');49 $this->recommended = $ this->getRequest()->getAttribute('recommended');50 $this->recommendation = $ this->getRequest()->getAttribute('recommendation');48 $this->recommender = $request->getAttribute('recommender'); 49 $this->recommended = $request->getAttribute('recommended'); 50 $this->recommendation = $request->getAttribute('recommendation'); 51 51 } 52 52 trunk/apps/main/modules/sfGuardAuth/actions/actions.class.php
r54 r56 10 10 { 11 11 12 /** 13 * Activates a user 14 * 15 * @param sfWebRequest $request 16 */ 12 17 public function executeActivate(sfWebRequest $request) 13 18 { … … 222 227 } 223 228 229 /** 230 * Registers a new member 231 * 232 * @param sfWebRequest $request 233 * @sf_param array user Member form informations 234 */ 224 235 public function executeRegister(sfWebRequest $request) 225 236 { … … 278 289 } 279 290 291 /** 292 * Resend activation mail 293 * 294 * @param sfWebRequest $request 295 * @sf_param array user User form fields data 296 * @sf_param string recaptcha_challenge_field Recaptcha challenge 297 * @sf_param string recaptcha_response_field Recaptcha response 298 * @see sfValidatorReCaptcha 299 */ 280 300 public function executeResendActivation(sfWebRequest $request) 281 301 { … … 284 304 if ($request->isMethod('post')) 285 305 { 286 // Recaptcha parameters 287 $captcha = array( 288 'recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 289 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'), 290 ); 291 $params = array_merge($request->getParameter('user', array()), array('captcha' => $captcha)); 292 293 $this->form->bind($params); 306 $this->form->bindFromRequest($request); 294 307 295 308 if ($this->form->isValid()) 296 309 { 297 $user = sfGuardUserPeer::retrieveByEmail($ params['email']);310 $user = sfGuardUserPeer::retrieveByEmail($this->form->getValue('email')); 298 311 $this->forward404Unless($user); // theoricaly, can't happen 299 312 … … 311 324 return sfView::SUCCESS; 312 325 } 326 313 327 $this->getUser()->setFlash('notice', $this->__('Your activation mail has been sent to '.$user->getEmail())); 314 328 $this->redirect('@homepage'); … … 318 332 319 333 public function handleErrorChangePassword() 320 {321 return sfView::SUCCESS;322 }323 324 public function handleErrorRegister()325 334 { 326 335 return sfView::SUCCESS; trunk/apps/main/modules/sfGuardAuth/templates/registerSuccess.php
r54 r56 31 31 <fieldset> 32 32 <legend><?php echo __('Account informations') ?></legend> 33 <?php echo $form->renderGlobalErrors() ?> 33 34 <?php echo $form['username']->renderRow() ?> 34 35 <?php echo $form['email']->renderRow() ?> trunk/apps/main/modules/sfGuardAuth/templates/resendActivationSuccess.php
r54 r56 24 24 <?php echo $form['email']->renderRow() ?> 25 25 <span class="form-help"><?php echo __('Enter the email address you entered when you have registered here.') ?></span> 26 <?php echo $form['captcha']->renderRow() ?> 27 <p class="form-help"> 28 <?php echo __('This codes aims at detecting if you are a bot or a human person.') ?> 29 </p> 26 <?php if (true === sfConfig::get('app_recaptcha_enabled')): ?> 27 <?php echo $form['captcha']->renderRow() ?> 28 <p class="form-help"> 29 <?php echo __('This codes aims at detecting if you are a bot or a human person.') ?> 30 </p> 31 <?php endif; ?> 30 32 <p> 31 33 <?php echo $form['_csrf_token'] ?> trunk/apps/main/templates/_messages.php
r54 r56 1 <?php if ( $sf_context->has('form') && $form = $sf_context->get('form') && $sf_context->get('form')->hasGlobalErrors()): ?>1 <?php if (!is_null($activeForm) && $activeForm->hasGlobalErrors()): ?> 2 2 <div class="form-errors"> 3 3 <h4><?php echo __('Errors have been encountered') ?></h4> 4 <?php echo $ sf_context->get('form')->renderGlobalErrors() ?>4 <?php echo $activeForm->renderGlobalErrors() ?> 5 5 </div> 6 6 <?php endif; ?> trunk/apps/main/templates/layout.php
r48 r56 38 38 <?php include_partial('global/menu') ?> 39 39 </div> 40 <?php include_partial('global/messages' ) ?>40 <?php include_partial('global/messages', array('activeForm' => $activeForm)) ?> 41 41 <div id="main"> 42 42 <div class="inner"> trunk/config/app.yml-dist
r6 r56 42 42 43 43 googleanalytics: 44 tracker_id: <your_google_analytics_tracker_id_here>44 tracker_id: ~ # create an account here: http://www.google.com/analytics/ 45 45 46 46 googlemaps: 47 api_key: <your_google_api_key_here>47 api_key: ~ # get an API key here: code.google.com/apis/maps/signup.html 48 48 49 49 homepage: … … 168 168 default: default_avatar48.jpg 169 169 170 recaptcha: # Get an API key at http://recaptcha.net/ 171 enabled: on # set to off to disable captcha (HAZARDOUS) 172 private_key: ~ # put your recatcha private api key here 173 public_key: ~ # put your recatcha public api key here 174 170 175 recommendations: 171 176 max_items: 8 … … 180 185 yahoo_geocoding: 181 186 api_gateway: "http://local.yahooapis.com/MapsService/V1/geocode?" 182 api_key: <your_yahoo_api_key_here>187 api_key: ~ # get an API key here: http://developer.yahoo.com/wsregapp/ trunk/lib/form/BaseFormPropel.class.php
r52 r56 11 11 { 12 12 sfWidgetFormSchema::setDefaultFormFormatterName('div'); 13 self::enableCSRFProtection('symf0n14n5');14 13 } 15 14 } trunk/lib/form/application/ApplicationForm.class.php
r52 r56 1 1 <?php 2 3 2 /** 4 3 * Application form. … … 12 11 public function configure() 13 12 { 13 unset($this['created_at'], $this['updated_at']); 14 14 } 15 15 } trunk/lib/form/user/RegisterForm.class.php
r53 r56 36 36 new sfValidatorString(array('min_length' => 3, 'max_length' => 20)), 37 37 new sfValidatorRegex(array('pattern' => '/^[a-zA-Z]([a-zA-Z0-9._-]+)$/'), array('invalid' => 'Name "%value%" contains forbidden characters')), 38 new sfValidatorBlacklist(array(' choices' => self::$forbidden_names), array('invalid' => 'Name "%value%" is blacklisted')),38 new sfValidatorBlacklist(array('forbidden_values' => self::$forbidden_names), array('invalid' => 'Name "%value%" is blacklisted')), 39 39 )), 40 40 'email' => new sfValidatorAnd(array( trunk/lib/form/user/ResendActivationForm.class.php
r54 r56 4 4 * 5 5 */ 6 class ResendActivationForm extends sfForm 6 class ResendActivationForm extends sfFormReCaptcha 7 7 { 8 8 public function configure() 9 9 { 10 self::enableCSRFProtection('symf0n14n5');11 12 10 // Widgets 13 11 $this->widgetSchema['email'] = new sfWidgetFormInput(); 14 $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array('public_key' => sfConfig::get('app_recaptcha_public_key'))); 12 if (true === sfConfig::get('app_recaptcha_enabled')) 13 { 14 $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array('public_key' => sfConfig::get('app_recaptcha_public_key'))); 15 } 15 16 16 17 // Validators … … 20 21 array('invalid' => 'This email has never been registered here, or is already activated.')), 21 22 )); 22 $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array('private_key' => sfConfig::get('app_recaptcha_private_key'))); 23 24 if (true === sfConfig::get('app_recaptcha_enabled')) 25 { 26 $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array('private_key' => sfConfig::get('app_recaptcha_private_key'))); 27 } 23 28 24 29 $this->widgetSchema->setNameFormat('user[%s]'); trunk/lib/form/user/SigninForm.class.php
r54 r56 1 1 <?php 2 2 /** 3 * Sign in form 4 * 5 */ 3 6 class SigninForm extends sfGuardFormSignin 4 7 { 5 public function setup()6 {7 sfWidgetFormSchema::setDefaultFormFormatterName('div');8 self::enableCSRFProtection('symf0n14n5');9 }10 11 8 public function configure() 12 9 {
