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); } }
} // topics $smarty->assign('TOPICS', $prg->getTopics()); // genre $smarty->assign('GENRE', $vocabularies->getGenreName($prg->get('genre_id'))); // language $smarty->assign('LANGUAGE', $prg->getLanguagesLocalized()); // rights sections $smarty->assign('RIGHTS', $prg->getAssociatedObjects('sotf_rights', 'start_time')); $text = $smarty->fetch('rssMeta.htm'); $properties["description"] = $text; //$properties["description"] = $prg->get('abstract'); $properties["title"] = $page->getlocalized('abstract'); $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId . '#general'; //$properties["dc:date"]= $prog->get('production_date'); $rss_writer_object->additem($properties); // add contributors as item $properties = array(); /* $smarty->assign('ROLES', $prg->getRoles()); $text = $smarty->fetch('rssContributors.htm'); $properties["description"] = $text; */ $text = '<br clear="all" />'; foreach ($prg->getRoles() as $role) { $text = $text . '<br />' . $role['contact_data']['name'] . ' (' . $role['role_name'] . ')'; } $properties["title"] = $page->getlocalized('Roles'); $properties["link"] = $config['rootUrl'] . "/get.php/" . $prgId . '#roles'; $properties["description"] = $text; //$properties["dc:date"]= $prog->get('production_date');
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; }