更新到 5.2 正式版后第一次 SVN 提交。

[email protected]


git-svn-id: https://svn.code.sf.net/p/hawebs/svn@649 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-11-17 02:40:00 +00:00
parent 56fb3bbe0b
commit f90e80fdf1
60 changed files with 12167 additions and 0 deletions
@@ -0,0 +1,115 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('Smarty_setup.php');
require_once('modules/Settings/Forms.php');
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $current_user;
global $adb;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
if(isset($_REQUEST['record']) && $_REQUEST['record']!='')
{
$sql = "select * from vtiger_mail_accounts where user_id=?";
$result = $adb->pquery($sql, array($_REQUEST['record']));
$rowcount = $adb->num_rows($result);
if ($rowcount!=0)
{
while($temprow = $adb->fetchByAssoc($result))
{
$smarty->assign("DISPLAYNAME", $temprow['display_name']);
$smarty->assign("ID", $temprow['user_id']);
$smarty->assign("EMAIL", $temprow['mail_id']);
$smarty->assign("ACCOUNTNAME", $temprow['account_name']);
$smarty->assign($temprow['mail_protocol'],$temprow['mail_protocol']);
$smarty->assign("SERVERUSERNAME", $temprow['mail_username']);
$smarty->assign("SERVERPASSWORD", $temprow['mail_password']);
$smarty->assign("SERVERNAME", $temprow['mail_servername']);
$smarty->assign("RECORD_ID", $temprow['account_id']);
$smarty->assign("BOX_REFRESH", $temprow['box_refresh']);
$smarty->assign("MAILS_PER_PAGE", $temprow['mails_per_page']);
$smarty->assign("EDIT", "TRUE");
if(strtolower($temprow['mail_protocol']) == "imap")
$smarty->assign("IMAP", "CHECKED");
if(strtolower($temprow['mail_protocol']) == "imap2")
$smarty->assign("IMAP2", "CHECKED");
if(strtolower($temprow['mail_protocol']) == "imap4")
$smarty->assign("IMAP4", "CHECKED");
if(strtolower($temprow['mail_protocol']) == "imap4rev1")
$smarty->assign("IMAP4R1", "CHECKED");
if(strtolower($temprow['mail_protocol']) == "pop3")
$smarty->assign("POP3", "CHECKED");
if(strtolower($temprow['ssltype']) == "notls")
$smarty->assign("NOTLS", "CHECKED");
if(strtolower($temprow['ssltype']) == "tls")
$smarty->assign("TLS", "CHECKED");
if(strtolower($temprow['ssltype']) == "ssl")
$smarty->assign("SSL", "CHECKED");
if(strtolower($temprow['sslmeth']) == "validate-cert")
$smarty->assign("VALIDATECERT", "CHECKED");
if(strtolower($temprow['sslmeth']) == "novalidate-cert")
$smarty->assign("NOVALIDATECERT", "CHECKED");
if($temprow['int_mailer'] == "1")
$smarty->assign("INT_MAILER_USE", "CHECKED");
else
$smarty->assign("INT_MAILER_NOUSE", "CHECKED");
if(strtolower($temprow['box_refresh']) == "60000")
$smarty->assign("BOX_OPT1", " SELECTED");
if(strtolower($temprow['box_refresh']) == "120000")
$smarty->assign("BOX_OPT2", " SELECTED");
if(strtolower($temprow['box_refresh']) == "180000")
$smarty->assign("BOX_OPT3", " SELECTED");
if(strtolower($temprow['box_refresh']) == "240000")
$smarty->assign("BOX_OPT4", " SELECTED");
if(strtolower($temprow['box_refresh']) == "300000")
$smarty->assign("BOX_OPT5", " SELECTED");
}
}
}
$qry_res = $adb->pquery("select * from vtiger_mail_accounts where user_id=?", array($current_user->id));
$count = $adb->num_rows($qry_res);
if($count > 0)
$field = '<input name="server_password" value="*****" class="detailedViewTextBox" onfocus="this.className=\'detailedViewTextBoxOn\'" onblur="this.className=\'detailedViewTextBox\'" type="password">';//"<input title='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_TITLE']."' accessKey='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_KEY']."' class='crmButton password small' LANGUAGE=javascript onclick='return window.open(\"index.php?module=Users&action=ChangePassword&form=EditView&mail_accounts=true\",\"test\",\"width=320,height=200,resizable=no,scrollbars=0, toolbar=no, titlebar=no, left=200, top=226, screenX=100, screenY=126\");' type='button' name='password' value='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_LABEL']."'>";
else
$field = '<input name="server_password" value="" class="detailedViewTextBox" onfocus="this.className=\'detailedViewTextBoxOn\'" onblur="this.className=\'detailedViewTextBox\'" type="password">';
$smarty->assign('CHANGE_PW_BUTTON',$field);
$return_module = vtlib_purify($_REQUEST['return_module']);
if(empty($return_module)) $return_module = 'Settings';
else $return_module = htmlspecialchars($return_module, ENT_QUOTES, $default_charset);
$return_action = vtlib_purify($_REQUEST['return_action']);
if(empty($return_action)) $return_action = 'index';
else $return_action = htmlspecialchars($return_action, ENT_QUOTES, $default_charset);
$smarty->assign("RETURN_MODULE",$return_module);
$smarty->assign("RETURN_ACTION",$return_action);
$smarty->assign("JAVASCRIPT", get_validate_record_js());
$smarty->assign("USERID", $current_user->id);
$smarty->display('AddMailAccount.tpl');
?>
@@ -0,0 +1,36 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('Smarty_setup.php');
global $adb;
global $current_user;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$query="select * from vtiger_announcement where creatorid=?";
$result=$adb->pquery($query, array($current_user->id));
$announcement=$adb->query_result($result,0,'announcement');
$title_prev=$adb->query_result($result,0,'title');
$id=$adb->query_result($result,0,'creatorid');
$smarty = new vtigerCRM_Smarty;
$smarty->assign("ANNOUNCE",$announcement);
$smarty->assign("MOD", return_module_language($current_language,'Settings'));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("APP", $app_strings);
$smarty->assign("CMOD", $mod_strings);
$smarty->display("Settings/Announcements.tpl");
?>
@@ -0,0 +1,155 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Authenticate.php,v 1.10 2005/02/28 05:25:22 jack Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Users/Users.php');
require_once('modules/Users/CreateUserPrivilegeFile.php');
require_once('include/logging.php');
require_once('user_privileges/audit_trail.php');
global $mod_strings, $default_charset;
$focus = new Users();
// Add in defensive code here.
$focus->column_fields["user_name"] = to_html($_REQUEST['user_name']);
$user_password = vtlib_purify($_REQUEST['user_password']);
$focus->load_user($user_password);
if($focus->is_authenticated())
{
//Inserting entries for audit trail during login
if($audit_trail == 'true')
{
if($record == '')
$auditrecord = '';
else
$auditrecord = $record;
$date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
$query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)";
$params = array($adb->getUniqueID('vtiger_audit_trial'), $focus->id, 'Users','Authenticate','',$date_var);
$adb->pquery($query, $params);
}
// Recording the login info
$usip=$_SERVER['REMOTE_ADDR'];
$intime=date("Y/m/d H:i:s");
require_once('modules/Users/LoginHistory.php');
$loghistory=new LoginHistory();
$Signin = $loghistory->user_login($focus->column_fields["user_name"],$usip,$intime);
//Security related entries start
require_once('include/utils/UserInfoUtil.php');
createUserPrivilegesfile($focus->id);
//Security related entries end
session_unregister('login_password');
session_unregister('login_error');
session_unregister('login_user_name');
$_SESSION['authenticated_user_id'] = $focus->id;
$_SESSION['app_unique_key'] = $application_unique_key;
// store the user's theme in the session
if (isset($_REQUEST['login_theme'])) {
$authenticated_user_theme = vtlib_purify($_REQUEST['login_theme']);
}
elseif (isset($_REQUEST['ck_login_theme'])) {
$authenticated_user_theme = vtlib_purify($_REQUEST['ck_login_theme']);
}
else {
$authenticated_user_theme = $default_theme;
}
// store the user's language in the session
if (isset($_REQUEST['login_language'])) {
$authenticated_user_language = vtlib_purify($_REQUEST['login_language']);
}
elseif (isset($_REQUEST['ck_login_language'])) {
$authenticated_user_language = vtlib_purify($_REQUEST['ck_login_language']);
}
else {
$authenticated_user_language = $default_language;
}
// If this is the default user and the default user theme is set to reset, reset it to the default theme value on each login
if($reset_theme_on_default_user && $focus->user_name == $default_user_name)
{
$authenticated_user_theme = $default_theme;
}
if(isset($reset_language_on_default_user) && $reset_language_on_default_user && $focus->user_name == $default_user_name)
{
$authenticated_user_language = $default_language;
}
$_SESSION['vtiger_authenticated_user_theme'] = $authenticated_user_theme;
$_SESSION['authenticated_user_language'] = $authenticated_user_language;
$log->debug("authenticated_user_theme is $authenticated_user_theme");
$log->debug("authenticated_user_language is $authenticated_user_language");
$log->debug("authenticated_user_id is ". $focus->id);
$log->debug("app_unique_key is $application_unique_key");
// Clear all uploaded import files for this user if it exists
global $import_dir;
$tmp_file_name = $import_dir. "IMPORT_".$focus->id;
if (file_exists($tmp_file_name))
{
unlink($tmp_file_name);
}
$arr = $_SESSION['lastpage'];
if(isset($_SESSION['lastpage']))
header("Location: index.php?".$arr[0]);
else
header("Location: index.php");
}
else
{
$sql = 'select user_name, id, crypt_type from vtiger_users where user_name=?';
$result = $adb->pquery($sql, array($focus->column_fields["user_name"]));
$rowList = $result->GetRows();
foreach ($rowList as $row) {
$cryptType = $row['crypt_type'];
if(strtolower($cryptType) == 'md5' && version_compare(PHP_VERSION, '5.3.0') >= 0) {
header("Location: modules/Migration/PHP5.3_PasswordHelp.php");
die;
}
}
$_SESSION['login_user_name'] = $focus->column_fields["user_name"];
$_SESSION['login_password'] = $user_password;
$_SESSION['login_error'] = $mod_strings['ERR_INVALID_PASSWORD'];
// go back to the login screen.
// create an error message for the user.
header("Location: index.php");
}
?>
@@ -0,0 +1,111 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/ChangePassword.php,v 1.2 2004/10/29 09:55:10 jack Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
// This file is used for all popups on this module
// The popup_picker.html file is used for generating a list from which to find and choose one instance.
global $theme;
require_once('modules/Users/Users.php');
require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/logging.php');
global $app_strings;
global $mod_strings;
$mod_strings['ERR_ENTER_OLD_PASSWORD'];
insert_popup_header($theme);
?>
<script type='text/javascript' src="include/js/general.js"></script>
<script type='text/javascript' language='JavaScript'>
function set_password(form) {
if (form.is_admin.value == 1 && trim(form.old_password.value) == "") {
alert("<?php echo $mod_strings['ERR_ENTER_OLD_PASSWORD']; ?>");
return false;
}
if (trim(form.new_password.value) == "") {
alert("<?php echo $mod_strings['ERR_ENTER_NEW_PASSWORD']; ?>");
return false;
}
if (trim(form.confirm_new_password.value) == "") {
alert("<?php echo $mod_strings['ERR_ENTER_CONFIRMATION_PASSWORD']; ?>");
return false;
}
if (trim(form.new_password.value) == trim(form.confirm_new_password.value)) {
if (form.is_admin.value == 1) window.opener.document.DetailView.old_password.value = form.old_password.value;
window.opener.document.DetailView.new_password.value = form.new_password.value;
window.opener.document.DetailView.return_module.value = 'Users';
window.opener.document.DetailView.return_action.value = 'DetailView';
window.opener.document.DetailView.changepassword.value = 'true';
window.opener.document.DetailView.return_id.value = window.opener.document.DetailView.record.value;
window.opener.document.DetailView.action.value = 'Save';
window.opener.document.DetailView.submit();
return true;
}
else {
alert("<?php echo $mod_strings['ERR_REENTER_PASSWORDS']; ?>");
return false;
}
}
</script>
<form name="ChangePassword" onsubmit="VtigerJS_DialogBox.block();">
<?php echo get_form_header($mod_strings['LBL_CHANGE_PASSWORD'], "", false); ?>
<table width='100%' cellspacing='0' cellpadding='5' border='0' class="small">
<tr>
<td class="detailedViewHeader" colspan="2"><b><?php echo $mod_strings['LBL_CHANGE_PASSWORD']; ?></b></td>
</tr>
<?php if (!is_admin($current_user)) {
echo "<tr>";
echo "<td width='40%' class='dvtCellLabel' align='right'><b> ".$mod_strings['LBL_OLD_PASSWORD']."</b></td>\n";
echo "<td width='60%' class='dvtCellInfo'><input name='old_password' type='password' tabindex='1' size='15'></td>\n";
echo "<input name='is_admin' type='hidden' value='1'>";
echo "</tr><tr>\n";
}
else echo "<input name='old_password' type='hidden'><input name='is_admin' type='hidden' value='0'>";
?>
<td width='40%' class='dvtCellLabel' nowrap align="right"><b><?php echo $mod_strings['LBL_NEW_PASSWORD']; ?></b></td>
<td width='60%' class='dvtCellInfo'><input name='new_password' type='password' tabindex='1' size='15'></td>
</tr><tr>
<td width='40%' class='dvtCellLabel' nowrap align="right"><b><?php echo $mod_strings['LBL_CONFIRM_PASSWORD']; ?></b></td>
<td width='60%' class='dvtCellInfo'><input name='confirm_new_password' type='password' tabindex='1' size='15'></td>
</tr><tr>
<td width='40%' class='dataLabel'></td>
<td width='60%' class='dvtCellInfo'></td>
</td></tr>
</table>
<br>
<table width='100%' cellspacing='0' cellpadding='1' border='0'>
<tr>
<td align='right'><input title='<?php echo $app_strings['LBL_SAVE_BUTTON_TITLE']; ?>' accessKey='<?php echo $app_strings['LBL_SAVE_BUTTON_KEY']; ?>' class='crmbutton small save' LANGUAGE=javascript onclick='if (set_password(this.form)) window.close(); else return false;' type='submit' name='button' value=' <?php echo $app_strings['LBL_SAVE_BUTTON_LABEL']; ?> '></td>
<td align='left'><input title='<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>' accessyKey='<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY']; ?>' class='crmbutton small cancel' LANGUAGE=javascript onclick='window.close()' type='submit' name='button' value=' <?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']; ?> '></td>
</tr>
<script language="JavaScript">
document.ChangePassword.new_password.focus();
</script>
</table>
</form>
<br>
@@ -0,0 +1,68 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/utils.php');
global $mod_strings;
$profilename=vtlib_purify($_REQUEST['profile_name']);
if(isset($_REQUEST['dup_check']) && $_REQUEST['dup_check']!='')
{
$query = 'select profilename from vtiger_profile where profilename=?';
$result = $adb->pquery($query, array($profilename));
if($adb->num_rows($result) > 0)
{
echo $mod_strings['LBL_PROFILENAME_EXIST'];
die;
}else
{
echo 'SUCCESS';
die;
}
}
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
if(isset($_REQUEST['parent_profile']) && $_REQUEST['parent_profile'] != '')
$smarty->assign("PARENT_PROFILE",vtlib_purify($_REQUEST['parent_profile']));
if(isset($_REQUEST['radio_button']) && $_REQUEST['radio_button'] != '')
$smarty->assign("RADIO_BUTTON",vtlib_purify($_REQUEST['radio_button']));
if(isset($_REQUEST['profile_name']) && $_REQUEST['profile_name'] != '')
$smarty->assign("PROFILE_NAME",vtlib_purify($_REQUEST['profile_name']));
if(isset($_REQUEST['profile_description']) && $_REQUEST['profile_description'] != '')
$smarty->assign("PROFILE_DESCRIPTION",vtlib_purify($_REQUEST['profile_description']));
if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != '')
$smarty->assign("MODE",vtlib_purify($_REQUEST['mode']));
$smarty->assign("MOD", return_module_language($current_language,'Settings'));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("APP", $app_strings);
$smarty->assign("CMOD", $mod_strings);
$sql = "select * from vtiger_profile";
$result = $adb->pquery($sql, array());
$profilelist = array();
$temprow = $adb->fetch_array($result);
do
{
$name=$temprow["profilename"];
$profileid=$temprow["profileid"];
$profilelist[] = array($name,$profileid);
}while($temprow = $adb->fetch_array($result));
$smarty->assign("PROFILE_LISTS", $profilelist);
$smarty->display("CreateProfile.tpl");
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
$sql= 'delete from vtiger_salesmanactivityrel where smid=? and activityid = ?';
$adb->pquery($sql, array($_REQUEST['record'], $_REQUEST['return_id']));
if($_REQUEST['return_module'] == 'Calendar')
$mode ='&activity_mode=Events';
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action']).$mode."&record=".vtlib_purify($_REQUEST['return_id'])."&relmodule=".vtlib_purify($_REQUEST['module']));
?>
@@ -0,0 +1,30 @@
<?php
/*+********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/UserInfoUtil.php');
global $adb;
$del_id = $_REQUEST['delete_group_id'];
$transfer_group_id = $_REQUEST['transfer_group_id'];
$assignType = $_REQUEST['assigntype'];
if($assignType == 'T')
{
$transferId = $_REQUEST['transfer_group_id'];
}
elseif($assignType == 'U')
{
$transferId = $_REQUEST['transfer_user_id'];
}
//Updating the user2 vtiger_role vtiger_table
deleteGroup($del_id,$transferId);
header("Location: index.php?action=listgroups&module=Settings&parenttab=Settings");
?>
@@ -0,0 +1,17 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/UserInfoUtil.php');
global $adb;
$del_id = $_REQUEST['delete_prof_id'];
$tran_id = $_REQUEST['transfer_prof_id'];
//Deleting the Profile
deleteProfile($del_id,$tran_id);
header("Location: index.php?module=Settings&action=ListProfiles&parenttab=Settings");
?>
@@ -0,0 +1,18 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
global $adb;
$del_id = $_REQUEST['delete_role_id'];
$tran_id = $_REQUEST['user_role'];
deleteRole($del_id,$tran_id);
header("Location: index.php?action=listroles&module=Settings");
?>
@@ -0,0 +1,16 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/UserInfoUtil.php');
global $adb;
$shareid = $_REQUEST['shareid'];
deleteSharingRule($shareid);
header("Location: index.php?module=Settings&action=OrgSharingDetailView&parenttab=Settings");
?>
@@ -0,0 +1,28 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once 'include/Webservices/Utils.php';
global $adb;
$del_id = $_REQUEST['delete_user_id'];
$tran_id = $_REQUEST['transfer_user_id'];
vtws_transferOwnership($del_id, $tran_id);
//delete from user vtiger_table;
$sql15 = "delete from vtiger_users where id=?";
$adb->pquery($sql15, array($del_id));
//if check to delete user from detail view
if(isset($_REQUEST["ajax_delete"]) && $_REQUEST["ajax_delete"] == 'false')
header("Location: index.php?action=ListView&module=Users");
else
header("Location: index.php?action=UsersAjax&module=Users&file=ListView&ajax=true");
?>
@@ -0,0 +1,236 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/DetailView.php,v 1.21 2005/04/19 14:44:02 ray Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once('data/Tracker.php');
require_once('modules/Users/Users.php');
require_once('include/utils/utils.php');
require_once('include/utils/UserInfoUtil.php');
require_once('include/utils/GetUserGroups.php');
//to check audittrail if enable or not
require_once('user_privileges/audit_trail.php');
global $current_user;
global $theme;
global $default_language;
global $adb;
global $currentModule;
global $app_strings;
global $mod_strings;
$focus = new Users();
if(!empty($_REQUEST['record']))
{
$focus->retrieve_entity_info($_REQUEST['record'],'Users');
$focus->id = $_REQUEST['record'];
}
else
{
echo "
<script type='text/javascript'>
window.location = 'index.php?module=Users&action=ListView';
</script>
";
}
if( $focus->user_name == "" )
{
if(is_admin($current_user))
{
echo "
<table>
<tr>
<td>
<b>User does not exist.</b>
</td>
</tr>";
echo "
<tr>
<td>
<a href='index.php?module=Users&action=ListView'>List Users</a>
</td>
</tr>
</table>
";
exit;
}
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
}
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
//the user might belong to multiple groups
$log->info("User detail view");
$category = getParenttab();
$smarty = new vtigerCRM_Smarty;
$smarty->assign("UMOD", $mod_strings);
global $current_language;
$smod_strings = return_module_language($current_language, 'Settings');
$smarty->assign("MOD", $smod_strings);
$smarty->assign("APP", $app_strings);
$oGetUserGroups = new GetUserGroups();
$oGetUserGroups->getAllUserGroups($focus->id);
if(useInternalMailer() == 1)
$smarty->assign("INT_MAILER","true");
$smarty->assign("GROUP_COUNT",count($oGetUserGroups->user_groups));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$smarty->assign("ID", $focus->id);
$smarty->assign("CATEGORY", $category);
if(isset($focus->imagename) && $focus->imagename!='')
{
$imagestring="<div id='track1' style='margin: 4px 0pt 0pt 10px; width: 200px; background-image: url(themes/images/scaler_slider_track.gif); background-repeat: repeat-x; background-position: left center; height: 18px;'>
<div class='selected' id='handle1' style='width: 18px; height: 18px; position: relative; left: 145px;cursor:pointer;'><img src='" . vtiger_imageurl('scaler_slider.gif', $theme) . "'></div>
</div>
<script language='JavaScript' type='text/javascript' src='include/js/slider.js'></script>
<div class='scale-image' style='padding: 10px; float: left; width: 83.415px;'><img src='test/user/".$focus->imagename."' width='100%'</div>
<p><script type='text/javascript' src='include/js/scale_demo.js'></script></p>";
//$smarty->assign("USER_IMAGE",$imagestring);
}
if(isset($_REQUEST['modechk']) && $_REQUEST['modechk'] != '' )
{
$modepref = $_REQUEST['modechk'];
}
if($_REQUEST['modechk'] == 'prefview')
$parenttab = '';
else
$parenttab = 'Settings';
$smarty->assign("PARENTTAB", $parenttab);
if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id)
&& isset($default_user_name)
&& $default_user_name == $focus->user_name
&& isset($lock_default_user_name)
&& $lock_default_user_name == true ) {
$buttons = "<input title='".$app_strings['LBL_EDIT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_EDIT_BUTTON_KEY']."' class='crmButton small edit' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='$focus->id'; this.form.action.value='EditView';\" type='submit' name='Edit' value=' ".$app_strings['LBL_EDIT_BUTTON_LABEL']." '>";
$smarty->assign('EDIT_BUTTON',$buttons);
}
elseif (is_admin($current_user) || $_REQUEST['record'] == $current_user->id) {
$buttons = "<input title='".$app_strings['LBL_EDIT_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_EDIT_BUTTON_KEY']."' class='crmButton small edit' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.return_id.value='$focus->id'; this.form.action.value='EditView';\" type='submit' name='Edit' value=' ".$app_strings['LBL_EDIT_BUTTON_LABEL']." '>";
$smarty->assign('EDIT_BUTTON',$buttons);
$buttons = "<input title='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_TITLE']."' accessKey='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_KEY']."' class='crmButton password small' LANGUAGE=javascript onclick='return window.open(\"index.php?module=Users&action=ChangePassword&form=DetailView\",\"test\",\"width=320,height=200,resizable=no,scrollbars=0, toolbar=no, titlebar=no, left=200, top=226, screenX=100, screenY=126\");' type='button' name='password' value='".$mod_strings['LBL_CHANGE_PASSWORD_BUTTON_LABEL']."'>";
$smarty->assign('CHANGE_PW_BUTTON',$buttons);
}
if (is_admin($current_user))
{
$buttons = "<input title='".$app_strings['LBL_DUPLICATE_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_DUPLICATE_BUTTON_KEY']."' class='crmButton small cancel' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='DetailView'; this.form.isDuplicate.value=true; this.form.return_id.value='".vtlib_purify($_REQUEST['record'])."';this.form.action.value='EditView'\" type='submit' name='Duplicate' value=' ".$app_strings['LBL_DUPLICATE_BUTTON_LABEL']."' >";
$smarty->assign('DUPLICATE_BUTTON',$buttons);
//done so that only the admin user can see the customize tab button
if($_REQUEST['record'] != $current_user->id)
{
$buttons = "<input title='".$app_strings['LBL_DELETE_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_DELETE_BUTTON_KEY']."' class='classBtn' onclick=\"deleteUser('$focus->id')\" type='button' name='Delete' value=' ".$app_strings['LBL_DELETE_BUTTON_LABEL']." '>";
$smarty->assign('DELETE_BUTTON',$buttons);
}
if($_SESSION['authenticated_user_roleid'] == 'administrator')
{
$buttons = "<input title='".$app_strings['LBL_LISTROLES_BUTTON_TITLE']."' accessKey='".$app_strings['LBL_LISTROLES_BUTTON_KEY']."' class='classBtn' onclick=\"this.form.return_module.value='Users'; this.form.return_action.value='TabCustomise'; this.form.action.value='listroles'; this.form.record.value= '". $current_user->id ."'\" type='submit' name='ListRoles' value=' ".$app_strings['LBL_LISTROLES_BUTTON_LABEL']." '>";
$smarty->assign('LISTROLES_BUTTON',$buttons);
}
}
if(is_admin($current_user))
$smarty->assign("IS_ADMIN", true);
else
$smarty->assign("IS_ADMIN", false);
$lead_tables = Array('vtiger_users','vtiger_user2role');
$tabid = getTabid("Users");
$validationData = getDBValidationData($lead_tables,$tabid);
$data = split_validationdataArray($validationData);
if($current_user->id == $_REQUEST['record'] || is_admin($current_user) == true)
{
$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
$smarty->assign("MODULE", 'Users');
$smarty->assign("CURRENT_USERID", $current_user->id);
$smarty->assign("HOMEORDER",$focus->getHomeStuffOrder($focus->id));
//Added to provide User based Tagcloud
$smarty->assign("TAGCLOUDVIEW",getTagCloudView($focus->id));
$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
$smarty->assign("USERNAME",$focus->last_name.' '.$focus->first_name);
$smarty->assign("HOUR_FORMAT",$focus->hour_format);
$smarty->assign("START_HOUR",$focus->start_hour);
$_SESSION['Users_FORM_TOKEN'] = rand(5, 2000) * rand(2, 7);
$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']);
//for check audittrail if it is enable or not
$smarty->assign("AUDITTRAIL",$audit_trail);
$smarty->display("UserDetailView.tpl");
}
else
{
$output = '<table border="0" cellpadding="5" cellspacing="0" height="450" width="100%">
<tr><td align = "center">
<div style="border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;">
<table border="0" cellpadding="5" cellspacing="0" width="98%">
<tr>
<td rowspan="2" width="11%">
<img src="'. vtiger_imageurl('denied.gif', $theme).'">
</td>
<td style="border-bottom: 1px solid rgb(204, 204, 204);" nowrap="nowrap" width="70%">
<span class="genHeaderSmall">'.$app_strings["LBL_PERMISSION"].'
</span>
</td>
</tr>
<tr>
<td class="small" align="right" nowrap="nowrap">
<a href="javascript:window.history.back();">'.$app_strings["LBL_GO_BACK"].'</a>
<br>
</td>
</tr>
</table>
</div>
</td></tr>
</table>';
echo $output;
}
?>
@@ -0,0 +1,68 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/logging.php');
require_once('modules/Users/Users.php');
require_once('include/database/PearDatabase.php');
global $adb ,$mod_strings ;
$local_log =& LoggerManager::getLogger('UsersAjax');
$ajaxaction = $_REQUEST["ajxaction"];
if($ajaxaction == "DETAILVIEW")
{
if(empty($_SESSION['Users_FORM_TOKEN']) || $_SESSION['Users_FORM_TOKEN']
!== (int)$_REQUEST['form_token']) {
echo ":#:ERR".($app_strings['LBL_PERMISSION']);
die;
}
$userid = $_REQUEST["recordid"];
$tablename = $_REQUEST["tableName"];
$fieldname = $_REQUEST["fldName"];
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
if($userid != "")
{
$userObj = new Users();
$userObj->retrieve_entity_info($userid,"Users");
$userObj->column_fields[$fieldname] = $fieldvalue;
if($fieldname=='asterisk_extension'){
$query = "select 1 from vtiger_asteriskextensions
inner join vtiger_users on vtiger_users.id=vtiger_asteriskextensions.userid
where status='Active' and asterisk_extension =?";
$params = array($fieldvalue);
$result = $adb->pquery($query, $params);
if($adb->num_rows($result) > 0)
{
echo ":#:ERR".$mod_strings['LBL_ASTERISKEXTENSIONS_EXIST'];
return false;
}
}
if($fieldname == 'internal_mailer'){
if(isset($_SESSION['internal_mailer']) && $_SESSION['internal_mailer'] != $userObj->column_fields['internal_mailer'])
$_SESSION['internal_mailer'] = $userObj->column_fields['internal_mailer'];
}
$userObj->id = $userid;
$userObj->mode = "edit";
$userObj->save("Users");
if($userObj->id != "")
{
echo ":#:SUCCESS";
}else
{
echo ":#:FAILURE";
}
}else
{
echo ":#:FAILURE";
}
}
?>
+127
View File
@@ -0,0 +1,127 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/EditView.php,v 1.16 2005/04/19 14:44:02 ray Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('Smarty_setup.php');
require_once('data/Tracker.php');
require_once('modules/Users/Users.php');
require_once('include/utils/UserInfoUtil.php');
require_once('modules/Users/Forms.php');
require_once('include/database/PearDatabase.php');
require_once('modules/Calendar/OpenListView.php');
require_once('modules/Leads/ListViewTop.php');
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $currentModule,$default_charset;
$smarty=new vtigerCRM_Smarty;
$focus = new Users();
if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
$smarty->assign("ID",vtlib_purify($_REQUEST['record']));
$mode='edit';
if (!is_admin($current_user) && $_REQUEST['record'] != $current_user->id) die ("Unauthorized access to user administration.");
$focus->retrieve_entity_info($_REQUEST['record'],'Users');
$smarty->assign("USERNAME",$focus->last_name.' '.$focus->first_name);
}else
{
$mode='create';
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$focus->id = "";
$focus->user_name = "";
$mode='create';
//When duplicating the user the password fields should be empty
$focus->column_fields['user_password']='';
$focus->column_fields['confirm_password']='';
}
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$log->info("User edit view");
$smarty->assign("JAVASCRIPT", get_validate_record_js());
$smarty->assign("UMOD", $mod_strings);
global $current_language;
$smod_strings = return_module_language($current_language,'Settings');
$smarty->assign("MOD", $smod_strings);
$smarty->assign("CURRENT_USERID", $current_user->id);
$smarty->assign("APP", $app_strings);
if (isset($_REQUEST['error_string'])) $smarty->assign("ERROR_STRING", "<font class='error'>Error: ".vtlib_purify($_REQUEST['error_string'])."</font>");
if (isset($_REQUEST['return_module']))
{
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
$RETURN_MODULE=vtlib_purify($_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action']))
{
$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
$RETURN_ACTION = vtlib_purify($_REQUEST['return_action']);
}
if ($_REQUEST['isDuplicate'] != 'true' && isset($_REQUEST['return_id']))
{
$smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
$RETURN_ID = vtlib_purify($_REQUEST['return_id']);
}
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$focus->mode = $mode;
$disp_view = getView($focus->mode);
$smarty->assign("IMAGENAME",$focus->imagename);
$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
$smarty->assign("MODULE", 'Settings');
$smarty->assign("MODE",$focus->mode);
$smarty->assign("HOUR_FORMAT",$focus->hour_format);
$smarty->assign("START_HOUR",$focus->start_hour);
if ($_REQUEST['Edit'] == ' Edit ')
{
$smarty->assign("READONLY", "readonly");
$smarty->assign("USERNAME_READONLY", "readonly");
}
if(isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] != 'true')
{
$smarty->assign("USERNAME_READONLY", "readonly");
}
$smarty->assign("HOMEORDER",$focus->getHomeStuffOrder($focus->id));
//Added to provide User based Tagcloud
if($mode == 'create') $smarty->assign("TAGCLOUDVIEW","true"); // While creating user select tag cloud by default
else $smarty->assign("TAGCLOUDVIEW",getTagCloudView($focus->id));
$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
$smarty->assign("USER_MODE",$mode);
$smarty->assign('PARENTTAB', getParentTab());
$_SESSION['Users_FORM_TOKEN'] = rand(5, 2000) * rand(2, 7);
$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']);
$smarty->display('UserEditView.tpl');
?>
+26
View File
@@ -0,0 +1,26 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Error.php,v 1.1 2004/08/17 15:06:40 gjayakrishnan Exp $
* Description: TODO: To be written.
********************************************************************************/
global $app_strings;
?>
<br><br>
<font class='error'><?php if (isset($_REQUEST['error_string'])) echo vtlib_purify($_REQUEST['error_string']); ?>
<br><br>
<?php echo $app_strings['NTC_CLICK_BACK']; ?>
</font>
+227
View File
@@ -0,0 +1,227 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Forms.php,v 1.3 2004/11/08 13:48:29 jack Exp $
* Description: Contains a variety of utility functions used to display UI
* components such as form vtiger_headers and footers. Intended to be modified on a per
* theme basis.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/Zend/Json.php');
/**
* this function checks if the asterisk server details are set in the database or not
* returns string "true" on success :: "false" on failure
*/
function checkAsteriskDetails(){
global $adb,$current_user;
$sql = "select * from vtiger_asterisk";
$result = $adb->query($sql);
$count = $adb->num_rows($result);
if($count > 0){
return "true";
}else{
return "false";
}
}
/**
* this function gets the asterisk extensions assigned in vtiger
*/
function getAsteriskExtensions(){
global $adb, $current_user;
$sql = "SELECT * FROM vtiger_asteriskextensions
INNER JOIN vtiger_users ON vtiger_users.id = vtiger_asteriskextensions.userid
AND vtiger_users.deleted=0 AND status = 'Active'";
$result = $adb->pquery($sql, array());
$count = $adb->num_rows($result);
$data = array();
for($i=0;$i<$count;$i++){
$user = $adb->query_result($result, $i, "userid");
$extension = $adb->query_result($result, $i, "asterisk_extension");
if(!empty($extension)){
$data[$user] = $extension;
}
}
return $data;
}
/**
* Create javascript to validate the data entered into a record.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
*/
function get_validate_record_js () {
global $mod_strings;
global $app_strings, $current_user;
$lbl_last_name = $mod_strings['LBL_LIST_LAST_NAME'];
$lbl_user_name = $mod_strings['LBL_LIST_USER_NAME'];
$lbl_role_name = $mod_strings['LBL_ROLE_NAME'];
$lbl_new_password = $mod_strings['LBL_LIST_PASSWORD'];
$lbl_confirm_new_password = $mod_strings['LBL_LIST_CONFIRM_PASSWORD'];
$lbl_user_email1 = $mod_strings['LBL_LIST_EMAIL'];
$err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS'];
$err_invalid_email_address = $app_strings['ERR_INVALID_EMAIL_ADDRESS'];
$err_invalid_yahoo_email_address = $app_strings['ERR_INVALID_YAHOO_EMAIL_ADDRESS'];
$lbl_user_image=$mod_strings['User Image'];
$the_emailid = $app_strings['THE_EMAILID'];
$email_field_is = $app_strings['EMAIL_FILED_IS'].$err_invalid_email_address;
$other_email_field_is = $app_strings['OTHER_EMAIL_FILED_IS'].$err_invalid_email_address;
$yahoo_email_field_is = $app_strings['YAHOO_EMAIL_FILED_IS'].$err_invalid_yahoo_email_address;
$lbl_asterisk_details_not_set = $app_strings['LBL_ASTERISK_SET_ERROR'];
//check asteriskdetails start
$checkAsteriskDetails = checkAsteriskDetails();
// Fix : 6362
$record = ($_REQUEST['record'])?$_REQUEST['record']:'false';// used to check the asterisk extension in edit mode
$mode = ($_REQUEST['isDuplicate'] == 'true')?'true':'false';
$extensions = getAsteriskExtensions();
$extensions_list = Zend_Json::encode($extensions);
//check asteriskdetails end
$the_script = <<<EOQ
<script language="JavaScript" type="text/javascript" src="include/js/json.js"></script>
<script type="text/javascript" language="Javascript">
<!-- to hide script contents from old browsers
function set_fieldfocus(errorMessage,oMiss_field){
alert("$err_missing_required_fields" + errorMessage);
oMiss_field.focus();
}
function verify_data(form) {
var isError = false;
var errorMessage = "";
//check if asterisk server details are set or not
if(trim(form.asterisk_extension.value)!="" && "$checkAsteriskDetails" == "false"){
errorMessage = "$lbl_asterisk_details_not_set";
alert(errorMessage);
return false;
}
var extensions = $extensions_list;
if(form.asterisk_extension.value != "") {
for(var userid in extensions){
if(trim(form.asterisk_extension.value) == extensions[userid]) {
if(userid == $record && $mode == false) {
} else {
alert("This extension has already been configured for another user. Please use another extension.");
return false;
}
}
}
}
//asterisk check ends
if (trim(form.email1.value) == "") {
isError = true;
errorMessage += "\\n$lbl_user_email1";
oField_miss = form.email1;
}
if (trim(form.role_name.value) == "") {
isError = true;
errorMessage += "\\n$lbl_role_name";
oField_miss =form.role_name;
}
if (trim(form.last_name.value) == "") {
isError = true;
errorMessage += "\\n$lbl_last_name";
oField_miss =form.last_name;
}
if(form.mode.value !='edit')
{
if (trim(form.user_password.value) == "") {
isError = true;
errorMessage += "\\n$lbl_new_password";
oField_miss =form.user_password;
}
if (trim(form.confirm_password.value) == "") {
isError = true;
errorMessage += "\\n$lbl_confirm_new_password";
oField_miss =form.confirm_password;
}
}
if (trim(form.user_name.value) == "") {
isError = true;
errorMessage += "\\n$lbl_user_name";
oField_miss =form.user_name;
}
if (isError == true) {
set_fieldfocus(errorMessage,oField_miss);
return false;
}
form.email1.value = trim(form.email1.value);
if (form.email1.value != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email1.value)) {
alert("$the_emailid"+form.email1.value+"$email_field_is");
form.email1.focus();
return false;
}
form.email2.value = trim(form.email2.value);
if (form.email2.value != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.email2.value)) {
alert("$the_emailid"+form.email2.value+"$other_email_field_is");
form.email2.focus();
return false;
}
form.yahoo_id.value = trim(form.yahoo_id.value);
if (form.yahoo_id.value != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(form.yahoo_id.value) || (trim(form.yahoo_id.value) != "" && !(form.yahoo_id.value.indexOf('yahoo') > -1))) {
alert("$the_emailid"+form.yahoo_id.value+"$yahoo_email_field_is");
form.yahoo_id.focus();
return false;
}
if(! upload_filter("imagename", "jpg|gif|bmp|png|JPG|GIF|BMP|PNG") )
{
form.imagename.focus();
return false;
}
if(form.mode.value != 'edit')
{
if(trim(form.user_password.value) != trim(form.confirm_password.value))
{
set_fieldfocus("The password does't match",form.user_password);
return false;
}
check_duplicate();
}else
{
// $('user_status').disabled = false;
VtigerJS_DialogBox.block();
form.submit();
}
}
// end hiding contents from old browsers -->
</script>
EOQ;
return $the_script;
}
?>
@@ -0,0 +1,119 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/utils.php');
global $app_strings;
global $mod_strings;
global $theme,$default_charset;
$theme_path="themes/".$theme."/";
$delete_group_id = vtlib_purify($_REQUEST['groupid']);
$delete_group_name = fetchGroupName($delete_group_id);
$output='';
$output ='<div id="DeleteLay" class="layerPopup" style="width:400px;">
<form name="deleteGroupForm" action="index.php" onsubmit="VtigerJS_DialogBox.block();">
<input type="hidden" name="module" value="Users">
<input type="hidden" name="action" value="DeleteGroup">
<input type="hidden" name="delete_group_id" value="'.$delete_group_id.'">
<table border=0 cellspacing=0 cellpadding=5 width=100% class=layerHeadingULine>
<tr>
<td class=layerPopupHeading " align="left">'.$mod_strings['LBL_DELETE_GROUP'].'</td>
<td align="right" class="small"><img src="'. vtiger_imageurl('close.gif', $theme) .'" border=0 alt="'.$app_strings["LBL_CLOSE"].'" title="'.$app_strings["LBL_CLOSE"].'" style="cursor:pointer" onClick="document.getElementById(\'DeleteLay\').style.display=\'none\'";></td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
<tr>
<td class="small">
<table border=0 celspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
<tr>
<td width="50%" class="cellLabel small"><b>'.$mod_strings['LBL_DELETE_GROUPNAME'].'</b></td>
<td width="50%" class="cellText small"><b>'.htmlentities($delete_group_name,ENT_QUOTES,$default_charset).'</b></td>
</tr>
<tr>
<td align="left" class="cellLabel small" nowrap><b>'.$mod_strings['LBL_TRANSFER_GROUP'].'</b></td>
<td align="left" class="cellText small">';
global $adb;
$sql = "select groupid,groupname from vtiger_groups";
$result = $adb->pquery($sql, array());
$num_groups = $adb->num_rows($result);
$sql1 = "select id,user_name from vtiger_users where deleted=0";
$result1= $adb->pquery($sql1, array());
$num_users = $adb->num_rows($result1);
$output.= '<input name="assigntype" checked value="U" onclick="toggleAssignType(this.value)" type="radio">&nbsp;User';
if($num_groups > 1)
{
$output .= '<input name="assigntype" value="T" onclick="toggleAssignType(this.value)" type="radio">&nbsp;Group';
}
$output .= '<span id="assign_user" style="display: block;">';
$output .= '<select class="select" name="transfer_user_id">';
for($i=0;$i<$num_users;$i++)
{
$user_name=$adb->query_result($result1,$i,"user_name");
$user_id=$adb->query_result($result1,$i,"id");
if(strlen($user_name)>20)
{
$user_name=substr($user_name,0,20)."...";
}
$output.='<option value="'.$user_id.'">'.$user_name.'</option>';
}
$output .='</select></span>';
if($num_groups > 1)
{
$output .= '<span id="assign_team" style="display: none;">';
$output.='<select class="select" name="transfer_group_id">';
$temprow = $adb->fetch_array($result);
do
{
$group_name= htmlentities($temprow["groupname"],ENT_QUOTES,$default_charset);
$group_id=$temprow["groupid"];
if($delete_group_id != $group_id)
{
if(strlen($group_name)>20)
{
$group_name=substr($group_name,0,20)."...";
}
$output.='<option value="'.$group_id.'">'.$group_name.'</option>';
}
}while($temprow = $adb->fetch_array($result));
$output.='</select></span>';
}
$output.='</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerPopupTransport">
<tr>
<td class="small" align="center"><input type="submit" name="Delete" value="'.$app_strings["LBL_SAVE_BUTTON_LABEL"].'" class="crmbutton small save">
</td>
</tr>
</table>
</form></div>';
echo $output;
?>
+125
View File
@@ -0,0 +1,125 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/utils.php');
require_once('Smarty_setup.php');
global $app_strings;
global $list_max_entries_per_page;
global $currentModule, $current_user;
if($current_user->is_admin != 'on')
{
die("<br><br><center>".$app_strings['LBL_PERMISSION']." <a href='javascript:window.history.back()'>".$app_strings['LBL_GO_BACK'].".</a></center>");
}
$log = LoggerManager::getLogger('user_list');
global $mod_strings,$adb;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
global $current_language;
$mod_strings = return_module_language($current_language,'Users');
$category = getParentTab();
$focus = new Users();
$no_of_users=UserCount();
//Display the mail send status
$smarty = new vtigerCRM_Smarty;
if($_REQUEST['mail_error'] != '')
{
require_once("modules/Emails/mail.php");
$error_msg = strip_tags(parseEmailErrorString($_REQUEST['mail_error']));
$error_msg = $app_strings['LBL_MAIL_NOT_SENT_TO_USER']. ' ' . vtlib_purify($_REQUEST['user']). '. ' .$app_strings['LBL_PLS_CHECK_EMAIL_N_SERVER'];
$smarty->assign("ERROR_MSG",$mod_strings['LBL_MAIL_SEND_STATUS'].' <b><font class="warning">'.$error_msg.'</font></b>');
}
$list_query = getListQuery("Users");
//Postgres 8 fixes
if( $adb->dbType == "pgsql")
$list_query = fixPostgresQuery($list_query, $log, 0);
$userid = array();
$userid_Query = "SELECT id,user_name FROM vtiger_users WHERE user_name IN ('admin')";
$users = $adb->pquery($userid_Query,array());
$norows = $adb->num_rows($users);
if($norows > 0){
for($i=0;$i<$norows ;$i++){
$id = $adb->query_result($users,$i,'id');
$userid[$id] = $adb->query_result($users,$i,'user_name');
}
}
$smarty->assign("USERNODELETE",$userid);
if(!$_SESSION['lvs'][$currentModule]) {
unset($_SESSION['lvs']);
$modObj = new ListViewSession();
$modObj->sorder = $sorder;
$modObj->sortby = $order_by;
$_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
}
if($_REQUEST['sorder'] !='')
$sorder = $adb->sql_escape_string($_REQUEST['sorder']);
else
$sorder = $focus->getSortOrder();
$_SESSION['USERS_SORT_ORDER'] = $sorder;
if($_REQUEST['order_by'] != '')
$order_by = $adb->sql_escape_string($_REQUEST['order_by']);
else
$order_by = $focus->getOrderBy();
$_SESSION['USERS_ORDER_BY'] = $order_by;
if(!empty($order_by)){
$list_query .= ' ORDER BY '.$order_by.' '.$sorder;
}
if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
$count_result = $adb->query( mkCountQuery($list_query));
$noofrows = $adb->query_result($count_result,0,"count");
}else{
$noofrows = null;
}
$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, '', $queryMode);
$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows);
$limit_start_rec = ($start-1) * $list_max_entries_per_page;
if( $adb->dbType == "pgsql")
$list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
else
$list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows);
$smarty->assign('recordListRange',$recordListRangeMsg);
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Users","index",'');
$smarty->assign("MOD", return_module_language($current_language,'Settings'));
$smarty->assign("CMOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("CURRENT_USERID", $current_user->id);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("CATEGORY",$category);
$smarty->assign("LIST_HEADER",getListViewHeader($focus,"Users",$url_string,$sorder,$order_by,"",""));
$smarty->assign("LIST_ENTRIES",getListViewEntries($focus,"Users",$list_result,$navigation_array,"","","EditView","Delete",""));
$smarty->assign("PAGE_START_RECORD",$limit_start_rec);
$smarty->assign("RECORD_COUNTS", $record_string);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("USER_IMAGES",getUserImageNames());
if($_REQUEST['ajax'] !='')
$smarty->display("UserListViewContents.tpl");
else
$smarty->display("UserListView.tpl");
?>
@@ -0,0 +1,11 @@
<?php
/*+*******************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
require_once 'include/ListView/ListViewPagging.php';
?>
+197
View File
@@ -0,0 +1,197 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Login.php,v 1.6 2005/01/08 13:15:03 jack Exp $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$theme_path="themes/".$theme."/";
$image_path="include/images/";
global $app_language;
//we don't want the parent module's string file, but rather the string file specifc to this subpanel
global $current_language;
$current_module_strings = return_module_language($current_language, 'Users');
define("IN_LOGIN", true);
include_once('vtlib/Vtiger/Language.php');
// Retrieve username and password from the session if possible.
if(isset($_SESSION["login_user_name"]))
{
if (isset($_REQUEST['default_user_name']))
$login_user_name = vtlib_purify($_REQUEST['default_user_name']);
else
$login_user_name = vtlib_purify($_SESSION['login_user_name']);
}
else
{
if (isset($_REQUEST['default_user_name']))
{
$login_user_name = vtlib_purify($_REQUEST['default_user_name']);
}
elseif (isset($_REQUEST['ck_login_id_vtiger'])) {
$login_user_name = get_assigned_user_name($_REQUEST['ck_login_id_vtiger']);
}
else
{
$login_user_name = $default_user_name;
}
$_session['login_user_name'] = $login_user_name;
}
$current_module_strings['VLD_ERROR'] = base64_decode('UGxlYXNlIHJlcGxhY2UgdGhlIFN1Z2FyQ1JNIGxvZ29zLg==');
// Retrieve username and password from the session if possible.
if(isset($_SESSION["login_password"]))
{
$login_password = $_SESSION['login_password'];
}
else
{
$login_password = $default_password;
$_session['login_password'] = $login_password;
}
if(isset($_SESSION["login_error"]))
{
$login_error = $_SESSION['login_error'];
}
?>
<!--Added to display the footer in the login page by Dina-->
<style type="text/css">@import url("themes/<?php echo $theme; ?>/style.css");</style>
<script type="text/javascript" language="JavaScript">
<!-- Begin -->
function set_focus() {
if (document.DetailView.user_name.value != '') {
document.DetailView.user_password.focus();
document.DetailView.user_password.select();
}
else document.DetailView.user_name.focus();
}
<!-- End -->
</script>
<br><br>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="700">
<tr>
<td align="right"><img src="themes/images/honestCRMTop.gif"></td>
</tr>
</table>
<!-- key to check session_out in Ajax key=s18i14i22a19 -->
<!-- Login Starts -->
<table border="0" cellspacing="0" cellpadding="0" width=700>
<tr>
<td class="bg" width="50%"><img src="themes/images/vtigerName.gif" alt="vtiger CRM" title="vtiger CRM"></td>
<td class="bg" align="right" width="50%"><img src="themes/images/honestCRM.gif" alt="The honest Open Source CRM" title="The honest Open Source CRM"></td>
</tr>
<tr>
<td class="small z1" align="center">
<img src="themes/images/bullets.gif">
</td>
<td class="small z2" align="center">
<?php
if (isset($_REQUEST['ck_login_language_vtiger'])) {
$display_language = vtlib_purify($_REQUEST['ck_login_language_vtiger']);
}
else {
$display_language = $default_language;
}
if (isset($_REQUEST['ck_login_theme_vtiger'])) {
$display_theme = vtlib_purify($_REQUEST['ck_login_theme_vtiger']);
}
else {
$display_theme = $default_theme;
}
?>
<!-- Sign in form -->
<br>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="Users">
<input type="hidden" name="action" value="Authenticate">
<input type="hidden" name="return_module" value="Users">
<input type="hidden" name="return_action" value="Login">
<table border="0" cellpadding="0" cellspacing="0" width="80%">
<tr>
<td class="signinHdr"><img src="themes/images/signin.gif" alt="<?php echo $app_strings['LBL_SIGN_IN']?>" title="<?php echo $app_strings['LBL_SIGN_IN']?>"></td>
</tr>
<tr>
<td class="small">
<!-- form elements -->
<br>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td class="small" align="right" width="30%"><?php echo $current_module_strings['LBL_USER_NAME'] ?></td>
<td class="small" align="left" width="70%"><input class="small" type="text" name="user_name" value="<?php echo $login_user_name ?>" tabindex="1"></td>
</tr>
<tr>
<td class="small" align="right" width="30%"><?php echo $current_module_strings['LBL_PASSWORD'] ?></td>
<td class="small" align="left" width="70%"><input class="small" type="password" size='20' name="user_password" value="<?php echo $login_password ?>" tabindex="2"></td>
</tr>
<tr bgcolor="#f5f5f5">
<td class="small" align="right" width="30%"><?php echo $current_module_strings['LBL_THEME'] ?></td>
<td class="small" align="left" width="70%"><select class="small" name='login_theme' style="width:70%" tabindex="3">
<?php echo get_select_options_with_id(get_themes(), $display_theme) ?>
</select></td>
</tr>
<tr bgcolor="#f5f5f5">
<td class="small" align="right" width="30%"><?php echo $current_module_strings['LBL_LANGUAGE'] ?></td>
<td class="small" align="left" width="70%"><select class="small" name='login_language' style="width:70%" tabindex="4">
<!-- vtlib Customization -->
<? /* php echo get_select_options_with_id(get_languages(), $display_language) */ ?>
<?php echo get_select_options_with_id(Vtiger_Language::getAll(), $display_language) ?>
</select></td>
</tr>
<?php
if( isset($_SESSION['validation'])){
?>
<tr>
<td colspan="2"><font color="Red"> <?php echo $current_module_strings['VLD_ERROR']; ?> </font></td>
</tr>
<?php
}
else if(isset($login_error) && $login_error != "")
{
?>
<tr>
<td colspan="2"><b class="small"><font color="Brown">
<?php echo $login_error ?>
</font></b></td>
</tr>
<?php
}
?>
<tr>
<td class="small">&nbsp;</td>
<td class="small"><input title="<?php echo $current_module_strings['LBL_LOGIN_BUTTON_TITLE'] ?>" alt="<?php echo $current_module_strings['LBL_LOGIN_BUTTON_TITLE'] ?>" accesskey="<?php echo $current_module_strings['LBL_LOGIN_BUTTON_TITLE'] ?>" src="themes/images/btnSignInNEW.gif" type="image" name="Login" value=" <?php echo $current_module_strings['LBL_LOGIN_BUTTON_LABEL'] ?> " tabindex="5"></td>
</tr>
</table>
<br><br>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
@@ -0,0 +1,211 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
include_once('config.php');
require_once('include/logging.php');
require_once('data/SugarBean.php');
require_once('include/logging.php');
require_once('include/ListView/ListView.php');
require_once('include/database/PearDatabase.php');
/** This class is used to store and display the login history of all the Users.
* An Admin User can view his login history details and of all the other users as well.
* StandardUser is allowed to view only his login history details.
**/
class LoginHistory {
var $log;
var $db;
// Stored vtiger_fields
var $login_id;
var $user_name;
var $user_ip;
var $login_time;
var $logout_time;
var $status;
var $module_name = "Users";
var $table_name = "vtiger_loginhistory";
var $object_name = "LoginHistory";
var $new_schema = true;
var $column_fields = Array("id"
,"login_id"
,"user_name"
,"user_ip"
,"login_time"
,"logout_time"
,"status"
);
function LoginHistory() {
$this->log = LoggerManager::getLogger('loginhistory');
$this->db = PearDatabase::getInstance();
}
var $sortby_fields = Array('user_name', 'user_ip', 'login_time', 'logout_time', 'status');
// This is the list of vtiger_fields that are in the lists.
var $list_fields = Array(
'User Name'=>Array('vtiger_loginhistory'=>'user_name'),
'User IP'=>Array('vtiger_loginhistory'=>'user_ip'),
'Signin Time'=>Array('vtiger_loginhistory'=>'login_time'),
'Signout Time'=>Array('vtiger_loginhistory'=>'logout_time'),
'Status'=>Array('vtiger_loginhistory'=>'status'),
);
var $list_fields_name = Array(
'User Name'=>'user_name',
'User IP'=>'user_ip',
'Signin Time'=>'login_time',
'Signout Time'=>'logout_time',
'Status'=>'status'
);
var $default_order_by = "login_time";
var $default_sort_order = 'DESC';
/**
* Function to get the Header values of Login History.
* Returns Header Values like UserName, IP, LoginTime etc in an array format.
**/
function getHistoryListViewHeader()
{
global $log;
$log->debug("Entering getHistoryListViewHeader method ...");
global $app_strings;
$header_array = array($app_strings['LBL_LIST_USER_NAME'], $app_strings['LBL_LIST_USERIP'], $app_strings['LBL_LIST_SIGNIN'], $app_strings['LBL_LIST_SIGNOUT'], $app_strings['LBL_LIST_STATUS']);
$log->debug("Exiting getHistoryListViewHeader method ...");
return $header_array;
}
/**
* Function to get the Login History values of the User.
* @param $navigation_array - Array values to navigate through the number of entries.
* @param $sortorder - DESC
* @param $orderby - login_time
* Returns the login history entries in an array format.
**/
function getHistoryListViewEntries($username, $navigation_array, $sorder='', $orderby='')
{
global $log;
$log->debug("Entering getHistoryListViewEntries() method ...");
global $adb, $current_user;
if($sorder != '' && $order_by != '')
$list_query = "Select * from vtiger_loginhistory where user_name=? order by ".$order_by." ".$sorder;
else
$list_query = "Select * from vtiger_loginhistory where user_name=? order by ".$this->default_order_by." ".$this->default_sort_order;
$result = $adb->pquery($list_query, array($username));
$entries_list = array();
if($navigation_array['end_val'] != 0)
{
for($i = $navigation_array['start']; $i <= $navigation_array['end_val']; $i++)
{
$entries = array();
$loginid = $adb->query_result($result, $i-1, 'login_id');
$entries[] = $adb->query_result($result, $i-1, 'user_name');
$entries[] = $adb->query_result($result, $i-1, 'user_ip');
$entries[] = $adb->query_result($result, $i-1, 'login_time');
$entries[] = $adb->query_result($result, $i-1, 'logout_time');
$entries[] = $adb->query_result($result, $i-1, 'status');
$entries_list[] = $entries;
}
$log->debug("Exiting getHistoryListViewEntries() method ...");
return $entries_list;
}
}
/** Function that Records the Login info of the User
* @param ref variable $usname :: Type varchar
* @param ref variable $usip :: Type varchar
* @param ref variable $intime :: Type timestamp
* Returns the query result which contains the details of User Login Info
*/
function user_login(&$usname,&$usip,&$intime)
{
global $adb;
//Kiran: Setting logout time to '0000-00-00 00:00:00' instead of null
$query = "Insert into vtiger_loginhistory (user_name, user_ip, logout_time, login_time, status) values (?,?,?,?,?)";
$params = array($usname,$usip,'0000-00-00 00:00:00', $this->db->formatDate($intime, true),'Signed in');
$result = $adb->pquery($query, $params)
or die("MySQL error: ".mysql_error());
return $result;
}
/** Function that Records the Logout info of the User
* @param ref variable $usname :: Type varchar
* @param ref variable $usip :: Type varchar
* @param ref variable $outime :: Type timestamp
* Returns the query result which contains the details of User Logout Info
*/
function user_logout(&$usname,&$usip,&$outtime)
{
global $adb;
$logid_qry = "SELECT max(login_id) AS login_id from vtiger_loginhistory where user_name=? and user_ip=?";
$result = $adb->pquery($logid_qry, array($usname, $usip));
$loginid = $adb->query_result($result,0,"login_id");
if ($loginid == '')
{
return;
}
// update the user login info.
$query = "Update vtiger_loginhistory set logout_time =?, status=? where login_id = ?";
$result = $adb->pquery($query, array($this->db->formatDate($outtime, true), 'Signed off', $loginid))
or die("MySQL error: ".mysql_error());
}
/** Function to create list query
* @param reference variable - order by is passed when the query is executed
* @param reference variable - where condition is passed when the query is executed
* Returns Query.
*/
function create_list_query(&$order_by, &$where)
{
// Determine if the vtiger_account name is present in the where clause.
global $current_user, $adb;
$query = "SELECT user_name,user_ip, status,
".$this->db->getDBDateString("login_time")." AS login_time,
".$this->db->getDBDateString("logout_time")." AS logout_time
FROM ".$this->table_name;
if($where != "")
{
if(!is_admin($current_user))
$where .=" AND user_name = '". $adb->sql_escape_string($current_user->user_name) ."'";
$query .= " WHERE ($where)";
}
else
{
if(!is_admin($current_user))
$query .= " WHERE user_name = '". $adb->sql_escape_string($current_user->user_name) ."'";
}
if(!empty($order_by))
$query .= " ORDER BY ". $adb->sql_escape_string($order_by);
return $query;
}
}
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Users/Logout.php,v 1.8 2005/03/21 04:51:21 ray Exp $
* Description: TODO: To be written.
********************************************************************************/
require_once('include/logging.php');
require_once('database/DatabaseConnection.php');
require_once('modules/Users/LoginHistory.php');
require_once('modules/Users/Users.php');
require_once('config.php');
require_once('include/db_backup/backup.php');
require_once('include/db_backup/ftp.php');
require_once('include/database/PearDatabase.php');
require_once('user_privileges/enable_backup.php');
require_once 'modules/VtigerBackup/VtigerBackup.php';
global $adb, $enable_backup,$current_user;
if(is_admin($current_user) == true && PerformancePrefs::getBoolean('LOGOUT_BACKUP', true)) {
$backup = new VtigerBackup();
$backup->backup();
}
// Recording Logout Info
$usip=$_SERVER['REMOTE_ADDR'];
$outtime=date("Y/m/d H:i:s");
$loghistory=new LoginHistory();
$loghistory->user_logout($current_user->user_name,$usip,$outtime);
$local_log =& LoggerManager::getLogger('Logout');
// clear out the autthenticating flag
session_destroy();
define("IN_LOGIN", true);
// go to the login screen.
header("Location: index.php?action=Login&module=Users");
?>
@@ -0,0 +1,73 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/utils/utils.php');
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
$smarty = new vtigerCRM_Smarty;
$defSharingPermissionData = getDefaultSharingEditAction();
$row=1;
$entries = Array();
foreach($defSharingPermissionData as $tab_id => $def_perr)
{
$entity_name = getTabname($tab_id);
if($tab_id == 6)
{
$cont_name = getTabname(4);
$entity_name .= ' & '.$cont_name;
}
$defActionArr=getModuleSharingActionArray($tab_id);
$entries[] = $entity_name;
if($tab_id != 6)
{
$output = '<select class="detailedViewTextBox" id="'.$tab_id.'_perm_combo" name="'.$tab_id.'_per">';
}
else
{
$output = '<select class="detailedViewTextBox" id="'.$tab_id.'_perm_combo" name="'.$tab_id.'_per" onchange="checkAccessPermission(this.value)">';
}
$entries[] = $tab_id;
foreach($defActionArr as $shareActId=>$shareActName)
{
$selected='';
if($shareActId == $def_perr)
{
$selected='selected';
}
$output .= '<option value="'.$shareActId.'" '.$selected. '>'.$mod_strings[$shareActName].'</option>';
}
$output .= '</select>';
$entries[] = $output;
$row++;
}
$list_entries=array_chunk($entries,3);
$smarty->assign("ORGINFO",$list_entries);
$smarty->assign("MOD", return_module_language($current_language,'Settings'));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH",$image_path);
$smarty->assign("APP", $app_strings);
$smarty->assign("CMOD", $mod_strings);
$smarty->display("OrgSharingEditView.tpl");
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Leads/Popup.php,v 1.7 2005/03/23 14:19:48 samk Exp $
* Description: TODO: To be written.
********************************************************************************/
require_once('Popup.php');
?>
@@ -0,0 +1,75 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/utils/utils.php');
global $mod_strings;
global $app_strings;
global $theme,$default_charset;
$theme_path="themes/".$theme."/";
$delete_prof_id = vtlib_purify($_REQUEST['profileid']);
$delete_prof_name = getProfileName($delete_prof_id);
$output='';
$output ='<div id="DeleteLay" class="layerPopup">
<form name="newProfileForm" action="index.php" onsubmit="VtigerJS_DialogBox.block();">
<input type="hidden" name="module" value="Users">
<input type="hidden" name="action" value="DeleteProfile">
<input type="hidden" name="delete_prof_id" value="'.$delete_prof_id.'">
<table border=0 cellspacing=0 cellpadding=5 width=100% class=layerHeadingULine>
<tr>
<td class="layerPopupHeading" align="left">'.$mod_strings["LBL_DELETE_PROFILE"].'</td>
<td align="right" class="small"><img src="'. vtiger_imageurl('close.gif', $theme) .'" border=0 alt="'.$app_strings["LBL_CLOSE"].'" title="'.$app_strings["LBL_CLOSE"].'" style="cursor:pointer" onClick="document.getElementById(\'DeleteLay\').style.display=\'none\'";></td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=5 width=95% align=center>
<tr>
<td class="small">
<table border=0 celspacing=0 cellpadding=5 width=100% align=center bgcolor=white>
<tr>
<td width="50%" class="cellLabel small"><b>'.$mod_strings["LBL_PROFILE_TO_BE_DELETED"].'</b></td>
<td width="50%" class="cellText small"><b>'.htmlentities($delete_prof_name,ENT_QUOTES,$default_charset).'</b></td>
</tr>
<tr>
<td align="left" class="cellLabel small" nowrap><b>'.$mod_strings["LBL_TRANSFER_ROLES_TO_PROFILE"].'</b></td>
<td align="left" class="cellText small">';
$output.='<select class="select" name="transfer_prof_id">';
global $adb;
$sql = "select * from vtiger_profile";
$result = $adb->pquery($sql, array());
$temprow = $adb->fetch_array($result);
do
{
$prof_name=htmlentities($temprow["profilename"],ENT_QUOTES,$default_charset);
$prof_id=$temprow["profileid"];
if($delete_prof_id != $prof_id)
{
$output.='<option value="'.$prof_id.'">'.$prof_name.'</option>';
}
}while($temprow = $adb->fetch_array($result));
$output.='</select>';
$output.='</td>
</tr>
</table>
</td>
</tr>
</table>
<table border=0 cellspacing=0 cellpadding=5 width=100% class="layerPopupTransport">
<tr>
<td align=center class="small">
<input type="submit" name="Delete" value="'.$app_strings["LBL_SAVE_BUTTON_LABEL"].'" class="crmButton small">
</td>
</tr>
</table>
</form></div>';
echo $output;
?>
@@ -0,0 +1,18 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
global $php_max_execution_time;
set_time_limit($php_max_execution_time);
RecalculateSharingRules();
header("Location: index.php?action=OrgSharingDetailView&parenttab=Settings&module=Settings");
?>
@@ -0,0 +1,25 @@
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
require_once('include/database/PearDatabase.php');
global $adb;
$profileid = vtlib_purify($_REQUEST['profileid']);
if(strtolower($default_charset) == 'utf-8') {
$profilename = $_REQUEST['profilename'];
$profileDesc = $_REQUEST['description'];
} else {
$profilename = utf8RawUrlDecode($_REQUEST['profilename']);
$profileDesc = utf8RawUrlDecode($_REQUEST['description']);
}
$query="UPDATE vtiger_profile set profilename=?, description=? where profileid=?";
$adb->pquery($query, array($profilename, $profileDesc, $profileid));
?>
@@ -0,0 +1,64 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once('include/utils/UserInfoUtil.php');
$toid=$_REQUEST['parentId'];
$fromid=$_REQUEST['childId'];
global $adb,$mod_strings;
$query = "select * from vtiger_role where roleid=?";
$result=$adb->pquery($query, array($toid));
$parentRoleList=$adb->query_result($result,0,'parentrole');
$replace_with=$parentRoleList;
$orgDepth=$adb->query_result($result,0,'depth');
//echo 'replace with is '.$replace_with;
//echo '<BR>org depth '.$orgDepth;
$parentRoles=explode('::',$parentRoleList);
if(in_array($fromid,$parentRoles))
{
echo $mod_strings['ROLE_DRAG_ERR_MSG'];
die;
}
$roleInfo=getRoleAndSubordinatesInformation($fromid);
$fromRoleInfo=$roleInfo[$fromid];
$replaceToStringArr=explode('::'.$fromid,$fromRoleInfo[1]);
$replaceToString=$replaceToStringArr[0];
//echo '<BR>to be replaced string '.$replaceToString;
$stdDepth=$fromRoleInfo['2'];
//echo '<BR> std depth '.$stdDepth;
//Constructing the query
foreach($roleInfo as $mvRoleId=>$mvRoleInfo)
{
$subPar=explode($replaceToString,$mvRoleInfo[1],2);//we have to spilit as two elements only
$mvParString=$replace_with.$subPar[1];
$subDepth=$mvRoleInfo[2];
$mvDepth=$orgDepth+(($subDepth-$stdDepth)+1);
$query="update vtiger_role set parentrole=?,depth=? where roleid=?";
//echo $query;
$adb->pquery($query, array($mvParString, $mvDepth, $mvRoleId));
// Invalidate any cached information
VTCacheUtils::clearRoleSubordinates($roleId);
}
header("Location: index.php?action=SettingsAjax&module=Settings&file=listroles&ajax=true");
?>

Some files were not shown because too many files have changed in this diff Show More