protected function fetch_resource($type_folder) { // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."() betreten."); $param = app::$param; $tmpl_dir = ""; if (count($param) > 1) { $tmpl_dir = $param[0] . "/"; $param = array_slice($param, 1); $filename = implode("/", $param); } else { $filename = $param[0]; } $content_type = $this->get_content_type($this->type); if (file_exists(TMPL_DIR . $tmpl_dir . $this->type . "/" . $filename)) { $real_filename = TMPL_DIR . $tmpl_dir . $this->type . "/" . $filename; } elseif (file_exists(TMPL_DIR . "default/" . $this->type . "/" . $filename)) { $real_filename = TMPL_DIR . "default/" . $this->type . "/" . $filename; } else { /** * @TODO: ggf. default-Dateien? */ header("HTTP/1.0 404 Not Found"); return; } header("Content-Type: {$content_type}"); app::$output = file_get_contents($real_filename); return; }
public function fetch_resource($type) { // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."() betreten."); $param = app::$param; $req = app::$request; if (!array_key_exists("playername", $req)) { header("HTTP/1.0 404 Not Found"); return; } $player = $req['playername']; $cls = "model_player" . date("Y"); $avatar = $cls::get_entry_by_playername($player); if (is_null($avatar->avatar_mime) || $avatar->avatar_mime == "") { header("HTTP/1.0 404 Not Found"); return; } header("Content-Type: " . $avatar->avatar_mime); app::$output = stripslashes($avatar->avatar); return; }
public function fetch_resource($type) { // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."() betreten."); $param = app::$param; $req = app::$request; if (!array_key_exists("type", $req) && !array_key_exists("month", $req)) { header("HTTP/1.0 404 Not Found"); return; } $type = $req['type']; $month = intval(date("m")); if (array_key_exists("month", $req)) { $month = intval($req['month']); } $cls = "model_award" . date("Y"); $awrd = $cls::get_entry_by_month_type($month, $type); header("Content-Type: " . $awrd->mime); app::$output = stripslashes($awrd->file); return; }