error .= "Name not set."; $this->errno = 1; return false; } // Init debug value $this->debug = $debug; // Set the name of the project $this->Name = $name; $this->menu = array(); } function add($name, $val) { if($name == "") { $this->error .= "Parameter name not set ($name => $val)"; $this->errno = 1; return false; } if($this->debug) $this->dbg .= "$name => $val\n"; $this->val[$name] = $val; return true; } function dbgConfigValues() { reset ($this->val); while (list ($key, $val) = each ($this->val)) { echo "$key => $val
"; } } function addMenuItem($label, $link, $admin, $position = -1) { if($position < 0 || $position >= count($this->menu)) $this->menu[count($this->menu)] = array("label" => $label, "link" => $link, "admin" => $admin); else { $beginning = array_slice($this->menu, 0, $position); $end = array_slice($this->menu, $position); $beginning[count($beginning)] = array("label" => $label, "link" => $link, "admin" => $admin); $this->menu = array_merge($beginning, $end); } } function resetMenu() { reset($this->menu); } function getMenuLine($template, $admin, $position) { $item = current($this->menu); if($item == false) return false; if($item["admin"] == true && $admin == false) { next($this->menu); return ""; } if(isset($this->val["HideCurrentNode"]) && $this->val["HideCurrentNode"] == "true" && preg_match('#'.$item["link"] . "$#", $position)) { next($this->menu); return ""; } // Determino se l'item corrente e' quello selezionato if(isset($this->val["HighlightCurrentNode"]) && $this->val["HighlightCurrentNode"] == "true") { $file = basename($item["link"]); $variables = array(); if(preg_match("/^.*\?/", $file)) { $vars_part = preg_replace("/^.*\?/", "", $file); $vars_part_array = explode('&', $vars_part); } else { $vars_part = ""; $vars_part_array = array(); } while(list($k, $v) = each($vars_part_array)) { $var = explode("=", $v); $variables[htmlspecialchars(urldecode($var[0]))] = htmlspecialchars(urldecode($var[1])); } // Seleziono solo la parte del filename $file = preg_replace("/\?.*$/", "", $file); $highlight = true; if($highlight && !preg_match("/^" . $file . "/", basename($position))) { $highlight = false; } if($highlight) { while(list($k, $v) = each($variables)) { if(!isset($_REQUEST[$k]) || $_REQUEST[$k] != $v ) { $highlight = false; } } } if($highlight) { $template = preg_replace("/#highlight#/", "id=\"highlight\"", $template); } else { $template = preg_replace("/#highlight#/", "", $template); } } $output = preg_replace("/#link#/", $item["link"], $template); if(function_exists("msg")) { $output = preg_replace("/#label#/", msg($item["label"]), $output); } else { $output = preg_replace("/#label#/", $item["label"], $output); } next($this->menu); return $output; } } ?> error .= '$Cfg (ConfigClass) object not set.'; $this->status = 1; return; } $this->Cfg = &$Cfg; if(!is_object($Html) && get_class($Html) != "HtmlClass") { $this->error .= '$Html (HtmlClass) object not set.'; $this->status = 1; return; } $this->Html = &$Html; // Init debug value $this->debug = $debug; // Init login string from config if($this->Cfg->val["loginString"] == "") { $this->error .= 'loginString not set in configuration file.'; $this->status = 1; return; } else $this->loginString = $this->Cfg->val["loginString"]; $this->conn = pg_connect($this->Cfg->val["loginString"]); if( !$this->conn ) { $this->status = 1; $this->error .= "Unable to connect to PostgreSQL DBMS!"; return; } $result = $this->dbExec("SET DATESTYLE=EUROPEAN;"); pg_FreeResult($result); if(isset($this->Cfg->val["dbEncoding"]) && $this->Cfg->val["dbEncoding"] != "") { $result = $this->dbExec("SET client_encoding = '" . $this->Cfg->val["dbEncoding"] . "';"); } } function logoutDB() { if($this->conn) pg_close($this->conn); } function dbExec($query) { if($this->debug && $this->Html->headerSent) echo("" . $query . "\n"); else if($this->debug) $this->Html->addToDbg("" . $query . "\n"); $result = pg_exec($this->conn, $query); // Error checking if($result == false) { $this->error = "
" . pg_ErrorMessage($this->conn) . "
"; $this->Html->addToDbg("
" .
                            pg_ErrorMessage($this->conn) . "
