1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

work on sitedown

This commit is contained in:
marj
2009-10-28 16:57:51 +00:00
parent 785018a6db
commit 4ccabca5a9
4 changed files with 691 additions and 628 deletions

View File

@@ -9,38 +9,38 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_admin/ugflag.php,v $
* $Revision: 1.5 $
* $Date: 2009-09-27 21:18:37 $
* $Author: e107coders $
* $Revision: 1.6 $
* $Date: 2009-10-28 16:57:51 $
* $Author: marj_nl_fr $
*
*/
require_once("../class2.php");
if (!getperms("9"))
*/
require_once ("../class2.php");
if(!getperms("9"))
{
header("location:".e_BASE."index.php");
exit;
exit();
}
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
require_once(e_HANDLER."form_handler.php");
require_once (e_HANDLER."form_handler.php");
require_once (e_HANDLER."message_handler.php");
$emessage = eMessage::getInstance();
$emessage_method = e_AJAX_REQUEST ? 'add' : 'addSession';
$frm = new e_form(true);
if (isset($_POST['updatesettings']))
if(isset($_POST['updatesettings']))
{
$changed = FALSE;
$temp = intval($_POST['maintainance_flag']);
if ($pref['maintainance_flag'] != $temp)
if($pref['maintainance_flag'] != $temp)
{
$pref['maintainance_flag'] = $temp;
$changed = TRUE;
}
$temp = $tp->toDB($_POST['maintainance_text']);
if ($pref['maintainance_text'] != $temp)
if($pref['maintainance_text'] != $temp)
{
$pref['maintainance_text'] = $temp;
$changed = TRUE;
@@ -53,22 +53,23 @@ if (isset($_POST['updatesettings']))
$changed = TRUE;
}
if ($changed)
if($changed)
{
$admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01',$pref['maintainance_text'],E_LOG_INFORMATIVE,'');
$admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, '');
save_prefs();
$emessage->$emessage_method(UGFLAN_1, E_MESSAGE_SUCCESS);
}
else $emessage->$emessage_method(UGFLAN_7);
else
$emessage->$emessage_method(UGFLAN_7);
if(!e_AJAX_REQUEST)
{
header("location:".e_SELF);
exit;
exit();
}
}
require_once("auth.php");
require_once ("auth.php");
$text = "
<form method='post' action='".e_SELF."' id='core-ugflag-form'>
@@ -79,32 +80,22 @@ $text = "
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tbody>";
$elements = array(e_UC_PUBLIC=>LAN_DISABLED,
e_UC_ADMIN=>UGFLAN_8,
e_UC_MAINADMIN=>UGFLAN_9);
$text .= "
<tr>
<td class='label'>".UGFLAN_2.": </td>
<td class='control'>
<div class='auto-toggle-area autocheck'>
".$frm->checkbox('maintainance_flag', '1', $pref['maintainance_flag'])."
</div>
".$frm->radio_multi('maintainance_flag', $elements, $pref['maintainance_flag'], TRUE)."
</td>
</tr>";
if(getperms('0'))
{
$text .= "<tr>
<td class='label'>".UGFLAN_8.":
</td>
<td class='control'>
<div class='auto-toggle-area autocheck'>
".$frm->checkbox('main_admin_only', '1', $pref['main_admin_only'])."
</div>
<div class='field-help'>".UGFLAN_9."</div>
</td>
</tr>";
}
$text .= "
$text .= "
<tr>
<td class='label'>".UGFLAN_5."
@@ -130,8 +121,8 @@ if(!e_AJAX_REQUEST)
echo "<div id='ajax-container'>\n";
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag');
echo "\n</div>";
require_once(e_ADMIN."footer.php");
exit;
require_once (e_ADMIN."footer.php");
exit();
}
$e107->ns->tablerender(UGFLAN_4, $emessage->render().$text, 'core-ugflag');

View File

