Пример #1
0
function showRSS()
{
    global $icmsAdminTpl, $icmsConfigPersona;
    $rssurl = $icmsConfigPersona['rss_local'];
    $rssfile = ICMS_CACHE_PATH . '/adminnews_' . _LANGCODE . '.xml';
    // Create a new instance of the SimplePie object
    $feed = new icms_feeds_Simplerss();
    $feed->set_feed_url($rssurl);
    $feed->set_cache_duration(3600);
    $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
    $feed->init();
    $feed->handle_content_type();
    if (!$feed->error) {
        $icmsAdminTpl->assign('admin_rss_feed_link', $feed->get_link());
        $icmsAdminTpl->assign('admin_rss_feed_title', $feed->get_title());
        $icmsAdminTpl->assign('admin_rss_feed_dsc', $feed->get_description());
        $feeditems = array();
        foreach ($feed->get_items() as $item) {
            $feeditem = array();
            $feeditem['link'] = $item->get_permalink();
            $feeditem['title'] = $item->get_title();
            $feeditem['description'] = $item->get_description();
            $feeditem['date'] = $item->get_date();
            $feeditem['guid'] = $item->get_id();
            $feeditems[] = $feeditem;
        }
        $icmsAdminTpl->assign('admin_rss_feeditems', $feeditems);
    }
    $icmsAdminTpl->display('db:admin/system_adm_rss.html');
}
Пример #2
0
 /**
  * Check for a newer version of ImpressCMS
  *
  * @return	TRUE if there is an update, FALSE if no update OR errors occured
  *
  */
 public function check()
 {
     // Create a new instance of the SimplePie object
     $feed = new icms_feeds_Simplerss();
     $feed->set_feed_url($this->version_xml);
     $feed->set_cache_duration(0);
     $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
     $feed->init();
     $feed->handle_content_type();
     if (!$feed->error) {
         $versionInfo['title'] = $feed->get_title();
         $versionInfo['link'] = $feed->get_link();
         $versionInfo['image_url'] = $feed->get_image_url();
         $versionInfo['image_title'] = $feed->get_image_title();
         $versionInfo['image_link'] = $feed->get_image_link();
         $feed_item = $feed->get_item(0);
         $versionInfo['description'] = $feed_item->get_description();
         $versionInfo['permalink'] = $feed_item->get_permalink();
         $versionInfo['title'] = $feed_item->get_title();
         $versionInfo['content'] = $feed_item->get_content();
         $guidArray = $feed_item->get_item_tags('', 'guid');
         $versionInfo['guid'] = $guidArray[0]['data'];
     } else {
         $this->errors[] = _AM_VERSION_CHECK_RSSDATA_EMPTY;
         return false;
     }
     $this->latest_version_name = $versionInfo['title'];
     $this->latest_changelog = $versionInfo['description'];
     $build_info = explode('|', $versionInfo['guid']);
     $this->latest_build = $build_info[0];
     $this->latest_status = $build_info[1];
     if ($this->latest_build > ICMS_VERSION_BUILD) {
         // There is an update available
         $this->latest_url = $versionInfo['link'];
         return true;
     }
     return false;
 }