Source for file Homepage.php
Documentation is available at Homepage.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | MCMS: a PHP Content Management System for creating accessible sites. |
// | Copyright (C) 2005 Silvio Moioli |
// | 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 2 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, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
// +----------------------------------------------------------------------+
// | Authors: Silvio Moioli <silvio at moioli dot net> www.moioli.net |
// +----------------------------------------------------------------------+
* Interfaccia per la gestione dell'homepage di ogni sito.
* @author Silvio Moioli <silvio at moioli dot net>
/** Carica la classe base di MCMS per l'interfacciamento al Database */
require_once $_SERVER["DOCUMENT_ROOT"]. "/admin/lib/model/Engine.php";
* Carica la classe per le pagine (Page)
require_once $_SERVER["DOCUMENT_ROOT"]. "/admin/lib/model/Page.php";
* Interfaccia per la gestione dell'homepage di ogni sito.
* Permette di utilizzare il database in modo trasparente: creare oggetti
* di questa classe e operare sugli attributi tramite gli appositi metodi
* modificherā automaticamente il database sottostante.
* @author Silvio Moioli <silvio at moioli dot net>
//Attributi ereditati: $ID e $engine
* Costruttore "di lettura" (costruisce una homepage da un record del
* database giā esistente).
* Nota: le homepages sono create direttamente dal costruttore di
* Site. All'atto della costruzione di un nuovo sito, infatti, verrā
* anche creata una nuova homepage.
* Per i costruttori "di scrittura", quindi, vedere la classe Site
* @param int $ID l'ID del database sottostante
* @param Engine $engine un motore per interagire con il database
* @return mixed l'homepage se la costruzione č andata a buon fine, altrimenti
$this->Page($ID, $engine);
* Getter per il campo Motto dalla tabella Homepage.
* Ritorna una stringa con il "motto" del sito (es. "Clarence: a wwworld
* apart"), che sarā visualizzata nella home.
* @return mixed una stringa con il motto se l'operazione č andata a buon fine,
* altrimenti un DB_ERROR.
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$res = $thisDB->getOne("SELECT `motto homepage` FROM `homepages`".
"WHERE `id pagina` = '$thisID' LIMIT 1;");
* Setter per il campo Motto dalla tabella Homepage.
* Cambia il motto visualizzato nella homepage.
* @param string $slogan il nuovo motto del sito.
* @return mixed true se l'operazione č andata a buon fine, altrimenti
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$slogan = $thisDB->escapeSimple($thisDB->escapeSimple($slogan));
$thisDB->query("UPDATE `homepages` SET `motto homepage`='$slogan'".
"WHERE `id pagina` = '$thisID';");
|