public function process(Zend_Controller_Request_Abstract $request)
 {
     //echo "<br/>here at process.";
     $this->name = $this->sanitize($request->getPost('name'));
     $this->name = substr($this->name, 0, 255);
     if (strlen($this->name) == 0) {
         $this->addError('name', 'Please enter a name for this general membership due');
         //this is a giving FormProcessor.php function.
     }
     $this->price = $this->sanitize(trim($request->getPost('price')));
     //echo "<br/>your ticket_price is: ".$this->ticket_price;
     if ($this->price == 'FREE') {
         //echo "<br/>after ticket_price";
         $this->price = (int) 0;
         //echo "<br/>after ticket_price is: ".$this->ticket_price;
     }
     if (!is_numeric($this->price)) {
         $this->addError('price', 'Please enter a valid product price');
     }
     $this->content = FormProcessor_BlogPost::cleanHtml($request->getPost('content'));
     //echo "<br/>you are at after clean HTML";
     if (!$this->hasError()) {
         echo "<br/>you are at no error";
         $this->objects->profile->name = $this->name;
         $this->objects->profile->price = $this->price;
         $this->objects->profile->content = $this->content;
         //echo "<br/>you are at before save()";
         $this->objects->Save();
     }
     //echo "<br/>you are at before return";
     return !$this->hasError();
 }
 public function editAction()
 {
     $request = $this->getRequest();
     $post_id = (int) $this->getRequest()->getQuery('id');
     $fp = new FormProcessor_BlogPost($this->db, $this->identity->user_id, $post_id);
     if ($request->isPost()) {
         if ($fp->process($request)) {
             $url = $this->getUrl('preview') . '?id=' . $fp->post->getId();
             $this->_redirect($url);
         }
     }
     if ($fp->post->isSaved()) {
         $this->breadcrumbs->addStep('Preview Post: ' . $fp->post->profile->title, $this->getUrl('preview') . '?id' . $fp->post->getId());
         $this->breadcrumbs->addStep('Edit Blog Post');
     } else {
         $this->breadcrumbs->addStep('Create a New Blog Post');
     }
     $this->view->fp = $fp;
 }
示例#3
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     //echo "<br/> Here at process";
     $this->name = $this->sanitize($request->getPost('name'));
     //$this->name = substr($this->name, 0, 255);
     echo "current product name: " . $this->name . "<br />";
     if (strlen($this->name) == 0) {
         $this->addError('name', 'Please enter a valid product name');
     }
     $this->price = $this->sanitize($request->getPost('price'));
     if (strlen($this->price) == 0 || !is_numeric($this->price)) {
         $this->addError('price', 'Please enter a valid product price');
     }
     $this->brand = $this->sanitize($request->getPost('brand'));
     if (strlen($this->brand) == 0) {
         $this->addError('brand', 'Please enter a valid product brand');
     }
     $this->reward_point = $this->sanitize($request->getPost('reward_point'));
     $this->video_youtube = $this->sanitize($request->getPost('video_youtube'));
     $this->discount_price = $this->sanitize($request->getPost('discount_price'));
     $this->description = FormProcessor_BlogPost::cleanHtml($request->getPost('description'));
     if (!$this->hasError()) {
         echo "here at good to save<br />";
         $this->product->User_id = $this->userID;
         $this->product->name = $this->name;
         $this->product->price = $this->price;
         $this->product->brand = $this->brand;
         $this->product->profile->description = $this->description;
         $this->product->reward_point = $this->reward_point;
         $this->product->video_youtube = $this->video_youtube;
         $this->product->Username = $this->username;
         $this->product->discount_price = $this->discount_price;
         $this->product->save();
         $this->product_id = $this->product->getId();
     } else {
         echo "here at bad process";
     }
     return !$this->hasError();
 }