\n"); } return $result; } function db_num_fields($result) { return pg_num_fields($result); } function db_field_name($result, $n) { return pg_field_name($result, $n); } function db_num_rows($result) { return pg_num_rows($result); } function db_fetch_array($result, $idx, $result_type = PGSQL_BOTH) { return pg_fetch_array($result, $idx, $result_type); } function db_fetch_row($result, $idx) { return pg_fetch_row($result, $idx); } function db_free_result($result) { return pg_free_result($result); } function db_escape_string($string) { return pg_escape_string($string); } } ?> ] = true|false var $Capability = array(); function LoginClass() { global $Cfg, $Html, $Db, $debug; if(!is_object($Cfg) && get_class($Cfg) != "ConfigClass") { $this->error .= '$Cfg (ConfigClass) object not set.'; $this->status = 1; return; } $this->Cfg = &$Cfg; if(!is_object($Html) && get_class($Html) != "HtmlClass") { $this->error .= '$Html (HtmlClass) object not set.'; $this->status = 1; return; } $this->Html = &$Html; if(!is_object($Db) && (get_class($Db) != "PostgresClass" || get_class($Db) != "MysqlClass")) { $this->error .= '$Db (DbClass) object not set.'; $this->status = 1; return; } $this->Db = &$Db; // Init debug value $this->debug = $debug; // Init values for names of table and fields of login handler if($this->Cfg->val["TabName"] != "") $this->TabName = $this->Cfg->val["TabName"]; if($this->Cfg->val["TabID"] != "") $this->TabID = $this->Cfg->val["TabID"]; if($this->Cfg->val["TabUsername"] != "") $this->TabUsername = $this->Cfg->val["TabUsername"]; if($this->Cfg->val["TabPassword"] != "") $this->TabPassword = $this->Cfg->val["TabPassword"]; if($this->Cfg->val["TabDisplayName"] != "") $this->TabDisplayName = $this->Cfg->val["TabDisplayName"]; if(isset($this->Cfg->val["TabLog"]) && $this->Cfg->val["TabLog"] != "") $this->TabLog = $this->Cfg->val["TabLog"]; if(isset($this->Cfg->val["Multilanguage"]) && $this->Cfg->val["Multilanguage"] == "true") { $this->MultiLang = true; } // Cookie timeout if (isset($this->Cfg->val["CookieTimeout"]) && intval($this->Cfg->val["CookieTimeout"]) > 0) $this->CookieTimeout = intval($this->Cfg->val["CookieTimeout"]); else $this->CookieTimeout = 1800; // 30 minutes } function doLogin($Username = "", $Password = "") { global $_COOKIE, $_GET, $_POST, $_SESSION; if($Username == "") $Username = get_passed_var("Username"); if($Password == "") $Password = get_passed_var("Password"); // Verify if cookie is set and check for its validity. if(isset($_COOKIE[$this->Cfg->Name . "Login"]) && $_COOKIE[$this->Cfg->Name . "Login"] != "" && ($Username == "" && $Password == "")) { $id=preg_replace("/:.*$/", "", $_COOKIE[$this->Cfg->Name . "Login"]); $sum=preg_replace("/^.*:/", "", $_COOKIE[$this->Cfg->Name . "Login"]); $this->UserID = $id; $query = "SELECT u.\"" . $this->TabID . "\" AS id, ". "u.\"" . $this->TabUsername . "\" AS username, " . "u.\"" . $this->TabPassword . "\" AS password ". ($this->MultiLang ? ", l.\"" . $this->Cfg->val["TabLangRetval"] . "\" AS language " : "" ). "FROM \"" . $this->TabName . "\" u ". ($this->MultiLang ? "LEFT OUTER JOIN \"" . $this->Cfg->val["TabLangTable"] . "\" l ON ". "u.\"" . $this->Cfg->val["TabLangField"] . "\" = ". "l.\"" . $this->Cfg->val["TabLangId"] . "\" " : "" ). "WHERE u.\"" . $this->TabID . "\" = '" . $id . "';"; $result = $this->Db->dbExec($query); // Exactly 1 user corresponds. if($this->Db->db_num_rows($result) == 1) { $row = $this->Db->db_fetch_array($result, 0); $thisTime = md5($row["username"] . ":" . $row["password"]); if(trim($sum) == trim($thisTime)) { // Login ok. // Refresh cookie. if(!headers_sent()) { setcookie($this->Cfg->Name . "Login", $id . ":" . $sum, time()+$this->CookieTimeout, "/"); } // Update online status if requested if(isset($this->Cfg->val["OnlineStatus"])) $this->updateOnlineStatus(); $this->Username = $row["username"]; $this->Verified = true; return true; } else { // Checksum failed. $this->loginForm("Checksum failed: ticket corrupted. Unable to login."); $this->Verified = false; return false; } } else { $this->loginForm("Login incorrect."); $this->Verified = false; return false; } } // If cookie is not set and $Username and $Password are set, try to login else if($Username != "" && $Password != "") { // Verify if User and Pass are correct. $query = "SELECT u.\"" . $this->TabID . "\" AS id, ". "u.\"" . $this->TabUsername . "\" AS username, " . "u.\"" . $this->TabPassword . "\" AS password ". ($this->MultiLang ? ", l.\"" . $this->Cfg->val["TabLangRetval"] . "\" AS language " : "" ) . "FROM \"" . $this->TabName . "\" u ". ($this->MultiLang ? "LEFT OUTER JOIN \"" . $this->Cfg->val["TabLangTable"] . "\" l ". "ON u.\"" . $this->Cfg->val["TabLangField"] . "\" = ". "l.\"" . $this->Cfg->val["TabLangId"] . "\" " : "" ) . "WHERE u.\"" . $this->TabUsername . "\" ILIKE '" . $Username . "';"; $result = $this->Db->dbExec($query); // Exactly 1 user corresponds. if($this->Db->db_num_rows($result) == 1) { $row = $this->Db->db_fetch_array($result, 0); // Is the password is stored encrypted with md5? if($this->Cfg->val["TabMd5"] == "1") $Password = crypt($Password, $row["password"]); if($Password == $row["password"]) { // Prepare the cookie $row = $this->Db->db_fetch_array($result, 0); $string = $row["id"] . ": " . md5($row["username"] . ":" . $row["password"]); $set = setcookie($this->Cfg->Name . "Login", $string, time()+$this->CookieTimeout, "/"); } // password incorrect => error. else { $this->loginForm("Login incorrect."); $this->Verified = false; return false; } } // 0 or more than 1 user => error. else { $this->loginForm("Login incorrect."); $this->Verified = true; return false; } $this->UserID = $row["id"]; $this->Username = $row["username"]; if($this->MultiLang) { $_SESSION["lang"] = $row["language"]; $this->Html->setLang(); $this->Html->loadTemplate(); } $this->Db->db_free_result($result); // Update online status if requested if(isset($this->Cfg->val["OnlineStatus"])) $this->updateOnlineStatus(); $this->log_login_event(); $this->Verified = true; return true; } // If cookie is not set and there are not $Username and $Password vars, // print out login form else { $this->loginForm(""); $this->Verified = false; return false; } } // Sets the login cookie using the password sent already encrypted // For compatibility with pre-law-196/03 procedure function doLoginEnc($Id, $Username, $PasswordEnc) { $string = $Id . ": " . md5($Username . ":" . $PasswordEnc); setcookie($this->Cfg->Name . "Login", $string, time() + $this->CookieTimeout, "/"); return true; } // Mantainence of a table with a line for every user logged in, with the // timestamp of the last request. function updateOnlineStatus($logout = false) { // If the table is not set return silently if(!isset($this->Cfg->val["OnlineStatus"])) return false; // Delete all the lines that concern me. $query = "DELETE FROM " . $this->Cfg->val["OnlineStatus"] . " WHERE id = " . $this->UserID . ";"; $result = $this->Db->dbExec($query); // Delete the lines older than the duration of the session $query = "DELETE FROM " . $this->Cfg->val["OnlineStatus"] . " WHERE tstamp < now() - '" . $this->Cfg->val["CookieTimeout"] . "'::interval;"; $result = $this->Db->dbExec($query); if($logout != true) { // Add a line about this interaction with the db $query = "INSERT INTO " . $this->Cfg->val["OnlineStatus"] . " VALUES (" . $this->UserID . ", now())"; $result = $this->Db->dbExec($query); } } // Get the number of users online function getOnlineStatus($what = "number") { // If the table is not set return silently if(!isset($this->Cfg->val["OnlineStatus"])) return false; $output = "
Users online: "; if($what == "number") { $query = "SELECT count(*) FROM " . $this->Cfg->val["OnlineStatus"] . ";"; $result = $this->Db->dbExec($query); if($this->Db->db_num_rows($result) == 0) $output .= "0"; else { $row = $this->Db->db_fetch_array($result, 0); $output .= $row[0]; $this->Db->db_free_result($result); } } $output .= "
\n"; return $output; } // Prints the form and, if necessary, an error message to say why previous // login attempt failed. function loginForm($error) { global $_SERVER; $output = ""; // Set error string $this->errorStr = $error; if($this->silent) { return; } if(!$this->Html->usingTemplate) { // Head $this->Html->printHeader(); } if($error != "") { $output = "
" . $error . "

