summaryrefslogtreecommitdiffstats
path: root/index.cgi
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2013-03-07 00:08:36 +0100
committerpiernov <piernov@piernov.org>2013-03-07 00:08:36 +0100
commit7fac0f20beffe1a1b99351893add73d5eef33f2c (patch)
tree162c2ff1b2aa0709c2de26d0399106b1a5368708 /index.cgi
downloadRuDynFrame-7fac0f20beffe1a1b99351893add73d5eef33f2c.tar.gz
RuDynFrame-7fac0f20beffe1a1b99351893add73d5eef33f2c.tar.bz2
RuDynFrame-7fac0f20beffe1a1b99351893add73d5eef33f2c.tar.xz
RuDynFrame-7fac0f20beffe1a1b99351893add73d5eef33f2c.zip
Importation initiale du projetHEADmaster
Diffstat (limited to 'index.cgi')
-rwxr-xr-xindex.cgi71
1 files changed, 71 insertions, 0 deletions
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 <<HTML_TPE
+ <article style="margin-left:#{div_width}em">
+ <header>
+ <h1>#{titre}</h1>
+ </header>
+ #{contenu}
+ </article>
+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)