コード例 #1
0
ファイル: sales.php プロジェクト: aldiunanto/sia
 public function store()
 {
     $vals = array('sales_username' => trim($this->input->post('sales_username')), 'sales_pwd' => md5($this->input->post('sales_pwd')), 'sales_email' => $this->input->post('sales_email'), 'sales_fname' => trim($this->input->post('sales_fname')), 'sales_lname' => trim($this->input->post('sales_lname')), 'sales_phone' => trim($this->input->post('sales_phone')), 'sales_gender' => $this->input->post('sales_gender'), 'sales_address' => trim($this->input->post('sales_address')), 'sales_city' => trim($this->input->post('sales_city')), 'sales_reg' => $this->input->post('sales_reg'), 'sales_about' => trim($this->input->post('sales_about')), 'visibility' => 1, 'created_at' => now(true));
     $this->sales->create($vals);
     $this->session->set_flashdata('message', '<div class="alert alert-success">A new sales successfully added.</div>');
     redirect('sales');
 }
コード例 #2
0
 public function getNow()
 {
     if (!$this->_now) {
         return now();
     }
     return $this->_now;
 }
コード例 #3
0
ファイル: Collection.php プロジェクト: rajarshc/Rooja
 public function _initSelect()
 {
     //die("<PRE>".$this->getSelect()->__toString(). "</PRE>");
     parent::_initSelect();
     $this->getSelect()->distinct(true)->joinInner(array('product_table' => $this->getTable('catalogrule/rule_product')), 'main_table.rule_id = product_table.rule_id', array())->where('from_time=0 or from_time<=? or to_time=0 or to_time>=?', now())->group('main_table.rule_id');
     //die("<PRE>".$this->getSelect()->__toString()."</PRE>");
 }
コード例 #4
0
ファイル: empl_status.php プロジェクト: abdulghanni/_zohobiz_
 public function ajax_update()
 {
     $this->_validate();
     $data = array('title' => $this->input->post('title'), 'edited_on' => date('Y-m-d H:i:s', now()), 'edited_by' => GetUserID());
     $this->empl_status_model->update(array('id' => $this->input->post('id')), $data);
     echo json_encode(array("status" => TRUE));
 }
コード例 #5
0
ファイル: contact.php プロジェクト: manhhung86it/cyafun
 public function index()
 {
     //        $this->user_manager->authenticate();
     $this->load->model('contact_model', 'contact');
     $contact = $this->contact->getContactPages(3);
     $dataContact = array('content' => $contact['content'], 'title' => $contact['title']);
     $posts = $this->input->post();
     if ($posts) {
         $this->load->library('setting_manager');
         $this->load->helper('date');
         $this->load->model('contact_model', 'contact');
         $this->load->library('mail');
         $this->config->load('email', TRUE);
         $data = $posts;
         $validate = $this->setting_manager->contactValidate($data);
         if (empty($validate)) {
             $reply = 0;
             $to_add = array("name" => $data['name'], "email" => $data['email'], "phone" => $data['phone'], "message" => $data['content'], "date_add" => date('Y-m-d H:i:s', now()), "reply" => $reply);
             $insert = $this->contact->insert($to_add);
             $mailTo['name'] = $data['name'];
             $mailTo['email'] = $this->config->item('email_contact_from', 'email');
             $dataEmail['email'] = $data['email'];
             $dataEmail['name'] = $data['name'];
             $dataEmail['phone'] = $data['phone'];
             $dataEmail['content'] = $data['content'];
             sentMailTemp($mailTo, 'contact', $dataEmail);
             $this->data['success'] = 'Your Mail has been sent successfully';
             redirect('contact/index');
         } else {
             $this->data['data_error'] = $validate;
         }
     }
     $this->data['contact'] = $dataContact;
     $this->load('front_layout', 'contact');
 }
コード例 #6
0
ファイル: twitter.php プロジェクト: no2key/MuuCMS
 public function saveUser($user)
 {
     $exist = $this->exist($user->screen_name);
     if (!$exist) {
         $this->helper("time");
         $date = now(4);
         $imageProfile = str_replace("normal", "bigger", $user->profile_image_url);
         if (!$user->url) {
             $website = "http://twitter.com/" . $user->screen_name;
         } else {
             $website = $user->url;
         }
         $fields = "Username, Website, Avatar, Rank, Start_Date, Type";
         $values = "'{$user->screen_name}', '{$website}', '{$imageProfile}', 'Beginner', '{$date}', 'Twitter'";
         $this->Db->table("users", $fields);
         $this->Db->values($values);
         $insertID = $this->Db->save();
         $fields = "ID_User, Name, Twitter";
         $values = "'{$insertID}', '{$user->name}', '{$user->screen_name}'";
         $this->Db->table("users_information", $fields);
         $this->Db->values($values);
         $this->Db->save();
         $this->Twitter_Api->welcome();
         return $this->exist($user->screen_name);
     } else {
         return $exist;
     }
 }
