403Webshell
Server IP : 80.241.246.6  /  Your IP : 216.73.216.188
Web Server : Apache/2.4.25 (Debian)
System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User : www-data ( 33)
PHP Version : 7.0.33-0+deb9u12
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/kharagauli_new/Smarty/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/kharagauli_new/Smarty/rss.php
<?php




class rss{
 

  public function __construct($xmlns, $a_channel, $site_url, $site_name, $full_feed = false){
    $this->_lang = isset($_SESSION['language'])?$_SESSION['language']:"Georgia";
    $this->xmlns = ($xmlns ? ' ' . $xmlns : '');
    $this->channel_properties = $a_channel;
    $this->site_url = $site_url;
    $this->site_name = $site_name;
    $this->full_feed = $full_feed;
  }
 

  public function create_feed($connect) {
 
    $xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
 
    $xml .= '<rss version="2.0"' . $this->xmlns . '>' . "\n";
 
    $xml .= '<channel>' . "\n";
    $xml .= '<title><![CDATA[ ' . $this->channel_properties["title"] . ' ]]></title>' . "\n";
    $xml .= '<link><![CDATA[ ' . $this->channel_properties["link"] . ' ]]></link>' . "\n";
    $xml .= '<description><![CDATA[ ' . $this->channel_properties["description"] . ' ]]></description>' . "\n";
 
    if(array_key_exists("language", $this->channel_properties)) {
      $xml .= '<language>' . $this->channel_properties["language"] . '</language>' . "\n";
    }
    if(array_key_exists("image_title", $this->channel_properties)) {
      $xml .= '<image>' . "\n";
      $xml .= '<title>' . $this->channel_properties["image_title"] . '</title>' . "\n";
      $xml .= '<link>' . $this->channel_properties["image_link"] . '</link>' . "\n";
      $xml .= '<url>' . $this->channel_properties["image_url"] . '</url>' . "\n";
      $xml .= '</image>' . "\n";
    }
 
    $rss_items = $this->get_feed_items($connect);
 
    foreach($rss_items as $rss_item) {
      $xml .= '<item>' . "\n";
      $xml .= '<title><![CDATA[ ' . $rss_item['title'] . ' ]]></title>' . "\n";
      $xml .= '<link><![CDATA[ ' . $rss_item['link'] . ' ]]></link>' . "\n";
      $xml .= '<description><![CDATA[ ' . mb_substr(trim(strip_tags($rss_item['description'])),0,200,"UTF-8") . ' ]]></description>' . "\n";
      $xml .= '<pubDate>' . $rss_item['pubDate'] . '</pubDate>' . "\n";
      $xml .= '<category>' . $rss_item['category'] . '</category>' . "\n";
      $xml .= '<source>' . $rss_item['source'] . '</source>' . "\n";
 
      if($this->full_feed) {
        $xml .= '<content:encoded>' . $rss_item['content'] . '</content:encoded>' . "\n";
      }
 
      $xml .= '</item>' . "\n";
    }
 
    $xml .= '</channel>';
 
    $xml .= '</rss>';
 
    return $xml;
  }
 

  public function get_feed_items($connect, $rss_items_count = 10) {



    $sql = "
      select 
        t.page_date as date_published,t.id,t.name_".$this->_lang.",t.body_".$this->_lang.",
        t1.menu_id,
        t2.name_".$this->_lang." as manu_name,t2.url_".$this->_lang."
      from body t 
      join menu_body t1 on t1.body_id = t.id
      join menu t2 on t2.id = t1.menu_id and t2.search_with_rss = 1
         where t.page_date <= unix_timestamp(now())
         group by t.id order by t.page_date desc limit 0, $rss_items_count 
    ";  


 
    $sql = $connect->con->query($sql);

    $a_topic_ids = [];
    while($row = $sql->fetch(PDO::FETCH_ASSOC))
      $a_topic_ids[] = $row;
    

    

 
    $a_rss_items = array();
    $a_rss_item = array();
    foreach($a_topic_ids as $topic) {
 

      $a_rss_item['title'] = $topic['name_'.$this->_lang];
 
      $a_rss_item['link'] = $this->site_url . '/'.$topic['url_'.$this->_lang] .'/page/'. $topic['id'];
 
      $a_rss_item['description'] = '';
 
      // if($topic['image']) {
      //   $img_url = $this->site_url . $topic['image'];
      //   $a_rss_item['description'] = '<img src="' . $img_url . '" hspace="5" vspace="5" align="left"/>';
      // }

      $a_rss_item['description'] .= $topic['body_'.$this->_lang];
 
     // $date = new DateTime($topic["date_published"]); 
      $a_rss_item['pubDate'] = date("d-m-Y h:i",$topic["date_published"]);//$date->format("D, d M Y H:i:s O");
 
      $a_rss_item['category'] = $topic["manu_name"];
 
      $a_rss_item['source'] = $this->site_name;
 
      if($this->full_feed)
        $a_rss_item['content'] = '<![CDATA[' . $topic['body_'.$this->_lang] .  ']]>';
      
 
      array_push($a_rss_items, $a_rss_item);
 
    }
 
    return $a_rss_items;
  }
 
}   


$xmlns = 'xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"';
 
$domain = $_SERVER['HTTP_HOST']; 
$a_channel = array(
  "title" => $domain,
  "link" => "http://".$domain,
  "description" => $domain,
  "language" => "en",
  "image_title" => $domain,
  "image_link" => "http://".$domain,
  "image_url" => "http://".$domain."/feed/rss.png",
);
$site_url = 'http://'.$domain; 
$site_name = $domain;
 
$rss = new rss($xmlns, $a_channel, $site_url, $site_name);
return $rss->create_feed($_);

Youez - 2016 - github.com/yon3zu
LinuXploit