Exemple #1
0
 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('web_model');
     if ($this->auth->is_logged() == FALSE) {
         $this->status_login = "******";
         $this->key_activation = $this->generate_key(20);
     } else {
         $this->status_login = "******";
     }
     /* Obtenemos la fecha actual */
     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';
 }
 public function set_weld($rowArr = array())
 {
     $postInfo = array();
     if (sizeof($rowArr) > 0) {
         $postInfo = $rowArr;
     } else {
         foreach ($_POST as $key => $value) {
             if ($key == "PROGRESS_RECID" || $key == "index" || $key == "remarks1" || $key == "idField" || $key == "_defaultId") {
                 continue;
             }
             $postInfo[$key] = mysql_real_escape_string($value);
         }
         //$postInfo['logupdate'] = $postInfo['loguser'] . " " . mdate("%Y-%m-%d %H:%i:%s");
         $postInfo['logdate'] = mdate("%Y-%m-%d %H:%i:%s");
         $postInfo['logtime'] = mdate("%H:%i:%s");
     }
     if (intval($_POST['index']) == 0) {
         $sql = "DELETE FROM {$this->tblName}";
         $query = $this->qms_pip->query($sql);
     }
     if ($_POST['PROGRESS_RECID'] == "0") {
         $query = $this->qms_pip->set($postInfo);
         $query = $this->qms_pip->insert($this->tblName);
     } else {
         $query = $this->qms_pip->where('PROGRESS_RECID', $_POST['PROGRESS_RECID']);
         $query = $this->qms_pip->update($this->tblName, $postInfo);
     }
     return $query;
 }
Exemple #3
0
 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');
 }
 public function new_user_post()
 {
     $fn = $this->post("firstname");
     $ln = $this->post("lastname");
     $gender = $this->post("gender");
     $dob = $this->post("dob");
     $cnid = $this->post("country");
     $email = $this->post("email");
     $pwd = $this->post("pwd");
     $datetime = mdate('%Y-%m-%d %h:%i:%s', time());
     //$ra=rand(10000,100000);
     //$ra=$email.$ra;
     $link = md5($email);
     // to create randum number for activation link
     $pwd = do_hash($pwd, 'md5');
     if ($fn && $ln && $dob && $gender && $cnid && $email && $pwd && $datetime && $link) {
         $this->load->model("registration_model");
         $new_user = $this->registration_model->create_user($fn, $ln, $dob, $gender, $cnid, $email, $pwd, $datetime, $link);
         if ($new_user === false) {
             $this->response(array("status" => "failed"));
         } else {
             $this->response(array("status" => "success"));
         }
     }
 }
 public function addUser($add = array())
 {
     $query = FALSE;
     $this->db->where('sort', 'prefs')->where('item', 'ti_setup')->delete('settings');
     $this->db->set('sort', 'prefs')->set('item', 'ti_setup')->set('value', 'installed')->set('serialized', '0')->insert('settings');
     if (!empty($add['site_email'])) {
         $this->db->where('staff_email', strtolower($add['site_email']));
         $this->db->delete('staffs');
         $this->db->set('staff_email', strtolower($add['site_email']));
     }
     if (!empty($add['staff_name'])) {
         $this->db->set('staff_name', $add['staff_name']);
     }
     $this->db->set('staff_group_id', '11')->set('staff_location_id', '0')->set('language_id', '11')->set('timezone', '0')->set('staff_status', '1');
     $this->db->set('date_added', mdate('%Y-%m-%d', time()));
     $query = $this->db->insert('staffs');
     if ($this->db->affected_rows() > 0 && $this->db->insert_id()) {
         $staff_id = $this->db->insert_id();
         if (!empty($add['username'])) {
             $this->db->where('username', $add['username']);
             $this->db->delete('users');
             $this->db->set('username', $add['username']);
             $this->db->set('staff_id', $staff_id);
         }
         if (!empty($add['password'])) {
             $this->db->set('salt', $salt = substr(md5(uniqid(rand(), TRUE)), 0, 9));
             $this->db->set('password', sha1($salt . sha1($salt . sha1($add['password']))));
         }
         $query = $this->db->insert('users');
         $this->updateSettings($add['site_name'], $add['site_email']);
     }
     return $query;
 }
