echo "
RSS-Feeds werden in Kürze zur Verfügung stehen.";
exit;
$myEnv['module'] = 'general';
$myEnv['stdsmenu'] = false;
$myEnv["output"] = "html";
$_CONSOLE = true;
include ("../../config.inc.php");
include (INCLUDEPATH . "container.inc.php");
$conn = connect_database();
////user => password
//$users = array('admin' => 'admin', 'guest' => 'test');
//
//if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
// header('HTTP/1.1 401 Unauthorized');
// header('WWW-Authenticate: Digest realm="'.$realm.
// '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
//
// die('Abort login');
//}
//$data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST']);
//// analyze the PHP_AUTH_DIGEST variable
//if (!($data = http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) ||
// !isset($users[$data['username']]))
// die('Username or password is wrong!');
//
//// generate the valid response
//$A1 = md5($data['username'] . ':' . $realm . ':' .$users[$data['username']]);
//$A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']);
//$valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2);
//
//if ($data['response'] != $valid_response)
// die('Username or password is wrong!');
//else{
//
//}
//
//// ok, valid username & password
////echo 'Your are logged in as: ' . $data['username'];
//
///**
// * function to parse the http auth header
// *
// */
//function http_digest_parse($txt)
//{
// // protect against missing data
// $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
// $data = array();
// $keys = implode('|', array_keys($needed_parts));
//
// preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
//
// foreach ($matches as $m) {
// $data[$m[1]] = $m[3] ? $m[3] : $m[4];
// unset($needed_parts[$m[1]]);
// }
//
// return $needed_parts ? false : $data;
//}
/**
* Get detail of the rss
* This will appear as the header of the rss
*
* @return (string) $details Include the begin of the xml string in rss document
*/
function getDetails(){
require_once(INCLUDEPATH . 'flar/functions/tools.php');
$langVars = parse_ini_file_quotes_safe(ROOTPATH."/modules/general/lang/flare/notifications.".$_SESSION["MGW"]->spkz.".lang");
switch($_GET["type"]){
case "damage":
$rss_title = "damage_rss_feed";
break;
case "inspection":
$rss_title = "inspection_rss_feed";
break;
case "rented":
$rss_title = "current_rental_rss_feed";
break;
case "patrol_card":
$rss_title = "patrol_card_rss_feed";
break;
case "inspector_watch":
$rss_title = "inspector_watch_rss_feed";
break;
case "inspector_favourite":
$rss_title = "inspector_favourite_rss_feed";
break;
case "inspector_rating":
$rss_title = "inspector_rating_rss_feed";
break;
case "inspector_damage":
$rss_title = "inspector_damage_rss_feed";
break;
case "inspector_fuel":
$rss_title = "inspector_fuel_rss_feed";
break;
case "inspector_newestitem":
$rss_title = "inspector_newestitem_rss_feed";
break;
case "inspector_cost":
$rss_title = "inspector_cost_rss_feed";
break;
case "inspector_cost_mileage":
$rss_title = "inspector_cost_mileage_rss_feed";
break;
case "inspector_cost_rental":
$rss_title = "inspector_cost_rental_rss_feed";
break;
case "inspector_cost_rental_project":
$rss_title = "inspector_cost_rental_project_rss_feed";
break;
default:
$rss_title = "flare_rss_feed";
break;
}
//$rss_title = ($langVars[$rss_title])? $langVars[$rss_title] : $rss_title;
$rss_title = "haha";
$details = '
http://localhost
Rss.
en-us';
return $details;
}
/**
* Get items of the rss
* This will appear as the content of the rss
*
* @return (string) $items Include items tag of xml string and the end of xml string in rss document
*/
function getItems($smarty){
$items = '';
if($_GET["private"]){
require_once(INCLUDEPATH . 'flar/functions/db_person.php');
require_once(INCLUDEPATH . 'flar/functions/db_inventory.php');
require_once(INCLUDEPATH . 'flar/Blog_entry.php');
require_once(INCLUDEPATH . 'flar/Res_personal.php');
require_once(INCLUDEPATH . 'flar/Company.php');
require_once(INCLUDEPATH . 'flar/functions/tools.php');
$langVars = parse_ini_file_quotes_safe(ROOTPATH."/modules/general/lang/flare/notifications.".$_SESSION["MGW"]->spkz.".lang");
$smarty->assign("lang_Vars", $langVars);
$db_personal = new Flar_Res_personal();
$db_personal->private_identifier = $_GET["private"];
//check private identifier
if($db_personal->find(TRUE)){
$bLoadForRSS = true;
$output = "";
$person_id = $db_personal->PERSON_ID;
$person_language = $db_personal->language_code_lang_code;
switch($_GET["type"]){
case "damage":
$rss_title = "damage_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_damage.php");
break;
case "inspection":
$rss_title = "inspection_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspection.php");
break;
case "rented":
$rss_title = "current_rental_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_current_rental.php");
break;
case "patrol_card":
$rss_title = "patrol_card_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_gascard.php");
break;
case "inspector_watch":
$rss_title = "inspector_watch_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_watch.php");
break;
case "inspector_favourite":
$rss_title = "inspector_favourite_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_favourite.php");
break;
case "inspector_rating":
$rss_title = "inspector_rating_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_rating.php");
break;
case "inspector_damage":
$rss_title = "inspector_damage_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_damage.php");
break;
case "inspector_fuel":
$rss_title = "inspector_fuel_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_fuel.php");
break;
case "inspector_newestitem":
$rss_title = "inspector_newestitem_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_newestitem.php");
break;
case "inspector_cost":
$rss_title = "inspector_cost_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_cost.php");
break;
case "inspector_cost_mileage":
$rss_title = "inspector_cost_mileage_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_costmileage.php");
break;
case "inspector_cost_rental":
$rss_title = "inspector_cost_rental_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_cost_rental.php");
break;
case "inspector_cost_rental_project":
$rss_title = "inspector_cost_rental_project_rss_feed";
include(ROOTPATH. "/include/flar/console/include/_notification_inspector_cost_rentalproject.php");
break;
default:
$blog_entry = new Flar_Blog_entry();
if ((int)$_GET["blog_id"]){
$blog_entry->blog_id = $_GET["blog_id"];
}
if ((int)$_GET["id"]){
$blog_entry->id = $_GET["id"];
}
if ((int)$_GET["cat_id"]){
$blog_entry->blog_category_idblog_category = $_GET["cat_id"];
}
$blog_entry->orderBy('idblog_entry DESC');
$blog_entry->limit(10);
$blog_entry->find();
while( $blog_entry->fetch()){
$output = $blog_entry->text;
//rss for damage
if ($_GET["type"] == "damage"){
if ($blog_entry->id>0){
// set params array
$params = array();
$params[22] = $blog_entry->id;//unfixable checkbox
$data_arr = getData_inventoryDamage($params);
$smarty->assign("data_array", $data_arr);
$smarty->assign("data_number", sizeof($data_arr) );
$output = $smarty->fetch(ROOTPATH.'/modules/general/templates/'.THEME.'/html/flare/notifications/damage_list.tpl');
}
}
$date = $blog_entry->date;
// get person name
if ( $blog_entry->PERSON_ID ) $_person_name_array = get_person_name_by_id( $blog_entry->PERSON_ID );
if ($_person_name_array["firstname"]) $_person_name = $_person_name_array["firstname"]." ";
$_person_name = $_person_name.$_person_name_array["lastname"];
//add information in blog entry into item tag in xml string
$items .= '-
'. $blog_entry->titel . ' (' . $_person_name . ')
http://localhost/'. $blog_entry->titel . '
'.$date.'
'. $_person_name .'
';
}
//Free array
$blog_entry->free();
break;
}
if($output != ""){
//add information in blog entry into item tag in xml string
$items .= '-
'.( ($langVars[$rss_title])? $langVars[$rss_title] : $rss_title ).' '.date("Y-m-d H:i:s"). '
http://localhost
'.date("Y-m-d H:i:s").'
';
}
}
$db_personal->free();
}
//dummy data
// $items .= '-
// doana asdasdfls
// http://localhost/a
// sdfgdsfgsdf
// 2010-11-10 14:54:00
// abc
//
';
// $items .= '-
// doana asdaas dfls
// http://localhost/b
// sdfgdsfgsdf
// 2010-11-10 14:59:00
// abc
//
';
$items .= '
';
return $items;
}
//print out the fully xml string for rss document
header("Content-Type: application/rss+xml");
echo getDetails() . getItems($smarty);
?>