Ejemplo n.º 1
0
 public function rss()
 {
     requirePermission("view");
     // HACK FIX: Wipe the output buffer, because something is placing a tab in it.
     ob_end_clean();
     // Load the XML helper
     $this->load->helper('xml');
     // Get the articles with the upper limit decided by our config.
     $this->news_articles = $this->news_model->getArticles(0, $this->config->item('news_limit'));
     // For each key we need to add the special values that we want to print
     foreach ($this->news_articles as $key => $article) {
         $this->news_articles[$key]['title'] = xml_convert(langColumn($article['headline']));
         $this->news_articles[$key]['content'] = xml_convert(langColumn($article['content']));
         $this->news_articles[$key]['link'] = base_url() . 'news/view/' . $article['id'];
         $this->news_articles[$key]['date'] = date(DATE_RSS, $article['timestamp']);
         $this->news_articles[$key]['author'] = $this->user->getNickname($article['author_id']);
         $this->news_articles[$key]['tags'] = $this->news_model->getTags($article['id']);
     }
     $data['link'] = $this->config->site_url();
     $data['domain'] = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
     $data['feed_url'] = base_url() . 'news/rss';
     $data['page_description'] = $this->config->item('rss_description');
     $data['page_language'] = $this->config->item('rss_lang');
     $data['articles'] = $this->news_articles;
     header('Content-Type: text/xml; charset=UTF-8');
     echo $this->template->loadPage('rss.tpl', $data);
 }
Ejemplo n.º 2
0
	function _build_feed( $posts = array() )
	{
		$this->data->rss->encoding = $this->config->item('charset');
		$this->data->rss->feed_name = $this->settings->item('site_name');
		$this->data->rss->feed_url = base_url();
		$this->data->rss->page_description = sprintf($this->lang->line('blog_rss_posts_title'), $this->settings->item('site_name'));
		$this->data->rss->page_language = 'en-gb';
		$this->data->rss->creator_email = $this->settings->item('contact_email');
		
		if(!empty($posts))
		{        
			foreach($posts as $row)
			{
				//$row->created_on = human_to_unix($row->created_on);
				$row->link = site_url('blog/' .date('Y/m', $row->created_on) .'/'. $row->slug);
				$row->created_on = standard_date('DATE_RSS', $row->created_on);
				
				$item = array(
					//'author' => $row->author,
					'title' => xml_convert($row->title),
					'link' => $row->link,
					'guid' => $row->link,
					'description'  => $row->intro,
					'date' => $row->created_on
				);				
				$this->data->rss->items[] = (object) $item;
			} 
		}	
	}
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  */
 public function __construct($str = '')
 {
     $protect_all = ee()->TMPL->fetch_param('protect_entities') === 'yes' ? TRUE : FALSE;
     $str = $str == '' ? ee()->TMPL->tagdata : $str;
     // Load the XML Helper
     ee()->load->helper('xml');
     $str = xml_convert(strip_tags($str), $protect_all);
     // Strip [email] tags
     $str = preg_replace("/\\[email=(.*?)\\](.*?)\\[\\/email\\]/i", '\\2', $str);
     $str = preg_replace("/\\[email\\](.*?)\\[\\/email\\]/i", '\\1', $str);
     $this->return_data = trim(str_replace(' ', ' ', $str));
 }
Ejemplo n.º 4
0
	/**
	 * Constructor
	 *
	 */
	function Xml_encode($str = '')
	{
		$this->EE =& get_instance();
		
		$protect_all = ($this->EE->TMPL->fetch_param('protect_entities') === 'yes') ? TRUE : FALSE;
		
		$str = ($str == '') ? $this->EE->TMPL->tagdata : $str;

		// Load the XML Helper
		$this->EE->load->helper('xml');
		
		$str = xml_convert(strip_tags($str), $protect_all);
		$this->return_data = trim(str_replace(' ', ' ', $str));
	}
Ejemplo n.º 5
0
 function index()
 {
     $board =& $this->board;
     $bo_table = $board['bo_table'];
     if ($board['bo_read_level'] > 1) {
         echo '비회원의 접근이 가능하지 않습니다.';
         exit;
     }
     if (!$board['bo_use_rss']) {
         echo 'RSS를 지원하지 않습니다.';
         exit;
     }
     $this->load->helper('xml');
     $base_url = $this->config->item('base_url');
     $this->db->select('wr_id, mb_id, ca_code, wr_subject, wr_content, wr_datetime');
     $qry = $this->db->get_where('ki_write', array('bo_table' => $bo_table), 15);
     $result = $qry->result_array();
     if ($board['bo_use_category']) {
         $CI =& get_instance();
         $CI->load->model('Category_model');
         $category = $CI->Category_model->get_category('bo_' . $bo_table);
     }
     header("Content-type: text/xml; charset=" . $this->config->item('charset'));
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     echo "<?xml version=\"1.0\" encoding=\"" . $this->config->item('charset') . "\"?>\n";
     echo "<rss version=\"2.0\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:taxo=\"http://purl.org/rss/1.0/modules/taxonomy/\">\n";
     echo "<channel>\n";
     echo "<title><![CDATA[" . xml_convert($board['bo_subject']) . "]]></title>\n";
     echo "<link>" . $base_url . '/board/' . $bo_table . "</link>\n";
     echo "<description></description>\n";
     echo "<language>ko</language>\n";
     echo "<generator>Tested.co.kr</generator>\n";
     echo "<pubDate>" . date('r', time()) . "</pubDate>\n";
     foreach ($result as $row) {
         echo "<item>\n";
         echo "<author>" . $row['mb_id'] . "</author>\n";
         if ($board['bo_use_category']) {
             echo "<category><![CDATA[" . xml_convert($category[$row['ca_code']]) . "]]></category>\n";
         }
         echo "<title><![CDATA[" . xml_convert($row['wr_subject']) . "]]></title>\n";
         echo "<link>" . $base_url . '/board/' . $bo_table . '/view/wr_id/' . $row['wr_id'] . "</link>\n";
         echo "<description><![CDATA[" . xml_convert(cut_str(preg_replace("/\\s+&nbsp;+/", '', strip_tags(htmlspecialchars_decode($row['wr_content']))), 300)) . "]]></description>\n";
         echo "<pubDate>" . date('r', strtotime($row['wr_datetime'])) . "</pubDate>\n";
         echo "</item>\n";
     }
     echo "</channel>\n";
     echo "</rss>\n";
 }