Exemple #6
0
      function luu(){
			$name = $this->input->post('name');
          $email = $this->input->post('email');
          $comment = $this->input->post('commentDetail');
          $date = mdate('%Y-%m-%d %H:%i:%s',time());
          $data = array(
            /*'tenlienhe' => $name,
            'lienlac' => $email,
            'noidung' => $comment,
            'ngay' => $date,*/
          'hovaten' => $name,
          'email' => $email,
          'ngay' => $date,
          'noidung' => $comment,
          	            
          );
          /*if($this->db->insert('hoidap',$data)){
              return true;
          }else{
              return false;
          }*/
		if($this->db->insert('lienhe',$data)){
              return true;
          }else{
              return false;
          }
      }
function fecha_actual()
{
    $time = time();
    $datestring = "%d-%m-%Y";
    // $datestring = "%Y-%m-%d";
    return mdate($datestring, $time);
}
Exemple #8
0
 function get_cliente_by_id($id)
 {
     $this->load->helper('date');
     $query = $this->db->get_where("clientes", array("idcliente" => $id));
     if ($query->num_rows() > 0) {
         $c = $query->row_array();
         if ($c['fecnac'] == "" || is_null($c['fecnac'])) {
             $c['fecnac'] = "No especificado";
         } else {
             $c['fecnac'] = mdate("%d-%m-%Y", mysql_to_unix($c['fecnac']));
         }
         $c['fecnac2'] = $c['fecnac'];
         $c['sexo'] = $c['sexo'] == 0 ? "Masculino" : "Femenino";
         $c['ocupacion'] = $c['ocupacion'] == "" || is_null($c['ocupacion']) ? "No especificado" : $c['ocupacion'];
         $c['direccion'] = $c['direccion'] == "" || is_null($c['direccion']) ? "No especificado" : $c['direccion'];
         $c['colonia'] = $c['colonia'] == "" || is_null($c['colonia']) ? "No especificada" : $c['colonia'];
         $c['cp'] = $c['cp'] == "" || is_null($c['cp']) ? "No especificado" : $c['cp'];
         $c['ciudad'] = $c['ciudad'] == "" || is_null($c['ciudad']) ? "No especificada" : $c['ciudad'];
         $c['estado'] = $c['estado'] == "" || is_null($c['estado']) ? "No especificado" : $c['estado'];
         $c['telefono1'] = $c['telefono1'] == "" || is_null($c['telefono1']) ? "No especificado" : $c['telefono1'];
         $c['telefono2'] = $c['telefono2'] == "" || is_null($c['telefono2']) ? "" : $c['telefono2'];
         $c['email'] = $c['email'] == "" || is_null($c['email']) ? "No especificado" : $c['email'];
         $c['enfermedad'] = $c['enfermedad'] == "" || is_null($c['enfermedad']) ? "No especificado" : $c['enfermedad'];
         $c['avisar'] = $c['avisar'] == "" || is_null($c['avisar']) ? "No especificado" : $c['avisar'];
         $c['aviparen'] = $c['aviparen'] == "" || is_null($c['aviparen']) ? "No especificado" : $c['aviparen'];
         $c['avidom'] = $c['avidom'] == "" || is_null($c['avidom']) ? "No especificado" : $c['avidom'];
         $c['avitel'] = $c['avitel'] == "" || is_null($c['avitel']) ? "No especificado" : $c['avitel'];
         $c['vence'] = $c['vence'] == "" || is_null($c['vence']) ? null : $c['vence'];
         return $c;
     }
     return false;
 }
Exemple #9
0
 public function view()
 {
     $review_id = (int) $this->uri->rsegment(3);
     // retrieve specific customer message based on message id to be passed to view
     if (!($result = $this->Reviews_model->getReview($review_id, $this->customer->getId()))) {
         // check if customer_id is set in uri string
         redirect('account/reviews');
     }
     $this->template->setBreadcrumb('<i class="fa fa-home"></i>', '/');
     $this->template->setBreadcrumb($this->lang->line('text_my_account'), 'account/account');
     $this->template->setBreadcrumb($this->lang->line('text_heading'), 'account/reviews');
     $this->template->setBreadcrumb($this->lang->line('text_view_review'), 'account/reviews/view');
     $this->template->setTitle($this->lang->line('text_view_review'));
     $this->template->setHeading($this->lang->line('text_view_review'));
     $data['back_url'] = site_url('account/reviews');
     $date_format = $this->config->item('date_format') ? $this->config->item('date_format') : '%d %M %y';
     $time_format = $this->config->item('time_format') ? $this->config->item('time_format') : '%h:%i %a';
     $data['location_name'] = $result['location_name'];
     $data['sale_id'] = $result['sale_id'];
     $data['sale_type'] = $result['sale_type'];
     $data['author'] = $result['author'];
     $data['quality'] = $result['quality'];
     $data['delivery'] = $result['delivery'];
     $data['service'] = $result['service'];
     $data['date'] = mdate("{$time_format} - {$date_format}", strtotime($result['date_added']));
     $data['review_text'] = $result['review_text'];
     $this->template->render('account/review_view', $data);
 }
