コード例 #1
0
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;
}
コード例 #2
0
function smarty_modifier_xoops_date_format($time, $format = "%b %e, %Y")
{
    if ($time && is_numeric($time)) {
        return strftime($format, xoops_getUserTimestamp($time));
    }
    return;
}
コード例 #3
0
ファイル: modifier.xugj_date.php プロジェクト: nouphet/rata
/**
 * 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;
}
コード例 #4
0
ファイル: defaultAction.php プロジェクト: nunoluciano/uxcl
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;
}
コード例 #5
0
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;
                }
            }
        }
    }
}
コード例 #6
0
ファイル: local.php プロジェクト: BackupTheBerlios/xoops4-svn
 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));
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 /**
  * 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);
 }
コード例 #9
0
ファイル: local.php プロジェクト: BackupTheBerlios/soopa
 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));
 }
コード例 #10
0
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;
}
コード例 #11
0
 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;
 }
コード例 #12
0
ファイル: sync_show.php プロジェクト: nouphet/rata
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;
    }
}
コード例 #13
0
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;
}
コード例 #14
0
ファイル: mylangadmin.php プロジェクト: hiro1173/legacy
        <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;
コード例 #15
0
ファイル: xoopslocal.php プロジェクト: RanLee/Xoops_demo
 /**
  * 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));
 }
コード例 #16
0
ファイル: func.class.php プロジェクト: nunoluciano/uxcl
function myformatTimestamp($time, $format, $timeoffset=""){
    global $xoopsUser;
    $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
	return date($format, $usertimestamp);
}
コード例 #17
0
<?php

require dirname(dirname(__FILE__)) . '/include/common_prepend.inc.php';
$xoopsOption['template_main'] = $mydirname . '_main_eachpipe.html';
// xoops header
include XOOPS_ROOT_PATH . '/header.php';
// fetch pipe_row
$pipe_id = intval(@$_GET['pipe_id']);
$pipe4assign = d3pipes_common_get_pipe4assign($mydirname, $pipe_id);
// specialcheck for eachpipe
if (empty($pipe4assign['main_disp'])) {
    redirect_header(XOOPS_URL . '/modules/' . $mydirname . '/', 3, _MD_D3PIPES_ERR_INVALIDPIPEID);
    exit;
}
// parse the pipe once
$entries = d3pipes_common_fetch_entries($mydirname, $pipe4assign, $xoopsModuleConfig['entries_per_eachpipe'], $errors, $xoopsModuleConfig);
// pagetitle & xoops_breadcrumbs
$pagetitle4assign = empty($pipe4assign['name']) ? _MD_D3PIPES_H2_EACHPIPE : $pipe4assign['name'];
$xoops_breadcrumbs[] = array('name' => $pagetitle4assign);
// assign
$xoopsTpl->assign(array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'xoops_config' => $xoopsConfig, 'mod_config' => $xoopsModuleConfig, 'xoops_breadcrumbs' => $xoops_breadcrumbs, 'xoops_pagetitle' => $pagetitle4assign, 'errors' => $errors, 'clipping_count' => d3pipes_main_get_clipping_count_moduledb($mydirname, $pipe_id), 'pipe' => $pipe4assign, 'entries' => $entries, 'timezone_offset' => xoops_getUserTimestamp(0), 'xoops_module_header' => d3pipes_main_get_link2rss($mydirname, $pipe_id, $pipe4assign) . d3pipes_main_get_link2maincss($mydirname) . $xoopsTpl->get_template_vars("xoops_module_header")));
include XOOPS_ROOT_PATH . '/footer.php';
コード例 #18
0
ファイル: storyform.inc.php プロジェクト: amjadtbssm/website
        $xxmin = "0{$xmin}";
    }
    echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
}
echo "</select></br />";
echo "<br /><input type='checkbox' name='autoexpdate' value='1'";
if (isset($autoexpdate) && $autoexpdate == 1) {
    echo " checked='checked'";
}
echo "> ";
$time = time();
if (isset($isedit) && $isedit == 1 && $expired > 0) {
    echo _AM_CHANGEEXPDATETIME . "<br />";
    printf(_AM_NOWSETEXPTIME, formatTimestamp($expired));
    echo "<br />";
    $expired = xoops_getUserTimestamp($expired);
    printf(_AM_CURRENTTIME, formatTimestamp($time));
    echo "<br />";
    echo "<input type='hidden' name='isedit' value='1' />";
} else {
    echo _AM_SETEXPDATETIME . "<br />";
    printf(_AM_CURRENTTIME, formatTimestamp($time));
    echo "<br />";
}
echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='autoexpmonth'>";
if (isset($autoexpmonth)) {
    $autoexpmonth = intval($autoexpmonth);
} elseif (isset($expired)) {
    $autoexpmonth = date('m', $expired);
} else {
    $autoexpmonth = date('m');
コード例 #19
0
ファイル: functions.php プロジェクト: amjadtbssm/website
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 = "D, j M Y H:i:s T";
            break;
        case 'l':
            $datestring = _DATESTRING;
            break;
        default:
            if ($format != '') {
                $datestring = $format;
            } else {
                $datestring = _DATESTRING;
            }
            break;
    }
    return ucfirst(date($datestring, $usertimestamp));
}
コード例 #20
0
 function b_xhld_mixed_show($options)
 {
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     $maxitem = empty($options[1]) ? 10 : intval($options[1]);
     $maxlen = empty($options[2]) ? 128 : intval($options[2]);
     $maxitemafeed = empty($options[3]) ? 99 : intval($options[3]);
     $block = array();
     $hlman =& xoops_getmodulehandler('headline', $mydirname, true);
     if (!$hlman) {
         $mydirname = basename(dirname(dirname(__FILE__)));
         $hlman =& xoops_getmodulehandler('headline', $mydirname, true);
         if (!$hlman) {
             return array();
         }
     }
     $headlines =& $hlman->getObjects(new Criteria('headline_asblock', 1));
     $count = count($headlines);
     $items = array();
     for ($i = 0; $i < $count; $i++) {
         // list( $usec , $sec ) = explode( " " , microtime() ) ;
         // $starttime = $sec + $usec ;
         $renderer =& xhld_getrenderer($headlines[$i], $mydirname);
         $itemsperfeed = empty($renderer->config["mixed_mode"]) ? 100 : $headlines[$i]->getVar('headline_blockmax');
         $tmp_data = $renderer->getRawDataAsArray(false, min($itemsperfeed, $maxitemafeed), $maxlen);
         $dtfmt_short = empty($renderer->config["dtfmt_short"]) ? '' : $renderer->config["dtfmt_short"];
         // list( $usec , $sec ) = explode( " " , microtime() ) ;
         // echo "<p>" . ( $sec + $usec - $starttime ) . "sec.</p>" ;
         if (!empty($tmp_data)) {
             $no_pubdate_counter = $i;
             foreach ($tmp_data['items'] as $item) {
                 if (empty($item['pubdate'])) {
                     $item['pubdate'] = '';
                     $no_pubdate_counter += $count;
                     $sort_weight = -$no_pubdate_counter;
                 } else {
                     $sort_weight = $item['pubdate'];
                 }
                 $items[] = array('site_name' => $tmp_data['site_name'], 'site_url' => $tmp_data['site_url'], 'site_id' => $tmp_data['site_id'], 'channel_data' => $tmp_data['channel_data'], 'image_data' => empty($tmp_data['image_data']) ? array() : $tmp_data['image_data'], 'title' => $item['title'], 'link' => $item['link'], 'sort_weight' => $sort_weight, 'pubdate' => $item['pubdate'], 'pubdate_utz' => xoops_getUserTimestamp($item['pubdate']), 'date_short' => date($dtfmt_short, xoops_getUserTimestamp($item['pubdate'])), 'date' => formatTimestamp($item['pubdate'], 'm'), 'description' => empty($item['description']) ? '' : $item['description']);
             }
         }
     }
     // order by pubdate desc
     usort($items, create_function('$a,$b', 'return $a["sort_weight"] < $b["sort_weight"] ? 1 : -1 ;'));
     $block['maxitem'] = $maxitem;
     $block['items'] = $items;
     $block['mod_url'] = XOOPS_URL . '/modules/' . $mydirname;
     $block['dtfmt_short'] = empty($dtfmt_short) ? '' : $dtfmt_short;
     return $block;
 }
コード例 #21
0
 function strToServerTime($text)
 {
     return strtotime($text) - xoops_getUserTimestamp(0);
 }
コード例 #22
0
        $mixlist['dtfmt_short'] = $dtfmt_short;
        $tpl->assign('mixlist', $mixlist);
    }
}
// headline_id specified
if ($hlid > 0) {
    $headline =& $hlman->get($hlid);
    if (is_object($headline)) {
        $renderer =& xhld_getrenderer($headline, $mydirname);
        $data = $renderer->getRawDataAsArray(false);
        // num is 1 origin instead of 0 origin
        $num = empty($_GET['num']) ? 1 : intval($_GET['num']);
        // item preparing
        $item = empty($data['items'][$num - 1]) ? $data['items'][0] : $data['items'][$num - 1];
        if ($item['pubdate'] > 0) {
            $item['date_short'] = date($dtfmt_short, xoops_getUserTimestamp($item['pubdate']));
            $item['date'] = formatTimestamp($item['pubdate'], 'm');
        }
        // strip tags other than <BR>
        $item['description'] = str_replace('[br]', '<BR>', strip_tags(str_replace(array('<br />', '<br>', '<BR />', '<BR>'), '[br]', $item['description'])));
        // navigation
        if ($num > 1) {
            $tpl->assign('prev_num', $num - 1);
        }
        if (!empty($data['items'][$num + 1])) {
            $tpl->assign('next_num', $num + 1);
        }
        $tpl->assign('hlid', $hlid);
        $tpl->assign('num', $num);
        $tpl->assign('hl_site_name', strip_tags($data['site_name']));
        $tpl->assign('item', $item);
コード例 #23
0
ファイル: functions.php プロジェクト: nao-pon/impresscms
/**
 * Function to display formatted times in user timezone
 *
 * @param string  $time  String with time
 * @param string  $format  The time format based on PHP function format parameters
 * @param string  $timeoffset  The time offset string
 * @return string  $usertimestamp  The generated user timestamp
 * @todo Move to a static class method - Date or Calendar
 */