コード例 #7
0
 public function saveAnswerAction()
 {
     if (!Mage::getSingleton('customer/session')->authenticate($this)) {
         Mage::getSingleton('core/session')->addError(Mage::helper('askit')->__('Sorry, only logined customer can add self answer.'));
         $this->_redirectReferer();
         return;
     }
     $customerName = (string) $this->getRequest()->getParam('askitCustomer');
     $email = (string) $this->getRequest()->getParam('askitEmail');
     if (!$customerName || !$email || !Mage::getStoreConfig('askit/general/allowedCustomerAnswer')) {
         $this->_redirectReferer();
         return;
     }
     $answer = (string) $this->getRequest()->getParam('askitAnswer');
     $questionId = (string) $this->getRequest()->getParam('question');
     $productId = (int) $this->getRequest()->getParam('product');
     $customerId = (int) Mage::getSingleton('customer/session')->getCustomerId();
     $model = Mage::getModel('askit/askIt');
     $storeId = Mage::getModel('askit/askIt')->load($questionId)->getStoreId();
     $defaultAnswerStatus = Mage::getStoreConfig('askit/general/defaultAnswerStatus');
     //pending
     $model->setText(strip_tags($answer))->setStoreId($storeId)->setProductId($productId)->setCustomerId($customerId)->setHint(0)->setParentId($questionId)->setCustomerName($customerName)->setEmail($email)->setCreatedTime(now())->setUpdateTime(now())->setStatus($defaultAnswerStatus)->save();
     Mage::getSingleton('core/session')->addSuccess(Mage::helper('askit')->__('Your answer has been accepted'));
     $this->_redirectReferer();
 }
コード例 #8
0
 public function saveAction()
 {
     if ($data = $this->getRequest()->getPost()) {
         $model = Mage::getModel('testimonials/testimonials');
         $model->setData($data)->setId($this->getRequest()->getParam('id'));
         try {
             if (!$model->getId()) {
                 $model->setCreatedTime(now());
             }
             $model->setUpdateTime(now());
             $url = $data['url'];
             $model->save();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonials')->__('Testimonial was successfully saved'));
             Mage::getSingleton('adminhtml/session')->setFormData(false);
             if ($this->getRequest()->getParam('back')) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
                 return;
             }
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
             Mage::getSingleton('adminhtml/session')->setFormData($data);
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonials')->__('Unable to find item to save'));
     $this->_redirect('*/*/');
 }
コード例 #9
0
 public function apontar_componente()
 {
     $of = trim($this->input->post('of'));
     $produto = trim($this->input->post('produto'));
     $componente = trim($this->input->post('componente'));
     $quantidade = (int) trim($this->input->post('quantidade'));
     $motivo = trim($this->input->post('motivo'));
     //se o motivo for igual a "D" (desabastecer), altera o valor para negativo
     if ($motivo == "D") {
         $quantidade = (int) $quantidade * -1;
     }
     if ((int) $quantidade != 0) {
         $session_data = $this->session->userdata('logged_in');
         $dados = array('cd_of' => $of, 'cd_produto' => $produto, 'cd_componente' => $componente, 'qt_apontada' => $quantidade, 'dt_apontamento' => date('YmdHis', now()), 'username' => $session_data['username'], 'cd_motivo' => $motivo);
         if ($this->apontamento_model->do_insert($dados) == TRUE) {
             echo '<div class="alert alert-success">' . ' Arquivo apontado com sucesso.</div>';
         } else {
             echo '<div class="alert alert-danger" role="alert">
                  <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                  <span class="sr-only">Error:</span>FAvor verificar dados inseridos</div>';
         }
     }
     $dados = array('dados_of' => $this->ordem_producao_model->get_dados_of($of, $produto)->row(), 'cd_componente' => $componente, 'tela' => 'apontar', 'pasta' => 'apontamento', 'status' => $this->apontamento_model->get_hist_apon($of, $produto, $componente)->result());
     $this->load->view('conteudo', $dados);
 }
コード例 #10
0
 public function saveAction()
 {
     if ($data = $this->getRequest()->getPost()) {
         if (isset($_FILES['content_bg_img']['name']) && $_FILES['content_bg_img']['name'] != null) {
             $result['file'] = '';
             try {
                 /* Starting upload */
                 $uploader = new Varien_File_Uploader('content_bg_img');
                 // Any extention would work
                 $uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
                 $uploader->setAllowRenameFiles(true);
                 // Set the file upload mode
                 // false -> get the file directly in the specified folder
                 // true -> get the file in the product like folders
                 //	(file.jpg will go in something like /media/f/i/file.jpg)
                 $uploader->setFilesDispersion(false);
                 // We set media as the upload dir
                 $path = Mage::getBaseDir('media') . DS . 'queldorei/shopper' . DS;
                 $result = $uploader->save($path, $_FILES['content_bg_img']['name']);
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError($e->getMessage() . '  ' . $path);
                 Mage::getSingleton('adminhtml/session')->setFormData($data);
                 $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
                 return;
             }
             $data['content_bg_img'] = 'queldorei/shopper/' . $result['file'];
         } else {
             if (isset($data['content_bg_img']['delete']) && $data['content_bg_img']['delete'] == 1) {
                 $data['content_bg_img'] = '';
             } else {
                 unset($data['content_bg_img']);
             }
         }
         $model = Mage::getModel('shoppercategories/shoppercategories');
         $model->setData($data)->setId($this->getRequest()->getParam('id'));
         try {
             if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
                 $model->setCreatedTime(now())->setUpdateTime(now());
             } else {
                 $model->setUpdateTime(now());
             }
             $model->save();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shoppercategories')->__('Color Scheme was successfully saved'));
             Mage::getSingleton('adminhtml/session')->setFormData(false);
             if ($this->getRequest()->getParam('back')) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
                 return;
             }
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
             Mage::getSingleton('adminhtml/session')->setFormData($data);
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('shoppercategories')->__('Unable to find item to save'));
     $this->_redirect('*/*/');
 }
