Update of /cvsroot/phpmp/phpMP/includes
In directory sc8-pr-cvs1:/tmp/cvs-serv15380/includes
Modified Files:
admin.php
Log Message:
Finished site config - not pretty, but it works for a pre-alpha. I expect to tune it up a few times anyways (when the templates are implemented)
Index: admin.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/includes/admin.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** admin.php 9 Feb 2003 16:01:22 -0000 1.1
--- admin.php 9 Feb 2003 19:20:51 -0000 1.2
***************
*** 12,20 ****
function execute($action)
{
switch ($action)
{
! case C_ACTION_GENERAL:
! $this->p_action = $action;
! $this->_show_general();
break;
default: break;
--- 12,21 ----
function execute($action)
{
+ $this->p_action = $action;
+
switch ($action)
{
! case C_ACTION_SITE:
! $this->_show_site();
break;
default: break;
***************
*** 26,35 ****
// Accepts: none.
// Returns: none.
! function _show_general()
{
// Print out a form for the user
print "<form method=\"post\" action=\"main.php?parse=" . $this->p_action . "\">";
! print "Site Name: <input type=\"text\" name=\"sname\"><br>";
! print "<input type=\"submit\" name=\"submit_general\">";
}
--- 27,46 ----
// Accepts: none.
// Returns: none.
! function _show_site()
{
// Print out a form for the user
print "<form method=\"post\" action=\"main.php?parse=" . $this->p_action . "\">";
! print "Site Name: <input type=\"text\" name=\"sname\" value=\"" . C_SITE_NAME . "\"><br>";
! if (C_OVERRIDE_USR_TPL == 0) { $checked = "CHECKED"; } else { $checked = ""; }
! print "Default Template: <input type=\"text\" name=\"deftpl\" value=\"" . C_DEFAULT_TPL . "\">";
! print " <input type=\"checkbox\" name=\"ovrtpl\" value=\"0\" " . $checked . "> Override User Template?<br>";
! print "Default Language: <input type=\"text\" name=\"deflang\" value=\"" . C_DEFAULT_LANG . "\"> (french, english)<br>"; // Should / Will be a dropdown list
! print "Default Date Format: <input type=\"text\" name=\"defdate\" value=\"" . C_DEFAULT_DATE_FORMAT . "\"> (Example: " . date(C_DEFAULT_DATE_FORMAT) . ") [Same syntax as the PHP date function]<br>";
! if (C_ENABLE_ACCOUNT_ACTIVATION == 0) { $checked = "CHECKED"; } else { $checked = ""; }
! print "<input type=\"checkbox\" name=\"accact\" value=\"0\" " . $checked . "> Enable Account Activation?<br>";
! print "System Timezone: <input type=\"text\" name=\"systime\" value=\"" . C_SYSTEM_TIMEZONE . "\"><br>";
! if (C_USE_PORTAL_PERMS == 0) { $checked = "CHECKED"; } else { $checked = ""; }
! print "<input type=\"checkbox\" name=\"portperms\" value=\"0\" " . $checked . "> Use Portal Permissions?<br>";
! print "<input type=\"submit\" name=\"submit_general\" value=\"Submit Configuration\">";
}
***************
*** 38,54 ****
// Accepts: Form values from the general form
// Returns: none.
! function parse_general($sname)
{
include_once( C_PHPMP_ROOT . 'dba/' . DB_TYPE . '.dba' );
$DB = new DB;
// We now go through each config_value and update it accordingly
// I dont know if this is the only way, but it works fine for me
! $query = $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $sname . "' WHERE config_key='site_name'");
!
! if (!$query)
! {
! die ("Error executing query");
! }
}
--- 49,71 ----
// Accepts: Form values from the general form
// Returns: none.
! function parse_site($sname, $ovrtpl, $deftpl, $deflang, $defdate, $accact, $systime, $portperms)
{
include_once( C_PHPMP_ROOT . 'dba/' . DB_TYPE . '.dba' );
$DB = new DB;
+ if ($ovrtpl != 0) { $ovrtpl = 1; }
+ if ($accact != 0) { $accact = 1; }
+ if ($portperms != 0) { $portperms = 1; }
+
// We now go through each config_value and update it accordingly
// I dont know if this is the only way, but it works fine for me
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $sname . "' WHERE config_key='site_name'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $ovrtpl . "' WHERE config_key='override_usr_tpl'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $deftpl . "' WHERE config_key='default_tpl'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $deflang . "' WHERE config_key='default_lang'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $defdate . "' WHERE config_key='default_date_format'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $accact . "' WHERE config_key='enable_account_activation'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $systime . "' WHERE config_key='system_timezone'");
! $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $portperms . "' WHERE config_key='use_portal_perms'");
}
|