示例#4
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     //validate the user's name
     $this->first_name = $this->sanitize($request->getPost('first_name'));
     //sanitize uses FormProcessor's zend_filter funciton to clean strings.
     if (strlen($this->first_name) == 0) {
         $this->addError('first_name', 'Please enter your first name');
     } else {
         $this->user->profile->first_name = $this->first_name;
         $this->user->first_name = $this->first_name;
     }
     $this->last_name = $this->sanitize($request->getPost('last_name'));
     if (strlen($this->last_name) == 0) {
         $this->addError('last_name', 'Please enter your last_name');
     } else {
         $this->user->profile->last_name = $this->last_name;
         $this->user->last_name = $this->last_name;
     }
     $this->email = $this->sanitize($request->getPost('email'));
     $validator = new Zend_Validate_EmailAddress();
     if (strlen($this->email) == 0) {
         $this->addError('email', 'Please enter you email address');
     } elseif (!$validator->isValid($this->email)) {
         $this->addError('email', 'Please enter a valid email address');
     } else {
         $this->user->profile->email = $this->email;
         //echo "here";
     }
     $this->address = $this->sanitize($request->getPost('address'));
     if (strlen($this->address) == 0) {
         $this->addError('address', 'Please enter you address address');
     } else {
         $this->user->profile->address = strtolower($this->address);
     }
     $this->zip = $this->sanitize($request->getPost('zip'));
     if (strlen($this->zip) == 0) {
         $this->addError('zip', 'Please enter you zip');
     } else {
         $this->user->profile->zip = strtolower($this->zip);
     }
     $this->city = $this->sanitize($request->getPost('city'));
     if (strlen($this->city) == 0) {
         $this->addError('city', 'Please enter you city');
     } else {
         $this->user->profile->city = strtolower($this->city);
     }
     $this->state = $this->sanitize($request->getPost('states'));
     if (strlen($this->state) == 0) {
         $this->addError('states', 'Please enter your state');
     } else {
         $this->user->profile->state = strtolower($this->state);
     }
     //validating the correct password
     $this->password = $this->sanitize($request->getPost('password'));
     $this->confirm_password = $this->sanitize($request->getPost('confirm_password'));
     if (empty($this->password) && !empty($this->confirm_password)) {
         $this->addError('password', 'please enter the password');
     } elseif (!empty($this->password) && empty($this->confirm_password)) {
         $this->addError('confirm_password', 'please ReEnter your password above');
     } elseif ($this->password != $this->confirm_password) {
         $this->addError('confirm_password', 'the ReEntered password does not match the above passowrd');
     } elseif ($this->password == '' && $this->confirm_password == '') {
         //nothing.
         //echo "here at nothing with password";
     } else {
         //echo "password changed";
         $this->user->password = $this->password;
     }
     if ($this->user->user_type == 'clubAdmin') {
         foreach ($this->publicProfile as $key => $label) {
             $this->{$key} = $this->sanitize($request->getPost($key));
             $this->user->profile->{$key} = $this->{$key};
         }
     }
     $this->paypalEmail = $this->sanitize($request->getPost('paypalEmail'));
     if (!empty($this->paypalEmail)) {
         $this->user->profile->paypalEmail = $this->paypalEmail;
     }
     $this->club_description = FormProcessor_BlogPost::cleanHtml($request->getPost('club_description'));
     //echo "the current club_description is: ".$this->club_description;
     if (!empty($this->club_description)) {
         $this->user->profile->club_description = $this->club_description;
     }
     //$this->paypalEmail = $this->user->profile->paypalEmail;
     $this->num_posts = max(1, (int) $request->getPost('num_posts'));
     //$this->user->status = $request->getPost('club_public');
     $this->user->profile->num_posts = $this->num_posts;
     //if no erros have occured, save the user
     if (!$this->hasError()) {
         $this->user->save();
     }
     //return true if no errors have occurredd
     return !$this->hasError();
 }
 public function process(Zend_Controller_Request_Abstract $request)
 {
     $this->name = $this->sanitize($request->getPost('name'));
     //$this->name = substr($this->name, 0, 255);
     echo "current product name: " . $this->name . "<br />";
     if (strlen($this->name) == 0) {
         $this->addError('name', 'Please enter a valid product name');
     }
     $this->price = $this->sanitize($request->getPost('price'));
     if (strlen($this->price) == 0 || !is_numeric($this->price)) {
         $this->addError('price', 'Please enter a valid product price');
     } else {
         switch ($this->price) {
             case $this->price < 100:
                 $this->product_price_range = 'price_category_1';
                 break;
             case $this->price > 100 && $this->price < 200:
                 $this->product_price_range = 'price_category_2';
                 break;
             case $this->price > 200 && $this->price < 500:
                 $this->product_price_range = 'price_category_3';
                 break;
             case $this->price > 500 && $this->price < 1000:
                 $this->product_price_range = 'price_category_4';
                 break;
             case $this->price > 1000 && $this->price < 5000:
                 $this->product_price_range = 'price_category_5';
                 break;
         }
     }
     $this->brand = $this->sanitize($request->getPost('brand'));
     if (strlen($this->brand) == 0) {
         $this->addError('brand', 'Please enter a valid product brand');
     }
     $this->domestic_shipping_rate = $this->sanitize($request->getPost('domesticShippingRate'));
     if (strlen($this->domestic_shipping_rate) == 0 || !is_numeric($this->domestic_shipping_rate)) {
         $this->addError('shippingRate', 'Please enter a valid shipping rate');
     }
     $this->international_shipping_rate = $this->sanitize($request->getPost('internationalShippingRate'));
     if (strlen($this->international_shipping_rate) == 0 || !is_numeric($this->international_shipping_rate)) {
         $this->addError('shippingRate', 'Please enter a valid shipping rate');
     }
     $this->video_youtube = $this->sanitize($request->getPost('video_youtube'));
     $this->discount_price = $this->sanitize($request->getPost('discount_price'));
     if ($this->sales_price != '' && is_numeric($this->sales_price) && $this->sales_price > 0) {
         echo 'here at discount price';
         $this->on_sale = 1;
         $this->reward_point = floor(0.03 * $this->sales_price) * 4;
     } else {
         echo 'here at price';
         $this->reward_point = floor(0.03 * $this->price) * 4;
         $this->on_sale = 0;
     }
     $this->return_allowed = $request->getPost('return');
     $this->backorder_time = $this->sanitize($request->getPost('backorder_time'));
     $this->description = FormProcessor_BlogPost::cleanHtml($request->getPost('description'));
     $this->product_type = $this->sanitize($request->getPost('product'));
     if (strlen($this->product_type) == 0) {
         $this->addError('product_type', 'Please enter a valid product_type');
     }
     /*$imageForm=new FormProcessor_Image($this->tempProduct, 'storeSeller');
     			echo 'here at instantiating image<br />';
     		if($imageForm->process($this->request)){
     			echo 'here at process request<br />';
     			//then update the session variable for it
     			$this->messenger->addMessage('Image uploaded');
     		}else{
     			echo 'here at process error<br />';
     			foreach($imageForm->getErrors() as $error)
     			{
     				$this->messenger->addMessage($error);
     			}
     		}*/
     if (!$this->hasError()) {
         //echo"here at good to save<br />";
         $this->product->product_category = $this->product_category;
         $this->product->inventory_attribute_table = $this->inventory_attribute_table;
         $this->product->purchase_type = $this->purchase_type;
         $this->product->product_type = $this->product_type;
         $this->product->product_tag = $this->product_tag;
         $this->product->name = $this->name;
         $this->product->uploader_id = $this->userID;
         $this->product->uploader_network = $this->uploader_network;
         $this->product->uploader_username = $this->uploader_username;
         $this->product->uploader_email = $this->uploader_email;
         $this->product->product_price_range = $this->product_price_range;
         $this->product->price = $this->price;
         $this->product->on_sale = $this->on_sale;
         $this->product->sales_price = $this->sales_price;
         $this->product->return_allowed = $this->return_allowed;
         $this->product->domestic_shipping_rate = $this->domestic_shipping_rate;
         $this->product->international_shipping_rate = $this->international_shipping_rate;
         $this->product->brand = $this->brand;
         $this->product->profile->description = $this->description;
         $this->product->reward_point = $this->reward_point;
         $this->product->video_youtube = $this->video_youtube;
         $this->product->backorder_time = $this->backorder_time;
         $this->product->save();
         $this->product_id = $this->product->getId();
     } else {
         echo "here at bad process";
     }
     return !$this->hasError();
 }
