Source for file Author.php
Documentation is available at Author.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 degli autori dei siti gestiti da MCMS.
* @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";
* Interfaccia per la gestione degli autori dei siti gestiti da MCMS.
* Permette di gestire tutti i dettagli di un autore di uno o più
* siti, articoli o notizie.
* @author Silvio Moioli <silvio at moioli dot net>
* @var int $ID ID del database sottostante per questo sito.
* @var Engine il motore del database sottostante per questo sito.
* Costruttore "di lettura" (costruisce un autore da un record del
* database già esistente).
* Nota: non può essere creato una nuovo autore da qui, ma solo dal Factory
* Method nella classe Engine.
* Per i costruttori "di scrittura", quindi, vedere la classe Engine
* @param int $ID l'ID del database sottostante
* @param Engine $engine un motore per interagire con il database
* @return mixed l'autore se la costruzione è andata a buon fine, altrimenti
if (settype($ID, "integer") && $ID> 0){
* Ritorna l'ID di questo autore.
* Solo le classi del package MCMS potrebbero avere bisogno di
* questo parametro, per le interrogazioni al Database.
* @return int l'ID del database sottostante
* Ritorna il motore sottostante a questo autore.
* Solo le classi del package MCMS potrebbero avere bisogno di
* questo parametro, per le interrogazioni al Database.
* @return int l'ID del database sottostante
* Getter per il campo Nome dalla tabella Autore.
* Ritorna il nome di battesimo di questo autore.
* @return mixed il nome (string) se l'operazione è andata a
* buon fine, altrimenti un DB_ERROR
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$res = $thisDB->getOne("SELECT `nome autore` FROM `autori`".
"WHERE `id autore` = '$thisID' LIMIT 1;");
* Setter per il campo Nome dalla tabella Autore.
* Cambia il nome di battesimo di questo autore
* @param string $name il nuovo nome
* @return mixed true se l'operazione è andata a buon fine, altrimenti
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$name = $thisDB->escapeSimple($name);
$thisDB->query("UPDATE `autori` SET `nome autore`='$name'".
"WHERE `id autore` = '$thisID';");
* Getter per il campo Cognome dalla tabella Autore.
* Ritorna il cognome di questo autore.
* @return mixed il cognome (string) se l'operazione è andata a
* buon fine, altrimenti un DB_ERROR
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$res = $thisDB->getOne("SELECT `cognome autore` FROM `autori`".
"WHERE `id autore` = '$thisID' LIMIT 1;");
* Setter per il campo Cognome dalla tabella Autore.
* Cambia il cognome di questo autore
* @param string $cognome il nuovo cognome
* @return mixed true se l'operazione è andata a buon fine, altrimenti
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$cognome = $thisDB->escapeSimple($cognome);
$thisDB->query("UPDATE `autori` SET `cognome autore`='$cognome'".
"WHERE `id autore` = '$thisID';");
* Getter per il campo Nickname dalla tabella Autore.
* Ritorna il nickname di questo autore.
* @return mixed il nickname (string) se l'operazione è andata a
* buon fine, altrimenti un DB_ERROR
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$res = $thisDB->getOne("SELECT `nick autore` FROM `autori`".
"WHERE `id autore` = '$thisID' LIMIT 1;");
* Setter per il campo Nickname dalla tabella Autore.
* Cambia il nickname di questo autore
* @param string $nickname il nuovo nickname
* @return mixed true se l'operazione è andata a buon fine, altrimenti
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$nickname = $thisDB->escapeSimple($thisDB->escapeSimple($nickname));
$thisDB->query("UPDATE `autori` SET `nick autore`='$nickname'".
"WHERE `id autore` = '$thisID';");
* Getter per il campo Email dalla tabella Autore.
* Ritorna l'indirizzo email di questo autore.
* @return mixed l'indirizzo email (string) se l'operazione è andata a
* buon fine, altrimenti un DB_ERROR
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$res = $thisDB->getOne("SELECT `email autore` FROM `autori`".
"WHERE `id autore` = '$thisID' LIMIT 1;");
* Setter per il campo Email dalla tabella Autore.
* Cambia l'indirizzo email di questo autore.
* @param string $email il nuovo indirizzo
* @return mixed true se l'operazione è andata a buon fine, altrimenti
$thisDB = $thisEngine->getDB();
$thisID = $thisDB->escapeSimple($this->getID());
$email = $thisDB->escapeSimple($email);
$thisDB->query("UPDATE `autori` SET `email autore`='$email'".
"WHERE `id autore` = '$thisID';");
|