コード例 #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
ファイル: main.php プロジェクト: laiello/bitcero-modules
function cache_view_files()
{
    global $xoopsSecurity;
    RMTemplate::get()->set_help('http://redmexico.com.mx/docs/xoops-booster/archivos-del-cache');
    RMTemplate::get()->assign('xoops_pagetitle', __('Booster Zone', 'booster'));
    RMTemplate::get()->add_style('cache.css', 'rmcommon', 'plugins/booster');
    RMFunctions::create_toolbar();
    xoops_cp_header();
    $plugin = RMFunctions::get()->load_plugin('booster');
    // Get files
    $items = XoopsLists::getFileListAsArray(XOOPS_CACHE_PATH . '/booster/files');
    $files = array();
    $count_expired = 0;
    foreach ($items as $file) {
        $tmp = explode('.', $file);
        if ($tmp[1] != 'meta') {
            continue;
        }
        $content = json_decode(file_get_contents(XOOPS_CACHE_PATH . '/booster/files/' . $file), true);
        $files[] = array('id' => $tmp[0], 'url' => $content['uri'], 'date' => formatTimestamp($content['created'], 'l'), 'time' => $content['created'], 'lang' => $content['language'], 'size' => filesize(XOOPS_CACHE_PATH . '/booster/files/' . $tmp[0] . '.html'));
        $count_expired = time() - $content['created'] >= $plugin->get_config('time') ? $count_expired + 1 : $count_expired;
    }
    include RMTemplate::get()->get_template('cache_files.php', 'plugin', 'rmcommon', 'booster');
    xoops_cp_footer();
}
コード例 #3
0
ファイル: autotasks.php プロジェクト: nao-pon/impresscms
	/**
	 * Get the last time a task was run and format it for display
	 * @return	string
	 */
	public function getLastRunTimeForDisplay() {
		if ($this->getVar('sat_lastruntime') < 1) {
			return _CO_ICMS_AUTOTASKS_NOTYETRUNNED;
		} else {
			return formatTimestamp($this->getVar('sat_lastruntime'));
		}
	}
コード例 #4
0
ファイル: Feed.php プロジェクト: trabisdementia/xuups
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct($this);
     $this->setTemplate(XMF_ROOT_PATH . '/templates/xmf_feed.html');
     $this->disableLogger();
     global $xoopsConfig;
     $this->title = $xoopsConfig['sitename'];
     $this->url = XOOPS_URL;
     $this->description = $xoopsConfig['slogan'];
     $this->language = _LANGCODE;
     $this->charset = _CHARSET;
     $this->pubdate = date(_DATESTRING, time());
     $this->lastbuild = formatTimestamp(time(), 'D, d M Y H:i:s');
     $this->webmaster = $xoopsConfig['adminmail'];
     $this->editor = $xoopsConfig['adminmail'];
     $this->generator = XOOPS_VERSION;
     $this->copyright = 'Copyright ' . formatTimestamp(time(), 'Y') . ' ' . $xoopsConfig['sitename'];
     $this->ttl = 60;
     $this->image_title = $this->title;
     $this->image_url = XOOPS_URL . '/images/logo.gif';
     $this->image_link = $this->url;
     $this->image_width = 200;
     $this->image_height = 50;
     //title link description pubdate guid category author
     $this->items = array();
 }
コード例 #5
0
ファイル: userinfo.php プロジェクト: nao-pon/impresscms
	/**
	 * Function to be triggered at the end of the core boot process
	 *
	 * @return	void
	 */
	function eventStartOutputInit() {
		global $xoopsTpl;
		if (is_object(icms::$user)) {
			foreach (icms::$user->vars as $key => $value) {
				$user[$key] = $value;
			}
			foreach ($user as $key => $value) {
				foreach ($user [$key] as $key1 => $value1) {
					if ($key1 == 'value') {
						if ($key == 'last_login') {
							$value1 = formatTimestamp(
								isset($_SESSION['xoopsUserLastLogin'])
										? $_SESSION['xoopsUserLastLogin']
										: time(),
								_DATESTRING
							);
						}
						$user [$key] = $value1;
					}
				}
			}
			$pm_handler = icms::handler('icms_data_privmessage');
			$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('read_msg', 0));
			$criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid')));
			$user['new_messages'] = $pm_handler->getCount($criteria);

			$xoopsTpl->assign('user', $user);
		}
	}