示例#6
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     $this->name = $this->sanitize($request->getPost('name'));
     //$this->name = substr($this->name, 0, 255);
     echo "current product name: " . $this->name . "<br />";
     if (strlen($this->name) == 0) {
         $this->addError('name', 'Please enter a valid product name');
     }
     $this->price = $this->sanitize($request->getPost('price'));
     if (strlen($this->price) == 0 || !is_numeric($this->price)) {
         $this->addError('price', 'Please enter a valid product price');
     } else {
         switch ($this->price) {
             case $this->price <= 100:
                 $this->product_price_range = 'price_category_1';
                 break;
             case $this->price > 100 && $this->price <= 200:
                 $this->product_price_range = 'price_category_2';
                 break;
             case $this->price > 200 && $this->price <= 500:
                 $this->product_price_range = 'price_category_3';
                 break;
             case $this->price > 500 && $this->price <= 1000:
                 $this->product_price_range = 'price_category_4';
                 break;
             case $this->price > 1000 && $this->price <= 5000:
                 $this->product_price_range = 'price_category_5';
                 break;
         }
     }
     $this->brand = $this->sanitize($request->getPost('brand'));
     if (strlen($this->brand) == 0) {
         $this->addError('brand', 'Please enter a valid product brand');
     }
     $this->domestic_shipping_rate = $this->sanitize($request->getPost('domesticShippingRate'));
     if (strlen($this->domestic_shipping_rate) == 0 || !is_numeric($this->domestic_shipping_rate)) {
         $this->addError('domesticShippingRate', 'Please enter a valid shipping rate');
     }
     $this->international_shipping_rate = $this->sanitize($request->getPost('internationalShippingRate'));
     if (strlen($this->international_shipping_rate) == 0 || !is_numeric($this->international_shipping_rate)) {
         $this->addError('internationalShippingRate', 'Please enter a valid shipping rate');
     }
     $this->video_youtube = $this->sanitize($request->getPost('video_youtube'));
     $this->discount_price = $this->sanitize($request->getPost('discount_price'));
     if ($this->sales_price != '' && is_numeric($this->sales_price) && $this->sales_price > 0) {
         echo 'here at discount price';
         $this->on_sale = 1;
         $this->reward_point = floor(0.03 * $this->sales_price) * 4;
     } else {
         echo 'here at price';
         $this->reward_point = floor(0.03 * $this->price) * 4;
         $this->on_sale = 0;
     }
     $this->return_allowed = $request->getPost('return');
     $this->backorder_time = $this->sanitize($request->getPost('backorder_time'));
     $this->description = FormProcessor_BlogPost::cleanHtml($request->getPost('description'));
     $this->product_type = $this->sanitize($request->getPost('product'));
     if (strlen($this->product_type) == 0) {
         $this->addError('product_type', 'Please enter a valid product_type');
     }
     $this->social_usage = $request->getPost('social_usage');
     if (strlen($this->social_usage) == 0) {
         $this->social_usage = 'off';
     }
     $this->competition_usage = $request->getPost('competition_usage');
     if (strlen($this->competition_usage) == 0) {
         $this->competition_usage = 'off';
     }
     if (!$this->hasError()) {
         //echo"here at good to save<br />";
         $this->product->product_category = $this->product_category;
         $this->product->inventory_attribute_table = $this->inventory_attribute_table;
         $this->product->purchase_type = $this->purchase_type;
         $this->product->product_type = $this->product_type;
         $this->product->product_tag = $this->product_tag;
         $this->product->name = $this->name;
         $this->product->uploader_id = $this->userID;
         $this->product->uploader_network = $this->uploader_network;
         $this->product->uploader_username = $this->uploader_username;
         $this->product->uploader_email = $this->uploader_email;
         $this->product->product_price_range = $this->product_price_range;
         $this->product->price = $this->price;
         $this->product->on_sale = $this->on_sale;
         $this->product->sales_price = $this->sales_price;
         $this->product->return_allowed = $this->return_allowed;
         $this->product->domestic_shipping_rate = $this->domestic_shipping_rate;
         $this->product->international_shipping_rate = $this->international_shipping_rate;
         $this->product->brand = $this->brand;
         $this->product->profile->description = $this->description;
         $this->product->reward_point = $this->reward_point;
         $this->product->video_youtube = $this->video_youtube;
         $this->product->backorder_time = $this->backorder_time;
         $this->product->social_usage = $this->social_usage;
         echo 'social_usage is: ' . $this->product->social_usage;
         $this->product->competition_usage = $this->competition_usage;
         echo 'competition is: ' . $this->product->competition_usage;
         $this->product->save();
         $this->product_id = $this->product->getId();
     } else {
         echo "here at bad process";
     }
     return !$this->hasError();
 }