function formatTimestamp($time, $format = "l", $timeoffset = null)
{
    global $icmsConfig;
    $format_copy = $format;
    $format = strtolower($format);
    if ($format == "rss" || $format == "r") {
        $TIME_ZONE = "";
        if (!empty($GLOBALS['icmsConfig']['server_TZ'])) {
            $server_TZ = abs((int) ($GLOBALS['icmsConfig']['server_TZ'] * 3600.0));
            $prefix = $GLOBALS['icmsConfig']['server_TZ'] < 0 ? " -" : " +";
            $TIME_ZONE = $prefix . date("Hi", $server_TZ);
        }
        $date = gmdate("D, d M Y H:i:s", (int) $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, icms_conv_nr2local($num));
        return $ret;
    }
    // disable user timezone calculation and use default timezone,
    // for cache consideration
    if ($timeoffset === null) {
        $timeoffset = $icmsConfig['default_TZ'] == '' ? '0.0' : $icmsConfig['default_TZ'];
    }
    $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
    switch ($format) {
        case 'daynumber':
            $datestring = 'd';
            break;
        case 'D':
            $datestring = 'D';
            break;
        case 'F':
            $datestring = 'F';
            break;
        case 'hs':
            $datestring = 'h';
            break;
        case 'H':
            $datestring = 'H';
            break;
        case 'gg':
            $datestring = 'g';
            break;
        case 'G':
            $datestring = 'G';
            break;
        case 'i':
            $datestring = 'i';
            break;
        case 'j':
            $datestring = 'j';
            break;
        case 'l':
            $datestring = _DATESTRING;
            break;
        case 'm':
            $datestring = _MEDIUMDATESTRING;
            break;
        case 'monthnr':
            $datestring = 'm';
            break;
        case 'mysql':
            $datestring = 'Y-m-d H:i:s';
            break;
        case 'month':
            $datestring = 'M';
            break;
        case 'n':
            $datestring = 'n';
            break;
        case 's':
            $datestring = _SHORTDATESTRING;
            break;
        case 'seconds':
            $datestring = 's';
            break;
        case 'suffix':
            $datestring = 'S';
            break;
        case 't':
            $datestring = 't';
            break;
        case 'w':
            $datestring = 'w';
            break;
        case 'shortyear':
            $datestring = 'y';
            break;
        case 'Y':
            $datestring = 'Y';
            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;
    }
    $basecheck = $icmsConfig['use_ext_date'] == true && defined('_CALENDAR_TYPE') && $format != 'mysql';
    if ($basecheck && file_exists(ICMS_ROOT_PATH . '/language/' . $icmsConfig['language'] . '/local.date.php')) {
        include_once ICMS_ROOT_PATH . '/language/' . $icmsConfig['language'] . '/local.date.php';
        return ucfirst(local_date($datestring, $usertimestamp));
    } elseif ($basecheck && _CALENDAR_TYPE != "jalali" && $icmsConfig['language'] != 'english') {
        return ucfirst(icms_conv_nr2local(ext_date(date($datestring, $usertimestamp))));
    } elseif ($basecheck && _CALENDAR_TYPE == "jalali") {
        include_once 'jalali.php';
        return ucfirst(icms_conv_nr2local(jdate($datestring, $usertimestamp)));
    } else {
        return ucfirst(date($datestring, $usertimestamp));
    }
}
コード例 #24
0
ファイル: event.php プロジェクト: severnaya99/Sg-2010
 function getEventForm($siteSide = 'user', $mode = 'new', $data = null)
 {
     $catHandler = xoops_getmodulehandler('cat', 'extcal');
     $fileHandler = xoops_getmodulehandler('file', 'extcal');
     if ($siteSide == 'admin') {
         $action = 'event.php?op=enreg';
         $cats = $catHandler->getAllCat($GLOBALS['xoopsUser'], 'all');
     } else {
         $action = 'post.php';
         $cats = $catHandler->getAllCat($GLOBALS['xoopsUser']);
     }
     $reccurOptions = array();
     if ($mode == 'edit') {
         if (!($event = $this->getEventWithNotApprove($data['event_id']))) {
             return false;
         }
         $formTitle = _MD_EXTCAL_EDIT_EVENT;
         $formName = 'modify_event';
         $title = $event->getVar('event_title', 'e');
         $cat = $event->getVar('cat_id');
         $desc = $event->getVar('event_desc', 'e');
         $nbMember = $event->getVar('event_nbmember', 'e');
         $contact = $event->getVar('event_contact', 'e');
         $url = $event->getVar('event_url', 'e');
         $email = $event->getVar('event_email', 'e');
         $address = $event->getVar('event_address', 'e');
         $startDateValue = xoops_getUserTimestamp($event->getVar('event_start'), $this->_extcalTime->_getUserTimeZone($GLOBALS['xoopsUser']));
         $endDateValue = xoops_getUserTimestamp($event->getVar('event_end'), $this->_extcalTime->_getUserTimeZone($GLOBALS['xoopsUser']));
         // Configuring recurring form
         $eventOptions = explode('|', $event->getVar('event_recur_rules'));
         $reccurMode = $eventOptions[0];
         array_shift($eventOptions);
         switch ($reccurMode) {
             case 'daily':
                 $reccurOptions['rrule_freq'] = 'daily';
                 $reccurOptions['rrule_daily_interval'] = $eventOptions[0];
                 break;
             case 'weekly':
                 $reccurOptions['rrule_freq'] = 'weekly';
                 $reccurOptions['rrule_weekly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_weekly_bydays'] = $eventOptions;
                 break;
             case 'monthly':
                 $reccurOptions['rrule_freq'] = 'monthly';
                 $reccurOptions['rrule_monthly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_bymonthday'] = $eventOptions;
                 break;
             case 'yearly':
                 $reccurOptions['rrule_freq'] = 'yearly';
                 $reccurOptions['rrule_yearly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_byday'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_bymonths'] = $eventOptions;
                 break;
         }
         $files = $fileHandler->objectToArray($fileHandler->getEventFiles($data['event_id']));
         $fileHandler->formatFilesSize($files);
     } elseif ($mode == 'preview') {
         $formTitle = _MD_EXTCAL_SUBMIT_EVENT;
         $formName = 'submit_event';
         $title = $data['event_title'];
         $cat = $data['cat_id'];
         $desc = $data['event_desc'];
         $nbMember = $data['event_nbmember'];
         $contact = $data['event_contact'];
         $url = $data['event_url'];
         $email = $data['event_email'];
         $address = $data['event_address'];
         $startDateValue = $data['event_start'];
         $endDateValue = $data['event_end'];
         $eventEndOk = $data['have_end'];
         // Configuring recurring form
         $eventOptions = explode('|', $event['event_recur_rules']);
         $reccurMode = $eventOptions[0];
         array_shift($eventOptions);
         switch ($reccurMode) {
             case 'daily':
                 $reccurOptions['rrule_freq'] = 'daily';
                 $reccurOptions['rrule_daily_interval'] = $eventOptions[0];
                 break;
             case 'weekly':
                 $reccurOptions['rrule_freq'] = 'weekly';
                 $reccurOptions['rrule_weekly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_weekly_bydays'] = $eventOptions;
                 break;
             case 'monthly':
                 $reccurOptions['rrule_freq'] = 'monthly';
                 $reccurOptions['rrule_monthly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_bymonthday'] = $eventOptions;
                 break;
             case 'yearly':
                 $reccurOptions['rrule_freq'] = 'yearly';
                 $reccurOptions['rrule_yearly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_byday'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_bymonths'] = $eventOptions;
                 break;
         }
         $files = $fileHandler->objectToArray($fileHandler->getEventFiles($data['event_id']));
         $fileHandler->formatFilesSize($files);
     } else {
         $formTitle = _MD_EXTCAL_SUBMIT_EVENT;
         $formName = 'submit_event';
         $title = '';
         $cat = '';
         $desc = '';
         $nbMember = 0;
         $contact = '';
         $url = '';
         $email = '';
         $address = '';
         $startDateValue = 0;
         $endDateValue = 0;
         $eventEndOk = 0;
         $files = array();
     }
     // Create XoopsForm Object
     $form = new ExtcalThemeForm($formTitle, 'event_form', $action, 'post', true);
     // Add this extra to allow file upload
     $form->setExtra('enctype="multipart/form-data"');
     // Category select
     $catSelect = new XoopsFormSelect(_MD_EXTCAL_CATEGORY, 'cat_id', $cat);
     foreach ($cats as $cat) {
         $catSelect->addOption($cat->getVar('cat_id'), $cat->getVar('cat_name'));
     }
     $form->addElement($catSelect, true);
     // Title
     $form->addElement(new XoopsFormText(_MD_EXTCAL_TITLE, 'event_title', 30, 255, $title), true);
     // Start and end
     new ExtcalFormDateTime($form, $startDateValue, $endDateValue);
     // Description
     $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_DESCRIPTION, 'event_desc', $desc, 10), false);
     // Max registered member for this event
     $nbMemberElement = new XoopsFormText(_MD_EXTCAL_NBMEMBER, 'event_nbmember', 4, 4, $nbMember);
     $nbMemberElement->setDescription(_MD_EXTCAL_NBMEMBER_DESC);
     $form->addElement($nbMemberElement, false);
     // Contact
     $form->addElement(new XoopsFormText(_MD_EXTCAL_CONTACT, 'event_contact', 30, 255, $contact), false);
     // Url
     $form->addElement(new XoopsFormText(_MD_EXTCAL_URL, 'event_url', 30, 255, $url), false);
     // Email
     $form->addElement(new XoopsFormText(_MD_EXTCAL_EMAIL, 'event_email', 30, 255, $email), false);
     // Address
     $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_ADDRESS, 'event_address', $address), false);
     // Recurence form
     $form->addElement(new ExtcalFormRecurRules($reccurOptions));
     // File attachement
     $fileElmtTray = new XoopsFormElementTray(_MD_EXTCAL_FILE_ATTACHEMENT, "<br />");
     // If they are attached file to this event
     if (count($files) > 0) {
         $eventFiles = new ExtcalFormFileCheckBox('', 'filetokeep');
         foreach ($files as $file) {
             $name = $file['file_nicename'] . " (<i>" . $file['file_mimetype'] . "</i>) " . $file['formated_file_size'];
             $eventFiles->addOption($file['file_id'], $name);
         }
         $fileElmtTray->addElement($eventFiles);
     }
     $fileElmtTray->addElement(new XoopsFormFile(_MD_EXTCAL_FILE_ATTACHEMENT, 'event_file', 3145728));
     $form->addElement($fileElmtTray);
     if (isset($data['event_id'])) {
         $form->addElement(new XoopsFormHidden('event_id', $data['event_id']), false);
     }
     $buttonElmtTray = new XoopsFormElementTray('', "&nbsp;");
     $buttonElmtTray->addElement(new XoopsFormButton("", "form_submit", _SEND, "submit"), false);
     if ($siteSide == 'user') {
         $buttonElmtTray->addElement(new XoopsFormButton("", "form_preview", _MD_EXTCAL_PREVIEW, "submit"), false);
     }
     $form->addElement($buttonElmtTray);
     return $form;
 }