Ejemplo n.º 6
0
 function _build_feed($posts = array())
 {
     $this->data->rss->encoding = $this->config->item('charset');
     $this->data->rss->feed_name = $this->settings->item('site_name');
     $this->data->rss->feed_url = base_url();
     $this->data->rss->page_description = 'News articles for ' . $this->settings->item('site_name');
     $this->data->rss->page_language = 'en-gb';
     $this->data->rss->creator_email = $this->settings->item('contact_email');
     if (!empty($posts)) {
         foreach ($posts as $row) {
             //$row->created_on = human_to_unix($row->created_on);
             $row->link = site_url('news/' . date('Y/m', $row->created_on) . '/' . $row->slug);
             $row->created_on = standard_date('DATE_RSS', $row->created_on);
             $item = array('title' => xml_convert($row->title), 'link' => $row->link, 'guid' => $row->link, 'description' => str_replace('/img/post_resources/', base_url() . 'img/post_resources/', $row->body), 'date' => $row->created_on);
             $this->data->rss->items[] = (object) $item;
         }
     }
 }
 function xml_from_result_object($result, $params = array())
 {
     // Set our default values
     foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) {
         if (!isset($params[$key])) {
             $params[$key] = $val;
         }
     }
     // Create variables for convenience
     extract($params);
     // Generate the result
     $xml = "<{$root}>" . $newline;
     foreach ($result as $row) {
         $xml .= $tab . "<{$element}>" . $newline;
         foreach ($row as $key => $val) {
             $xml .= $tab . $tab . "<{$key}>" . xml_convert($val) . "</{$key}>" . $newline;
         }
         $xml .= $tab . "</{$element}>" . $newline;
     }
     $xml .= "</{$root}>" . $newline;
     return $xml;
 }
Ejemplo n.º 8
0
 public function _build_feed($posts = array(), $suffix = '')
 {
     $data = new stdClass();
     $data->rss = new stdClass();
     $data->rss->encoding = $this->config->item('charset');
     $data->rss->feed_name = Settings::get('site_name') . ' ' . $suffix;
     $data->rss->feed_url = base_url();
     $data->rss->page_description = sprintf($this->lang->line('blog:rss_posts_title'), Settings::get('site_name'));
     $data->rss->page_language = 'en-gb';
     $data->rss->creator_email = Settings::get('contact_email');
     if (!empty($posts)) {
         foreach ($posts as $row) {
             //$row->created_on = human_to_unix($row->created_on);
             $row->link = site_url('blog/' . date('Y/m', $row->created_on) . '/' . $row->slug);
             $row->created_on = date(DATE_RSS, $row->created_on);
             $intro = isset($row->intro) ? $row->intro : $row->body;
             $item = array('title' => xml_convert($row->title), 'link' => $row->link, 'guid' => $row->link, 'description' => $intro, 'date' => $row->created_on, 'category' => $row->category_title);
             $data->rss->items[] = (object) $item;
         }
     }
     return $data;
 }
Ejemplo n.º 9
0
 function export($datas)
 {
     //tempname('FCPATH')
     $out = "<traspaso>\n";
     foreach ($datas as $data) {
         if (isset($data['select']) and count($data['select']) > 0) {
             $this->ci->db->select($data['select']);
         }
         if (isset($data['where'])) {
             $this->ci->db->where($data['where'], NULL, FALSE);
         } else {
             $data['where'] = '';
         }
         if (isset($data['distinc']) and $data['distinc']) {
             $this->db->distinct();
         }
         $this->ci->db->from($data['table']);
         $query = $this->ci->db->get();
         if ($query->num_rows() > 0) {
             $out .= "<esquema>";
             $out .= "<tabla>{$data['table']}</tabla>";
             $out .= "<where>{$data['where']}</where>";
             $out .= "<data>";
             foreach ($query->result_array() as $row) {
                 $out .= "    <fila>\n";
                 foreach ($row as $campo => $valor) {
                     $out .= "<campo nombre='{$campo}'>" . xml_convert($valor) . "</campo>";
                 }
                 $out .= "</fila>";
             }
             $out .= "</data>";
             $out .= "</esquema>\n";
         }
     }
     $out .= "</traspaso>";
     return $out;
 }
Ejemplo n.º 10
0
 /** -------------------------------------
 	/**  Convert delimited text to XML
 	/** -------------------------------------*/
 function delimited_to_xml($params, $reduce_null = FALSE)
 {
     if (!is_array($params)) {
         return FALSE;
     }
     $defaults = array('data' => NULL, 'structure' => array(), 'root' => 'root', 'element' => 'element', 'delimiter' => "\t", 'enclosure' => '');
     foreach ($defaults as $key => $val) {
         if (!isset($params[$key])) {
             $params[$key] = $val;
         }
     }
     extract($params);
     /*
       $data 		- string containing delimited data
       $structure 	- array providing a key for $data elements
       $root			- the root XML document tag name
       $element		- the tag name for the element used to enclose the tag data
       $delimiter	- the character delimiting the text, default is \t (tab)
       $enclosure	- character used to enclose the data, such as " in the case of $data = '"item", "item2", "item3"';
     */
     if ($data === NULL or !is_array($structure) or count($structure) == 0) {
         return FALSE;
     }
     /** -------------------------------------
     		/**  Convert delimited text to array
     		/** -------------------------------------*/
     $data_arr = array();
     $data = str_replace(array("\r\n", "\r"), "\n", $data);
     $lines = explode("\n", $data);
     if (empty($lines)) {
         $this->errors[] = "No data to work with";
         return FALSE;
     }
     if ($enclosure == '') {
         foreach ($lines as $key => $val) {
             if (!empty($val)) {
                 $data_arr[$key] = explode($delimiter, $val);
             }
         }
     } else {
         foreach ($lines as $key => $val) {
             if (!empty($val)) {
                 preg_match_all("/" . preg_quote($enclosure) . "(.*?)" . preg_quote($enclosure) . "/si", $val, $matches);
                 $data_arr[$key] = $matches[1];
                 if (empty($data_arr[$key])) {
                     $this->errors[] = 'Structure mismatch, skipping line: ' . $val;
                     unset($data_arr[$key]);
                 }
             }
         }
     }
     //  Construct the XML
     $xml = "<{$root}>\n";
     foreach ($data_arr as $datum) {
         if (!empty($datum) and count($datum) == count($structure)) {
             $xml .= "\t<{$element}>\n";
             foreach ($datum as $key => $val) {
                 if ($reduce_null == TRUE && $structure[$key] == '') {
                     continue;
                 }
                 $xml .= "\t\t<{$structure[$key]}>" . xml_convert($val) . "</{$structure[$key]}>\n";
             }
             $xml .= "\t</{$element}>\n";
         } else {
             $details = '';
             foreach ($datum as $val) {
                 $details .= "{$val}, ";
             }
             $this->errors[] = 'Line does not match structure: ' . substr($details, 0, -2);
         }
     }
     $xml .= "</{$root}>\n";
     if (!stristr($xml, "<{$element}>")) {
         $this->errors[] = "No valid elements to build XML";
         return FALSE;
     }
     return $xml;
 }