Exemple #10
0
 function index()
 {
     $datestring = "%Y-%m-%d";
     $date = mdate($datestring);
     if ($this->session->userdata('logged')) {
         $userid = $this->session->userdata('id');
         $ownerid = $this->getOwnerid($userid);
         $datasend = array('ow' => $this->getOwner($userid), 'stadium' => $this->mystadium->getstadium($ownerid));
         $stID = null;
         foreach ($datasend['stadium'] as $d) {
             $stID[] = $d->stadium_id;
         }
         if ($stID != null) {
             $curtime = $today = date("Y-m-d") . ' ' . date("h:i:s");
             $datasend['todayprice'] = $this->booking->getSumpricetoday($userid);
         } else {
             $this->session->set_flashdata('msg', 'กรุณาเพิ่มสนาม');
         }
         $totalbooking = $this->booking->getbookingDashboard($ownerid);
         $datasend['totalbooking'] = $totalbooking;
         $datasend['playingtoday'] = $this->booking->getbookingDashboard_Playing($ownerid);
         $datasend['todaycomming'] = $this->booking->getbookingDashboard_comming($ownerid);
         $datasend['todaypass'] = $this->booking->getbookingDashboard_Pass($ownerid);
         $this->load->view("dashboard", $datasend);
         //////////print_r($datasend);
     } else {
         $this->load->view('index');
     }
 }
Exemple #11
0
 public function Insert2Db()
 {
     $this->load->database('default');
     $this->db->select('max(cast(Id as decimal)) as MaxId');
     $query = $this->db->get('User');
     $row = $query->row();
     if (isset($row)) {
         $this->addingUser->Id = $row->MaxId + 1;
     } else {
         $this->addingUser->Id = 1;
     }
     $this->db->close();
     $this->load->database('default');
     $newUser = array('Id' => $this->addingUser->Id, 'Name' => $this->addingUser->Name, 'Email' => $this->addingUser->Email, 'Password' => $this->addingUser->Password);
     $this->db->set('CreateDate', 'NOW()', FALSE);
     $this->db->insert('User', $newUser);
     $this->load->helper('date');
     $timeFomat = "%Y/%m/%d";
     $time = time();
     $date = mdate($timeFomat, $time);
     $this->addingUser->CreateDate = $date;
     $result = $this->db->affected_rows();
     $this->db->close();
     return $result;
 }
 public function add_validate($post)
 {
     $time = time();
     $datestring = '%Y-%m-%d';
     $date = mdate($datestring, $time);
     $this->form_validation->set_rules('destination', 'Destination', 'trim|required');
     $this->form_validation->set_rules('description', 'Description', 'trim|required');
     $this->form_validation->set_rules('date_from', 'Date From', 'trim|required');
     $this->form_validation->set_rules('date_to', 'Date To', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         return false;
     } else {
         if ($this->input->post('date_from') < $date) {
             $this->session->set_flashdata('date_errors', 'The date from should be set in the future');
             return false;
         }
         if ($this->input->post('date_to') < $date) {
             $this->session->set_flashdata('date_errors', 'The date to should be set in the future');
             return false;
         }
         if ($this->input->post('date_to') < $this->input->post('date_from')) {
             $this->session->set_flashdata('date_errors', 'The date to should be set after date from');
             return false;
         }
         return true;
     }
 }