コード例 #11
0
 protected function _sendEmail()
 {
     $data = $this->getRequest()->getParams();
     $senderInfo = $data['sender'];
     $recipients = $data['recipients'];
     $recipientEmail = $recipients['email'];
     $recipientName = $recipients['name'];
     $offer = Mage::getModel('customerreward/offer')->load($this->getRequest()->getParam('offer_id'));
     $offer->setCurrentDate(Mage::helper('core')->formatDate(now(), 'long'));
     $description = Mage::getBlockSingleton('customerreward/offer_view')->setOffer($offer)->getTitleDescriptionHtml();
     $offer->setTitleHtml($description['title']);
     $offer->setDescription($description['description']);
     $offer->setImageUrl(Mage::getBaseUrl('media') . $offer->getImage());
     if (Mage::helper('customerreward')->getReferConfig('coupon')) {
         $offer->setCoupon($data['coupon']);
     }
     //send email
     $translate = Mage::getSingleton('core/translate');
     $translate->setTranslateInline(false);
     $mailTemplate = Mage::getModel('core/email_template');
     $message = nl2br(htmlspecialchars($senderInfo['message']));
     $sender = array('name' => Mage::helper('customerreward')->htmlEscape($senderInfo['name']), 'email' => Mage::helper('customerreward')->htmlEscape($senderInfo['email']));
     $mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()));
     $template = Mage::helper('customerreward')->getEmailConfig('sendfriend');
     foreach ($recipientEmail as $k => $email) {
         $name = $recipientName[$k];
         $mailTemplate->sendTransactional($template, 'sales', $email, $name, array('store' => Mage::app()->getStore(), 'name' => $name, 'email' => $email, 'message' => $message, 'sender_name' => $sender['name'], 'sender_email' => $sender['email'], 'title' => $data['title'], 'url' => $data['url'], 'offer' => $offer));
     }
     $translate->setTranslateInline(true);
     return $this;
 }
コード例 #12
0
 public function saveAction()
 {
     $model = Mage::getModel('contest/participant');
     if ($data = $this->getRequest()->getPost()) {
         $model->setData($data)->setId($this->getRequest()->getParam('id'));
         try {
             if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
                 $model->setCreatedTime(now())->setUpdateTime(now());
             } else {
                 $model->setUpdateTime(now());
             }
             $model->save();
             if (!empty($data["contest_participant_send_mail"]) && $data["contest_participant_send_mail"] == 1) {
                 // SEND EMAIL TO PARTICPANT
                 $this->_sendEmailToParticipant($this->getRequest()->getParam('id'));
             }
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('contest')->__('Participant was successfully saved'));
             Mage::getSingleton('adminhtml/session')->setFormData(false);
             if ($this->getRequest()->getParam('back')) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
                 return;
             }
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
             Mage::getSingleton('adminhtml/session')->setFormData($data);
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('contest')->__('Unable to find item to save'));
     $this->_redirect('*/*/');
 }