Ejemplo n.º 11
0
 /**
  * Generate XML data from a query result object
  *
  * @param	object	$query	Query result object
  * @param	array	$params	Any preferences
  * @return	string
  */
 public function getXMLFromResult(ResultInterface $query, $params = array())
 {
     // Set our default values
     foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) {
         if (!isset($params[$key])) {
             $params[$key] = $val;
         }
     }
     // Create variables for convenience
     extract($params);
     // Load the xml helper
     //		get_instance()->load->helper('xml');
     // Generate the result
     $xml = '<' . $root . '>' . $newline;
     while ($row = $query->getUnbufferedRow()) {
         $xml .= $tab . '<' . $element . '>' . $newline;
         foreach ($row as $key => $val) {
             $xml .= $tab . $tab . '<' . $key . '>' . xml_convert($val) . '</' . $key . '>' . $newline;
         }
         $xml .= $tab . '</' . $element . '>' . $newline;
     }
     return $xml . '</' . $root . '>' . $newline;
 }
Ejemplo n.º 12
0
		<dc:creator>info@newsporta.com</dc:creator>

		<dc:rights>Copyright <?php 
echo gmdate("Y", time());
?>
</dc:rights>
		<admin:generatorAgent rdf:resource="http://www.newsportal.com/" />

		<?php 
foreach ($data['news'] as $news) {
    ?>

			<item>

				<title><?php 
    echo xml_convert($news->title);
    ?>
</title>
				<link><?php 
    echo base_url('news/detail/' . $news->idpost);
    ?>
</link>
				<guid><?php 
    echo base_url('news/detail/' . $news->idpost);
    ?>
</guid>

				<description><![CDATA[ <?php 
    echo character_limiter($news->body, 200);
    ?>
 ]]></description>
Ejemplo n.º 13
0
	    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	
	    <dc:rights>Copyright <?php 
echo gmdate('Y', strtotime($last_updated));
?>
</dc:rights>
	    
	    <?php 
if (!empty($posts)) {
    ?>
		    <?php 
    foreach ($posts as $post) {
        ?>
		    <item>
				<title><?php 
        echo xml_convert($post->title);
        ?>
</title>
				<link><?php 
        echo $post->url;
        ?>
</link>
				<guid><?php 
        echo $post->url;
        ?>
</guid>
				<pubDate><?php 
        echo $post->rss_date;
        ?>
</pubDate>
				<description><![CDATA[
Ejemplo n.º 14
0
 /**
  * Log Search terms
  *
  * @access	public
  * @param	string
  * @param	string
  * @return	void
  */
 public function log_search_terms($terms = '', $type = 'site')
 {
     if ($terms == '' or ee()->db->table_exists('exp_search_log') === FALSE) {
         return;
     }
     if (ee()->config->item('enable_search_log') == 'n') {
         return;
     }
     ee()->load->helper('xml');
     $search_log = array('member_id' => ee()->session->userdata('member_id'), 'screen_name' => ee()->session->userdata('screen_name'), 'ip_address' => ee()->input->ip_address(), 'search_date' => ee()->localize->now, 'search_type' => $type, 'search_terms' => xml_convert(ee()->functions->encode_ee_tags(ee()->security->xss_clean($terms), TRUE)), 'site_id' => ee()->config->item('site_id'));
     ee()->db->query(ee()->db->insert_string('exp_search_log', $search_log));
     // Prune Database
     srand(time());
     if (rand() % 100 < 5) {
         $max = !is_numeric(ee()->config->item('max_logged_searches')) ? 500 : ee()->config->item('max_logged_searches');
         $query = ee()->db->query("SELECT MAX(id) as search_id FROM exp_search_log WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "'");
         $row = $query->row_array();
         if (isset($row['search_id']) && $row['search_id'] > $max) {
             ee()->db->query("DELETE FROM exp_search_log WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "' AND id < " . ($row['search_id'] - $max) . "");
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * RSS method
  * @access public
  * @param array $url_segments The URL segments
  * @return void
  */
 public function _rss($url_segments)
 {
     // Remove the .rss suffix
     $url_segments += array(preg_replace('/.rss$/', '', array_pop($url_segments)));
     // Fetch this page from the database via cache
     $page = $this->cache->model('pages_m', 'get_by_path', array($url_segments));
     // If page is missing or not live (and not an admin) show 404
     if (empty($page) or $page->status == 'draft' and $this->user->group !== 'admin' or !$page->rss_enabled) {
         // Will try the page then try 404 eventually
         $this->_page('404');
         return;
     }
     $children = $this->cache->model('pages_m', 'get_many_by', array(array('parent_id' => $page->id, 'status' => 'live')));
     $data->rss->title = ($page->meta_title ? $page->meta_title : $page->title) . ' | ' . $this->settings->site_name;
     $data->rss->description = $page->meta_description;
     $data->rss->link = site_url($url_segments);
     $data->rss->creator_email = $this->settings->contact_email;
     if (!empty($children)) {
         $this->load->helper(array('date', 'xml'));
         foreach ($children as &$row) {
             $path = $this->pages_m->get_path_by_id($row->id);
             $row->link = site_url($path);
             $row->created_on = standard_date('DATE_RSS', $row->created_on);
             $item = array('title' => xml_convert($row->title), 'link' => $row->link, 'guid' => $row->link, 'description' => $row->meta_description, 'date' => $row->created_on);
             $data->rss->items[] = (object) $item;
         }
     }
     $this->load->view('rss', $data);
 }
Ejemplo n.º 16
0
	    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	
	    <dc:rights>Copyright <?php 
echo gmdate('Y', time());
?>
</dc:rights>
	    
	    <?php 
if ($posts) {
    ?>
		    <?php 
    foreach ($posts as $post) {
        ?>
		    <item>
				<title><?php 
        echo xml_convert($post['title']);
        ?>
</title>
				<link><?php 
        echo base_url() . 'blog/post/' . date('Y', strtotime($post['date_posted'])) . '/' . date('m', strtotime($post['date_posted'])) . '/' . date('d', strtotime($post['date_posted'])) . '/' . $post['url_title'] . '/';
        ?>
</link>
				<guid><?php 
        echo base_url() . 'blog/post/' . date('Y', strtotime($post['date_posted'])) . '/' . date('m', strtotime($post['date_posted'])) . '/' . date('d', strtotime($post['date_posted'])) . '/' . $post['url_title'] . '/';
        ?>
</guid>
				<description><![CDATA[
				<?php 
        echo $post['excerpt'];
        ?>
		      	]]>
Ejemplo n.º 17
0
</dc:rights>
        <admin:generatorAgent rdf:resource="http://www.codefight.org/"/>

        <?php 
foreach ($posts->result() as $entry) {
    $link = $this->cf_data_model->link_clean($entry->page_title);
    $menu_id = explode(',', $entry->menu_id);
    $menu_id = array_filter($menu_id);
    $menu_id = array_shift($menu_id);
    $link = "{$entry->page_type}/{$menu_id}/{$entry->page_id}/{$link}";
    ?>

        <item>

            <title><?php 
    echo xml_convert($entry->name);
    ?>
</title>
            <link><?php 
    echo site_url($link);
    ?>
#cmnt<?php 
    echo $entry->page_comment_id;
    ?>
</link>
            <guid><?php 
    echo site_url($link);
    ?>
#cmnt<?php 
    echo $entry->page_comment_id;
    ?>
Ejemplo n.º 18
0
    <dc:rights>Copyright <?php 
echo gmdate("Y", time());
?>
</dc:rights>
    <admin:generatorAgent rdf:resource="http://www.codeigniter.com/" />

<?php 
foreach ($posts as $entry) {
    $title = $entry['title'];
    $published = $entry['published'];
    include 'permalink.php';
    $published = $entry['pubdate'];
    ?>
    <item>
      <title><?php 
    echo xml_convert($entry['title']);
    ?>
</title>
      <link><?php 
    echo $permalink;
    ?>
</link>
      <guid><?php 
    echo $permalink;
    ?>
</guid>
      <description><![CDATA[
      <?php 
    echo $entry['text'];
    ?>
      ]]></description>
 public function test_xml_convert()
 {
     $this->assertEquals('&lt;tag&gt;my &amp; test &#45; &lt;/tag&gt;', xml_convert('<tag>my & test - </tag>'));
 }
Ejemplo n.º 20
0
</title>
		<dc:language><?php 
echo $page_language;
?>
</dc:language>
		<dc:rights>Copyright <?php 
echo gmdate("Y", time());
?>
</dc:rights>

		<?php 
foreach ($posts->result() as $row) {
    ?>
		<item>
			<title><?php 
    echo xml_convert($row->c_title);
    ?>
</title>
			<link><?php 
    echo base_url($row->r_url_rw . '/' . $row->c_url_rw);
    ?>
</link>
			<guid><?php 
    echo base_url($row->r_url_rw . '/' . $row->c_url_rw);
    ?>
</guid>
			<?php 
    $c_content = strip_tags($row->c_content);
    ?>
			<description>
				<?php 
Ejemplo n.º 21
0
 function xml_report($query)
 {
     $this->load->helper('xml');
     echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
     echo "<items>\n";
     foreach ($query as $details) {
         echo "\t<item>\n";
         foreach ($details as $attribute => $value) {
             if ($attribute == "man_ip_address") {
                 $value = ip_address_from_db($value);
             }
             $value = xml_convert($value);
             echo "\t\t<" . $attribute . ">" . $value . "</" . $attribute . ">\n";
         }
         echo "\t</item>\n";
     }
     echo "</items>\n";
     header('Content-Type: text/xml');
     header('Content-Disposition: attachment;filename="' . $this->data['heading'] . '.xml"');
     header('Cache-Control: max-age=0');
 }
Ejemplo n.º 22
0
	</url>
	
	<?php 
foreach ($menus as $key => $menu) {
    switch ($menu->route) {
        case 1:
            $links = $menu->links;
            break;
        case 2:
            $links = $menu->links;
            break;
        case 3:
            $links = "m/" . $menu->slug;
            break;
        default:
            $links = "#";
            break;
    }
    ?>
	<url>
		<loc><?php 
    echo @xml_convert(base_url($links));
    ?>
</loc>
		<priority>0.5</priority>
	</url>
	<?php 
}
?>
	
</urlset>
Ejemplo n.º 23
0
 /** -----------------------------------
 	/**  View a Single Message
 	/** -----------------------------------*/
 function view_message($copy_id = '')
 {
     /** -----------------------------------
     		/**  What Private Message?
     		/** -----------------------------------*/
     if ($copy_id == '') {
         if ($this->allegiance == 'cp' && ee()->input->get_post('msg') !== FALSE && is_numeric(ee()->input->get_post('msg'))) {
             $copy_id = ee()->input->get_post('msg');
         } elseif ($this->allegiance == 'user' && $this->cur_id != '' && is_numeric($this->cur_id)) {
             $copy_id = $this->cur_id;
         }
     }
     /** -----------------------------------
     		/**  Retrieve Data
     		/** -----------------------------------*/
     $data = $this->_message_data($copy_id, '', $this->member_id);
     if ($data === FALSE) {
         return $this->_error_page('invalid_message');
     }
     if (ee()->config->item('enable_censoring') == 'y' && ee()->config->item('censored_words') != '') {
         ee()->load->library('typography');
         ee()->typography->initialize();
         $data['subject'] = ee()->typography->filter_censored_words($data['subject']);
         $data['body'] = ee()->typography->filter_censored_words($data['body']);
     }
     // Load the XML Helper
     ee()->load->helper('xml');
     $this->single_parts['include']['subject'] = $data['subject'];
     $this->single_parts['include']['body'] = $data['body'];
     $this->single_parts['include']['recipients'] = xml_convert($this->convert_recipients($data['recipients'], 'string', 'screen_name'));
     $this->single_parts['include']['cc'] = $data['cc'] == '' ? '' : xml_convert($this->convert_recipients($data['cc'], 'string', 'screen_name'));
     $this->single_parts['include']['sender'] = $data['sender'];
     $this->single_parts['include']['date'] = $data['date'];
     $this->conditionals['attachments_exist'] = 'n';
     if ($data['sender'] == ee()->session->userdata['screen_name'] && isset($data['folder_id']) && $data['folder_id'] == 2) {
         $this->conditionals['show_cc'] = 'y';
     } elseif (in_array($this->member_id, explode(', ', $data['cc']))) {
         $this->conditionals['show_cc'] = 'y';
         $this->single_parts['include']['cc'] = ee()->session->userdata['screen_name'];
     } elseif ($data['hide_cc'] == 'y' or $data['cc'] == '') {
         $this->conditionals['show_cc'] = 'n';
     } else {
         $this->conditionals['show_cc'] = 'y';
     }
     /** -----------------------------------
     		/**  Prepare Attachments for Display
     		/** -----------------------------------*/
     $this->conditionals['attachments_exist'] = count($data['attachments']) > 0 ? 'y' : 'n';
     $this->single_parts['include']['attachment_links'] = count($data['attachments']) > 0 ? $this->_attachment_links($data['attachments']) : '';
     // -----------------------------------
     //  Form Declaration
     //
     //  NOTE: $data['id'] = $message_id
     // -----------------------------------
     $details = array('hidden_fields' => array('message_id' => $copy_id, 'toggle[]' => $copy_id, 'daction' => ''), 'action' => $this->_create_path('modify_messages'), 'id' => 'target', 'enctype' => 'multi', 'secure' => $this->allegiance == 'cp' ? FALSE : TRUE);
     $this->single_parts['form']['form_declaration']['view_message'] = ee()->functions->form_declaration($details);
     /** -----------------------------------
     		/**  Various Components
     		/** -----------------------------------*/
     $this->current_folder = !isset($data['folder_id']) ? 'n' : $data['folder_id'];
     $this->folders_pulldown();
     $this->_buttons();
     $this->single_parts['include']['hidden_js'] = $this->hidden_js();
     /** ----------------------------------
     		/**  Reduce exp_members.private_messages
     		/** ----------------------------------*/
     if ($data['message_read'] == 'n' && ee()->session->userdata['private_messages'] > 0) {
         ee()->db->query("UPDATE exp_members SET private_messages = private_messages - 1\r\n\t\t\t\t\t\tWHERE member_id = '{$this->member_id}'");
         ee()->session->userdata['private_messages']--;
     }
     /** -----------------------------------
     		/**  Tracking and Status
     		/** -----------------------------------*/
     if ($data['message_read'] == 'n') {
         $udata = array('message_read' => 'y', 'message_time_read' => ee()->localize->now);
         ee()->db->query(ee()->db->update_string('exp_message_copies', $udata, "copy_id = {$copy_id}"));
     }
     /** ----------------------------------------
     		/**  Return the Compose Form Contents
     		/** ----------------------------------------*/
     $this->title = ee()->lang->line('private_message') . ' - ' . ee()->functions->word_limiter($data['subject'], 10);
     $this->crumb = ee()->lang->line('private_message');
     $this->return_data = $this->_process_template($this->retrieve_template('view_message'));
 }
Ejemplo n.º 24
0
 /** ----------------------------------------
 	/**  Constructor
 	/** ----------------------------------------*/
 function Wiki($return = FALSE)
 {
     // Make a local reference to the ExpressionEngine super object
     $this->EE =& get_instance();
     if ($return === TRUE) {
         return;
     }
     ee()->lang->loadfile('wiki');
     /** ----------------------------------------
     		/**  Update Module Code
     		/** ----------------------------------------*/
     if (isset(ee()->TMPL->module_data['Wiki']['version']) && $this->version > ee()->TMPL->module_data['Wiki']['version']) {
         $this->update_module(ee()->TMPL->module_data['Wiki']['version']);
     }
     /* ----------------------------------------
     		/*
     		/*  There are five main kinds of pages in the ExpressionEngine Wiki:
     		/*
     		/*	- Main/Index
     		/*	- Article Page (Including Namespaces)
     		/*	- Edit Topic Page
     		/*	- History Topic Page
     		/*	- Special Page (ex: Uploads, Search Results, Recent Changes)
     		/*
     		/*	Now, the {exp:wiki} tag will be put into a template group
     		/*  and a template, which is set in base_path="" so that
     		/*  we can discover the structure of the URLs and what segments
     		/*  to read for what.
     		/* ----------------------------------------*/
     if (($this->base_path = ee()->TMPL->fetch_param('base_path')) === FALSE) {
         return $this->return_data = lang('basepath_unset');
     }
     $this->base_path = rtrim($this->base_path, '/') . '/';
     $this->base_url = ee()->functions->create_url($this->base_path) . '/';
     /* ----------------------------------------
     			Creating this array once is very useful and since I do my sanitization
     			again here as well as in the Input class, I am sure that the
     			segments are clean and ready to use on a page.
     		/* ----------------------------------------*/
     $x = explode('/', $this->base_path);
     $this->seg_parts = explode('/', ee()->security->xss_clean(strip_tags(stripslashes(ee()->uri->query_string))));
     /* ----------------------------------------
     			Fixes a minor bug in ExpressionEngine where the QSTR variable
     			has the template name included when there is no third segment
     			on a non-index template - Paul
     		/* ----------------------------------------*/
     if (isset($x['1'])) {
         if ($this->seg_parts['0'] == $x['1']) {
             array_shift($this->seg_parts);
         }
     }
     /** ----------------------------------------
     		/**  Preferences and Language
     		/** ----------------------------------------*/
     if (ee()->TMPL->fetch_param('wiki') !== FALSE) {
         $query = ee()->db->query("SELECT * FROM exp_wikis WHERE wiki_short_name = '" . ee()->db->escape_str(ee()->TMPL->fetch_param('wiki')) . "'");
     } else {
         $query = ee()->db->query("SELECT * FROM exp_wikis WHERE wiki_short_name = 'default_wiki'");
     }
     if ($query->num_rows() == 0) {
         return $this->return_data = 'No Valid Wiki Specified';
     }
     foreach ($query->row_array() as $field => $value) {
         if ($field != 'wiki_id') {
             $field = substr($field, 5);
         }
         if ($field == 'users' or $field == 'admins') {
             $value = explode('|', $value);
         }
         $this->{$field} = $value;
     }
     /** ------------------------------------
     		/**  Retrieve Our Namespaces
     		/** ------------------------------------*/
     $namespace_query = ee()->db->query("SELECT * FROM exp_wiki_namespaces WHERE wiki_id = '" . ee()->db->escape_str($this->wiki_id) . "' ORDER BY namespace_name");
     if ($namespace_query->num_rows() > 0) {
         foreach ($namespace_query->result_array() as $row) {
             $this->namespaces[strtolower($row['namespace_name'])] = array($row['namespace_name'], $row['namespace_label']);
             if (isset($this->seg_parts['0']) && strcasecmp($this->prep_title(substr($this->seg_parts['0'], 0, strlen($row['namespace_label'] . ':'))), $row['namespace_label'] . ':') == 0) {
                 $this->admins = explode('|', $row['namespace_admins']);
                 $this->users = explode('|', $row['namespace_users']);
             }
         }
     }
     if (ee()->TMPL->fetch_param('profile_path') !== FALSE) {
         $this->profile_path = reduce_double_slashes('/' . ee()->TMPL->fetch_param('profile_path') . '/' . ee()->config->item('profile_trigger') . '/');
     } else {
         $this->profile_path = reduce_double_slashes('/' . ee()->config->item('profile_trigger') . '/');
     }
     /** ----------------------------------------
     		/**  Namespaces Localization
     		/** ----------------------------------------*/
     $this->main_ns = isset(ee()->lang->language['main_ns']) ? lang('main_ns') : $this->main_ns;
     $this->file_ns = isset(ee()->lang->language['file_ns']) ? lang('file_ns') : $this->file_ns;
     $this->image_ns = isset(ee()->lang->language['image_ns']) ? lang('image_ns') : $this->image_ns;
     $this->special_ns = isset(ee()->lang->language['special_ns']) ? lang('special_ns') : $this->special_ns;
     $this->category_ns = isset(ee()->lang->language['category_ns']) ? lang('category_ns') : $this->category_ns;
     /* ----------------------------------------
     		/*  Category namespace actually has articles so it is put into the
     		/*	namespaces array. However, instead of the localized name we use
     		/*  the relatively simple 'category' in the page_namespace field.
     		/* ---------------------------------------*/
     $this->namespaces['category'] = array('category', $this->category_ns);
     /** ----------------------------------------
     		/**  Tag Settings
     		/** ----------------------------------------*/
     if (!in_array('1', $this->admins)) {
         $this->admins[] = "1";
     }
     if (!in_array('1', $this->users)) {
         $this->users[] = "1";
     }
     foreach ($this->admins as $key => $value) {
         if (in_array($value, array('2', '3', '4'))) {
             unset($this->admins[$key]);
         }
     }
     foreach ($this->users as $key => $value) {
         if (in_array($value, array('2', '3', '4'))) {
             unset($this->users[$key]);
         }
     }
     /** ----------------------------------------
     		/**  Valid Upload Directory?
     		/** ----------------------------------------*/
     if (!empty($this->upload_dir) && is_numeric($this->upload_dir)) {
         $query = ee()->db->query("SELECT COUNT(*) AS count FROM exp_upload_prefs\n\t\t\t\t\t\t\t\t WHERE id = '" . ee()->db->escape_str($this->upload_dir) . "'");
         if ($query->row('count') > 0) {
             $this->valid_upload_dir = 'y';
             $this->can_upload = 'y';
             if (in_array(ee()->session->userdata['group_id'], array(2, 3, 4))) {
                 $this->can_upload = 'n';
             } elseif (ee()->session->userdata['group_id'] != 1) {
                 $query = ee()->db->query("SELECT upload_id FROM exp_upload_no_access WHERE member_group = '" . ee()->session->userdata['group_id'] . "'");
                 if ($query->num_rows() > 0) {
                     foreach ($query->result_array() as $row) {
                         if ($query->row('upload_id') == $this->upload_dir) {
                             $this->can_upload = 'n';
                             break;
                         }
                     }
                 }
             }
         }
     }
     /** ----------------------------------------
     		/**  Set theme, load file helper
     		/** ----------------------------------------*/
     ee()->load->helper('file');
     $this->theme_path = PATH_THEMES . 'wiki_themes/default/';
     $this->image_url = ee()->config->slash_item('theme_folder_url') . 'wiki_themes/default/images/';
     $this->theme_url = ee()->config->slash_item('theme_folder_url') . 'wiki_themes/default/';
     if (ee()->TMPL->fetch_param('theme') !== FALSE && ee()->TMPL->fetch_param('theme') != '' && ee()->TMPL->fetch_param('theme') != 'default') {
         $theme = ee()->security->sanitize_filename(ee()->TMPL->fetch_param('theme'));
         if (is_dir(PATH_THEMES . '/wiki_themes/' . $theme)) {
             $this->theme_path = PATH_THEMES . 'wiki_themes/' . $theme . '/';
             $this->image_url = ee()->config->slash_item('theme_folder_url') . 'wiki_themes/' . $theme . '/images/';
             $this->theme_url = ee()->config->slash_item('theme_folder_url') . 'wiki_themes/' . $theme . '/';
         } else {
             ee()->TMPL->log_item('Wiki module: theme not found - "' . htmlentities($theme) . '"');
         }
     }
     /** ----------------------------------------
     		/**  Editing Article
     		/** ----------------------------------------*/
     if (ee()->input->post('editing') == 'y' && ee()->input->post('preview') === FALSE) {
         return $this->edit_article();
     }
     /** ----------------------------------------
     		/**  Displaying Page
     		/** ----------------------------------------*/
     $this->return_data = str_replace(array('{module_version}'), array($this->version), $this->_fetch_template('wiki_page.html'));
     $this->return_data = $this->active_members($this->return_data);
     /* -------------------------------------
     		/*  'wiki_start' hook.
     		/*  - Allows page template to be modified prior to article processing
     		/*  - Added 1.6.0
     		*/
     if (ee()->extensions->active_hook('wiki_start') === TRUE) {
         $this->return_data = ee()->extensions->universal_call('wiki_start', $this);
         if (ee()->extensions->end_script === TRUE) {
             return;
         }
     }
     /*
     		/* -------------------------------------*/
     /** ----------------------------------------
     		/**  Determine Page to Show
     		/** ----------------------------------------*/
     // Index Page
     if (count($this->seg_parts) == 0 or ee()->uri->query_string == '' or ee()->uri->query_string == 'index') {
         $this->title = 'index';
         $this->article('index');
     } elseif (substr($this->seg_parts['0'], 0, strlen($this->file_ns . ':')) == $this->file_ns . ':') {
         $this->title = $this->seg_parts['0'];
         $this->current_namespace = $this->file_ns;
         $this->file(substr($this->seg_parts['0'], strlen($this->file_ns . ':')));
     } elseif (substr($this->seg_parts['0'], 0, strlen($this->image_ns . ':')) == $this->image_ns . ':') {
         $this->title = $this->seg_parts['0'];
         $this->current_namespace = $this->image_ns;
         $this->image(substr($this->seg_parts['0'], strlen($this->image_ns . ':')));
     } elseif (substr($this->seg_parts['0'], 0, strlen($this->special_ns . ':')) == $this->special_ns . ':') {
         $this->title = $this->seg_parts['0'];
         $this->current_namespace = $this->special_ns;
         $this->special(substr($this->seg_parts['0'], strlen($this->special_ns . ':')));
     } elseif (isset($this->seg_parts['0']) && strlen($this->seg_parts['0']) == 32 && preg_match("/^[a-z0-9]+\$/i", $this->seg_parts['0'])) {
         $this->display_attachment();
         exit;
     } else {
         if (in_array($this->seg_parts['0'], array('edit', 'history', 'revision', 'noredirect'))) {
             $this->title = 'index';
             if ($this->seg_parts['0'] == 'noredirect') {
                 $this->article('index');
             } else {
                 $this->{$this->seg_parts['0']}('index');
             }
         } else {
             $this->title = $this->seg_parts['0'];
             if ($this->valid_title($this->title) != $this->title) {
                 $this->redirect('', $this->title);
             }
             if (isset($this->seg_parts['1']) && $this->seg_parts['1'] == 'edit') {
                 $this->edit($this->title);
             } elseif (isset($this->seg_parts['1']) && $this->seg_parts['1'] == 'history') {
                 $this->history($this->title);
             } elseif (isset($this->seg_parts['1']) && $this->seg_parts['1'] == 'revision') {
                 $this->revision($this->title);
             } else {
                 $this->article($this->title);
             }
         }
     }
     if ($this->can_upload == 'y') {
         $this->return_data = $this->_allow_if('uploads', $this->return_data);
     } else {
         $this->return_data = $this->_deny_if('uploads', $this->return_data);
     }
     /** ----------------------------------------
     		/**  Global Tags
     		/** ----------------------------------------*/
     if (preg_match_all("/\\{wiki:custom_namespaces_list(.*?)\\}(.*?)\\{\\/wiki:custom_namespaces_list\\}/s", $this->return_data, $matches)) {
         for ($i = 0, $s = count($matches[0]); $i < $s; ++$i) {
             $output = '';
             if (count($this->namespaces) > 0) {
                 foreach ($this->namespaces as $name => $label) {
                     $selected = isset($this->seg_parts['1']) && strtolower($this->seg_parts['1']) == $name ? 'selected="selected"' : '';
                     $output .= str_replace(array('{namespace_short_name}', '{namespace_label}', '{namespace_selected}'), array($label['0'], $label['1'], $selected), $matches['2'][$i]);
                 }
             }
             $this->return_data = str_replace($matches['0'][$i], $output, $this->return_data);
         }
     }
     if (preg_match("/\\{wiki:categories_list(.*?)\\}(.*?)\\{\\/wiki:categories_list\\}/s", $this->return_data)) {
         $this->categories_list();
     }
     /** ----------------------------------------
     		/**  Global Conditionals
     		/** ----------------------------------------*/
     if (ee()->session->userdata('member_id') == 0) {
         $this->return_data = $this->_deny_if('logged_in', $this->return_data);
         $this->return_data = $this->_allow_if('logged_out', $this->return_data);
     } else {
         $this->return_data = $this->_allow_if('logged_in', $this->return_data);
         $this->return_data = $this->_deny_if('logged_out', $this->return_data);
     }
     if (in_array(ee()->session->userdata['group_id'], $this->admins)) {
         $this->return_data = $this->_deny_if('cannot_admin', $this->return_data);
         $this->return_data = $this->_allow_if('can_admin', $this->return_data);
     } else {
         $this->return_data = $this->_allow_if('cannot_admin', $this->return_data);
         $this->return_data = $this->_deny_if('can_admin', $this->return_data);
     }
     /** ----------------------------------------
     		/**  Global Variables
     		/** ----------------------------------------*/
     $link = $this->create_url($this->current_namespace, $this->topic);
     // Load the XML Helper
     ee()->load->helper('xml');
     $data = array('{charset}' => ee()->config->item('output_charset'), '{wiki_name}' => $this->label_name, '{title}' => xml_convert($this->prep_title($this->title)), '{url_title}' => xml_convert($this->valid_title($this->title)), '{topic}' => xml_convert($this->prep_title($this->topic)), '{namespace}' => xml_convert($this->current_namespace), '{special_namespace}' => xml_convert($this->special_ns), '{main_namespace}' => xml_convert($this->main_ns), '{file_namespace}' => xml_convert($this->file_ns), '{category_namespace}' => xml_convert($this->category_ns), '{image_namespace}' => xml_convert($this->image_ns), '{revision_id}' => $this->revision_id, '{screen_name}' => $this->prep_screen_name(ee()->session->userdata('screen_name')), '{path:wiki_home}' => ee()->functions->create_url($this->base_path), '{path:wiki_base_url}' => $this->base_url, '{path:article_history}' => $link . '/history', '{path:view_article}' => $link, '{path:edit_article}' => $link . '/edit', '{path:logout}' => ee()->functions->create_url('logout'), '{path:your_control_panel}' => ee()->functions->create_url($this->profile_path . 'profile'), '{path:your_profile}' => ee()->functions->create_url($this->profile_path . ee()->session->userdata('member_id')), '{path:login}' => ee()->functions->create_url($this->profile_path . 'login'), '{path:register}' => ee()->functions->create_url($this->profile_path . 'register'), '{path:memberlist}' => ee()->functions->create_url($this->profile_path . 'memberlist'), '{path:forgot}' => ee()->functions->create_url($this->profile_path . 'forgot_password'), '{path:private_messages}' => ee()->functions->create_url($this->profile_path . 'messages/view_folder/1'), '{path:image_url}' => $this->image_url, '{path:theme_url}' => $this->theme_url, '{text_format}' => ucwords(str_replace('_', ' ', $this->text_format)));
     /** -------------------------------------
     		/**  Parse URI segments
     		/** -------------------------------------*/
     // This code lets admins fetch URI segments which become
     // available as:  {segment_1} {segment_2}
     for ($i = 1; $i < 9; $i++) {
         $data[LD . 'segment_' . $i . RD] = ee()->uri->segment($i);
     }
     /** -------------------------------------
     		/**  Parse Snippets
     		/** -------------------------------------*/
     foreach (ee()->config->_global_vars as $key => $val) {
         $data[LD . $key . RD] = $val;
     }
     /** -------------------------------------
     		/**  Parse manual variables
     		/** -------------------------------------*/
     if (count(ee()->TMPL->global_vars) > 0) {
         foreach (ee()->TMPL->global_vars as $key => $val) {
             $data[LD . $key . RD] = $val;
         }
     }
     /* -------------------------------------
     		/*  We reset some of these because in $data we are converting them
     		/*  for display purposes and we would rather have the conditionals
     		/*  use the unmodified versions
     		/* -------------------------------------*/
     $this->conditionals['title'] = $this->title;
     $this->conditionals['topic'] = $this->topic;
     $this->conditionals['namespace'] = $this->current_namespace;
     $this->return_data = $this->prep_conditionals($this->return_data, array_merge($data, $this->conditionals));
     $this->return_data = str_replace(array_keys($data), array_values($data), $this->return_data);
     /** -------------------------------------
     		/**  Parse Current Time
     		/** -------------------------------------*/
     $this->return_data = ee()->TMPL->parse_date_variables($this->return_data, array('current_time' => ee()->localize->now));
     // Parse the language text
     if (preg_match_all("/" . LD . "lang:(.+?)" . RD . "/i", $this->return_data, $matches)) {
         for ($j = 0; $j < count($matches['0']); $j++) {
             $line = lang($matches['1'][$j]);
             // Since we're using the pre-existing search language file
             // we might need to add a prefix
             if ($line == '' and $this->current_request == 'search') {
                 $line = lang('search_' . $matches['1'][$j]);
             }
             $this->return_data = str_replace($matches['0'][$j], $line, $this->return_data);
         }
     }
     /** ----------------------------------------
     		/**  Cleanup
     		/** ----------------------------------------*/
     $this->return_data = $this->_deny_if('redirected', $this->return_data);
     $this->return_data = $this->_deny_if('redirect_page', $this->return_data);
 }
Ejemplo n.º 25
0
 /**
  * Generate XML data from a query result object
  *
  * @param	object	$query	Query result object
  * @param	array	$params	Any preferences
  * @return	string
  */
 public function xml_from_result($query, $params = array())
 {
     if (!is_object($query) or !method_exists($query, 'list_fields')) {
         show_error('You must submit a valid result object');
     }
     // Set our default values
     foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) {
         if (!isset($params[$key])) {
             $params[$key] = $val;
         }
     }
     // Create variables for convenience
     extract($params);
     // Load the xml helper
     get_instance()->load->helper('xml');
     // Generate the result
     $xml = '<' . $root . '>' . $newline;
     while ($row = $query->unbuffered_row()) {
         $xml .= $tab . '<' . $element . '>' . $newline;
         foreach ($row as $key => $val) {
             $xml .= $tab . $tab . '<' . $key . '>' . xml_convert($val) . '</' . $key . '>' . $newline;
         }
         $xml .= $tab . '</' . $element . '>' . $newline;
     }
     return $xml . '</' . $root . '>' . $newline;
 }
Ejemplo n.º 26
0
        echo xml_convert($content->title);
        ?>
</title> 
    <link><?php 
        echo base_url() . $content->title_url;
        ?>
</link>
    <guid isPermaLink="true"><?php 
        echo $item_base_url . $content->content_id;
        ?>
</guid>			
    <description><![CDATA[<?php 
        echo $content->content;
        ?>
]]></description>
    <author><?php 
        echo xml_convert($content->name);
        ?>
</author>	  
    <pubdate><?php 
        echo standard_date('DATE_RSS', mysql_to_unix($content->created_at));
        ?>
</pubdate>
  </item>
  <?php 
    }
}
?>
      
</channel>
</rss>
Ejemplo n.º 27
0
		<name><?php 
echo get_home_team()->name;
?>
</name>
	</author>
	<id><?php 
echo site_url();
?>
</id>
	
	<?php 
foreach ($posts["chapters"] as $entry) {
    ?>
		<entry>
			<title><?php 
    echo xml_convert($entry["title"]);
    ?>
</title>
			<link href="<?php 
    echo $entry["href"];
    ?>
"/>
			<id><?php 
    echo $entry["href"];
    ?>
</id>
			<updated><?php 
    echo date(DATE_W3C, strtotime($entry["created"]));
    ?>
</updated>
			<summary><?php 
Ejemplo n.º 28
0
 /** ----------------------------------------
 	/**  Search keywords
 	/** ----------------------------------------*/
 function keywords()
 {
     /** ----------------------------------------
     		/**  Check search ID number
     		/** ----------------------------------------*/
     // If the QSTR variable is less than 32 characters long we
     // don't have a valid search ID number
     if (strlen($this->EE->uri->query_string) < 32) {
         return '';
     }
     /** ----------------------------------------
     		/**  Fetch ID number and page number
     		/** ----------------------------------------*/
     $search_id = substr($this->EE->uri->query_string, 0, 32);
     /** ----------------------------------------
     		/**  Fetch the cached search query
     		/** ----------------------------------------*/
     $query = $this->EE->db->query("SELECT keywords FROM exp_search WHERE search_id = '" . $this->EE->db->escape_str($search_id) . "'");
     if ($query->num_rows() == 1) {
         // Load the XML Helper
         $this->EE->load->helper('xml');
         return $this->EE->functions->encode_ee_tags(xml_convert($query->row('keywords')));
     } else {
         return '';
     }
 }
Ejemplo n.º 29
0
 /**
  * Generate XML data from a query result object
  *
  * @access	public
  * @param	object	The query result object
  * @param	array	Any preferences
  * @return	string
  */
 function xml_from_result($query, $params = array())
 {
     if (!is_object($query) or !method_exists($query, 'list_fields')) {
         show_error('You must submit a valid result object');
     }
     // Set our default values
     foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val) {
         if (!isset($params[$key])) {
             $params[$key] = $val;
         }
     }
     // Create variables for convenience
     extract($params);
     // Load the xml helper
     $CI =& get_instance();
     $CI->load->helper('xml');
     // Generate the result
     $xml = "<{$root}>" . $newline;
     foreach ($query->result_array() as $row) {
         $xml .= $tab . "<{$element}>" . $newline;
         foreach ($row as $key => $val) {
             $xml .= $tab . $tab . "<{$key}>" . xml_convert($val) . "</{$key}>" . $newline;
         }
         $xml .= $tab . "</{$element}>" . $newline;
     }
     $xml .= "</{$root}>" . $newline;
     return $xml;
 }
Ejemplo n.º 30
0
Archivo: feed.php Proyecto: csiber/embr
</dc:language>
  <dc:creator><?php 
echo $creator_email;
?>
</dc:creator>
  <dc:rights>Copyright <?php 
echo gmdate("Y", time());
?>
</dc:rights>
  <admin:generatorAgent rdf:resource="http://www.codeigniter.com/"/>
<?php 
foreach ($posts as $post) {
    ?>
  <item>
  <title><?php 
    echo xml_convert($post["title"]);
    ?>
</title>
  <link><?php 
    echo base_url() . strtolower(url_title($post["title"]));
    ?>
</link>
  <guid><?php 
    echo base_url() . strtolower(url_title($post["title"]));
    ?>
</guid>
  <description><![CDATA[<?php 
    echo $post['image'] ? "<img src=\"" . base_url() . "img/uploads/" . $post["image"] . "\"/>" : $post["content"];
    ?>
]]></description>
  <pubDate><?php