Exemplo n.º 1
0
 function getParameters($id)
 {
     global $database, $mosConfig_offset, $mosConfig_live_site;
     $feed = new rdRssData($database);
     $feed->load($id);
     $params = new mosParameters($feed->params);
     $params->id = $id;
     $params->catids = $feed->catids;
     $params->published = $feed->published;
     if (method_exists($database, "getNullDate")) {
         $params->nullDate = $database->getNullDate();
     } else {
         $params->nullDate = '0000-00-00 00:00:00';
     }
     $params->now = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
     $iso = split('=', _ISO);
     // parameter intilization
     $params->date = date('r');
     $params->year = date('Y');
     $params->encoding = $iso[1];
     $params->link = htmlspecialchars($mosConfig_live_site);
     $params->cache = $params->def('cache', 1);
     $params->cache_time = $params->def('cache_time', 3600);
     $params->count = $params->def('count', 5);
     $params->orderby = $params->def('orderby', '');
     $params->title = $params->def('title', 'Joomla! powered Site');
     $params->description = $params->def('description', 'Joomla! site syndication');
     $params->image_file = $params->def('image_file', 'joomla_rss.png');
     if ($params->image_file == -1) {
         $params->image = NULL;
     } else {
         $params->image = $mosConfig_live_site . '/images/M_images/' . $params->image_file;
     }
     $params->image_alt = $params->def('image_alt', 'Powered by Joomla!');
     $params->limit_text = $params->def('limit_text', 1);
     $params->text_length = $params->def('text_length', 20);
     // get feed type from url
     $params->feed = mosGetParam($_GET, 'feed', 'RSS2.0');
     // live bookmarks
     $params->live_bookmark = $params->def('live_bookmark', '');
     return $params;
 }
Exemplo n.º 2
0
 /**
  *
  * @param $option
  */
 function save($option, $section, $task, $redirect = 1)
 {
     global $database, $mainframe, $my;
     $row = new rdRssData($database);
     if (!$row->bind($_POST)) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $params = mosGetParam($_POST, 'params', '');
     if (is_array($params)) {
         $txt = array();
         foreach ($params as $k => $v) {
             $txt[] = "{$k}={$v}";
         }
         $row->params = implode("\n", $txt);
     }
     $catids = mosGetParam($_POST, 'catid', array());
     $row->catids = implode(',', $catids);
     $isNew = $row->id < 1;
     if ($isNew) {
         $row->created = $row->created ? $row->created : date("Y-m-d H:i:s");
         $row->created_by = $row->created_by ? $row->created_by : $my->id;
         $row->modified = date("Y-m-d H:i:s");
         $row->modified_by = $my->id;
     } else {
         $row->modified = date("Y-m-d H:i:s");
         $row->modified_by = $my->id;
         $row->checkin();
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $msg = $row->name . _RDRSS_SCSA;
     if ($redirect) {
         mosRedirect("index2.php?option={$option}&amp;task=list", $msg);
     } else {
         return $row->id;
     }
 }