mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Can define centre and project information in administrative menu
Able to edit questionnaires RS text and name Can disable/enable questionnaires for viewing in admin interface RS text entered via new CKEditor including ability to insert tokens/template replace text Added setting table and associated getter/setter functions (currently only used for centre information but could add more)
This commit is contained in:
53
db.inc.php
53
db.inc.php
@@ -72,7 +72,60 @@ $db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
$db->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||
if (DEBUG == true) $db->debug = true;
|
||||
|
||||
$db->Execute("set names 'utf8'");
|
||||
|
||||
//store session in database (see sessions2 table)
|
||||
ADOdb_Session::config(DB_TYPE, DB_HOST, DB_USER, DB_PASS, DB_NAME,$options=false);
|
||||
|
||||
|
||||
/**
|
||||
* Get a setting from the database
|
||||
*
|
||||
* @param mixed $name The setting name
|
||||
*
|
||||
* @return mixed The setting value
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @since 2011-01-17
|
||||
*/
|
||||
function get_setting($name)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$qname = $db->qstr($name);
|
||||
|
||||
$sql = "SELECT value
|
||||
FROM setting
|
||||
WHERE field LIKE $qname";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
|
||||
if (!empty($rs))
|
||||
return unserialize($rs['value']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update or create a new setting to store in the database
|
||||
*
|
||||
* @param mixed $name
|
||||
* @param mixed $value An array or string to save
|
||||
*
|
||||
* @return bool Successful database insert/update?
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @since 2011-01-17
|
||||
*/
|
||||
function set_setting($name,$value)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$qname = $db->qstr($name);
|
||||
$qvalue = serialize($value);
|
||||
|
||||
$sql = "INSERT INTO setting (setting_id,field,value)
|
||||
VALUES (NULL,$qname,'$qvalue')
|
||||
ON DUPLICATE KEY UPDATE value = '$qvalue'";
|
||||
|
||||
|
||||
return $db->Execute($sql);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user