コード例 #13
0
 public function validate()
 {
     $hlp = Mage::helper('umicrosite');
     $dhlp = Mage::helper('udropship');
     extract($this->getData());
     $hasPasswordField = false;
     foreach ($this->getRegFields() as $rf) {
         $rfName = str_replace('[]', '', $rf['name']);
         if (!empty($rf['required']) && !$this->getData($rfName) && !in_array($rf['type'], array('image', 'file')) && !in_array($rfName, array('payout_paypal_email'))) {
             Mage::throwException($hlp->__('Incomplete form data'));
         }
         $hasPasswordField = $hasPasswordField || in_array($rfName, array('password_confirm', 'password'));
         if ($rfName == 'password_confirm' && $this->getData('password') != $this->getData('password_confirm')) {
             Mage::throwException($hlp->__('Passwords do not match'));
         }
     }
     $this->setStreet(@$street1 . "\n" . @$street2);
     $this->initPassword(@$password);
     $this->initUrlKey(@$url_key);
     $this->setRemoteIp($_SERVER['REMOTE_ADDR']);
     $this->setRegisteredAt(now());
     $this->setStoreId(Mage::app()->getStore()->getId());
     $dhlp->processCustomVars($this);
     $this->attachLabelVars();
     return $this;
 }
コード例 #14
0
 public function saveAction()
 {
     $session = Mage::getSingleton('adminhtml/session');
     if ($data = $this->getRequest()->getPost()) {
         $model = Mage::getModel('prodfaqs/prodfaqs');
         $model->setData($data)->setId($this->getRequest()->getParam('id'));
         try {
             if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
                 $model->setCreatedTime(now())->setUpdateTime(now());
             } else {
                 $model->setUpdateTime(now());
             }
             $model->save();
             if ($data['customer_email'] != '' && $data['send_mail_to'] == 1) {
                 Mage::helper('prodfaqs')->sendEmailToClient($data);
             }
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('prodfaqs')->__('Faq was successfully saved'));
             Mage::getSingleton('adminhtml/session')->setFormData(false);
             if ($this->getRequest()->getParam('back')) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
                 return;
             }
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
             Mage::getSingleton('adminhtml/session')->setFormData($data);
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('prodfaqs')->__('Unable to find Faq to save'));
     $this->_redirect('*/*/');
 }
コード例 #15
0
 public function saveAction()
 {
     //$accomplish_want = $this->getRequest()->getParam('accomplish_want');
     //$recommend = $this->getRequest()->getParam('recommend');
     //$about_concern = $this->getRequest()->getParam('about_concern');
     $name = $this->getRequest()->getParam('name');
     $email = $this->getRequest()->getParam('email');
     $phone = $this->getRequest()->getParam('phone');
     $help = $this->getRequest()->getParam('help');
     $comment = $this->getRequest()->getParam('comment');
     //$best_time = $this->getRequest()->getParam('best_time');
     // $concern_number = $this->getRequest()->getParam('concern_number');
     /* Mail Function */
     $to = "*****@*****.**";
     $subject = 'Customer Feedback';
     $msg = '<html><head>';
     $msg .= '<title>Feedback Details</title>';
     $msg .= '</head>';
     $msg .= '<table border="1" cellspacing="1">';
     $msg .= "<tr><td>Name</td><td>" . $name . "</td></tr>";
     $msg .= "<tr><td>Email Address</td><td>" . $email . "</td></tr>";
     $msg .= "<tr><td>Mobile Number</td><td>" . $phone . "</td></tr>";
     $msg .= "<tr><td>Category</td><td>" . $help . "</td></tr>";
     $msg .= "<tr><td>Tell us more about your feedback or inquiry</td><td>" . $comment . "</td></tr>";
     $msg .= "</table>";
     $msg .= "</html>";
     // To send HTML mail, the Content-type header must be set
     $headers = 'MIME-Version: 1.0' . "\r\n";
     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
     mail($to, $subject, $msg, $headers);
     /* End Mail function */
     $model = Mage::getModel('feedback/feedback');
     $model->setData($data)->setId($this->getRequest()->getParam('id'));
     $model->setHelp($help);
     $model->setComment($comment);
     $model->setPhone($phone);
     $model->setName($name);
     $model->setEmail($email);
     try {
         if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
             $model->setCreatedTime(now())->setUpdateTime(now());
         } else {
             $model->setUpdateTime(now());
         }
         $model->save();
         Mage::getSingleton('core/session')->addSuccess(Mage::helper('feedback')->__('Thank you for your feedback. Your opinion is important to us.'));
         Mage::getSingleton('core/session')->setFormData(false);
         if ($this->getRequest()->getParam('back')) {
             $this->_redirect('*/*/edit', array('id' => $model->getId()));
             return;
         }
         $this->_redirect('*/*/');
         return;
     } catch (Exception $e) {
         Mage::getSingleton('core/session')->addError($e->getMessage());
         Mage::getSingleton('core/session')->setFormData($data);
         $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
         return;
     }
 }