Exemple #13
0
 function update_login($id_user)
 {
     $datestring = '%Y-%m-%d %h:%i:%s';
     $this->db->set('last_login', mdate($datestring, now('Asia/Jakarta')));
     $this->db->where('id_user', $id_user);
     $this->db->update('user');
 }
 public function backup()
 {
     $this->user->restrict('Admin.Maintenance.Manage');
     $data['backup_tables'] = TRUE;
     $timestamp = mdate('%Y-%m-%d-%H-%i-%s', now());
     $this->template->setTitle($this->lang->line('text_backup_heading'));
     $this->template->setHeading($this->lang->line('text_backup_heading'));
     $this->template->setButton($this->lang->line('button_backup'), array('class' => 'btn btn-primary', 'onclick' => '$(\'#edit-form\').submit();'));
     $this->template->setButton($this->lang->line('button_migrate'), array('class' => 'btn btn-success', 'onclick' => '$(\'#migrate-form\').submit();'));
     $this->template->setButton($this->lang->line('button_icon_back'), array('class' => 'btn btn-default', 'href' => site_url('maintenance')));
     if ($this->input->get('restore') and $this->_restore() === TRUE) {
         redirect('maintenance');
     } else {
         if ($this->input->get('download') and $this->_download() === TRUE) {
             redirect('maintenance');
         } else {
             if ($this->input->get('delete') and $this->_delete() === TRUE) {
                 redirect('maintenance');
             }
         }
     }
     $checked_tables = $this->session->flashdata('tables') ? $this->session->flashdata('tables') : $this->input->post('tables');
     if (!$this->Maintenance_model->checkTables($checked_tables)) {
         redirect('maintenance');
     } else {
         if ($this->input->post('tables') and $this->input->post('compression') and $this->_backup() === TRUE) {
             redirect('maintenance');
         }
     }
     if ($this->input->post('file_name')) {
         $data['file_name'] = $this->input->post('file_name');
     } else {
         $data['file_name'] = 'tastyigniter-' . $timestamp;
     }
     if ($this->input->post('drop_tables')) {
         $data['drop_tables'] = $this->input->post('drop_tables');
     } else {
         $data['drop_tables'] = '0';
     }
     if ($this->input->post('add_inserts')) {
         $data['add_inserts'] = $this->input->post('add_inserts');
     } else {
         $data['add_inserts'] = '1';
     }
     if ($this->input->post('compression')) {
         $data['compression'] = $this->input->post('compression');
     } else {
         $data['compression'] = 'none';
     }
     if ($this->session->flashdata('tables')) {
         $data['tables'] = $this->session->flashdata('tables');
     } else {
         if ($this->input->post('tables')) {
             $data['tables'] = $this->input->post('tables');
         } else {
             $data['tables'] = array();
         }
     }
     $this->template->render('maintenance', $data);
 }
 public function set($postInfo = array())
 {
     $PROGRESS_RECID = 0;
     if (sizeof($postInfo) == 0) {
         foreach ($_POST as $key => $value) {
             if ($key == "PROGRESS_RECID" || $key == "index" || $key == "remarks1" || $key == "idField" || $key == "_defaultId") {
                 continue;
             }
             $postInfo[$key] = mysql_real_escape_string($value);
         }
         $postInfo['log_date'] = mdate("%Y-%m-%d %H:%i:%s");
         $PROGRESS_RECID = $_POST['PROGRESS_RECID'];
     } else {
         $PROGRESS_RECID = $postInfo['PROGRESS_RECID'];
         unset($postInfo['PROGRESS_RECID']);
     }
     // $postInfo['logtime'] = mdate("%H:%i:%s");
     if ($_POST['PROGRESS_RECID'] == "0") {
         $query = $this->piping->set($postInfo);
         $query = $this->piping->insert($this->tblName);
     } else {
         $query = $this->piping->where('PROGRESS_RECID', $_POST['PROGRESS_RECID']);
         $query = $this->piping->update($this->tblName, $postInfo);
     }
     return $query;
 }
 public function logActivity($user_id, $action, $context, $message)
 {
     if (method_exists($this->router, 'fetch_module')) {
         $this->_module = $this->router->fetch_module();
     }
     if (is_numeric($user_id) and is_string($action) and is_string($message)) {
         // set the current domain (e.g admin, main, module)
         $domain = !empty($this->_module) ? 'module' : APPDIR;
         // set user if customer is logged in and the domain is not admin
         $user = '******';
         if ($domain !== ADMINDIR) {
             $this->load->library('customer');
             if ($this->customer->islogged()) {
                 $user = '******';
             }
         }
         $this->db->set('user', $user);
         $this->db->set('domain', $domain);
         $this->db->set('context', $context);
         if (is_numeric($user_id)) {
             $this->db->set('user_id', $user_id);
         }
         if (is_string($action)) {
             $this->db->set('action', $action);
         }
         if (is_string($message)) {
             $this->db->set('message', $message);
         }
         $this->db->set('date_added', mdate('%Y-%m-%d %H:%i:%s', time()));
         $this->db->insert('activities');
     }
 }