\n"; } if(isset($this->Cfg->val["loginFormRedirectTo"]) && $this->Cfg->val["loginFormRedirectTo"] != "") { $redirect_to = $this->Cfg->val["loginFormRedirectTo"]; $Logout = get_passed_var("Logout"); if(isset($Logout) && $Logout == "true") { if(preg_match("/\?/", $redirect_to)) { $redirect_to .= "&Logout=true"; } else { $redirect_to .= "?Logout=true"; } } if(!headers_sent()) { header("location: " . $redirect_to); } $redirect = "\n"; $Html->setOutput("head", $redirect); } // Body // The file must be pure html or php, but it must begin after the // tag and end before (both excluded) else if($this->Cfg->val["loginFormFile"] != "" && preg_match("/\.php$/", $this->Cfg->val["loginFormFile"]) && file_exists($this->Cfg->val["loginFormFile"])) { include($this->Cfg->val["loginFormFile"]); } else if($this->Cfg->val["loginFormFile"] != "" && file_exists($this->Cfg->val["loginFormFile"])) { $output .= file_get_contents($this->Cfg->val["loginFormFile"]); } else { $output .= "
\n". "
" . " \n". " \n". " \n". "
\n". " Username:\n". " \n". " \n". "
\n". " Password:\n". " \n". " \n". "
\n". " \n" . " \n". "
\n". "
\n"; } if(! $this->Html->usingTemplate) { echo $output; // Tail $this->Html->printFooter(); } else { $this->Html->setOutput($this->Cfg->val["templateMainRegion"], $output); $this->Html->setOutput($this->Cfg->val["templateFooterRegion"], menuFooter()); $this->Html->printOutput(); } $this->Db->logoutDB(); exit; } function doLogout($printForm = true) { setcookie($this->Cfg->Name . "Login", "", time()-18000, "/"); @session_destroy(); // Update online status if requested if(isset($this->Cfg->val["OnlineStatus"])) $this->updateOnlineStatus(true); if($printForm) $this->loginForm(""); $this->Verified = false; return false; } function setCapabilities() { if(isset($this->Cfg->val["CapabilityList"]) && $this->Cfg->val["CapabilityList"] != "") { $caps = preg_split("/,\s*/", $this->Cfg->val["CapabilityList"]); // Make query $query = "SELECT "; reset($caps); // Add fields while(list($key, $val) = each($caps)) { if($val != "") $query .= "\"" . $val . "\", "; } // Remove tailing ", " $query = preg_replace("/, $/", " ", $query); // Complete query $query .= "FROM \"" . $this->TabName . "\" WHERE \"" . $this->TabID . "\" = '" . $this->UserID . "';"; $result = $this->Db->dbExec($query); // Exactly 1 user corresponds. if($this->Db->db_num_rows($result) == 1) { // Read and set values $row = $this->Db->db_fetch_array($result, 0); reset($caps); while(list($key, $val) = each($caps)) { if($row[$val] == "t" || $row[$val] == "1" ) $this->Capability[$val] = true; else $this->Capability[$val] = false; } } $this->Db->db_free_result($result); } } function getName() { $ok = true; $name = ""; if($ok) { $query = "SELECT " . $this->TabDisplayName . " AS name FROM ". $this->TabName . " WHERE " . $this->TabID . "='" . $this->UserID . "';"; $result = $this->Db->dbExec($query); if($result === false) { $this->status = 1; $this->error .= $this->Db->error; $ok = false; } } if($ok && $this->Db->db_num_rows($result) == 0) { $this->status = 1; $ok = false; $this->error .= "User not found"; } if($ok) { $row = $this->Db->db_fetch_array($result, 0); $name = $row["name"]; } return trim($name); } function log_login_event() { global $_SERVER; if($this->TabLog == "") { return; } $query = "INSERT INTO " . $this->TabLog . " (user_id, username, evento, ". "data, ip) VALUES ('" . $this->UserID . "', '" . $this->Username . "', ". "'login', now(), '" . $_SERVER['REMOTE_ADDR'] . "');"; $result = $this->Db->dbExec($query); if($result === false) { $this->status = 1; $this->error .= $this->Db->error; $ok = false; } } function cookiePresent() { global $_COOKIE; if(isset($_COOKIE[$this->Cfg->Name . "Login"])) return true; else return false; } } ?> "; var $title = ""; var $meta = " "; var $link = ""; var $body = ""; var $omitEndHead = false; function htmlHeaderClass() { global $Cfg; $this->link = " val["CssName"]) || ! file_exists($Cfg->val["CssName"]) ? $Cfg->Name .".css" : $Cfg->val["CssName"] ) ."\" />\n"; } } class HtmlClass { var $HttpHeader = ""; var $htmlHeader = ""; var $Footer = ""; var $Cfg; var $Lang = "it_IT"; var $error = "HtmlClass: "; var $debug; var $dbg = ""; var $dbgToHead = true; var $status = 0; var $headerSent = false; var $usingTemplate = false; var $template = ""; function HtmlClass() { global $debug, $Cfg; if(!is_object($Cfg) && get_class($Cfg) != "ConfigClass") { $this->error .= '$Cfg (ConfigClass) object not set.'; $this->status = 1; return; } $this->Cfg = &$Cfg; // Setup the language $this->setLang(); // Load a template respecting the language selected if($this->loadTemplate()) { $this->usingTemplate = true; } else { $this->htmlHeader = new htmlHeaderClass(); // Insert html header and footer from config file if($this->Cfg->val["htmlHeader"] != "") $this->addToHeader("body", $this->Cfg->val["htmlHeader"]); if($this->Cfg->val["htmlFooter"] != "") $this->addToFooter($this->Cfg->val["htmlFooter"]); } // Init debug value $this->debug = $debug; } function setDbgToHead($bool) { $this->dbgToHead = $bool; } function printHeader() { if($this->usingTemplate) { echo "Warning: using templates use printOutput() instead of printHeader()
"; return; } $this->printHttpHeader(); echo($this->htmlHeader->docType . "\n\n". "\n". ($this->htmlHeader->title != "" ? $this->htmlHeader->title . "\n" : "" ) . ($this->htmlHeader->meta != "" ? $this->htmlHeader->meta . "\n" : "" ) . ($this->htmlHeader->link != "" ? $this->htmlHeader->link . "\n" : "" ) . ($this->htmlHeader->omitEndHead == true ? "" : "\n") . ($this->htmlHeader->body != "" ? $this->htmlHeader->body . "\n" : "\n" )); if($this->dbg != "" && $this->debug) { echo("

