Beispiel #1
0
 function decode($text)
 {
     $config = parent::loadConfig(dirname(__FILE__));
     if (empty($text) || empty($config['link'])) {
         return $text;
     }
     $charset = !empty($config['charset']) ? $config['charset'] : "UTF-8";
     xoops_load('xoopslocal');
     $ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>";
     return $ret;
 }
Beispiel #2
0
 function cleanup($text, $trim = 0)
 {
     if (strtolower($this->xml_encoding) == "utf-8" && strncasecmp(_CHARSET, $this->xml_encoding, 5)) {
         $text = XoopsLocal::convert_encoding($text, "utf-8");
     }
     if (!empty($trim)) {
         $text = xoops_substr($text, 0, intval($trim));
     }
     $text = htmlspecialchars($text, ENT_QUOTES);
     return $text;
 }
 /**
  * Function to convert UNIX time to formatted time string
  */
 function art_formatTimestamp($time, $format = "c", $timeoffset = null)
 {
     $artConfig = art_load_config();
     if (strtolower($format) == "reg" || strtolower($format) == "") {
         $format = "c";
     }
     if ((strtolower($format) == "custom" || strtolower($format) == "c") && !empty($artConfig["formatTimestamp_custom"])) {
         $format = $artConfig["formatTimestamp_custom"];
     }
     xoops_load("xoopslocal");
     return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
 }
 /**
  * Function to convert UNIX time to formatted time string
  */
 function newbb_formatTimestamp($time, $format = "c", $timeoffset = "")
 {
     load_functions("locale");
     $newbbConfig = newbb_load_config();
     $format = strtolower($format);
     if ($format == "reg" || $format == "") {
         $format = "c";
     }
     if (($format == "custom" || $format == "c") && !empty($newbbConfig["formatTimestamp_custom"])) {
         $format = $newbbConfig["formatTimestamp_custom"];
     }
     return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
 }
/**
 * Function to convert UNIX time to formatted time string
 */
function newbb_formatTimestamp($time, $format = "c", $timeoffset = "")
{
    xoops_load("xoopslocal");
    require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.config.php";
    $newbbConfig = newbb_loadConfig();
    $format = strtolower($format);
    if ($format == "reg" || $format == "") {
        $format = "c";
    }
    if (($format == "custom" || $format == "c") && !empty($newbbConfig["formatTimestamp_custom"])) {
        $format = $newbbConfig["formatTimestamp_custom"];
    }
    return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
}
Beispiel #6
0
 /**
  * @param $text
  *
  * @return string
  */
 public static function decode($text, $width, $height)
 {
     $config = parent::loadConfig(__DIR__);
     if (empty($text) || empty($config['link'])) {
         return $text;
     }
     $charset = !empty($config['charset']) ? $config['charset'] : 'UTF-8';
     xoops_load('XoopsLocal');
     $ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>";
     return $ret;
 }
Beispiel #7
0
$criteria->add(new Criteria('status', 2), 'AND');
$criteria->add(new Criteria('datesub', time(), '<='), 'AND');
$criteria->setSort('datesub');
$criteria->setOrder('DESC');
//Get all articles dates as an array to save memory
$items = $publisher->getHandler('item')->getAll($criteria, array('datesub'), false);
$itemsCount = count($items);
if (!($itemsCount > 0)) {
    redirect_header(XOOPS_URL, 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS);
    exit;
} else {
    $years = array();
    $months = array();
    $i = 0;
    foreach ($items as $item) {
        $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset);
        if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $time, $datetime)) {
            $this_year = intval($datetime[1]);
            $this_month = intval($datetime[2]);
            if (empty($lastyear)) {
                $lastyear = $this_year;
            }
            if ($lastmonth == 0) {
                $lastmonth = $this_month;
                $months[$lastmonth]['string'] = $months_arr[$lastmonth];
                $months[$lastmonth]['number'] = $lastmonth;
            }
            if ($lastyear != $this_year) {
                $years[$i]['number'] = $lastyear;
                $years[$i]['months'] = $months;
                $months = array();
Beispiel #8
0
    art_trackback_response(1, "Trackback is closed");
}
if (!strlen($title . $url . $blog_name)) {
    art_trackback_response(1, art_constant("MD_INVALID"));
}
if (!empty($article_id) && !empty($url)) {
    $trackback_handler =& xoops_getmodulehandler("trackback", $GLOBALS["artdirname"]);
    $criteria = new CriteriaCompo(new Criteria("art_id", $article_id));
    $criteria->add(new Criteria("tb_url", $url));
    if ($trackback_handler->getCount($criteria) > 0) {
        art_trackback_response(1, "We already have a ping from that URI for this article.");
    }
    $charset = empty($charset) ? "utf-8" : $charset;
    $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset);
    $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset);
    $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset);
    $tb_status = intval($xoopsModuleConfig["trackback_option"]);
    $trackback_obj = $trackback_handler->create();
    $trackback_obj->setVar("art_id", $article_id);
    $trackback_obj->setVar("tb_time", time());
    $trackback_obj->setVar("tb_title", $title);
    $trackback_obj->setVar("tb_url", $url);
    $trackback_obj->setVar("tb_excerpt", $excerpt);
    $trackback_obj->setVar("tb_blog_name", $blog_name);
    $trackback_obj->setVar("tb_ip", art_getIP());
    $trackback_obj->setVar("tb_status", $tb_status);
    $result = $trackback_handler->insert($trackback_obj);
    $criteria = new CriteriaCompo(new Criteria("art_id", $article_id));
    $criteria->add(new Criteria("tb_status", 0, ">"));
    $count = $trackback_handler->getCount($criteria);
    $article_handler =& xoops_getmodulehandler("article", $GLOBALS["artdirname"]);
