forked from osclass/Osclass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
devconquer
committed
Mar 18, 2011
1 parent
fcc26bf
commit 5a3dfc0
Showing
7 changed files
with
131 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
* OSCLass – software for creating and publishing online classified | ||
* advertising platforms | ||
* | ||
* Copyright (C) 2010 OSCLASS | ||
* | ||
* This program is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License | ||
* as published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
function osc_db_name() { | ||
return getSiteInfo('s_db_name', DB_NAME) ; | ||
} | ||
|
||
function osc_db_host() { | ||
return getSiteInfo('s_db_host', DB_HOST) ; | ||
} | ||
|
||
function osc_db_user() { | ||
return getSiteInfo('s_db_user', DB_USER) ; | ||
} | ||
|
||
function osc_db_password() { | ||
return getSiteInfo('s_db_password', DB_PASSWORD) ; | ||
} | ||
|
||
//PRIVATE FUNCTION FOR GETTING NO BOOLEAN INFORMATION (if there was a class :P) | ||
function getSiteInfo($key, $default_value) { | ||
if (MULTISITE) { | ||
$_P = SiteInfo::newInstance() ; | ||
return($_P->get($key, $section)) ; | ||
} | ||
|
||
return $default_value ; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/* | ||
* OSCLass – software for creating and publishing online classified | ||
* advertising platforms | ||
* | ||
* Copyright (C) 2010 OSCLASS | ||
* | ||
* This program is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License | ||
* as published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
class SiteInfo extends DAO | ||
{ | ||
private static $instance ; | ||
private $site_info ; | ||
|
||
public static function newInstance() { | ||
if(!self::$instance instanceof self) { | ||
self::$instance = new self ; | ||
} | ||
return self::$instance ; | ||
} | ||
|
||
public function __construct() { | ||
$this->createMetadataConnection() ; | ||
$this->toArray() ; | ||
} | ||
|
||
public function getTableName() { | ||
return 'tbl_sites' ; | ||
} | ||
|
||
public function toArray() { | ||
$domain = $_SERVER['HTTP_HOST'] ; | ||
$this->site_info = $this->findByPrimaryKeyInMetadataDB($domain) ; | ||
} | ||
|
||
public function get($key) { | ||
if (!isset($this->site_info[$key])) { | ||
return '' ; | ||
} | ||
return ($this->site_info[$key]) ; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters