当前位置: 首页>>代码示例>>PHP>>正文


PHP xoops_getUserTimestamp函数代码示例

本文整理汇总了PHP中xoops_getUserTimestamp函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_getUserTimestamp函数的具体用法?PHP xoops_getUserTimestamp怎么用?PHP xoops_getUserTimestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xoops_getUserTimestamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plzxoo_block_answers_show

function plzxoo_block_answers_show($options)
{
    $max_rows = empty($options[1]) ? 5 : intval($options[1]);
    // 表示件数
    $longest_subject = empty($options[2]) ? 50 : intval($options[2]);
    // 質問名の最大長
    $single_answer_per_question = empty($options[3]) ? false : true;
    // 締め切った質問も表示するか
    $category_limit = preg_match('/^[0-9, ]+$/', @$options[4]) ? $options[4] : 0;
    // category limit
    $order_by_modified = empty($options[5]) ? false : true;
    // order by input_date(0) or modified_date(1)
    $db =& Database::getInstance();
    if ($single_answer_per_question) {
        $grp_single = 'GROUP BY a.qid';
        $select_input_date = 'MAX(a.input_date) AS max_input_date';
        $select_modified_date = 'MAX(a.modified_date) AS max_modified_date';
        $odr_1st = $order_by_modified ? 'max_modified_date DESC' : 'max_input_date DESC';
    } else {
        $grp_single = '';
        $select_input_date = 'a.input_date';
        $select_modified_date = 'a.modified_date';
        $odr_1st = $order_by_modified ? 'a.modified_date DESC' : 'a.input_date DESC';
    }
    $whr_category = $category_limit ? 'q.cid IN (' . $category_limit . ')' : '1';
    $result = $db->query("SELECT q.subject,q.qid,q.cid,c.name,q.uid,u.uname,q.size,a.uid,{$select_input_date},{$select_modified_date},a.body FROM " . $db->prefix("plzxoo_answer") . " a LEFT JOIN " . $db->prefix("plzxoo_question") . " q ON q.qid=a.qid LEFT JOIN " . $db->prefix("plzxoo_category") . " c ON q.cid=c.cid LEFT JOIN " . $db->prefix("users") . " u ON a.uid=u.uid WHERE ({$whr_category}) AND q.status IN (1,2) {$grp_single} ORDER BY {$odr_1st} LIMIT {$max_rows}");
    $ret = array('dummy' => true);
    while (list($question_subject, $qid, $cid, $category_name, $question_uid, $answer_uname, $answer_num, $answer_uid, $input_date, $modified_date, $answer_body) = $db->fetchRow($result)) {
        $ret['answers'][] = array('question_subject' => htmlspecialchars(xoops_substr($question_subject, 0, $longest_subject), ENT_QUOTES), 'qid' => intval($qid), 'cid' => intval($cid), 'input_date' => intval($input_date), 'input_date_formatted' => formatTimestamp($input_date, 'm'), 'input_date_utime' => xoops_getUserTimestamp($input_date), 'modified_date' => intval($modified_date), 'modified_date_formatted' => formatTimestamp($modified_date, 'm'), 'modified_date_utime' => xoops_getUserTimestamp($modified_date), 'category_name' => htmlspecialchars($category_name, ENT_QUOTES), 'question_uid' => intval($question_uid), 'answer_uname' => htmlspecialchars($answer_uname, ENT_QUOTES), 'answer_num' => intval($answer_num), 'answer_uid' => intval($answer_uid), 'answer_body' => intval($answer_body));
    }
    return $ret;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:32,代码来源:plzxoo_block_answers.php

示例2: smarty_modifier_xoops_date_format

function smarty_modifier_xoops_date_format($time, $format = "%b %e, %Y")
{
    if ($time && is_numeric($time)) {
        return strftime($format, xoops_getUserTimestamp($time));
    }
    return;
}
开发者ID:nouphet,项目名称:rata,代码行数:7,代码来源:modifier.xoops_date_format.php

示例3: smarty_modifier_xugj_date

/**
 * Smarty xugj_date modifier plugin
 *
 * Type:     modifier
 * Name:     xugj_date
 * Purpose:  format datestamps via date()
 * Input:
 *         - string: input date string or integer
 *         - format: format of date() for output
 *         - new1_string: message for the latest timestamp
 *         - new2_string: message for the second latest timestamp
 *         - is_uzone: is the string offsetted for user's timezone
 * @link http://www.xugj.org/
 * @author   xugj members
 * @param string or integer
 * @param string (optional)
 * @param string (optional)
 * @param string (optional)
 * @param bool (optional)
 * @return string|void
 */
function smarty_modifier_xugj_date($string, $format = 'Y-n-j', $new1_string = 'New!', $new2_string = 'New', $is_uzone = true)
{
    if (is_numeric($string)) {
        // specified by UNIX TIMESTAMP
        $time = intval($string);
    } else {
        // specified by format
        $time = strtotime($string);
    }
    if ($time <= 0) {
        $time = time();
    }
    $utime = $is_uzone ? $time : xoops_getUserTimestamp($time);
    $unow = xoops_getUserTimestamp(time());
    $new_marks = '';
    if ($new1_string) {
        if ($utime > $unow - 1 * 86400) {
            $new_marks = '<span class="new1">' . $new1_string . '</span>';
        } else {
            if ($new2_string) {
                if ($utime > $unow - 7 * 86400) {
                    $new_marks = '<span class="new2">' . $new2_string . '</span>';
                }
            }
        }
    }
    return date($format, $utime) . $new_marks;
}
开发者ID:nouphet,项目名称:rata,代码行数:49,代码来源:modifier.xugj_date.php

示例4: getDeleteImageConfirmFormData

function getDeleteImageConfirmFormData($image_id)
{
	global $xoopsModuleConfig;
	
	$image_handler =& XsnsImageHandler::getInstance();
	$image =& $image_handler->get($image_id);
	if(!is_object($image)){
		return false;
	}
	$image_info =& $image->getInfo(2);
	
	$filename = $xoopsModuleConfig['file_upload_path']. '/'. $image_info['filename'];
	if(!file_exists($filename)){
		return false;
	}
	
	$ext_to_mime = include(XOOPS_ROOT_PATH.'/class/mimetypes.inc.php');
	
	$path_parts = @pathinfo($filename);
	$file_stat = @stat($filename);
	
	$form_data = array(
		'title' => _MD_XSNS_TITLE_IMAGE,
		'desc' => _MD_XSNS_FILE_DEL_IMAGE_DESC,
		'file_name_desc' => _MD_XSNS_FILE_IMAGE,
		'name' => "<img src='".XSNS_IMAGE_URL."?f=".$image_info['filename']."&t=2' alt=''>",
		'size' => filesize($filename),
		'type' => @$ext_to_mime[$path_parts['extension']],
		'time' => xoops_getUserTimestamp($file_stat['mtime']),
	);
	return $form_data;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:32,代码来源:defaultAction.php

示例5: addEventToArray

function addEventToArray(&$event, &$eventsArray)
{
    global $extcalTimeHandler, $startMonth, $endMonth, $xoopsUser, $month, $year;
    //print_r($GLOBALS);
    // Calculating the start and the end of the event
    $startEvent = xoops_getUserTimestamp($event['event_start'], $extcalTimeHandler->_getUserTimeZone($xoopsUser));
    $endEvent = xoops_getUserTimestamp($event['event_end'], $extcalTimeHandler->_getUserTimeZone($xoopsUser));
    // This event start before this month and finish after
    if ($startEvent < $startMonth && $endEvent > $endMonth) {
        $endFor = date('t', mktime(0, 0, 0, $month, 1, $year));
        for ($i = 1; $i <= $endFor; $i++) {
            $event['status'] = 'middle';
            $eventsArray[$i][] = $event;
        }
        // This event start before this month and finish during
    } else {
        if ($startEvent < $startMonth) {
            $endFor = date('j', $endEvent);
            for ($i = 1; $i <= $endFor; $i++) {
                $event['status'] = $i != $endFor ? 'middle' : 'end';
                $eventsArray[$i][] = $event;
            }
            // This event start during this month and finish after
        } else {
            if ($endEvent > $endMonth) {
                $startFor = date('j', $startEvent);
                $endFor = date('t', mktime(0, 0, 0, $month, 1, $year));
                for ($i = $startFor; $i <= $endFor; $i++) {
                    $event['status'] = $i == $startFor ? 'start' : 'middle';
                    $eventsArray[$i][] = $event;
                }
                // This event start and finish during this month
            } else {
                $startFor = date('j', $startEvent);
                $endFor = date('j', $endEvent);
                for ($i = $startFor; $i <= $endFor; $i++) {
                    if ($startFor == $endFor) {
                        $event['status'] = 'single';
                    } else {
                        if ($i == $startFor) {
                            $event['status'] = 'start';
                        } else {
                            if ($i == $endFor) {
                                $event['status'] = 'end';
                            } else {
                                $event['status'] = 'middle';
                            }
                        }
                    }
                    $eventsArray[$i][] = $event;
                }
            }
        }
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:55,代码来源:calendar-month.php

示例6: formatTimestamp

 function formatTimestamp($time, $format = "l", $timeoffset = "")
 {
     global $xoopsConfig, $xoopsUser;
     if (strtolower($format) == "rss" || strtolower($format) == "r") {
         $TIME_ZONE = "";
         if (!empty($GLOBALS['xoopsConfig']['server_TZ'])) {
             $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
             $prefix = $GLOBALS['xoopsConfig']['server_TZ'] < 0 ? " -" : " +";
             $TIME_ZONE = $prefix . date("Hi", $server_TZ);
         }
         $date = gmdate("D, d M Y H:i:s", intval($time)) . $TIME_ZONE;
         return $date;
     }
     $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
     switch (strtolower($format)) {
         case 's':
             $datestring = _SHORTDATESTRING;
             break;
         case 'm':
             $datestring = _MEDIUMDATESTRING;
             break;
         case 'mysql':
             $datestring = "Y-m-d H:i:s";
             break;
         case 'rss':
             $datestring = "r";
             break;
         case 'l':
             $datestring = _DATESTRING;
             break;
         case 'c':
         case 'custom':
             $current_timestamp = xoops_getUserTimestamp(time(), $timeoffset);
             if (date("Ymd", $usertimestamp) == date("Ymd", $current_timestamp)) {
                 $datestring = _TODAY;
             } elseif (date("Ymd", $usertimestamp + 24 * 60 * 60) == date("Ymd", $current_timestamp)) {
                 $datestring = _YESTERDAY;
             } elseif (date("Y", $usertimestamp) == date("Y", $current_timestamp)) {
                 $datestring = _MONTHDAY;
             } else {
                 $datestring = _YEARMONTHDAY;
             }
             break;
         default:
             if ($format != '') {
                 $datestring = $format;
             } else {
                 $datestring = _DATESTRING;
             }
             break;
     }
     return ucfirst(date($datestring, $usertimestamp));
 }
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:53,代码来源:local.php

示例7: xoops_gethandler

 function &getStructure($type = 's')
 {
     $ret =& parent::getStructure($type);
     $uHandler =& xoops_gethandler('user');
     $user = new exXoopsUserObject($uHandler->get($this->getVar('uid')));
     $ret['user'] = $user->getArray($type);
     $ret['input_date_formatted'] = formatTimestamp($ret['input_date'], 'm');
     $ret['input_date_utime'] = xoops_getUserTimestamp($ret['input_date']);
     $ret['modified_date_formatted'] = formatTimestamp($ret['modified_date'], 'm');
     $ret['modified_date_utime'] = xoops_getUserTimestamp($ret['modified_date']);
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:12,代码来源:answer.class.php

示例8: format

 /**
  * Format a given date
  *
  * Given date can be a timestamp (int) or a string date.
  * Example 1:
  *      $tf->format( time() )
  *
  * Example 2:
  *      $tf->format( '2014-05-25' );
  *
  * @param int|string $time <p>Time to format</p>
  * @param string $format <p>This value is optional. Represents the format for the returned value.</p>
  * @return mixed
  */
 public function format($time = 0, $format = '')
 {
     global $xoopsConfig;
     if ($time <= 0 || strpos($time, "-") !== false) {
         $time = strtotime($time);
     }
     $time = xoops_getUserTimestamp($time <= 0 ? $this->time : $time, '');
     $format = $format == '' ? $this->format : $format;
     if ($format == '' || $time < 0) {
         trigger_error(__('You must provide a valid time and format value to use RMTimeFormatter::format() method', 'rmcommon'));
         return null;
     }
     $find = array('%d%', '%D%', '%m%', '%M%', '%T%', '%y%', '%Y%', '%h%', '%i%', '%s%');
     $replace = array(date('d', $time), $this->days($time), date('m', $time), $this->months($time), substr($this->months($time), 0, 3), date('y', $time), date('Y', $time), date('H', $time), date('i', $time), date('s', $time));
     return str_replace($find, $replace, $format);
 }
开发者ID:JustineBABY,项目名称:rmcommon,代码行数:30,代码来源:timeformatter.php

示例9: formatTimestamp

 function formatTimestamp($time, $format = "l", $timeoffset = "")
 {
     global $xoopsConfig, $xoopsUser;
     $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
     switch (strtolower($format)) {
         case 's':
             $datestring = _SHORTDATESTRING;
             break;
         case 'm':
             $datestring = _MEDIUMDATESTRING;
             break;
         case 'mysql':
             $datestring = "Y-m-d H:i:s";
             break;
         case 'rss':
             $datestring = "r";
             break;
         case 'l':
             $datestring = _DATESTRING;
             break;
         case 'c':
         case 'custom':
             $usernow = $usertimestamp + time() - $time;
             $today = mktime(0, 0, 0, date("m", $usernow), date("d", $usernow), date("Y", $usernow));
             $thisyear = mktime(0, 0, 0, 1, 1, date("Y", $usernow));
             $time_diff = ($today - $usertimestamp) / (24 * 60 * 60);
             // days
             if ($time_diff < 0) {
                 $datestring = _TODAY;
             } elseif ($time_diff < 1) {
                 $datestring = _YESTERDAY;
             } elseif ($usertimestamp > $thisyear) {
                 $datestring = _MONTHDAY;
             } else {
                 $datestring = _YEARMONTHDAY;
             }
             break;
         default:
             if ($format != '') {
                 $datestring = $format;
             } else {
                 $datestring = _DATESTRING;
             }
             break;
     }
     return ucfirst(date($datestring, $usertimestamp));
 }
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:47,代码来源:local.php

示例10: d3pipes_admin_disp2raw

function d3pipes_admin_disp2raw($value, $type)
{
    switch ($type) {
        case 'text':
            // fix a bug(?) of InPlaceEditor
            $value = str_replace('<br>', '<br />', $value);
            break;
        case 'time':
            $value = strtotime($value);
            if (empty($value)) {
                $value = time();
            }
            $tz_offset = xoops_getUserTimestamp(0);
            $value -= $tz_offset;
            break;
    }
    return $value;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:18,代码来源:admin_functions.php

示例11: xoops_gethandler

 function &getStructure($type = 's')
 {
     $ret =& parent::getStructure($type);
     $uHandler =& xoops_gethandler('user');
     $user = new exXoopsUserObject($uHandler->get($this->getVar('uid')));
     $ret['user'] = $user->getArray($type);
     $ret['status_str'] = $GLOBALS['plzxoo_status_mapping'][$this->getVar('status')];
     $ret['input_date_formatted'] = formatTimestamp($ret['input_date'], 'm');
     $ret['input_date_utime'] = xoops_getUserTimestamp($ret['input_date']);
     $ret['modified_date_formatted'] = formatTimestamp($ret['modified_date'], 'm');
     $ret['modified_date_utime'] = xoops_getUserTimestamp($ret['modified_date']);
     // カテゴリ
     if ($ret['cid']) {
         $cHandler =& plzXoo::getHandler('category');
         $category =& $cHandler->get($ret['cid']);
         $ret['category'] =& $category->getArray();
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:19,代码来源:question.class.php

示例12: b_d3pipes_sync_show

function b_d3pipes_sync_show($options)
{
    $mydirname = empty($options[0]) ? 'd3pipes' : $options[0];
    $unique_id = empty($options[1]) ? uniqid(rand()) : htmlspecialchars($options[1], ENT_QUOTES);
    // just dummy
    $pipe_ids = empty($options[2]) ? array(0) : explode(',', preg_replace('/[^0-9,:]/', '', $options[2]));
    $max_entries = empty($options[3]) ? 0 : intval($options[3]);
    $this_template = empty($options[4]) ? 'db:' . $mydirname . '_block_sync.html' : trim($options[4]);
    $union_class = @$options[5] == 'separated' ? 'separated' : 'mergesort';
    $link2clipping = empty($options[6]) ? false : true;
    $keep_pipeinfo = empty($options[7]) ? false : true;
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname($mydirname);
    $config_handler =& xoops_gethandler('config');
    $configs = $config_handler->getConfigList($module->mid());
    $constpref = '_MB_' . strtoupper($mydirname);
    // Union object
    $union_obj =& d3pipes_common_get_joint_object($mydirname, 'union', $union_class, sizeof($pipe_ids) == 1 ? $pipe_ids[0] . ':' . $max_entries : implode(',', $pipe_ids) . '||' . ($keep_pipeinfo ? 1 : 0));
    $union_obj->setModConfigs($configs);
    $entries = $union_obj->execute(array(), $max_entries);
    $pipes_entries = method_exists($union_obj, 'getPipesEntries') ? $union_obj->getPipesEntries() : array();
    $errors = $union_obj->getErrors();
    // language file of main.php
    $langman =& D3LanguageManager::getInstance();
    $langman->read('main.php', $mydirname, basename(dirname(dirname(__FILE__))));
    $block = array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $configs['images_dir'], 'xoops_config' => $GLOBALS['xoopsConfig'], 'mod_config' => $configs, 'pipe_ids' => $pipe_ids, 'max_entries' => $max_entries, 'union_class' => $union_class, 'link2clipping' => $link2clipping, 'keep_pipeinfo' => $keep_pipeinfo, 'errors' => $errors, 'entries' => $entries, 'pipes_entries' => $pipes_entries, 'timezone_offset' => xoops_getUserTimestamp(0));
    if (empty($options['disable_renderer'])) {
        require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
        $tpl = new D3Tpl();
        $tpl->assign('block', $block);
        $ret['content'] = $tpl->fetch($this_template);
        return $ret;
    } else {
        return $block;
    }
}
开发者ID:nouphet,项目名称:rata,代码行数:39,代码来源:sync_show.php

示例13: plzxoo_block_list_show

function plzxoo_block_list_show($options)
{
    $max_rows = empty($options[1]) ? 5 : intval($options[1]);
    // 表示件数
    $longest_subject = empty($options[2]) ? 50 : intval($options[2]);
    // 質問名の最大長
    $display_closed = empty($options[3]) ? false : true;
    // 締め切った質問も表示するか
    $category_limit = preg_match('/^[0-9, ]+$/', @$options[4]) ? $options[4] : 0;
    // category limit
    $order_by_modified = empty($options[5]) ? false : true;
    // order by input_date(0) or modified_date(1)
    $db =& Database::getInstance();
    $whr_status = $display_closed ? 'q.status IN (1,2)' : 'q.status=1';
    $whr_category = $category_limit ? 'q.cid IN (' . $category_limit . ')' : '1';
    $odr_1st = $order_by_modified ? 'q.modified_date DESC' : 'q.input_date DESC';
    $result = $db->query("SELECT q.subject,q.qid,q.cid,q.input_date,q.modified_date,c.name,q.uid,u.uname,q.size,MAX(a.input_date) FROM " . $db->prefix("plzxoo_question") . " q LEFT JOIN " . $db->prefix("plzxoo_answer") . " a ON q.qid=a.qid LEFT JOIN " . $db->prefix("plzxoo_category") . " c ON q.cid=c.cid LEFT JOIN " . $db->prefix("users") . " u ON q.uid=u.uid WHERE ({$whr_status}) AND ({$whr_category}) GROUP BY q.qid ORDER BY {$odr_1st} LIMIT {$max_rows}");
    $ret = array('dummy' => true);
    while (list($subject, $qid, $cid, $input_date, $modified_date, $category_name, $uid, $uname, $answer_num, $answer_last_input_date) = $db->fetchRow($result)) {
        $answer_date_formatted = empty($answer_last_input_date) ? '' : formatTimestamp($answer_last_input_date, 'm');
        $ret['questions'][] = array('subject' => htmlspecialchars(xoops_substr($subject, 0, $longest_subject), ENT_QUOTES), 'qid' => intval($qid), 'cid' => intval($cid), 'input_date' => intval($input_date), 'input_date_formatted' => formatTimestamp($input_date, 'm'), 'input_date_utime' => xoops_getUserTimestamp($input_date), 'modified_date' => intval($modified_date), 'modified_date_formatted' => formatTimestamp($modified_date, 'm'), 'modified_date_utime' => xoops_getUserTimestamp($modified_date), 'answer_date' => intval($answer_last_input_date), 'answer_date_formatted' => $answer_date_formatted, 'answer_date_utime' => xoops_getUserTimestamp($answer_last_input_date), 'category_name' => htmlspecialchars($category_name, ENT_QUOTES), 'uid' => intval($uid), 'uname' => htmlspecialchars($uname, ENT_QUOTES), 'answer_num' => intval($answer_num));
    }
    return $ret;
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:24,代码来源:plzxoo_block_list.php

示例14: file_exists

        <strike>if ( file_exists(XOOPS_ROOT_PATH."/modules/"...."/main.php") ) {
            include_once XOOPS_ROOT_PATH."/modules/"...."/main.php";
        } else {
            if ( file_exists(XOOPS_ROOT_PATH..../english/main.php") ) {
                include_once XOOPS_ROOT_PATH..../english/main.php";
            }
        }</strike>
        require_once XOOPS_TRUST_PATH."/libs/altsys/class/D3LanguageManager.class.php" ;
        $langman =& D3LanguageManager::getInstance() ;
        $langman->read( "main.php" , $xoopsModule->getVar("dirname") ) ;
		</pre>
	';
}
//
// display stage
//
xoops_cp_header();
// mymenu
altsys_include_mymenu();
// breadcrumbs
$breadcrumbsObj =& AltsysBreadcrumbs::getInstance();
if ($breadcrumbsObj->hasPaths()) {
    $breadcrumbsObj->appendPath(XOOPS_URL . '/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN);
    $breadcrumbsObj->appendPath('', $target_mname);
}
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
$tpl = new D3Tpl();
$tpl->assign(array('target_dirname' => $target_dirname, 'target_mname' => $target_mname, 'target_lang' => $target_lang, 'languages' => $languages, 'languages4disp' => $languages4disp, 'target_file' => $target_file, 'lang_files' => $lang_files, 'langfile_constants' => $langfile_constants, 'mylang_constants' => $mylang_constants, 'use_my_language' => strlen($langman->my_language) > 0, 'mylang_file_name' => htmlspecialchars($mylang_unique_path, ENT_QUOTES), 'cache_file_name' => htmlspecialchars($cache_file_name, ENT_QUOTES), 'cache_file_mtime' => intval($cache_file_mtime), 'timezone_offset' => xoops_getUserTimestamp(0), 'notice' => $notice4disp, 'already_read' => $already_read, 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys')));
$tpl->display('db:altsys_main_mylangadmin.html');
xoops_cp_footer();
exit;
开发者ID:hiro1173,项目名称:legacy,代码行数:31,代码来源:mylangadmin.php

示例15: formatTimestamp

 /**
  * Function to display formatted times in user timezone
  *
  * Setting $timeoffset to null (by default) will skip timezone calculation for user, using default timezone instead, which is a MUST for cached contents
  */
 static function formatTimestamp($time, $format = 'l', $timeoffset = null)
 {
     global $xoopsConfig, $xoopsUser;
     $format_copy = $format;
     $format = strtolower($format);
     if ($format == 'rss' || $format == 'r') {
         $TIME_ZONE = '';
         if (isset($GLOBALS['xoopsConfig']['server_TZ'])) {
             $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
             $prefix = $GLOBALS['xoopsConfig']['server_TZ'] < 0 ? ' -' : ' +';
             $TIME_ZONE = $prefix . date('Hi', $server_TZ);
         }
         $date = gmdate('D, d M Y H:i:s', intval($time)) . $TIME_ZONE;
         return $date;
     }
     if (($format == 'elapse' || $format == 'e') && $time < time()) {
         $elapse = time() - $time;
         if ($days = floor($elapse / (24 * 3600))) {
             $num = $days > 1 ? sprintf(_DAYS, $days) : _DAY;
         } elseif ($hours = floor($elapse % (24 * 3600) / 3600)) {
             $num = $hours > 1 ? sprintf(_HOURS, $hours) : _HOUR;
         } elseif ($minutes = floor($elapse % 3600 / 60)) {
             $num = $minutes > 1 ? sprintf(_MINUTES, $minutes) : _MINUTE;
         } else {
             $seconds = $elapse % 60;
             $num = $seconds > 1 ? sprintf(_SECONDS, $seconds) : _SECOND;
         }
         $ret = sprintf(_ELAPSE, $num);
         return $ret;
     }
     // disable user timezone calculation and use default timezone,
     // for cache consideration
     if ($timeoffset === null) {
         $timeoffset = $xoopsConfig['default_TZ'] == '' ? '0.0' : $xoopsConfig['default_TZ'];
     }
     $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
     switch ($format) {
         case 's':
             $datestring = _SHORTDATESTRING;
             break;
         case 'm':
             $datestring = _MEDIUMDATESTRING;
             break;
         case 'mysql':
             $datestring = 'Y-m-d H:i:s';
             break;
         case 'l':
             $datestring = _DATESTRING;
             break;
         case 'c':
         case 'custom':
             static $current_timestamp, $today_timestamp, $monthy_timestamp;
             if (!isset($current_timestamp)) {
                 $current_timestamp = xoops_getUserTimestamp(time(), $timeoffset);
             }
             if (!isset($today_timestamp)) {
                 $today_timestamp = mktime(0, 0, 0, date('m', $current_timestamp), date('d', $current_timestamp), date('Y', $current_timestamp));
             }
             if (abs($elapse_today = $usertimestamp - $today_timestamp) < 24 * 60 * 60) {
                 $datestring = $elapse_today > 0 ? _TODAY : _YESTERDAY;
             } else {
                 if (!isset($monthy_timestamp)) {
                     $monthy_timestamp[0] = mktime(0, 0, 0, 0, 0, date('Y', $current_timestamp));
                     $monthy_timestamp[1] = mktime(0, 0, 0, 0, 0, date('Y', $current_timestamp) + 1);
                 }
                 if ($usertimestamp >= $monthy_timestamp[0] && $usertimestamp < $monthy_timestamp[1]) {
                     $datestring = _MONTHDAY;
                 } else {
                     $datestring = _YEARMONTHDAY;
                 }
             }
             break;
         default:
             if ($format != '') {
                 $datestring = $format_copy;
             } else {
                 $datestring = _DATESTRING;
             }
             break;
     }
     return ucfirst(date($datestring, $usertimestamp));
 }
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:87,代码来源:xoopslocal.php


注:本文中的xoops_getUserTimestamp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。