public function update_data() { $this->load->model('tags_model', 'tags', true); $this->load->model('links_model', 'links', true); $this->load->model('images_model', 'images', true); $this->load->helper('date'); $config = $this->config->item('upload'); $file = file('/srv/www/themoviepostersite.com/posters.csv'); $data = ''; $views = array(); foreach ($file as $key => $value) { $csv = str_getcsv($value); $data['id'] = $csv[0]; $data['title'] = $csv[1]; $data['filename'] = $csv[2]; $num_views = $csv[3]; $data['created_on'] = mysql_to_unix($csv[4]); $views['created_on'] = $csv[5]; $data['group_id'] = $csv[6]; $data['thumbnail'] = $csv[7]; $data['path_to_file'] = $config['upload_path'] . $data['id']; //legacy path $tags = explode(", ", $csv[9]); $this->images->create($data); foreach ($tags as $k => $v) { $tag['tag'] = $v; $this->tags->create($tag); $id = $this->tags->get_insert_id(); $tag_link['itemid'] = $id; $tag_link['item'] = 'tag'; $tag_link['pinupid'] = $data['id']; $this->links->create($tag_link); } } }
public function _get_updateddate($Date) { if (empty($Date)) { return null; } return mysql_to_unix($Date); }
public function edit() { $id = abs((int) $this->uri->segment(4)); if (!empty($id)) { $this->form_validation->set_rules('Start_time', 'start', 'required'); $this->form_validation->set_rules('End_time', 'end', 'required'); //validasi date $start = $this->input->post('Start_time'); $end = $this->input->post('End_time'); if ($this->form_validation->run() == FALSE || $this->validate_date($start) == FALSE || $this->validate_date($end) == FALSE || (mysql_to_unix($end) - mysql_to_unix($start)) / 86400 <= 0) { $this->data['user'] = $this->access->get_user($id); $this->data['title'] = 'Edit Akses Satker'; $this->data['template'] = 'manajemen_akses/edit'; // $this->session->set_flashdata('message_type', 'error'); // $this->session->set_flashdata('message1', 'Data salah input'); $this->load->view('backend/index', $this->data); } else { $this->access->update_date($start, $end, $id); $this->session->set_flashdata('message_type', 'success'); $this->session->set_flashdata('message', 'Data berhasil diperbaharui'); redirect('backend/access_management/'); } } else { redirect('backend'); } }
function retorno() { $data['title'] = "Relatórios - Controle de Estoque"; $data['headline'] = "Relatório"; $data['include'] = 'Relatorio_retorno'; $this->load->model('MRelatorio', '', TRUE); $qry = $this->MRelatorio->getConsumoProduto($_POST); $table = $this->table->generate($qry); $tmpl = array('table_open' => '<table id="tabela" class="relatorio">'); $this->table->set_template($tmpl); $this->table->set_empty(" "); $this->table->set_heading('Produto', 'Quantidade', 'Data'); $table_row = array(); $data['qry'] = array(); foreach ($qry->result() as $produto) { $table_row = NULL; $table_row[] = $produto->nome_produto; $table_row[] = $produto->quantidade_pedida; $data_human = mysql_to_pt($produto->data_pedido); $table_row[] = $data_human; $this->table->add_row($table_row); $data['qry'][] = array(mysql_to_unix($produto->data_pedido) * 1000, $produto->quantidade_pedida); } $table = $this->table->generate(); $data['data_table'] = $table; $this->load->view('template', $data); }
function view_forum($forumID = 0) { $this->load->helper('date'); $forumID = intval($forumID); $forum = $this->forum_model->getForum($forumID); // Check if topic exists if (!empty($forum)) { $forum['topic_list'] = array(); // Get a list of posts which have no parents (topics) in this forum foreach ($this->post_model->getTopicsInForum($forumID) as $topic) { $topic['post_count'] = count($this->post_model->getPostsInTopic($topic['postID'])); $topic['last_post'] = $this->post_model->getLastPost('topic', $topic['postID']); // Convert to unix and see how long ago it was posted $timespan = timespan(mysql_to_unix($topic['last_post']['post_date'])); // If its set and doesnt contain the word days in the timespan if (isset($forum['last_post']['post_date']) && !strpos($timespan, 'Day')) { $topic['last_post']['post_date'] = $timespan; } else { $topic['last_post']['post_date'] = $topic['last_post']['post_date']; } $forum['topic_list'][] = $topic; } $this->data = array_merge($this->data, $forum); $this->layout->title('Forums > ' . $this->data['forum_name']); $this->layout->create('view_forum', $this->data); } else { show_error('The Forum doesn\'t exist!'); $this->layout->create('message', $this->data); } }
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; }
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 index() { $ga = new ga(); $this->ga->authen('*****@*****.**', 'rain2512', 'ga:98468001'); if ($_GET) { $now = Date2DB($_GET['date']); } else { $now = date("Y-m-d"); } $lastmonth = date('Y-m-d', strtotime('-29 days', mysql_to_unix($now))); //Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates $data['summery'] = $this->ga->getSummery($lastmonth, $now); //All time summery: visitors, page views $data['allTimeSummery'] = $this->ga->getAllTimeSummery(); //Last 10 days visitors (for graph) $data['visits'] = $this->ga->getVisits($lastmonth, $now, 30); //Top 10 search engine keywords $data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10); //Top 10 visitor countries $data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10); //Top 10 page views $data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10); //Top 10 referrer websites $data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10); //Top 10 visitor browsers $data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10); //Top 10 visitor operating systems $data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10); $this->template->append_metadata(js_datepicker()); $this->template->build("index", $data); }
function retorno_compra() { $data['title'] = "Relatórios - Controle de Estoque"; $data['headline'] = "Relatório"; $data['include'] = 'relatorio_retorno'; $this->load->model('MRelatorio', '', TRUE); $qry = $this->MRelatorio->getCompraProduto(); $table = $this->table->generate($qry); $tmpl = array('table_open' => '<table id="tabela" class="relatorio">'); $this->table->set_template($tmpl); $this->table->set_empty(" "); $this->table->set_heading('Número Nota', 'Fornecedor', 'Data da Nota', 'Valor Total'); $table_row = array(); $data['qry'] = array(); foreach ($qry->result() as $nota) { $table_row = NULL; $table_row[] = $nota->numero_nota; $this->load->model('MFornecedor', '', TRUE); $fornecedor = $this->MFornecedor->getFornecedor($nota->id_fornecedor)->result(); $table_row[] = $fornecedor[0]->razao_social; $table_row[] = mysql_to_pt($nota->data_nota); $table_row[] = ' '; $this->table->add_row($table_row); $data['qry'][] = array(mysql_to_unix($nota->data_nota) * 1000, $fornecedor[0]->razao_social); } $table = $this->table->generate(); $data['data_table'] = $table; $this->load->view('template3', $data); }
private function set_vars($row) { if (!is_array($row)) { return trigger_error('$comic->set_vars($row) must be called with an array as the argument!'); } global $scdb; $this->title = $row['title']; $this->image = $row['image']; $this->info = $row['info']; $this->cat = (int) $row['cat']; $this->category = $this->cat_info($this->cat); $this->transcript = $row['transcript']; $this->time = $row['time']; $this->stamp = (int) mysql_to_unix($this->time); $this->views = (int) $row['views'] + 1; $this->ID = (int) $row['ID']; $this->PID = (int) $row['PID']; $user_info = $this->user_info($row['author']); $this->author = $user_info->nicename; $this->author_full = $user_info->name; // keep until i've changed all calls to $this->type to $this->category->nicename $this->type = $this->category->nicename; $this->first = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1"); $this->last = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `cat` = '{$this->cat}' AND `time` <= '" . NOW . "' ORDER BY `ID` DESC LIMIT 1"); if ($this->ID !== $this->first) { $this->prev = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` < '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` DESC LIMIT 1"); } if ($this->ID !== $this->last) { $this->next = (int) $scdb->get_var("SELECT `ID` FROM `{$scdb->comics}` WHERE `ID` > '{$this->ID}' AND `cat` = '{$this->cat}' ORDER BY `ID` ASC LIMIT 1"); } }
public function inc_statistic() { $ga = new ga(); $this->ga->authen('*****@*****.**', 'rain2512', 'ga:98468001'); // $ga->authen('*****@*****.**','rain2512','ga:98468001'); $now = date("Y-m-d"); $lastmonth = date("Y-m-d", strtotime('-1 month', mysql_to_unix($now))); $data["today"] = $this->ga->getSummery($now, $now); $data["month"] = $this->ga->getSummery($lastmonth, $now); $data["alltime"] = $this->ga->getAllTimeSummery(); $lastmonth = date('Y-m-d', strtotime('-30 days')); //Summery: visitors, unique visit, pageview, time on site, new visits, bounce rates $data['summery'] = $this->ga->getSummery($lastmonth, $now); //All time summery: visitors, page views $data['allTimeSummery'] = $this->ga->getAllTimeSummery(); //Last 10 days visitors (for graph) $data['visits'] = $this->ga->getVisits(date('Y-m-d', strtotime('-10 days')), $now, 10); //Top 10 search engine keywords $data['topKeywords'] = $this->ga->getTopKeyword($lastmonth, $now, 10); //Top 10 visitor countries $data['topCountries'] = $this->ga->getTopCountry($lastmonth, $now, 10); //Top 10 page views $data['topPages'] = $this->ga->getTopPage($lastmonth, $now, 10); //Top 10 referrer websites $data['topReferrer'] = $this->ga->getTopReferrer($lastmonth, $now, 10); //Top 10 visitor browsers $data['topBrowsers'] = $this->ga->getTopBrowser($lastmonth, $now, 10); //Top 10 visitor operating systems $data['topOs'] = $this->ga->getTopOs($lastmonth, $now, 10); $this->load->view("inc_statistic", $data); }
/** * Replace all of the default date fields. * * @param String The tagdata to be parsed * @param Object The channel parser object * @param Mixed The results from the preparse method * * @return String The processed tagdata */ public function replace($tagdata, EE_Channel_data_parser $obj, $date_vars) { $prefix = $obj->prefix(); $tag = $obj->tag(); $data = $obj->row(); $dates = array($prefix . 'entry_date' => $data['entry_date'], $prefix . 'edit_date' => mysql_to_unix($data['edit_date']), $prefix . 'recent_comment_date' => $data['recent_comment_date'] != 0 ? $data['recent_comment_date'] : '', $prefix . 'expiration_date' => $data['expiration_date'] != 0 ? $data['expiration_date'] : '', $prefix . 'comment_expiration_date' => $data['comment_expiration_date'] != 0 ? $data['comment_expiration_date'] : ''); // "week_date" // Subtract the number of days the entry is "into" the week to get zero (Sunday) // If the entry date is for Sunday, and Monday is being used as the week's start day, // then we must back things up by six days $offset = 0; if (strtolower(ee()->TMPL->fetch_param('start_day')) == 'monday') { $day_of_week = ee()->localize->format_date('%w', $data['entry_date']); if ($day_of_week == '0') { $offset = -518400; // back six days } else { $offset = 86400; // plus one day } } $dates['week_date'] = $data['entry_date'] - ee()->localize->format_date('%w', $data['entry_date'], TRUE) * 60 * 60 * 24 + $offset; $tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates); $dates = array($prefix . 'gmt_date' => $data['entry_date'], $prefix . 'gmt_entry_date' => $data['entry_date'], $prefix . 'gmt_edit_date' => mysql_to_unix($data['edit_date'])); $tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates, FALSE); return $tagdata; }
function datediff($datefrom, $dateto = FALSE) { $startDate = mysql_to_unix($datefrom); $lastDate = $dateto ? mysql_to_unix($dateto) : now(); $differnce = $startDate - $lastDate; $differnce = $differnce / (60 * 60 * 24); return (int) $differnce; }
public function get_timespan($time) { $time = mysql_to_unix($time); //$time -= -3600; return $this->time_since($time); //return $time; //return timespan($time, $now); }
public function post_comments($post_id = 0) { // load date_helper from CI's app singleton get_instance()->load->helper('date'); $comments = $this->db->where('post_id', (int) $post_id)->order_by('created DESC')->get('comments')->result_array(); return array_map(function ($a) { $a['time_ago'] = timespan(mysql_to_unix($a['created']), time(), 2); return $a; }, $comments); }
function updpet_lock($arr) { $ownerdataobj = $this->user_io_m->init('id_user', getAccountUserId()); //$expdate=date('Y-m-d H:i:s',strtotime('+'.$arr['totday']."days")); if ($arr['totday'] > 1) { $day = "days"; } else { $day = 'day'; } $checkrecord = $this->getPetLockRecord($arr['iduser']); if (mysql_to_unix($checkrecord->lockexp_date) > mysql_to_unix(mysqlDate())) { //if this pet had locked and not expire date $sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(lockexp_date,'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user="******" AND id_owner=" . getAccountUserId(); } else { $sql = "UPDATE " . TBL_PET . " \r\n\t\t\t\tSET lockstatus=1 ,id_petlock=" . $arr['lockid'] . ",userprice=" . $arr['totprice'] . "/2,\r\n\t\t\t\taddlock_date=NOW(),intr=" . $arr['totday'] . "*24,\r\n\t\t\t\tlockexp_date=ADDDATE(NOW(),'" . $arr['totday'] . "')\r\n\t\t\t\tWHERE id_user="******" AND id_owner=" . getAccountUserId(); } $this->db->query($sql); debug("update tbl pet"); //For lock history added on dt-30-12-10 $petinfo = $this->user_io_m->init('id_user', $arr['iduser']); $lock_sql = "INSERT INTO " . TBL_LOCKHISTORY . "\r\n\t\t\t\t\t(owner,pet,owner_email,pet_email,id_lock,pet_amount,owner_amount,lock_time,time_from,time_to,ip) \r\n\t\t\t\t\tVALUES('" . $ownerdataobj->username . "','" . $petinfo->username . "','" . $ownerdataobj->email . "','" . $petinfo->email . "'," . $arr['lockid'] . "," . $arr['totprice'] . "/2," . $arr['totprice'] . "/2," . $arr['totday'] . "*24,NOW(),ADDDATE(NOW(),'" . $arr['totday'] . "'),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($lock_sql); debug("update lock history"); //For lock history ended on dt-30-12-10 $user_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['user'] / 100; $site_amount = $arr['totprice'] * $GLOBALS['global']['LOCKPET']['site'] / 100; $sql_trans = "INSERT INTO " . TBL_TRANSACTION . " \r\n\t\t\t\t\t\t(id_user,id_owner,facevalue,amount,trans_type,site_amt,user_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t(" . $arr['iduser'] . "," . $ownerdataobj->id_user . ",0," . $arr['totprice'] . "," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . "," . $site_amount . "," . $user_amount . ",NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($sql_trans); debug("update transaction history"); //update wall $sql_wall = "INSERT INTO " . TBL_WALL . " \r\n\t\t\t(id_user,action_to,trans_type,description,post_code,add_date_post) \r\n\t\t\tVALUES\r\n\t\t\t(" . $ownerdataobj->id_user . ",'" . $arr['petname'] . "'," . $GLOBALS['global']['TRANS_TYPE']['petlock'] . ",'with " . $arr['lockname'] . " for " . $arr['totday'] . " {$day}','" . $GLOBALS['global']['CHATTER_CODE']['pet_locked'] . "',NOW())"; $this->db->query($sql_wall); $id_wall = $this->db->insert_id(); $this->user_io_m->postItemOnFbTt($id_wall, TIMELINE_LOCKPET); debug("update wall"); //update cash to pet //$ucase = $arr['totprice']/2; $sql_updu = "UPDATE " . TBL_USER . " SET cash= cash+" . $user_amount . " WHERE id_user="******"update cash pet"); //update cash to admin $sql_upda = "UPDATE " . TBL_USER . " SET cash= cash+" . $site_amount . " WHERE id_admin=1"; $this->db->query($sql_upda); debug("update cash admin"); //update cash to owner $sql_updo = "UPDATE " . TBL_USER . " SET cash=cash-" . $arr['totprice'] . " WHERE id_user="******"update cash owner"); return true; }
function timediff($last_time, $first_time = false) { // convert to unix timestamps $last_time = mysql_to_unix($last_time); if ($first_time) { $first_time = mysql_to_unix($first_time); } else { $first_time = now(); // default now } // perform subtraction to get the difference (in seconds) between times $time_diff = $last_time - $first_time; // return the difference return $time_diff; }
function mysql_to_human($fecha = '', $tiempo = FALSE, $seconds = FALSE) { if ($fecha != '0000-00-00 00:00:00') { $time = mysql_to_unix($fecha); $r = date('d', $time) . '/' . date('m', $time) . '/' . date('Y', $time) . ' '; if ($tiempo) { $r .= date('H', $time) . ':' . date('i', $time); if ($seconds) { $r .= ':' . date('s', $time); } } } else { $r = ''; } return $r; }
function _cron_unlockpet() { $res = $this->db->where('lockstatus', 1)->get(TBL_PET)->result(); $unlockid = array(); for ($i = 0; $i < count($res); $i++) { if (mysql_to_unix($res[$i]->lockexp_date) < mysql_to_unix(mysqlDate())) { $unlockid[] = $res[$i]->id_pet; } } if (count($unlockid)) { for ($i = 0; $i < count($unlockid); $i++) { $sql = "UPDATE " . TBL_PET . " SET lockstatus=0,addlock_date='0000-00-00 00:00:00',userprice=0,id_petlock=0,lockexp_date='0000-00-00 00:00:00',intr=0 WHERE id_pet=" . $unlockid[$i]; $this->db->query($sql); } } }
function submitBuyPeepedAccess() { $userdataobj = getAccountUserDataObject(true); $id_user = $this->input->post('id_user', 0); $sellerdataobj = $this->user_io_m->init('id_user', $id_user); $days = $this->input->post('days', 0); $amountfee = $days * $sellerdataobj->peep_access; $cash = $userdataobj->cash; if ($cash < $amountfee) { echo json_encode(array('result' => 'ERROR', 'message' => 'Your balance is not enough to access peeped.')); exit; } if ($days < 1) { echo json_encode(array('result' => 'ERROR', 'message' => 'Unknown error.')); exit; } $data['id_buyer'] = getAccountUserId(); $data['id_user'] = $id_user; $data['amount'] = $amountfee; $data['ip'] = $this->geo_lib->getIpAddress(); $data['access_days'] = $days; $data['buy_date'] = mysqlDate(); $data['exp_date'] = sysDateTimeFormat(mysql_to_unix($data['buy_date']) + 86400 * $days, 'Y-m-d H:i:s'); $id_history = $this->mod_io_m->insert_map($data, TBL_PEEPBOUGHT_HISTORY); $site_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['site'] / 100); $user_amt = $amountfee * ($GLOBALS['global']['PEEP_PRICE']['user'] / 100); $transaction_data = array(); $transaction_data['id_owner'] = getAccountUserId(); $transaction_data['id_user'] = $data['id_user']; $transaction_data['amount'] = $data['amount']; $transaction_data['trans_type'] = $GLOBALS['global']['TRANS_TYPE']['buy_peeped']; $transaction_data['site_amt'] = $site_amt; $transaction_data['user_amt'] = $user_amt; $transaction_data['trans_date'] = mysqlDate(); $transaction_data['ip'] = $this->geo_lib->getIpAddress(); $transaction_id = $this->mod_io_m->insert_map($transaction_data, TBL_TRANSACTION); if ($transaction_id) { $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $site_amt . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $data['amount'] . "' WHERE id_user='******'"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $user_amt . "' WHERE id_user='******'id_user'] . "'"); } $CMCHATMSG = str_replace(array('$u1', '$u2', '$p3'), array($userdataobj->username, $sellerdataobj->username, $amountfee), language_translate('hook_chat_buy_peep_access')); echo json_encode(array('result' => 'ok', 'message' => 'Buy peeped access successfully.', 'CMCHATMSG' => $CMCHATMSG)); $this->email_sender->juzonSendEmail_JUZ_WHO_BOUGHT_WHO_PEEPED_ME($transaction_data['id_owner'], $transaction_data['id_user'], $transaction_data['amount']); exit; }
function mysql_to_th($datetime = '', $format = 'S', $time = FALSE) { if ($datetime == '0000-00-00' || $datetime == '') { return false; } if ($format == 'F') { $month_th = array(1 => 'มกราคม', 2 => 'กุมภาพันธ์', 3 => 'มีนาคม', 4 => 'เมษายน', 5 => 'พฤษภาคม', 6 => 'มิถุนายน', 7 => 'กรกฏาคม', 8 => 'สิงหาคม', 9 => 'กันยายน', 10 => 'ตุลาคม', 11 => 'พฤศจิกายน', 12 => 'ธันวาคม'); } else { $month_th = array(1 => 'ม.ค.', 2 => 'ก.พ.', 3 => 'มี.ค.', 4 => 'เม.ย', 5 => 'พ.ค.', 6 => 'มิ.ย', 7 => 'ก.ค.', 8 => 'ส.ค.', 9 => 'ก.ย.', 10 => 'ต.ค.', 11 => 'พ.ย.', 12 => 'ธ.ค.'); } $datetime = mysql_to_unix($datetime); $r = date('d', $datetime) . ' ' . $month_th[date('n', $datetime)] . ' ' . (date('Y', $datetime) + 543); if ($time) { $r .= ' - ' . date('H', $datetime) . ':' . date('i', $datetime) . ' น.'; } return $r; }
/** * Formatted Invoice Date * * Returns a localized date when fed "YYYY-MM-DD" * * @access public * @param string The date to read (YYYY-MM-DD) * @param int The number of days in the future * @return integer */ function formatted_invoice_date($date = '', $days_from_now = 0) { if ($date == '') { return ''; // if there is no date given, just return nothing } $CI =& get_instance(); $date = mysql_to_unix($date) + $days_from_now * 60 * 60 * 24; if ($CI->config->item('invoice_date_format') == 'day_month_year') { // 1 January 2009 $formatted_date = date('j ', $date) . $CI->lang->line('cal_' . strtolower(date('F', $date))) . date(' Y', $date); } else { // Januray 1, 2009 $formatted_date = $CI->lang->line('cal_' . strtolower(date('F', $date))) . date(' j, Y', $date); } return $formatted_date; }
function _formatField($Field, $Data) { if (isset($this->columnFormat[$Field])) { switch ($this->columnFormat[$Field]) { case 'date': if (!is_numeric($Data)) { $this->ci->load->helper('date'); $Data = mysql_to_unix($Data); } return date($this->columnFormatOption[$Field], $Data); break; default: $Fn = $this->columnFormat[$Field]; if (is_callable($Fn)) { return $Fn($Data); } } } return $Data; }
function test() { ini_set('date.timezone', 'PRC'); //people republic of china $this->load->helper("date"); // echo timezone_menu("UP8"); // $datestring = "Year: %Y Month: %m Day: %d - %h:%i %a"; $time = time(); // echo standard_date("DATE_ATOM", $time); $timestamp = local_to_gmt($time); //转化为时间戳 gmt greenwich mean time 格林尼治时间 //$timezone="PRC";//people republic of china // echo gmt_to_local($timestamp,$timezone,true); $mysql = '20061124092345'; $unix = mysql_to_unix($mysql); $past_time = '19900926092633'; $a = strtotime($past_time); echo local_to_gmt($past_time); // $time=time(); echo timespan($past_time, $time); ///$past_time 一定是个时间戳 }
<div class="box"> <div class="post-img"> <a href="<?php echo site_url("/view/" . $post->post_id); ?> " class="post-hover"> <span class="title"><?php echo character_limiter($post->post_title, 12); ?> </span> <span class="desc"><?php echo word_limiter($post->post_text, 20); ?> </span> <em><?php echo strftime('%B %d, %Y', mysql_to_unix($post->post_date)); ?> </em> </a> <img src="<?php echo cdn_url(getThumb($post->post_image_path)); ?> " alt="<?php echo $post->post_title; ?> " /> </div> <div class="post-tools"> <p class="ico"><a href="" class="comments"><?php echo $post->post_reply_count; ?>
/** * Get Stream Metadata * * Returns an array of the following data: * * name The stream name * slug The streams slug * namespace The stream namespace * db_table The name of the stream database table * raw_size Raw size of the stream database table * size Formatted size of the stream database table * entries_count Number of the entries in the stream * fields_count Number of fields assigned to the stream * last_updated Unix timestamp of when the stream was last updated * * @access public * @param mixed $stream object, int or string stream * @param string $namespace namespace if first param is string * @return object */ public function get_stream_metadata($stream, $namespace = null) { $stream = $this->get_stream($stream, $namespace); $data = array(); $data['name'] = $stream->stream_name; $data['slug'] = $stream->stream_slug; $data['namespace'] = $stream->stream_namespace; // Get DB table name $data['db_table'] = $stream->stream_prefix . $stream->stream_slug; // Get the table data $info = $this->CI->db->query("SHOW TABLE STATUS LIKE '" . $this->CI->db->dbprefix($data['db_table']) . "'")->row(); // Get the size of the table $data['raw_size'] = $info->Data_length; $this->CI->load->helper('number'); $data['size'] = byte_format($info->Data_length); // Last updated time $data['last_updated'] = !$info->Update_time ? $info->Create_time : $info->Update_time; $this->CI->load->helper('date'); $data['last_updated'] = mysql_to_unix($data['last_updated']); // Get the number of rows (the table status data on this can't be trusted) $data['entries_count'] = $this->CI->db->count_all($data['db_table']); // Get the number of fields $data['fields_count'] = $this->CI->db->select('id')->where('stream_id', $stream->id)->get(ASSIGN_TABLE)->num_rows(); return $data; }
//needs threading for responses/etc echo $this->pdata['header']; echo $this->pdata['content']; echo "<font size =6 color = '#474747'>Your Sent Messages</font>"; echo "<br /><br />"; echo anchor("pm/compose", "new |"); echo anchor("pm/index", "inbox |"); echo "sent |"; echo anchor("pm/archive", "archives"); echo "<br /><br />"; $TABLE = array(); //time format! $format = "%m/%d/%Y %h:%i %a"; if (count($messages)) { foreach ($messages as $key => $msg) { $stamp = mysql_to_unix($msg->created); $TABLE[] = $this->User->get_name($msg->from_id); $TABLE[] = $this->User->get_name($msg->to_id); $TABLE[] = anchor("pm/view_message1/" . $msg->id, $msg->subject); $TABLE[] = mdate($format, $stamp); } $tmpl = array('table_open' => "<table class='messages'><tr valign='bottom'><th>From</th><th>To</th><th>Subject</th><th>Date/Time</th></tr>", 'row_start' => "<tr valign='top'>"); $this->table->set_template($tmpl); $this->table->set_empty(" "); $pretty = $this->table->make_columns($TABLE, 4); echo $this->table->generate($pretty); } else { echo "No messages in sent folder!"; } echo $this->pdata['footer'];
<input type="hidden" name="metaficha" value="0"/> <?php } ?> <?php if (UsuarioBackendSesion::usuario()->tieneRol('publicador')) { ?> <tr id="fecha" style="display: table-row;"> <td class="titulo"><label for="postulacion_start">Fecha de actualización <span class="red">*</span></label></td> <td> <?php $updatedDate = $ficha->updated_data_at ? $ficha->updated_data_at : $ficha->updated_at; ?> <input type="text" name="updated_data_at" class="fecha_de_actualizacion" readonly="readonly" value="<?php echo strftime('%d-%m-%Y', mysql_to_unix($updatedDate)); ?> " placeholder="24-02-2013" /> <div class="error_date" style="color: red; display: none;">Debe elegir un periodo válido para la fecha</div> </td> </tr> <?php } ?> <tr> <td class="titulo">Servicio <span class="red">*</span></td> <td> <select data-placeholder="Seleccione un Servicio" name="servicio_codigo" class="chzn-select"> <option value=""></option> <?php foreach ($servicios as $servicio) {
?> <li> <h4><?php echo $e->Tarea->nombre; ?> </h4> <p>Estado: <?php echo $e->pendiente == 0 ? 'Completado' : 'Pendiente'; ?> </p> <p><?php echo $e->created_at ? 'Inicio: ' . strftime('%c', mysql_to_unix($e->created_at)) : ''; ?> </p> <p><?php echo $e->ended_at ? 'Término: ' . strftime('%c', mysql_to_unix($e->ended_at)) : ''; ?> </p> <p>Asignado a: <?php echo !$e->usuario_id ? 'Ninguno' : !$e->Usuario->registrado ? 'No registrado' : '<abbr class="tt" title="' . $e->Usuario->displayInfo() . '">' . $e->Usuario->displayUsername() . '</abbr>'; ?> </p> <p><a href="<?php echo site_url('backend/seguimiento/ver_etapa/' . $e->id); ?> ">Revisar detalle</a></p> </li> <?php } ?> </ul>
echo $TotalYear; ?> </strong> </div> <div class="col-xs-3"> <span>All Time</span><strong><?php echo $TotalAlltime; ?> </strong> </div> </div> <?php $Table = new ifx_Table2($TableData); $DateCol = new ifx_TColumn('createddate', 'Date', $Table); $DateCol->formatter(function ($Row, $Date) { return date('d-m-y', mysql_to_unix($Date)); })->defaultSort('DESC'); $OrderID = new ifx_TColumn('nice_id', 'Order ID', $Table); $Customer = new ifx_TColumn(null, 'Customer', $Table); $Customer->formatter(function ($Row) { return $Row->firstname . ' ' . $Row->lastname; })->sortable(true, 'concat(firstname, lastname)'); $Email = new ifx_TColumn('email', 'E-Mail Address', $Table); $Total = new ifx_TColumn(null, 'Total', $Table); $Total->formatter(function ($Row) { return '£' . number_format($Row->total + $Row->postage, 2); })->sortable(true, 'total+postage'); $Status = new ifx_TColumn(null, 'Status', $Table); $Status->formatter(function ($Row) { if (!is_null($Row->nextstatusid)) { $Link = ' [<a href="/site-admin/orders/updateorderstatus/' . $Row->order_id . '/' . $Row->nextstatusid . '/">' . $Row->nextstatusnoun . '</a>]';