From: <dai...@us...> - 2014-03-27 08:21:13
|
Revision: 6643 http://sourceforge.net/p/web-erp/reponame/6643 Author: daintree Date: 2014-03-27 08:21:10 +0000 (Thu, 27 Mar 2014) Log Message: ----------- Serakfalcon: fixed findLogoFile function in includes/session.inc Modified Paths: -------------- trunk/doc/Change.log trunk/includes/session.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2014-03-27 08:05:36 UTC (rev 6642) +++ trunk/doc/Change.log 2014-03-27 08:21:10 UTC (rev 6643) @@ -1,5 +1,6 @@ webERP Change Log +26/3/14 Serakfalcon: fixed findLogoFile function in includes/session.inc 24/3/14 Phil: Removed DefaultTheme configuration parameter - unecessary as noted by Serafalcon 23/03/14 Exson: Fixed the no defined variable bugs in WorkOrderIssue.php. Reported by Tim. 23/03/14 Exson: Fixed the bug that the search results shows only limited to DisplayRecordsMax which does not make sense due to pagination in WorkOrderIssue.php. Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2014-03-27 08:05:36 UTC (rev 6642) +++ trunk/includes/session.inc 2014-03-27 08:21:10 UTC (rev 6643) @@ -211,38 +211,14 @@ */ function findLogoFile($CompanyDir, $PathPrefix) { - $dir = $PathPrefix.'companies/' . $CompanyDir . '/'; - $DirHandle = dir($dir); - while ($DirEntry = $DirHandle->read() ){ - if ($DirEntry != '.' AND $DirEntry !='..'){ - $InCompanyDir[] = $DirEntry; //make an array of all files under company directory - } - } //loop through list of files in the company directory - if ($InCompanyDir !== FALSE) { - foreach($InCompanyDir as $logofilename) { - if (strncasecmp($logofilename,'logo.png',8) === 0 AND - is_readable($dir . $logofilename) AND - is_file($dir . $logofilename)) { - $logo = $logofilename; - break; - } - } - if (!isset($logo)) { - foreach($InCompanyDir as $logofilename) { - if (strncasecmp($logofilename,'logo.jpg',8) === 0 AND - is_readable($dir . $logofilename) AND - is_file($dir . $logofilename)) { - $logo = $logofilename; - break; - } - } - } - if (empty($logo)) { - return null; - } else { - return 'companies/' .$CompanyDir .'/'. $logo; - } - } //end listing of files under company directory is not empty + $result = null; + $dir = $PathPrefix . 'companies/' . $CompanyDir; + if (file_exists($dir . '/logo.png')) { + $result = 'companies/' . $CompanyDir . '/logo.png'; + } elseif (file_exists($dir . '/logo.jpg')) { + $result = 'companies/' . $CompanyDir . '/logo.jpg'; + } + return $result; } /* Find a logo in companies/<company of this session> */ |