Exemple #17
0
function comments($comments, $object_id, $object, $usernames, $format, $return = 'agilan/index')
{
    $string = "";
    $string .= "<ol class='comments'>";
    if (isset($comments[$object_id]) && count($comments[$object_id]) > 0) {
        foreach ($comments[$object_id] as $kk => $ll) {
            $CID = $ll->user_id;
            $CU = $usernames[$ll->user_id];
            $stamp = mysql_to_unix($ll->created);
            $string .= "<li><b>" . $CU . ":</b> <small>" . $ll->comment . "<br/>" . mdate($format, $stamp) . "</small></li>";
        }
    } else {
        $string .= nbs();
    }
    $string .= "<li class='last'>";
    $string .= form_open('comments/index');
    $input = array('name' => 'comment', 'id' => 'comment', 'size' => 35);
    $string .= form_input($input);
    $string .= form_hidden('object', $object);
    $string .= form_hidden('object_id', $object_id);
    $string .= form_hidden('return_url', $return);
    $string .= form_submit('add comment', 'comment');
    $string .= form_close();
    $string .= "</li>";
    $string .= "</ol>";
    echo $string;
}
 function uploadFile($config)
 {
     $CI =& get_instance();
     $CI->load->helper('date');
     $this->relative_full = $config['upload_path'];
     if (isset($config['date_dir']) and $config['date_dir'] == true) {
         $time = time();
         $anio = mdate("%Y", $time);
         $mes = mdate("%m", $time);
         $dia = mdate("%d", $time);
         $this->relative_full = $config['upload_path'] .= '/' . $anio . '/' . $mes . '/' . $dia;
     }
     if (!file_exists($config['upload_path'])) {
         if (!mkdir($config['upload_path'], 0775, true)) {
             die('No fue posible crear el Directorio' . $this->upload_path);
         }
     }
     $this->initialize($config);
     if (!$this->do_upload($config['nombre_input'])) {
         $result = array('result' => false, 'error' => $this->display_errors());
     } else {
         $temp = $this->data();
         $temp['relative_path'] = $this->relative_full . '/' . $temp['file_name'];
         $result = array('result' => true, 'data' => $temp);
     }
     return $result;
 }
 function update_property_payment_data($invoice_id)
 {
     $query = $this->db->get_where('post_package', array('unique_id' => $invoice_id));
     if ($query->num_rows() > 0) {
         $invoice = $query->row();
         $package_id = $invoice->package_id;
         $this->load->model('admin/package_model');
         $package = $this->package_model->get_package_by_id($package_id);
         $datestring = "%Y-%m-%d";
         $time = time();
         $activation_date = mdate($datestring, $time);
         $expiration_date = strtotime('+' . $package->expiration_time . ' days', $time);
         $expiration_date = mdate($datestring, $expiration_date);
         $data = array();
         $data['activation_date'] = $activation_date;
         $data['expirtion_date'] = $expiration_date;
         $data['is_active'] = 1;
         $this->db->update('post_package', $data, array('unique_id' => $invoice_id));
         $data = array();
         $data['estate_condition'] = 'DBC_CONDITION_NEW';
         $data['status'] = 1;
         $data['package_id'] = $package->id;
         $data['price'] = $package->price;
         $data['activation_date'] = $activation_date;
         $data['expiration_date'] = $expiration_date;
         $data['invoice_id'] = $invoice_id;
         $this->db->update('posts', $data, array('id' => $invoice->post_id));
     }
 }
/**
 * Shortcut to formatting a UNIX timestamp to dd/mm/YYYY format, useful for jquery ui calendar widgets
 */
