style.css // script.php => script.js error_reporting(E_ALL); /* HLKMemo CMS - Core part of DragonFly project Tiny Dynamic Web Text Editor and Content Management System Copyright (C)2007/2011-01-27 STJO/SIII Official Web site : http://hlka.free.fr v2.9 : HlkInternalStyle function v2.8 : NewPage and DeletePage admin buttons v2.7 : Separate Header page management, Style Input Variable, New comment presentation v2.6.3 : Replacing index.php forms with "/" (canceled) v2.6.2 : Adding browse.php and upload.php for CKEditor v2.6.1 : CKEditor Integration // http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Integration // http://stackoverflow.com/questions/1498628/how-can-you-integrate-a-custom-file-browser-uploader-with-ckeditor v2.6 : HLKNOTEDIT avoid visual modification v2.5 : HTML 5 compliant v2.4.3 : new multiple gopage post value v2.4.2 : slash at style and script for URL forwarding compatibility v2.4.1 : include security.php cookie management if exists v2.4 : Manage multiple content/visual edit buttons v2.3 : Manage FCKEditor 2 option v2.2 : Double admin level adding simple backoffice manager v2.1 : PHP Writing Rules, fix empty no-UTF8 file reading bug v2.0 : UTF8 Support v1.9.2 : Title in config v1.9.1 : Creates default design file v1.9.0 : Creates default style, script and function files, style.php replaces style.css, script.php replaces script.js v1.8.2 : XHTML 1.0 w3c compliant v1.8.1 : Fix script ref v1.8.0 : External link to style.css, add script.js and meta edition, chmod 755 v1.7.4 : Fix functions file can null empty v1.7.3 : Page allowed by post, functions included once v1.7.2 : Remove Google verify tag v1.7.1 : External configuration v1.7 : Document File management v1.6.3 : Fix logout with globals off v1.6.2 : Fix include constaint v1.6.1 : Fix textarea bug and html entities bug v1.6 : Separate Edition of the optional Function PHP file v1.5.1 : Fix quote bug v1.5 : Multi PHP Version (for PHP5) v1.4 : Edition of dynamic includes using PHP files v1.3 : Creation of the Design concept Edition including all HTML files v1.2 : Separate Edition of the optional CSS Style file v1.1 : Securization of Edition by Cookies authentification and PHP variables protection v1.0 : Simple HTML file save via TEXTAREA Edition This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ if (file_exists("security.php")) { include "security.php"; } // Default home page name $HLKDEFAULTPAGE = "home"; // Default page extention $HLKDEFAULTEXT = "php"; // Location of uploaded files $HLKDOCUMENTDIR = "img"; // Default style file name $HLKSTYLEFILE = "style.css"; // Default script file name $HLKSCRIPTFILE = "script.js"; // Default design file name $HLKDESIGNFILE = "design.$HLKDEFAULTEXT"; // Default meta file name $HLKMETAFILE = "meta.$HLKDEFAULTEXT"; // Default function file name $HLKFUNCTIONFILE = "functions.$HLKDEFAULTEXT"; // Default config file name $HLKCONFIGFILE = "config.$HLKDEFAULTEXT"; // UTF8 Start file if needed $HLKMAGIC = ""; // "\xEF\xBB\xBF"; // Default Header extention (.+) $HLKDESCRIPTIONEXT = "header.php"; // Default editor width $HLKNBCOL = "75"; // Default editor height $HLKNBROW = "20"; // External WYSIWYG Editor presence //$HLKVISUALEDITOR = "fckeditor/fckeditor.php"; $HLKVISUALEDITOR = "ckeditor/ckeditor_php5.php"; // CSS Style for Text Input $HLKINPUTSTYLE = "color:#000000;background-color:#EEEEEE;font-family:Courier New;font-size:16px;font-weight:bold;"; // Generate default config file if not exists if (!file_exists("$HLKCONFIGFILE")) { $fileout = fopen("$HLKCONFIGFILE", "w+"); fputs($fileout, $HLKMAGIC); fputs($fileout, ""); fclose($fileout); } @include "$HLKCONFIGFILE"; @$logout = $_REQUEST["logout"]; if ($logout != "") { SetCookie("$HLKADMINKEY", "0", time()+3600*24*30, "/", ""); $admin = ""; } else { @$admin = $_COOKIE["$HLKADMINKEY"]; } @$page = str_replace("/", "", strtolower($_REQUEST["page"])); @$newpagename = $_POST["newpagename"]; if ($newpagename != "") { $page = $newpagename; } if (($page == "") || ($page == "index") || ($page == "design")) { $page = $HLKDEFAULTPAGE; } if (isset ($_REQUEST["page"])){ if ($_REQUEST["page"] == 'video/loi-girardin-industriel') { header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/loi-girardin-industriel.htm'); }elseif ($_REQUEST["page"] == 'girardin-industriel-actualites.htm?produit=SNC-LOGSOC') { header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com'); } } switch ($page) { case "girardin-industriel-2010": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/girardin-industriel-2012.htm'); break; case "girardin-industriel-contact": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/girardin-industriel-quisommesnous.htm'); break; case "girardin-industriel-coordonnees": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/girardin-industriel-quisommesnous.htm'); break; case "girardin-industriel-photovoltaique": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/girardin-industriel-realisation.htm'); break; case "girardin-industriel-simulateur": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/girardin-industriel-exemples.htm'); break; case "/video/loi-girardin-industriel": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com/loi-girardin-industriel.htm'); break; case "seminaires-girardin-industriel": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com'); break; case "plan-site": header('Status: 301 Moved Permanently', false, 301); header('Location: http://www.girardin-industriel.com'); break; default: break; } print "\r"; print "\r"; print "\r"; print " $SITENAME\r"; if (file_exists("$HLKMETAFILE")) { include "$HLKMETAFILE"; } else { print " \r"; print " \r"; print " \r"; print " \r"; print " \r"; } // Updating CSS File if ($admin == $HLKADMINVALUE) { @$sendstyle = $_POST["sendstyle"]; @$newstyle = $_POST["newstyle"]; if (($sendstyle != "") && ($newstyle != "")) { $newstyle = stripslashes($newstyle); if (substr($newstyle, 0, strlen($HLKMAGIC)) != $HLKMAGIC) { $newstyle = $HLKMAGIC.$newstyle; } $fileout = fopen($HLKSTYLEFILE, "w"); fwrite($fileout, $newstyle, strlen($newstyle)); fclose($fileout); $editstyle = ""; } } if (file_exists("$HLKSTYLEFILE")) { print " \r"; } // Updating JS File if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$sendscript = $_POST["sendscript"]; @$newscript = $_POST["newscript"]; if (($sendscript != "") && ($newscript != "")) { $newscript = stripslashes($newscript); if (substr($newscript, 0, strlen($HLKMAGIC))!=$HLKMAGIC) { $newscript = $HLKMAGIC.$newscript; } $fileout = fopen($HLKSCRIPTFILE, "w"); fwrite($fileout, $newscript, strlen($newscript)); fclose($fileout); $editscript = ""; } } if (file_exists("$HLKSCRIPTFILE")) { print " \r"; } print "\r"; // Updating Design file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$senddesign = $_POST["senddesign"]; @$newdesign = $_POST["newdesign"]; if (($senddesign != "") && ($newdesign != "")) { $newdesign = stripslashes($newdesign); if (substr($newdesign, 0, strlen($HLKMAGIC))!=$HLKMAGIC) { $newdesign = $HLKMAGIC.$newdesign; } $fileout = fopen($HLKDESIGNFILE, "w"); fwrite($fileout, $newdesign, strlen($newdesign)); fclose($fileout); $editdesign = ""; } } // Updating Functions file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$sendfunctions = $_POST["sendfunctions"]; @$newfunctions = $_POST["newfunctions"]; if (($sendfunctions != "") && ($newfunctions != "")) { $newfunctions = stripslashes($newfunctions); if (substr($newfunctions, 0, strlen($HLKMAGIC))!=$HLKMAGIC) { $newfunctions = $HLKMAGIC.$newfunctions; } $fileout = fopen($HLKFUNCTIONFILE, "w"); fwrite($fileout, $newfunctions, strlen($newfunctions)); fclose($fileout); $editfunctions = ""; } } // Deleting Page if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$deletepage = $_POST["deletepage"]; if ($deletepage != "") { @copy("$page.$HLKDEFAULTEXT", "$page.old"); @unlink("$page.$HLKDEFAULTEXT"); } } // Updating Content file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$sendcontent = $_POST["sendcontent"]; @$newcontent = $_POST["newcontent"]; if (($sendcontent != "") && ($newcontent != "")) { $newcontent = stripslashes($newcontent); if (substr($newcontent, 0, strlen($HLKMAGIC))!=$HLKMAGIC) { $newcontent = $HLKMAGIC.$newcontent; } $fileout = fopen("$page.$HLKDEFAULTEXT", "w"); fwrite($fileout, $newcontent, strlen($newcontent)); fclose($fileout); @chmod("$page.$HLKDEFAULTEXT", 0755); $editcontent = ""; } } // Updating Header file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$sendheader = $_POST["sendheader"]; @$newtitle = str_replace("\"", """, stripslashes($_POST["newtitle"])); @$newdescription = str_replace("\"", """, stripslashes($_POST["newdescription"])); @$newkeywords = str_replace("\"", """, stripslashes($_POST["newkeywords"])); @$newquality = str_replace("\"", """, stripslashes($_POST["newquality"])); if ($sendheader != "") { $fileout = fopen("$page.$HLKDESCRIPTIONEXT", "w"); fputs($fileout, "\r"); fclose($fileout); @chmod("$page.$HLKDESCRIPTIONEXT", 0755); $editheader = ""; } } // Sending new Document file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$sendfile = $_POST["sendfile"]; if ($sendfile != "") { @$userfile = $_FILES["userfile"]["tmp_name"]; @$userfile_name = $_FILES["userfile"]["name"]; @$userfile_size = $_FILES["userfile"]["size"]; @$userfile_type = $_FILES["userfile"]["type"]; if (!empty($userfile) && $userfile != "none") { $userfile_name = strtolower($userfile_name); $userfile_name = str_replace(".","_",$userfile_name); $userfile_name = str_replace("~","_",$userfile_name); $userfile_name = str_replace("@","_",$userfile_name); $userfile_name = str_replace(";","_",$userfile_name); $userfile_name = str_replace(",","_",$userfile_name); $userfile_name = str_replace(" ","_",$userfile_name); $userfile_name = str_replace("'","_",$userfile_name); $userfile_name = str_replace("[","(",$userfile_name); $userfile_name = str_replace("]",")",$userfile_name); if (strrpos($userfile_name, "_")) { $userfile_name[strrpos($userfile_name, "_")] = "."; } $filein = fopen("$userfile", "r"); if ($filein) { $fileout = fopen("$HLKDOCUMENTDIR/$userfile_name", "w"); $contents = fread($filein, filesize("$userfile") ); fwrite($fileout, $contents, filesize("$userfile")); fclose($filein); fclose($fileout); } unlink($userfile); } } } // Deleting Document file if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$deletefile = $_POST["deletefile"]; if ($deletefile != "") { $vars = $_POST; for (reset($vars); $key=key($vars); next($vars)) { if (strtolower(substr($key, 0, 15)) == "deletefilename_") { //var_dump($key); $filename = substr($key, -(strlen($key) - 15)); if (strrpos($filename, "_")) { $filename[strrpos($filename, "_")] = "."; } unlink("$HLKDOCUMENTDIR/$filename"); } } } } if (file_exists("$HLKFUNCTIONFILE")) { @require_once "$HLKFUNCTIONFILE"; } @$filein = fopen($HLKDESIGNFILE, "r"); @$design = fread($filein, filesize($HLKDESIGNFILE)); @fclose($filein); function HlkInternalStyle() { print "\n"; } function HlkDisplay() { global $page, $design, $HLKDESIGNFILE, $HLKDEFAULTEXT; if (($design != "") && ((strpos(" ".$design, "include\"$"."page.$HLKDEFAULTEXT\"") > 0) || (strpos(" ".$design, "include \"$"."page.$HLKDEFAULTEXT\"") > 0)) && (file_exists($HLKDESIGNFILE))) { include "design.$HLKDEFAULTEXT"; } else if (file_exists("$page.".$HLKDEFAULTEXT)) { include "$page.$HLKDEFAULTEXT"; } } function HlkVisualForm($aTitle, $aInputName, $aData, $aSubmitName) { global $page, $HLKNBCOL, $HLKNBROW, $admin, $HLKVISUALEDITOR; if (file_exists($HLKVISUALEDITOR)) { HlkInternalStyle(); print "
\r"; print "\r"; print "
\r"; print "

