tutto cho che serve phoca
This commit is contained in:
		| @ -0,0 +1,26 @@ | ||||
| <?php | ||||
| /* | ||||
|  * @package Joomla 1.5 | ||||
|  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * | ||||
|  * @component Phoca Gallery | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined( '_JEXEC' ) or die( 'Restricted access' ); | ||||
| use Joomla\CMS\Language\Text; | ||||
|  | ||||
| class PhocaDownloadException | ||||
| { | ||||
|  | ||||
| 	public static function renderErrorInfo ($msg, $jText = false){ | ||||
|  | ||||
| 		if ($jText) { | ||||
| 			return '<div class="alert alert-danger pg-error-info">'.Text::_($msg).'</div>'; | ||||
| 		} else { | ||||
| 			return '<div class="alert alert-danger pg-error-info">'.$msg.'</div>'; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
| @ -0,0 +1,24 @@ | ||||
| <?php | ||||
| /* @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @extension Phoca Extension | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined( '_JEXEC' ) or die( 'Restricted access' ); | ||||
| class PhocaDownloadExternal | ||||
| { | ||||
| 	public static function checkOSE($fileName) { | ||||
| 		if (file_exists(JPATH_SITE.'/components/com_osemsc/init.php')  | ||||
| 		&& file_exists(JPATH_ADMINISTRATOR.'/components/com_ose_cpu/define.php')) { | ||||
|             require_once(JPATH_SITE.'components/com_osemsc/init.php'); | ||||
|             oseRegistry :: call('content')->checkAccess('phoca', 'category', $fileName->catid); | ||||
|         } else if (file_exists(JPATH_ADMINISTRATOR . "/components/com_osemsc/warehouse/api.php")) { | ||||
|             require_once (JPATH_ADMINISTRATOR . "/components/com_osemsc/warehouse/api.php"); | ||||
|             $checkmsc = new OSEMSCAPI(); | ||||
|             $checkmsc->ACLCheck("phoca", "cat", $fileName->catid, true); | ||||
|         } | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
| @ -0,0 +1 @@ | ||||
| <html><body bgcolor="#FFFFFF"></body></html> | ||||
| @ -0,0 +1,127 @@ | ||||
| <?php | ||||
| /* @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @extension Phoca Extension | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined( '_JEXEC' ) or die( 'Restricted access' ); | ||||
| use Joomla\CMS\Factory; | ||||
|  | ||||
| class PhocaDownloadSettings | ||||
| { | ||||
| 	public static function getManagerGroup($manager) { | ||||
|  | ||||
| 		$group = array(); | ||||
| 		switch ($manager) { | ||||
| 			case 'icon': | ||||
| 			case 'iconspec1': | ||||
| 			case 'iconspec2': | ||||
| 				$group['f'] = 2;//File | ||||
| 				$group['i'] = 1;//Image | ||||
| 				$group['t'] = 'icon';//Text | ||||
| 				$group['c']	= '&tmpl=component'; | ||||
| 			break; | ||||
|  | ||||
|  | ||||
| 			case 'image': | ||||
| 				$group['f'] = 2;//File | ||||
| 				$group['i'] = 1;//Image | ||||
| 				$group['t'] = 'image';//Text | ||||
| 				$group['c']	= '&tmpl=component'; | ||||
| 			break; | ||||
|  | ||||
| 			case 'filepreview': | ||||
| 				$group['f'] = 3; | ||||
| 				$group['i'] = 1; | ||||
| 				$group['t'] = 'filename'; | ||||
| 				$group['c']	= '&tmpl=component'; | ||||
| 			break; | ||||
|  | ||||
| 			case 'fileplay': | ||||
| 				$group['f'] = 3; | ||||
| 				$group['i'] = 0; | ||||
| 				$group['t'] = 'filename'; | ||||
| 				$group['c']	= '&tmpl=component'; | ||||
| 			break; | ||||
|  | ||||
| 			case 'filemultiple': | ||||
| 				$group['f'] = 1; | ||||
| 				$group['i'] = 0; | ||||
| 				$group['t'] = 'filename'; | ||||
| 				$group['c']	= ''; | ||||
| 			break; | ||||
|  | ||||
| 			case 'file': | ||||
| 			default: | ||||
| 				$group['f'] = 1; | ||||
| 				$group['i'] = 0; | ||||
| 				$group['t'] = 'filename'; | ||||
| 				$group['c']	= '&tmpl=component'; | ||||
| 			break; | ||||
| 		} | ||||
| 		return $group; | ||||
| 	} | ||||
|  | ||||
| 	public static function getDefaultAllowedMimeTypesDownload() { | ||||
| 		return '{hqx=application/mac-binhex40}{cpt=application/mac-compactpro}{csv=text/x-comma-separated-values}{bin=application/macbinary}{dms=application/octet-stream}{lha=application/octet-stream}{lzh=application/octet-stream}{exe=application/octet-stream}{class=application/octet-stream}{psd=application/x-photoshop}{so=application/octet-stream}{sea=application/octet-stream}{dll=application/octet-stream}{oda=application/oda}{pdf=application/pdf}{ai=application/postscript}{eps=application/postscript}{ps=application/postscript}{smi=application/smil}{smil=application/smil}{mif=application/vnd.mif}{xls=application/vnd.ms-excel}{ppt=application/powerpoint}{wbxml=application/wbxml}{wmlc=application/wmlc}{dcr=application/x-director}{dir=application/x-director}{dxr=application/x-director}{dvi=application/x-dvi}{gtar=application/x-gtar}{gz=application/x-gzip}{php=application/x-httpd-php}{php4=application/x-httpd-php}{php3=application/x-httpd-php}{phtml=application/x-httpd-php}{phps=application/x-httpd-php-source}{js=application/x-javascript}{swf=application/x-shockwave-flash}{sit=application/x-stuffit}{tar=application/x-tar}{tgz=application/x-tar}{xhtml=application/xhtml+xml}{xht=application/xhtml+xml}{zip=application/x-zip}{mid=audio/midi}{midi=audio/midi}{mpga=audio/mpeg}{mp2=audio/mpeg}{mp3=audio/mpeg}{aif=audio/x-aiff}{aiff=audio/x-aiff}{aifc=audio/x-aiff}{ram=audio/x-pn-realaudio}{rm=audio/x-pn-realaudio}{rpm=audio/x-pn-realaudio-plugin}{ra=audio/x-realaudio}{rv=video/vnd.rn-realvideo}{wav=audio/x-wav}{bmp=image/bmp}{gif=image/gif}{jpeg=image/jpeg}{jpg=image/jpeg}{jpe=image/jpeg}{png=image/png}{tiff=image/tiff}{tif=image/tiff}{css=text/css}{html=text/html}{htm=text/html}{shtml=text/html}{txt=text/plain}{text=text/plain}{log=text/plain}{rtx=text/richtext}{rtf=text/rtf}{xml=text/xml}{xsl=text/xml}{mpeg=video/mpeg}{mpg=video/mpeg}{mpe=video/mpeg}{qt=video/quicktime}{mov=video/quicktime}{avi=video/x-msvideo}{flv=video/x-flv}{movie=video/x-sgi-movie}{doc=application/msword}{xl=application/excel}{eml=message/rfc822}{pptx=application/vnd.openxmlformats-officedocument.presentationml.presentation}{xlsx=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet}{docx=application/vnd.openxmlformats-officedocument.wordprocessingml.document}{rar=application/x-rar-compressed}{odb=application/vnd.oasis.opendocument.database}{odc=application/vnd.oasis.opendocument.chart}{odf=application/vnd.oasis.opendocument.formula}{odg=application/vnd.oasis.opendocument.graphics}{odi=application/vnd.oasis.opendocument.image}{odm=application/vnd.oasis.opendocument.text-master}{odp=application/vnd.oasis.opendocument.presentation}{ods=application/vnd.oasis.opendocument.spreadsheet}{odt=application/vnd.oasis.opendocument.text}{sxc=application/vnd.sun.xml.calc}{sxd=application/vnd.sun.xml.draw}{sxg=application/vnd.sun.xml.writer.global}{sxi=application/vnd.sun.xml.impress}{sxm=application/vnd.sun.xml.math}{sxw=application/vnd.sun.xml.writer}{mp4=video/mp4}{mp4=application/octet-stream}'; | ||||
| 	} | ||||
|  | ||||
| 	public static function getDefaultAllowedMimeTypesUpload() { | ||||
| 		return '{pdf=application/pdf}{ppt=application/powerpoint}{gz=application/x-gzip}{tar=application/x-tar}{tgz=application/x-tar}{zip=application/x-zip}{bmp=image/bmp}{gif=image/gif}{jpeg=image/jpeg}{jpg=image/jpeg}{jpe=image/jpeg}{png=image/png}{tiff=image/tiff}{tif=image/tiff}{txt=text/plain}{mpeg=video/mpeg}{mpg=video/mpeg}{mpe=video/mpeg}{qt=video/quicktime}{mov=video/quicktime}{avi=video/x-msvideo}{flv=video/x-flv}{doc=application/msword}{mp4=video/mp4}{mp4=application/octet-stream}'; | ||||
| 	} | ||||
|  | ||||
| 	public static function getHTMLTagsUpload() { | ||||
| 		return array('abbr','acronym','address','applet','area','audioscope','base','basefont','bdo','bgsound','big','blackface','blink','blockquote','body','bq','br','button','caption','center','cite','code','col','colgroup','comment','custom','dd','del','dfn','dir','div','dl','dt','em','embed','fieldset','fn','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','iframe','ilayer','img','input','ins','isindex','keygen','kbd','label','layer','legend','li','limittext','link','listing','map','marquee','menu','meta','multicol','nobr','noembed','noframes','noscript','nosmartquotes','object','ol','optgroup','option','param','plaintext','pre','rt','ruby','s','samp','script','select','server','shadow','sidebar','small','spacer','span','strike','strong','style','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','ul','var','wbr','xml','xmp','!DOCTYPE', '!--'); | ||||
| 	} | ||||
|  | ||||
| 	public static function getLayoutText($type) { | ||||
|  | ||||
| 		$db = Factory::getDBO(); | ||||
|  | ||||
| 		$query = 'SELECT a.'.$type | ||||
| 		.' FROM #__phocadownload_layout AS a'; | ||||
|  | ||||
| 		$db->setQuery($query, 0, 1); | ||||
| 		$layout = $db->loadObject(); | ||||
|  | ||||
| 		/*if (!$db->query()) { | ||||
| 			throw new Exception($db->getErrorMsg(), 500); | ||||
| 			return false; | ||||
| 		}*/ | ||||
|  | ||||
| 		if (isset($layout->$type)) { | ||||
| 			return $layout->$type; | ||||
| 		} | ||||
|  | ||||
| 		return ''; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public static function getLayoutParams($type) { | ||||
|  | ||||
| 		$params = array(); | ||||
| 		switch($type) { | ||||
|  | ||||
| 			case 'categories': | ||||
| 				$params['style']		= array('pd-title','pd-desc', 'pd-subcategory', 'pd-no-subcat');//'pd-', | ||||
| 				$params['search']		= array('{pdtitle}','{pddescription}', '{pdsubcategories}', '{pdclear}'); | ||||
| 			break; | ||||
|  | ||||
| 			case 'category': | ||||
| 				$params['style']		= array('pd-title','pd-image', 'pd-file', 'pd-fdesc', 'pd-mirrors', 'pd-mirror', 'pd-report', 'pd-rating', 'pd-tags', 'pd-buttons', 'pd-downloads', 'pd-video'); | ||||
| 				$params['search']		= array('{pdtitle}','{pdimage}', '{pdfile}', '{pdfilesize}', '{pdversion}', '{pdlicense}', '{pdauthor}', '{pdauthoremail}', '{pdfiledate}', '{pddownloads}', '{pddescription}', '{pdfeatures}', '{pdchangelog}', '{pdnotes}', '{pdmirrorlink1}', '{pdmirrorlink2}', '{pdreportlink}', '{pdrating}', '{pdtags}', '{pdfiledesctop}', '{pdfiledescbottom}', '{pdbuttondownload}', '{pdbuttondetails}', '{pdbuttonpreview}', '{pdbuttonplay}', '{pdvideo}'); | ||||
| 			break; | ||||
|  | ||||
|  | ||||
| 			case 'file': | ||||
| 				$params['style']		= array('pd-title','pd-image', 'pd-file', 'pd-fdesc', 'pd-mirrors', 'pd-mirror', 'pd-report', 'pd-rating', 'pd-tags', 'pd-downloads', 'pd-video'); | ||||
| 				$params['search']		= array('{pdtitle}','{pdimage}', '{pdfile}', '{pdfilesize}', '{pdversion}', '{pdlicense}', '{pdauthor}', '{pdauthoremail}', '{pdfiledate}', '{pddownloads}', '{pddescription}', '{pdfeatures}', '{pdchangelog}', '{pdnotes}', '{pdmirrorlink1}', '{pdmirrorlink2}', '{pdreportlink}', '{pdrating}', '{pdtags}', '{pdvideo}'); | ||||
| 			break; | ||||
| 		} | ||||
|  | ||||
| 		return $params; | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
| @ -0,0 +1,239 @@ | ||||
| <?php | ||||
| /* @package Joomla | ||||
|  * @copyright Copyright (C) Open Source Matters. All rights reserved. | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php | ||||
|  * @extension Phoca Extension | ||||
|  * @copyright Copyright (C) Jan Pavelka www.phoca.cz | ||||
|  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||||
|  */ | ||||
| defined( '_JEXEC' ) or die( 'Restricted access' ); | ||||
|  | ||||
| use Joomla\CMS\Component\ComponentHelper; | ||||
| use Joomla\CMS\Filesystem\Folder; | ||||
| use Joomla\CMS\Installer\Installer; | ||||
| use Joomla\CMS\Factory; | ||||
| use Joomla\CMS\Application\ApplicationHelper; | ||||
| use Joomla\CMS\Plugin\PluginHelper; | ||||
| class PhocaDownloadUtils | ||||
| { | ||||
| 	public static function footer() { | ||||
| 		echo '<div>Powe'.'red b'.'y <a href="ht'.'tp://www.pho'.'ca.c'.'z/pho' | ||||
| 		.'cado'.'wn'.'load" tar'.'get="_bl'.'ank" title="Pho'.'ca Down' .'load">Pho' | ||||
| 		.'ca Downl'.'oad</a></div>'; | ||||
| 	} | ||||
|  | ||||
| 	public static function getExtensionVersion($c = 'phocadownload') { | ||||
| 		$folder = JPATH_ADMINISTRATOR .'/components/com_'.$c; | ||||
| 		if (Folder::exists($folder)) { | ||||
| 			$xmlFilesInDir = Folder::files($folder, '.xml$'); | ||||
| 		} else { | ||||
| 			$folder = JPATH_SITE . '/components/com_'.$c; | ||||
| 			if (Folder::exists($folder)) { | ||||
| 				$xmlFilesInDir = Folder::files($folder, '.xml$'); | ||||
| 			} else { | ||||
| 				$xmlFilesInDir = null; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		$xml_items = array(); | ||||
| 		if (count($xmlFilesInDir)) | ||||
| 		{ | ||||
| 			foreach ($xmlFilesInDir as $xmlfile) | ||||
| 			{ | ||||
| 				if ($data = Installer::parseXMLInstallFile($folder.'/'.$xmlfile)) { | ||||
| 					foreach($data as $key => $value) { | ||||
| 						$xml_items[$key] = $value; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		if (isset($xml_items['version']) && $xml_items['version'] != '' ) { | ||||
| 			return $xml_items['version']; | ||||
| 		} else { | ||||
| 			return ''; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function setVars( $task = '') { | ||||
|  | ||||
| 		$a			= array(); | ||||
| 		$app		= Factory::getApplication(); | ||||
| 		$a['o'] 	= htmlspecialchars(strip_tags($app->input->get('option'))); | ||||
| 		$a['c'] 	= str_replace('com_', '', $a['o']); | ||||
| 		$a['n'] 	= 'Phoca' . ucfirst(str_replace('com_phoca', '', $a['o'])); | ||||
| 		$a['l'] 	= strtoupper($a['o']); | ||||
| 		$a['i']		= 'media/'.$a['o'].'/images/administrator/'; | ||||
| 		$a['s']		= 'media/'.$a['o'].'/css/administrator/'.$a['c'].'.css'; | ||||
| 		$a['task']	= $a['c'] . htmlspecialchars(strip_tags($task)); | ||||
| 		$a['tasks'] = $a['task']. 's'; | ||||
| 		return $a; | ||||
| 	} | ||||
|  | ||||
| 	public static function getAliasName($alias) { | ||||
| 		$alias = ApplicationHelper::stringURLSafe($alias); | ||||
| 		if (trim(str_replace('-', '', $alias)) == '') { | ||||
| 			$alias = Factory::getDate()->format("Y-m-d-H-i-s"); | ||||
| 		} | ||||
| 		return $alias; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public static function strTrimAll($input) { | ||||
| 		$output	= ''; | ||||
| 	    $input	= trim($input); | ||||
| 	    for($i=0;$i<strlen($input);$i++) { | ||||
| 	        if(substr($input, $i, 1) != " ") { | ||||
| 	            $output .= trim(substr($input, $i, 1)); | ||||
| 	        } else { | ||||
| 	            $output .= " "; | ||||
| 	        } | ||||
| 	    } | ||||
| 	    return $output; | ||||
| 	} | ||||
|  | ||||
| 	public static function toArray($value = FALSE) { | ||||
| 		if ($value == FALSE) { | ||||
| 			return array(0 => 0); | ||||
| 		} else if (empty($value)) { | ||||
| 			return array(0 => 0); | ||||
| 		} else if (is_array($value)) { | ||||
| 			return $value; | ||||
| 		} else { | ||||
| 			return array(0 => $value); | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
| 	public static function isURLAddress($url) { | ||||
| 		return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url); | ||||
| 	} | ||||
|  | ||||
| 	public static  function setQuestionmarkOrAmp($url) { | ||||
| 		$isThereQMR = false; | ||||
| 		$isThereQMR = preg_match("/\?/i", $url); | ||||
| 		if ($isThereQMR) { | ||||
| 			return '&'; | ||||
| 		} else { | ||||
| 			return '?'; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public static function getToken($title = '') { | ||||
| 		$salt = md5($title . 'string '. date('s'). mt_rand(0,9999) . str_replace(mt_rand(0,9), mt_rand(0,9999), date('r')). 'end string'); | ||||
| 		$token = hash('sha256', $salt . time()); | ||||
| 		return $token; | ||||
| 	} | ||||
|  | ||||
| 	public static function cleanFolderUrlName($string) { | ||||
| 		$string = str_replace('@', '-', $string); | ||||
| 		$string = str_replace('?', '-', $string); | ||||
| 		$string = str_replace('&', '-', $string); | ||||
| 		$string = str_replace('%', '-', $string); | ||||
| 		return $string; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public static function getIntFromString($string) { | ||||
|  | ||||
| 		if (empty($string)) { | ||||
| 			return 0; | ||||
| 		} | ||||
| 		$int	= '';//$int = 0 | ||||
| 		$parts 	= explode(':', $string); | ||||
| 		if (isset($parts[0])) { | ||||
| 			$int = (int)$parts[0]; | ||||
| 		} | ||||
| 		return $int; | ||||
| 	} | ||||
|  | ||||
|     public static function getInfo() { | ||||
|  | ||||
|         PluginHelper::importPlugin('phocatools'); | ||||
|         $results = Factory::getApplication()->triggerEvent('onPhocatoolsOnDisplayInfo', array('NjI5NTcxNzcxMTc=')); | ||||
|         if (isset($results[0]) && $results[0] === true) { | ||||
|             return ''; | ||||
|         } | ||||
|         return '<div style="text-align:right;color:#ccc;display:block">Powered by <a href="https://www.phoca.cz/phocadownload">Phoca Download</a></div>'; | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| 	public static function filterValue($string, $type = 'html') { | ||||
|  | ||||
| 		switch ($type) { | ||||
|  | ||||
| 			case 'url': | ||||
| 				return rawurlencode($string); | ||||
| 				break; | ||||
|  | ||||
| 			case 'number': | ||||
| 				return preg_replace( '/[^.0-9]/', '', (string)$string ); | ||||
| 				break; | ||||
|  | ||||
| 			case 'number2': | ||||
|        			//return preg_replace( '/[^0-9\.,+-]/', '', $string ); | ||||
|        			return preg_replace( '/[^0-9\.,-]/', '', (string)$string ); | ||||
| 			break; | ||||
|  | ||||
| 			case 'alphanumeric': | ||||
| 				return preg_replace("/[^a-zA-Z0-9]+/", '', (string)$string); | ||||
| 				break; | ||||
|  | ||||
| 			case 'alphanumeric2': | ||||
| 				return preg_replace("/[^\\w-]/", '', (string)$string);// Alphanumeric plus _  - | ||||
| 				break; | ||||
|  | ||||
| 			case 'alphanumeric3': | ||||
| 				return preg_replace("/[^\\w.-]/", '', (string)$string);// Alphanumeric plus _ . - | ||||
| 				break; | ||||
|  | ||||
| 			case 'folder': | ||||
| 			case 'file': | ||||
| 				$string =  preg_replace('/[\"\*\/\\\:\<\>\?\'\|]+/', '', (string)$string); | ||||
| 				return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); | ||||
| 				break; | ||||
|  | ||||
| 			case 'folderpath': | ||||
| 			case 'filepath': | ||||
| 				$string = preg_replace('/[\"\*\:\<\>\?\'\|]+/', '', (string)$string); | ||||
| 				return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); | ||||
| 				break; | ||||
|  | ||||
| 			case 'text': | ||||
| 				return htmlspecialchars(strip_tags((string)$string), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); | ||||
| 				break; | ||||
|  | ||||
| 			case 'html': | ||||
| 			default: | ||||
| 				return htmlspecialchars((string)$string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); | ||||
| 				break; | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	public static function getIp() { | ||||
|  | ||||
|  | ||||
| 		$params 				= ComponentHelper::getParams('com_phocadownload'); | ||||
| 		$store_ip				= $params->get( 'store_ip', 0 ); | ||||
|  | ||||
| 		if ($store_ip == 0) { | ||||
| 			return ''; | ||||
| 		} | ||||
|  | ||||
| 		$ip = false; | ||||
| 		if(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) { | ||||
| 			$ip  = $_SERVER['REMOTE_ADDR']; | ||||
| 		} else { | ||||
| 			$ip  = getenv('HTTP_X_FORWARDED_FOR'); | ||||
| 		} | ||||
| 		if (!$ip) { | ||||
| 			$ip = $_SERVER['REMOTE_ADDR']; | ||||
| 		} | ||||
|  | ||||
| 		return $ip; | ||||
| 	} | ||||
| } | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user