/4.8/administrator/components/com_users/admin.users.html.php
PHP | 509 lines | 478 code | 14 blank | 17 comment | 13 complexity | b22c5e6ee468085f5e18716bc126f777 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, LGPL-2.0
- <?php
- /**
- * @package MiaCMS
- * @subpackage Users
- * @author MiaCMS see README.php
- * @copyright see README.php
- * See COPYRIGHT.php for copyright notices and details.
- * @license GNU/GPL Version 2, see LICENSE.php
- * MiaCMS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2 of the License.
- */
- /** ensure this file is being included by a parent file */
- defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
- class HTML_users {
- function showUsers( &$rows, $pageNav, $search, $option, $lists ) {
- global $mainframe, $mosConfig_offset;
- ?>
- <form action="index2.php" method="post" id="adminForm" name="adminForm">
- <table class="adminheading">
- <tr>
- <th class="user">
- <?php echo T_('User Manager'); ?>
- </th>
- <td>
- <?php echo T_('Filter:'); ?>
- </td>
- <td>
- <input type="text" id="search" name="search" value="<?php echo $search;?>" class="text_area" />
- </td>
- <td>
- <?php echo $lists['type'];?>
- </td>
- <td>
- <?php echo $lists['logged'];?>
- </td>
- </tr>
- </table>
- <table class="adminlist">
- <tr>
- <th width="2%" class="title">
- #
- </th>
- <th width="3%" class="title">
- <input id="check_all" type="checkbox" name="toggle" value="" />
- </th>
- <th class="title">
- <?php echo T_('Name'); ?>
- </th>
- <th width="5%" class="title" nowrap="nowrap">
- <?php echo T_('Logged In'); ?>
- </th>
- <th width="5%" class="title">
- <?php echo T_('Enabled'); ?>
- </th>
- <th width="15%" class="title" >
- <?php echo T_('UserID'); ?>
- </th>
- <th width="15%" class="title">
- <?php echo T_('Group'); ?>
- </th>
- <th width="15%" class="title">
- <?php echo T_('E-Mail'); ?>
- </th>
- <th width="10%" class="title">
- <?php echo T_('Last Visit'); ?>
- </th>
- </tr>
- <?php
- $k = 0;
- for ($i=0, $n=count( $rows ); $i < $n; $i++) {
- $row =& $rows[$i];
- $published = mosCommonHTML::userPublishedProcessing( $row, $i );
- $link = htmlentities('index2.php?option=com_users&task=editA&id='. $row->id. '&hidemainmenu=1');
- ?>
- <tr class="<?php echo "row$k"; ?>">
- <td>
- <?php echo $i+1+$pageNav->limitstart;?>
- </td>
- <td>
- <?php echo mosHTML::idBox( $i, $row->id ); ?>
- </td>
- <td>
- <a href="<?php echo $link; ?>">
- <?php echo $row->name; ?>
- </a>
- </td>
- <td align="center">
- <?php echo $row->loggedin ? '<img src="images/tick.png" width="12" height="12" border="0" alt="" />': ''; ?>
- </td>
- <td>
- <?php echo $published; ?>
- </td>
- <td>
- <?php echo $row->username; ?>
- </td>
- <td>
- <?php echo $row->groupname; ?>
- </td>
- <td>
- <a href="mailto:<?php echo $row->email; ?>">
- <?php echo $row->email; ?>
- </a>
- </td>
- <td nowrap="nowrap">
- <?php echo mosFormatDate( $row->lastvisitDate, "%Y-%m-%d %H:%M:%S" ); ?>
- </td>
- </tr>
- <?php
- $k = 1 - $k;
- }
- ?>
- </table>
- <?php echo $pageNav->getListFooter(); ?>
- <input type="hidden" name="option" value="<?php echo $option;?>" />
- <input type="hidden" name="task" value="" />
- <input type="hidden" id="boxchecked" name="boxchecked" value="0" />
- <input type="hidden" id="hidemainmenu" name="hidemainmenu" value="0" />
- </form>
- <?php
- $rowCount = count( $rows );
- $saveOrderCount = $rowCount - 1;
- $tag = <<<JSTAG
- <script type="text/javascript">
- //Setup the check all onclick handler
- YAHOO.util.Event.addListener("check_all", "click", function() {
- YAHOO.miacms.base.checkAll($rowCount);
- });
- //Setup filter event handlers
- YAHOO.util.Event.addListener("search", "change", function() {
- YAHOO.util.Dom.get("adminForm").submit();
- });
- YAHOO.util.Event.addListener("filter_type", "change", function() {
- YAHOO.util.Dom.get("adminForm").submit();
- });
- YAHOO.util.Event.addListener("filter_position", "change", function() {
- YAHOO.util.Dom.get("adminForm").submit();
- });
- //Setup save icon event handler
- YAHOO.util.Event.addListener("saveorder", "click", function() {
- YAHOO.miacms.base.saveorder($saveOrderCount);
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
- function edituser( &$row, &$contact, &$lists, $option, $uid, $openids = null ) {
- global $mainframe, $my, $acl, $mosConfig_live_site;
- $canBlockUser = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'user properties', 'block_user' );
- $canEmailEvents = $acl->acl_check( 'workflow', 'email_events', 'users', $acl->get_group_name( $row->gid, 'ARO' ) );
- ?>
- <form action="index2.php?f=<?php echo mosMainframe::formId($option, 'edit', $my); ?>" method="post" id="adminForm" name="adminForm">
- <table class="adminheading">
- <tr>
- <th class="user">
- <?php echo T_('User:'); ?> <small><?php echo $row->id ? T_('Edit') : T_('Add');?></small>
- </th>
- </tr>
- </table>
- <table width="100%">
- <tr>
- <td width="60%" valign="top">
- <table class="adminform">
- <tr>
- <th colspan="2">
- <?php echo T_('User Details'); ?>
- </th>
- </tr>
- <tr>
- <td width="100">
- <?php echo T_('Name:'); ?>
- </td>
- <td width="85%">
- <input type="text" name="name" class="inputbox" size="40" value="<?php echo $row->name; ?>" />
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Username:'); ?>
- </td>
- <td>
- <input type="text" name="username" class="inputbox" size="40" value="<?php echo $row->username; ?>" />
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Email:'); ?>
- </td>
- <td>
- <input class="inputbox" type="text" name="email" size="40" value="<?php echo $row->email; ?>" />
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('New Password:'); ?>
- </td>
- <td>
- <input class="inputbox" type="password" name="password" size="40" value="" />
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Verify Password:'); ?>
- </td>
- <td>
- <input class="inputbox" type="password" name="password2" size="40" value="" />
- </td>
- </tr>
- <tr>
- <td valign="top">
- <?php echo T_('Group:'); ?>
- </td>
- <td>
- <?php echo $lists['gid']; ?>
- </td>
- </tr>
- <?php
- if ($canBlockUser) {
- ?>
- <tr>
- <td>
- <?php echo T_('Block User'); ?>
- </td>
- <td>
- <?php echo $lists['block']; ?>
- </td>
- </tr>
- <?php
- }
- if ($canEmailEvents) {
- ?>
- <tr>
- <td>
- <?php echo T_('Receive Submission Emails'); ?>
- </td>
- <td>
- <?php echo $lists['sendEmail']; ?>
- </td>
- </tr>
- <?php
- }
- if( $uid ) {
- ?>
- <tr>
- <td>
- <?php echo T_('Register Date'); ?>
- </td>
- <td>
- <?php echo $row->registerDate;?>
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Last Visit Date'); ?>
- </td>
- <td>
- <?php echo $row->lastvisitDate;?>
- </td>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td colspan="2">
- </td>
- </tr>
- </table>
- </td>
- <td width="40%" valign="top">
- <?php
- if ( !$contact ) {
- ?>
- <table class="adminform">
- <tr>
- <th>
- <?php echo T_('Contact Information'); ?>
- </th>
- </tr>
- <tr>
- <td>
- <br />
- <?php echo T_('No Contact details linked to this User:'); ?>
- <br />
- <?php echo T_('See "Components -> Contact -> Manage Contacts" for details.'); ?>
- <br /><br />
- </td>
- </tr>
- </table>
- <?php
- } else {
- ?>
- <table class="adminform">
- <tr>
- <th colspan="2">
- <?php echo T_('Contact Information'); ?>
- </th>
- </tr>
- <tr>
- <td width="15%">
- <?php echo T_('Name:'); ?>
- </td>
- <td>
- <strong>
- <?php echo $contact[0]->name;?>
- </strong>
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Position:'); ?>
- </td>
- <td >
- <strong>
- <?php echo $contact[0]->con_position;?>
- </strong>
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Telephone:'); ?>
- </td>
- <td >
- <strong>
- <?php echo $contact[0]->telephone;?>
- </strong>
- </td>
- </tr>
- <tr>
- <td>
- <?php echo T_('Fax:'); ?>
- </td>
- <td >
- <strong>
- <?php echo $contact[0]->fax;?>
- </strong>
- </td>
- </tr>
- <tr>
- <td></td>
- <td >
- <strong>
- <?php echo $contact[0]->misc;?>
- </strong>
- </td>
- </tr>
- <?php
- if ($contact[0]->image) {
- ?>
- <tr>
- <td></td>
- <td valign="top">
- <img src="<?php echo $mosConfig_live_site;?>/images/stories/<?php echo $contact[0]->image; ?>" align="middle" alt="<?php echo T_('Contact'); ?>" />
- </td>
- </tr>
- <?php
- }
- ?>
- <tr>
- <td colspan="2">
- <br /><br />
- <input class="button" type="button" value="<?php echo T_('Change Contact Details'); ?>" onclick="YAHOO.admin.user.gotocontact( '<?php echo $contact[0]->id; ?>' );" />
- <i>
- <br />
- '<?php echo T_('Components -> Contact -> Manage Contacts'); ?>'.
- </i>
- </td>
- </tr>
- </table>
- <?php
- }
- if (($openids != null) && (count($openids) > 0)) {
- ?>
- <table class="adminform">
- <tr>
- <th>
- <?php echo T_('OpenIDs'); ?>
- </th>
- </tr>
- <tr>
- <td>
- <?php HTML_users::listOpenIDs($openids); ?>
- </td>
- </tr>
- </table>
- <?php
- }
- ?>
- </td>
- </tr>
- </table>
- <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
- <input type="hidden" name="option" value="<?php echo $option; ?>" />
- <input type="hidden" name="task" value="" />
- <input type="hidden" name="contact_id" value="" />
- <?php
- if (!$canEmailEvents) {
- ?>
- <input type="hidden" name="sendEmail" value="0" />
- <?php
- }
- ?>
- </form>
- <?php
- //Define heredoc vars
- $nameMsg = T_('You must provide a name');
- $loginNameMsg = T_('You must provide a user login name');
- $invalidMsg = T_('Your login name contains invalid characters or is too short');
- $emailMsg = T_('You must provide an email address');
- $passwordMsg = T_('Passwords do not match');
- $assignUserMsg = T_('You must assign user to a group');
- $pfeMsg = T_('Please Select another group as `Public Frontend` is not a selectable option');
- $pbeMsg = T_('Please Select another group as `Public Backend` is not a selectable option');
- $tag = <<<JSTAG
- <script type="text/javascript">
- YAHOO.util.Event.on(window, "load", function() {
- YAHOO.miacms.base.submitbutton = function(pressbutton) {
- var form = YAHOO.util.Dom.get("adminForm") || document.adminForm;
- if (pressbutton === 'cancel') {
- YAHOO.miacms.base.submitform( pressbutton );
- return;
- }
- var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
- //Do field validation
- if (YAHOO.miacms.base.trim(form.name.value) === "") {
- alert( "$nameMsg" );
- } else if (YAHOO.miacms.base.trim(form.username.value) === "") {
- alert( "$loginNameMsg" );
- } else if (r.exec(form.username.value) || form.username.value.length < 3) {
- alert( "$invalidMsg" );
- } else if (YAHOO.miacms.base.trim(form.email.value) === "") {
- alert( "$emailMsg" );
- } else if (YAHOO.miacms.base.trim(form.password.value) != "" && form.password.value != form.password2.value){
- alert( "$passwordMsg" );
- } else if (form.gid.value === "") {
- alert( "$assignUserMsg" );
- } else if (form.gid.value == "29") {
- alert( "$pfeMsg" );
- } else if (form.gid.value == "30") {
- alert( "$pbeMsg" );
- } else {
- YAHOO.miacms.base.submitform( pressbutton );
- }
- };
- YAHOO.namespace("admin.user");
- YAHOO.admin.user.gotocontact = function( id ) {
- var form = YAHOO.util.Dom.get("adminForm") || document.adminForm;
- form.contact_id.value = id;
- YAHOO.miacms.base.submitform( 'contact' );
- };
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
- function listOpenIDs($openids) {
- //for each openid
- global $mainframe, $mosConfig_live_site;
- echo "<p>".T_("You can remove your registered OpenIDs by clicking the Remove links.");
- echo "<ol>";
- foreach ($openids as $openid) {
- $link = "index2.php?option=com_users&task=removeOpenID&idopenid=".$openid->id."&userid=".$openid->user_id;
- echo "<li>".$openid->openid." <a class='removeopenidlink' href=".$link.">".T_("Remove")."</a></li>";
- }
- echo "</ol>";
- echo "</div>";
- $sureMsg = T_('Are you sure you want to delete the OpenID?');
- $tag = <<<JSTAG
- <script type="text/javascript">
- YAHOO.util.Event.on(window, "load", function() {
- YAHOO.miacms.base.removeopenid = function(e) {
- if (!confirm('$sureMsg')) {
- YAHOO.util.Event.preventDefault(e);
- YAHOO.util.Event.stopPropagation(e);
- return false;
- }
- return true;
- };
- var removeopenidlinks = YAHOO.util.Dom.getElementsByClassName("removeopenidlink") || "undefined";
- if (removeopenidlinks !=="undefined") {
- YAHOO.util.Event.addListener(removeopenidlinks, "click", YAHOO.miacms.base.removeopenid);
- }
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- return;
- }
- }
- ?>