コード例 #25
0
ファイル: xml.php プロジェクト: nouphet/rata
        redirect_header(XOOPS_URL . '/modules/' . $mydirname . '/', 3, _MD_D3PIPES_ERR_INVALIDPIPEID);
        exit;
    }
    // fetch entries
    $entries = d3pipes_common_fetch_entries($mydirname, $pipe4assign, $max_entries, $errors, $xoopsModuleConfig);
    // check lastfetch_time
    if (empty($pipe4assign['lastfetch_time'])) {
        $lastfetch_time = 0;
        foreach ($entries as $entry) {
            $lastfetch_time = max(@$entry['pipe']['lastfetch_time'], $lastfetch_time);
        }
        $pipe4assign['lastfetch_time'] = empty($lastfetch_time) ? time() : $lastfetch_time;
    }
}
// get lastmodified of all over of entries
$entries_lastmodified = 0;
foreach ($entries as $entry) {
    $entries_lastmodified = max($entries_lastmodified, $entry['pubtime']);
}
// Utf8from object
$utf8from_obj =& d3pipes_common_get_joint_object_default($mydirname, 'utf8from', $xoopsModuleConfig['internal_encoding']);
// assign
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
$xoopsTpl = new D3Tpl();
$xoopsTpl->assign(array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'xoops_config' => $xoopsConfig, 'xoops_config_utf8' => array_map('d3pipes_common_filter_ietoutf8', $xoopsConfig), 'mod_config' => @$xoopsModuleConfig, 'xoops_breadcrumbs' => @$xoops_breadcrumbs, 'xoops_pagetitle' => @$pagetitle4assign, 'errors' => $errors, 'pipe' => $utf8from_obj->execute($pipe4assign), 'entries' => $utf8from_obj->execute($entries), 'entries_lastmodified' => $entries_lastmodified, 'timezone_offset' => xoops_getUserTimestamp(0), 'style' => $style, 'link_prefer' => $link_prefer, 'xoops_module_header' => d3pipes_main_get_link2maincss($mydirname) . "\n" . $xoopsTpl->get_template_vars("xoops_module_header")));
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
header('Content-Type:text/xml; charset=utf-8');
$xoopsTpl->display('db:' . $mydirname . '_independent_' . $style . '.html');
exit;
コード例 #26
0
ファイル: functions.php プロジェクト: nunoluciano/uxcl
function formatTimestamp($time, $format = 'l', $timeoffset = '')
{
    $usertimestamp = xoops_getUserTimestamp($time, $timeoffset);
    return _formatTimeStamp($usertimestamp, $format);
}
コード例 #27
0
ファイル: wfsarticle.php プロジェクト: severnaya99/Sg-2010
 function editform()
 {
     global $xoopsModule, $HTTP_SERVER_VARS, $HTTP_POST_VARS, $groupid, $myts, $xoopsConfig, $xoopsUser, $xoopsDB, $textareaname, $wfsConfig;
     include XOOPS_ROOT_PATH . "/include/xoopscodes.php";
     $textareaname = '';
     //$maintext = '';
     echo "<table width='100%' border='0' cellspacing='0' cellpadding='1'>";
     echo "<table><tr><td><form action='index.php' method='post' name='coolsus'>";
     echo "<div><b>" . _AM_GROUPPROMPT . "</b><br />";
     if (isset($this->groupid)) {
         listGroups($this->groupid);
     } else {
         listGroups();
     }
     echo "<br />";
     echo "</div><br />";
     echo "<div><b>" . _WFS_CATEGORY . "</b><br>";
     $xt = new WfsCategory();
     if (isset($this->categoryid)) {
         $xt->makeSelBox(0, $this->categoryid, "categoryid");
     } else {
         $xt->makeSelBox(0, 0, "categoryid");
     }
     echo "</div><br />";
     echo "<div><b>" . _AM_ARTICLEWEIGHT . "</b><br />";
     echo "<input type='text' name='weight' id='weight' value='";
     if (isset($this->weight)) {
         echo $this->weight("F");
     } else {
         $this->weight = 0;
         echo $this->weight("F");
     }
     echo "' size='5' /></div><br>";
     echo "<div>" . _WFS_CAUTH . "<br></div>";
     echo "<div><select name='changeuser'>";
     echo "<option value='-1'>------</option>";
     $result = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " ORDER BY uname");
     while (list($uid, $uname) = $xoopsDB->fetchRow($result)) {
         if ($uid == $this->uid) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $uid . "' {$opt_selected}>" . $uname . "</option>";
     }
     echo "</select></div><br />";
     echo "<div><b>" . _WFS_TITLE . "</b><br />";
     echo "<input type='text' name='title' id='title' value='";
     if (isset($this->title)) {
         if ($this->titleFlag) {
             echo $this->title("F");
         } else {
             echo $this->title("E");
         }
     }
     echo "' size='50' /></div><br />";
     //HTML Page Seclection//
     echo "<div><b>" . _WFS_HTMLPAGE . "</b></div>";
     //echo " <b>HTML Path: </b>".$htmlpath."<br /><br /></div>";
     $html_array = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath']);
     echo "<div><select size='1' name='htmlpage'>";
     echo "<option value=' '>------</option>";
     foreach ($html_array as $htmlpage) {
         if ($htmlpage == $this->htmlpage()) {
             $opt_selected = "selected='selected'";
         } else {
             $opt_selected = "";
         }
         echo "<option value='" . $htmlpage . "' {$opt_selected}>" . $htmlpage . "</option>";
     }
     echo "</select>";
     $htmlpath = XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath'];
     echo " <b>HTML Path: </b>" . $htmlpath . "<br /><br /></div>";
     //echo "</div><br />";
     echo "<div><b>" . _WFS_MAINTEXT . "</b></div>";
     if (isset($this->maintext)) {
         if ($this->maintextFlag) {
             $GLOBALS['maintext'] = $this->maintext("F");
         } else {
             $GLOBALS['maintext'] = $this->maintext("E");
         }
     }
     if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) {
         $wfsConfig['wysiwygeditor'] = '0';
     }
     if ($wfsConfig['wysiwygeditor'] == '1') {
         html_editor('maintext');
         $smiliepath = $wfsConfig['smiliepath'];
         $smilie_array = XoopsLists::getimgListAsArray(XOOPS_ROOT_PATH . "/" . $smiliepath);
         echo "<br /><div style='text-align: left;'><b>" . _AM_SMILIE . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<div><script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton() {\n\t\t\t   \tdocument.all." . $textareaname . "_mysmile.src = '" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/' + document.all." . $textareaname . "_smiley.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_smiley' onchange='showbutton();'>";
         foreach ($smilie_array as $file) {
             echo "<option value='" . $file . "' {$opt_selected}>" . $file . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mysmile' src='" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/{$file}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mysmile.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton();\n\t\t</script>";
         //Start of article images
         $graphpath = $wfsConfig['graphicspath'];
         $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $graphpath);
         echo "<br><div style='text-align: left;'><b>" . _AM_GRAPHIC . "</b><br />";
         echo "<table><tr><td align='top' valign='left'>";
         echo "<script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton2() {\n\t\t\t\tdocument.all." . $textareaname . "_mygraph.src = '" . $xoopsConfig['xoops_url'] . "/{$graphpath}/' + document.all." . $textareaname . "_graph.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>";
         echo "<select name='" . $textareaname . "_graph' onchange='showbutton2();'>";
         foreach ($graph_array as $file2) {
             echo "<option value='" . $file2 . "' {$opt_selected}>" . $file2 . "</option>";
         }
         echo "</select></td><td align='top' valign='left'>";
         echo "<img name='" . $textareaname . "_mygraph' src='" . $xoopsConfig['xoops_url'] . "/{$graphpath}/{$file2}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mygraph.src);\" />";
         echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton2();\n\t\t</script>";
     } else {
         xoopsCodeTarea("maintext", 60, 15);
         xoopsSmilies("maintext");
     }
     echo "<div><b>" . _WFS_SUMMARY . "</b></div>";
     echo "<div><textarea id='summary' name='summary' wrap='virtual' cols='60' rows='5'>";
     if (isset($this->summary)) {
         if ($this->summaryFlag) {
             echo $this->summary("F");
         } else {
             echo $this->summary("E");
         }
     }
     echo "</textarea></div>";
     echo "<div class = 'bg3'><h4>" . _WFS_ARTICLELINK . "</h4></div>";
     echo "<div><b>" . _WFS_LINKURL . "</b><br />";
     echo "<input type='text' name='url' id='url' value='";
     if (isset($this->url)) {
         echo $this->url("F");
     }
     echo "' size='70' /></div><br />";
     echo "<div><b>" . _WFS_LINKURLNAME . "</b><br />";
     echo "<input type='text' name='urlname' id='urlname' value='";
     if (isset($this->urlname)) {
         echo $this->urlname("F");
     }
     echo "' size='50' /></div><br>";
     echo "<div class = 'bg3'><h4>" . _WFS_ATTACHEDFILES . "</h4></div>";
     echo "<div>" . _WFS_ATTACHEDFILESTXT . "</div><br />";
     if (empty($this->articleid)) {
         echo _WFS_AFTERREGED . "<br />";
     } elseif ($num = $this->getFilesCount()) {
         echo "<table border='1' style='border-collapse: collapse' bordercolor='#ffffff' width='100%' >";
         echo "<tr class='bg3'><td align='center'>" . _AM_FILEID . "</td><td align='center'>" . _AM_FILEICON . "</td><td align='center'>" . _AM_FILESTORE . "</td><td align='center'>" . _AM_REALFILENAME . "</td><td align='center'>" . _AM_USERFILENAME . "</td><td align='center' class='nw'>" . _AM_FILEMIMETYPE . "</td><td align='center' class='nw'>" . _AM_FILESIZE . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
         foreach ($this->files as $attached) {
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $attached->getFileRealName())) {
                 $filename = $attached->getFileRealName();
             } else {
                 $filename = "File Error!";
             }
             $fileid = $attached->getFileid();
             $mimetype = new mimetype();
             $icon = get_icon(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $iconshow = "<img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align='middle'>";
             if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)) {
                 $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename));
             } else {
                 $size = '0';
             }
             $filerealname = $attached->downloadname;
             $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename);
             $counter = $attached->getCounter();
             $linkedname = $attached->getFileShowName();
             //$linkedname = $attached->getLinkedName(XOOPS_URL."/modules/".$xoopsModule->dirname()."/download.php?fileid=");
             $editlink = "<a href='index.php?op=fileedit&amp;fileid=" . $fileid . "'>" . _AM_EDIT . "</a>";
             $dellink = "<a href='index.php?op=delfile&amp;fileid=" . $fileid . "'>" . _AM_DELETE . "</a>";
             echo "<tr><td align='center'><b>" . $fileid . "</b>";
             echo "</td><td align='center'>" . $iconshow . "";
             echo "</td><td align='center'>" . $filename . "";
             echo "</td><td align='center'>" . $filerealname . "";
             echo "</td><td align='center'>" . $linkedname . "";
             echo "</td><td align='center'>" . $mimeshow . "";
             echo "</td><td align='center'>" . $size . "";
             //echo "</td><td align='center' class='nw'>".$counter."";
             echo "</td><td align='center'>" . $editlink . " " . $dellink . "";
             echo "</td></tr>";
         }
         echo "</table>";
     } else {
         echo "<div align='left'>" . _WFS_NOFILE . "</div>";
     }
     echo "</div><br />";
     echo "<div class = 'bg3'><h4>" . _WFS_MISCSETTINGS . "</h4></div>";
     echo "<input type='checkbox' name='autodate' value='1'";
     if (isset($autodate) && $autodate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (!empty($this->articleid)) {
         $isedit = 1;
     }
     if (isset($isedit) && $isedit == 1 && $this->published > $time) {
         echo "<b>" . _AM_CHANGEDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETTIME, formatTimestamp($this->published));
         $published = xoops_getUserTimestamp($this->published);
         echo "<br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='automonth'>";
     if (isset($automonth)) {
         $automonth = intval($automonth);
     } elseif (isset($this->published)) {
         $automonth = date('m', $this->published);
     } else {
         $automonth = date('m');
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $automonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoday'>";
     if (isset($autoday)) {
         $autoday = intval($autoday);
     } elseif (isset($published)) {
         $autoday = date('d', $this->published);
     } else {
         $autoday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoyear'>";
     if (isset($autoyear)) {
         $autoyear = intval($autoyear);
     } elseif (isset($this->published)) {
         $autoyear = date('Y', $this->published);
     } else {
         $autoyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autohour'>";
     if (isset($autohour)) {
         $autohour = intval($autohour);
     } elseif (isset($this->publishedshed)) {
         $autohour = date('H', $this->published);
     } else {
         $autohour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autohour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='automin'>";
     if (isset($automin)) {
         $automin = intval($automin);
     } elseif (isset($published)) {
         $automin = date('i', $published);
     } else {
         $automin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $automin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select></br />";
     echo "<br /><input type='checkbox' name='autoexpdate' value='1'";
     if (isset($autoexpdate) && $autoexpdate == 1) {
         echo " checked='checked'";
     }
     echo "> ";
     $time = time();
     if (isset($isedit) && $isedit == 1 && $this->expired > 0) {
         echo "<b>" . _AM_CHANGEEXPDATETIME . "</b><br /><br />";
         printf(_AM_NOWSETEXPTIME, formatTimestamp($this->expired));
         echo "<br /><br />";
         $expired = xoops_getUserTimestamp($this->expired);
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
         echo "<input type='hidden' name='isedit' value='1' />";
     } else {
         echo "<b>" . _AM_SETEXPDATETIME . "</b><br /><br />";
         printf(_AM_CURRENTTIME, formatTimestamp($time));
         echo "<br />";
     }
     echo "<br /> &nbsp; " . _AM_MONTHC . " <select name='autoexpmonth'>";
     if (isset($autoexpmonth)) {
         $autoexpmonth = intval($autoexpmonth);
     } elseif (isset($expired)) {
         $autoexpmonth = date('m', $expired);
     } else {
         $autoexpmonth = date('m');
         $autoexpmonth = $autoexpmonth + 1;
     }
     for ($xmonth = 1; $xmonth < 13; $xmonth++) {
         if ($xmonth == $autoexpmonth) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_DAYC . " <select name='autoexpday'>";
     if (isset($autoexpday)) {
         $autoexpday = intval($autoexpday);
     } elseif (isset($expired)) {
         $autoexpday = date('d', $expired);
     } else {
         $autoexpday = date('d');
     }
     for ($xday = 1; $xday < 32; $xday++) {
         if ($xday == $autoexpday) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xday}' {$sel}>{$xday}</option>";
     }
     echo "</select>&nbsp;";
     echo _AM_YEARC . " <select name='autoexpyear'>";
     if (isset($autoexpyear)) {
         $autoyear = intval($autoexpyear);
     } elseif (isset($expired)) {
         $autoexpyear = date('Y', $expired);
     } else {
         $autoexpyear = date('Y');
     }
     $cyear = date('Y');
     for ($xyear = $autoexpyear - 8; $xyear < $cyear + 2; $xyear++) {
         if ($xyear == $autoexpyear) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xyear}' {$sel}>{$xyear}</option>";
     }
     echo "</select>";
     echo "&nbsp;" . _AM_TIMEC . " <select name='autoexphour'>";
     if (isset($autoexphour)) {
         $autoexphour = intval($autoexphour);
     } elseif (isset($expired)) {
         $autoexphour = date('H', $expired);
     } else {
         $autoexphour = date('H');
     }
     for ($xhour = 0; $xhour < 24; $xhour++) {
         if ($xhour == $autoexphour) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         echo "<option value='{$xhour}' {$sel}>{$xhour}</option>";
     }
     echo "</select>";
     echo " : <select name='autoexpmin'>";
     if (isset($autoexpmin)) {
         $autoexpmin = intval($autoexpmin);
     } elseif (isset($expired)) {
         $autoexpmin = date('i', $expired);
     } else {
         $autoexpmin = date('i');
     }
     for ($xmin = 0; $xmin < 61; $xmin++) {
         if ($xmin == $autoexpmin) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $xxmin = $xmin;
         if ($xxmin < 10) {
             $xxmin = "0{$xmin}";
         }
         echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>";
     }
     echo "</select><br /><br />";
     if (isset($this->published) && $this->published == 0 && isset($this->type) && $this->type == "user") {
         echo "<div><input type='checkbox' name='approved' value='1' checked='checked'>&nbsp;<b>" . _AM_APPROVE . "</b></div><br />";
     }
     echo "<br /><div><input type='checkbox' name='nosmiley' value='1'";
     if (isset($this->nosmiley) && $this->nosmiley == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISAMILEY . "</b></div>";
     echo "<div><input type='checkbox' name='nohtml' value='1'";
     if (isset($this->nohtml) && $this->nohtml == 1) {
         echo " checked='checked'";
     }
     echo " /> <b>" . _WFS_DISHTML . "</b><br />";
     echo "</div><br />";
     if (isset($isedit) && $isedit == 1) {
         echo "<input type='checkbox' name='movetotop' value='1'";
         if (isset($movetotop) && $movetotop == 1) {
             echo " checked='checked'";
         }
         echo " />&nbsp;<b>" . _AM_MOVETOTOP . "</b><br />";
     }
     echo "<br /><div><input type='checkbox' name='justhtml' value='2'";
     if (isset($this->htmlpage) && $this->ishtml == '2') {
         echo " checked='checked'";
     }
     echo " />" . _AM_JUSTHTML . "<br /></div>";
     echo "<div><input type='checkbox' name='noshowart' value='1'";
     if (isset($this->noshowart) && $this->noshowart == 1) {
         echo " checked='checked'";
     }
     echo " /> " . _AM_NOSHOART . "<br />";
     echo "</div><br />";
     echo "<input type='checkbox' name='offline' value='1'";
     if (isset($this->offline) && $this->offline == 1) {
         echo " checked='checked'";
     }
     echo " />&nbsp;" . _AM_OFFLINE . "<br />";
     echo "<br />";
     if (!empty($this->articleid)) {
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />\n";
     }
     if (!empty($HTTP_POST_VARS['referer'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_POST_VARS['referer'] . "' />\n";
     } elseif (!empty($HTTP_SERVER_VARS['HTTP_REFERER'])) {
         echo "<input type='hidden' name='referer' value='" . $HTTP_SERVER_VARS['HTTP_REFERER'] . "' />\n";
     }
     echo "<input type='submit' name='op' class='formButton' value='Preview' />&nbsp;<input type='submit' name='op' class='formButton' value='Save' />&nbsp;<input type='submit' name='op' class='formButton' value='Clean' />";
     echo "</form>";
     echo "</td></tr></table>";
     if (!empty($this->articleid)) {
         echo "<hr />";
         $upload = new UploadFile();
         echo $upload->formStart("index.php?op=fileup");
         echo "<h4>" . _WFS_FILEUPLOAD . "</h4>\n";
         echo "" . _WFS_ATTACHFILEACCESS . "<br />";
         echo "<br /><b>" . _WFS_ATTACHFILE . "</b><br />";
         echo $upload->formMax();
         echo $upload->formField();
         echo "<br /><br /><b>" . _WFS_FILESHOWNAME . "</b><br />";
         echo "<input type='text' name='fileshowname' id='fileshowname' value='";
         if (isset($this->fileshowname)) {
             echo $this->fileshowname;
         }
         echo "' size='70' maxlength='80' /><br />";
         echo "<br /><b>" . _WFS_FILEDESCRIPT . "</b><br />";
         echo "<textarea name='textfiledescript' cols='50' rows='5'></textarea><br />";
         echo "<br /><b>" . _WFS_FILETEXT . "</b><br />";
         echo "<textarea name='textfilesearch' cols='50' rows='3'></textarea><br />";
         echo "<input type='hidden' name='groupid' value='" . $this->groupip . "' />";
         echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />";
         echo "<input type='hidden' name='groupid' value= '" . $this->groupid . "' />";
         echo $upload->formSubmit(_WFS_UPLOAD);
         echo $upload->formEnd();
     }
 }
コード例 #28
0
 function renderBlock($force_update = false, $maxlen = 255)
 {
     if ($force_update || $this->_hl->cacheExpired()) {
         if (!$this->updateCache()) {
             return false;
         }
     }
     $dtfmt_short = empty($this->config["dtfmt_short"]) ? '' : $this->config["dtfmt_short"];
     $parsed_cache = $this->_hl->getVar('headline_xml');
     if (empty($parsed_cache)) {
         return false;
     }
     $this->_tpl->clear_all_assign();
     $this->_tpl->assign('xoops_url', XOOPS_URL);
     $this->_tpl->assign_by_ref('channel', $parsed_cache['channel']);
     if ($this->_hl->getVar('headline_blockimg') == 1) {
         $this->_tpl->assign_by_ref('image', $parsed_cache['image']);
     }
     $items = $parsed_cache['items'];
     $count = count($items);
     $max = $count > $this->_hl->getVar('headline_blockmax') ? $this->_hl->getVar('headline_blockmax') : $count;
     $i = 0;
     foreach ($items as $item) {
         if (strlen($item['title']) >= $maxlen) {
             if (!XOOPS_USE_MULTIBYTES) {
                 $item['title'] = substr($item['title'], 0, $maxlen - 1) . "...";
             } else {
                 if (function_exists('mb_strcut')) {
                     $item['title'] = mb_strcut($item['title'], 0, $maxlen - 1) . "...";
                 }
             }
         }
         $item['pubdate_utz'] = xoops_getUserTimestamp($item['pubdate']);
         $item['date_short'] = date($dtfmt_short, xoops_getUserTimestamp($item['pubdate']));
         $item['date'] = formatTimestamp($item['pubdate'], 'm');
         $this->_tpl->append('items', $item);
         if (++$i >= $max) {
             break;
         }
     }
     $this->_tpl->assign(array('mod_url' => XOOPS_URL . '/modules/' . $this->_mydirname, 'site_name' => $this->_hl->getVar('headline_name'), 'site_url' => $this->_hl->getVar('headline_url'), 'site_id' => $this->_hl->getVar('headline_id'), 'dtfmt_long' => _DATESTRING, 'dtfmt_short' => $dtfmt_short));
     $this->_block = $this->_tpl->fetch("db:xhld{$this->_mydirnumber}_block.html");
     return true;
 }
コード例 #29
0
ファイル: jsbackend.php プロジェクト: nouphet/rata
// fetch link2clipping
$link2clipping = empty($_GET['link2clipping']) ? false : true;
// fetch keep_pipeinfo
$keep_pipeinfo = empty($_GET['keep_pipeinfo']) ? false : true;
// fetch pipe_row
$pipe_ids = empty($_GET['pipe_ids']) ? array(0) : explode(',', preg_replace('/[^0-9,:]/', '', $_GET['pipe_ids']));
if (sizeof($pipe_ids) == 1) {
    // single pipe
    $pipe4assign = d3pipes_common_get_pipe4assign($mydirname, intval($pipe_ids[0]));
    if (empty($pipe4assign)) {
        $entries = array();
        $errors = array('Invalid pipe_id');
    } else {
        $entries = d3pipes_common_fetch_entries($mydirname, $pipe4assign, $max_entries, $errors, $xoopsModuleConfig);
    }
    $pipes_entries = array();
} else {
    // Union object
    $union_obj =& d3pipes_common_get_joint_object($mydirname, 'union', $union_class, implode(',', $pipe_ids) . '||' . ($keep_pipeinfo ? 1 : 0));
    $union_obj->setModConfigs($xoopsModuleConfig);
    $entries = $union_obj->execute(array(), $max_entries);
    $pipes_entries = method_exists($union_obj, 'getPipesEntries') ? $union_obj->getPipesEntries() : array();
    $errors = $union_obj->getErrors();
}
// assign
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
$xoopsTpl = new D3Tpl();
$xoopsTpl->assign(array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'xoops_config' => $xoopsConfig, 'mod_config' => @$xoopsModuleConfig, 'xoops_breadcrumbs' => @$xoops_breadcrumbs, 'xoops_pagetitle' => @$pagetitle4assign, 'errors' => $errors, 'entries' => $entries, 'pipes_entries' => $pipes_entries, 'link2clipping' => $link2clipping, 'keep_pipeinfo' => $keep_pipeinfo, 'timezone_offset' => xoops_getUserTimestamp(0), 'xoops_module_header' => d3pipes_main_get_link2maincss($mydirname) . "\n" . $xoopsTpl->get_template_vars("xoops_module_header")));
$html = addslashes(strtr($xoopsTpl->fetch('db:' . $mydirname . '_main_jsbackend.html'), "\n\r", "  "));
echo "d3pipes_insert_html('{$mydirname}_async_block_{$unique_id}','{$html}');";
exit;
コード例 #30
0
ファイル: uploads.php プロジェクト: geek01/tadgallery
function upload_muti_file()
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $type_to_mime;
    krsort($_POST['csn_menu']);
    foreach ($_POST['csn_menu'] as $cate_sn) {
        if (empty($cate_sn)) {
            continue;
        } else {
            $csn = $cate_sn;
            break;
        }
    }
    if (!empty($_POST['new_csn'])) {
        $csn = add_tad_gallery_cate($csn, $_POST['new_csn'], $_POST['sort']);
    }
    $uid = $xoopsUser->getVar('uid');
    if (!empty($_POST['csn'])) {
        $_SESSION['tad_gallery_csn'] = $_POST['csn'];
    }
    //取消上傳時間限制
    set_time_limit(0);
    //設置上傳大小
    ini_set('memory_limit', '100M');
    $files = array();
    foreach ($_FILES['upfile'] as $k => $l) {
        foreach ($l as $i => $v) {
            if (empty($v)) {
                continue;
            }
            if (!array_key_exists($i, $files)) {
                $files[$i] = array();
            }
            $files[$i][$k] = $v;
        }
    }
    $sort = 0;
    foreach ($files as $i => $file) {
        if (empty($file['tmp_name'])) {
            continue;
        }
        $orginal_file_name = strtolower(basename($file["name"]));
        //get lowercase filename
        $file_ending = substr(strtolower($orginal_file_name), -3);
        //file extension
        $pic = getimagesize($file['tmp_name']);
        $width = $pic[0];
        $height = $pic[1];
        //讀取exif資訊
        if (function_exists('exif_read_data')) {
            $result = exif_read_data($file['tmp_name'], 0, true);
            $creat_date = $result['IFD0']['DateTime'];
        } else {
            $creat_date = date("Y-m-d");
        }
        $dir = (empty($creat_date) or substr($creat_date, 0, 1) != "2") ? date("Y_m_d") : str_replace(":", "_", substr($result['IFD0']['DateTime'], 0, 10));
        $exif = mk_exif($result);
        $now = date("Y-m-d H:i:s", xoops_getUserTimestamp(time()));
        $sql = "insert into " . $xoopsDB->prefix("tad_gallery") . "\n        (`csn`, `title`, `description`, `filename`, `size`, `type`, `width`, `height`, `dir`, `uid`, `post_date`, `counter`, `exif`, `tag`, `good`, `photo_sort`)\n        values('{$csn}','','','{$file['name']}','{$file['size']}','{$file['type']}','{$width}','{$height}','{$dir}','{$uid}','{$now}','0','{$exif}','','0',{$sort})";
        $sort++;
        $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 10, mysql_error() . $sql);
        //取得最後新增資料的流水編號
        $sn = $xoopsDB->getInsertId();
        mk_dir(_TADGAL_UP_FILE_DIR . $dir);
        mk_dir(_TADGAL_UP_FILE_DIR . "small/" . $dir);
        mk_dir(_TADGAL_UP_FILE_DIR . "medium/" . $dir);
        $filename = photo_name($sn, "source", 1);
        if (move_uploaded_file($file['tmp_name'], $filename)) {
            $m_thumb_name = photo_name($sn, "m", 1);
            $s_thumb_name = photo_name($sn, "s", 1);
            if (!empty($xoopsModuleConfig['thumbnail_b_width']) and ($width > $xoopsModuleConfig['thumbnail_b_width'] or $height > $xoopsModuleConfig['thumbnail_b_width'])) {
                thumbnail($filename, $filename, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_b_width']);
            }
            if ($width > $xoopsModuleConfig['thumbnail_m_width'] or $height > $xoopsModuleConfig['thumbnail_m_width']) {
                thumbnail($filename, $m_thumb_name, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_m_width']);
            }
            if ($width > $xoopsModuleConfig['thumbnail_s_width'] or $height > $xoopsModuleConfig['thumbnail_s_width']) {
                thumbnail($filename, $s_thumb_name, $type_to_mime[$file_ending], $xoopsModuleConfig['thumbnail_s_width']);
            }
        }
    }
    return $csn;
}