Beispiel #9
0
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_SPOTLIGHT", "Spotlight");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_SPOTLIGHT_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_ARTICLE", "Articles");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_ARTICLE_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CATEGORY", "Categories");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CATEGORY_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_TOPIC", "Topics");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_TOPIC_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_AUTHOR", "Authors");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_AUTHOR_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_BLOCK_RECENTNEWS", "Recent news");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_BLOCK_TAG_CLOUD", "Tag Cloud");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_BLOCK_TAG_TOP", "Top Tags");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_TIMEFORMAT", "Time format for display");
xoops_load("xoopslocal");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_TIMEFORMAT_DESC", XoopsLocal::getTimeFormatDesc());
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_TIMEFORMAT_CUSTOM", "Custom");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CONFIGCAT_MODULE", "General setting");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CONFIGCAT_MODULE_DESC", "Module-wide preferences");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CONFIGCAT_ARTICLE", "Article setting");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_CONFIGCAT_ARTICLE_DESC", "Article related");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_THEMESET", "Theme set");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_THEMESET_DESC", "Module-wide, select '" . _NONE . "' will use site-wide theme");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_DISPLAY_SUMMARY", "Display summary on article list");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_DISPLAY_SUMMARY_DESC", "On index, category and topic pages");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_FORUM", "Forum");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_FORUM_DESC", "The forum to be used for discussion");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_URLFORUM", "Forum URL");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_URLFORUM_DESC", "");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_URLBLOG", "Blog URL");
define($GLOBALS["ART_VAR_PREFIXU"] . "_MI_URLBLOG_DESC", "");
/**
 * xoops_trim()
 *
 * @param mixed $text
 * @return
 */
function xoops_trim($text)
{
    xoops_load('XoopsLocal');
    return XoopsLocal::trim($text);
}
Beispiel #11
0
 function &utf8_encode(&$text)
 {
     $text = XoopsLocal::convert_encoding($text, 'utf-8');
     return $text;
 }