示例#7
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     //echo "<br/>here at process.";
     $this->name = $this->sanitize($request->getPost('title'));
     $this->name = substr($this->name, 0, 255);
     if (strlen($this->name) == 0) {
         $this->addError('title', 'Please enter a title for this post');
         //this is a giving FormProcessor.php function.
     }
     $cdate = array('y' => (int) $request->getPost('ts_createdYear'), 'm' => (int) $request->getPost('ts_createdMonth'), 'd' => (int) $request->getPost('ts_createdDay'));
     $ctime = array('h' => (int) $request->getPost('ts_createdHour'), 'm' => (int) $request->getPost('ts_createdMinute'));
     $ctime['h'] = max(1, min(12, $ctime['h']));
     $ctime['m'] = max(0, min(59, $ctime['m']));
     $cmeridian = strtolower($request->getPost('ts_createdMeridian'));
     if ($cmeridian != 'pm') {
         $cmeridian = 'am';
     }
     //conver the hour into 23 hour time
     if ($ctime['h'] < 12 && $cmeridian == 'pm') {
         $ctime['h'] += 12;
     } else {
         if ($ctime['h'] == 12 && $cmeridian == 'am') {
             $ctime['h'] = 0;
         }
     }
     if (!checkDate($cdate['m'], $cdate['d'], $cdate['y'])) {
         $this->addError('ts_created', 'Please select a valid date');
     }
     $this->ts_created = mktime($ctime['h'], $ctime['m'], 0, $cdate['m'], $cdate['d'], $cdate['y']);
     //echo "<br/>you are at the end of firs ttime";
     //------------------------------------------------------------------------------
     $edate = array('y' => (int) $request->getPost('ts_endYear'), 'm' => (int) $request->getPost('ts_endMonth'), 'd' => (int) $request->getPost('ts_endDay'));
     $etime = array('h' => (int) $request->getPost('ts_endHour'), 'm' => (int) $request->getPost('ts_endMinute'));
     $etime['h'] = max(1, min(12, $etime['h']));
     $etime['m'] = max(0, min(59, $etime['m']));
     $emeridian = strtolower($request->getPost('ts_endMeridian'));
     if ($emeridian != 'pm') {
         $emeridian = 'am';
     }
     //conver the hour into 23 hour time
     if ($etime['h'] < 12 && $emeridian == 'pm') {
         $etime['h'] += 12;
     } else {
         if ($etime['h'] == 12 && $emeridian == 'am') {
             $etime['h'] = 0;
         }
     }
     if (!checkDate($edate['m'], $edate['d'], $edate['y'])) {
         $this->addError('ts_created', 'Please select a valid date');
     }
     $this->ts_end = mktime($etime['h'], $etime['m'], 0, $edate['m'], $edate['d'], $edate['y']);
     //echo "<br/>you are at the end of the second time";
     //-----------------------------------------------------------------------------
     $this->ticket_price = $this->sanitize(trim($request->getPost('ticket_price')));
     //echo "<br/>your ticket_price is: ".$this->ticket_price;
     if ($this->ticket_price == 'FREE') {
         //echo "<br/>after ticket_price";
         $this->ticket_price = (int) 0;
         //echo "<br/>after ticket_price is: ".$this->ticket_price;
     }
     if ($this->ticket_price == '') {
         $this->ticket_price = (int) 0;
     }
     if (!is_numeric($this->ticket_price)) {
         $this->addError('ticket_price', 'Please enter a valid product price');
     }
     $this->content = FormProcessor_BlogPost::cleanHtml($request->getPost('content'));
     $this->location = $this->sanitize($request->getPost('location'));
     //echo "<br/>you are at after clean HTML";
     if (!$this->hasError()) {
         //echo "<br/>you are at no error";
         $this->event->profile->name = $this->name;
         $this->event->profile->price = $this->ticket_price;
         $this->event->profile->content = $this->content;
         $this->event->ts_created = $this->ts_created;
         $this->event->ts_end = $this->ts_end;
         $this->event->profile->location = $this->location;
         //echo "<br/>you are at before save()";
         $this->event->save();
     }
     //echo "<br/>you are at before return";
     return !$this->hasError();
 }