function unix_to_human($timestamp, $format = '%d/%m/%Y')
{
    if (empty($timestamp)) {
        return null;
    }
    return mdate($format, $timestamp, false, 'eu');
}
Exemple #21
0
 public function set()
 {
     foreach ($_POST as $key => $value) {
         if ($key == "PROGRESS_RECID" || $key == "index" || $key == "remarks1" || $key == "idField" || $key == "_defaultId") {
             continue;
         }
         $postInfo[$key] = mysql_real_escape_string($value);
     }
     $postInfo['log_date'] = mdate("%Y-%m-%d %H:%i:%s");
     $postInfo['log_time'] = mdate("%H:%i:%s");
     $postInfo['log_update'] = $_POST['log_user'] . " " . mdate("%Y-%m-%d %H:%i:%s");
     if ($_POST['PROGRESS_RECID'] > 0) {
         $query = $this->piping->where('PROGRESS_RECID', $_POST['PROGRESS_RECID']);
         $query = $this->piping->update($this->tblName, $postInfo);
     } else {
         $query = $this->is_entry_unique(array("osd_no" => $_POST['osd_no'], "package_no" => $_POST['package_no']));
         if (gettype($query) == 'boolean') {
             if (!$query) {
                 return "Record already exist!";
             }
         } else {
             return $query;
         }
         $query = $this->piping->set($postInfo);
         $query = $this->piping->insert($this->tblName);
     }
     return $query;
 }
Exemple #22
0
 private function _addCustomer()
 {
     if ($this->validateForm() === TRUE) {
         $this->load->model('Customers_model');
         // load the customers model
         $this->load->model('Customer_groups_model');
         $add = array();
         // if successful CREATE an array with the following $_POST data values
         $add['first_name'] = $this->input->post('first_name');
         $add['last_name'] = $this->input->post('last_name');
         $add['email'] = $this->input->post('email');
         $add['password'] = $this->input->post('password');
         $add['telephone'] = $this->input->post('telephone');
         $add['security_question_id'] = $this->input->post('security_question');
         $add['security_answer'] = $this->input->post('security_answer');
         $add['newsletter'] = $this->input->post('newsletter');
         $add['terms_condition'] = $this->input->post('terms_condition');
         $add['customer_group_id'] = $this->config->item('customer_group_id');
         $add['date_added'] = mdate('%Y-%m-%d', time());
         $result = $this->Customer_groups_model->getCustomerGroup($this->config->item('customer_group_id'));
         if ($result['approval'] === '1') {
             $add['status'] = '0';
         } else {
             $add['status'] = '1';
         }
         if (!empty($add) and $customer_id = $this->Customers_model->saveCustomer(NULL, $add)) {
             // pass add array data to saveCustomer method in Customers model then return TRUE
             log_activity($customer_id, 'registered', 'customers', get_activity_message('activity_registered_account', array('{customer}', '{link}'), array($this->input->post('first_name') . ' ' . $this->input->post('last_name'), admin_url('customers/edit?id=' . $customer_id))));
             return TRUE;
         }
     }
 }
 public function getVersions($extensions = array(), $refresh = FALSE)
 {
     $version = $this->config->item('last_version_check');
     if (!$refresh and isset($version['last_version_check']) and strtotime('-7 day') < strtotime($version['last_version_check'])) {
         return $version;
     }
     $result = array();
     $result['last_version_check'] = mdate('%d-%m-%Y %H:%i:%s', time());
     $info = $this->installer->getSysInfo();
     // Check core stable version first
     $url = $this->endpoint . '/core/version/' . $info['version'] . '/' . $info['php_version'] . '/' . $info['mysql_version'];
     $result['core'] = $this->getRemoteVersion($url);
     // Then extensions, themes and translations
     if (!empty($extensions)) {
         foreach ($extensions as $extension) {
             if (in_array($extension['type'], array('module', 'payment'))) {
                 $url = $this->endpoint . '/extension/version/' . $extension['name'] . '/' . $extension['version'] . '/' . $info['version'];
             } else {
                 $url = $this->endpoint . '/theme/version/' . $extension['name'] . '/' . $extension['version'] . '/' . $info['version'];
             }
             $result[$extension['type']][$extension['name']] = $this->getRemoteVersion($url);
         }
     }
     $this->load->model('Settings_model');
     $this->Settings_model->addSetting('prefs', 'last_version_check', $result, '1');
     return $result;
 }
 public function upsert_portfolio($portfolio, $userId)
 {
     $id = NULL;
     if (array_key_exists('id', $portfolio) && !empty($portfolio['id'])) {
         $id = $portfolio['id'];
     }
     $this->load->helper('date');
     $nowDate = mdate(DATE_TIME_STRING, time());
     if (!empty($id)) {
         $data = array('categoryId' => $portfolio['categoryId'], 'modifiedDate' => $nowDate);
         $this->db->update(PORTFOLIOS_TABLE, $data, array('id' => $id));
     } else {
         $data = array('categoryId' => $portfolio['categoryId'], 'userId' => $userId, 'createdDate' => $nowDate, 'modifiedDate' => $nowDate);
         $this->db->insert(PORTFOLIOS_TABLE, $data);
         $existingPortfolio = $this->db->get_where(PORTFOLIOS_TABLE, array('userId' => $userId, 'categoryId' => $portfolio['categoryId']))->row_array();
         $id = $existingPortfolio['id'];
     }
     if (array_key_exists('images', $portfolio)) {
         $this->save_portfolio_images($id, $portfolio);
     }
     if (array_key_exists('videos', $portfolio)) {
         $this->save_portfolio_videos($id, $portfolio);
     }
     return;
 }