コード例 #6
0
ファイル: players.php プロジェクト: laiello/bitcero-modules
function showPlayers()
{
    global $xoopsModule, $mc, $adminTemplate, $tpl, $db;
    $gteam = TCFunctions::get('team');
    $team = new TCTeam($gteam);
    // Equipos
    $tpl->assign('team', $team->isNew() ? 0 : $team->id());
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name");
    $teams = array();
    while ($row = $db->fetchArray($result)) {
        $ct = new TCTeam();
        $ct->assignVars($row);
        $cat =& $ct->category(true);
        $teams[] = array('id' => $ct->id(), 'name' => $ct->name() . " (" . $cat->name() . ")");
    }
    // Entrenadores
    $coachs = array();
    if (!$team->isNew()) {
        foreach ($team->coachs(true) as $coach) {
            $coachs[] = array('id' => $coach->id(), 'name' => $coach->name(), 'image' => $coach->image());
        }
    }
    // Jugadores
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_players") . " WHERE team='" . $team->id() . "'");
    $players = array();
    while ($row = $db->fetchArray($result)) {
        $player = new TCPlayer();
        $player->assignVars($row);
        $players[] = array('id' => $player->id(), 'name' => $player->name(), 'image' => $player->image(), 'number' => $player->number(), 'age' => $player->age(), 'date' => formatTimestamp($player->date(), 'c'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Jugadores', 'admin_team'));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/coach_players.php", 'module', 'team');
    xoops_cp_footer();
}
コード例 #7
0
ファイル: assoc.php プロジェクト: nouphet/rata
 function listAction()
 {
     echo '<h3>' . _AD_OPENID_LANG_ASSOC . '</h3>';
     echo '<p>' . _AD_OPENID_LANG_ASSOC_DESC . '</p>';
     echo '<table border=1>';
     echo '<tr><th>' . _AD_OPENID_LANG_PATTERN . '</th><th>' . _AD_OPENID_LANG_ISSUED;
     echo '</th><th colspan="2"></th></tr>';
     $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
     if ($records =& $this->_handler->getObjects(30, $start)) {
         foreach ($records as $r) {
             $server_url = $r->get4Show('server_url');
             $expire = $r->get('issued') + $r->get('life') < time();
             $issued = formatTimestamp($r->get('issued'), 'm/d H:i');
             echo '<tr><td>';
             echo $server_url;
             echo '</td><td>';
             echo $expire ? '<font color="#808080">' . $issued . '</font>' : $issued;
             echo '</td><td>';
             echo '<a href="' . XOOPS_URL . '/modules/openid/admin/index.php?controller=filter&op=new&auth=1&pattern=' . $server_url . '">' . _AD_OPENID_LANG_ALLOW . '</a>';
             echo '</td><td>';
             echo '<a href="' . XOOPS_URL . '/modules/openid/admin/index.php?controller=filter&op=new&auth=0&pattern=' . $server_url . '">' . _AD_OPENID_LANG_DENY . '</a>';
             echo '</td></tr>';
         }
         echo '</table>';
         require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
         $pageNav = new XoopsPageNav($this->_handler->getCount(), 30, $start, 'start', 'controller=' . $this->_control);
         echo $pageNav->renderNav();
         echo '<p><a href="' . $this->_url . '&op=garbage">' . _AD_OPENID_LANG_CLEANUP . '</a></p>';
     } else {
         echo '</table>';
         echo '<p>' . $this->_handler->getError() . '</p>';
     }
 }
コード例 #8
0
function b_mysearch_last_search_show()
{
    include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php';
    $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch');
    $visiblekeywords = 0;
    $block = array();
    $visiblekeywords = mysearch_getmoduleoption('showindex');
    if ($visiblekeywords > 0) {
        $block['visiblekeywords'] = $visiblekeywords;
        $totalcount = $mysearch_handler->getCount();
        $start = 0;
        $critere = new Criteria('mysearchid', 0, '<>');
        $critere->setSort('datesearch');
        $critere->setLimit($visiblekeywords);
        $critere->setStart($start);
        $critere->setOrder('DESC');
        $tmpmysearch = new searches();
        $elements = $mysearch_handler->getObjects($critere);
        foreach ($elements as $oneelement) {
            $search = array();
            $search['keyword'] = $oneelement->getVar('keyword');
            $search['date'] = formatTimestamp(strtotime($oneelement->getVar('datesearch')));
            $search['uid'] = $oneelement->getVar('keyword');
            $search['uname'] = $tmpmysearch->uname($oneelement->getVar('uid'));
            $search['link'] = "<a href='" . XOOPS_URL . '/search.php?query=' . $oneelement->getVar('keyword') . "&action=results' target='_blank'>";
            $block['searches'][] = $search;
            unset($search);
        }
    }
    return $block;
}
コード例 #9
0
ファイル: wfs_new.php プロジェクト: severnaya99/Sg-2010
function b_wfs_new_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB->prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfs = array();
            $title = $myts->makeTboxData4Show($myrow["title"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if (strlen($myrow['title']) >= $options[2]) {
                    $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
                }
            }
            $wfs['title'] = $title;
            $wfs['id'] = $myrow['articleid'];
            if ($options[0] == "published") {
                $wfs['new'] = formatTimestamp($myrow['published'], "s");
            } elseif ($options[0] == "counter") {
                $wfs['new'] = $myrow['counter'];
            }
            $block['new'][] = $wfs;
        }
    }
    return $block;
}
コード例 #10
0
ファイル: mylinks_top.php プロジェクト: amjadtbssm/website
function b_mylinks_top_show($options)
{
    global $xoopsDB;
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status>0 ORDER BY " . $options[0] . " DESC", $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $link = array();
        $title = $myts->makeTboxData4Show($myrow["title"]);
        if (!XOOPS_USE_MULTIBYTES) {
            if (strlen($myrow['title']) >= $options[2]) {
                $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
            }
        }
        $link['id'] = $myrow['lid'];
        $link['cid'] = $myrow['cid'];
        $link['title'] = $title;
        if ($options[0] == "date") {
            $link['date'] = formatTimestamp($myrow['date'], 's');
        } elseif ($options[0] == "hits") {
            $link['hits'] = $myrow['hits'];
        }
        $block['links'][] = $link;
    }
    return $block;
}
コード例 #11
0
function b_mylinks_top_show($options)
{
    global $xoopsDB;
    $block = array();
    //ver2.5
    $modulename = basename(dirname(dirname(__FILE__)));
    $myts =& MyTextSanitizer::getInstance();
    $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status>0 ORDER BY " . $options[0] . " DESC", $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $link = array();
        $title = $myts->htmlSpecialChars($myrow['title']);
        //        if ( !XOOPS_USE_MULTIBYTES ) {
        if (mb_strlen($myrow['title']) >= $options[2]) {
            $title = $myts->htmlSpecialChars(mb_substr($myrow['title'], 0, $options[2] - 1)) . "...";
        }
        //        }
        $link['id'] = $myrow['lid'];
        $link['cid'] = $myrow['cid'];
        $link['title'] = $title;
        if ($options[0] == "date") {
            $link['date'] = formatTimestamp($myrow['date'], 's');
        } elseif ($options[0] == "hits") {
            $link['hits'] = $myrow['hits'];
        }
        $block['links'][] = $link;
    }
    if (!empty($block)) {
        // only show block if there's data to display
        $block['mylinks_weburl'] = XOOPS_URL . "/modules/{$modulename}";
    }
    return $block;
}
コード例 #12
0
 function tinyd_block_nav_base($mydirname, $mydirnumber)
 {
     // get my config
     $module_handler =& xoops_gethandler('module');
     $config_handler =& xoops_gethandler('config');
     $module =& $module_handler->getByDirname($mydirname);
     $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
     $navblock_target = empty($config['tc_navblock_target']) ? 1 : intval($config['tc_navblock_target']);
     if (empty($config['tc_modulesless_dir'])) {
         $block["mod_url"] = XOOPS_URL . "/modules/{$mydirname}";
         $tc_rewrite_dir = TC_REWRITE_DIR;
     } else {
         $block["mod_url"] = XOOPS_URL . '/' . $config['tc_modulesless_dir'];
         $tc_rewrite_dir = "";
     }
     $myts =& MyTextSanitizer::getInstance();
     $db =& Database::getInstance();
     $whr_submenu = $navblock_target == 2 ? "submenu=1" : "1";
     $result = $db->query("SELECT storyid,title,link,UNIX_TIMESTAMP(last_modified) FROM " . $db->prefix("tinycontent{$mydirnumber}") . " WHERE visible=1 AND {$whr_submenu} ORDER BY blockid");
     while (list($id, $title, $link, $last_modified) = $db->fetchRow($result)) {
         if (!empty($config['tc_force_mod_rewrite']) || $link == TC_WRAPTYPE_USEREWRITE) {
             $href = $tc_rewrite_dir . sprintf(TC_REWRITE_FILENAME_FMT, $id);
         } else {
             if ($link == TC_WRAPTYPE_CONTENTBASE) {
                 $href = "content/index.php?id={$id}";
             } else {
                 $href = "index.php?id={$id}";
             }
         }
         $block["links"][] = array("href" => $href, "id" => $id, "title" => $myts->makeTboxData4Show($title), "date" => formatTimestamp($last_modified), "last_modified" => $last_modified);
     }
     return $block;
 }
