CODE STYLE controllers/adminProxy.php

This commit is contained in:
Fernando Ontiveros
2012-10-19 11:31:42 -04:00
parent 4351ce5253
commit 92f6ff3f6b

View File

@@ -32,7 +32,7 @@ class adminProxy extends HttpProxyController
$updateRedirector = false;
$restart = false;
if (!file_exists($envFile) ) { // if ini file doesn't exists
if (!file_exists($envFile) ) {
if (!is_writable(PATH_CONFIG)) {
throw new Exception('The enviroment config directory is not writable. <br/>Please give write permission to directory: /workflow/engine/config');
}
@@ -41,8 +41,7 @@ class adminProxy extends HttpProxyController
$content .= ";\r\n";
file_put_contents($envFile, $content);
//@chmod($envFile, 0777);
}
else {
} else {
if (!is_writable($envFile)) {
throw new Exception('The enviroment ini file file is not writable. <br/>Please give write permission to file: /workflow/engine/config/env.ini');
}
@@ -90,8 +89,7 @@ class adminProxy extends HttpProxyController
if ($updateRedirector) {
if (!file_exists(PATH_HTML . 'index.html')) {
throw new Exception('The index.html file is not writable on workflow/public_html directory.');
}
else {
} else {
if (!is_writable(PATH_HTML . 'index.html')) {
throw new Exception(G::LoadTranslation('ID_INDEX_NOT_WRITEABLE') . ' /workflow/public_html/index.html');
}
@@ -108,8 +106,7 @@ class adminProxy extends HttpProxyController
G::update_php_ini($envFile, $updatedConf);
if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
$urlPart = '/main/login';
}
else {
} else {
$urlPart = '/login/login';
}
@@ -119,7 +116,7 @@ class adminProxy extends HttpProxyController
$this->message = 'Saved Successfully';
}
function uxUserUpdate($httpData)
public function uxUserUpdate($httpData)
{
require_once 'classes/model/Users.php';
$data = G::json_decode($httpData->users);
@@ -127,8 +124,7 @@ class adminProxy extends HttpProxyController
if (!is_array($data)) {
$list[0] = (array) $data ;
}
else {
} else {
$list = $data;
}
@@ -149,15 +145,15 @@ class adminProxy extends HttpProxyController
if (count($rows) == 1) {
$retRow = $rows[0];
}
else {
} else {
$retRow = $rows;
}
return array('success' => true, 'message'=>'done', 'users'=>$retRow);
}
function calendarValidate($httpData) {
public function calendarValidate($httpData)
{
$httpData=array_unique((array)$httpData);
$message = '';
$oldName = isset($_POST['oldName'])? $_POST['oldName']:'';
@@ -169,16 +165,15 @@ class adminProxy extends HttpProxyController
$aCalendars = $oCalendar->getCalendarList(false,true);
$aCalendarDefinitions = end($aCalendars);
foreach($aCalendarDefinitions as $aDefinitions) {
if (trim($_POST['name'])==''){
foreach ($aCalendarDefinitions as $aDefinitions) {
if (trim($_POST['name'])=='') {
$validated = false;
$message = G::loadTranslation('ID_CALENDAR_INVALID_NAME');
break;
}
if ($aDefinitions['CALENDAR_NAME'] != $_POST['name']){
if ($aDefinitions['CALENDAR_NAME'] != $_POST['name']) {
$validated = true;
}
else {
} else {
if ($aDefinitions['CALENDAR_NAME'] != $oldName) {
$validated = false;
$message = G::loadTranslation('ID_CALENDAR_INVALID_NAME');
@@ -195,7 +190,7 @@ class adminProxy extends HttpProxyController
return $message;
}
function uxGroupUpdate($httpData)
public function uxGroupUpdate($httpData)
{
G::LoadClass('groups');
$groups = new Groups();
@@ -216,7 +211,7 @@ class adminProxy extends HttpProxyController
return array('success' => $success, 'users' => $usersAdmin);
}
function getUxTypesList($type = 'assoc')
public function getUxTypesList($type = 'assoc')
{
$list = array();
@@ -227,8 +222,7 @@ class adminProxy extends HttpProxyController
'SWITCHABLE' => 'Switchable',
'SINGLE' => 'Single Application'
);
}
else {
} else {
$list = array(
array('NORMAL', 'Normal'),
array('SIMPLIFIED', 'Simplified'),
@@ -236,16 +230,15 @@ class adminProxy extends HttpProxyController
array('SINGLE', 'Single Application')
);
}
return $list;
}
function calendarSave()
public function calendarSave()
{
//{ $_POST['BUSINESS_DAY']
$businessDayArray = G::json_decode($_POST['BUSINESS_DAY']);
$businessDayFixArray = array();
for($i=0;$i<sizeof($businessDayArray);$i++) {
for ($i=0; $i<sizeof($businessDayArray); $i++) {
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_DAY'] = $businessDayArray[$i]->CALENDAR_BUSINESS_DAY;
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_START'] = $businessDayArray[$i]->CALENDAR_BUSINESS_START;
$businessDayFixArray[$i+1]['CALENDAR_BUSINESS_END'] = $businessDayArray[$i]->CALENDAR_BUSINESS_END;
@@ -256,7 +249,7 @@ class adminProxy extends HttpProxyController
//{ $_POST['CALENDAR_WORK_DAYS']
$calendarWorkDaysArray = G::json_decode($_POST['CALENDAR_WORK_DAYS']);
$calendarWorkDaysFixArray = array();
for($i=0;$i<sizeof($calendarWorkDaysArray);$i++) {
for ($i=0; $i<sizeof($calendarWorkDaysArray); $i++) {
$calendarWorkDaysFixArray[$i] = $calendarWorkDaysArray[$i]."";
}
$_POST['CALENDAR_WORK_DAYS'] = $calendarWorkDaysFixArray;
@@ -265,7 +258,7 @@ class adminProxy extends HttpProxyController
//{ $_POST['HOLIDAY']
$holidayArray = G::json_decode($_POST['HOLIDAY']);
$holidayFixArray = array();
for($i=0;$i<sizeof($holidayArray);$i++) {
for ($i=0; $i<sizeof($holidayArray); $i++) {
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_NAME'] = $holidayArray[$i]->CALENDAR_HOLIDAY_NAME;
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_START'] = $holidayArray[$i]->CALENDAR_HOLIDAY_START;
$holidayFixArray[$i+1]['CALENDAR_HOLIDAY_END'] = $holidayArray[$i]->CALENDAR_HOLIDAY_END;
@@ -274,10 +267,10 @@ class adminProxy extends HttpProxyController
//}
//[ CALENDAR_STATUS BUSINESS_DAY_STATUS HOLIDAY_STATUS
if($_POST['BUSINESS_DAY_STATUS']=="INACTIVE") {
if ($_POST['BUSINESS_DAY_STATUS']=="INACTIVE") {
unset($_POST['BUSINESS_DAY_STATUS']);
}
if($_POST['HOLIDAY_STATUS']=="INACTIVE") {
if ($_POST['HOLIDAY_STATUS']=="INACTIVE") {
unset($_POST['HOLIDAY_STATUS']);
}
//]
@@ -286,7 +279,6 @@ class adminProxy extends HttpProxyController
G::LoadClass('calendar');
$calendarObj=new calendar();
$calendarObj->saveCalendarInfo($form);
echo "{success: true}";
}
@@ -295,21 +287,21 @@ class adminProxy extends HttpProxyController
* @param object $params
* @return array $data
*/
function testingOption($params){
public function testingOption($params)
{
$data['success'] = true;
$data['optionAuthS'] = $params->optionAuthS;
return $data;
}// end testingOption function
}
/**
* saving the authentication source data
* @param object $params
* @return array $data
*/
function saveAuthSources($params){
public function saveAuthSources($params)
{
global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
@@ -336,34 +328,31 @@ class adminProxy extends HttpProxyController
foreach ($params as $sField => $sValue) {
if (in_array($sField, $aCommonFields)) {
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
}
else {
} else {
$aData[$sField] = ($sValue=='Active Directory')?'ad':$sValue;
}
}
$aFields['AUTH_SOURCE_DATA'] = $aData;
if ($aFields['AUTH_SOURCE_UID'] == '') {
$RBAC->createAuthSource($aFields);
}
else {
} else {
$RBAC->updateAuthSource($aFields);
}
$data=array();
$data['success'] = true;
return $data;
}//end saveAuthSoruces function
}
/**
* for Test email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function testConnection($params) {
public function testConnection($params)
{
G::LoadClass('net');
G::LoadThirdParty('phpmailer', 'class.smtp');
if ($_POST['typeTest'] == 'MAIL')
{
if ($_POST['typeTest'] == 'MAIL') {
define("SUCCESSFUL", 'SUCCESSFUL');
define("FAILED", 'FAILED');
$mail_to = $_POST['mail_to'];
@@ -388,9 +377,9 @@ class adminProxy extends HttpProxyController
$response = array('success' => $resp->status);
if ($resp->status == false)
if ($resp->status == false) {
$response['msg'] = G::LoadTranslation('ID_SENDMAIL_NOT_INSTALLED');
}
echo G::json_encode($response);
die;
}
@@ -437,20 +426,17 @@ class adminProxy extends HttpProxyController
$this->success = $Server->getErrno() == 0;
$this->msg = $this->result ? 'success' : $Server->error;
break;
case 2:
$Server->scannPort($port);
$this->success = $Server->getErrno() == 0; //'Successfull'.$smtp->status;
$this->msg = $this->result ? '' : $Server->error;
break;
case 3: //try to connect to host
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
}
else {
} else {
$host = $srv;
}
@@ -459,17 +445,14 @@ class adminProxy extends HttpProxyController
$this->success = $smtp->Connect(($ssl ? 'ssl://':'').$server, $port, $timeout);
$this->msg = $this->result ? '' : $Server->error;
break;
case 4: //try login to host
if($auth_required == 'true') {
if ($auth_required == 'true') {
try {
if (preg_match('/^(.+):([0-9]+)$/', $srv, $hostinfo)) {
$server = $hostinfo[1];
$port = $hostinfo[2];
}
else {
} else {
$server = $srv;
}
if (strtoupper($UseSecureCon)=='TLS') {
@@ -484,47 +467,38 @@ class adminProxy extends HttpProxyController
$ssl = (strtoupper($UseSecureCon) == 'ssl');
$server = $_POST['server'];
if(strtoupper($UseSecureCon) == 'SSL') {
if (strtoupper($UseSecureCon) == 'SSL') {
$resp = $smtp->Connect(('ssl://').$server, $port, $timeout);
}
else {
} else {
$resp = $smtp->Connect($server, $port, $timeout);
}
if ($resp) {
$hello = $_SERVER['SERVER_NAME'];
$smtp->Hello($hello);
if (strtoupper($UseSecureCon) == 'TLS') {
$smtp->Hello($hello);
}
if( $smtp->Authenticate($user, $passwd) ) {
if ( $smtp->Authenticate($user, $passwd) ) {
$this->success = true;
}
else {
} else {
$this->success = false;
$this->msg = $smtp->error['error'];
}
}
else {
} else {
$this->success = false;
$this->msg = $smtp->error['error'];
}
}
catch (Exception $e) {
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
}
else {
} else {
$this->success = true;
$this->msg = 'No authentication required!';
}
break;
case 5: //send a test mail
if($SendaTestMail == 'true') {
case 5:
if ($SendaTestMail == 'true') {
try {
$_POST['FROM_NAME'] = 'Process Maker O.S. [Test mail]';
$_POST['FROM_EMAIL'] = $user;
@@ -535,36 +509,29 @@ class adminProxy extends HttpProxyController
$_POST['MESS_PASSWORD'] = $passwd;
$_POST['TO'] = $Mailto;
if($auth_required == 'true') {
if ($auth_required == 'true') {
$_POST['SMTPAuth'] = true;
}
else {
} else {
$_POST['SMTPAuth'] = false;
}
if (strtolower($_POST["UseSecureCon"]) != "no") {
$_POST["SMTPSecure"] = $_POST["UseSecureCon"];
}
if ($_POST['UseSecureCon'] == 'ssl') {
$_POST['MESS_SERVER'] = 'ssl://'.$_POST['MESS_SERVER'];
}
$resp = $this->sendTestMail();
if ($resp->status == '1') {
$this->success=true;
}
else {
} else {
$this->success=false;
$this->msg=$smtp->error['error'];
}
}
catch (Exception $e) {
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
}
else {
} else {
$this->success=true;
$this->msg='jump this step';
}
@@ -576,8 +543,8 @@ class adminProxy extends HttpProxyController
* for send email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function sendTestMail() {
public function sendTestMail()
{
global $G_PUBLISH;
G::LoadClass("system");
G::LoadClass('spool');
@@ -590,11 +557,9 @@ class adminProxy extends HttpProxyController
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
case 'PHPMAILER':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2');
break;
case 'OPENMAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3');
break;
@@ -648,8 +613,7 @@ class adminProxy extends HttpProxyController
$o->status = true;
$o->success = true;
$o->msg = G::LoadTranslation('ID_MAIL_TEST_SUCCESS');
}
else {
} else {
$o->status = false;
$o->success = false;
$o->msg = $oSpool->error;
@@ -661,10 +625,9 @@ class adminProxy extends HttpProxyController
* getting Save email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function saveConfiguration() {
public function saveConfiguration()
{
require_once 'classes/model/Configuration.php';
try {
$oConfiguration = new Configuration();
$aFields['MESS_PASSWORD'] = $_POST['passwd'];
@@ -687,7 +650,7 @@ class adminProxy extends HttpProxyController
}
$aFields['MESS_PASSWORD'] = $passwd;
if ($aFields['MESS_PASSWORD'] != '') { // for plain text
if ($aFields['MESS_PASSWORD'] != '') {
$aFields['MESS_PASSWORD'] = 'hash:'.$aFields['MESS_PASSWORD'];
$aFields['MESS_PASSWORD'] = G::encrypt($aFields['MESS_PASSWORD'],'EMAILENCRYPT');
}
@@ -714,9 +677,9 @@ class adminProxy extends HttpProxyController
$UsrUid='';
$AppUid='';
if($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) {
if ($oConfiguration->exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)) {
$oConfiguration->update(
array(
array (
'CFG_UID' => 'Emails',
'OBJ_UID' => '',
'CFG_VALUE' => serialize($aFields),
@@ -727,8 +690,7 @@ class adminProxy extends HttpProxyController
);
$this->success='true';
$this->msg='Saved';
}
else {
} else {
$oConfiguration->create(
array(
'CFG_UID' => 'Emails',
@@ -742,8 +704,7 @@ class adminProxy extends HttpProxyController
$this->success='true';
$this->msg='Saved';
}
}
catch (Exception $e) {
} catch (Exception $e) {
$this->success= false;
$this->msg = $e->getMessage();
}
@@ -753,8 +714,8 @@ class adminProxy extends HttpProxyController
* loadFields for email configuration
* @autor Alvaro <alvaro@colosa.com>
*/
public function loadFields() {
public function loadFields()
{
G::loadClass('configuration');
$oConfiguration = new Configurations();
@@ -796,6 +757,7 @@ class adminProxy extends HttpProxyController
G::mk_dir ( $dir );
$i = 0;
$images = array();
/** if we have at least one image it's load */
if (file_exists($dir)) {
if ($handle = opendir($dir)) {
@@ -804,12 +766,9 @@ class adminProxy extends HttpProxyController
$extention = explode(".", $file);
$aImageProp = getimagesize($dir . '/' . $file, $info);
$sfileExtention = strtoupper($extention[count($extention)-1]);
if( in_array($sfileExtention, array('JPG', 'JPEG', 'PNG', 'GIF') ) ) {
if ( in_array($sfileExtention, array('JPG', 'JPEG', 'PNG', 'GIF') ) ) {
$check = (!strcmp($file, $sPhotoSelect)) ? '/images/toadd.png' : '/images/delete.png';
$onclick = (strcmp($file, $sPhotoSelect)) ? "onclick ='deleteLogo(\" $file \");return false;'" : '';
if ($i == 0) {
$i++;
}
@@ -831,12 +790,13 @@ class adminProxy extends HttpProxyController
echo G::json_encode($o);
exit();
}
/**
* Change Name logo
* @param type $snameLogo
* @return type $snameLogo
*/
function changeNamelogo($snameLogo)
public function changeNamelogo($snameLogo)
{
$snameLogo = preg_replace("/[áàâãª]/", "a", $snameLogo);
$snameLogo = preg_replace("/[ÁÀÂÃ]/", "A", $snameLogo);
@@ -854,6 +814,7 @@ class adminProxy extends HttpProxyController
$snameLogo = str_replace( "[Ñ]", "N", $snameLogo);
return ($snameLogo);
}
/**
* Create Thumb
* @param type $img_file
@@ -861,7 +822,7 @@ class adminProxy extends HttpProxyController
* @param type $thumb_path
* @param type $img_type
*/
function createThumb($img_file, $ori_path, $thumb_path, $img_type)
public function createThumb($img_file, $ori_path, $thumb_path, $img_type)
{
$path = $ori_path;
$img = $path.$img_file;
@@ -890,14 +851,14 @@ class adminProxy extends HttpProxyController
// square
$tmp_width = $square_size;
$tmp_height = $square_size;
} else if ($img_height < $img_width) {
} elseif ($img_height < $img_width) {
// wide
$tmp_height = $square_size;
$tmp_width = intval(($img_width / $img_height) * $square_size);
if ($tmp_width % 2 != 0) {
$tmp_width++;
}
} else if ($img_height > $img_width) {
} elseif ($img_height > $img_width) {
$tmp_width = $square_size;
$tmp_height = intval(($img_height / $img_width) * $square_size);
if (($tmp_height % 2) != 0) {
@@ -946,10 +907,8 @@ class adminProxy extends HttpProxyController
$img_thumb_square = imagecreatefromgif($thumb);
break;
}
$thumb_width = imagesx($img_thumb_square);
$thumb_height = imagesy($img_thumb_square);
if ($thumb_height < $thumb_width) {
// wide
$x_src = ($thumb_width - $square_size) / 2;
@@ -957,16 +916,14 @@ class adminProxy extends HttpProxyController
$img_final = imagecreatetruecolor($square_size, $square_size);
imagecopy($img_final, $img_thumb_square, 0, 0,
$x_src, $y_src, $square_size, $square_size);
}
else if ($thumb_height > $thumb_width) {
} elseif ($thumb_height > $thumb_width) {
// landscape
$x_src = 0;
$y_src = ($thumb_height - $square_size) / 2;
$img_final = imagecreatetruecolor($square_size, $square_size);
imagecopy($img_final, $img_thumb_square, 0, 0,
$x_src, $y_src, $square_size, $square_size);
}
else {
} else {
$img_final = imagecreatetruecolor($square_size, $square_size);
imagecopy($img_final, $img_thumb_square, 0, 0,
0, 0, $square_size, $square_size);
@@ -995,7 +952,7 @@ class adminProxy extends HttpProxyController
* Upload Image
* @global type $_FILES
*/
function uploadImage()
public function uploadImage()
{
//!dataSystem
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
@@ -1028,7 +985,6 @@ class adminProxy extends HttpProxyController
if (in_array($_FILES['img']['type'], $allowedType)) {
// max upload file is 500 KB
if ($_FILES['img']['size'] <= 500000) {
$formf = $_FILES['img'];
$namefile = $formf['name'];
$typefile = $formf['type'];
@@ -1037,43 +993,34 @@ class adminProxy extends HttpProxyController
$aMessage1 = array();
$fileName = trim(str_replace(' ', '_', $namefile));
$fileName = self::changeNamelogo($fileName);
G::uploadFile($tmpFile, $dir, 'tmp' . $fileName);
try {
if (extension_loaded('exif')) {
$typeMime = exif_imagetype($dir . '/'. 'tmp'.$fileName);
}
else {
} else {
$arrayInfo = getimagesize($dir . '/' . 'tmp' . $fileName);
$typeMime = $arrayInfo[2];
}
if ($typeMime == $allowedTypeArray['index' . base64_encode($_FILES['img']['type'])]) {
$error = false;
try {
list($imageWidth, $imageHeight, $imageType) = @getimagesize($dir . '/' . 'tmp' . $fileName);
G::resizeImage($dir . '/tmp' . $fileName, $imageWidth, 49, $dir . '/' . $fileName);
}
catch (Exception $e) {
} catch (Exception $e) {
$error = $e->getMessage();
}
$uploaded++;
}
else {
} else {
$failed = "3";
}
unlink ($dir . '/tmp' . $fileName);
}
catch (Exception $e) {
} catch (Exception $e) {
$failed = "3";
}
}
else {
} else {
$failed = "2";
}
}
else if ($_FILES['img']['type'] != '') {
} elseif ($_FILES['img']['type'] != '') {
$failed = "1";
}
@@ -1085,7 +1032,7 @@ class adminProxy extends HttpProxyController
* Get Name Current Logo
* @return type
*/
function getNameCurrentLogo()
public function getNameCurrentLogo()
{
G::LoadClass('replacementLogo');
$upload = new replacementLogo();
@@ -1099,12 +1046,12 @@ class adminProxy extends HttpProxyController
* @param type $selectLogo
* @return type int value
*/
function isCurrentLogo()
public function isCurrentLogo()
{
$arrayImg = explode(";", $_POST['selectLogo']);
foreach ($arrayImg as $imgname) {
if ($imgname != "") {
if( strcmp($imgname, self::getNameCurrentLogo()) == 0 ) {
if ( strcmp($imgname, self::getNameCurrentLogo()) == 0 ) {
echo '{success: true}';
exit();
}
@@ -1120,7 +1067,7 @@ class adminProxy extends HttpProxyController
* @param
* @return string '{success: true | false}'
*/
function deleteImage()
public function deleteImage()
{
//!dataSystem
$ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
@@ -1134,15 +1081,14 @@ class adminProxy extends HttpProxyController
$arrayImg = explode(";", $_POST['images']);
foreach ($arrayImg as $imgname) {
if ($imgname != "") {
if( strcmp($imgname, self::getNameCurrentLogo()) != 0 ) {
if(file_exists($dir . '/' . $imgname)) {
if ( strcmp($imgname, self::getNameCurrentLogo()) != 0 ) {
if (file_exists($dir . '/' . $imgname)) {
unlink ($dir . '/' . $imgname);
}
if(file_exists($dir . '/tmp' . $imgname)) {
if (file_exists($dir . '/tmp' . $imgname)) {
unlink ($dir . '/tmp' . $imgname);
}
}
else {
} else {
echo '{success: false}';
exit();
}
@@ -1157,13 +1103,13 @@ class adminProxy extends HttpProxyController
* @global type $_REQUEST
* @global type $RBAC
*/
function replacementLogo()
public function replacementLogo()
{
global $_REQUEST;
$sfunction = $_REQUEST['nameFunction'];
$_GET['NAMELOGO'] = $_REQUEST['NAMELOGO'];
try {//ini_set('display_errors','1');
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_LOGIN')) {
case -2:
@@ -1210,8 +1156,7 @@ class adminProxy extends HttpProxyController
G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
break;
}
}
catch (Exception $oException) {
} catch (Exception $oException) {
die($oException->getMessage());
}
exit();
@@ -1221,7 +1166,7 @@ class adminProxy extends HttpProxyController
* Show Logo
* @param type $imagen
*/
function showLogo($imagen)
public function showLogo($imagen)
{
$info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
@@ -1229,8 +1174,7 @@ class adminProxy extends HttpProxyController
header("Content-type: {$info['mime']}");
fpassthru($fp);
exit;
}
else {
} else {
throw new Exception("Image format not valid");
}
}
@@ -1240,7 +1184,7 @@ class adminProxy extends HttpProxyController
* @param type $dir
* @param type $newDir
*/
function cpyMoreLogos($dir,$newDir)
public function cpyMoreLogos($dir, $newDir)
{
if (file_exists($dir)) {
if (($handle = opendir($dir))) {
@@ -1250,7 +1194,6 @@ class adminProxy extends HttpProxyController
$aImageProp = getimagesize($dir . '/' . $file, $info);
$sfileExtention = strtoupper($extention[count($extention)-1]);
if ( in_array($sfileExtention, array('JPG', 'JPEG', 'PNG', 'GIF') ) ) {
$dir1 = $dir . PATH_SEP . $file;
$dir2 = $newDir . PATH_SEP . $file;
copy($dir1, $dir2);
@@ -1265,7 +1208,7 @@ class adminProxy extends HttpProxyController
/**
* Show Logo File
*/
function showLogoFile()
public function showLogoFile()
{
$_GET['id'] = $_REQUEST['id'];
@@ -1276,16 +1219,13 @@ class adminProxy extends HttpProxyController
if (is_file($imagen)) {
self::showLogo($imagen);
}
else {
} else {
$newDir = PATH_DATA . "sites" . PATH_SEP.str_replace("sys", "", $ainfoSite[1]).PATH_SEP."files/logos";
$dir = PATH_HOME . "public_html/files/logos";
if (!is_dir($newDir)) {
G::mk_dir($newDir);
}
//this function does copy all logos from public_html/files/logos to /shared/site/yourSite/files/logos
//cpyMoreLogos($dir,$newDir);
$newDir .= PATH_SEP.$base64Id;
$dir .= PATH_SEP.$base64Id;
copy($dir,$newDir);
@@ -1295,5 +1235,5 @@ class adminProxy extends HttpProxyController
die;
exit();
}
}