Beispiel #12
0
    $tpl->assign('channel_desc', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
    $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
    $tpl->assign('channel_category', 'News');
    $tpl->assign('channel_generator', 'XOOPS');
    $tpl->assign('channel_language', _LANGCODE);
    $tpl->assign('image_url', XOOPS_URL . '/images/logo.png');
    $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
    if (empty($dimention[0])) {
        $width = 88;
    } else {
        $width = $dimention[0] > 144 ? 144 : $dimention[0];
    }
    if (empty($dimention[1])) {
        $height = 31;
    } else {
        $height = $dimention[1] > 400 ? 400 : $dimention[1];
    }
    $tpl->assign('image_width', $width);
    $tpl->assign('image_height', $height);
    if (@(include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php')) {
        $sarray = NewsStory::getAllPublished(10, 0, true);
    }
    if (!empty($sarray) && is_array($sarray)) {
        foreach ($sarray as $story) {
            $tpl->append('items', array('title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'guid' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES))));
        }
    }
}
$tpl->display('db:system_rss.html');
Beispiel #13
0
 if (!($items = XoopsCache::read($rssfile))) {
     require_once $GLOBALS['xoops']->path('class/snoopy.php');
     include_once $GLOBALS['xoops']->path('class/xml/rss/xmlrss2parser.php');
     xoops_load('XoopsLocal');
     $snoopy = new Snoopy();
     $cnt = 0;
     foreach ($rssurl as $url) {
         if ($snoopy->fetch($url)) {
             $rssdata = $snoopy->results;
             $rss2parser = new XoopsXmlRss2Parser($rssdata);
             if (false != $rss2parser->parse()) {
                 $_items = $rss2parser->getItems();
                 $count = count($_items);
                 for ($i = 0; $i < $count; $i++) {
                     $_items[$i]['title'] = XoopsLocal::convert_encoding($_items[$i]['title'], _CHARSET, 'UTF-8');
                     $_items[$i]['description'] = XoopsLocal::convert_encoding($_items[$i]['description'], _CHARSET, 'UTF-8');
                     $items[strval(strtotime($_items[$i]['pubdate'])) . "-" . strval(++$cnt)] = $_items[$i];
                 }
             } else {
                 echo $rss2parser->getErrors();
             }
         }
     }
     krsort($items);
     XoopsCache::write($rssfile, $items, 86400);
 }
 if ($items != '') {
     $ret = '<table class="outer width100">';
     foreach (array_keys($items) as $i) {
         $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">';
         $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
Beispiel #14
0
 /**
  * @param string $dateFormat
  * @param string $format
  *
  * @return string
  */
 public function datesub($dateFormat = 's', $format = "S")
 {
     xoops_load('XoopsLocal');
     return XoopsLocal::formatTimestamp($this->getVar('datesub', $format), $dateFormat);
 }
Beispiel #15
0
 function _encoding(&$text, $in_charset, $out_charset)
 {
     $text =& XoopsLocal::convert_encoding($text, $out_charset, $in_charset);
 }
Beispiel #16
0
function forum_formatTimestamp($time, $format = "c", $timeoffset = "")
{
	if(strtolower($format) == "reg" || strtolower($format) == "") {
		$format = "c";
	}
	if( (strtolower($format) == "custom" || strtolower($format) == "c") && !empty($GLOBALS["xoopsModuleConfig"]["formatTimestamp_custom"]) ) {
		$format = $GLOBALS["xoopsModuleConfig"]["formatTimestamp_custom"];
	}
	
	load_functions("locale");
	return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
	
	if(class_exists("XoopsLocal") && is_callable(array("XoopsLocal", "formatTimestamp")) && defined("_TODAY")){
		return XoopsLocal::formatTimestamp($time, $format, $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':
    default:
    	forum_load_lang_file("main", "xforum");
        $current_timestamp = xoops_getUserTimestamp(time(), $timeoffset);
        if(date("Ymd", $usertimestamp) == date("Ymd", $current_timestamp)){
			$datestring = _MD_TODAY;
		}elseif(date("Ymd", $usertimestamp+24*60*60) == date("Ymd", $current_timestamp)){
			$datestring = _MD_YESTERDAY;
		}elseif(date("Y", $usertimestamp) == date("Y", $current_timestamp)){
			$datestring = _MD_MONTHDAY;
		}else{
			$datestring = _MD_YEARMONTHDAY;
		}
        break;
    }

    return date($datestring, $usertimestamp);
}
Beispiel #17
0
    $tpl->assign('channel_desc', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
    $tpl->assign('channel_lastbuild', XoopsLocal::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
    $tpl->assign('channel_editor', $xoopsConfig['adminmail']);
    if ($categoryid != -1) {
        $channel_category .= " > " . $categoryObj->name();
    }
    $tpl->assign('channel_category', htmlspecialchars($channel_category));
    $tpl->assign('channel_generator', $publisher->getModule()->name());
    $tpl->assign('channel_language', _LANGCODE);
    $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
    $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif');
    if (empty($dimention[0])) {
        $width = 140;
        $height = 140;
    } else {
        $width = $dimention[0] > 140 ? 140 : $dimention[0];
        $dimention[1] = $dimention[1] * $width / $dimention[0];
        $height = $dimention[1] > 140 ? $dimention[1] * $dimention[0] / 140 : $dimention[1];
    }
    $tpl->assign('image_width', $width);
    $tpl->assign('image_height', $height);
    $sarray = $publisher->getHandler('item')->getAllPublished(10, 0, $categoryid);
    if (is_array($sarray)) {
        $count = $sarray;
        foreach ($sarray as $item) {
            $tpl->append('items', array('title' => htmlspecialchars($item->title(), ENT_QUOTES), 'link' => $item->getItemUrl(), 'guid' => $item->getItemUrl(), 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'), 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES)));
        }
    }
}
$tpl->display('db:publisher_rss.html');
Beispiel #18
0
function xoops_trim($text)
{
    if (is_callable(array("XoopsLocal", "trim"))) {
        return XoopsLocal::trim($text);
        // Or
        // return xoops_local("trim", $text);
    }
    return trim($text);
}
Beispiel #19
0
$modversion['blocks'][$i]['template'] = "publisher_items_menu.html";
$i++;
$modversion['blocks'][$i]['file'] = "latest_files.php";
$modversion['blocks'][$i]['name'] = _MI_PUBLISHER_LATESTFILES;
$modversion['blocks'][$i]['description'] = _MI_PUBLISHER_LATESTFILES_DSC;
$modversion['blocks'][$i]['show_func'] = "publisher_latest_files_show";
$modversion['blocks'][$i]['edit_func'] = "publisher_latest_files_edit";
$modversion['blocks'][$i]['options'] = "0|datesub|5|0";
$modversion['blocks'][$i]['template'] = "publisher_latest_files.html";
$i++;
$modversion['blocks'][$i]['file'] = "date_to_date.php";
$modversion['blocks'][$i]['name'] = _MI_PUBLISHER_DATE_TO_DATE;
$modversion['blocks'][$i]['description'] = _MI_PUBLISHER_DATE_TO_DATE_DSC;
$modversion['blocks'][$i]['show_func'] = "publisher_date_to_date_show";
$modversion['blocks'][$i]['edit_func'] = "publisher_date_to_date_edit";
$modversion['blocks'][$i]['options'] = XoopsLocal::formatTimestamp(time(), 'm/j/Y') . "|" . XoopsLocal::formatTimestamp(time(), 'm/j/Y');
$modversion['blocks'][$i]['template'] = "publisher_date_to_date.html";
$i++;
$modversion['blocks'][$i]['file'] = "items_columns.php";
$modversion['blocks'][$i]['name'] = _MI_PUBLISHER_COLUMNS;
$modversion['blocks'][$i]['description'] = _MI_PUBLISHER_COLUMNS_DSC;
$modversion['blocks'][$i]['show_func'] = "publisher_items_columns_show";
$modversion['blocks'][$i]['edit_func'] = "publisher_items_columns_edit";
$modversion['blocks'][$i]['options'] = "2|0|4|256|normal";
$modversion['blocks'][$i]['template'] = "publisher_items_columns.html";
$i++;
$modversion['blocks'][$i]['file'] = "latest_news.php";
$modversion['blocks'][$i]['name'] = _MI_PUBLISHER_LATEST_NEWS;
$modversion['blocks'][$i]['description'] = _MI_PUBLISHER_LATEST_NEWS_DSC;
$modversion['blocks'][$i]['show_func'] = "publisher_latest_news_show";
$modversion['blocks'][$i]['edit_func'] = "publisher_latest_news_edit";
Beispiel #20
0
            //Obtenemos una imagen del album
            $sql = "SELECT b.* FROM " . $db->prefix('gs_setsimages') . " a, " . $db->prefix('gs_images') . " b WHERE";
            $sql .= " a.id_set='" . $set->id() . "' AND b.id_image=a.id_image AND b.public=2 AND b.owner='" . $set->owner() . "' ORDER BY RAND() LIMIT 0,4";
            $resimg = $db->query($sql);
            if (!isset($users[$set->owner()])) {
                $users[$set->owner()] = new GSUser($set->owner(), 1);
            }
            $imgs = '<a href="' . $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&amp;set=' . $set->id()) . '">';
            while ($rowimg = $db->fetchArray($resimg)) {
                $img = new GSImage();
                $img->assignVars($rowimg);
                $urlimg = $users[$set->owner()]->filesURL() . '/' . ($config['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
                // Conversion de los formatos
                if (!$img->setFormat() && $config['set_format_mode']) {
                    GSFunctions::resizeImage($crop, $users[$set->owner()]->filesPath() . '/' . $img->image(), $users[$set->owner()]->filesPath() . '/formats/set_' . $img->image(), $width, $height);
                    $img->setSetFormat(1, 1);
                }
                $imgs .= '<img src="' . $urlimg . '" alt="' . $set->title() . '" /> ';
            }
            $imgs .= '</a>';
            $desc = $imgs . '<br />';
            $desc .= sprintf(__('By: <strong>%s</strong>', 'galleries'), $set->uname());
            $item = array();
            $item['title'] = $set->title();
            $item['link'] = $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&amp;set=' . $set->id());
            $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($desc, ENT_QUOTES));
            $item['pubdate'] = formatTimestamp($set->date(), 'rss');
            $item['guid'] = $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&amp;set=' . $set->id());
            $rss_items[] = $item;
        }
}
Beispiel #21
0
 function _encoding(&$text, $in_charset, $out_charset)
 {
     // some conversion goes here
     // refer to schinese.php for example
     $text =& XoopsLocal::convert_encoding($text, $out_charset, $in_charset);
 }
Beispiel #22
0
    default:
        $rss_channel['title'] = sprintf(__('Posts in %s', 'mywords'), $xoopsConfig['sitename']);
        $rss_channel['link'] = XOOPS_URL . ($config->permalinks ? $config->basepath : '/modules/mywords');
        $rss_channel['description'] = __('All recent published posts', 'mywords');
        $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss');
        $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['category'] = 'Blog';
        $rss_channel['generator'] = 'Common Utilities';
        $rss_channel['language'] = RMCLANG;
        // Get posts
        $posts = MWFunctions::get_posts(0, 10);
        $rss_items = array();
        foreach ($posts as $post) {
            $item = array();
            $item['title'] = $post->getVar('title');
            $item['link'] = $post->permalink();
            $img = new RMImage();
            $img->load_from_params($post->getVar('image', 'e'));
            if (!$img->isNew()) {
                $image = '<img src="' . $img->url() . '" alt="' . $post->getVar('title') . '" /><br />';
            } else {
                $image = '';
            }
            $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES));
            $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss');
            $item['guid'] = $post->permalink();
            $rss_items[] = $item;
        }
        break;
}
Beispiel #23
0
             fclose($fp);
         }
     }
     if ($rssdata != '') {
         include_once XOOPS_ROOT_PATH . '/class/xml/rss/xmlrss2parser.php';
         $rss2parser = new XoopsXmlRss2Parser($rssdata);
         if (false != $rss2parser->parse()) {
             echo '<table class="outer" width="100%">';
             $items =& $rss2parser->getItems();
             $count = count($items);
             $myts =& MyTextSanitizer::getInstance();
             for ($i = 0; $i < $count; $i++) {
                 echo '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" target="_blank">';
                 echo htmlspecialchars(XoopsLocal::convert_encoding($items[$i]['title'], _CHARSET, "UTF-8")) . '</a> (' . formatTimestamp(htmlspecialchars($items[$i]['pubdate'])) . ')</td></tr>';
                 if ($items[$i]['description'] != "") {
                     echo '<tr><td class="odd">' . XoopsLocal::convert_encoding($items[$i]['description'], _CHARSET, "UTF-8");
                     if ($items[$i]['guid'] != "") {
                         echo '&nbsp;&nbsp;<a href="' . htmlspecialchars($items[$i]['guid']) . '" target="_blank">' . _MORE . '</a>';
                     }
                     echo '</td></tr>';
                 } elseif ($items[$i]['guid'] != "") {
                     echo '<tr><td class="even" valign="top"></td><td colspan="2" class="odd"><a href="' . htmlspecialchars($items[$i]['guid']) . '" target="_blank">' . _MORE . '</a></td></tr>';
                 }
             }
             echo '</table>';
         } else {
             echo $rss2parser->getErrors();
         }
     }
 } else {
     //load admin frontpage blocks
Beispiel #24
0
 /**
  * @param string $dateFormat
  * @param string $format
  *
  * @return string
  */
 public function datesub($dateFormat = '', $format = 'S')
 {
     if (empty($dateformat)) {
         $dateFormat = $this->publisher->getConfig('format_date');
     }
     xoops_load('XoopsLocal');
     return XoopsLocal::formatTimestamp($this->getVar('datesub', $format), $dateFormat);
 }
Beispiel #25
0
 function convert_encoding($val)
 {
     if (is_array($val)) {
         foreach (array_keys($val) as $key) {
             $val[$key] = $this->convert_encoding($val[$key]);
         }
     } else {
         $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET);
     }
     return $val;
 }