本文整理汇总了PHP中get_timestamp函数的典型用法代码示例。如果您正苦于以下问题:PHP get_timestamp函数的具体用法?PHP get_timestamp怎么用?PHP get_timestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_timestamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _set_field_filter
protected function _set_field_filter($cond)
{
if (isset($cond['read']) && isset($this->id)) {
$cond['update_timestamp'] = get_timestamp();
}
return $cond;
}
示例2: save
/**
* store nu usefullinks
* returns the id
*/
public function save($type = 1)
{
$data = array('title' => $this->input->post('title'), 'title_np' => $this->input->post('title_np'), 'link' => $this->input->post('link'), 'description' => $this->input->post('description'), 'description_np' => $this->input->post('description_np'), 'created_by' => $this->ion_auth->get_user()->id, 'date_created' => get_timestamp(), 'date_published' => $this->input->post('date_published'), 'date_removed' => $this->input->post('date_removed'), 'active' => $this->input->post('active'), 'homepage' => $this->input->post('homepage'));
/*
echo '<pre>';
print_r($data);
print_r($_POST);
echo '</pre>';
*/
//print_r( $this->ion_auth->get_user()->id);
//update existing usefullinks
if (strlen($this->input->post('id')) > 0) {
$data['id'] = $this->input->post('id');
return $this->update($data);
//insert new usefullinks
} else {
//echo '<pre>';
//print_r($data);
//echo '</pre>';
if (!$this->db->insert($this->table, $data)) {
return $this->db->_error_message();
}
return $this->db->insert_id();
}
}
示例3: log
/** Inserts a log entry
*
* @param string $str_LogLevel
* @param string $str_Message
* @param string $str_UserNick
* @param string $str_Hostname
* @return boolean
*/
public function log($str_LogLevel, $str_Message, $str_UserNick = NULL, $str_Hostname = 'localhost')
{
// Check if proposed log level is acceptable, otherwise log entry is refused
if (in_array($str_LogLevel, $this->logLevelsList) && array_search($str_LogLevel, $this->logLevelsList) <= array_search($this->logLevel, $this->logLevelsList)) {
$str_Timestamp = get_timestamp();
$arr_InsertValues = array(array($str_Timestamp => 's'), array($str_LogLevel => 's'), array($str_Hostname => 's'), array($str_UserNick => 's'), array($this->entity => 's'), array($this->module => 's'), array($str_Message => 's'));
$str_LogPrepared = 'insert into ' . $this->logTableName . ' (
logTimestamp,
logLevel,
hostname,
userNick,
entity,
module,
message
) values (
?,
?,
?,
?,
?,
?,
?
)';
$this->dbHandler->beginTransaction();
$this->dbHandler->executePrepared($str_LogPrepared, $arr_InsertValues);
$this->dbHandler->commit();
return TRUE;
} else {
return FALSE;
}
}
示例4: add
public function add($user, $file, $action = null)
{
$entry = get_timestamp() . " | " . basename($file) . " | " . $user . " | " . $action . "\n";
$f = fopen($this->log_file, 'a');
fwrite($f, $entry);
fclose($f);
}
示例5: get_favicon
function get_favicon($url)
{
if (!$url || !is_url($url)) {
return false;
}
if (!isset($_GET['refresh']) && UNIX_TIME <= get_timestamp($url) + FAVICON_CACHE_TTL) {
$cache = get_url_filename($url);
return file_get_contents($cache);
} else {
return update_cache($url);
}
}
示例6: process_form
function process_form()
{
global $vars, $phpcdb, $phpc_cal, $phpcid, $phpc_script;
if (!isset($vars['eid']) && !isset($vars['oid'])) {
soft_error(__("Cannot create occurrence."));
}
$start_ts = get_timestamp("start");
$end_ts = get_timestamp("end");
switch ($vars["time-type"]) {
case 'normal':
$time_type = 0;
break;
case 'full':
$time_type = 1;
break;
case 'tba':
$time_type = 2;
break;
default:
soft_error(__("Unrecognized Time Type."));
}
$duration = $end_ts - $start_ts;
if ($duration < 0) {
soft_error(__("An event cannot have an end earlier than its start."));
}
verify_token();
if (!$phpc_cal->can_write()) {
permission_error(__('You do not have permission to write to this calendar.'));
}
if (!isset($vars['oid'])) {
$modify = false;
if (!isset($vars["eid"])) {
soft_error(__("EID not set."));
}
$oid = $phpcdb->create_occurrence($vars["eid"], $time_type, $start_ts, $end_ts);
} else {
$modify = true;
$oid = $vars["oid"];
$phpcdb->modify_occurrence($oid, $time_type, $start_ts, $end_ts);
}
if ($oid != 0) {
if ($modify) {
$message = __("Modified occurence: ");
} else {
$message = __("Created occurence: ");
}
return message_redirect(tag('', $message, create_event_link($oid, 'display_event', $oid)), "{$phpc_script}?action=display_event&phpcid={$phpcid}&oid={$oid}");
} else {
return message_redirect(__('Error submitting occurrence.'), "{$phpc_script}?action=display_month&phpcid={$phpcid}");
}
}
示例7: search_results
function search_results()
{
global $vars, $phpcdb, $phpcid, $sort_options, $order_options;
$searchstring = $vars['searchstring'];
if (!empty($vars['search-from-date']) && strlen($vars['search-from-date']) > 0) {
$start = get_timestamp('search-from');
} else {
$start = false;
}
if (!empty($vars['search-to-date']) && strlen($vars['search-to-date']) > 0) {
$end = get_timestamp('search-to');
} else {
$end = false;
}
// make sure sort is valid
$sort = htmlentities($vars['sort']);
if (array_search($sort, array_keys($sort_options)) === false) {
soft_error(__('Invalid sort option') . ": {$sort}");
}
// make sure order is valid
$order = htmlentities($vars['order']);
if (array_search($order, array_keys($order_options)) === false) {
soft_error(__('Invalid order option') . ": {$order}");
}
$keywords = explode(" ", $searchstring);
$results = $phpcdb->search($phpcid, $keywords, $start, $end, $sort, $order);
$tags = array();
foreach ($results as $event) {
if (!$event->can_read()) {
continue;
}
$name = $event->get_author();
$subject = $event->get_subject();
$desc = $event->get_desc();
$date = $event->get_date_string();
$time = $event->get_time_string();
$eid = $event->get_eid();
$tags[] = tag('tr', tag('td', tag('strong', create_event_link($subject, 'display_event', $eid))), tag('td', "{$date} {$time}"), tag('td', $desc));
}
if (sizeof($tags) == 0) {
$html = tag('div', tag('strong', __('No events matched your search criteria.')));
} else {
$html = tag('table', attributes('class="phpc-main"'), tag('caption', __('Search Results')), tag('thead', tag('tr', tag('th', __('Subject')), tag('th', __('Date Time')), tag('th', __('Description')))));
foreach ($tags as $tag) {
$html->add($tag);
}
}
return $html;
}
示例8: save
/**
* save nu poll
*/
public function save()
{
$data = array('question' => $this->input->post('question'), 'question_np' => $this->input->post('question_np'), 'option1' => $this->input->post('option1'), 'option2' => $this->input->post('option2'), 'option3' => $this->input->post('option3'), 'option4' => $this->input->post('option4'), 'option1_np' => $this->input->post('option1_np'), 'option2_np' => $this->input->post('option2_np'), 'option3_np' => $this->input->post('option3_np'), 'option4_np' => $this->input->post('option4_np'), 'active' => $this->input->post('publish'));
//store new poll
if ($this->input->post('id') == null) {
$data['created_by'] = $this->ion_auth->get_user()->id;
$data['date_created'] = get_timestamp();
$this->poll_library->new_poll($data);
//update existing poll
} else {
$data['id'] = $this->input->post('id');
$this->poll_library->update_poll($data);
}
redirect('admin/poll');
}
示例9: done_upload
public function done_upload($category = '')
{
if ($this->file_name) {
$dest = $this->system_upload_path . '/' . $category . '/';
if (!file_exists($dest)) {
mkdir($dest, 0755, true);
}
$path = $this->upload_path . $this->file_name;
$name = md5(get_timestamp() . $this->file_name);
$path_parts = pathinfo($path);
$name .= '.' . $path_parts['extension'];
rename($path, $dest . $name);
$this->site_path = $dest . $name;
$this->relative_path = $category . '/' . $name;
return true;
}
return false;
}
示例10: upload
/**
* slider form
*/
public function upload()
{
if ($this->input->post('upload')) {
//upload the file
$result = $this->slider_model->upload('slider');
$result['status'] = 'image uploaded';
//get uploaded file's info.
$this->data = array_merge($this->data, array('result' => $result));
redirect('admin/slider');
}
//generate username, current date if creating nu slider [not editing]
$this->data['date_created'] = get_timestamp();
$this->session->set_userdata('date_created', $this->data['date_created']);
$this->data['created_by'] = $this->ion_auth->get_user()->username;
//display
$this->load->view('templates/admin_header');
$this->load->view('admin/index.php');
$this->load->view('admin/upload_slider.php', $this->data);
$this->load->view('templates/admin_footer');
}
示例11: datediff
function datediff($interval, $date1, $date2)
{
return datediff_timestamp($interval, get_timestamp($date1), get_timestamp($date2));
}
示例12: create
/**
* organizations form
*/
public function create()
{
$title_dropdown = $this->organizations_model->get(null, null, null, true);
if (count($title_dropdown)) {
$this->data['title_dropdown'] = '';
$this->data['title_dropdown'] .= '<option></option>';
foreach ($title_dropdown as $key => $val) {
$this->data['title_dropdown'] .= '<option>' . $val->title . '</option>';
}
}
//generate username, current date if creating nu acts [not editing]
if (!isset($this->data['date_created'])) {
$this->data['date_created'] = get_timestamp();
$this->session->set_userdata('date_created', $this->data['date_created']);
}
if (!isset($this->data['created_by'])) {
$this->data['created_by'] = $this->ion_auth->get_user()->username;
} else {
//get the username of the person who created the acts
// $this->data['created_by'] = $this->ion_auth->get_user($this->data['created_by'])->username;
}
//print_r($this->data[0]);
//array_push($this->data,$this->data[0]);
//array_push($this->data,(array)$this->data[0]);
//array_merge($this->data[0],$this->data);
//echo '<pre>';
//print_r($this->data);
//echo '</pre>';
//display
$this->load->view('templates/admin_header');
$this->load->view('admin/index.php');
$this->load->view('admin/create_organizations.php', $this->data);
$this->load->view('templates/admin_footer');
}
示例13: create
/**
* networks form
*/
public function create()
{
//print_r($this->data);
//generate username, current date if creating nu networks [not editing]
if (!isset($this->data['date_created'])) {
$this->data['date_created'] = get_timestamp();
$this->session->set_userdata('date_created', $this->data['date_created']);
}
if (!isset($this->data['created_by'])) {
$this->data['created_by'] = $this->ion_auth->get_user()->username;
// }else{
//
// //get the username of the person who created the networks
// $this->data['created_by'] = $this->ion_auth->get_user($this->data['created_by'])->username;
}
//print_r($this->data[0]);
//array_push($this->data,$this->data[0]);
//array_push($this->data,(array)$this->data[0]);
//array_merge($this->data[0],$this->data);
//echo '<pre>';
//print_r($this->data);
//echo '</pre>';
//display
$this->load->view('templates/admin_header');
$this->load->view('admin/index.php');
$this->load->view('admin/create_networks.php', $this->data);
$this->load->view('templates/admin_footer');
}
示例14: process_form
function process_form()
{
global $vars, $phpcdb, $phpc_cal, $phpcid, $phpc_script, $phpc_user;
// When modifying events, this is the value of the checkbox that
// determines if the date should change
$modify_occur = !isset($vars['eid']) || !empty($vars['phpc-modify']);
if ($modify_occur) {
$start_ts = get_timestamp("start");
$end_ts = get_timestamp("end");
switch ($vars["time-type"]) {
case 'normal':
$time_type = 0;
break;
case 'full':
$time_type = 1;
break;
case 'tba':
$time_type = 2;
break;
default:
soft_error(__("Unrecognized Time Type."));
}
$duration = $end_ts - $start_ts;
if ($duration < 0) {
message(__("An event cannot have an end earlier than its start."));
return display_form();
}
}
verify_token();
if (0) {
permission_error(__('You do not have permission to write to this calendar.'));
}
if ($phpc_cal->can_create_readonly() && !empty($vars['readonly'])) {
$readonly = true;
} else {
$readonly = false;
}
$catid = empty($vars['catid']) ? false : $vars['catid'];
if (!isset($vars['eid'])) {
$modify = false;
$eid = $phpcdb->create_event($phpcid, $phpc_user->get_uid(), $vars["subject"], $vars["description"], $readonly, $catid);
} else {
$modify = true;
$eid = $vars['eid'];
$phpcdb->modify_event($eid, $vars['subject'], $vars['description'], $readonly, $catid);
if ($modify_occur) {
$phpcdb->delete_occurrences($eid);
}
}
if ($modify_occur) {
$oid = $phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
$occurrences = 1;
switch ($vars["repeats"]) {
case "never":
break;
case 'daily':
if (!isset($vars["every-day"])) {
soft_error(__("Required field \"every-day\" is not set."));
}
$ndays = $vars["every-day"];
if ($ndays < 1) {
soft_error(__("every-day must be greater than 1"));
}
$daily_until = get_timestamp("daily-until");
while ($occurrences <= 730) {
$start_ts = add_days($start_ts, $ndays);
$end_ts = add_days($end_ts, $ndays);
if (days_between($start_ts, $daily_until) < 0) {
break;
}
$phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
$occurrences++;
}
break;
case 'weekly':
if (!isset($vars["every-week"])) {
soft_error(__("Required field \"every-week\" is not set."));
}
if ($vars["every-week"] < 1) {
soft_error(__("every-week must be greater than 1"));
}
$ndays = $vars["every-week"] * 7;
$weekly_until = get_timestamp("weekly-until");
while ($occurrences <= 730) {
$start_ts = add_days($start_ts, $ndays);
$end_ts = add_days($end_ts, $ndays);
if (days_between($start_ts, $weekly_until) < 0) {
break;
}
$phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
$occurrences++;
}
break;
case 'monthly':
if (!isset($vars["every-month"])) {
soft_error(__("Required field \"every-month\" is not set."));
}
if ($vars["every-month"] < 1) {
soft_error(__("every-month must be greater than 1"));
}
//.........这里部分代码省略.........
示例15: create
/**
* pages form
*/
public function create()
{
//generate WYSIWYG editor
$this->_ckeditor_conf();
$this->data['generated_editor'] = display_ckeditor($this->data['ckeditor']);
$this->data['generated_editor2'] = display_ckeditor($this->data['ckeditor2']);
//generate username, current date if creating nu pages [not editing]
if (!isset($this->data['date_created'])) {
$this->data['date_created'] = get_timestamp();
$this->session->set_userdata('date_created', $this->data['date_created']);
}
if (!isset($this->data['created_by'])) {
$this->data['created_by'] = $this->ion_auth->get_user()->username;
} else {
//get the username of the person who created the pages
// $this->data['created_by'] = $this->ion_auth->get_user($this->data['created_by'])->username;
}
if (!isset($this->data['output'])) {
$this->data = array_merge($this->data, array('output' => '', 'js_files' => array(), 'css_files' => array()));
}
//array_push($this->data,$this->data[0]);
//array_push($this->data,(array)$this->data[0]);
//array_merge($this->data[0],$this->data);
//echo '<pre>';
//print_r($this->data);
//echo '</pre>';
//display
$this->load->view('templates/admin_header');
$this->load->view('admin/index.php');
$this->load->view('admin/create_pages.php', $this->data);
$this->load->view('templates/admin_footer');
}