更新到 5.2 后第一次 SVN 提交。
[email protected] git-svn-id: https://svn.code.sf.net/p/hawebs/svn@551 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,103 +1,104 @@
|
||||
<?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.
|
||||
*********************************************************************************/
|
||||
|
||||
class DBHealthCheck {
|
||||
var $db;
|
||||
var $dbType;
|
||||
var $dbName;
|
||||
var $dbHostName;
|
||||
var $recommendedEngineType = 'InnoDB';
|
||||
|
||||
function DBHealthCheck($db) {
|
||||
$this->db = $db;
|
||||
$this->dbType = $db->databaseType;
|
||||
$this->dbName = $db->databaseName;
|
||||
$this->dbHostName = $db->host;
|
||||
}
|
||||
|
||||
function isDBHealthy() {
|
||||
$tablesList = $this->getUnhealthyTablesList();
|
||||
if (count($tablesList) > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getUnhealthyTablesList() {
|
||||
$tablesList = array();
|
||||
$dbApiName = '_'.($this->dbType).'_getUnhealthyTables';
|
||||
if(method_exists($this,$dbApiName)) {
|
||||
$tablesList = $this->$dbApiName();
|
||||
}
|
||||
return $tablesList;
|
||||
}
|
||||
|
||||
function updateTableEngineType($tableName) {
|
||||
$dbApiName = '_'.($this->dbType).'_updateEngineType';
|
||||
if(method_exists($this,$dbApiName)) {
|
||||
$this->$dbApiName($tableName);
|
||||
}
|
||||
}
|
||||
|
||||
function updateAllTablesEngineType() {
|
||||
$dbApiName = '_'.($this->dbType).'_updateEngineTypeForAllTables';
|
||||
if(method_exists($this,$dbApiName)) {
|
||||
$this->$dbApiName();
|
||||
}
|
||||
}
|
||||
|
||||
function _mysql_getUnhealthyTables() {
|
||||
$tablesResult = $this->db->_Execute("SHOW TABLE STATUS FROM $this->dbName");
|
||||
$noOfTables = $tablesResult->NumRows($tablesResult);
|
||||
$unHealthyTables = array();
|
||||
$i=0;
|
||||
for($j=0; $j<$noOfTables; ++$j) {
|
||||
$tableInfo = $tablesResult->GetRowAssoc(0);
|
||||
$isHealthy = false;
|
||||
// If already InnoDB type, skip it.
|
||||
if ($tableInfo['engine'] == 'InnoDB') {
|
||||
$isHealthy = true;
|
||||
}
|
||||
// If table is a sequence table, then skip it.
|
||||
$tableNameParts = explode("_",$tableInfo['name']);
|
||||
$tableNamePartsCount = count($tableNameParts);
|
||||
if ($tableNameParts[$tableNamePartsCount-1] == 'seq') {
|
||||
$isHealthy = true;
|
||||
}
|
||||
|
||||
if(!$isHealthy) {
|
||||
$unHealthyTables[$i]['name'] = $tableInfo['name'];
|
||||
$unHealthyTables[$i]['engine'] = $tableInfo['engine'];
|
||||
$unHealthyTables[$i]['autoincrementValue'] = $tableInfo['auto_increment'];
|
||||
$tableCollation = $tableInfo['collation'];
|
||||
$unHealthyTables[$i]['characterset'] = substr($tableCollation, 0, strpos($tableCollation,'_'));
|
||||
$unHealthyTables[$i]['collation'] = $tableCollation;
|
||||
$unHealthyTables[$i]['createOptions'] = $tableInfo['create_options'];
|
||||
++$i;
|
||||
}
|
||||
$tablesResult->MoveNext();
|
||||
}
|
||||
return $unHealthyTables;
|
||||
}
|
||||
|
||||
function _mysql_updateEngineType($tableName) {
|
||||
$this->db->_Execute("ALTER TABLE $tableName ENGINE=$this->recommendedEngineType");
|
||||
}
|
||||
|
||||
function _mysql_updateEngineTypeForAllTables() {
|
||||
$unHealthyTables = $this->_mysql_getUnhealthyTables();
|
||||
$noOfTables = count($unHealthyTables);
|
||||
for($i=0; $i<$noOfTables; ++$i) {
|
||||
$tableName = $unHealthyTables[$i]['name'];
|
||||
$this->db->_Execute("ALTER TABLE $tableName ENGINE=$this->recommendedEngineType");
|
||||
}
|
||||
}
|
||||
}
|
||||
<?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.
|
||||
*********************************************************************************/
|
||||
|
||||
class DBHealthCheck {
|
||||
var $db;
|
||||
var $dbType;
|
||||
var $dbName;
|
||||
var $dbHostName;
|
||||
var $recommendedEngineType = 'InnoDB';
|
||||
|
||||
function DBHealthCheck($db) {
|
||||
$this->db = $db;
|
||||
$this->dbType = $db->databaseType;
|
||||
$this->dbName = $db->databaseName;
|
||||
$this->dbHostName = $db->host;
|
||||
}
|
||||
|
||||
function isMySQL() { return (stripos($this->dbType ,'mysql') === 0);}
|
||||
function isOracle() { return $this->dbType=='oci8'; }
|
||||
function isPostgres() { return $this->dbType=='pgsql'; }
|
||||
|
||||
function isDBHealthy() {
|
||||
$tablesList = $this->getUnhealthyTablesList();
|
||||
if (count($tablesList) > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getUnhealthyTablesList() {
|
||||
$tablesList = array();
|
||||
if($this->isMySql()) {
|
||||
$tablesList = $this->_mysql_getUnhealthyTables();
|
||||
}
|
||||
return $tablesList;
|
||||
}
|
||||
|
||||
function updateTableEngineType($tableName) {
|
||||
if($this->isMySql()) {
|
||||
$this->_mysql_updateEngineType($tableName);
|
||||
}
|
||||
}
|
||||
|
||||
function updateAllTablesEngineType() {
|
||||
if($this->isMySql()) {
|
||||
$this->_mysql_updateEngineTypeForAllTables();
|
||||
}
|
||||
}
|
||||
|
||||
function _mysql_getUnhealthyTables() {
|
||||
$tablesResult = $this->db->_Execute("SHOW TABLE STATUS FROM `$this->dbName`");
|
||||
$noOfTables = $tablesResult->NumRows($tablesResult);
|
||||
$unHealthyTables = array();
|
||||
$i=0;
|
||||
for($j=0; $j<$noOfTables; ++$j) {
|
||||
$tableInfo = $tablesResult->GetRowAssoc(0);
|
||||
$isHealthy = false;
|
||||
// If already InnoDB type, skip it.
|
||||
if ($tableInfo['engine'] == 'InnoDB') {
|
||||
$isHealthy = true;
|
||||
}
|
||||
// If table is a sequence table, then skip it.
|
||||
$tableNameParts = explode("_",$tableInfo['name']);
|
||||
$tableNamePartsCount = count($tableNameParts);
|
||||
if ($tableNameParts[$tableNamePartsCount-1] == 'seq') {
|
||||
$isHealthy = true;
|
||||
}
|
||||
|
||||
if(!$isHealthy) {
|
||||
$unHealthyTables[$i]['name'] = $tableInfo['name'];
|
||||
$unHealthyTables[$i]['engine'] = $tableInfo['engine'];
|
||||
$unHealthyTables[$i]['autoincrementValue'] = $tableInfo['auto_increment'];
|
||||
$tableCollation = $tableInfo['collation'];
|
||||
$unHealthyTables[$i]['characterset'] = substr($tableCollation, 0, strpos($tableCollation,'_'));
|
||||
$unHealthyTables[$i]['collation'] = $tableCollation;
|
||||
$unHealthyTables[$i]['createOptions'] = $tableInfo['create_options'];
|
||||
++$i;
|
||||
}
|
||||
$tablesResult->MoveNext();
|
||||
}
|
||||
return $unHealthyTables;
|
||||
}
|
||||
|
||||
function _mysql_updateEngineType($tableName) {
|
||||
$this->db->_Execute("ALTER TABLE $tableName ENGINE=$this->recommendedEngineType");
|
||||
}
|
||||
|
||||
function _mysql_updateEngineTypeForAllTables() {
|
||||
$unHealthyTables = $this->_mysql_getUnhealthyTables();
|
||||
$noOfTables = count($unHealthyTables);
|
||||
for($i=0; $i<$noOfTables; ++$i) {
|
||||
$tableName = $unHealthyTables[$i]['name'];
|
||||
$this->db->_Execute("ALTER TABLE $tableName ENGINE=$this->recommendedEngineType");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,51 +1,51 @@
|
||||
<?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.
|
||||
********************************************************************************/
|
||||
|
||||
$idstring = rtrim($_REQUEST['idstring'],";");
|
||||
|
||||
if($_REQUEST['export_record'] == true)
|
||||
{
|
||||
//This conditions user can select includesearch & (all |currentpage|selecteddata) but not search---STARTS>>>>>>>>.
|
||||
if(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'all') && $_SESSION['export_where'] == '')
|
||||
{
|
||||
echo'NOT_SEARCH_WITHSEARCH_ALL';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'currentpage') && $_SESSION['export_where'] == '')
|
||||
{
|
||||
echo'NOT_SEARCH_WITHSEARCH_CURRENTPAGE';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'selecteddata') && $idstring == '')
|
||||
{
|
||||
echo'NO_DATA_SELECTED';
|
||||
exit();
|
||||
}
|
||||
//This conditions user can select includesearch & (all |currentpage|selecteddata) but not search----ENDS<<<<<<<<.
|
||||
//This conditions user can select withoutsearch & (all |currentpage|selecteddata) but search---STARTS>>>>>>>>.
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'all') && $_SESSION['export_where'] != '')
|
||||
{
|
||||
echo'SEARCH_WITHOUTSEARCH_ALL';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'currentpage') && $_SESSION['export_where'] != '')
|
||||
{
|
||||
echo'SEARCH_WITHOUTSEARCH_CURRENTPAGE';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'selecteddata') && $idstring == '')
|
||||
{
|
||||
echo'NO_DATA_SELECTED';
|
||||
exit();
|
||||
}
|
||||
//This conditions user can select withoutsearch & (all |currentpage|selecteddata) but search---ENDS<<<<<<<<<<<<
|
||||
}
|
||||
?>
|
||||
<?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.
|
||||
********************************************************************************/
|
||||
|
||||
$idstring = rtrim($_REQUEST['idstring'],";");
|
||||
|
||||
if($_REQUEST['export_record'] == true)
|
||||
{
|
||||
//This conditions user can select includesearch & (all |currentpage|selecteddata) but not search---STARTS>>>>>>>>.
|
||||
if(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'all') && $_SESSION['export_where'] == '')
|
||||
{
|
||||
echo'NOT_SEARCH_WITHSEARCH_ALL';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'currentpage') && $_SESSION['export_where'] == '')
|
||||
{
|
||||
echo'NOT_SEARCH_WITHSEARCH_CURRENTPAGE';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'includesearch' && $_REQUEST['export_data'] == 'selecteddata') && $idstring == '')
|
||||
{
|
||||
echo'NO_DATA_SELECTED';
|
||||
exit();
|
||||
}
|
||||
//This conditions user can select includesearch & (all |currentpage|selecteddata) but not search----ENDS<<<<<<<<.
|
||||
//This conditions user can select withoutsearch & (all |currentpage|selecteddata) but search---STARTS>>>>>>>>.
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'all') && $_SESSION['export_where'] != '')
|
||||
{
|
||||
echo'SEARCH_WITHOUTSEARCH_ALL';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'currentpage') && $_SESSION['export_where'] != '')
|
||||
{
|
||||
echo'SEARCH_WITHOUTSEARCH_CURRENTPAGE';
|
||||
exit();
|
||||
}
|
||||
elseif(($_REQUEST['search_type'] == 'withoutsearch' && $_REQUEST['export_data'] == 'selecteddata') && $idstring == '')
|
||||
{
|
||||
echo'NO_DATA_SELECTED';
|
||||
exit();
|
||||
}
|
||||
//This conditions user can select withoutsearch & (all |currentpage|selecteddata) but search---ENDS<<<<<<<<<<<<
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
<?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');
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('include/utils/utils.php');
|
||||
global $app_strings,$mod_strings, $list_max_entries_per_page, $currentModule, $theme, $current_language, $current_user;
|
||||
|
||||
$smarty = new vtigerCRM_Smarty();
|
||||
$category = getParentTab();
|
||||
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
require_once($theme_path.'layout_utils.php');
|
||||
|
||||
$idstring = rtrim($_REQUEST['idstring'],",");
|
||||
|
||||
$smarty->assign("SESSION_WHERE",$_SESSION['export_where']);
|
||||
|
||||
$smarty->assign('APP',$app_strings);
|
||||
$smarty->assign('MOD',$mod_strings);
|
||||
$smarty->assign("THEME", $theme_path);
|
||||
$smarty->assign("IMAGE_PATH", $image_path);
|
||||
$smarty->assign("CATEGORY",$category);
|
||||
$smarty->assign("MODULE",$currentModule);
|
||||
$smarty->assign("MODULELABEL",getTranslatedString($currentModule));
|
||||
$smarty->assign("IDSTRING",$idstring);
|
||||
$smarty->assign("PERPAGE",$list_max_entries_per_page);
|
||||
|
||||
if(!is_admin($current_user) && (isPermitted($currentModule, 'Export') != 'yes')) {
|
||||
$smarty->display(vtlib_getModuleTemplate('Vtiger','OperationNotPermitted.tpl'));
|
||||
} else {
|
||||
$smarty->display('ExportRecords.tpl');
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?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');
|
||||
require_once('Smarty_setup.php');
|
||||
require_once('include/utils/utils.php');
|
||||
global $app_strings,$mod_strings, $list_max_entries_per_page, $currentModule, $theme, $current_language, $current_user;
|
||||
|
||||
$smarty = new vtigerCRM_Smarty();
|
||||
$category = getParentTab();
|
||||
|
||||
$theme_path="themes/".$theme."/";
|
||||
$image_path=$theme_path."images/";
|
||||
require_once($theme_path.'layout_utils.php');
|
||||
|
||||
$idstring = rtrim($_REQUEST['idstring'],",");
|
||||
|
||||
$smarty->assign("SESSION_WHERE",$_SESSION['export_where']);
|
||||
|
||||
$smarty->assign('APP',$app_strings);
|
||||
$smarty->assign('MOD',$mod_strings);
|
||||
$smarty->assign("THEME", $theme_path);
|
||||
$smarty->assign("IMAGE_PATH", $image_path);
|
||||
$smarty->assign("CATEGORY",$category);
|
||||
$smarty->assign("MODULE",$currentModule);
|
||||
$smarty->assign("MODULELABEL",getTranslatedString($currentModule));
|
||||
$smarty->assign("IDSTRING",$idstring);
|
||||
$smarty->assign("PERPAGE",$list_max_entries_per_page);
|
||||
|
||||
if(!is_admin($current_user) && (isPermitted($currentModule, 'Export') != 'yes')) {
|
||||
$smarty->display(vtlib_getModuleTemplate('Vtiger','OperationNotPermitted.tpl'));
|
||||
} else {
|
||||
$smarty->display('ExportRecords.tpl');
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,133 +1,133 @@
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/** Class to retreive all the vtiger_users present in a group
|
||||
*
|
||||
*/
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/GetParentGroups.php');
|
||||
|
||||
class GetGroupUsers {
|
||||
|
||||
var $group_users=array();
|
||||
var $group_subgroups=array();
|
||||
|
||||
/** to get all the vtiger_users and vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns the vtiger_users present in the group in the variable $parent_groups of the class
|
||||
* @returns the sub vtiger_groups present in the group in the variable $group_subgroups of the class
|
||||
*/
|
||||
function getAllUsersInGroup($groupid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllUsersInGroup(".$groupid.") method...");
|
||||
//Retreiving from the user2grouptable
|
||||
$query="select * from vtiger_users2group where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_user_id=$adb->query_result($result,$i,'userid');
|
||||
if(! in_array($now_user_id,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_user_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Retreiving from the vtiger_group2role
|
||||
$query="select * from vtiger_group2role where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_role_id=$adb->query_result($result,$i,'roleid');
|
||||
$now_role_users=array();
|
||||
$now_role_users=getRoleUsers($now_role_id);
|
||||
|
||||
foreach($now_role_users as $now_role_userid => $now_role_username)
|
||||
{
|
||||
if(! in_array($now_role_userid,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_role_userid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Retreiving from the vtiger_group2rs
|
||||
$query="select * from vtiger_group2rs where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_rs_id=$adb->query_result($result,$i,'roleandsubid');
|
||||
$now_rs_users=getRoleAndSubordinateUsers($now_rs_id);
|
||||
foreach($now_rs_users as $now_rs_userid => $now_rs_username)
|
||||
{
|
||||
if(! in_array($now_rs_userid,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_rs_userid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//Retreving from group2group
|
||||
$query="select * from vtiger_group2grouprel where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_grp_id=$adb->query_result($result,$i,'containsgroupid');
|
||||
|
||||
|
||||
$focus = new GetGroupUsers();
|
||||
$focus->getAllUsersInGroup($now_grp_id);
|
||||
$now_grp_users=$focus->group_users;
|
||||
$now_grp_grps=$focus->group_subgroups;
|
||||
if(! array_key_exists($now_grp_id,$this->group_subgroups))
|
||||
{
|
||||
$this->group_subgroups[$now_grp_id]=$now_grp_users;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach($focus->group_users as $temp_user_id)
|
||||
{
|
||||
if(! in_array($temp_user_id,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$temp_user_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($focus->group_subgroups as $temp_grp_id => $users_array)
|
||||
{
|
||||
if(! array_key_exists($temp_grp_id,$this->group_subgroups))
|
||||
{
|
||||
$this->group_subgroups[$temp_grp_id]=$focus->group_users;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$log->debug("Exiting getAllUsersInGroup method...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
/** Class to retreive all the vtiger_users present in a group
|
||||
*
|
||||
*/
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/GetParentGroups.php');
|
||||
|
||||
class GetGroupUsers {
|
||||
|
||||
var $group_users=array();
|
||||
var $group_subgroups=array();
|
||||
|
||||
/** to get all the vtiger_users and vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns the vtiger_users present in the group in the variable $parent_groups of the class
|
||||
* @returns the sub vtiger_groups present in the group in the variable $group_subgroups of the class
|
||||
*/
|
||||
function getAllUsersInGroup($groupid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllUsersInGroup(".$groupid.") method...");
|
||||
//Retreiving from the user2grouptable
|
||||
$query="select * from vtiger_users2group where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_user_id=$adb->query_result($result,$i,'userid');
|
||||
if(! in_array($now_user_id,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_user_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Retreiving from the vtiger_group2role
|
||||
$query="select * from vtiger_group2role where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_role_id=$adb->query_result($result,$i,'roleid');
|
||||
$now_role_users=array();
|
||||
$now_role_users=getRoleUsers($now_role_id);
|
||||
|
||||
foreach($now_role_users as $now_role_userid => $now_role_username)
|
||||
{
|
||||
if(! in_array($now_role_userid,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_role_userid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Retreiving from the vtiger_group2rs
|
||||
$query="select * from vtiger_group2rs where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_rs_id=$adb->query_result($result,$i,'roleandsubid');
|
||||
$now_rs_users=getRoleAndSubordinateUsers($now_rs_id);
|
||||
foreach($now_rs_users as $now_rs_userid => $now_rs_username)
|
||||
{
|
||||
if(! in_array($now_rs_userid,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$now_rs_userid;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//Retreving from group2group
|
||||
$query="select * from vtiger_group2grouprel where groupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_grp_id=$adb->query_result($result,$i,'containsgroupid');
|
||||
|
||||
|
||||
$focus = new GetGroupUsers();
|
||||
$focus->getAllUsersInGroup($now_grp_id);
|
||||
$now_grp_users=$focus->group_users;
|
||||
$now_grp_grps=$focus->group_subgroups;
|
||||
if(! array_key_exists($now_grp_id,$this->group_subgroups))
|
||||
{
|
||||
$this->group_subgroups[$now_grp_id]=$now_grp_users;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach($focus->group_users as $temp_user_id)
|
||||
{
|
||||
if(! in_array($temp_user_id,$this->group_users))
|
||||
{
|
||||
$this->group_users[]=$temp_user_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($focus->group_subgroups as $temp_grp_id => $users_array)
|
||||
{
|
||||
if(! array_key_exists($temp_grp_id,$this->group_subgroups))
|
||||
{
|
||||
$this->group_subgroups[$temp_grp_id]=$focus->group_users;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$log->debug("Exiting getAllUsersInGroup method...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/** Class to retreive all the Parent Groups of the specified Group
|
||||
*
|
||||
*/
|
||||
class GetParentGroups {
|
||||
|
||||
var $parent_groups=Array();
|
||||
|
||||
/** to get all the parent vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns updates the parent group in the varibale $parent_groups of the class
|
||||
*/
|
||||
function getAllParentGroups($groupid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllParentGroups(".$groupid.") method...");
|
||||
$query="select groupid from vtiger_group2grouprel where containsgroupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
if($num_rows > 0)
|
||||
{
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($group_id,$this->parent_groups))
|
||||
{
|
||||
$this->parent_groups[]=$group_id;
|
||||
$this->getAllParentGroups($group_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
$log->debug("Exiting getAllParentGroups method...");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/** Class to retreive all the Parent Groups of the specified Group
|
||||
*
|
||||
*/
|
||||
class GetParentGroups {
|
||||
|
||||
var $parent_groups=Array();
|
||||
|
||||
/** to get all the parent vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns updates the parent group in the varibale $parent_groups of the class
|
||||
*/
|
||||
function getAllParentGroups($groupid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllParentGroups(".$groupid.") method...");
|
||||
$query="select groupid from vtiger_group2grouprel where containsgroupid=?";
|
||||
$result = $adb->pquery($query, array($groupid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
if($num_rows > 0)
|
||||
{
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($group_id,$this->parent_groups))
|
||||
{
|
||||
$this->parent_groups[]=$group_id;
|
||||
$this->getAllParentGroups($group_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
$log->debug("Exiting getAllParentGroups method...");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,103 +1,103 @@
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/** Class to retreive all the Parent Groups of the specified Group
|
||||
*
|
||||
*/
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/GetParentGroups.php');
|
||||
|
||||
class GetUserGroups {
|
||||
|
||||
var $user_groups=Array();
|
||||
//var $userRole='';
|
||||
|
||||
/** to get all the parent vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns updates the parent group in the varibale $parent_groups of the class
|
||||
*/
|
||||
function getAllUserGroups($userid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllUserGroups(".$userid.") method...");
|
||||
//Retreiving from the user2grouptable
|
||||
$query="select * from vtiger_users2group where userid=?";
|
||||
$result = $adb->pquery($query, array($userid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Setting the User Role
|
||||
$userRole = fetchUserRole($userid);
|
||||
//Retreiving from the vtiger_user2role
|
||||
$query="select * from vtiger_group2role where roleid=?";
|
||||
$result = $adb->pquery($query, array($userRole));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Retreiving from the user2rs
|
||||
$parentRoles=getParentRole($userRole);
|
||||
$parentRolelist= array();
|
||||
foreach($parentRoles as $par_rol_id)
|
||||
{
|
||||
array_push($parentRolelist, $par_rol_id);
|
||||
}
|
||||
array_push($parentRolelist, $userRole);
|
||||
$query="select * from vtiger_group2rs where roleandsubid in (". generateQuestionMarks($parentRolelist) .")";
|
||||
$result = $adb->pquery($query, array($parentRolelist));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
}
|
||||
}
|
||||
foreach($this->user_groups as $grp_id)
|
||||
{
|
||||
$focus = new GetParentGroups();
|
||||
$focus->getAllParentGroups($grp_id);
|
||||
|
||||
foreach($focus->parent_groups as $par_grp_id)
|
||||
{
|
||||
if(! in_array($par_grp_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$par_grp_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$log->debug("Exiting getAllUserGroups method...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
/** Class to retreive all the Parent Groups of the specified Group
|
||||
*
|
||||
*/
|
||||
require_once('include/utils/UserInfoUtil.php');
|
||||
require_once('include/utils/GetParentGroups.php');
|
||||
|
||||
class GetUserGroups {
|
||||
|
||||
var $user_groups=Array();
|
||||
//var $userRole='';
|
||||
|
||||
/** to get all the parent vtiger_groups of the specified group
|
||||
* @params $groupId --> Group Id :: Type Integer
|
||||
* @returns updates the parent group in the varibale $parent_groups of the class
|
||||
*/
|
||||
function getAllUserGroups($userid)
|
||||
{
|
||||
global $adb,$log;
|
||||
$log->debug("Entering getAllUserGroups(".$userid.") method...");
|
||||
//Retreiving from the user2grouptable
|
||||
$query="select * from vtiger_users2group where userid=?";
|
||||
$result = $adb->pquery($query, array($userid));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Setting the User Role
|
||||
$userRole = fetchUserRole($userid);
|
||||
//Retreiving from the vtiger_user2role
|
||||
$query="select * from vtiger_group2role where roleid=?";
|
||||
$result = $adb->pquery($query, array($userRole));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Retreiving from the user2rs
|
||||
$parentRoles=getParentRole($userRole);
|
||||
$parentRolelist= array();
|
||||
foreach($parentRoles as $par_rol_id)
|
||||
{
|
||||
array_push($parentRolelist, $par_rol_id);
|
||||
}
|
||||
array_push($parentRolelist, $userRole);
|
||||
$query="select * from vtiger_group2rs where roleandsubid in (". generateQuestionMarks($parentRolelist) .")";
|
||||
$result = $adb->pquery($query, array($parentRolelist));
|
||||
$num_rows=$adb->num_rows($result);
|
||||
for($i=0;$i<$num_rows;$i++)
|
||||
{
|
||||
$now_group_id=$adb->query_result($result,$i,'groupid');
|
||||
|
||||
if(! in_array($now_group_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$now_group_id;
|
||||
}
|
||||
}
|
||||
foreach($this->user_groups as $grp_id)
|
||||
{
|
||||
$focus = new GetParentGroups();
|
||||
$focus->getAllParentGroups($grp_id);
|
||||
|
||||
foreach($focus->parent_groups as $par_grp_id)
|
||||
{
|
||||
if(! in_array($par_grp_id,$this->user_groups))
|
||||
{
|
||||
$this->user_groups[]=$par_grp_id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$log->debug("Exiting getAllUserGroups method...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,137 +1,136 @@
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
// TTF Font names
|
||||
DEFINE("FF_COURIER",'Courier New');
|
||||
DEFINE("FF_VERDANA",'Verdana');
|
||||
DEFINE("FF_TIMES",'Times New Roman');
|
||||
DEFINE("FF_COMIC",'Comic');
|
||||
DEFINE("FF_ARIAL",'Arial');
|
||||
DEFINE("FF_GEORGIA",'Georgia');
|
||||
DEFINE("FF_TREBUCHE",'Trebuc');
|
||||
DEFINE("FF_DROIDSANSFALLBACK",'Droid Sans Fallback');
|
||||
|
||||
// Chinese font
|
||||
DEFINE("FF_SIMSUN",'Simsun');
|
||||
DEFINE("FF_CHINESE",'Chinese');
|
||||
DEFINE("FF_BIG5",'Big5');
|
||||
|
||||
DEFINE("FF_FONT1",'Vera');
|
||||
|
||||
/**This function is used to get the font name when a language code is given
|
||||
* Param $locale - language code
|
||||
* Return type string - font name
|
||||
*/
|
||||
function calculate_font_name($locale)
|
||||
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering calculate_font_name(".$locale.") method ...");
|
||||
|
||||
switch($locale)
|
||||
{
|
||||
case 'zh_cn':
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_DROIDSANSFALLBACK;
|
||||
case 'tw_zh':
|
||||
if(!function_exists('iconv')){
|
||||
echo " Unable to display traditional Chinese on the graphs.<BR>The function iconv does not exists please read more about <a href='http://us4.php.net/iconv'>iconv here</a><BR>";
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_CHINESE;
|
||||
}
|
||||
default:
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
}
|
||||
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
}
|
||||
|
||||
/**This function is used to generate the n colors.
|
||||
* Param $count - number of colors to generate
|
||||
* Param $start - value of first color
|
||||
* Param $step - color increment to apply
|
||||
* Return type array - array of n colors values
|
||||
*/
|
||||
|
||||
function color_generator($count = 1, $start = '33CCFF', $step = '221133')
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering color_generator(".$count.",".$start.",".$step.") method ...");
|
||||
// explode color strings to RGB array
|
||||
if($start{0} == "#") $start = substr($start,1);
|
||||
if($step{0} == "#") $step = substr($step,1);
|
||||
// pad shorter strings with 0
|
||||
$start = substr($start."000000",0,6);
|
||||
$step = substr($step."000000",0,6);
|
||||
$colors = array(hexdec(substr($start,0,2)),hexdec(substr($start,2,2)),hexdec(substr($start,4,2)));
|
||||
$steps = array(hexdec(substr($step,0,2)),hexdec(substr($step,2,2)),hexdec(substr($step,4,2)));
|
||||
// buils $count colours adding $step to $start
|
||||
$result = array();
|
||||
for($i=1; $i<=$count; $i++){
|
||||
array_push($result,"#".dechex($colors[0]).dechex($colors[1]).dechex($colors[2]));
|
||||
for($j=0; $j<3; $j++) {
|
||||
$colors[$j] += $steps[$j];
|
||||
if($colors[$j] > 0xFF) $colors[$j] -= 0xFF;
|
||||
}
|
||||
}
|
||||
$log->debug("Exiting color_generator method ...");
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**This function is used to define the optimum spacin for tick marks on an axis
|
||||
* Param $max - maximum value of axis
|
||||
* Return type array - array of 2 values major and minor spacing
|
||||
*/
|
||||
|
||||
function get_tickspacing($max = 10)
|
||||
{
|
||||
global $log,$app_strings;
|
||||
$log->debug("Entering get_tickspacing(".$max.") method ...");
|
||||
$result = array(1,1);
|
||||
|
||||
// normalize $max to get value between 1 and 10
|
||||
$coef = pow(10,floor(log10($max)));
|
||||
if($coef == 0)
|
||||
{
|
||||
$data=0;
|
||||
echo "<h3>".$app_strings['NO_DATA_AVAILABLE_WITH_SPECIFIED_PERIOD']."</h3>";
|
||||
$log->debug("Exiting get_tickspacing method ...");
|
||||
return $data;
|
||||
}
|
||||
$normalized = $max / $coef;
|
||||
|
||||
if($normalized < 1.5){
|
||||
$result[0] = 0.2;
|
||||
$result[1] = 0.1;
|
||||
}
|
||||
elseif($normalized < 5){
|
||||
$result[0] = 0.5;
|
||||
$result[1] = 0.1;
|
||||
}
|
||||
elseif($normalized < 10){
|
||||
$result[0] = 1.0;
|
||||
$result[1] = 0.5;
|
||||
}
|
||||
$result[0] *= $coef;
|
||||
$result[1] *= $coef;
|
||||
$log->debug("Exiting get_tickspacing method ...");
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
// TTF Font names
|
||||
DEFINE("FF_COURIER",'Courier New');
|
||||
DEFINE("FF_VERDANA",'Verdana');
|
||||
DEFINE("FF_TIMES",'Times New Roman');
|
||||
DEFINE("FF_COMIC",'Comic');
|
||||
DEFINE("FF_ARIAL",'Arial');
|
||||
DEFINE("FF_GEORGIA",'Georgia');
|
||||
DEFINE("FF_TREBUCHE",'Trebuc');
|
||||
|
||||
// Chinese font
|
||||
DEFINE("FF_SIMSUN",'Simsun');
|
||||
DEFINE("FF_CHINESE",'Chinese');
|
||||
DEFINE("FF_BIG5",'Big5');
|
||||
|
||||
DEFINE("FF_FONT1",'Vera');
|
||||
|
||||
/**This function is used to get the font name when a language code is given
|
||||
* Param $locale - language code
|
||||
* Return type string - font name
|
||||
*/
|
||||
function calculate_font_name($locale)
|
||||
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering calculate_font_name(".$locale.") method ...");
|
||||
|
||||
switch($locale)
|
||||
{
|
||||
case 'cn_zh':
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_SIMSUN;
|
||||
case 'tw_zh':
|
||||
if(!function_exists('iconv')){
|
||||
echo " Unable to display traditional Chinese on the graphs.<BR>The function iconv does not exists please read more about <a href='http://us4.php.net/iconv'>iconv here</a><BR>";
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_CHINESE;
|
||||
}
|
||||
default:
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
}
|
||||
|
||||
$log->debug("Exiting calculate_font_name method ...");
|
||||
return FF_FONT1;
|
||||
}
|
||||
|
||||
/**This function is used to generate the n colors.
|
||||
* Param $count - number of colors to generate
|
||||
* Param $start - value of first color
|
||||
* Param $step - color increment to apply
|
||||
* Return type array - array of n colors values
|
||||
*/
|
||||
|
||||
function color_generator($count = 1, $start = '33CCFF', $step = '221133')
|
||||
{
|
||||
global $log;
|
||||
$log->debug("Entering color_generator(".$count.",".$start.",".$step.") method ...");
|
||||
// explode color strings to RGB array
|
||||
if($start{0} == "#") $start = substr($start,1);
|
||||
if($step{0} == "#") $step = substr($step,1);
|
||||
// pad shorter strings with 0
|
||||
$start = substr($start."000000",0,6);
|
||||
$step = substr($step."000000",0,6);
|
||||
$colors = array(hexdec(substr($start,0,2)),hexdec(substr($start,2,2)),hexdec(substr($start,4,2)));
|
||||
$steps = array(hexdec(substr($step,0,2)),hexdec(substr($step,2,2)),hexdec(substr($step,4,2)));
|
||||
// buils $count colours adding $step to $start
|
||||
$result = array();
|
||||
for($i=1; $i<=$count; $i++){
|
||||
array_push($result,"#".dechex($colors[0]).dechex($colors[1]).dechex($colors[2]));
|
||||
for($j=0; $j<3; $j++) {
|
||||
$colors[$j] += $steps[$j];
|
||||
if($colors[$j] > 0xFF) $colors[$j] -= 0xFF;
|
||||
}
|
||||
}
|
||||
$log->debug("Exiting color_generator method ...");
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**This function is used to define the optimum spacin for tick marks on an axis
|
||||
* Param $max - maximum value of axis
|
||||
* Return type array - array of 2 values major and minor spacing
|
||||
*/
|
||||
|
||||
function get_tickspacing($max = 10)
|
||||
{
|
||||
global $log,$app_strings;
|
||||
$log->debug("Entering get_tickspacing(".$max.") method ...");
|
||||
$result = array(1,1);
|
||||
|
||||
// normalize $max to get value between 1 and 10
|
||||
$coef = pow(10,floor(log10($max)));
|
||||
if($coef == 0)
|
||||
{
|
||||
$data=0;
|
||||
echo "<h3>".$app_strings['NO_DATA_AVAILABLE_WITH_SPECIFIED_PERIOD']."</h3>";
|
||||
$log->debug("Exiting get_tickspacing method ...");
|
||||
return $data;
|
||||
}
|
||||
$normalized = $max / $coef;
|
||||
|
||||
if($normalized < 1.5){
|
||||
$result[0] = 0.2;
|
||||
$result[1] = 0.1;
|
||||
}
|
||||
elseif($normalized < 5){
|
||||
$result[0] = 0.5;
|
||||
$result[1] = 0.1;
|
||||
}
|
||||
elseif($normalized < 10){
|
||||
$result[0] = 1.0;
|
||||
$result[1] = 0.5;
|
||||
}
|
||||
$result[0] *= $coef;
|
||||
$result[1] *= $coef;
|
||||
$log->debug("Exiting get_tickspacing method ...");
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,111 +1,111 @@
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
class Encryption
|
||||
{
|
||||
function encrypt($message)
|
||||
{
|
||||
//converting a string to binary
|
||||
$enc_message = $this->asc2bin($message);
|
||||
$enc_message = $this -> xor_string($enc_message);
|
||||
$enc_message = $this -> urlsafe_b64encode($enc_message);
|
||||
return $enc_message;
|
||||
}
|
||||
function asc2bin($inputString, $byteLength=8)
|
||||
{
|
||||
$binaryOutput = '';
|
||||
$strSize = strlen($inputString);
|
||||
for($x=0; $x<$strSize; $x++)
|
||||
{
|
||||
$charBin = decbin(ord($inputString{$x}));
|
||||
$charBin = str_pad($charBin, $byteLength, '0', STR_PAD_LEFT);
|
||||
$binaryOutput .= $charBin;
|
||||
}
|
||||
|
||||
return $binaryOutput;
|
||||
}
|
||||
|
||||
function bin2asc($binaryInput, $byteLength=8)
|
||||
{
|
||||
if (strlen($binaryInput) % $byteLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// why run strlen() so many times in a loop? Use of constants = speed increase.
|
||||
$strSize = strlen($binaryInput);
|
||||
$origStr = '';
|
||||
// jump between bytes.
|
||||
for($x=0; $x<$strSize; $x += $byteLength)
|
||||
{
|
||||
// extract character's binary code
|
||||
$charBinary = substr($binaryInput, $x, $byteLength);
|
||||
$origStr .= chr(bindec($charBinary)); // conversion to ASCII.
|
||||
}
|
||||
return $origStr;
|
||||
}
|
||||
|
||||
function decrypt($message)
|
||||
{
|
||||
$dec_message = $this -> urlsafe_b64decode($message);
|
||||
$dec_message = $this -> xor_string($dec_message);
|
||||
$dec_message = $this->bin2asc($dec_message);
|
||||
return $dec_message;
|
||||
}
|
||||
function xor_string($string)
|
||||
{
|
||||
$buf = '';
|
||||
$size = strlen($string);
|
||||
for ($i=0; $i<$size; $i++)
|
||||
$buf .= chr(ord($string[$i]) ^ 255);
|
||||
return $buf;
|
||||
}
|
||||
function urlsafe_b64encode($string)
|
||||
{
|
||||
$data = base64_encode($string);
|
||||
$data = str_replace(array('+','/','='),array('-','_','.'),$data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function urlsafe_b64decode($string)
|
||||
{
|
||||
$data = str_replace(array('-','_'),array('+','/'),$string);
|
||||
$mod4 = strlen($data) % 4;
|
||||
if ($mod4)
|
||||
{
|
||||
$data .= substr('====', $mod4);
|
||||
}
|
||||
return base64_decode($data);
|
||||
}
|
||||
function x_Encrypt($string, $key)
|
||||
{
|
||||
for($i=0; $i<strlen($string); $i++)
|
||||
{
|
||||
for($j=0; $j<strlen($key); $j++)
|
||||
{
|
||||
$string[$i] = $string[$i]^$key[$j];
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function x_Decrypt($string, $key)
|
||||
{
|
||||
for($i=0; $i<strlen($string); $i++)
|
||||
{
|
||||
for($j=0; $j<strlen($key); $j++)
|
||||
{
|
||||
$string[$i] = $key[$j]^$string[$i];
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
<?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.
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
class Encryption
|
||||
{
|
||||
function encrypt($message)
|
||||
{
|
||||
//converting a string to binary
|
||||
$enc_message = $this->asc2bin($message);
|
||||
$enc_message = $this -> xor_string($enc_message);
|
||||
$enc_message = $this -> urlsafe_b64encode($enc_message);
|
||||
return $enc_message;
|
||||
}
|
||||
function asc2bin($inputString, $byteLength=8)
|
||||
{
|
||||
$binaryOutput = '';
|
||||
$strSize = strlen($inputString);
|
||||
for($x=0; $x<$strSize; $x++)
|
||||
{
|
||||
$charBin = decbin(ord($inputString{$x}));
|
||||
$charBin = str_pad($charBin, $byteLength, '0', STR_PAD_LEFT);
|
||||
$binaryOutput .= $charBin;
|
||||
}
|
||||
|
||||
return $binaryOutput;
|
||||
}
|
||||
|
||||
function bin2asc($binaryInput, $byteLength=8)
|
||||
{
|
||||
if (strlen($binaryInput) % $byteLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// why run strlen() so many times in a loop? Use of constants = speed increase.
|
||||
$strSize = strlen($binaryInput);
|
||||
$origStr = '';
|
||||
// jump between bytes.
|
||||
for($x=0; $x<$strSize; $x += $byteLength)
|
||||
{
|
||||
// extract character's binary code
|
||||
$charBinary = substr($binaryInput, $x, $byteLength);
|
||||
$origStr .= chr(bindec($charBinary)); // conversion to ASCII.
|
||||
}
|
||||
return $origStr;
|
||||
}
|
||||
|
||||
function decrypt($message)
|
||||
{
|
||||
$dec_message = $this -> urlsafe_b64decode($message);
|
||||
$dec_message = $this -> xor_string($dec_message);
|
||||
$dec_message = $this->bin2asc($dec_message);
|
||||
return $dec_message;
|
||||
}
|
||||
function xor_string($string)
|
||||
{
|
||||
$buf = '';
|
||||
$size = strlen($string);
|
||||
for ($i=0; $i<$size; $i++)
|
||||
$buf .= chr(ord($string[$i]) ^ 255);
|
||||
return $buf;
|
||||
}
|
||||
function urlsafe_b64encode($string)
|
||||
{
|
||||
$data = base64_encode($string);
|
||||
$data = str_replace(array('+','/','='),array('-','_','.'),$data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function urlsafe_b64decode($string)
|
||||
{
|
||||
$data = str_replace(array('-','_'),array('+','/'),$string);
|
||||
$mod4 = strlen($data) % 4;
|
||||
if ($mod4)
|
||||
{
|
||||
$data .= substr('====', $mod4);
|
||||
}
|
||||
return base64_decode($data);
|
||||
}
|
||||
function x_Encrypt($string, $key)
|
||||
{
|
||||
for($i=0; $i<strlen($string); $i++)
|
||||
{
|
||||
for($j=0; $j<strlen($key); $j++)
|
||||
{
|
||||
$string[$i] = $string[$i]^$key[$j];
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function x_Decrypt($string, $key)
|
||||
{
|
||||
for($i=0; $i<strlen($string); $i++)
|
||||
{
|
||||
for($j=0; $j<strlen($key); $j++)
|
||||
{
|
||||
$string[$i] = $key[$j]^$string[$i];
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+4865
-4871
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user