示例#1
0
 private function CopyUser()
 {
     if ($message = str_strip($_REQUEST, '#')) {
         $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoError(GetLang(B('UmVhY2hlZFVzZXJMaW1pdA==')), $message, MSG_ERROR);
         exit;
     }
     $userId = $_GET['userId'];
     $arrData = array();
     $arrPerms = array();
     $this->_GetUserData($userId, $arrData);
     // Does this user have permission to edit this user?
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrUserData['uservendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
         FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewUsers');
     }
     $this->_GetPermissionData($userId, $arrPerms);
     // Setup the permission check boxes
     foreach ($arrPerms as $k => $v) {
         $GLOBALS["Selected_" . $v] = "selected='selected'";
     }
     $GLOBALS['Username'] = "";
     $GLOBALS['UserEmail'] = $arrData['useremail'];
     $GLOBALS['UserFirstName'] = $arrData['userfirstname'];
     $GLOBALS['UserLastName'] = $arrData['userlastname'];
     if ($arrData['userstatus'] == 0) {
         $GLOBALS['Active0'] = 'selected="selected"';
     } else {
         $GLOBALS['Active1'] = 'selected="selected"';
     }
     // Setup the permission check boxes
     foreach ($arrPerms as $k => $v) {
         $GLOBALS["Check_" . $v] = 'checked="checked"';
     }
     if ($arrData['userrole'] && $arrData['userrole'] != 'custom') {
         $GLOBALS['HidePermissionSelects'] = 'display: none';
     }
     if (!gzte11(ISC_HUGEPRINT)) {
         $GLOBALS['HideVendorOptions'] = 'display: none';
     } else {
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $vendorDetails = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
             $GLOBALS['HideVendorSelect'] = 'display: none';
             $GLOBALS['Vendor'] = $vendotDetails['vendorname'];
         } else {
             $GLOBALS['VendorList'] = $this->GetVendorList($arrData['uservendorid']);
             $GLOBALS['HideVendorLabel'] = 'display: none';
         }
     }
     $GLOBALS['UserRoleOptions'] = $this->GetUserRoleOptions($arrData['userrole'], $arrData['uservendorid']);
     $GLOBALS['FormAction'] = "createUser2";
     $GLOBALS['Title'] = GetLang('CopyUser');
     $GLOBALS['PassReq'] = "<span class='Required'>*</span>";
     $GLOBALS['Adding'] = 1;
     $GLOBALS['UserId'] = "";
     /* Added below condition for applying store credit permission - vikas */
     $loggeduser = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser();
     if ((int) $arrData['userstorecreditperm'] == 0) {
         $GLOBALS['StoreCreditActive0'] = 'selected="selected"';
     } else {
         $GLOBALS['StoreCreditActive1'] = 'selected="selected"';
     }
     if ($loggeduser['pk_userid'] != 1) {
         $GLOBALS['StoreCreditDisable'] = " disabled=\"\" ";
     }
     $GLOBALS['StoreCreditPermission'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("StoreCreditPerm");
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("user.form");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
示例#2
0
	private function CopyUser()
	{
		if($message = str_strip($_REQUEST, '#')) {
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoError(GetLang(B('UmVhY2hlZFVzZXJMaW1pdA==')), $message, MSG_ERROR);
			exit;
		}

		$userId = $_GET['userId'];
		$arrData = array();
		$arrPerms = array();

		$this->_GetUserData($userId, $arrData);

		// Does this user have permission to edit this user?
		if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['uservendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
			FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewUsers');
		}

		$arrPerms = $this->_GetPermissionData($userId);

		$GLOBALS['Username'] = "";
		$GLOBALS['UserEmail'] = isc_html_escape($arrData['useremail']);
		$GLOBALS['UserFirstName'] = isc_html_escape($arrData['userfirstname']);
		$GLOBALS['UserLastName'] = isc_html_escape($arrData['userlastname']);

		if($arrData['userstatus'] == 0) {
			$GLOBALS['Active0'] = 'selected="selected"';
		} else {
			$GLOBALS['Active1'] = 'selected="selected"';
		}

		if($arrData['userrole'] && $arrData['userrole'] != 'custom') {
			$GLOBALS['HidePermissionSelects'] = 'display: none';
		}

		if(!gzte11(ISC_HUGEPRINT)) {
			$GLOBALS['HideVendorOptions'] = 'display: none';
		}
		else {
			if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
				$vendorDetails = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
				$GLOBALS['HideVendorSelect'] = 'display: none';
				$GLOBALS['Vendor'] = $vendorDetails['vendorname'];
			}
			else {
				$GLOBALS['VendorList'] = $this->GetVendorList($arrData['uservendorid']);
				$GLOBALS['HideVendorLabel'] = 'display: none';
			}
		}

		$GLOBALS['PermissionSelects'] = $this->GeneratePermissionRows($arrData, $arrPerms);
		$GLOBALS['UserRoleOptions'] = $this->GetUserRoleOptions($arrData['userrole'], $arrData['uservendorid']);

		$GLOBALS['FormAction'] = "createUser2";
		$GLOBALS['Title'] = GetLang('CopyUser');
		$GLOBALS['PassReq'] = "<span class='Required'>*</span>";
		$GLOBALS['Adding'] = 1;
		$GLOBALS['UserId'] = "";

		$this->template->assign('PCIPasswordMinLen', GetConfig('PCIPasswordMinLen'));
		$this->template->display('user.form.tpl');
	}