Example #1
0
 public function Display()
 {
     global $db;
     $rss_writer_object = new rss_writer_class();
     $rss_writer_object->specification = '1.0';
     $rss_writer_object->about = BASE_URL . 'rss.xml';
     $rss_writer_object->rssnamespaces['dc'] = 'http://purl.org/dc/elements/1.1/';
     $properties = array();
     if ($this->mCategoryId == 'all') {
         $properties['description'] = 'Latest jobs';
     } else {
         $properties['description'] = 'Latest jobs for ' . ucwords($this->mCategoryName);
     }
     $properties['link'] = BASE_URL;
     $properties['title'] = SITE_NAME;
     $properties['dc:date'] = date('d-m-Y');
     $rss_writer_object->addchannel($properties);
     $count = 0;
     $jobb = new Job();
     if ($this->mCategoryId == 'all') {
         $jobs = $jobb->GetJobs(0, 0, 0, 0, 0, true);
     } else {
         $jobs = $jobb->GetJobs(0, $this->mCategoryId, 0, 0, 0, true);
     }
     foreach ($jobs as $job) {
         $count++;
         if ($count > 10) {
             break;
         }
         $properties = array();
         $properties['description'] = '<strong>Location:</strong> ' . $job['location'] . '<br />';
         if ($job['url'] != '' && $job['url'] != 'http://') {
             $properties['description'] .= '<strong>URL:</strong> <a href="' . $job['url'] . '">' . $job['url'] . '</a><br /><br />';
         }
         $properties['description'] .= '<strong>Description:</strong><br />' . $job['description'] . '<br /><br />';
         $properties['description'] .= '<a href="' . BASE_URL . URL_JOB . '/' . $job['id'] . '/' . $job['url_title'] . '/' . '">Apply to this job</a><br />';
         $properties['link'] = BASE_URL . URL_JOB . '/' . $job['id'] . '/' . $job['url_title'] . '/';
         $type = '[' . $job['type_name'] . ']';
         $properties['title'] = $type . ' ' . $job['title'] . ' at ' . $job['company'];
         $properties['dc:date'] = $job['mysql_date'];
         $rss_writer_object->additem($properties);
     }
     if (empty($jobs)) {
         $properties = array();
         $properties['description'] = ' ';
         $properties['description'] .= ' ';
         $properties['link'] = ' ';
         $properties['title'] = ' ';
         $properties['dc:date'] = ' ';
         $rss_writer_object->additem($properties);
     }
     if ($rss_writer_object->writerss($output)) {
         header('Content-Type: text/xml; charset="utf-8"');
         header('Content-Length: ' . strval(strlen($output)));
         echo $output;
     } else {
         //header('Content-Type: text/plain');
         //echo ('Error: '.$rss_writer_object->error);
     }
 }