" . $this->dbg . "

"); $this->dbg = ""; } $this->headerSent = true; } function printHttpHeader() { if($this->HttpHeader != "") header($this->HttpHeader); } function printFooter() { if($this->usingTemplate) { echo "Warning: using templates use printOutput() instead of printFooter()
\n"; return; } echo($this->Footer . "\n\n\n"); } function addToHttpHeader($val) { $this->HttpHeader .= $val; // Add, if necessary, a tailing \n to the header if($val[strlen($val)] != '\n') $this->HttpHeader .= '\n'; } function omitEndHead($value = true) { if($this->usingTemplate) { echo "Warning: using templates omitEndHead() is useless
\n"; return; } $this->htmlHeader->omitEndHead = $value; } function addToHeader($section, $val) { if($this->usingTemplate) { echo "Warning: using templates addToHeader() is not allowed.
\n"; return; } switch($section) { case "meta": $this->htmlHeader->meta .= $val; break; case "title": $this->htmlHeader->title = $val; break; case "link": $this->htmlHeader->link = $val; break; case "body": // if there is a file called "$val" read it in the $body variable if(strlen($val) < 128 && file_exists($val)) $this->htmlHeader->body .= join('', file($val)); else $this->htmlHeader->body .= $val; break; } } function addToFooter($val) { if($this->usingTemplate) { echo "Warning: using templates addToFooter() is useless
\n"; return; } if(file_exists($val)) $this->Footer .= join('', file($val)); else $this->Footer .= $val; } function addToDbg($string) { $this->dbg .= $string . "
\n"; } function clearHeader($section) { if($this->usingTemplate) { echo "Warning: using templates clearHeader() is useless
\n"; return; } switch($section) { case "meta": $this->htmlHeader->meta = ""; break; case "title": $this->htmlHeader->title = ""; break; case "link": $this->htmlHeader->link = ""; break; case "body": $this->htmlHeader->body = ""; break; case "all": $this->htmlHeader->meta = ""; $this->htmlHeader->title = ""; $this->htmlHeader->link = ""; $this->htmlHeader->body = ""; break; } } function clearFooter() { if($this->usingTemplate) { echo "Warning: using templates clearFooter() is useless
\n"; return; } $this->Footer = ""; } function setOutput($section, $string) { if(!$this->usingTemplate) { echo "Warning: templates not enabled. Use printHeader() and printFooter() instead of printOutput()
\n"; return; } $string = preg_replace('/\$/', '\\\\$', $string); $this->template = preg_replace('/().*?()/s', '$1' . "\n" . $string . '$2', $this->template); } function appendOutput($section, $string) { if(!$this->usingTemplate) { echo "Warning: templates not enabled. Use printHeader() and printFooter() instead of printOutput()
\n"; return; } $string = preg_replace('/\$/', '\\\\$', $string); // Was: ereg_replace('\$', '\\$', $string); $this->template = preg_replace('/(.*?)()/s', '$1' . "\n" . $string . '$2', $this->template); } function printOutput() { $output = ""; if(!$this->usingTemplate) { echo "Warning: templates not enabled. Use printHeader() and printFooter() instead of printOutput()
\n"; return; } $this->printHttpHeader(); // Substitute placeholder with actual content. $output = $this->template; if($this->dbg != "" && $this->debug && $this->dbgToHead) { $output = preg_replace("/()/s", '$1' . "\n

