commit 6fd985c585428e17f54cefe23a400a0eccb13709
parent 459ec3596619b0a0d0b2495ab89765b1c55afdea
Author: dankert <devnull@localhost>
Date: Thu, 18 Mar 2010 22:41:32 +0100
Admins können auf einfachen Benutzer umschalten und diesen imitieren.
Diffstat:
4 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php
@@ -1049,6 +1049,22 @@ class IndexAction extends Action
}
+ function switchuser()
+ {
+ $user = Session::getUser();
+
+ if ( ! $user->isAdmin )
+ Http::notAuthorized("");
+
+ $this->recreateSession();
+
+ $newUser = new User( $this->getRequestId() );
+ $newUser->load();
+
+ $newUser->setCurrent();
+ }
+
+
function show()
{
global $conf;
diff --git a/actionClasses/IndexAction.ini.php b/actionClasses/IndexAction.ini.php
@@ -8,6 +8,9 @@ goto=show
guest=true
goto=showlogin
+[switchuser]
+goto=show
+
[object]
goto=show
guest=true
diff --git a/themes/default/pages/html/user/listing.tpl.php b/themes/default/pages/html/user/listing.tpl.php
@@ -32,6 +32,7 @@
<body class="main" <?php if (@$conf['interface']['application_mode']) { ?> style="padding:0px;margin:0px;"<?php } ?> >
<?php /* Debug-Information */ if ($showDuration) { echo "<!-- Output Variables are:\n";echo str_replace('-->','-- >',print_r($this->templateVars,true));echo "\n-->";} ?><?php unset($a1_class) ?><?php $a2_name='GLOBAL_USERS';$a2_icon='user';$a2_width='70%';$a2_rowclasses='odd,even';$a2_columnclasses='1,2,3'; ?><?php
$coloumn_widths=array();
+ $icon=$a2_icon;
$row_classes = explode(',',$a2_rowclasses);
$row_class_idx = 999;
$column_classes = explode(',',$a2_columnclasses);
@@ -50,7 +51,7 @@
if (!@$conf['interface']['application_mode'] )
{
echo '<tr class="title"><td>';
- echo '<img src="'.$image_dir.'icon_'.$actionName.IMG_ICON_EXT.'" align="left" border="0">';
+ echo '<img src="'.$image_dir.'icon_'.$icon.IMG_ICON_EXT.'" align="left" border="0">';
if ($this->isEditable()) { ?>
<?php if ($this->isEditMode()) {
?><a href="<?php echo Html::url($actionName,$subActionName,$this->getRequestId() ) ?>" accesskey="1" title="<?php echo langHtml('MODE_EDIT_DESC') ?>" class="path" style="text-align:right;font-weight:bold;font-weight:bold;"><img src="<?php echo $image_dir ?>mode-edit.png" style="vertical-align:top; " border="0" /></a> <?php }
@@ -58,7 +59,7 @@
?><img src="<?php echo $image_dir ?>readonly.png" style="vertical-align:top; " border="0" /> <?php } else {
?><a href="<?php echo Html::url($actionName,$subActionName,$this->getRequestId(),array('mode'=>'edit') ) ?>" accesskey="1" title="<?php echo langHtml('MODE_SHOW_DESC') ?>" class="path" style="text-align:right;font-weight:bold;font-weight:bold;"><img src="<?php echo $image_dir ?>readonly.png" style="vertical-align:top; " border="0" /></a> <?php }
?><?php }
- echo '<span class="path">'.langHtml('GLOBAL_'.$actionName).'</span> <strong>»</strong> ';
+ echo '<span class="path">'.langHtml($actionName).'</span> <strong>»</strong> ';
if ( !isset($path) || is_array($path) )
$path = array();
foreach( $path as $pathElement)
@@ -203,7 +204,7 @@
$tmp_tag = 'span';
?><<?php echo $tmp_tag ?> class="<?php echo $a6_class ?>" title="<?php echo $a6_title ?>"><?php
$langF = $a6_escape?'langHtml':'lang';
- $tmp_text = $a6_value;
+ $tmp_text = $a6_escape?htmlentities($a6_value):$a6_value;
$tmp_text = nl2br($tmp_text);
echo $tmp_text;
unset($tmp_text);
@@ -243,7 +244,27 @@
$tmp_text = nl2br($tmp_text);
echo $tmp_text;
unset($tmp_text);
-?></<?php echo $tmp_tag ?>><?php unset($a7_class,$a7_raw,$a7_escape,$a7_cut) ?><?php } ?></td></tr><?php } ?> </table>
+?></<?php echo $tmp_tag ?>><?php unset($a7_class,$a7_raw,$a7_escape,$a7_cut) ?><?php } ?></td><?php $column_idx++; ?><td
+<?php if (!empty($column_widths)) { ?>
+ width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>"
+<?php } ?>
+<?php if (!empty($column_classes)) { ?>
+ class="<?php echo $column_classes[($column_idx-1)%count($column_classes)] ?>"
+<?php } ?>
+><?php $a6_title='';$a6_target='_top';$a6_class='';$a6_action='index';$a6_subaction='switchuser';$a6_id=$userid; ?><?php
+ $params = array();
+ $tmp_url = '';
+ $tmp_url = Html::url($a6_action,$a6_subaction,!empty($a6_id)?$a6_id:$this->getRequestId(),$params);
+?><a<?php if (isset($a6_name)) echo ' name="'.$a6_name.'"'; else echo ' href="'.$tmp_url.(isset($a6_anchor)?'#'.$a6_anchor:'').'"' ?> class="<?php echo $a6_class ?>" target="<?php echo $a6_target ?>"<?php if (isset($a6_accesskey)) echo ' accesskey="'.$a6_accesskey.'"' ?> title="<?php echo encodeHtml($a6_title) ?>"><?php unset($a6_title,$a6_target,$a6_class,$a6_action,$a6_subaction,$a6_id) ?><?php $a7_class='text';$a7_key='LOGIN';$a7_escape=true;$a7_cut='both'; ?><?php
+ $a7_title = '';
+ $tmp_tag = 'span';
+?><<?php echo $tmp_tag ?> class="<?php echo $a7_class ?>" title="<?php echo $a7_title ?>"><?php
+ $langF = $a7_escape?'langHtml':'lang';
+ $tmp_text = $langF($a7_key);
+ $tmp_text = nl2br($tmp_text);
+ echo $tmp_text;
+ unset($tmp_text);
+?></<?php echo $tmp_tag ?>><?php unset($a7_class,$a7_key,$a7_escape,$a7_cut) ?></a></td></tr><?php } ?> </table>
</td>
</tr>
</table>
diff --git a/themes/default/templates/user/listing.tpl.src.php b/themes/default/templates/user/listing.tpl.src.php
@@ -12,3 +12,7 @@ page
text raw:_(
text key:USER_ADMIN
text raw:)
+ cell
+ link target:_top action:index subaction:switchuser id:var:userid
+ text key:LOGIN
+ +
\ No newline at end of file