4 * @file classes/site/SiteDAO.inc.php
6 * Copyright (c) 2000-2009 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
13 * @brief Operations for retrieving and modifying the Site object.
16 // $Id: SiteDAO.inc.php,v 1.8 2009/05/13 16:35:48 asmecher Exp $
21 class SiteDAO
extends DAO
{
23 * Retrieve site information.
28 $result =& $this->retrieve(
32 if ($result->RecordCount() != 0) {
33 $site =& $this->_returnSiteFromRow($result->GetRowAssoc(false));
43 * Internal function to return a Site object from a row.
45 * @param $callHook boolean
48 function &_returnSiteFromRow(&$row, $callHook = true) {
50 $site->setRedirect($row['redirect']);
51 $site->setMinPasswordLength($row['min_password_length']);
52 $site->setPrimaryLocale($row['primary_locale']);
53 $site->setOriginalStyleFilename($row['original_style_file_name']);
54 $site->setInstalledLocales(isset($row['installed_locales']) && !empty($row['installed_locales']) ?
explode(':', $row['installed_locales']) : array());
55 $site->setSupportedLocales(isset($row['supported_locales']) && !empty($row['supported_locales']) ?
explode(':', $row['supported_locales']) : array());
57 if ($callHook) HookRegistry
::call('SiteDAO::_returnSiteFromRow', array(&$site, &$row));
63 * Insert site information.
66 function insertSite(&$site) {
67 $returner = $this->update(
69 (redirect, min_password_length, primary_locale, installed_locales, supported_locales, original_style_file_name)
74 (int) $site->getMinPasswordLength(),
75 $site->getPrimaryLocale(),
76 join(':', $site->getInstalledLocales()),
77 join(':', $site->getSupportedLocales()),
78 $site->getOriginalStyleFilename()
85 * Update existing site information.
88 function updateObject(&$site) {
93 min_password_length = ?,
95 installed_locales = ?,
96 supported_locales = ?,
97 original_style_file_name = ?',
100 (int) $site->getMinPasswordLength(),
101 $site->getPrimaryLocale(),
102 join(':', $site->getInstalledLocales()),
103 join(':', $site->getSupportedLocales()),
104 $site->getOriginalStyleFilename()
109 function updateSite(&$site) {
110 trigger_error('Deprecated function.');
111 return $this->updateObject($site);