From 7fac0f20beffe1a1b99351893add73d5eef33f2c Mon Sep 17 00:00:00 2001 From: piernov Date: Thu, 7 Mar 2013 00:08:36 +0100 Subject: Importation initiale du projet --- index.cgi | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 index.cgi (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi new file mode 100755 index 0000000..0d02331 --- /dev/null +++ b/index.cgi @@ -0,0 +1,71 @@ +#!/usr/bin/env ruby1.9.1 +# encoding: utf-8 + +require 'rubygems' +require 'dbi' +require 'cgi' + +require './conf' +db=$db + +require './header' +header, cgi = header_tpe() + +if cgi['id'] =~ /^\d+$/ + id = cgi['id'].to_i +else + id = 10 +end + +entree = cgi['entree'].split("/") + +if cgi['entree'] != "" + page_actuelle = entree +else + page_actuelle = id +end + +require './menu' +menu, longueur_max, id, cur_page = menu_tpe(page_actuelle) +if id == 0 or (not page_actuelle.is_a?(Integer) and cur_page != cgi['entree']) + require './404' + puts error404_tpe(page_actuelle,cur_page) + exit 0 +end + +titre = "Pas de titre" +contenu = "Pas de contenu" +derniere_maj = "" +derniere_maj_form = "" + +db.execute("SELECT titre, entree, contenu, derniere_maj, DATE_FORMAT(derniere_maj, '%W %e %M %Y à %k:%i') as derniere_maj_form FROM pages WHERE id=#{id}").each { |row| titre, entree, contenu, derniere_maj, derniere_maj_form = row} + +header["$titre$"] = " - " + titre + +puts header + +menu["$width$"] = (0.66*longueur_max).to_s() +div_width = (0.66*longueur_max+3).to_s() + +puts menu + +if ENV["HTTP_USER_AGENT"] =~ /MSIE [0-7]/ + contenu = contenu.gsub(".svg", ".png") +end + +puts < +
+

#{titre}

+
+ #{contenu} + +HTML_TPE + +if $Commentaires + require './comments' + puts comments_tpe(cgi,id,cur_page,div_width) +end + +require './footer' +puts footer_tpe(derniere_maj, derniere_maj_form) -- cgit v1.2.3-70-g09d2