示例#1
0
            $properties["dc:date"] = $prog['production_date'];
            $rss_writer_object->additem($properties);
        }
    } else {
        $properties = array();
        $properties["description"] = '';
        $properties["link"] = $config['rootUrl'];
        $properties["title"] = "no new items";
        //$properties["dc:date"]= ;
        $rss_writer_object->additem($properties);
    }
    //  If your channel has a search page, after adding the channel items, specify a search form details this way.
    $properties = array();
    // The name property if the name of the text input form field
    $properties["name"] = "pattern";
    $properties["link"] = $config['rootUrl'] . "/search.php?language=any_language";
    $properties["title"] = "Search for:";
    $properties["description"] = "Search in StreamOnTheFly";
    $rss_writer_object->addtextinput($properties);
}
if ($rss_writer_object->writerss($output)) {
    // If the document was generated successfully, you may now output it.
    Header("Content-Type: text/xml; charset=\"" . $rss_writer_object->outputencoding . "\"");
    Header("Content-Length: " . strval(strlen($output)));
    echo $output;
} else {
    //  If there was an error, output it as well.
    Header("Content-Type: text/plain");
    echo "Error: " . $rss_writer_object->error;
}
$page->logRequest();
示例#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;
}
示例#3
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);
     }
 }
示例#4
0
     $properties['title'] = 'Site news';
     $properties['dc:date'] = mktime(gmdate('H'), gmdate('i'), gmdate('s'), gmdate('m'), gmdate('d'), gmdate('Y'));
     $rss_writer_object->addchannel($properties);
     $query = "SELECT `news_title`,`news_body`,UNIX_TIMESTAMP(`date_posted`) as `date_posted` FROM `{$dbtable_prefix}site_news` ORDER BY `news_id` DESC";
     if (!($res = @mysql_query($query))) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     while ($rsrow = mysql_fetch_assoc($res)) {
         $properties = array();
         $properties['description'] = $rsrow['news_body'];
         $properties['link'] = '';
         $properties['title'] = $rsrow['news_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/site_news.xml', $towrite);
     } else {
         $error = true;
         $topass['message']['type'] = MESSAGE_ERROR;
         $topass['message']['text'] = $rss_writer_object->error;
     }
 } else {
     $nextpage = 'admin/site_news_addedit.php';
     // 		you must re-read all textareas from $_POST like this:
     //		$input['x']=addslashes_mq($_POST['x']);
     $input['news_body'] = addslashes_mq($_POST['news_body']);
     $input = sanitize_and_format($input, TYPE_STRING, FORMAT_HTML2TEXT_FULL | FORMAT_STRIPSLASH);
     $topass['input'] = $input;