@@ -9,13 +9,16 @@
* Form Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.58 $
* $Date: 2009-10-26 07:26:47 $
* $Author: e107coders $
* $Revision: 1.59 $
* $Date: 2009-10-28 16:57:51 $
* $Author: marj_nl_fr $
*
*/
*/
if (!defined('e107_INIT')) { exit; }
if(!defined('e107_INIT'))
{
exit;
}
//FIXME hardcoded text
/**
* Automate Form fields creation. Produced markup is following e107 CSS/XHTML standards
@@ -85,7 +88,7 @@ class e_form
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
}
function iconpreview($id,$default,$width='',$height='') // FIXME
function iconpreview($id, $default, $width = '', $height = '') // FIXME
{
$parms = $name."|".$width."|".$height."|".$id;
$sc_parameters .= 'mode=preview&default='.$default.'&id='.$id;
@@ -105,7 +108,7 @@ class e_form
$jsfunc = $ajax ? "e107Ajax.toggleUpdate('{$id}-iconpicker', '{$id}-iconpicker-cn', 'sc:iconpicker=".urlencode($sc_parameters)."', '{$id}-iconpicker-ajax', { overlayElement: '{$id}-iconpicker-button' })" : "e107Helper.toggle('{$id}-iconpicker')";
$ret = $this->text($name, $default);
// $ret .= $this->iconpreview($id,$default); //FIXME
$ret .= $this->admin_button($name.'-iconpicker-button', $label, 'action', '', array('other' => "onclick=\"{$jsfunc}\""));
$ret .= $this->admin_button($name.'-iconpicker-button', $label, 'action', '', array('other'=>"onclick=\"{$jsfunc}\""));
$ret .= "
<div id='{$id}-iconpicker' class='e-hideme'>
<div class='expand-container' id='{$id}-iconpicker-cn'>
@@ -122,7 +125,7 @@ class e_form
* @param name => string - the name of the field
* @param datestamp => UNIX timestamp - default value of the field
**/
function datepicker($name, $datestamp=false)
function datepicker($name, $datestamp = false)
{
global $pref;
//TODO can some of these values be set in an admin section somewhere so they are set per site?
@@ -137,7 +140,7 @@ class e_form
$cal_attrib['class'] = "tbox";
$cal_attrib['size'] = "12";
$cal_attrib['name'] = $name;
if ($datestamp)
if($datestamp)
{
//TODO use $prefs values for format?
$cal_attrib['value'] = date("d/m/Y H:i:s", $datestamp);
@@ -168,7 +171,7 @@ class e_form
return "<textarea name='{$name}' rows='{$rows}' cols='{$cols}'".$this->get_attributes($options, $name).">{$value}</textarea>";
}
function bbarea($name, $value, $help_mod = '', $help_tagid='', $size = 'large')
function bbarea($name, $value, $help_mod = '', $help_tagid = '', $size = 'large')
{
//size - large|medium|small
//width should be explicit set by current admin theme
@@ -188,11 +191,11 @@ class e_form
$size = 'large';
break;
}
$options = array('class' => 'tbox'.($size ? ' '.$size : '').' e-wysiwyg');
$options = array('class'=>'tbox'.($size ? ' '.$size : '').' e-wysiwyg');
$bbbar = '';
if(!deftrue('e_WYSIWYG'))
{
require_once(e_HANDLER."ren_help.php");
require_once (e_HANDLER."ren_help.php");
$options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
$bbbar = display_help($help_tagid, $help_mod, 'addtext', 'help', $size);
}
@@ -229,12 +232,13 @@ class e_form
function checkbox_toggle($name, $selector = 'multitoggle')
{
$selector = 'jstarget:'.$selector;
return $this->checkbox($name, $selector, false, array('id'=>false,'class'=>'checkbox toggle-all'));
return $this->checkbox($name, $selector, false, array('id'=>false, 'class'=>'checkbox toggle-all'));
}
function uc_checkbox($name, $current_value, $uc_options, $field_options = array())
{
if(!is_array($field_options)) parse_str($field_options, $field_options);
if(!is_array($field_options))
parse_str($field_options, $field_options);
return '
<div class="check-block">
'.$this->_uc->vetted_tree($name, array($this, '_uc_checkbox_cb'), $current_value, $uc_options, $field_options).'
@@ -256,11 +260,12 @@ class e_form
}
else
{
$style = " style='text-indent:" . (1.2 * $nest_level) . "em'";
$style = " style='text-indent:".(1.2 * $nest_level)."em'";
}
$descr = varset($field_options['description']) ? ' <span class="smalltext">('.$this->_uc->uc_get_classdescription($classnum).')</span>' : '';
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classnum).$descr, $treename.'[]', $classnum)."</div>\n";
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classnum).$descr,
$treename.'[]', $classnum)."</div>\n";
}
@@ -284,12 +289,13 @@ class e_form
}
function radio_multi($name, $elements, $checked, $multi_line = false)
function radio_multi($name, $elements, $checked, $multi_line = FALSE)
{
$text = array();
if(is_string($elements)) parse_str($elements, $elements);
if(is_string($elements))
parse_str($elements, $elements);
foreach ($elements as $value => $label)
foreach ($elements as $value=>$label)
{
$text[] = $this->radio($name, $value, $checked == $value)."".$this->label($label, $name, $value);
}
@@ -316,14 +322,16 @@ class e_form
{
if($option_array == 'yesno')
{
$option_array = array(1=>LAN_YES,0=>LAN_NO);
$option_array = array(1=>LAN_YES,
0=>LAN_NO);
}
return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close();
}
function uc_select($name, $current_value, $uc_options, $select_options = array(), $opt_options = array())
{
return $this->select_open($name, $select_options)."\n".$this->_uc->vetted_tree($name, array($this, '_uc_select_cb'), $current_value, $uc_options, $opt_options)."\n".$this->select_close();
return $this->select_open($name, $select_options)."\n".$this->_uc->vetted_tree($name, array($this, '_uc_select_cb'), $current_value, $uc_options,
$opt_options)."\n".$this->select_close();
}
// Callback for vetted_tree - Creates the option list for a selection box
@@ -358,7 +366,8 @@ class e_form
function option($option_title, $value, $selected = false, $options = array())
{
if(false === $value) $value = '';
if(false === $value)
$value = '';
$options = $this->format_options('option', '', $options);
$options['selected'] = $selected; //comes as separate argument just for convenience
return "<option value='{$value}'".$this->get_attributes($options).">{$option_title}</option>";
@@ -366,10 +375,11 @@ class e_form
function option_multi($option_array, $selected = false, $options = array())
{
if(is_string($option_array)) parse_str($option_array, $option_array);
if(is_string($option_array))
parse_str($option_array, $option_array);
$text = '';
foreach ($option_array as $value => $label)
foreach ($option_array as $value=>$label)
{
$text .= $this->option($label, $value, $selected == $value, $options)."\n";
}
@@ -399,10 +409,11 @@ class e_form
return "<input type='submit' name='{$name}' value='{$value}'".$this->get_attributes($options, $name, $value)." />";
}
function submit_image($name, $value, $image, $title='', $options = array())
function submit_image($name, $value, $image, $title = '', $options = array())
{
$options = $this->format_options('submit_image', $name, $options);
switch ($image) {
switch($image)
{
case 'edit':
$image = ADMIN_EDIT_ICON_PATH;
$options['class'] = 'action edit';
@@ -425,15 +436,17 @@ class e_form
* @param object $action [optional] default is submit
* @param object $label [optional]
* @param object $options [optional]
* @return
* @return string
*/
function admin_button($name, $value, $action = 'submit', $label = '', $options = array())
{
$btype = 'submit';
if(strpos($action, 'action') === 0) $btype = 'button';
if(strpos($action, 'action') === 0)
$btype = 'button';
$options = $this->format_options('admin_button', $name, $options);
$options['class'] = $action;//shorthand
if(empty($label)) $label = $value;
if( empty($label))
$label = $value;
return "
<button type='{$btype}' name='{$name}' value='{$value}'".$this->get_attributes($options, $name)."><span>{$label}</span></button>
@@ -442,14 +455,16 @@ class e_form
function getNext()
{
if(!$this->_tabindex_enabled) return 0;
if(!$this->_tabindex_enabled)
return 0;
$this->_tabindex_counter += 1;
return $this->_tabindex_counter;
}
function getCurrent()
{
if(!$this->_tabindex_enabled) return 0;
if(!$this->_tabindex_enabled)
return 0;
return $this->_tabindex_counter;
}
@@ -462,33 +477,40 @@ class e_form
{
$ret = '';
//
foreach ($options as $option => $optval)
foreach ($options as $option=>$optval)
{
switch($option)
{
switch ($option) {
case 'id':
$ret .= $this->_format_id($optval, $name, $value);
break;
case 'class':
if(!empty($optval)) $ret .= " class='{$optval}'";
if(! empty($optval))
$ret .= " class='{$optval}'";
break;
case 'size':
if($optval) $ret .= " size='{$optval}'";
if($optval)
$ret .= " size='{$optval}'";
break;
case 'title':
if($optval) $ret .= " title='{$optval}'";
if($optval)
$ret .= " title='{$optval}'";
break;
case 'label':
if($optval) $ret .= " label='{$optval}'";
if($optval)
$ret .= " label='{$optval}'";
break;
case 'tabindex':
if($optval) $ret .= " tabindex='{$optval}'";
elseif(false === $optval || !$this->_tabindex_enabled) break;
if($optval)
$ret .= " tabindex='{$optval}'";
elseif(false === $optval || !$this->_tabindex_enabled)
break;
else
{
$this->_tabindex_counter += 1;
@@ -497,23 +519,28 @@ class e_form
break;
case 'readonly':
if($optval) $ret .= " readonly='readonly'";
if($optval)
$ret .= " readonly='readonly'";
break;
case 'selected':
if($optval) $ret .= " selected='selected'";
if($optval)
$ret .= " selected='selected'";
break;
case 'checked':
if($optval) $ret .= " checked='checked'";
if($optval)
$ret .= " checked='checked'";
break;
case 'disabled':
if($optval) $ret .= " disabled='disabled'";
if($optval)
$ret .= " disabled='disabled'";
break;
case 'other':
if($optval) $ret .= " $optval";
if($optval)
$ret .= " $optval";
break;
}
}
@@ -531,17 +558,22 @@ class e_form
*/
function _format_id($id_value, $name, $value = '', $return_attribute = 'id')
{
if($id_value === false) return '';
if($id_value === false)
return '';
//format data first
$name = $this->name2id($name);
$value = trim(preg_replace('#[^a-z0-9\-]/i#','-', $value), '-');
$value = str_replace("/","-",$value);
if(!$id_value && is_numeric($value)) $id_value = $value;
$value = trim(preg_replace('#[^a-z0-9\-]/i#', '-', $value), '-');
$value = str_replace("/", "-", $value);
if(!$id_value && is_numeric($value))
$id_value = $value;
if(empty($id_value) ) return " {$return_attribute}='{$name}".($value ? "-{$value}" : '')."'";// also useful when name is e.g. name='my_name[some_id]'
elseif(is_numeric($id_value) && $name) return " {$return_attribute}='{$name}-{$id_value}'";// also useful when name is e.g. name='my_name[]'
else return " {$return_attribute}='{$id_value}'";
if( empty($id_value))
return " {$return_attribute}='{$name}".($value ? "-{$value}" : '')."'";// also useful when name is e.g. name='my_name[some_id]'
elseif(is_numeric($id_value) && $name)
return " {$return_attribute}='{$name}-{$id_value}'";// also useful when name is e.g. name='my_name[]'
else
return " {$return_attribute}='{$id_value}'";
}
function name2id($name)
@@ -561,13 +593,15 @@ class e_form
*/
function format_options($type, $name, $user_options)
{
if(is_string($user_options)) parse_str($user_options, $user_options);
if(is_string($user_options))
parse_str($user_options, $user_options);
$def_options = $this->_default_options($type);
foreach (array_keys($user_options) as $key)
{
if(!isset($def_options[$key])) unset($user_options[$key]);//remove it?
if(!isset($def_options[$key]))
unset($user_options[$key]);//remove it?
}
$user_options['name'] = $name; //required for some of the automated tasks
@@ -582,25 +616,27 @@ class e_form
*/
function _default_options($type)
{
if(isset($this->_cached_attributes[$type])) return $this->_cached_attributes[$type];
if(isset($this->_cached_attributes[$type]))
return $this->_cached_attributes[$type];
$def_options = array(
'id' => '',
'class' => '',
'title' => '',
'size' => '',
'readonly' => false,
'selected' => false,
'checked' => false,
'disabled' => false,
'tabindex' => 0,
'label' => '',
'other' => ''
);
$def_options = array('id'=>'',
'class'=>'',
'title'=>'',
'size'=>'',
'readonly'=>false,
'selected'=>false,
'checked'=>false,
'disabled'=>false,
'tabindex'=>0,
'label'=>'',
'other'=>'');
switch ($type) {
switch($type)
{
case 'hidden':
$def_options = array('id' => false, 'disabled' => false, 'other' => '');
$def_options = array('id'=>false,
'disabled'=>false,
'other'=>'');
break;
case 'text':
@@ -624,7 +660,11 @@ class e_form
break;
case 'option':
$def_options = array('class' => '', 'selected' => false, 'other' => '', 'disabled' => false, 'label' => '');
$def_options = array('class'=>'',
'selected'=>false,
'other'=>'',
'disabled'=>false,
'label'=>'');
break;
case 'radio':
@@ -658,26 +698,21 @@ class e_form
}
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
{
$columnsArray = array_filter($columnsArray);
$text = "
<div class='col-selection-cont'>
<a href='#".$id."' class='e-show-if-js e-expandit' title='Click to select columns to display'>"
."<img class='icon' src='".e_IMAGE_ABS."admin_images/select_columns_16.png' alt='select columns' />"
."</a>
<a href='#".$id."' class='e-show-if-js e-expandit' title='Click to select columns to display'>"."<img class='icon' src='".e_IMAGE_ABS."admin_images/select_columns_16.png' alt='select columns' />"."</a>
<div id='".$id."' class='e-show-if-js e-hideme col-selection'><div class='col-selection-body'>
";
unset($columnsArray['options'], $columnsArray['checkboxes']);
foreach($columnsArray as $key => $fld)
foreach ($columnsArray as $key=>$fld)
{
if(!varset($fld['forced']))
{
$checked = (in_array($key,$columnsDefault)) ? TRUE : FALSE;
$checked = (in_array($key, $columnsDefault)) ? TRUE : FALSE;
$text .= "
<div class='field-spacer'>
".$this->checkbox_label(varset($fld['title'], $key), 'e-columns[]', $key, $checked)."
@@ -703,9 +738,9 @@ class e_form
{
$text = "";
$count = 0;
foreach($fieldarray as $key=>$val)
foreach ($fieldarray as $key=>$val)
{
if(in_array($key, $columnPref) || $key=='options' || varsettrue($val['forced']))
if(in_array($key, $columnPref) || $key == 'options' || varsettrue($val['forced']))
{
$class = vartrue($val['class']) ? ' class="'.$val['class'].'"' : '';
$text .= '
@@ -722,13 +757,13 @@ class e_form
';
}
function thead($fieldarray, $columnPref=array(), $querypattern = '', $requeststr = '')
function thead($fieldarray, $columnPref = array(), $querypattern = '', $requeststr = '')
{
$text = "";
// Recommended pattern: ?mode=list&fld=[FIELD]&asc=[ASC]&frm=[FROM]
if(strpos($querypattern,'&')!==FALSE)
if(strpos($querypattern, '&') !== FALSE)
{
// we can assume it's always $_GET since that's what it will generate
// more flexible (e.g. pass default values for order/field when they can't be found in e_QUERY) & secure
@@ -736,7 +771,7 @@ class e_form
parse_str($tmp, $tmp);
$etmp = array();
parse_str($querypattern,$etmp);
parse_str($querypattern, $etmp);
}
else // Legacy Queries. eg. main.[FIELD].[ASC].[FROM]
{
@@ -744,7 +779,7 @@ class e_form
$etmp = explode(".", $querypattern);
}
foreach($etmp as $key => $val) // I'm sure there's a more efficient way to do this, but too tired to see it right now!.
foreach ($etmp as $key=>$val) // I'm sure there's a more efficient way to do this, but too tired to see it right now!.
{
if($val == "[FIELD]")
{
@@ -761,30 +796,37 @@ class e_form
}
}
if(!varset($fromval)){ $fromval = 0; }
if(!varset($fromval))
{
$fromval = 0;
}
$ascdesc = (varset($ascdesc) == 'desc') ? 'asc' : 'desc';
foreach($fieldarray as $key=>$val)
foreach ($fieldarray as $key=>$val)
{
if(in_array($key,$columnPref) || $key == 'options' || (vartrue($val['forced'])))
if(in_array($key, $columnPref) || $key == 'options' || (vartrue($val['forced'])))
{
$cl = (vartrue($val['thclass'])) ? " class='".$val['thclass']."'" : "";
$text .= "
<th id='e-column-".str_replace('_', '-', $key)."'{$cl}>
";
if($querypattern!="" && !varsettrue($val['nosort']) && $key != "options" && $key != "checkboxes")
if($querypattern != "" && !varsettrue($val['nosort']) && $key != "options" && $key != "checkboxes")
{
$from = ($key == $field) ? $fromval : 0;
$srch = array("[FIELD]","[ASC]","[FROM]");
$repl = array($key,$ascdesc,$from);
$val['url'] = e_SELF."?".str_replace($srch,$repl,$querypattern);
$srch = array("[FIELD]",
"[ASC]",
"[FROM]");
$repl = array($key,
$ascdesc,
$from);
$val['url'] = e_SELF."?".str_replace($srch, $repl, $querypattern);
}
$text .= (vartrue($val['url'])) ? "<a href='".str_replace(array('&amp;', '&'), array('&', '&amp;'),$val['url'])."'>" : ""; // Really this column-sorting link should be auto-generated, or be autocreated via unobtrusive js.
$text .= (vartrue($val['url'])) ? "<a href='".str_replace(array('&amp;', '&'), array('&', '&amp;'), $val['url'])."'>" : ""; // Really this column-sorting link should be auto-generated, or be autocreated via unobtrusive js.
$text .= vartrue($val['title'], '');
$text .= ($val['url']) ? "</a>" : "";
$text .= ($key == "options") ? $this->columnSelector($fieldarray,$columnPref) : "";
$text .= ($key == "options") ? $this->columnSelector($fieldarray, $columnPref) : "";
$text .= ($key == "checkboxes") ? $this->checkbox_toggle('e-column-toggle', vartrue($val['toggle'], 'multiselect')) : "";
@@ -812,7 +854,7 @@ class e_form
$pid = $obj->pid;
foreach ($fieldarray as $field => $data)
foreach ($fieldarray as $field=>$data)
{
//Not found
@@ -842,7 +884,8 @@ class e_form
$parms = array();
if(isset($data['colparms'])) //TODO rename to 'parms'.
{
if(!is_array($data['colparms'])) parse_str($data['colparms'], $data['colparms']);
if(!is_array($data['colparms']))
parse_str($data['colparms'], $data['colparms']);
$parms = $data['colparms'];
}
@@ -893,16 +936,17 @@ class e_form
break;
case 'boolean':
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
$value = $value ? ADMIN_TRUE_ICON:
'';// TODO - ADMIN_FALSE_ICON
break;
case 'url':
$value = "<a href='".$value ."'>".$value."</a>";
$value = "<a href='".$value."'>".$value."</a>";
break;
case 'method': // Custom Function
$meth = $field;
$value = $obj->$meth($value,$obj->mode);
$value = $obj->$meth($value, $obj->mode);
break;
//TODO - form_userclass, order,... and maybe more types
@@ -947,9 +991,9 @@ class e_form
function filterType($fieldarray)
{
return " frm-> filterType() is Deprecated &nbsp;&nbsp; ";
define("e_AJAX_REQUEST",TRUE);
define("e_AJAX_REQUEST", TRUE);
$text = "<select name='search_filter[]' style='margin:2px' onchange='UpdateForm(this.options[selectedIndex].value)'>";
foreach($fieldarray as $key=>$val)
foreach ($fieldarray as $key=>$val)
{
$text .= varset($val['type']) ? "<option value='$key'>".$val['title']."</option>\n" : "";
@@ -958,14 +1002,15 @@ class e_form
return $text;
}
function filterValue($type='',$fields='')
function filterValue($type = '', $fields = '')
{
return " frm-> filterValue() is Deprecated.&nbsp;&nbsp; ";
if($type)
{
switch ($fields[$type]['type']) {
switch($fields[$type]['type'])
{
case "datestamp":
return "[date field]";
break;
@@ -982,7 +1027,7 @@ class e_form
break;
default :
default:
return $this->text('searchquery', '', 50);
@@ -1004,11 +1049,12 @@ class e_form
* @param array ucOptions [optional] associative array of userclass option groups to display, keyed on the option value prefix
* @return string the HTML for the form component
*/
function batchoptions($options, $ucOptions=null) {
function batchoptions($options, $ucOptions = null)
{
$text = "
<div class='f-left'>
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />
".$this->select_open('execute_batch', array('class' => 'tbox select e-execute-batch', 'id' => false))."
".$this->select_open('execute_batch', array('class'=>'tbox select e-execute-batch', 'id'=>false))."
".$this->option('With selected...', '')."
";
@@ -1019,7 +1065,7 @@ class e_form
$classes = vartrue($options['__check_class'], array());
unset($options['__permissions'], $options['__check_class']);
foreach ($options as $key => $val)
foreach ($options as $key=>$val)
{
if(isset($permissions[$key]) && !getperms($permissions[$key]))
{
@@ -1032,15 +1078,17 @@ class e_form
}
if(!is_array($val))
{
if($disabled) $val = $val.' ('.LAN_NOPERMISSION.')';
$text .= "\t".$this->option('&nbsp;&nbsp;&nbsp;&nbsp;'.$val, $key, false, array('disabled' => $disabled))."\n";
if($disabled)
$val = $val.' ('.LAN_NOPERMISSION.')';
$text .= "\t".$this->option('&nbsp;&nbsp;&nbsp;&nbsp;'.$val, $key, false, array('disabled'=>$disabled))."\n";
}
else
{
if($disabled) $val[0] = $val[0].' ('.LAN_NOPERMISSION.')';
if($disabled)
$val[0] = $val[0].' ('.LAN_NOPERMISSION.')';
$text .= "\t".$this->optgroup_open($val[0], $disabled)."\n";
foreach ($val[1] as $k => $v)
foreach ($val[1] as $k=>$v)
{
$disabled = false;
if(isset($classes[$key][$k]) && !check_class($classes[$key][$k]))
@@ -1048,7 +1096,7 @@ class e_form
$disabled = true;
$v = $v.' ('.LAN_NOPERMISSION.')';
}
$text .= "\t\t".$this->option($v, $key.'_selected_'.$k, false, array('disabled' => $disabled))."\n";
$text .= "\t\t".$this->option($v, $key.'_selected_'.$k, false, array('disabled'=>$disabled))."\n";
}
$text .= $this->optgroup_close()."\n";
@@ -1056,12 +1104,12 @@ class e_form
}
if ($ucOptions) // Userclass List.
if($ucOptions) // Userclass List.
{
foreach ($ucOptions as $ucKey => $ucVal)
foreach ($ucOptions as $ucKey=>$ucVal)
{
$text .= "\t".$this->optgroup_open($ucVal[0])."\n";
foreach ($ucVal[1] as $key => $val)
foreach ($ucVal[1] as $key=>$val)
{
$text .= "\t\t".$this->option($val['userclass_name']['userclass_name'], $ucKey.'_selected_'.$val['userclass_name']['userclass_id'])."\n";
}
@@ -1078,18 +1126,22 @@ class e_form
return $text;
}
}
}
class form {
class form
{
function form_open($form_method, $form_action, $form_name = "", $form_target = "", $form_enctype = "", $form_js = "") {
function form_open($form_method, $form_action, $form_name = "", $form_target = "", $form_enctype = "", $form_js = "")
{
$method = ($form_method ? "method='".$form_method."'" : "");
$target = ($form_target ? " target='".$form_target."'" : "");
$name = ($form_name ? " id='".$form_name."' " : " id='myform'");
return "\n<form action='".$form_action."' ".$method.$target.$name.$form_enctype.$form_js.">";
}
function form_text($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
function form_text($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "",
$form_js = "")
{
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
$value = (isset($form_value) ? " value='".$form_value."'" : "");
$size = ($form_size ? " size='".$form_size."'" : "");
@@ -1099,7 +1151,9 @@ class form {
return "\n<input class='".$form_class."' type='text' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
}
function form_password($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
function form_password($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "",
$form_js = "")
{
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
$value = (isset($form_value) ? " value='".$form_value."'" : "");
$size = ($form_size ? " size='".$form_size."'" : "");
@@ -1109,14 +1163,17 @@ class form {
return "\n<input class='".$form_class."' type='password' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
}
function form_button($form_type, $form_name, $form_value, $form_js = "", $form_image = "", $form_tooltip = "") {
function form_button($form_type, $form_name, $form_value, $form_js = "", $form_image = "", $form_tooltip = "")
{
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
$image = ($form_image ? " src='".$form_image."' " : "");
$tooltip = ($form_tooltip ? " title='".$form_tooltip."' " : "");
return "\n<input class='button' type='".$form_type."' ".$form_js." value='".$form_value."'".$name.$image.$tooltip." />";
}
function form_textarea($form_name, $form_columns, $form_rows, $form_value, $form_js = "", $form_style = "", $form_wrap = "", $form_readonly = "", $form_tooltip = "") {
function form_textarea($form_name, $form_columns, $form_rows, $form_value, $form_js = "", $form_style = "", $form_wrap = "", $form_readonly = "",
$form_tooltip = "")
{
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
$readonly = ($form_readonly ? " readonly='readonly'" : "");
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
@@ -1125,7 +1182,8 @@ class form {
return "\n<textarea class='tbox' cols='".$form_columns."' rows='".$form_rows."' ".$name.$form_js.$style.$wrap.$readonly.$tooltip.">".$form_value."</textarea>";
}
function form_checkbox($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "") {
function form_checkbox($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "")
{
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
$checked = ($form_checked ? " checked='checked'" : "");
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
@@ -1133,7 +1191,8 @@ class form {
}
function form_radio($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "") {
function form_radio($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "")
{
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
$checked = ($form_checked ? " checked='checked'" : "");
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
@@ -1141,56 +1200,62 @@ class form {
}
function form_file($form_name, $form_size, $form_tooltip = "", $form_js = "") {
function form_file($form_name, $form_size, $form_tooltip = "", $form_js = "")
{
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
return "<input type='file' class='tbox' size='".$form_size."'".$name.$tooltip.$form_js." />";
}
function form_select_open($form_name, $form_js = "") {
function form_select_open($form_name, $form_js = "")
{
return "\n<select id='".$form_name."' name='".$form_name."' class='tbox' ".$form_js." >";
}
function form_select_close() {
function form_select_close()
{
return "\n</select>";
}
function form_option($form_option, $form_selected = "", $form_value = "", $form_js = "") {
function form_option($form_option, $form_selected = "", $form_value = "", $form_js = "")
{
$value = ($form_value !== FALSE ? " value='".$form_value."'" : "");
$selected = ($form_selected ? " selected='selected'" : "");
return "\n<option".$value.$selected." ".$form_js.">".$form_option."</option>";
}
function form_hidden($form_name, $form_value) {
function form_hidden($form_name, $form_value)
{
return "\n<input type='hidden' id='".$form_name."' name='".$form_name."' value='".$form_value."' />";
}
function form_close() {
function form_close()
{
return "\n</form>";
}
}
}
/*
Usage
echo $rs->form_open("post", e_SELF, "_blank");
echo $rs->form_text("testname", 100, "this is the value", 100, 0, "tooltip");
echo $rs->form_button("submit", "testsubmit", "SUBMIT!", "", "Click to submit");
echo $rs->form_button("reset", "testreset", "RESET!", "", "Click to reset");
echo $rs->form_textarea("textareaname", 10, 10, "Value", "overflow:hidden");
echo $rs->form_checkbox("testcheckbox", 1, 1);
echo $rs->form_checkbox("testcheckbox2", 2);
echo $rs->form_hidden("hiddenname", "hiddenvalue");
echo $rs->form_radio("testcheckbox", 1, 1);
echo $rs->form_radio("testcheckbox", 1);
echo $rs->form_file("testfile", "20");
echo $rs->form_select_open("testselect");
echo $rs->form_option("Option 1");
echo $rs->form_option("Option 2");
echo $rs->form_option("Option 3", 1, "defaultvalue");
echo $rs->form_option("Option 4");
echo $rs->form_select_close();
echo $rs->form_close();
*/
/*
Usage
echo $rs->form_open("post", e_SELF, "_blank");
echo $rs->form_text("testname", 100, "this is the value", 100, 0, "tooltip");
echo $rs->form_button("submit", "testsubmit", "SUBMIT!", "", "Click to submit");
echo $rs->form_button("reset", "testreset", "RESET!", "", "Click to reset");
echo $rs->form_textarea("textareaname", 10, 10, "Value", "overflow:hidden");
echo $rs->form_checkbox("testcheckbox", 1, 1);
echo $rs->form_checkbox("testcheckbox2", 2);
echo $rs->form_hidden("hiddenname", "hiddenvalue");
echo $rs->form_radio("testcheckbox", 1, 1);
echo $rs->form_radio("testcheckbox", 1);
echo $rs->form_file("testfile", "20");
echo $rs->form_select_open("testselect");
echo $rs->form_option("Option 1");
echo $rs->form_option("Option 2");
echo $rs->form_option("Option 3", 1, "defaultvalue");
echo $rs->form_option("Option 4");
echo $rs->form_select_close();
echo $rs->form_close();
*/
?>

View File

@@ -1,21 +1,21 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <EFBFBD>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/redirection_class.php,v $
| $Revision: 1.3 $
| $Date: 2009-10-20 03:59:20 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Copyright (C) 2001-2009 e107 Inc
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/redirection_class.php,v $
| $Revision: 1.4 $
| $Date: 2009-10-28 16:57:51 $
| $Author: marj_nl_fr $
+----------------------------------------------------------------------------+
*/
class redirection
{
@@ -23,10 +23,11 @@ class redirection
var $self_exceptions = array();
var $page_exceptions = array();
/**
* Manage Member-Only Mode.
* @return void
*/
function __construct()
{
$this->self_exceptions = array(SITEURL.e_SIGNUP, SITEURL.'index.php', SITEURL.'fpw.php', SITEURL.e_LOGIN, SITEURL.'membersonly.php');
@@ -35,7 +36,7 @@ class redirection
/**
* Perform re-direction when Maintenance Mode is active.
* @return
* @return void
*/
public function checkMaintenance()
{
@@ -66,8 +67,9 @@ class redirection
}
/** check if user is logged in.
*
/**
* check if user is logged in.
* @return void
*/
public function checkMembersOnly()
@@ -112,9 +114,9 @@ class redirection
$this->redirect(e_HTTP.'membersonly.php');
}
/** Store the current URL so that it can retrieved after login.
* @param
* @return
/**
* Store the current URL so that it can retrieved after login.
* @return void
*/
private function saveMembersOnlyUrl()
@@ -126,9 +128,9 @@ class redirection
}
/** Restore the previously saved URL, and redirect the User to it after login.
* @param
* @return
/**
* Restore the previously saved URL, and redirect the User to it after login.
* @return void
*/
private function restoreMembersOnlyUrl()
@@ -148,4 +150,3 @@ class redirection
exit();
}
}
?>

View File

@@ -1,22 +1,28 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system - Language File.
| e107 website system
|
| Copyright (C) 2001-2009 e107 Inc
| http://e107.org
|
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_ugflag.php,v $
| $Revision: 1.3 $
| $Date: 2009-09-27 21:18:42 $
| $Author: e107coders $
| $Revision: 1.4 $
| $Date: 2009-10-28 16:57:51 $
| $Author: marj_nl_fr $
+----------------------------------------------------------------------------+
*/
define("UGFLAN_1", "Maintenance settings updated");
define("UGFLAN_2", "Activate maintenance flag");
define("UGFLAN_3", "Update Maintenance Setting");
define("UGFLAN_4", "Maintenance Setting");
define('UGFLAN_1', 'Maintenance settings updated');
define('UGFLAN_2', 'Activate maintenance flag');
define('UGFLAN_3', 'Update Maintenance Setting');
define('UGFLAN_4', 'Maintenance Setting');
define("UGFLAN_5", "Text to display when site down");
define("UGFLAN_6", "Leave blank to display default message");
define("UGFLAN_7","Update unsuccessful as no changes were made.");
define("UGFLAN_8","Limit access to Main-Admins only");
define("UGFLAN_9","Only Main-Admins will be able to login while the maintenance mode is active.");
?>
define('UGFLAN_5', 'Text to display when site down');
define('UGFLAN_6', 'Leave blank to display default message');
define('UGFLAN_7', 'Update unsuccessful as no changes were made.');
define('UGFLAN_8', 'Limit access to Admins only');
define('UGFLAN_9', 'Limit access to Main-Admins only');