コード例 #13
0
ファイル: print.php プロジェクト: severnaya99/Sg-2010
function PrintPage($articleid)
{
    global $xoopsConfig, $xoopsDB, $xoopsModule, $wfsConfig;
    $story = new WfsArticle($articleid);
    $datetime = formatTimestamp($story->created(), $wfsConfig['timestamp']);
    echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
    echo "<html>\n<head>\n";
    echo "<title>" . $xoopsConfig['sitename'] . "</title>\n";
    echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n";
    echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "' />\n";
    echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "' />\n";
    echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n";
    echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n";
    echo "<body bgcolor='#ffffff' text='#000000'>\n            <table border='0'><tr><td align='center'>\n            <table border='0' width='650' cellpadding='0' cellspacing='1' bgcolor='#000000'><tr><td>\n            <table border='0' width='650' cellpadding='20' cellspacing='1' bgcolor='#ffffff'><tr><td align='center'>\n            <img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/logo.gif' border='0' alt='' /><br />\n            <h2>" . $story->title() . "</h2><hr />";
    if ($story->htmlpage) {
        $includepage = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/html/" . $story->htmlpage();
        $maintext = '';
        $maintext = (include $includepage);
        $maintext = $maintext;
    } else {
        $maintext = $story->maintext();
        //if (!empty($maintext)) $maintext .= "<hr />";
        $maintext = preg_replace("/\\[pagebreak\\]/", "<hr width='75%' />", $maintext);
    }
    echo "<tr><td>" . $maintext . "<br /><br /><br /><hr /><br />";
    echo "<small><b>" . _WFS_DATE . "</b>&nbsp;" . $datetime . "<br /><b>" . _WFS_TOPICC . "</b>&nbsp;" . $story->categoryTitle() . "<br /><b>" . _WFS_URLFORSTORY . "</b>&nbsp;" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $story->articleid() . "</small><br /></td></tr>";
    echo "</td></tr></table></td></tr></table>\n\n            </td></tr></table>\n            </body>\n            </html>\n            ";
}
コード例 #14
0
function b_ccenter_receipt_show($options)
{
    global $xoopsDB, $xoopsUser, $msg_status;
    if (!is_object($xoopsUser)) {
        return null;
    }
    $uid = $xoopsUser->getVar('uid');
    $max = array_shift($options);
    $order = array_shift($options);
    foreach ($options as $v) {
        $s[] = "'{$v}'";
    }
    $cond = " AND status IN (" . join(',', $s) . ")";
    $order = $order == 'asc' ? 'asc' : 'desc';
    $res = $xoopsDB->query("SELECT msgid, m.mtime, uid, status, title\n  FROM " . $xoopsDB->prefix('ccenter_message') . " m,\n    " . $xoopsDB->prefix('ccenter_form') . " WHERE (priuid={$uid} OR priuid=0) {$cond}\n   AND fidref=formid ORDER BY status,m.mtime {$order}", $max);
    if (!$res || $xoopsDB->getRowsNum($res) == 0) {
        return null;
    }
    $list = array();
    while ($data = $xoopsDB->fetchArray($res)) {
        $data['mdate'] = formatTimestamp($data['mtime'], _BL_CCENTER_DATE_FMT);
        $data['uname'] = $xoopsUser->getUnameFromId($data['uid']);
        $data['statstr'] = $msg_status[$data['status']];
        $list[] = $data;
    }
    $mydir = basename(dirname(dirname(__FILE__)));
    return array('list' => $list, 'dirname' => $mydir);
}
コード例 #15
0
ファイル: rss.php プロジェクト: laiello/bitcero-modules
function &gs_rssshow($limit)
{
    global $util, $mc;
    $db =& Database::getInstance();
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsset.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php';
    foreach ($_GET as $k => $v) {
        ${$k} = $v;
    }
    $feed = array();
    // Información General
    $items = array();
    $mc =& $util->moduleConfig('galleries');
    if ($show == 'imgs') {
        $feed['title'] = htmlspecialchars(_MI_GS_RSSNAME);
        $feed['link'] = htmlspecialchars(XOOPS_URL . '/modules/galleries/' . ($mc['urlmode'] ? 'explore/photos/' : 'explore.php?by=explore/photos'));
        $feed['description'] = htmlspecialchars(_MI_GS_RSSIMGS_DESC);
        $sql = "SELECT * FROM " . $db->prefix("gs_images") . " WHERE public='2' ORDER BY created DESC LIMIT 0,15";
        $result = $db->query($sql);
        $users = array();
        while ($row = $db->fetchArray($result)) {
            $pic = new GSImage();
            $pic->assignVars($row);
            if (!isset($users[$pic->owner()])) {
                $users[$pic->owner()] = new GSUser($pic->owner(), 1);
            }
            $user =& $users[$pic->owner()];
            $rtn = array();
            $rtn['title'] = htmlspecialchars($pic->title());
            $rtn['link'] = $user->userURL() . 'img/' . $pic->id() . '/';
            $rtn['description'] = htmlspecialchars('<img src="' . $user->filesURL() . '/ths/' . $pic->image() . '" alt="" /><br />' . sprintf(_MI_GS_RSSIMGDESC, $pic->desc(), formatTimestamp($pic->created(), 'string'), $user->uname(), $pic->views()));
            $rtn['date'] = formatTimestamp($pic->created());
            $items[] = $rtn;
        }
    } elseif ($show == 'sets') {
        $feed['title'] = htmlspecialchars(_MI_GS_RSSSETS);
        $feed['link'] = htmlspecialchars(XOOPS_URL . '/modules/galleries/' . ($mc['urlmode'] ? 'explore/sets/' : 'explore.php?by=explore/sets'));
        $feed['description'] = htmlspecialchars(_MI_GS_RSSSETS_DESC);
        $sql = "SELECT * FROM " . $db->prefix("gs_sets") . " WHERE public='2' ORDER BY date DESC LIMIT 0,15";
        $result = $db->query($sql);
        $users = array();
        while ($row = $db->fetchArray($result)) {
            $set = new GSSet();
            $set->assignVars($row);
            if (!isset($users[$set->owner()])) {
                $users[$set->owner()] = new GSUser($set->owner(), 1);
            }
            $user =& $users[$set->owner()];
            $rtn = array();
            $rtn['title'] = htmlspecialchars($set->title());
            $rtn['link'] = $user->userURL() . 'set/' . $set->id() . '/';
            $rtn['description'] = htmlspecialchars(sprintf(_MI_GS_RSSSETDESC, $user->uname(), formatTimestamp($set->date(), 'string'), $set->pics()));
            $rtn['date'] = formatTimestamp($set->date());
            $items[] = $rtn;
        }
    }
    $ret = array('feed' => $feed, 'items' => $items);
    return $ret;
}
コード例 #16
0
 /**
  * Overridding IcmsPersistable::toArray() method to add a few info
  *
  * @return array of tribetopic info
  */
 public function toArray()
 {
     $ret = parent::toArray();
     $ret['last_post_time'] = formatTimestamp($this->getVar('last_post_time', 'e'), 'm');
     $ret['poster_uname'] = icms_member_user_Handler::getUserLink($this->getVar('poster_uid'));
     $ret['userCanEditAndDelete'] = $this->userCanEditAndDelete();
     $ret['itemLink'] = str_replace($this->handler->_itemname . '.php?', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&', $ret['itemLink']);
     $ret['itemUrl'] = str_replace($this->handler->_itemname . '.php?', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&', $ret['itemUrl']);
     $ret['editItemLink'] = str_replace($this->handler->_itemname . '.php?op=mod', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&amp;op=modtribetopic', $this->getEditItemLink(false, true, true));
     $ret['deleteItemLink'] = str_replace($this->handler->_itemname . '.php?op=del', 'tribes.php?tribes_id=' . $this->getVar('tribes_id') . '&amp;op=deltribetopic', $this->getDeleteItemLink(false, true, true));
     // build last post link
     $module = icms::handler("icms_module")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE);
     $start = '';
     if ($this->getVar('replies') + 1 > $module->config['tribepostsperpage']) {
         $start = '&start=' . ($this->getVar('replies') + 1 - ($this->getVar('replies') + 1) % $module->config['tribepostsperpage']);
     }
     $ret['lastItemLink'] = '<a href="' . $ret['itemUrl'] . $start . '#post' . $this->getVar('last_post_id') . '"><img src="' . $this->handler->_moduleUrl . 'images/comments.gif" title="' . _MD_PROFILE_TRIBETOPIC_SHOW_LAST_POST . '" style="vertical-align:middle;" /></a>';
     // build toggle close item link
     if ($this->getVar('closed')) {
         // link to reopen the topic
         $ret['closedIcon'] = '<img src="' . $this->handler->_moduleUrl . 'images/lock.gif" title="' . _MD_PROFILE_TRIBETOPIC_CLOSE . '" style="vertical-align:middle;" />';
         $ret['toggleCloseLink'] = '<a href="' . $ret['itemUrl'] . '&amp;op=toggleclose"><img src="' . $this->handler->_moduleUrl . 'images/unlock.gif" title="' . _MD_PROFILE_TRIBETOPIC_REOPEN . '" style="vertical-align:middle;" /></a>';
     } else {
         // link to close the topic
         $ret['toggleCloseLink'] = '<a href="' . $ret['itemUrl'] . '&amp;op=toggleclose"><img src="' . $this->handler->_moduleUrl . 'images/lock.gif" title="' . _MD_PROFILE_TRIBETOPIC_CLOSE . '" style="vertical-align:middle;" /></a>';
     }
     return $ret;
 }
コード例 #17
0
ファイル: news_top.php プロジェクト: amjadtbssm/website
function b_news_top_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT storyid, title, published, expired, counter FROM " . $xoopsDB->prefix("stories") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $news = array();
        $title = $myts->makeTboxData4Show($myrow["title"]);
        if (!XOOPS_USE_MULTIBYTES) {
            if (strlen($myrow['title']) >= $options[2]) {
                $title = $myts->makeTboxData4Show(substr($myrow['title'], 0, $options[2] - 1)) . "...";
            }
        }
        $news['title'] = $title;
        $news['id'] = $myrow['storyid'];
        if ($options[0] == "published") {
            $news['date'] = formatTimestamp($myrow['published'], "s");
        } elseif ($options[0] == "counter") {
            $news['hits'] = $myrow['counter'];
        }
        $block['stories'][] = $news;
    }
    return $block;
}
コード例 #18
0
ファイル: teams.php プロジェクト: laiello/bitcero-modules
/**
* @desc Muestra todos los equipos registrados
*/
function showTeams()
{
    global $db, $tpl, $xoopsModule, $xoopsConfig, $adminTemplate;
    $tpl->assign('lang_existing', _AS_TC_EXISTING);
    $tpl->assign('lang_id', _AS_TC_ID);
    $tpl->assign('lang_image', _AS_TC_IMAGE);
    $tpl->assign('lang_name', _AS_TC_NAME);
    $tpl->assign('lang_catego', _AS_TC_CATEGO);
    $tpl->assign('lang_coachs', _AS_TC_COACHS);
    $tpl->assign('lang_options', _OPTIONS);
    $tpl->assign('lang_edit', _EDIT);
    $tpl->assign('lang_delete', _DELETE);
    $tpl->assign('lang_confirmm', _AS_TC_CONFM);
    $tpl->assign('lang_confirm', _AS_TC_CONFDEL);
    $tpl->assign('lang_date', _AS_TC_DATE);
    $tpl->assign('lang_players', _AS_TC_PLAYERS);
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name");
    $teams = array();
    while ($row = $db->fetchArray($result)) {
        $team = new TCTeam();
        $team->assignVars($row);
        $cat = new TCCategory($team->category());
        $coachs = '';
        foreach ($team->coachs(true) as $coach) {
            $coachs .= $coachs == '' ? $coach->name() : '<br />' . $coach->name();
        }
        $teams[] = array('id' => $team->id(), 'name' => $team->name(), 'image' => $team->image(), 'catego' => $cat->name(), 'coachs' => $coachs, 'date' => formatTimestamp($team->created(), 'c'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . _AS_TC_TEAMSLOC);
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/coach_teams.php", 'module', 'team');
    xoops_cp_footer();
}
コード例 #19
0
ファイル: show.php プロジェクト: yunsite/xoopsdc
function showcaseComponentsShow($options)
{
    include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
        $myts = MyTextSanitizer::getInstance();
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
            $page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
            $block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
            $block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
            $block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
コード例 #20
0
function b_marquee_xfsection($limit, $dateformat, $itemssize)
{
    $block = array();
    global $xoopsDB;
    if (!function_exists('xfblock_checkAccess')) {
        include_once XOOPS_ROOT_PATH . "/modules/xfsection/include/xfblock_groupaccess.php";
    }
    $myts =& MyTextSanitizer::getInstance();
    $sql = "SELECT articleid, title, published, expired, counter, groupid, uid FROM " . $xoopsDB->prefix("xfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY published DESC";
    $result = $xoopsDB->query($sql, $limit, 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (xfblock_checkAccess($myrow["groupid"])) {
            $wfs = array();
            $title = $myts->htmlSpecialChars($myrow["title"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if ($itemssize > 0) {
                    $title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemssize - 1));
                } else {
                    $title = $myts->htmlSpecialChars($myrow['title']);
                }
            }
            $block[] = array('date' => formatTimestamp($myrow['published'], $dateformat), 'category' => '', 'author' => XoopsUser::getUnameFromId($myrow['uid']), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/xfsection/article.php?articleid=' . $myrow['articleid'] . "'>" . $title . '</a>');
        }
    }
    return $block;
}
コード例 #21
0
function smarty_modifier_xoops_formattimestamp($time, $format = 's')
{
    if ($time && is_numeric($time)) {
        return formatTimestamp($time, $format);
    }
    return;
}
コード例 #22
0
ファイル: wfs_newdown.php プロジェクト: severnaya99/Sg-2010
function b_wfs_down_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $sql = "SELECT fileid, filerealname, filetext ,articleid, fileshowname, date, ext, minetype, downloadname, counter, filedescript, groupid FROM " . $xoopsDB->prefix("wfs_files") . " ORDER BY " . $options[0] . " DESC";
    $result = $xoopsDB->query($sql, $options[1], 0);
    while ($myrow = $xoopsDB->fetchArray($result)) {
        if (checkAccess($myrow["groupid"])) {
            $wfsd = array();
            $title = $myts->makeTboxData4Show($myrow["fileshowname"]);
            if (!XOOPS_USE_MULTIBYTES) {
                if (strlen($myrow['fileshowname']) >= $options[2]) {
                    $title = $myts->makeTboxData4Show(substr($myrow['fileshowname'], 0, $options[2] - 1)) . "...";
                }
            }
            $wfsd['titledown'] = $title;
            $wfsd['iddown'] = $myrow['articleid'];
            if ($options[0] == "date") {
                $wfsd['date'] = formatTimestamp($myrow['date'], "s");
            } elseif ($options[0] == "counter") {
                $wfsd['date'] = $myrow['counter'];
            }
            $block['download'][] = $wfsd;
        }
    }
    return $block;
}
コード例 #23
0
ファイル: answer.php プロジェクト: trabisdementia/xuups
 function datesub($dateFormat = 'none', $format = "S")
 {
     if ($dateFormat == 'none') {
         $smartModuleConfig =& sf_getModuleConfig();
         $dateFormat = $smartModuleConfig['dateformat'];
     }
     return formatTimestamp($this->getVar('datesub', $format), $dateFormat);
 }
コード例 #24
0
 function render()
 {
     $ele_name = $this->getName();
     $ele_value = $this->getValue(false);
     $jstime = formatTimestamp($ele_value, 'F j Y, H:i:s');
     include_once XOOPS_ROOT_PATH . '/include/calendarjs.php';
     return "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . date("Y-m-d", $ele_value) . "'" . $this->getExtra() . " /><input type='reset' value=' ... ' onclick='return showCalendar(\"" . $ele_name . "\");'>";
 }
コード例 #25
0
 function render()
 {
     //$jstime = formatTimestamp('F j Y H:i:s', $this->getValue());
     $jstime = formatTimestamp('F j Y, H:i:s', $this->getValue());
     include_once DIR_INCLUDES . '/include/calendarjs.php';
     //return "<input type='text' name='".$this->getName()."' id='".$this->getId()."' size='".$this->getSize()."' maxlength='".$this->getMaxlength()."' value='".date("Y-m-d", $this->getValue())."'".$this->getExtra()." /><input type='reset' value=' ... ' onclick='return showCalendar(\"".$this->getName()."\");'>";
     return "<input type='text' name='" . $this->getName() . "' id='" . $this->getId() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . date("d/m/Y", $this->getValue()) . "'" . $this->getExtra() . "  class='inputText' /><input type='image' value=' ... ' src='" . XOOPS_URL . "/images/calendar.gif' onclick='return showCalendar(\"" . $this->getId() . "\");' alt='calendário' title='calendário' align='middle'>";
 }
コード例 #26
0
ファイル: pages.php プロジェクト: laiello/bitcero-modules
/**
 * Muestra los envíos existentes
 */
function showPages($acceso = -1)
{
    global $mc, $xoopsModule, $xoopsSecurity;
    $keyw = rmc_server_var($_REQUEST, 'keyw', '');
    $acceso = rmc_server_var($_REQUEST, 'acceso', -1);
    $cat = rmc_server_var($_REQUEST, 'cat', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("qpages_pages");
    if ($acceso >= 0) {
        $sql .= " WHERE acceso={$acceso}";
    }
    if (trim($keyw) != '') {
        $sql .= ($acceso >= 0 ? " AND " : " WHERE ") . "titulo LIKE '%{$keyw}%'";
    }
    if (isset($cat) && $cat > 0) {
        $sql .= ($acceso >= 0 || $keyw != '' ? " AND " : " WHERE ") . "cat='{$cat}'";
    }
    /**
     * Paginacion de Resultados
     */
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 15;
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('pages.php?cat=' . $cat . '&page={PAGE_NUM}');
    $sql .= " ORDER BY id_page DESC LIMIT {$start},{$limit}";
    $sql = str_replace("SELECT COUNT(*)", "SELECT *", $sql);
    $result = $db->query($sql);
    $pages = array();
    while ($row = $db->fetchArray($result)) {
        $p = new QPPage();
        $p->assignVars($row);
        # Enlaces para las categorías
        $catego = new QPCategory($p->getCategory());
        $pages[] = array('id' => $p->getID(), 'titulo' => $p->getTitle(), 'catego' => $catego->getName(), 'fecha' => formatTimeStamp($p->getDate(), 's'), 'link' => $p->getPermaLink(), 'estado' => $p->getAccess(), 'modificada' => $p->getModDate() == 0 ? '--' : formatTimestamp($p->getModDate(), 'c'), 'lecturas' => $p->getReads(), 'order' => $p->order(), 'type' => $p->type(), 'desc' => $p->getDescription());
    }
    /**
     * Cargamos las categorias
     */
    $categos = array();
    qpArrayCategos($categos);
    $categories = array();
    foreach ($categos as $k) {
        $categories[] = array('id' => $k['id_cat'], 'nombre' => $k['nombre'], 'saltos' => $k['saltos']);
    }
    RMTemplate::get()->add_style('admin.css', 'qpages');
    RMTemplate::get()->add_script('../include/js/qpages.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->assign('xoops_pagetitle', __('Pages Management', 'qpages'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($acceso < 0 ? __('All Pages', 'qpages') : ($acceso == 0 ? __('Draft pages', 'qpages') : __('Published pages', 'qpages'))));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/qp_pages.php", 'module', 'qpages');
    xoops_cp_footer();
}
コード例 #27
0
ファイル: d3pipes.php プロジェクト: nouphet/rata
function b_gnavi_d3pipes_joints($options)
{
    global $xoopsDB;
    $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    require dirname(dirname(__FILE__)) . '/include/read_configs.php';
    $cat_limitation = empty($options[1]) ? 0 : 1;
    $photos_num = empty($options[2]) ? 10 : intval($options[2]);
    $show_desc = empty($options[3]) ? 0 : 1;
    $query = "ORDER BY unixtime DESC";
    $title_max_length = 255;
    // Category limitation
    if ($cat_limitation) {
        include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
        $cattree = new XoopsTree($table_cat, "cid", "pid");
        $children = $cattree->getAllChildId($cat_limitation);
        $whr_cat = "l.cid IN (";
        foreach ($children as $child) {
            $whr_cat .= "{$child},";
        }
        $whr_cat .= "{$cat_limitation})";
        for ($i = 1; $i <= 4; $i++) {
            $whr_cat .= " OR l.cid{$i} IN (";
            foreach ($children as $child) {
                $whr_cat .= "{$child},";
            }
            $whr_cat .= "{$cat_limitation})";
        }
        $whr_cat = "(" . $whr_cat . ")";
    } else {
        $whr_cat = '1';
    }
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    if ($show_desc) {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title ,t.description ,t.arrowhtml FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    } else {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    }
    $count = 1;
    while ($photo = $xoopsDB->fetchArray($result)) {
        $photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3);
        $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        if ($show_desc) {
            $photo['body'] = xoops_substr(strip_tags($myts->displayTarea($photo['description'], $photo['arrowhtml'], 1, 1, 1, 1, 1)), 0, 512);
        } else {
            $photo['body'] = '';
        }
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        $block['photo'][$count++] = $photo;
    }
    $block['mod_url'] = $mod_url;
    return $block;
}
コード例 #28
0
 function getChannelData()
 {
     // emulating from ATOM to RSS
     $error_level_stored = error_reporting();
     error_reporting($error_level_stored & ~E_NOTICE);
     $channel = array('title' => $this->_feed['title'], 'link' => $this->_feed['link'], 'lastbuilddate' => formatTimestamp($this->_feed['modified']), 'id' => $this->_feed['id'], 'id' => $this->_feed['id'], 'webmaster' => $this->_feed['author_name'], 'generator' => $this->_feed['generator']);
     error_reporting($error_level_stored);
     return $channel;
 }
コード例 #29
0
function b_news_randomnews_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $block['sort'] = $options[0];
    $tmpstory = new NewsStory();
    $restricted = news_getmoduleoption('restrictindex');
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    if ($dateformat == '') {
        $dateformat = 's';
    }
    if ($options[4] == 0) {
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, 0, 1, $options[0]);
    } else {
        $topics = array_slice($options, 4);
        $stories = $tmpstory->getRandomNews($options[1], 0, $restricted, $topics, 1, $options[0]);
    }
    unset($tmpstory);
    if (count($stories) == 0) {
        return '';
    }
    foreach ($stories as $story) {
        $news = array();
        $title = $story->title();
        if (strlen($title) > $options[2]) {
            $title = xoops_substr($title, 0, $options[2] + 3);
        }
        $news['title'] = $title;
        $news['id'] = $story->storyid();
        $news['date'] = formatTimestamp($story->published(), $dateformat);
        $news['hits'] = $story->counter();
        $news['rating'] = $story->rating();
        $news['votes'] = $story->votes();
        $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname());
        $news['topic_title'] = $story->topic_title();
        $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color);
        if ($options[3] > 0) {
            $html = $story->nohtml() == 1 ? 0 : 1;
            $news['teaser'] = news_truncate_tagsafe($myts->displayTarea($story->hometext, $html), $options[3] + 3);
            $news['infotips'] = '';
        } else {
            $news['teaser'] = '';
            if ($infotips > 0) {
                $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"';
            } else {
                $news['infotips'] = '';
            }
        }
        $block['stories'][] = $news;
    }
    $block['lang_read_more'] = _MB_READMORE;
    return $block;
}
コード例 #30
0
	function execute(&$controller, &$xoopsUser)
	{
		$filename = sprintf('%s User data List.csv', $GLOBALS['xoopsConfig']['sitename']);
		$text = '';
		$field_line = '';
		
		$user_handler =& $this->_getHandler();
		$criteria = new CriteriaElement();
		$criteria->setSort('uid');
		$users = $user_handler->getObjects($criteria);
		if (!$users || count($users)==0){
			return USER_FRAME_VIEW_INDEX;
		}
		foreach ($users[0]->gets() as $key=>$var){
			$_f = '_MD_USER_LANG_'.strtoupper($key);
			$field_line .= (defined($_f) ? constant($_f) : $key).",";
		}
		$field_line .= "\n";
		
		foreach ($users as $u){
			$user_data = '';
			foreach ($u->gets() as $key=>$value){
				switch ($key){
				  case 'user_regdate':
				  case 'last_login':
					$value = $value ? formatTimestamp($value, 'Y/n/j H:i') : '';
					break;
				  default:
				}
				if (preg_match('/[,"\r\n]/', $value)) {
					$value = preg_replace('/"/', "\"\"", $value);
					$value = "\"$value\"";
				}
				$user_data .= $value . ',';
			}
			$text .= trim($user_data, ',')."\n";
		}
		$text = $field_line.$text;
		
		/// japanese 
		if (strncasecmp($GLOBALS['xoopsConfig']['language'], 'ja', 2)===0){
			mb_convert_variables('SJIS', _CHARSET, $text);
		}
		
		if( preg_match('/firefox/i' , xoops_getenv('HTTP_USER_AGENT')) ){
			header("Content-Type: application/x-csv");
		}else{
			header("Content-Type: application/vnd.ms-excel");
		}
		
		
		header("Content-Disposition: attachment ; filename=\"{$filename}\"") ;
		exit($text);
	}