И так имеем: 2018-08-24 13:33:23 - PHP Notice: Undefined index: rating in *******catalog/controller/module/megareviews.php on line 170 2018-08-24 13:33:23 - PHP Notice: Undefined index: text in *******catalog/controller/module/megareviews.php on line 179 2018-08-26 12:01:33 - PHP Notice: Undefined index: phone in *******catalog/model/module/megareviews.php on line 4 2018-08-26 12:01:33 - PHP Notice: Undefined index: custom in *******catalog/model/module/megareviews.php on line 4 2018-08-26 12:01:33 - PHP Notice: Undefined index: videotitle in *******catalog/model/module/megareviews.php on line 4 2018-08-26 12:01:33 - PHP Notice: Undefined index: videourl in *******catalog/model/module/megareviews.php on line 4 2018-08-26 12:01:33 - PHP Notice: Undefined index: ay in *******catalog/model/module/megareviews.php on line 9 2018-08-26 12:01:33 - PHP Notice: Undefined variable: j in *******catalog/controller/module/megareviews.php on line 106 2018-08-26 23:59:46 - PHP Notice: Undefined index: phone in *******admin/model/module/megareviews.php on line 60 2018-08-26 12:01:33 - PHP Notice: Undefined index: files in *******catalog/model/module/megareviews.php on line 11 2018-08-26 12:01:33 - PHP Warning: Invalid argument supplied for foreach() in *******catalog/model/module/megareviews.php on line 9 2018-08-26 12:01:33 - PHP Warning: Invalid argument supplied for foreach() in *******catalog/model/module/megareviews.php on line 11 И модуль то при этом нормально работает) Бдем завтра смотреть что же там такого в этом модуле) --- Добавлено, 27 авг 2018 --- и нем с каталог/контроллер тут две ошибки в 170 и 179 строке PHP: ф<?phperror_reporting(0);class ControllerModuleMegareviews extends Controller { protected function index($setting) { $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); if (isset($this->request->get['product_id'])) $this->data['product_id'] = $this->request->get['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => 'r.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $settings['perpage'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/magnific-popup.css'); }else { $this->document->addStyle('catalog/view/theme/default/stylesheet/' . $css_file); $this->document->addStyle('catalog/view/theme/default/stylesheet/magnific-popup.css'); $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews.tpl'; } else { $this->template = 'default/template/module/megareviews.tpl'; } $this->document->addStyle('https://fonts.googleapis.com/css?family=Open+Sans'); $this->document->addScript('catalog/view/javascript/megareviews.js'); $this->document->addScript('catalog/view/javascript/jquery.magnific-popup.min.js'); $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=20; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); $this->response->setOutput($this->render()); } public function addReview(){ if (($this->request->server['REQUEST_METHOD'] == 'POST') ) { $post=$this->request->post; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $this->request->post['captcha']))) { return; } for ($i = 0; $i < count($_FILES['file']['name']); $i++) {//loop to get individual element from the array $target_path = "image/data/mr/"; //Declaring Path for uploaded images if(!is_dir($target_path)) mkdir($target_path); $validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $target_name = rand(1,10000). $ext[0]. "." . $ext[count($ext) - 1];//set the target path with a new name of image $target_path = $target_path.$target_name; $j = $j + 1;//increment the number of uploaded images according to the files in array if (($_FILES["file"]["size"][$i] < 1000000) //Approx. 100kb files can be uploaded. && in_array($file_extension, $validextensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path)) {//if file moved to uploads folder $post['files'][]="data/mr/".$target_name; } else {//if file was not moved. } } } } $post['status']='0'; if($settings['approve']==0)$post['status']='1'; $this->load->model('module/megareviews'); $this->model_module_megareviews->addReview($post); } public function ajaxOptions() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $s=$this->config->get('settings'); echo json_encode(Array("options" => $this->model_module_megareviews->getOptions(), "ay" => $this->model_module_megareviews->getAys(), "rating" => $s['rvalues'])); } public function ajaxVote() { $this->load->model('module/megareviews'); $this->load->model('setting/setting'); $data=$_POST; $forever = time()+3600*24*365*10; if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } if(isset($votes[$data['id']])){ if($votes[$data['id']]==$data['vote']){ unset($votes[$data['id']]); $result['status']=0; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],-1); else $this->model_module_megareviews->upVote($data['id'],-1); }else{ $result['status']=-1; } }else{ $result['status']=1; $votes[$data['id']]=$data['vote']; if($data['vote']==0) $this->model_module_megareviews->downVote($data['id'],1); else $this->model_module_megareviews->upVote($data['id'],1); } setcookie( 'lastvote', json_encode($votes), $forever); //print_r($_COOKIE); echo json_encode($result); } public function ajaxValidate() { $data=$_POST; $this->load->model('setting/setting'); $settings=$this->config->get('settings'); $this->load->language('module/megareviews'); $f=true; if($settings['recommend']==2 && !isset($data['recommend'])){ $f=false; $error["recommend"]=$this->language->get('text_requirederror'); } if($settings['rating']==2 && $data['rating']<0){ $f=false; $error["rating"]=$this->language->get('text_requirederror'); } if($settings['title']==2 && strlen($data['title'])==0){ $f=false; $error["title"]=$this->language->get('text_requirederror'); } $error["text"]=''; if($settings['text']==2 && strlen($data['text'])==0){ $f=false; $error["text"]=$this->language->get('text_requirederror'); } if(!isset($data['text']) || strlen($data['text'])<$settings['textcount']){ $f=false; $error["text"].=$this->language->get('text_lengtherror'); } if($settings['nickname']==2 && (!isset($data['author']) || strlen($data['author'])==0)){ $f=false; $error["author"]=$this->language->get('text_requirederror'); } if($settings['phone']==2 && (!isset($data['phone']) || strlen($data['phone'])==0)){ $f=false; $error["phone"]=$this->language->get('text_requirederror'); } if($settings['email']==2 && (!isset($data['email']) || strlen($data['email'])==0)){ $f=false; $error["email"]=$this->language->get('text_requirederror'); } if($settings['custom']==2 && (!isset($data['custom']) || strlen($data['custom'])==0)){ $f=false; $error["custom"]=$this->language->get('text_requirederror'); } if ($settings['captcha']==1 && (empty($this->session->data['captcha']) || ($this->session->data['captcha'] != $data['captcha']))) { $f=false; $error['captcha'] = $this->language->get('text_errorcaptcha'); } $result["status"] = $f ? '1' : '0'; $result["message"]=$f ? $settings['approve']==1 ? $this->language->get('text_addsuccess0') : $this->language->get('text_addsuccess1') : $this->language->get('text_adderror'); $result["error"]=$error; echo json_encode($result); } public function ajaxgetReviews() { $data=$_POST; $this->data = array_merge($this->data, $this->load->language('module/megareviews')); $this->load->model('module/megareviews'); $settings=$this->config->get('settings'); $this->data['options'] = $this->model_module_megareviews->getOptions(); $this->data['ays'] = $this->model_module_megareviews->getAys(); $this->data['product_id'] = $data['product_id']; $this->data['reviewsinfo'] = $this->model_module_megareviews->getReviewsInfo($this->data['product_id']); $this->data['settings']=$this->config->get('settings'); $data = array( 'product_id' => $this->data['product_id'], 'sort' => $data['sort'], 'order' => $data['order'], 'start' => (int) $data['start'], 'limit' => (int)$data['limit'] ); $css_file = 'megareviews.css'; if(file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/stylesheet/' . $css_file)) { $this->data['path']='catalog/view/theme/' . $this->config->get('config_template'); }else { $this->data['path']='catalog/view/theme/default'; } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/megareviews_list.tpl')) { $this->template = $this->config->get('config_template') . '/template/module/megareviews_list.tpl'; } else { $this->template = 'default/template/module/megareviews_list.tpl'; } $this->load->model('tool/image'); $rating=$this->data['reviewsinfo']['rating'];$starwidth=25; $this->data['reviewsinfo']['stars']=''; for($i=1;$i<=5;$i++){ if($i<=$rating) $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $this->data['reviewsinfo']['stars'].="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } if(floor($rating)!=$rating){ $pos=floor($rating)*$starwidth; $width=($rating-floor($rating))*$starwidth; $this->data['reviewsinfo']['stars'].="<div class='mr-star' style='position:absolute;left:".$pos."px;overflow:hidden;width:".$width."px;'><img width='".$starwidth."' height='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; } $this->data['reviews'] = $this->model_module_megareviews->getReviews($data); if(isset($_COOKIE['lastvote'])){ $lastvote=html_entity_decode($_COOKIE['lastvote']); $votes=json_decode(($lastvote),true); } foreach($this->data['reviews'] as &$review){ $stars=''; $starwidth=15; for($i=1;$i<=5;$i++){ if($i<=$review['rating']) $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/full-star.png'/></div>"; else { $stars.="<div class='mr-star'><img width='".$starwidth."' src='".$this->data['path']."/image/mr/empty-star.png'/></div>"; } } $review['stars']=$stars; $review['options']=$this->model_module_megareviews->getOptionValues($review['review_id']); $review['ays']=$this->model_module_megareviews->getAyValues($review['review_id']); $review['images']=$this->model_module_megareviews->getImages($review['review_id']); foreach($review['images'] as &$im){ $im['small'] = $this->model_tool_image->resize($im['big'], 100, 100); } unset($im); if(isset($votes[$review['review_id']]))$review['vote']=$votes[$review['review_id']]; else $review['vote']=-1; } unset($review); print_r($this->render()); }}?> --- Добавлено, 27 авг 2018 --- text_requirederror в языковом файле есть, на него не ругается --- Добавлено, 27 авг 2018 --- Нашёл когда возникает - если покупатель оставляет отзыв и неверно вводит данные. Ему показывает уведомление - а в админку залетают куча ошибок. Хотя срабатывает верно. Как такое возможно?
а в моделе: PHP: <?phpclass ModelModuleMegareviews extends Model { public function addReview($data) { $this->db->query("INSERT INTO " . DB_PREFIX . "megareviews SET author = '" . $this->db->escape($data['author']) . "', email = '" . $this->db->escape($data['email']) . "', phone = '" . $this->db->escape($data['phone']) . "', custom = '" . $this->db->escape($data['custom']) . "', title = '" . $this->db->escape($data['title']) . "',videotitle = '" . $this->db->escape($data['videotitle']) . "',videourl= '" . $this->db->escape($data['videourl']) . "', product_id = '" . (int)($data['product_id']) . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "',recommend = '" . (int)$data['recommend'] . "', status = '" . (int)$data['status'] . "', date_added = NOW()"); $review_id = $this->db->getLastId(); foreach($data['options'] as $id=>$value) if((int)$value>-1)$this->db->query("INSERT INTO " . DB_PREFIX . "megareviewsoptions_to_review SET option_id = '" . (int)($id) . "', review_id = '" . (int)$review_id . "', value = '" . (int)$value . "' "); unset($id);unset($value); foreach($data['ay'] as $id=>$value) if((int)$value>-1)$this->db->query("INSERT INTO " . DB_PREFIX . "megareviewsays_to_review SET ay_id = '" . (int)($id) . "', review_id = '" . (int)$review_id . "', value = '" . (int)$value . "' "); foreach($data['files'] as $value) if((int)$value>-1)$this->db->query("INSERT INTO " . DB_PREFIX . "megareviewsimg_to_review SET url = '" . $this->db->escape($value) . "', review_id = '" . (int)$review_id . "'"); $this->cache->delete('product'); } public function getTotalReviewsByProductId($product_id) { $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "megareviews r LEFT JOIN " . DB_PREFIX . "product p ON (r.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND p.date_available <= NOW() AND p.status = '1' AND r.status = '1' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); return $query->row['total']; } public function updateOptions($data) { $this->db->query("TRUNCATE TABLE " . DB_PREFIX . "megareviews_options"); foreach ($data as $option) { $this->addOption($option); } $this->cache->delete('product'); } public function addOption($data) { $this->db->query("INSERT INTO " . DB_PREFIX . "megareviews_options_to_review SET option_id = '" . $this->db->escape($data['min']) . "', max = '" . $this->db->escape($data['max']) . "', name = '" . $this->db->escape(strip_tags($data['name'])) . "' , `values` = '" . $this->db->escape(strip_tags($data['values'])) . "'"); $this->cache->delete('product'); } public function editReview($review_id, $data) { $this->db->query("UPDATE " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['author']) . "', product_id = '" . $this->db->escape($data['product_id']) . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '" . (int)$data['status'] . "', date_added = NOW() WHERE review_id = '" . (int)$review_id . "'"); $this->cache->delete('product'); } public function deleteReview($review_id) { $this->db->query("DELETE FROM " . DB_PREFIX . "review WHERE review_id = '" . (int)$review_id . "'"); $this->cache->delete('product'); } public function downVote($review_id, $count) { $this->db->query("UPDATE " . DB_PREFIX . "megareviews SET downVotes = downvotes+" . $count . " WHERE review_id = '" . (int)$review_id . "'"); } public function upVote($review_id, $count) { $this->db->query("UPDATE " . DB_PREFIX . "megareviews SET upvotes = upvotes+" . $count . " WHERE review_id = '" . (int)$review_id . "'"); } public function getReview($review_id) { $query = $this->db->query("SELECT DISTINCT *, (SELECT pd.name FROM " . DB_PREFIX . "product_description pd WHERE pd.product_id = r.product_id AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS product FROM " . DB_PREFIX . "review r WHERE r.review_id = '" . (int)$review_id . "'"); return $query->row; } public function updateSettings($data = array()) { $this->updateOptions($data['options']); } public function getReviews($data = array()) { $sql = "SELECT r.review_id, r.author, r.rating, r.status, r.date_added, r.videotitle,r.upvotes,r.downvotes, r.text,r.title,r.recommend,r.videourl FROM " . DB_PREFIX . "megareviews r WHERE product_id='".$data['product_id']."' AND status=1"; $sort_data = array( 'pd.name', 'r.upvotes', 'r.rating', 'r.status', 'r.date_added' ); if (isset($data['sort']) && in_array($data['sort'], $sort_data)) { $sql .= " ORDER BY " . $data['sort']; } else { $sql .= " ORDER BY r.date_added"; } if (isset($data['order']) && ($data['order'] == 'DESC')) { $sql .= " DESC"; } else { $sql .= " ASC"; } if($data['sort']=='r.upvotes')$sql .= ", downvotes ASC"; if (isset($data['start']) || isset($data['limit'])) { if ($data['start'] < 0) { $data['start'] = 0; } if ($data['limit'] < 1) { $data['limit'] = 20; } $sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit']; } $query = $this->db->query($sql); return $query->rows; } public function getOptions() { $sql = "SELECT `option_id`, `sort_order`, `name`, `min`, `max`, `values` FROM " . DB_PREFIX . "megareviews_options ORDER BY sort_order ASC"; $query = $this->db->query($sql); return $query->rows; } public function getReviewsInfo($pr_id) { $query = $this->db->query("SELECT FORMAT(AVG(rating),1) as avg FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND rating>-1 AND status=1"); $result["rating"] = $query->row['avg']; $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND status=1"); $result["count"] = $query->row['total']; $query = $this->db->query("SELECT COUNT(*) AS recommend FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND recommend=1 AND status=1"); $query1 = $this->db->query("SELECT COUNT(*) AS notrecommend FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND recommend=0 AND status=1"); if(($query->row['recommend']+$query1->row['notrecommend'])>0)$result["recommend"] = (int)($query->row['recommend']*100/($query->row['recommend']+$query1->row['notrecommend'])); //$query = $this->db->query("SELECT option_id, value FROM " . DB_PREFIX . "megareviewsoptions_to_review WHERE product_id='".$pr_id."'"); $options = $this->db->query("SELECT * FROM " . DB_PREFIX . "megareviews_options ORDER BY sort_order ASC"); foreach($options->rows as $option){ $query = $this->db->query("SELECT FORMAT(AVG(value),1) AS avg FROM " . DB_PREFIX . "megareviewsoptions_to_review WHERE review_id IN (SELECT review_id FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND status=1) AND option_id='".$option['option_id']."' AND value!='-1' "); $result["options"][$option['option_id']]=$query->row['avg']; } $ays = $this->db->query("SELECT * FROM " . DB_PREFIX . "megareviews_ays ORDER BY sort_order ASC"); foreach($ays->rows as $ay){ $query = $this->db->query("SELECT FORMAT(AVG(value),1) AS avg FROM " . DB_PREFIX . "megareviewsays_to_review WHERE review_id IN (SELECT review_id FROM " . DB_PREFIX . "megareviews WHERE product_id='".$pr_id."' AND status=1) AND ay_id='".$ay['ay_id']."' AND value!='-1'"); $result["ays"][$ay['ay_id']]=$query->row['avg']; } //$query = $this->db->query("SELECT ay_id, value FROM " . DB_PREFIX . "megareviewsays_to_review WHERE product_id='".$pr_id."'"); return $result; } public function getOptionValues($id){ $query = $this->db->query("SELECT o.option_id, o.value, oo.values, oo.name, oo.min, oo.max FROM " . DB_PREFIX . "megareviewsoptions_to_review o LEFT JOIN " . DB_PREFIX . "megareviews_options oo ON (o.option_id = oo.option_id) WHERE review_id='".$id."' && value>'-1'"); return $query->rows; } public function getAyValues($id){ $query = $this->db->query("SELECT a.ay_id, a.value, aa.values, aa.name, aa.sort_order FROM " . DB_PREFIX . "megareviewsays_to_review a LEFT JOIN " . DB_PREFIX . "megareviews_ays aa ON (a.ay_id = aa.ay_id) WHERE a.review_id='".$id."' && value>'-1' ORDER BY aa.sort_order"); return $query->rows; } public function getImages($id){ $query = $this->db->query("SELECT url as big FROM " . DB_PREFIX . "megareviewsimg_to_review WHERE review_id='".$id."' && url!=''"); return $query->rows; } public function getAys() { $sql = "SELECT `ay_id`, `sort_order`, `name`,`values` FROM " . DB_PREFIX . "megareviews_ays ORDER BY sort_order ASC"; $query = $this->db->query($sql); return $query->rows; } public function getTotalReviews() { $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "megareviews"); return $query->row['total']; } public function getTotalReviewsAwaitingApproval() { $query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review WHERE status = '0'"); return $query->row['total']; } }?>
Ну, всё правильно - никаких проверок нет, потому и ошибки. Контроллер в голом виде кидает POST в модель, а та сразу пытается впихнуть всё в базу не проверяя, есть ли в POST такие значения. Поскольку там только Notice и Warning, обработку кода эти ошибки не останавливают, потому оно и работает невзирая на них.
Скорее, наоборот - "незадумано" Автор не додумался, что при получении данных из каких-либо форм, которые к тому же заполняют посетители сайта, стоит добавить валидацию хотя бы на их заполненность, если вообще не по значениям. В общем - очередной дерьмомодуль. Кстати, он, случайно, не нуленный? А то там местами возникает ощущение, что плохо код после занула причесали (ну, либо автор ещё больший гавнокдер, чем кажется на первый взгляд).