* pour le formulaire d'authentification * et permettra de lancer l'action requerant une authentification * apres la validation de ce formulaire d'authentification * */ if (isset($_GET['archiActionPrecedente']) && $_GET['archiActionPrecedente'] != '') { $archiAction = $_GET['archiActionPrecedente']; } // Authentification requise pour ces actions : if ($authentification->estConnecte()) { switch ($archiAction) { case 'refreshCache': $cache = new cacheObject(); $cache->refreshCachedPages(); break; case 'resetCache': $cache = new cacheObject(); $cache->resetCache(); break; case 'administration': $administration = new archiAdministration(); // Affichage de la liste des données de la table selectionnée echo $administration->administre(array('tableName' => $_GET['tableName'], 'noAjouterButton' => 1, 'noSupprimerButton' => 1), 'action'); break; case 'adminEnregistreModifAdresse': $adresse = new archiAdresse(); $errors = $adresse->enregistreModificationAdresse(); if (count($errors) == 0) { $generateur = new formGenerator(); echo $generateur->afficheFormulaireListe(array_merge($_GET, array('modeAffichageLienDetail' => "adminAdresseDetail", "actionAffichageFormulaireIfSubmit" => $adresse->creerUrl('', 'adminElementAdresse', array('tableName' => $_GET['tableName']))))); } else { echo _("Erreur lors de l'enregistrement.") . "<br>";
function bootstrap() { global $CONFIG, $SYSTEM_INFO, $output_started, $body_started, $console, $profiler, $ALLOWED_MGMT_FUNCS; header("Content-type: application/xhtml+xml\r"); $console = new SystemConsole(); DEBUG("<strong>This is 29o3 " . $SYSTEM_INFO['SystemVersion'] . " Codename " . $SYSTEM_INFO['SystemCodename'] . "</strong>"); DEBUG("SYS: Bootstrapping started..."); $connector = new DatabaseConnector(); $connector->setupConnection($CONFIG['DatabaseHost'], $CONFIG['DatabaseUser'], $CONFIG['DatabasePassword'], $CONFIG['DatabaseName'], $CONFIG['DatabasePort']); DEBUG("DB: Connected to database."); $request = new PageRequest($connector); $request->parseRequest(); // instanciate new cache object $co = new cacheObject($connector, $request->getRequestedSite(), $request->getRequestedPage()); // check if we have content for current page cached $cacheContent = $co->getCached(); if ($cacheContent === false) { // construct header and body objects $header = new XHTMLHeader(); $body = new XHTMLBody(); $pdo = new pageDescriptionObject($header, $body, $connector, $request->getWantAdmin(), $request->getAdminFuncParam()); $connector->executeQuery("SELECT * FROM " . mktablename("pages") . " WHERE name='" . $request->getRequestedPage() . "'"); /* lets see what the admin wants */ if ($request->getWantAdmin()) { if ($request->getRequestedPage() == "overview") { } } $pageInfo = $connector->fetchArray(); $pdo->setPageDescriptionA($pageInfo, $request->getRequestedSite()); $header->setTitle($pdo->getContent("title")); if ($pdo->getContent("description") != "") { $header->addMetaDCDescription($pdo->getContent('description')); } if ($pdo->getContent("subject") != "") { $header->addMetaDCSubject($pdo->getContent("subject")); } if ($pdo->getContent("date") != 0) { $header->addMetaDCDate(strftime("%Y-%m-%d", $pdo->getContent('date'))); } if ($pdo->getContent("creator") != "") { $header->addMetaDCCreator($pdo->getContent("creator")); } if ($pdo->getContent("contributors") != "") { $c_arr = explode(";", $pdo->getContent('contributors')); for ($i = 0; $i <= count($c_arr) - 1; $i++) { $header->addMetaDCContributor($c_arr[$i]); } } if ($pdo->getContent("type") != "") { $header->addMetaDCType($pdo->getContent("type")); } if ($pdo->getContent("sources") != "") { $sources_array = explode(";", $pdo->getContent('sources')); for ($i = 0; $i <= count($sources_array) - 1; $i++) { $header->addMetaDCSource($sources_array[$i]); } } /* !!! FIXME: THE FOLLOWING CODE CAUSES A RACE CONDITION ON BOTH APACHE2/PHP !!! AND PHP-CLI. !!! SEV: (5) - Causes server process to fill RAM and swap -> kill !!! RES: Currently no resolution, commented out because of this. !!! I'd say it has got something to do with the database for !!! I cannot find an error elsewhere. >!< *** FIXED *** >!< F**K YOU F**K YOU DAMN CODER!!!! F**K YOU!!! */ if ($pdo->getContent("language") != "") { $header->addMetaDCLanguage($pdo->getContent('language')); } if ($pdo->getContent('copyright') != "") { $header->addMetaDCRights($pdo->getContent("copyright")); } // this is the r0x0r1ng stylesheet which controls how system messages (errors, etc.) appear $pdo->scheduleInsertion_ExternalStylesheet("n_style.css"); if ($pdo->getContent('no_cache') == 1) { $co->setScheduleCaching(false); DEBUG("CACHE: Caching deactivated on request."); } // now, get the page's stylesheet; it might be empty, but we'll add it if not :) if ($request->getWantAdmin() <= 1) { if ($request->getWantAdmin() == 1) { $co->setScheduleCaching(false); DEBUG("CACHE: Admin wanted, caching deactivated."); } $layoutManager = new LayoutManager($pdo); $pdo->getAvailableBoxes(); $connector->executeQuery("SELECT * FROM " . mktablename("layouts") . " WHERE lname='" . $pageInfo['layout'] . "'"); if ($connector->getNumRows() != 0) { $currentLayout = $connector->fetchArray(); $layoutManager->setLayoutFile($currentLayout['file']); $layoutManager->parseLayout(); } else { throw new GeneralException("No layout found. 29o3 cannot continue."); } if ($request->getWantAdmin()) { require_once $CONFIG['LibDir'] . 'admin/adminFuncs.php'; $af = new adminFuncs($pdo, $request); $pdo->scheduleInsertion_ExternalStylesheet($af->getAdminStylesheet()); } DEBUG("DB: " . $connector->getExecutedQueries() . " queries executed."); $connector->closeConnection(); DEBUG("DB: Connection closed."); $profiler->addBreakpoint(); DEBUG("SYS: Resource usage, sys:" . $profiler->getBreakpointGrandSysDifference() . "µs usr:"******"µs"); DEBUG("SYS: Exiting normally."); // print the buffer of the header since we're done with it :) $pdo->doInsertions(); // we have everything at this point... start caching procedure $co->doCache($pdo->getBuffers()); if ($CONFIG['Developer_Debug'] == true) { if ($body) { $body->eyecandyConsole($console); } else { $console->printBuffer(); } } if ($pdo->getBrandingState() == true) { $pdo->insertBodyDiv("Powered by <a href=\"http://twonineothree.berlios.de\">29o3</a> " . $SYSTEM_INFO["SystemVersion"] . " Codename " . $SYSTEM_INFO["SystemCodename"], "poweredBy", "poweredBy_Banner", "Powered by 29o3"); } printf('<?xml version="1.0" encoding="UTF-8"?>'); printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">%s', "\n"); printf('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">%s', "\n"); $pdo->printHeaderBuffer(); $header_started = true; // destruct the header object $pdo->destroyHeaderObject(); $body_started = true; // print out the body buffer $pdo->printBodyBuffer(); printf('</html>'); // exit normally. exit(0); } else { $co->setScheduleCaching(false); $pdo->setOmitBranding(true); DEBUG("CACHE: Admin wanted, caching deactivated."); require_once $CONFIG['LibDir'] . 'admin/adminFuncs.php'; $co->setScheduleCaching(false); $af = new adminFuncs($pdo, $request); $pdo->scheduleInsertion_ExternalStylesheet($af->getAdminStylesheet()); // $pdo->insertBodyDiv("<img src=\"lib/images/adminlogotop.png\" style=\"vertical-align: top; text-align: left; border: 0; padding: 0; margin: 0;\" /><span class=\"adminMenu\" style=\"width: 100%;\">" . $af->getAdminMenu() . "</span>", "adminStripe", "2mc_menu", "29o3 management console"); // this part is for the admin scripts which require // are not fetched from database DEBUG("SYS: Skipping normal layout and box fetching procedures"); $header->setTitle("29o3 management console"); $ao = NULL; $func = $request->getWantedAdminFunc(); if (!array_search($func, $ALLOWED_MGMT_FUNCS)) { $func = "Overview"; } // administration needs admin logged in $sm = new sessionManager($connector); if ($sm->checkSession() == false) { DEBUG("MGMT: Admin not logged in."); $func = "Login"; } if ($func == "Logout") { $sm->invalidateSession(); header("Location: " . mksyslink("?")); } require_once $CONFIG["LibDir"] . 'admin/admin' . $func . '.php'; $name = "Admin" . $func; $ao = new $name($connector, $pdo, $sm); $ao->doPreBodyJobs(); $pdo->insertIntoBodyBuffer($af->getAdminMenu()); $ao->doBodyJobs(); DEBUG("DB: " . $connector->getExecutedQueries() . " queries executed."); $profiler->addBreakpoint(); DEBUG("SYS: Resource usage, sys:" . $profiler->getBreakpointGrandSysDifference() . "µs usr:"******"µs"); $connector->closeConnection(); DEBUG("DB: Connection closed."); DEBUG("SYS: Exiting normally."); if ($CONFIG['Developer_Debug'] == true) { if ($body) { $body->eyecandyConsole($console); } else { $console->printBuffer(); } } // $pdo->insertBodyDiv("Powered by <a href=\"http://twonineothree.berlios.de\">29o3</a> " . $SYSTEM_INFO["SystemVersion"] . " Codename " . $SYSTEM_INFO["SystemCodename"], "poweredBy", "poweredBy_Banner", "Powered by 29o3"); // print the buffer of the header since we're done with it :) printf('<?xml version="1.0" encoding="UTF-8"?>'); printf('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">%s', "\n"); printf('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">%s', "\n"); $pdo->doInsertions(); $pdo->printHeaderBuffer(); $header_started = true; // destruct the header object $pdo->destroyHeaderObject(); $body_started = true; // print out the body buffer $pdo->printBodyBuffer(); printf('</html>'); // exit normally exit(0); } } else { echo $co->getCacheContent(); DEBUG("DB: " . $connector->getExecutedQueries() . " queries executed."); $profiler->addBreakpoint(); DEBUG("SYS: Resource usage, sys:" . $profiler->getBreakpointGrandSysDifference() . "µs usr:"******"µs"); $connector->closeConnection(); DEBUG("DB: Connection closed."); DEBUG("SYS: Exiting normally."); if ($CONFIG['Developer_Debug'] == true) { echo '<center><div class="eyecandyConsole">' . $console->getBuffer() . '</div></center>'; } echo "\n</body>\n</html>"; // exit normally exit(0); } // never reached }
public function ajouterHistoriqueAdresse($idAdresse) { $html = ''; $authentifie = new archiAuthentification(); $formulaire = new formGenerator(); if ($authentifie->estConnecte()) { $tabForm = $this->getAdresseFields(); if (isset($this->variablesPost['submit'])) { $this->connexionBdd->getLock(array('historiqueAdresse')); $errors = $formulaire->getArrayFromPost($tabForm); $this->nettoieCoordonneesAdresse($tabForm); // permet de garder l'id de la rue, quartier, sousQuartier le plus bas dans la hierarchie , a partir duquel on peut retrouver le reste if (count($errors) == 0) { // on regarde si l'adresse existe deja parmis les adresses valides (non "archivees") $sql = "\n\t\t\t\t\t\t\tSELECT ha.idAdresse\n\t\t\t\t\t\t\tFROM historiqueAdresse ha\n\t\t\t\t\t\t\tWHERE ha.idAdresse = " . $idAdresse . "\n\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tha.idRue='" . mysql_escape_string($tabForm['rue']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\tAND ha.idSousQuartier='" . mysql_escape_string($tabForm['sousQuartier']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.idQuartier='" . mysql_escape_string($tabForm['quartier']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.idVille='" . mysql_escape_string($tabForm['ville']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.idPays='" . mysql_escape_string($tabForm['pays']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.numero = '" . mysql_escape_string($tabForm['numero']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.nom='" . mysql_escape_string($tabForm['nom']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ha.description='" . mysql_escape_string($tabForm['description']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tha.date='" . $this->date->toBdd($tabForm['date']['value']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; $resCheckExist = $this->connexionBdd->requete($sql); if (mysql_num_rows($resCheckExist) > 0) { echo "Cet enregistrement existe deja dans la base, si vous n'avez pas mis les mêmes informations, assurez vous d'avoir bien changé la date."; // recuperation de l'id existant $fetchAdresseExistante = mysql_fetch_array($resCheckExist); } else { // ajout $sql = "INSERT INTO historiqueAdresse (idUtilisateur, idAdresse,date,description,nom,idRue,numero,idQuartier,idSousQuartier,idPays,idVille) VALUES (\n\t\t\t\t\t\t\t\t'" . $authentifie->getIdUtilisateur() . "',\n\t\t\t\t\t\t\t\t\t\t'" . $idAdresse . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\"" . $this->date->toBdd($tabForm['date']['value']) . "\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"" . $tabForm['description']['value'] . "\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"" . $tabForm['nom']['value'] . "\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['rue']['value'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['numero']['value'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['quartier']['value'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['sousQuartier']['value'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['pays']['value'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $tabForm['ville']['value'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)"; $this->connexionBdd->requete($sql); $cache = new cacheObject(); $cache->refreshCache(); echo 'votre modification a bien été prise en compte'; } } $this->connexionBdd->freeLock(array('historiqueAdresse')); $html .= $this->afficheFormulaire($tabForm, $idAdresse); } else { $html .= $this->afficheFormulaire(array(), $idAdresse); } } else { $html .= "archiAdresse::modifier() => probleme d'authentification ou d'identifiant transmis"; } return $html; }
<?php // recuperation du fichier a partir de la liste et du repertoire identifié par iddossier // recherche de la date dans la base de donnee archiv2, enregistrements dans les repertoires en redimensionnant avec // comme nom idHistoriqueImage ini_set('max_execution_time', 0); include 'PEAR.php'; include 'HTML/BBCodeParser.php'; //include('/home/pia/archiv2/includes/framework/config.class.php'); include '/home/vhosts/fabien/archi-strasbourg-v2/includes/framework/config.class.php'; //include_once('/home/pia/archiv2/modules/archi/includes/archiAccueil.class.php'); //include_once('/home/pia/archiv2/modules/archi/includes/archiAdresse.class.php'); //include_once('/home/pia/archiv2/modules/archi/includes/archiImage.class.php'); include_once '/home/vhosts/fabien/archi-strasbourg-v2/modules/archi/includes/archiAccueil.class.php'; include_once '/home/vhosts/fabien/archi-strasbourg-v2/modules/archi/includes/archiAdresse.class.php'; include_once '/home/vhosts/fabien/archi-strasbourg-v2/modules/archi/includes/archiImage.class.php'; $config = new ArchiConfig(); $cache = new cacheObject(); $cache->refreshCachedPages();