コード例 #16
0
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'tgl' => $this->input->post('tgl', TRUE), 'tgl_kedaluarsa' => $this->input->post('tgl_kedaluarsa', TRUE), 'tgl_terima' => $this->input->post('tgl_terima', TRUE), 'id_customer' => $this->input->post('id_customer', TRUE), 'id_sales' => $this->input->post('id_sales', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'ref' => $this->input->post('ref', TRUE), 'id_bayar' => $this->input->post('id_bayar', TRUE), 'totalbayar' => $this->input->post('total', TRUE), 'pajak' => $this->input->post('pajak', TRUE), 'total_pajak' => $this->input->post('total_pajak', TRUE), 'grandtotal' => $this->input->post('grandtotal', TRUE), 'uangmuka' => $this->input->post('uangmuka', TRUE), 'sisa' => $this->input->post('sisa', TRUE), 'biaya_lain' => $this->input->post('biayakirim', TRUE), 'status' => $this->input->post('status', TRUE), 'id_user' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('sales_order', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
コード例 #17
0
 /**
  * Log the data for the given observer model.
  *
  * @param Varien_Event_Observer $observer Observer Instance
  */
 public function log(Varien_Event_Observer $observer)
 {
     /* @var $history FireGento_AdminMonitoring_Model_History */
     $history = Mage::getModel('firegento_adminmonitoring/history');
     $history->setData(array('object_id' => $observer->getObjectId(), 'object_type' => $observer->getObjectType(), 'content' => $observer->getContent(), 'content_diff' => $observer->getContentDiff(), 'user_agent' => $this->getUserAgent(), 'ip' => $this->getRemoteAddr(), 'user_id' => $this->getUserId(), 'user_name' => $this->getUserName(), 'action' => $observer->getAction(), 'created_at' => now()));
     $history->save();
 }
コード例 #18
0
 /**
  * 商户提交入驻申请
  * @method insert
  */
 public function insert()
 {
     $model = D('Merchant');
     if (!$model->create()) {
         $this->error($model->getError());
     }
     $model->authorization_start_time = now();
     $model->authorization_end_time = date('Y-m-d H:i:s', strtotime('+1 month', time()));
     $imgData = I('post.imgData');
     if (empty($imgData)) {
         $this->error('请上传商户图片');
     }
     $imgData = explode('|', $imgData);
     $imgData = array_filter($imgData);
     $model->startTrans();
     $merchant_id = $model->add();
     $insert_img = D('MerchantImg')->insert($imgData, $merchant_id);
     if ($merchant_id !== false && $insert_img !== false) {
         $model->commit();
         $this->success('新增成功', U('Index/index'));
     } else {
         $model->rollback();
         $this->error('新增失败');
     }
 }
コード例 #19
0
ファイル: widgets_m.php プロジェクト: baltag/pyrocms
 public function insert_instance($input)
 {
     $this->load->helper('date');
     $last_widget = $this->db->select('`order`')->order_by('`order`', 'desc')->limit(1)->get_where('widget_instances', array('widget_area_id' => $input['widget_area_id']))->row();
     $order = isset($last_widget->order) ? $last_widget->order + 1 : 1;
     return $this->db->insert('widget_instances', array('title' => $input['title'], 'widget_id' => $input['widget_id'], 'widget_area_id' => $input['widget_area_id'], 'options' => $input['options'], '`order`' => $order, 'created_on' => now(), 'updated_on' => now()));
 }
コード例 #20
0
 public function getIndex(Request $request, $param1 = null, $param2 = null, $param3 = null, $param4 = null)
 {
     if (strtolower($param1) === 'generate') {
         return $this->getGenerate($request);
     } else {
         if (is_year($param1) && is_null($param2) && is_null($param3) && is_null($param4)) {
             return $this->makeMonthsView($request, $param1);
         } else {
             if (is_year($param1) && is_month($param2) && is_null($param3) && is_null($param4)) {
                 return $this->makeListView($request, $param1, $param2, $param3);
             } else {
                 if (is_year($param1) && is_month($param2) && !is_null($param3) && is_null($param4)) {
                     if (is_day($param3)) {
                         return $this->makeDayView($request, $param1, $param2, $param3);
                     } else {
                         if (is_uuid($param3)) {
                             return $this->makeMonthEmployeeView($request, $param1, $param2, $param3);
                         } else {
                             return redirect('/dtr/' . now('year'));
                         }
                     }
                 } else {
                     if (is_year($param1) && is_month($param2) && is_day($param3)) {
                         return $this->makeDayEmployeeView($request, $param1, $param2, $param3, $param4);
                     } else {
                         return redirect('/dtr/' . now('year'));
                     }
                 }
             }
         }
     }
     //.'/'.now('month'));//return $this->makeListView($request, $param1, $param2, $param3);
 }
コード例 #21
0
 /**
  * Called whenever a new or existing post is saved.
  */
 public function saveAction()
 {
     $request = $this->getRequest();
     if ($data = $request->getPost()) {
         $model = Mage::getModel("blog/post");
         if ($id = $request->getParam("id")) {
             $model->load($id);
             $newPost = false;
         } else {
             $newPost = true;
         }
         $model->setData($data)->setId($id);
         try {
             $nowTime = now();
             if ($request->getParam("created_time") == NULL) {
                 $model->setCreatedTime($nowTime)->setUpdateTime($nowTime);
             } else {
                 $model->setUpdateTime($nowTime);
             }
             $userString = Mage::getSingleton('admin/session')->getUser()->getFirstname() . " " . Mage::getSingleton('admin/session')->getUser()->getLastname();
             if ($request->getParam("user") == NULL) {
                 $model->setUser($userString)->setUpdateUser($userString);
             } else {
                 $model->setUpdateUser($userString);
             }
             $model->save();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('blog')->__('Post was saved successfully.'));
             Mage::getSingleton('adminhtml/session')->setFormData(false);
             // If this is a new post, we need to ensure it shows up immediately on the frontend.
             $newStatus = $model->getStatus();
             if ($newPost && $newStatus == Fontis_Blog_Model_Status::STATUS_ENABLED) {
                 Mage::helper("blog")->enablePost($model);
             } else {
                 if (!$newPost) {
                     $oldStatus = $model->getOrigData("status");
                     if ($oldStatus == Fontis_Blog_Model_Status::STATUS_ENABLED && ($newStatus == Fontis_Blog_Model_Status::STATUS_DISABLED || $newStatus == Fontis_Blog_Model_Status::STATUS_HIDDEN)) {
                         Mage::helper("blog")->disablePost();
                     } else {
                         if (($oldStatus == Fontis_Blog_Model_Status::STATUS_DISABLED || $oldStatus == Fontis_Blog_Model_Status::STATUS_HIDDEN) && $newStatus == Fontis_Blog_Model_Status::STATUS_ENABLED) {
                             Mage::helper("blog")->enablePost($model);
                         }
                     }
                 }
             }
             if ($request->getParam('back')) {
                 $this->_redirect('*/*/edit', array('id' => $model->getId()));
                 return;
             }
             $this->_redirect('*/*/');
             return;
         } catch (Exception $e) {
             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
             Mage::getSingleton('adminhtml/session')->setFormData($data);
             $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
             return;
         }
     }
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('blog')->__('Unable to find post to save.'));
     $this->_redirect('*/*/');
 }
