<?php require_once "HTML/IT.php"; require_once "inc/funcs.inc.php"; header("Content-type: text/xml"); if ($entries = get_latest_articles()) { $tpl = new IntegratedTemplate("tpl"); $tpl->loadTemplatefile("rss.tpl.html", true, true); foreach ($entries as $entry) { $tpl->SetCurrentBlock("eintrag"); $tpl->SetVariable("title", $entry[title]); #$tpl->SetVariable("text","no more"); $tpl->SetVariable("text", $entry[text]); $tpl->SetVariable("date", $entry[date]); $tpl->SetVariable("link", htmlspecialchars("http://jan.krutisch.de/janzyklopedie/index.php?action=entry&id=" . $entry[entry_id])); $tpl->ParseCurrentBlock("eintrag"); } $tpl->show(); } else { die("Sorry, didn't work out..."); } ?>
$error_message = "New Article saved"; } else { $error_message = "Nicht authentifiziert. Fool."; } } elseif ($_POST[action] == "kill") { if ($_SESSION[password] == $PASSWORD) { $headtpl->SetVariable("titel", "Eintrag Löschen"); kill_article($_POST[entry_id]); $error_message = "Eintrag gelöscht"; } else { $error_message = "Nicht authentifiziert. Fool."; } } elseif ($_POST[action] == "edit") { if ($entry = get_article_raw($_POST[entry_id])) { $headtpl->SetVariable("titel", "Eintrag Editieren: {$entry['title']}"); $tpl->loadTemplatefile("edit.tpl.html", true, true); $artikels = array('der', 'die', 'das'); $tpl->SetVariable("text", $entry[text]); $tpl->SetVariable("titel", $entry[title]); $tpl->SetVariable("entry_id", $entry[entry_id]); foreach ($artikels as $art) { $tpl->SetCurrentBlock("artikelchoose"); $tpl->SetVariable("artikel", $art); if ($entry[artikel] == $art) { $tpl->SetVariable("selected", "selected"); } $tpl->ParseCurrentBlock("artikelchoose"); } } } elseif ($_POST[action] == "cacheupdate") { $headtpl->SetVariable("titel", "Cacheentry löschen und somit updaten");
/** * Reads a file from disk and returns its content. * */ function makeDebug() { //set timer OFF for global execute time /*$exec_time = -1; $try = 0; while ($exec_time < 0 && $try++<999) { $exec_time = microtime() - $GLOBALS['start_time']; }*/ $GLOBALS['exec_time'] = $exec_time = getmicrotime() - $GLOBALS['start_time']; if (defined('DEBUG') and DEBUG == 1) { $this->free(); $debug_array = array('GET' => $_GET, 'POST' => $_POST, 'SESSION' => $_SESSION, 'COOKIE' => $_COOKIE); $colors = array('GENERAL' => '8495BB', 'GET' => 'FFCC66', 'POST' => '00FF66', 'SESSION' => '9999FF', 'COOKIE' => 'CC99FF', 'SQL' => 'FF9999', 'DATA' => 'FCFC00', 'FILESYS' => 'FCFC00', 'AUTH' => 'CCCCCC', 'EMAIL' => 'CCCCCC', 'DEBUG' => 'FFFF66'); $tpl_name_debug = '/' . SYS_ROOT . TPL_PATH . '/global/debug.htm'; parent::loadTemplatefile($tpl_name_debug, true, true); // GENERAL $name = 'GENERAL'; $time = 0; $this->setCurrentBlock('variable_item'); $this->setVariable(array('NAME' => 'Script name:', 'VALUE' => $_SERVER['PHP_SELF'])); $this->parseCurrentBlock(); //AUTH info global $app; if (is_array($app->user)) { $auth_info = 'id: ' . $app->user['id'] . BR . 'login: '******'login']; } else { $auth_info = 'False'; } $this->setVariable(array('NAME' => 'Authorization:', 'VALUE' => $auth_info)); $this->parseCurrentBlock(); $this->setCurrentBlock('variable_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('variable'); $this->parseCurrentBlock(); // END GENERAL if (is_array(@$GLOBALS['DEBUG'])) { $name = 'DEBUG'; $time = 0; $this->setCurrentBlock('debug_item'); foreach ($GLOBALS['DEBUG'] as $item) { ob_start(); print_r($item['value']); $val_r = ob_get_contents(); ob_end_clean(); $this->setVariable(array('NAME' => $item['name'], 'LINE' => $item['line'], 'VALUE' => nl2br($val_r))); $this->parseCurrentBlock(); } $this->setCurrentBlock('debug_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('debug'); $this->parseCurrentBlock(); } // SQL DEBUG if (is_array($GLOBALS['SQLS'])) { $name = 'SQL'; $time = 0; foreach ($GLOBALS['SQLS'] as $sql) { if (isset($sql['error']) and $sql['error'] != '') { $this->setCurrentBlock('sql_error'); $this->setVariable(array('ERROR' => $sql['error'])); $this->parseCurrentBlock(); } $this->setCurrentBlock('sql_item'); $this->setVariable(array('NAME' => $sql['sql'], 'VALUE' => $sql['time'])); $this->parseCurrentBlock(); $time += $sql['time']; } $this->setVariable(array('NAME' => 'TOTAL', 'VALUE' => "<b>{$time}</b>")); $this->parseCurrentBlock(); $this->setCurrentBlock('sql_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('sql'); $this->parseCurrentBlock(); } // DATA DEBUG if (is_array(@$GLOBALS['DATA_DEBUG'])) { $name = 'DATA'; $time = 0; foreach ($GLOBALS['DATA_DEBUG'] as $data) { $this->setCurrentBlock('data_item'); $this->setVariable(array('ACTION' => $data['action'], 'PARAMS' => $data['params'], 'REZ' => $data['rez'])); $this->parseCurrentBlock(); } $this->setCurrentBlock('data_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('data'); $this->parseCurrentBlock(); } // FILESYS DEBUG if (is_array(@$GLOBALS['FILESYS_DEBUG'])) { $name = 'FILESYS'; $time = 0; foreach ($GLOBALS['FILESYS_DEBUG'] as $data) { $this->setCurrentBlock('data_item'); $this->setVariable(array('ACTION' => $data['action'], 'PARAMS' => $data['params'], 'REZ' => $data['rez'])); $this->parseCurrentBlock(); } $this->setCurrentBlock('data_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('data'); $this->parseCurrentBlock(); } // AUTH DEBUG if (is_array(@$GLOBALS['AUTH_DEBUG'])) { $name = 'AUTH'; $time = 0; foreach ($GLOBALS['AUTH_DEBUG'] as $data) { $this->setCurrentBlock('data_item'); $this->setVariable(array('ACTION' => $data['action'], 'PARAMS' => $data['params'], 'REZ' => formatDebug($data['rez']))); $this->parseCurrentBlock(); } $this->setCurrentBlock('data_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); $this->setCurrentBlock('data'); $this->parseCurrentBlock(); } // Email debug $emails = @$GLOBALS['email_debug']; if (isset($emails) && is_array($emails) and sizeof($emails) > 0) { $this->setCurrentBlock('variable_item'); foreach ($emails as $email_name => $email_info) { $this->setVariable(array('NAME' => $email_name, 'VALUE' => '<b>recipients: </b>' . $email_info['recipients'] . HR . '<b>subject: </b>' . $email_info['subject'] . HR . '<b>header: </b>' . $email_info['header'] . HR . '<b>body: </b>' . $email_info['body'])); $this->parseCurrentBlock(); } $this->setCurrentBlock('variable_category'); $this->setVariable(array('NAME' => 'Email send', 'COLOR' => $colors['EMAIL'])); $this->parseCurrentBlock(); } $printed = false; foreach ($debug_array as $name => $array) { if (is_array($array) and sizeof($array) > 0) { $printed = true; $this->setCurrentBlock('variable_item'); foreach ($array as $key => $val) { //don't include previous $_SESSION[old_debug] data if ($key != 'old_debug') { ob_start(); print_r($val); $val_r = ob_get_contents(); ob_end_clean(); $this->setVariable(array('NAME' => $key, 'VALUE' => nl2br($val_r))); $this->parseCurrentBlock(); } } $this->setCurrentBlock('variable_category'); $this->setVariable(array('NAME' => $name, 'COLOR' => $colors[$name])); $this->parseCurrentBlock(); } } if ($printed) { $this->setCurrentBlock('variable'); $this->parseCurrentBlock(); } //get previuos debug data $this->setCurrentBlock('old_debug'); $this->setVariable(array('OLD_DEBUG' => @$_SESSION['old_debug'])); $this->parseCurrentBlock(); // $this->setCurrentBlock('win'); $this->setVariable('EXEC_TIME', $GLOBALS['exec_time']); $this->parseCurrentBlock(); $text = $this->get('win'); $this->setCurrentBlock('js'); $search = array('/[\\n|\\r]*/', "/'/"); $replace = array('', "'"); $text_r = preg_replace($search, $replace, $text); $this->setVariable(array('TEXT' => $text_r)); $this->parseCurrentBlock(); //set this debug data to $_SESSION[old_debug] $output = $this->get('win'); preg_match("/<dontdelete>(.*)<dontdelete>/ms", $output, $matches); $_SESSION['old_debug'] = $matches[1]; return $this->get('js'); } }