示例#8
0
 public function process(Zend_Controller_Request_Abstract $request)
 {
     $this->name = $this->sanitize($request->getPost('name'));
     //$this->name = substr($this->name, 0, 255);
     echo "current product name: " . $this->name . "<br />";
     if (strlen($this->name) == 0) {
         $this->addError('name', 'Please enter a valid product name');
     }
     $this->price = $this->sanitize($request->getPost('price'));
     if (strlen($this->price) == 0 || !is_numeric($this->price)) {
         $this->addError('price', 'Please enter a valid product price');
     } else {
         switch ($this->price) {
             case $this->price < 100:
                 $this->product_price_range = 'price_category_1';
                 break;
             case $this->price > 100 && $this->price < 200:
                 $this->product_price_range = 'price_category_2';
                 break;
             case $this->price > 200 && $this->price < 500:
                 $this->product_price_range = 'price_category_3';
                 break;
             case $this->price > 500 && $this->price < 1000:
                 $this->product_price_range = 'price_category_4';
                 break;
             case $this->price > 1000 && $this->price < 5000:
                 $this->product_price_range = 'price_category_5';
                 break;
         }
     }
     $this->brand = $this->sanitize($request->getPost('brand'));
     if (strlen($this->brand) == 0) {
         $this->addError('brand', 'Please enter a valid product brand');
     }
     $this->shipping_rate = $this->sanitize($request->getPost('shippingRate'));
     if (strlen($this->shipping_rate) == 0 || !is_numeric($this->shipping_rate)) {
         $this->addError('shippingRate', 'Please enter a valid shipping rate');
     }
     $this->reward_point = floor(0.03 * $this->price) * 4;
     $this->quantity = $this->sanitize($request->getPost('quantity'));
     $this->video_youtube = $this->sanitize($request->getPost('video_youtube'));
     $this->description = FormProcessor_BlogPost::cleanHtml($request->getPost('description'));
     $this->product_type = $this->sanitize($request->getPost('product'));
     if (strlen($this->product_type) == 0) {
         $this->addError('product_type', 'Please enter a valid product_type');
     }
     if (!$this->hasError()) {
         //echo"here at good to save<br />";
         $this->product->product_type = $this->product_type;
         $this->product->url = $this->name;
         $this->product->User_id = $this->userID;
         $this->product->Username = $this->username;
         $this->product->shipping_rate = $this->shipping_rate;
         $this->product->quantity = $this->quantity;
         $this->product->user_network = $this->user_network;
         $this->product->product_price_range = $this->product_price_range;
         $this->product->user_city = $this->user_city;
         $this->product->name = $this->name;
         $this->product->price = $this->price;
         $this->product->brand = $this->brand;
         $this->product->profile->description = $this->description;
         $this->product->product_tag = $this->product_tag;
         $this->product->user_network = $this->user_network;
         $this->product->reward_point = $this->reward_point;
         $this->product->video_youtube = $this->video_youtube;
         foreach ($this->specificProductTypeConfig['measurement'] as $k => $v) {
             $this->product->{$k} = $this->sanitize($request->getPost($k));
         }
         $this->product->save();
         $this->product_id = $this->product->getId();
     } else {
         echo "here at bad process";
     }
     return !$this->hasError();
 }