public function display($part = 'all') { switch ($part) { case 'page-menu-only': if (file_exists('theme/' . $this->get_config('es_theme') . '/page_menu.php')) { $page_menu_file = 'theme/' . $this->get_config('es_theme') . '/page_menu.php'; } else { $page_menu_file = 'includes/layout/theme//page_menu.php'; } ob_start(); include $page_menu_file; $page_menu = ob_get_contents(); ob_end_clean(); echo $page_menu; break; case 'posts-only': echo '<div id="new-post"></div>'; $this->get_posts(); break; case 'topbar-only': ob_start(); include 'includes/layout/topbar.php'; $this->topbar = ob_get_contents(); ob_end_clean(); echo $this->topbar; break; case 'sidebar-only': if (file_exists('theme/' . $this->get_config('es_theme') . '/sidebar.php')) { $sidebar_file = 'theme/' . $this->get_config('es_theme') . '/sidebar.php'; } else { $sidebar_file = 'includes/layout/theme/sidebar.php'; } ob_start(); include $sidebar_file; $sidebar = ob_get_contents(); ob_end_clean(); echo $sidebar; break; case 'first-load': if ($this->configFileExists()) { ob_start(); include 'includes/layout/topbar.php'; $this->topbar = ob_get_contents(); ob_end_clean(); $script_uri = 'http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']; if (substr($script_uri, -1) != '/') { $script_uri .= '/'; } $editsee_request = str_replace(str_replace('www.', '', $this->get_config('es_main_url')), '', $script_uri); if (substr($editsee_request, 0, 5) == 'feed/') { include "includes/RSSFeed.class.php"; header("Content-type: text/xml; charset=UTF-8"); $myfeed = new RSSFeed(); $myfeed->SetChannel($this->get_config('es_main_url'), $this->get_config('es_title'), $this->get_config('es_description'), 'en-us', date(Y) . ' ' . $_SERVER['HTTP_HOST'], 'webmaster@' . $_SERVER['HTTP_HOST'], $this->get_config('es_title')); $myfeed->SetImage(''); $query = $this->db->_query("select id,title,urltag,content,date_entered from " . $this->db->get_table_prefix() . "post \n\t\t\t\t\t\t\t\t\t\t\t\t\twhere type='post' and deleted='0' and (date_entered <= NOW())\n\t\t\t\t\t\t\t\t\t\t\t\t\torder by date_entered desc"); while ($post = $query->_fetch_assoc()) { $post['content'] = strip_tags($post['content'], '<br/><br>'); if (strpos($post['content'], '!--full-post--!')) { $post['content'] = substr($post['content'], 0, strpos($post['content'], '!--full-post--!')); $add_dots = true; } else { if (strlen($post['content']) > 280) { $post['content'] = substr(substr($post['content'], 0, 280), 0, strrpos(substr($post['content'], 0, 280), ' ')); $add_dots = true; } } $post['content'] = htmlentities(stripslashes($post['content'])); if ($add_dots) { $post['content'] .= ' [...]'; } $myfeed->SetItem($this->get_config('es_main_url') . 'post/' . $post['id'], $this->get_config('es_main_url') . 'post/' . $post['urltag'], $post['title'], $post['date_entered'], $post['content']); } echo $myfeed->output(); exit; } $editsee_index = ''; if ($editsee_request == '' || $editsee_request == $this->get_config('es_postpage') . '/' || $editsee_request == 'index.php/') { $post_start = 0; $page_number = 1; if ($this->get_config('es_homepage') == '!posts!' || $editsee_request == $this->get_config('es_postpage') . '/') { $this->is_posts = true; } else { $editsee_request = $this->get_config('es_homepage') . '/'; } } if (substr($editsee_request, 0, 5) == 'page/') { $page_number = substr(substr($editsee_request, 5), 0, strpos(substr($editsee_request, 5), '/')); $post_start = ($page_number - 1) * $this->get_config('es_posts_per_page'); $this->is_posts = true; } if ($this->is_posts) { ob_start(); $this->get_posts($post_start); $editsee_index .= ob_get_contents(); ob_end_clean(); } else { $query = $this->db->_query("select id,title from " . $this->db->get_table_prefix() . "post where urltag='" . substr($editsee_request, 0, -1) . "'"); if ($query->_num_rows() == 1) { $this->is_page = true; $page = $query->_fetch_assoc(); $this->title .= ' - ' . $page['title']; $editsee_index .= $this->get_single_post($page['id'], 'full', 'page'); } else { if (substr($editsee_request, 0, 5) == 'post/') { if (!$this->loggedIn()) { $if_notloggedin = ' and draft=0 and (date_entered <= NOW())'; } $query = $this->db->_query("select id,title from " . $this->db->get_table_prefix() . "post \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere (urltag='" . substr($editsee_request, 5, -1) . "' or id='" . substr($editsee_request, 5, -1) . "') \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand deleted=0" . $if_notloggedin); if ($query->_num_rows() == 1) { $this->is_post = true; $post = $query->_fetch_assoc(); $this->title .= ' - ' . $post['title']; $editsee_index .= $this->get_single_post($post['id'], 'full', 'post'); $post_id = $post['id']; ob_start(); include "includes/layout/comment_form.php"; $comment_form = ob_get_contents(); ob_end_clean(); $editsee_index .= $comment_form; } else { $this->is_404 = true; $editsee_index .= '404 not found'; } } else { if (substr($editsee_request, 0, 9) == 'category/') { $this->is_category = true; $category = substr(substr($editsee_request, 9), 0, strpos(substr($editsee_request, 9), '/')); ob_start(); $this->get_posts(0, $category); $editsee_index = ob_get_contents(); ob_end_clean(); } else { $this->is_404 = true; $editsee_index .= '404 not found'; } } } } if (file_exists('theme/' . $this->get_config('es_theme') . '/header.php')) { require_once 'theme/' . $this->get_config('es_theme') . '/header.php'; echo $editsee_index; } if (file_exists('theme/' . $this->get_config('es_theme') . '/index.php')) { require_once 'theme/' . $this->get_config('es_theme') . '/index.php'; } if (file_exists('theme/' . $this->get_config('es_theme') . '/footer.php')) { require_once 'theme/' . $this->get_config('es_theme') . '/footer.php'; } } else { ob_start(); include "includes/layout/install.php"; $install_page = ob_get_contents(); ob_end_clean(); echo $install_page; } } }
$ts = time(); $first = mktime(0, 0, 1, date('n', $ts), date('j', $ts), date('Y', $ts)); $last = mktime(23, 59, 59, date('n', $ts), date('j', $ts), date('Y', $ts)); /*echo $first; echo '<br>'; echo $last; echo '<br>'; echo date('j', $ts)-1; echo '<br>'; echo date('Y-m-d'); echo '<br>'; echo date('Y-m-d H:i s A', $first); echo '<br>'; echo date('Y-m-d H:i s A'); echo '<br>'; echo date('Y-m-d H:i s A', $last); //exit;*/ $myfeed = new RSSFeed(); $myfeed->SetChannel('http://www.v2nportal.com/mhealth/rss.rss', 'mHealth', '', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mHealth'); if (@$_REQUEST['feed_id']) { $category = strtoupper(urldecode($_REQUEST['feed_id'])); $sql = "SELECT * from tip t join category c where c.id = t.category_id and UPPER(c.name) = '{$category}' and t.schedule_time between {$first} and {$last} order by t.id desc"; } else { $sql = "SELECT * from tip t join category c where c.id = t.category_id and t.schedule_time between {$first} and {$last} order by t.id desc"; } $feeds_array = R::getAll($sql); //var_dump($feeds_array); foreach ($feeds_array as $feed) { $myfeed->SetItem('http://www.v2nportal.com/mhealth/rss.php?feed_id=' . $feed['name'], 'mHealth', stripslashes($feed['gist'])); } echo $myfeed->output();
$ts = time(); $first = mktime(0, 0, 1, date('n', $ts), date('j', $ts), date('Y', $ts)); $last = mktime(23, 59, 59, date('n', $ts), date('j', $ts), date('Y', $ts)); /*echo $first; echo '<br>'; echo $last; echo '<br>'; echo date('j', $ts)-1; echo '<br>'; echo date('Y-m-d'); echo '<br>'; echo date('Y-m-d H:i s A', $first); echo '<br>'; echo date('Y-m-d H:i s A'); echo '<br>'; echo date('Y-m-d H:i s A', $last); //exit;*/ $myfeed = new RSSFeed(); $myfeed->SetChannel('http://www.v2nportal.com/mhealth/rss.rss', 'mHealth', 'Free Daily Health Tips Via RSS Feeds', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mHealth'); if (@$_REQUEST['feed_id']) { $category = strtoupper(urldecode($_REQUEST['feed_id'])); $sql = "SELECT * from tip t join category c where c.id = t.category_id and UPPER(c.name) = '{$category}' and t.schedule_time between {$first} and {$last} order by t.id desc"; } else { $sql = "SELECT * from tip t join category c where c.id = t.category_id and t.schedule_time between {$first} and {$last} order by t.id desc"; } $feeds_array = R::getAll($sql); //var_dump($feeds_array); foreach ($feeds_array as $feed) { $myfeed->SetItem('http://www.v2nportal.com/mhealth/rss.php?feed_id=' . $feed['name'], date('Y-m-d', $feed['schedule_time']), stripslashes($feed['gist'])); } echo $myfeed->output();
public static function getRSS($data = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $config =& JFactory::getConfig(); $query = $db->getQuery(true); $params = JComponentHelper::getParams('com_tracker'); $lang = JFactory::getLanguage(); // Get the items for the RSS channel $query->select('t.fid'); // We need to use one field to do the preg_match. $used_fields = $data->item_title . ' ' . $data->item_description; // Select the fields in the item title and description if (preg_match('/{name}/', $used_fields)) { $query->select('t.name'); } if (preg_match('/{description}/', $used_fields)) { $query->select('t.description'); } if (preg_match('/{size}/', $used_fields)) { $query->select('t.size'); } if (preg_match('/{upload_date}/', $used_fields)) { $query->select('t.created_time'); } if (preg_match('/{seeders}/', $used_fields)) { $query->select('t.seeders'); } if (preg_match('/{leechers}/', $used_fields)) { $query->select('t.leechers'); } if (preg_match('/{completed}/', $used_fields)) { $query->select('t.completed'); } // Join on category table. if (preg_match('/{category}/', $used_fields) || $data->rss_type == 1) { $query->select('c.title AS category'); $query->join('LEFT', '#__categories AS c on c.id = t.categoryID'); } // Join on user table. if (preg_match('/{uploader}/', $used_fields)) { $query->select('u.username as user'); $query->join('LEFT', '#__users AS u on u.id = r.created_user_id'); } // Join on licenses table if (preg_match('/{license}/', $used_fields) || $data->rss_type == 2) { $query->select('l.shortname as license'); $query->join('LEFT', '#__tracker_licenses AS l on l.id = t.licenseID'); } $query->from('#__tracker_torrents AS t'); // Show torrents with the selected categories if ($data->rss_type == 1) { $query->where('t.categoryID IN ( ' . $data->rss_type_items . ' )'); // Or show torrents with the selected licenses } else { if ($data->rss_type == 2) { $query->where('t.licenseID IN ( ' . $data->rss_type_items . ' )'); } } $query->order('t.fid DESC'); // Limit the number of items we get from the DB $db->setQuery($query, 0, $data->item_count); $items = $db->loadObjectList(); $feed = new RSSFeed(); $feed->SetChannel(JURI::getInstance()->toString(), $data->channel_title, $data->channel_description, $lang->getTag(), '®' . $config->getValue('config.sitename') . date("Y"), $data->user, $data->name); // RSS Name foreach ($items as $i => $item) { // Now we need to prepare the preg_replace items. It's an ugly code but didn't found a better one $source = array(); $destination = array(); if (preg_match('/{name}/', $used_fields)) { array_push($source, '/{name}/'); array_push($destination, $item->name); } if (preg_match('/{description}/', $used_fields)) { array_push($source, '/{description}/'); array_push($destination, $item->description); } if (preg_match('/{link}/', $used_fields)) { array_push($source, '/{link}/'); array_push($destination, 'JRoute::_(JURI::base()."index.php?option=com_tracker&view=torrent&id=".$item->fid, true, -1)'); } if (preg_match('/{size}/', $used_fields)) { array_push($source, '/{size}/'); array_push($destination, $item->size); } if (preg_match('/{upload_date}/', $used_fields)) { array_push($source, '/{upload_date}/'); array_push($destination, $item->created_time); } if (preg_match('/{seeders}/', $used_fields)) { array_push($source, '/{seeders}/'); array_push($destination, $item->seeders); } if (preg_match('/{leechers}/', $used_fields)) { array_push($source, '/{leechers}/'); array_push($destination, $item->leechers); } if (preg_match('/{completed}/', $used_fields)) { array_push($source, '/{completed}/'); array_push($destination, $item->completed); } if (preg_match('/{category}/', $used_fields)) { array_push($source, '/{category}/'); array_push($destination, $item->category); } if (preg_match('/{uploader}/', $used_fields)) { array_push($source, '/{uploader}/'); array_push($destination, $item->user); } if (preg_match('/{license}/', $used_fields)) { array_push($source, '/{license}/'); array_push($destination, $item->license); } $name = preg_replace($source, $destination, $data->item_title); $description = preg_replace($source, $destination, $data->item_description); $feed->SetItem(JRoute::_(JURI::base() . 'index.php?option=com_tracker&view=torrent&id=' . $item->fid, true, -1), $name, $description); } echo $feed->output(); }
$c = db_connect(); $res = array(); $s = oci_parse($c, $sql); if ($bind != null) { foreach ($bind as $key => $value) { oci_bind_by_name($s, ":" . $key, htmlentities($value, ENT_QUOTES)); } } $res = oci_execute($s); return $res; } include_once 'lib/RSS.php'; $myfeed = new RSSFeed(); $myfeed->SetChannel('http://apps.v2nportal.com/services/marss/', 'mAgric Pest', '', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mAgric Pest'); $series = array('1' => '1121', '2' => '1141', '3' => '1161', '4' => '1101', '5' => '1081', '6' => '1181'); $id = $_REQUEST['cat']; $cid = $series[$id]; if (!$cid) { exit; } $tip = get_tips($cid); $myfeed->SetItem('http://www.v2nportal.com/marss/rss.php?feed_id=' . $tip->CATEGORY, 'mAgric', $tip->MESSAGE); echo $myfeed->output(); function get_tips($id) { $today = date('Y-m-d'); $sql = "select * from alert where service_id = {$id} and to_char(schedule, 'yyyy-mm-dd')='{$today}'"; $res = array_shift(db_query($sql)); //var_dump($res); exit; return $res; }
// GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // ----------------------------------------------------------------- // // Page: "RSS" - creates a RSS feed containing requirements changes for all users attached to the projects include "rss.class.php"; session_start(); include "admin/inc/conn.php"; //include settings file include "admin/inc/func.php"; //include functions file include "ini/params.php"; //include configuration file $query = "select * from users"; $rs = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($rs)) { //Rss $myfeed = new RSSFeed(); $myfeed->SetChannel(PROJECT_URL . "/" . $row['u_id'] . ".rss", htmlspecialchars($row['u_name']) . "'s feed", "Feed contains last changes in requirements of my projects", "en-us", "", htmlspecialchars($row['u_name']), "Requirements changes"); $query3 = "select r.*, p.p_name from requirements r, project_users pu, projects p where r.r_change_date>=DATE_SUB(CONCAT(CURDATE(), ' 00:00:00'), INTERVAL 1 DAY) and r.r_p_id=pu.pu_p_id and pu.pu_p_id=p.p_id and pu.pu_u_id=" . $row['u_id']; $rs3 = mysql_query($query3) or die(mysql_error()); while ($row3 = mysql_fetch_array($rs3)) { $myfeed->SetItem(PROJECT_URL . "/index.php?inc=view_requirement&r_id=" . $row3['r_id'], htmlspecialchars($row3['r_name']) . " (" . htmlspecialchars($row3['p_name']) . ")", strip_tags($row3['r_desc'])); } $fp = fopen("RSS/" . $row['u_id'] . ".xml", "wb"); fwrite($fp, $myfeed->output()); fclose($fp); }