[geeklog-cvs] Geeklog-1.x/system/classes config.class.php, 1.17, 1.18
Dirk Haun
dhaun at qs1489.pair.com
Sun Jan 27 04:02:17 EST 2008
Update of /cvsroot/geeklog/Geeklog-1.x/system/classes
In directory qs1489.pair.com:/tmp/cvs-serv22742/system/classes
Modified Files:
config.class.php
Log Message:
Moved hard-coded texts to the language files; a few minor changes for consistency
Index: config.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/classes/config.class.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** config.class.php 20 Jan 2008 20:55:17 -0000 1.17
--- config.class.php 27 Jan 2008 09:02:15 -0000 1.18
***************
*** 51,56 ****
{
static $instance;
! if(!$instance)
$instance = new config();
return $instance;
}
--- 51,59 ----
{
static $instance;
!
! if (!$instance) {
$instance = new config();
+ }
+
return $instance;
}
***************
*** 105,113 ****
{
global $_TABLES;
$sql_query = "SELECT name, value, group_name FROM {$_TABLES['conf_values']}";
$result = DB_query($sql_query);
while ($row = DB_fetchArray($result)) {
! if ($row[1] !== 'unset')
$this->config_array[$row[2]][$row[0]] = unserialize($row[1]);
}
$this->_post_configuration();
--- 108,118 ----
{
global $_TABLES;
+
$sql_query = "SELECT name, value, group_name FROM {$_TABLES['conf_values']}";
$result = DB_query($sql_query);
while ($row = DB_fetchArray($result)) {
! if ($row[1] !== 'unset') {
$this->config_array[$row[2]][$row[0]] = unserialize($row[1]);
+ }
}
$this->_post_configuration();
***************
*** 149,152 ****
--- 154,158 ----
{
global $_TABLES, $_DB, $_DB_dbms;
+
$escaped_val = addslashes(serialize($value));
$escaped_name = addslashes($name);
***************
*** 169,172 ****
--- 175,179 ----
{
global $_TABLES;
+
$escaped_name = addslashes($name);
$escaped_grp = addslashes($group);
***************
*** 179,182 ****
--- 186,190 ----
{
global $_TABLES;
+
$escaped_name = addslashes($name);
$escaped_grp = addslashes($group);
***************
*** 221,224 ****
--- 229,233 ----
{
global $_TABLES, $_DB, $_DB_dbms;
+
$format = 'INSERT INTO %1$s (name, value, type, ' .
'subgroup, group_name, selectionArray, sort_order,'.
***************
*** 272,275 ****
--- 281,285 ----
{
global $_TABLES, $LANG_confignames, $LANG_configselects;
+
$q_string = "SELECT name, type, selectionArray, "
. "fieldset, value FROM {$_TABLES['conf_values']}" .
***************
*** 278,285 ****
$Qresult = DB_query($q_string);
$res = array();
! if(!array_key_exists($group, $LANG_configselects))
$LANG_configselects[$group] = array();
! if(!array_key_exists($group, $LANG_confignames))
$LANG_confignames[$group] = array();
while ($row = DB_fetchArray($Qresult)) {
$cur = $row;
--- 288,297 ----
$Qresult = DB_query($q_string);
$res = array();
! if (!array_key_exists($group, $LANG_configselects)) {
$LANG_configselects[$group] = array();
! }
! if (!array_key_exists($group, $LANG_confignames)) {
$LANG_confignames[$group] = array();
+ }
while ($row = DB_fetchArray($Qresult)) {
$cur = $row;
***************
*** 299,302 ****
--- 311,315 ----
'unset' : unserialize($cur[4])));
}
+
return $res;
}
***************
*** 319,322 ****
--- 332,336 ----
{
global $_TABLES;
+
$q_string = "SELECT subgroup FROM {$_TABLES['conf_values']} WHERE " .
"group_name='{$group}' " .
***************
*** 324,329 ****
$res = DB_query($q_string);
$return = array();
! while ($row = DB_fetchArray($res))
$return[] = $row[0];
return $return;
}
--- 338,345 ----
$res = DB_query($q_string);
$return = array();
! while ($row = DB_fetchArray($res)) {
$return[] = $row[0];
+ }
+
return $return;
}
***************
*** 343,360 ****
function get_ui($grp, $sg='0', $change_result=null)
{
! global $_CONF,$LANG_configsubgroups;
! if(!array_key_exists($grp, $LANG_configsubgroups))
! $LANG_configsubgroups[$grp] = array();
! if (!SEC_inGroup('Root'))
return config::_UI_perm_denied();
! if (!isset($sg) OR empty($sg)) $sg = '0';
$t = new Template($_CONF['path_layout'] . 'admin/config');
$t->set_file(array('main' => 'configuration.thtml','menugroup' => 'menu_element.thtml'));
! $t->set_var( 'xhtml', XHTML );
! $t->set_var('site_url',$_CONF['site_url']);
$t->set_var('open_group', $grp);
--- 359,383 ----
function get_ui($grp, $sg='0', $change_result=null)
{
! global $_CONF, $LANG_CONFIG, $LANG_configsubgroups;
! if(!array_key_exists($grp, $LANG_configsubgroups)) {
! $LANG_configsubgroups[$grp] = array();
! }
! if (!SEC_inGroup('Root')) {
return config::_UI_perm_denied();
+ }
! if (!isset($sg) OR empty($sg)) {
! $sg = '0';
! }
$t = new Template($_CONF['path_layout'] . 'admin/config');
$t->set_file(array('main' => 'configuration.thtml','menugroup' => 'menu_element.thtml'));
! $t->set_var('lang_save_changes', $LANG_CONFIG['save_changes']);
! $t->set_var('lang_reset_form', $LANG_CONFIG['reset_form']);
! $t->set_var('lang_changes_made', $LANG_CONFIG['changes_made']);
+ $t->set_var('xhtml', XHTML);
+ $t->set_var('site_url', $_CONF['site_url']);
$t->set_var('open_group', $grp);
***************
*** 416,420 ****
$cssfile = '<link rel="stylesheet" type="text/css" href="'.$_CONF['layout_url'] .'/droplinemenu.css" ' . XHTML .'>' . LB;
$display = COM_siteHeader(array('configmanager_menu'),'Configuration Manager',$cssfile);
! if ($change_result != null AND $change_result !== array() ) {
$t->set_var('change_block',$this->_UI_get_change_block($change_result));
} else {
--- 439,443 ----
$cssfile = '<link rel="stylesheet" type="text/css" href="'.$_CONF['layout_url'] .'/droplinemenu.css" ' . XHTML .'>' . LB;
$display = COM_siteHeader(array('configmanager_menu'),'Configuration Manager',$cssfile);
! if ($change_result != null AND $change_result !== array()) {
$t->set_var('change_block',$this->_UI_get_change_block($change_result));
} else {
***************
*** 423,426 ****
--- 446,450 ----
$display .= $t->finish($t->parse("OUTPUT", "main"));
$display .= COM_siteFooter(false);
+
return $display;
}
***************
*** 433,436 ****
--- 457,461 ----
$display .= '<li>' . $param_name . '</li>';
$display .= '</ul>';
+
return $display;
}
***************
*** 440,445 ****
{
global $LANG_fs;
! if(!array_key_exists($group, $LANG_fs))
$LANG_fs[$group] = array();
$t->set_var('fs_contents', $contents);
$t->set_var('fs_display', $LANG_fs[$group][$fs_id]);
--- 465,472 ----
{
global $LANG_fs;
!
! if (!array_key_exists($group, $LANG_fs)) {
$LANG_fs[$group] = array();
+ }
$t->set_var('fs_contents', $contents);
$t->set_var('fs_display', $LANG_fs[$group][$fs_id]);
***************
*** 450,462 ****
function _UI_perm_denied()
{
! $display = COM_siteHeader ('menu');
! $display .= COM_startBlock ('Permission denied.', '',
! COM_getBlockTemplate ('_msg_block', 'header'));
! $display .= '<p padding="5px">You do not have the necessary permissions'
! . ' to access this page.</p>';
! $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
! $display .= COM_siteFooter ();
! COM_accessLog("User {$_USER['username']} tried to illegally" .
! " access the config administration screen.");
return $display;
}
--- 477,490 ----
function _UI_perm_denied()
{
! global $MESSAGE;
!
! $display = COM_siteHeader('menu', $MESSAGE[30])
! . COM_startBlock($MESSAGE[30], '',
! COM_getBlockTemplate ('_msg_block', 'header'))
! . $MESSAGE[96]
! . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'))
! . COM_siteFooter();
! COM_accessLog("User {$_USER['username']} tried to illegally access the config administration screen.");
!
return $display;
}
***************
*** 465,468 ****
--- 493,498 ----
$selectionArray = null , $deletable=0)
{
+ global $LANG_CONFIG;
+
$t = new Template($GLOBALS['_CONF']['path_layout'] . 'admin/config');
$t -> set_file('element', 'config_element.thtml');
***************
*** 471,484 ****
'select-element', 'list-element', 'unset-param',
'keyed-add-button', 'unkeyed-add-button');
! foreach ($blocks as $block)
$t->set_block('element', $block);
! $t->set_var( 'xhtml', XHTML );
$t->set_var('name', $name);
$t->set_var('display_name', $display_name);
$t->set_var('value', $val);
! if ($deletable)
$t->set_var('delete', $t->parse('output', 'delete-button'));
! elseif ($this->ref == 'Core' ) {
$t->set_var('unset_link',
"(<a href='#' onClick='unset(\"{$name}\");'>X</a>)");
--- 501,518 ----
'select-element', 'list-element', 'unset-param',
'keyed-add-button', 'unkeyed-add-button');
! foreach ($blocks as $block) {
$t->set_block('element', $block);
+ }
! $t->set_var('lang_restore', $LANG_CONFIG['restore']);
! $t->set_var('lang_add_element', $LANG_CONFIG['add_element']);
!
! $t->set_var('xhtml', XHTML);
$t->set_var('name', $name);
$t->set_var('display_name', $display_name);
$t->set_var('value', $val);
! if ($deletable) {
$t->set_var('delete', $t->parse('output', 'delete-button'));
! } elseif ($this->ref == 'Core' ) {
$t->set_var('unset_link',
"(<a href='#' onClick='unset(\"{$name}\");'>X</a>)");
***************
*** 577,580 ****
--- 611,615 ----
return null;
}
+
$success_array = array();
foreach ($this->config_array[$group] as $param_name => $param_value) {
***************
*** 588,591 ****
--- 623,627 ----
}
}
+
return $success_array;
}
***************
*** 601,605 ****
}
} else {
! $r = COM_stripSlashes( $input_val );
if ($r == 'b:0' OR $r == 'b:1') {
$r = ($r == 'b:1');
--- 637,641 ----
}
} else {
! $r = COM_stripslashes($input_val);
if ($r == 'b:0' OR $r == 'b:1') {
$r = ($r == 'b:1');
***************
*** 609,612 ****
--- 645,649 ----
}
}
+
return $r;
}
More information about the geeklog-cvs
mailing list