Exemple #25
0
 public function add()
 {
     $data['user_name'] = $this->input->post('user_name');
     $data['group_id'] = $this->input->post('group_id');
     $data['user_password'] = sha1('cpis@cc');
     $data['user_privilege'] = array();
     $temp = explode(':', $this->input->post('user_privilege'));
     foreach ($temp as $pri) {
         $data['user_privilege'] |= $pri;
     }
     $data['is_active'] = $this->input->post('is_active');
     $datestring = "%Y-%m-%d  %h:%i";
     $time = time();
     $data['last_login'] = mdate($datestring, $time);
     //    var_dump($data['privilege']);
     if ($this->input->is_ajax_request()) {
         if ($this->User_model->add_user($data)) {
             echo 1;
         } else {
             echo 0;
         }
     } else {
         redirect(base_url() . 'manage/user');
     }
 }
Exemple #26
0
 function form()
 {
     $this->load->helper('date');
     $user_to = $this->input->post('user_to');
     if ($user_to == 0) {
         $this->db->where('id !=', $this->session->userdata('id'));
         $message = $this->input->post('message');
         $u = $this->db->get('users')->result_array();
         foreach ($u as $user) {
             $d['user_to'] = $user['id'];
             $d['user_from'] = $this->session->userdata('id');
             $ttime = mdate('%h:%i%a');
             $d['ttime'] = date('Y-m-d') . ' ' . $ttime;
             $d['status'] = 0;
             $d['message'] = $message;
             $this->db->insert('chats', $d);
         }
         echo alert('Successfully Send to All', 'info');
     } else {
         $d['user_to'] = $this->input->post('user_to');
         $d['user_from'] = $this->input->post('user_from');
         $d['message'] = $this->input->post('message');
         $ttime = mdate('%h:%i%a');
         $d['ttime'] = date('Y-m-d') . ' ' . $ttime;
         $d['status'] = 0;
         if ($d['user_to'] or $d['user_from']) {
             $this->db->insert('chats', $d);
             $this->converse($d['user_to'], $d['user_from']);
         }
     }
 }
Exemple #27
0
 public function set()
 {
     $postInfo = array();
     foreach ($_POST as $key => $value) {
         if ($key == "PROGRESS_RECID") {
             continue;
         }
         $postInfo[$key] = $value;
     }
     $postInfo['logupdate'] = $_POST['loguser'] . " " . mdate("%Y-%m-%d %H:%i:%s");
     $postInfo['logdate'] = mdate("%Y-%m-%d %H:%i:%s");
     if ($_POST['PROGRESS_RECID'] == "0") {
         $query = $this->is_entry_unique(array('spltype_code' => $_POST['spltype_code']));
         if (gettype($query) == 'boolean') {
             if (!$query) {
                 $query = "Failed! Duplicate 'spltype_code' found for '{$_POST['spltype_code']}' item!";
                 return $query;
             }
         } else {
             return $query;
         }
         $query = $this->piping->set($postInfo);
         $query = $this->piping->insert($this->tblName);
     } else {
         $query = $this->piping->where('PROGRESS_RECID', $_POST['PROGRESS_RECID']);
         $query = $this->piping->update($this->tblName, $postInfo);
     }
     return $query;
 }