$aTitle

\r"; if (strpos(" ".$aData, "// HLKNOTEDIT") > 0) { print "Cette page contient essentiellement du code PHP
\r"; print "et n'est pas destinée à être éditée directement.
\r"; print "Veuillez demander à votre développeur d'y accéder par FTP
\r"; print "\r"; } else { // V2 if (false) { include_once("fckeditor/fckeditor.php") ; $oFCKeditor = new FCKeditor("$aInputName") ; $oFCKeditor->BasePath = 'fckeditor/' ; $oFCKeditor->Config['DefaultLanguage'] = "en" ; $oFCKeditor->Height = 650; $oFCKeditor->Width = 600; $oFCKeditor->Value = "$aData"; $oFCKeditor->Create(); } // V3 else { print "\r"; print "\r"; print "\r"; } print "
\r"; print "\r"; print "\r"; print "\r"; } print "
\r"; print "
\r"; } } function HlkEditForm($aTitle, $aInputName, $aData, $aSubmitName) { global $page, $HLKINPUTSTYLE, $HLKNBCOL, $HLKNBROW, $admin; HlkInternalStyle(); print "
\r"; print "\r"; print "
\r"; print "

$aTitle

\r"; print "\r"; print "
\r"; print "\r"; print "\r"; print "\r"; print "
\r"; print "
\r"; } function HlkEditHeader($aTitle, $aPageTitle, $aPageDescription, $aPageKeywords, $aPageQuality, $aSubmitName) { global $page, $HLKINPUTSTYLE, $admin; HlkInternalStyle(); print "
\r"; print "\r"; print "
\r"; print "