\n" . "Skip logs". "

\n". $this->dbg . "

\n". "\n", $output); $this->dbg = ""; } elseif($this->dbg != "" && $this->debug && !$this->dbgToHead) { $output = preg_replace("/(<\/body>)/s", "\n

\n" . "Debug:

\n". $this->dbg . "

\n". '$1', $output); } echo $output; $this->headerSent = true; } function setLang($newlang = "") { global $lang; if($newlang != "") { if(isset($_SESSION)) { $_SESSION["lang"] = $newlang; } $lang = $newlang; $this->Lang = $newlang; } else if(isset($_SESSION["lang"])) { $lang = $_SESSION["lang"]; $this->Lang = $lang; } else { $lang = $this->Lang; } } function loadTemplate() { global $_SESSION; if(isset($_SESSION["lang"])) { $this->Lang = $_SESSION["lang"]; } if(!isset($this->Cfg->val["template"])) { $this->addToDbg("Templates disabled"); return false; } if(is_array($this->Cfg->val["template"]) && isset($this->Cfg->val["template"][$this->Lang]) && file_exists($this->Cfg->val["template"][$this->Lang])) { $templateFilename = $this->Cfg->val["template"][$this->Lang]; $this->addToDbg("Selecting per language template (" . $this->Lang . "): " . $templateFilename); } if(!isset($templateFilename) && !is_array($this->Cfg->val["template"]) && file_exists($this->Cfg->val["template"])) { $templateFilename = $this->Cfg->val["template"]; $this->addToDbg("Selecting generic template: " . $templateFilename); } if(!isset($templateFilename)) { $this->addToDbg("No template found"); echo "ERROR: No template found."; exit; } if(!isset($this->Cfg->val["templateMainRegion"])) { echo "Error: main editable region not defined.
\n"; exit; } // Load and validate template $this->template = file_get_contents($templateFilename); if($this->template === false) { echo "Error: unable to read template file (" . $templateFilename . ").
\n"; exit; } if(!preg_match("/.*/s", $this->template)) { echo "Error: main editable region (" . $this->Cfg->val["templateMainRegion"] . ") not found in the ". "template.
\n"; exit; } return true; } function get_regions() { $regions = array(); preg_match_all("/