コード例 #22
0
ファイル: Famous.php プロジェクト: ZuoYouLai/tkglxtphp
 /**
  * 修改专题
  * Enter description here ...
  */
 public function edit()
 {
     $cmd = $this->input->post('cmd');
     if ($cmd && $cmd == 'submit') {
         $id = $this->input->post('id');
         $dataArray = array('title' => $this->input->post('title'), 'description' => $this->input->post('description'), 'content' => html_escape($_POST['content']), 'province' => $this->input->post('province'), 'city' => $this->input->post('city'), 'district' => $this->input->post('district'), 'street' => '', 'status' => $this->input->post('status'), 'create_id' => $this->input->post('create_id'), 'create_time' => now());
         //print_r($dataArray);exit;
         $result = $this->FamousModel->edit($dataArray, 'id=' . $id);
         if ($result) {
             show_error('index.php/Famous/index', 500, '提示信息:名媛专题修改成功!');
         } else {
             show_error('index.php/Famous/edit', 500, '提示信息:名媛专题修改失败!');
         }
     } else {
         $id = $this->input->get('id');
         if ($id) {
             $famous = $this->FamousModel->getModel('id=' . $id);
             if ($famous) {
                 $lady = $this->MemberModel->getList('is_lady=1');
                 if ($lady) {
                     $this->load->view('Famous/edit', array('lady' => $lady, 'famous' => $famous));
                 } else {
                     show_error('index.php/Index/index', 500, '提示信息:请先添加名媛数据,在新增名媛专题!');
                 }
             } else {
                 show_error('index.php/Famous/index', 500, '提示信息:专题不存在或已被删除!');
             }
         } else {
             show_error('index.php/Famous/index', 500, '提示信息:参数错误!');
         }
     }
 }