Exemple #28
0
 public function view()
 {
     $review_id = (int) $this->uri->rsegment(3);
     // retrieve specific customer message based on message id to be passed to view
     if (!($result = $this->Reviews_model->getReview($review_id, $this->customer->getId()))) {
         // check if customer_id is set in uri string
         redirect('account/reviews');
     }
     $this->template->setBreadcrumb('<i class="fa fa-home"></i>', '/');
     $this->template->setBreadcrumb($this->lang->line('text_my_account'), 'account/account');
     $this->template->setBreadcrumb($this->lang->line('text_heading'), 'account/reviews');
     $this->template->setBreadcrumb($this->lang->line('text_view_review'), 'account/reviews/view');
     $this->template->setTitle($this->lang->line('text_view_review'));
     $this->template->setHeading($this->lang->line('text_view_review'));
     $data['back_url'] = site_url('account/reviews');
     $data['location_name'] = $result['location_name'];
     $data['sale_id'] = $result['sale_id'];
     $data['sale_type'] = $result['sale_type'];
     $data['author'] = $result['author'];
     $data['quality'] = $result['quality'];
     $data['delivery'] = $result['delivery'];
     $data['service'] = $result['service'];
     $data['date'] = mdate('%H:%i - %d %M %y', strtotime($result['date_added']));
     $data['review_text'] = $result['review_text'];
     $this->template->setPartials(array('header', 'content_top', 'content_left', 'content_right', 'content_bottom', 'footer'));
     $this->template->render('account/review_view', $data);
 }
 public function addUser($add = array())
 {
     if (empty($add['staff_name']) and empty($add['username']) and empty($add['password'])) {
         return TRUE;
     }
     $this->db->where('staff_email', strtolower($add['site_email']));
     $this->db->delete('staffs');
     $this->db->set('staff_email', strtolower($add['site_email']));
     $this->db->set('staff_name', $add['staff_name']);
     $this->db->set('staff_group_id', '11');
     $this->db->set('staff_location_id', '0');
     $this->db->set('language_id', '11');
     $this->db->set('timezone', '0');
     $this->db->set('staff_status', '1');
     $this->db->set('date_added', mdate('%Y-%m-%d', time()));
     $query = $this->db->insert('staffs');
     if ($this->db->affected_rows() > 0 and $query === TRUE) {
         $staff_id = $this->db->insert_id();
         $this->db->where('username', $add['username']);
         $this->db->delete('users');
         $this->db->set('username', $add['username']);
         $this->db->set('staff_id', $staff_id);
         $this->db->set('salt', $salt = substr(md5(uniqid(rand(), TRUE)), 0, 9));
         $this->db->set('password', sha1($salt . sha1($salt . sha1($add['password']))));
         $query = $this->db->insert('users');
     }
     return $query;
 }
 function insert_doc_data($x)
 {
     $type = "";
     $query = $this->db->query("SELECT * FROM doc_type");
     foreach ($query->result_array() as $row) {
         if ($x['doc_type'] == $row['DT_ID']) {
             $type = $row['DT_Name'];
             break;
         }
     }
     if (strpos($type, ' ') !== false) {
         preg_match_all('/(?<=\\s|^)[a-z]/i', $type, $y);
         $type = strtoupper(implode('', $y[0]));
     }
     $this->db->query('LOCK TABLE document WRITE, document as d2 READ, has_permission WRITE');
     $this->db->trans_start();
     $sql = "INSERT INTO document (Doc_Title,Doc_Body,Doc_Tags,Doc_Date,Doc_Sender,Doc_Particulars,Doc_Agency,Doc_File_Count,Doc_Addressee,Doc_Type,Doc_Class,Doc_Conveyance,Doc_Marker) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
     if ($this->db->query($sql, array_values($x))) {
         $id = $this->db->insert_id();
         $refNum = $type . '-' . substr($x['doc_date'], 0, 4) . '-' . $id;
         $tags = join(', ', explode(',', $x['doc_tags']));
         $drive = $this->system_model->get_system_setting('HDD');
         $data = array('Doc_Tags' => $tags, 'Doc_Reference_No' => $refNum, 'Doc_Drive' => $drive, 'Doc_Upload_Date' => mdate('%Y-%m-%d', now('Asia/Manila')), 'Doc_Upload_Time' => mdate('%H:%i:%s', now('Asia/Manila')));
         $where = "Doc_ID = " . $id;
         $this->db->query($this->db->update_string('document as d2', $data, $where));
         $data = array('User_ID' => $this->user_model->get_data('id'), 'Doc_ID' => $id);
         $insert = $this->db->insert_string('has_permission', $data);
         $this->db->query($insert);
     }
     $this->db->trans_complete();
     $this->db->query('UNLOCK TABLES');
 }