Example #2
0
function gen_comment_feeds()
{
    global $dbtable_prefix;
    require_once _BASEPATH_ . '/includes/access_levels.inc.php';
    $short_blog_chars = 400;
    if (allow_at_level('read_blogs')) {
        // if non-members are allowed to read blogs...
        require_once _BASEPATH_ . '/includes/classes/rss_writer.class.php';
        $rss_writer_object = new rss_writer_class();
        $rss_writer_object->specification = '1.0';
        $rss_writer_object->about = _BASEURL_ . '/rss/latest-comments.xml';
        //		$rss_writer_object->rssnamespaces['dc']='http://purl.org/dc/elements/1.1/';
        $properties = array();
        $properties['description'] = 'Latest blog comments on ' . _SITENAME_;
        $properties['link'] = _BASEURL_;
        $properties['title'] = 'Latest Blog Comments';
        //		$properties['dc:date']=mktime(gmdate('H'),gmdate('i'),gmdate('s'),gmdate('m'),gmdate('d'),gmdate('Y'));
        $rss_writer_object->addchannel($properties);
        $query = "SELECT a.`comment_id`,a.`fk_user_id`,c.`alt_url` as `profile_url`,a.`_user`,a.`comment`,b.`post_id`,b.`title`,b.`alt_url` as `post_url` FROM `{$dbtable_prefix}comments_blog` a LEFT JOIN `{$dbtable_prefix}user_profiles` c ON a.`fk_user_id`=c.`fk_user_id`,`{$dbtable_prefix}blog_posts` b WHERE a.`fk_parent_id`=b.`post_id` AND a.`status`=" . STAT_APPROVED . " AND b.`is_public`=1 AND b.`status`=" . STAT_APPROVED . " ORDER BY a.`date_posted` DESC LIMIT 10";
        if (!($res = @mysql_query($query))) {
            trigger_error(mysql_error(), E_USER_ERROR);
        }
        while ($rsrow = mysql_fetch_assoc($res)) {
            $properties = array();
            if (strlen($rsrow['comment']) < $short_blog_chars) {
                $properties['description'] = $rsrow['comment'];
            } else {
                $properties['description'] = substr($rsrow['comment'], 0, strrpos(substr($rsrow['comment'], 0, $short_blog_chars), ' '));
            }
            $properties['description'] = sanitize_and_format($properties['description'], TYPE_STRING, $GLOBALS['__field2format'][TEXT_DB2DISPLAY]);
            if (empty($rsrow['post_url'])) {
                $properties['link'] = _BASEURL_ . '/blog_post_view.php?pid=' . $rsrow['post_id'] . '#comm' . $rsrow['comment_id'];
            } else {
                $properties['link'] = $rsrow['post_url'] . '#comm' . $rsrow['comment_id'];
            }
            $rsrow['title'] = sanitize_and_format($rsrow['title'], TYPE_STRING, $GLOBALS['__field2format'][TEXT_DB2DISPLAY]);
            $properties['title'] = sprintf('%1$s on "%2$s"', $rsrow['_user'], $rsrow['title']);
            //			$properties['dc:date']=$rsrow['date_posted'];
            $rss_writer_object->additem($properties);
        }
        if ($rss_writer_object->writerss($towrite)) {
            require_once _BASEPATH_ . '/includes/classes/fileop.class.php';
            $fileop = new fileop();
            $fileop->file_put_contents(_BASEPATH_ . '/rss/latest-comments.xml', $towrite);
        } else {
            $error = true;
            $topass['message']['type'] = MESSAGE_ERROR;
            $topass['message']['text'] = $rss_writer_object->error;
        }
    }
    return true;
}
Example #3
0
 }
 if (!$prg->getBool('published')) {
     raiseError("not_published_yet");
     exit;
 }
 // define channel
 $properties = array();
 $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId;
 $properties["title"] = $prg->get('title');
 if (empty($properties["title"])) {
     $properties["title"] = 'Untitled';
 }
 $properties["description"] = $prg->get('abstract') ? $prg->get('abstract') : '  ';
 $properties["dc:language"] = $prg->get2LetterLanguageCode();
 $properties["dc:date"] = getW3CDate();
 $rss_writer_object->addchannel($properties);
 // get and cache programme icon
 $prgData = $prg->getAllWithIcon();
 if ($prgData['icon']) {
     // define icon for station
     $properties = array();
     $properties["url"] = $config['cacheUrl'] . "/{$prgId}.png";
     $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId;
     $properties["title"] = "programme icon";
     //$properties["description"]="";
     $rss_writer_object->addimage($properties);
 }
 // add metadata as item
 $properties = array();
 $smarty->assign('ID', $prgId);
 //  $smarty->assign('LANG', 'eng');
Example #4
0
 function &_getRssWriter()
 {
     $url = 'http://' . $_SERVER['SERVER_NAME'] . str_replace('index.php', '', $_SERVER['PHP_SELF']);
     require_once TEST_ROOT . '/lib/xml_writer_class.php';
     require_once TEST_ROOT . '/lib/rss_writer_class.php';
     $rss_writer_object = new rss_writer_class();
     $rss_writer_object->specification = "1.0";
     $rss_writer_object->about = $url . "index.php?output=xml";
     $rss_writer_object->stylesheet = $url . "rss2html.xsl";
     $rss_writer_object->rssnamespaces["dc"] = "http://purl.org/dc/elements/1.1/";
     // Channel Properties
     $properties = array();
     $properties["title"] = "Dokuwiki Unit Test Cases";
     $properties["description"] = "Dokuwiki Unit Test Cases";
     $properties["link"] = "http://wiki.splitbrain.org/";
     $properties["dc:date"] = gmdate("Y-m-d\\TH:i:sO");
     $rss_writer_object->addchannel($properties);
     // Logo like this (if we had one)
     /*
     $properties=array();
     
     $properties["link"]="http://www.phpclasses.org/";
     $properties["title"]="PHP Classes repository logo";
     $properties["description"]="Repository of components and other resources for PHP developers";
     $rss_writer_object->addimage($properties);
     */
     return $rss_writer_object;
 }