コード例 #23
0
ファイル: ads.class.php プロジェクト: reactvideos/Website
 /**
  * Function used to add new advertisment in ClipBucket
  * @param : Array
  */
 function AddAd($array = NULL)
 {
     global $LANG, $db;
     if (!$array) {
         $array = $_POST;
     }
     $name = mysql_clean($array['name']);
     // $code		= mysql_real_escape_string(htmlspecialchars($array['code']));
     $code = mysql_clean(htmlspecialchars($array['code']));
     $placement = mysql_clean($array['placement']);
     $category = $array['category'];
     $status = $array['status'];
     if (empty($name)) {
         $msg = e(lang('ad_name_error'));
     } else {
         $count = $db->count(tbl("ads_data"), "ad_id", " ad_name='{$name}'");
         if ($count > 0) {
             e(lang('ad_exists_error2'));
         } else {
             $db->insert(tbl("ads_data"), array("ad_category", "ad_name", "ad_placement", "ad_code", "ad_status", "date_added"), array($category, $name, $placement, $code, $status, now()));
             $msg = e(lang('ad_add_msg'), 'm');
         }
         return $msg;
     }
 }
コード例 #24
0
 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (preg_match("/^dbplug:([^:]+)\$/", $targetString, $matches)) {
         $database_user = $map->get_hint('dbplug_dbuser');
         $database_pass = $map->get_hint('dbplug_dbpass');
         $database_name = $map->get_hint('dbplug_dbname');
         $database_host = $map->get_hint('dbplug_dbhost');
         $key = mysql_real_escape_string($matches[1]);
         // This is the one line you will certainly need to change
         $SQL = "select in,out from table where host={$key} LIMIT 1";
         if (mysql_connect($database_host, $database_user, $database_pass)) {
             if (mysql_select_db($database_name)) {
                 $result = mysql_query($SQL);
                 if (!$result) {
                     wm_warn("dbplug ReadData: Invalid query: " . mysql_error() . "\n");
                 } else {
                     $row = mysql_fetch_assoc($result);
                     $data[IN] = $row['in'];
                     $data[OUT] = $row['out'];
                 }
             } else {
                 wm_warn("dbplug ReadData: failed to select database: " . mysql_error() . "\n");
             }
         } else {
             wm_warn("dbplug ReadData: failed to connect to database server: " . mysql_error() . "\n");
         }
         $data_time = now();
     }
     wm_debug("RRD ReadData dbplug: Returning (" . ($data[IN] === null ? 'null' : $data[IN]) . "," . ($data[OUT] === null ? 'null' : $data[IN]) . ", {$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
コード例 #25
0
 public function do_upload()
 {
     $config = array('upload_path' => './uploads/honor/', 'allowed_types' => 'doc|png|gif|jpg', 'file_name' => date("YmdHis"), 'max_size' => 2048);
     $this->load->library('upload', $config);
     if (!$this->upload->do_upload()) {
         $error = array('error' => $this->upload->display_errors());
     } else {
         $data['upload_data'] = $this->upload->data();
         $config = array('width' => 150, 'height' => 100, 'maintain_ration' => TRUE, 'source_image' => $data['upload_data']['full_path'], 'new_image' => './uploads/honor/thumbs/');
         if ($this->input->post('updata')) {
             /*  判断是否修改 */
             $cases_title = $this->input->post('honor_name');
             $cases_content = strip_tags($this->input->post('content'));
             $id = $this->input->post('id');
             $data = array('title' => $cases_title, 'content' => $cases_content, 'img' => $data['upload_data']['file_name']);
             $this->db->where('id', $id);
             $this->db->update('cases', $data);
         } else {
             $cases_title = $this->input->post('honor_name');
             $cases_content = strip_tags($this->input->post('editorValue'));
             $data = array('title' => $cases_title, 'content' => $cases_content, 'addtime' => date('Y-m-d H:i:s', now()), 'type' => 'honor', 'img' => $data['upload_data']['file_name']);
             $this->db->insert('cases', $data);
         }
         $this->load->library('image_lib', $config);
         $this->image_lib->resize();
     }
 }
コード例 #26
0
 function update($id)
 {
     $data = array('id' => $this->input->post('id', TRUE), 'faktur' => $this->input->post('faktur', TRUE), 'faktur_reff' => $this->input->post('faktur_reff', TRUE), 'tanggal' => $this->input->post('tanggal', TRUE), 'id_gudang' => $this->input->post('id_gudang', TRUE), 'keterangan' => $this->input->post('keterangan', TRUE), 'akun' => $this->input->post('akun', TRUE), 'total_nilai' => $this->input->post('total_nilai', TRUE), 'user_id' => userid(), 'datetime' => now());
     $this->db->where('id', $id);
     $this->db->update('penyesuaian', $data);
     /*'datetime' => date('Y-m-d H:i:s'),*/
 }
コード例 #27
0
ファイル: kasus_m.php プロジェクト: blekedeg/lbhpers
 public function get_many_by($params = array())
 {
     if (!empty($params['month'])) {
         $this->db->where('MONTH(FROM_UNIXTIME(' . $this->db->dbprefix('kasus') . '.created_on))', $params['month']);
     }
     if (!empty($params['year'])) {
         $this->db->where('YEAR(FROM_UNIXTIME(' . $this->db->dbprefix('kasus') . '.created_on))', $params['year']);
     }
     if (!empty($params['keywords'])) {
         $this->db->like('kasus.title', trim($params['keywords']));
     }
     // Is a status set?
     if (!empty($params['status'])) {
         // If it's all, then show whatever the status
         if ($params['status'] != 'all') {
             // Otherwise, show only the specific status
             $this->db->where('status', $params['status']);
         }
     } else {
         $this->db->where('status', 1);
     }
     // By default, dont show future posts
     if (!isset($params['show_future']) || isset($params['show_future']) && $params['show_future'] == false) {
         $this->db->where('kasus.created_on <=', date('Y-m-d H:i:s', now()));
     }
     // Limit the results based on 1 number or 2 (2nd is offset)
     if (isset($params['limit']) && is_array($params['limit'])) {
         $this->db->limit($params['limit'][0], $params['limit'][1]);
     } elseif (isset($params['limit'])) {
         $this->db->limit($params['limit']);
     }
     return $this->get_all();
 }
コード例 #28
0
function sane($in_lat, $in_lng, $in_time)
{
    // applies sanity check to input values - returns boolean - 2/22/12
    snap(__LINE__, $in_lat);
    snap(__LINE__, $in_lng);
    snap(__LINE__, $in_time);
    if (!is_float($in_lat) || !is_float($in_lng) || !is_int($in_time)) {
        return FALSE;
    }
    // 2/22/12
    if (abs($in_lat > 90.0)) {
        return FALSE;
    }
    if (abs($in_lat == 0.0) || abs($in_lng == 0.0)) {
        return FALSE;
    }
    if (abs($in_lng) > 180.0) {
        return FALSE;
    }
    $one_day = 24 * 60 * 60;
    // set 24-hour window each side of now - 2/22/12
    $ts_threshold_p = now() - $one_day;
    // past
    $ts_threshold_f = now() + $one_day;
    // future
    //	return (!(($in_time<$ts_threshold_p) || ($in_time>$ts_threshold_f)));		// 2/22/12
    return $in_time > $ts_threshold_p && $in_time < $ts_threshold_f;
    // 2/22/12
}
コード例 #29
0
ファイル: noise.php プロジェクト: NeuronsWork/7tual
 public function __construct()
 {
     parent::__construct();
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
     $this->output->set_header("Pragma: no-cache");
     $this->load->model('noise_model');
     if ($this->auth->is_logged() == FALSE) {
         $this->status_login = "******";
         $this->key_activation = $this->generate_key(20);
     } else {
         $this->status_login = "******";
     }
     // LOAD LIBRARY SLUG
     $config = array('table' => 'notion', 'id' => 'id_notion', 'field' => 'slug', 'title' => 'title', 'replacement' => 'dash');
     $this->load->library('slug', $config);
     ## FECHA
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = false;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
     //$this->name_country = $this->country->ip_info('Visitor', 'Country');
     //$this->code_country = $this->country->ip_info("Visitor", "Country Code");
     $this->name_country = 'PERU';
     $this->code_country = 'PE';
     //$this->state        = $this->country->ip_info('181.66.157.144', 'State');
 }
コード例 #30
0
function shutdown()
{
	$error=error_get_last();
	if(is_array($error))
	{
	   if($error['type']==E_ERROR || $error['type']==E_CORE_ERROR || $error['type']==E_COMPILE_ERROR) // Håndterer fatal errors
	   {
			$feilmelding=now();
			foreach($error as $value)
			{
				$feilmelding.=" - $value";
			}
			logFatal($feilmelding);
			header("Location: error.php");
		}
		if($error['type']==E_WARNING || $error['type']==E_PARSE) // Håndterer warning og parse
	   {
			$feilmelding=now();
			foreach($error as $value)
			{
				$feilmelding.=" - $value";
			}
			logError($feilmelding);
		}
	}
}