$aTitle

\r"; print "\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
"; print "Titre"; print ""; print ""; print "
"; print "Description"; print ""; print ""; print "
"; print "Mots-clés"; print ""; print ""; print "
"; print "Libellé GA"; print ""; print ""; print "
\n"; print "\r"; print "\r"; print "\r"; print "
\r"; print "
\r"; } function HlkFiles($aDir) { global $page, $admin; HlkInternalStyle(); print "
\r"; print "
\r"; print "

File Upload

\r"; print "\r"; print "\r"; print " \r"; print " "; print " "; print " \r"; print "
\r"; print "\r"; print "\r"; print "
\r"; print "
\r"; print "
\r"; print "
\r"; print "

Files

\r"; $handle = opendir("$aDir"); $tabfiles = array(); while ($file = readdir($handle)) { if ($file != ".." && $file != "." && $file != "index.php") { $size = filesize("$aDir/$file"); $date = filemtime("$aDir/$file"); $tabfiles = $tabfiles + array($file => array($date, $size)); } } closedir($handle); $totalsize = 0; ksort($tabfiles); $i = 0; for (reset($tabfiles); $file = key($tabfiles); next($tabfiles)) { $zext = substr($file, -4); $zdate = date("d/m/Y H:i:s", $tabfiles[$file][0]); $zsize = number_format($tabfiles[$file][1]/1024, 1)."Ko"; if ($zext == ".jpg") { print "$file ($zdate) $zsize $zext"; print " "; print "
\r"; } $i++; } print "\r"; print "\r"; print "\r"; print "
\r"; print "
\r"; } function HlkMenu() { global $page, $admin, $HLKADMINVALUE, $HLKBACKVALUE; global $VERSION, $HLKVISUALEDITOR; HlkInternalStyle(); print "
\r"; print "\r"; print "
\r"; if ($admin == $HLKADMINVALUE) { print " \r"; print " \r"; print " \r"; print " \r"; if (file_exists($HLKVISUALEDITOR)) { print " \r"; } print " \r"; print " \r"; print " \r"; print " \r"; print " \r"; print " \r"; print " \r"; print " \r"; print " v$VERSION"; print " \r"; } elseif ($admin == $HLKBACKVALUE) { print " \r"; print " \r"; if (file_exists($HLKVISUALEDITOR)) { print " \r"; } print " \r"; print " \r"; print " \r"; print " \r"; print " v$VERSION"; print " \r"; } print "
\r"; print "
\r"; } print "\r"; if (($admin == $HLKADMINVALUE) || ($admin == $HLKBACKVALUE)) { @$editcontent = $_POST["editcontent"]; @$editvisual = $_POST["editvisual"]; @$editheader = $_POST["editheader"]; for (reset($_POST); $key = key($_POST); next($_POST)) { if (substr($key, 0, 7) == "gopage_") { $page = substr($key, 7, strlen($key) - 7); } elseif (substr($key, 0, 12) == "editcontent_") { $editcontent = "1"; $page = substr($key, 12, strlen($key) - 12); } elseif (substr($key, 0, 11) == "editvisual_") { $editvisual = "1"; $page = substr($key, 11, strlen($key) - 11); } if ((substr($page, -2) == "_x") || (substr($page, -2) == "_y")) { $page = substr($page, 0, strlen($page) - 2); } } @$editstyle = $_POST["editstyle"]; @$editscript = $_POST["editscript"]; @$editdesign = $_POST["editdesign"]; @$editfunctions = $_POST["editfunctions"]; @$managefiles = $_POST["managefiles"]; // Editing Content file if ($editcontent != "") { @$filein = fopen("$page.$HLKDEFAULTEXT", "r"); @$content = fread($filein, filesize("$page.$HLKDEFAULTEXT")); @fclose($filein); HlkEditForm("$page.$HLKDEFAULTEXT", "newcontent", $content, "sendcontent"); } // Editing Header files elseif ($editheader != "") { @include("$page.$HLKDESCRIPTIONEXT"); HlkEditHeader("$page.$HLKDESCRIPTIONEXT", @$PAGETITLE, @$PAGEDESCRIPTION, @$PAGEKEYWORDS, @$PAGEQUALITY, "sendheader"); } // Editing Content file with FCK elseif ($editvisual != "") { @$filein = fopen("$page.$HLKDEFAULTEXT", "r"); @$content = fread($filein, filesize("$page.$HLKDEFAULTEXT")); @fclose($filein); HlkVisualForm("$page.$HLKDEFAULTEXT", "newcontent", $content, "sendcontent"); } // Editing CSS file elseif ($editstyle != "") { if (!file_exists("$HLKSTYLEFILE")) { $fileout = fopen($HLKSTYLEFILE,"w"); fputs($fileout, "\r"); fputs($fileout, "body\r"); fputs($fileout, "{\r"); fputs($fileout, " \r"); fputs($fileout, "}\r"); fclose($fileout); } @$filein = fopen($HLKSTYLEFILE, "r"); @$css = fread($filein, filesize($HLKSTYLEFILE)); @fclose($filein); HlkEditForm($HLKSTYLEFILE, "newstyle", $css, "sendstyle"); } // Editing JS file elseif ($editscript != "") { if (!file_exists("$HLKSCRIPTFILE")) { $fileout = fopen($HLKSCRIPTFILE, "w"); fputs($fileout, "\r"); fputs($fileout, "{\r"); fputs($fileout, " \r"); fputs($fileout, "}\r"); fclose($fileout); } @$filein = fopen($HLKSCRIPTFILE,"r"); @$js = fread($filein, filesize($HLKSCRIPTFILE)); @fclose($filein); HlkEditForm($HLKSCRIPTFILE, "newscript", $js, "sendscript"); } // Editing Design file elseif ($editdesign != "") { if (!file_exists("$HLKDESIGNFILE")) { $fileout = fopen($HLKDESIGNFILE, "w"); fputs($fileout, "\r"); fclose($fileout); } @$filein = fopen($HLKDESIGNFILE, "r"); @$design = fread($filein, filesize($HLKDESIGNFILE)); @fclose($filein); HlkEditForm($HLKDESIGNFILE, "newdesign", $design, "senddesign"); } // Editing Functions file elseif ($editfunctions != "") { if (!file_exists("$HLKFUNCTIONFILE")) { $fileout = fopen($HLKFUNCTIONFILE, "w"); fputs($fileout, "\r"); fclose($fileout); } @$filein = fopen($HLKFUNCTIONFILE, "r"); @$functions = fread($filein, filesize($HLKFUNCTIONFILE)); @fclose($filein); HlkEditForm($HLKFUNCTIONFILE, "newfunctions", $functions, "sendfunctions"); } // Managing Files elseif ($managefiles != "") { HlkMenu(); HlkFiles($HLKDOCUMENTDIR); } // Admin Menu else { HlkMenu(); HlkDisplay(); } } else { HlkDisplay(); } print "\r"; //print "(new)"; print "\r"; print "\r"; ?>