Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * @copyright 2000-2012 Amiro.CMS. All rights reserved. * @version $ Id: ftpget..
Decoded Output download
<?php /**
* @copyright 2000-2012 Amiro.CMS. All rights reserved.
* @version $ Id: ftpgetfile.php 519177 2012-10-10 18:35:05 Artem $
* @size 20351 xkqwswptqixlxswgyzrzxluplpqkxyqpgtmrrrgpgnzszplxguwlrxtgiqwqssxiitrupnir
*/ ?>
<?php foreach(array(5537=>"DOHC|GMW",5538=>"IHSuJQD",5539=>'SQtQWtHr`GOG',5540=>"?zNs?GuYJMW='1'",5541=>'nHt|MnDtZJJQS',5542=>"MS",5543=>"?200?hk",5544=>'idmq?',5545=>"wHntQnt+jQnPtO%?",5546=>"ftGPQtfMJQ",5547=>"IHSuJQ",5548=>"",5549=>'',5550=>"DuYD|DQnS",5551=>"QDOHG|MtQI",5552=>"'",5553=>"QxtQrnZJ|fMJQ",5554=>"nHt|MnDtZJJQS",5555=>"nHt|JHPPQS|Mn",5556=>"'?zNs?MS|IQIYQr='",5557=>"Qxt|SZtZ",5558=>"SHCnJHZS|ZttQIGtD",5559=>"HrSQr|QxGMrQS",5560=>"PZJJQrB",5561=>"ZSIMn",5562=>"'{",5563=>"QDOHG|SMPMtZJD",5564=>"DIZJJ|GMWturQ",5565=>"RhhT|gzTo",5566=>"?zNs?IHSuJQ='",5567=>"ihsUjq|gmwTURqd|gzTo",5568=>"dqRVqR|gRhThwhj",5569=>"HrMPMnZJ|fnZIQ",5570=>"oqzs",5571=>"+",5572=>"|HrSQr|MtQID",5573=>"YZDQ") as $i1=>$i2){$i3=strrev("rtrts");define("I".$i1,$i3($i2,'abcdeghijklmopqswyz ~`!@#%^&*()_-+|{}[];:<>,./?ABCDEGHIJKLMOPQSWYZ','ZYWSQPOMLKJIHGEDCBA?/.,><:;][}{|+-_)(*&^%#@!`~ zywsqpomlkjihgedcba'));} $ActiveModule =I5537; $ActiveUpPage =I5538; $ENABLE_BUFFERING =false; if(isset($_GET["lang"])) {$lang =$lang_data =$_GET["lang"]; }if($_SIDE == "front") {$IILlLI1 =1; require_once $GLOBALS['DEFAULT_INCLUDES_PATH'] .files_subpath. I5539; }require_once $GLOBALS['DEFAULT_INCLUDES_PATH'] .'init.php'; if($_SIDE=="admin"){ $cms =&$adm; $IILlLlI =""; }else{ $cms =&$frn; $IILlLlI =I5540; }if(!$cms->Core->IsInstalled('files')){ TTT1lll(I5541); }$IILlLll =&$cms->Core->GetModule("files"); $buffer =$IILlLll->GetOption("buffer"); $IILlLlL =$IILlLll->GetOption("timelimit"); $id =$cms->VarsGet[I5542]; if(!isset($id)||empty($id)){ TTT1lll('unknown_file'); }$IILlLl1 =""; $IILlLLI =$IILlLll->GetOption("partial_download_on"); $status =$GLOBALS["SERVER_PROTOCOL"].I5543; function GetContentType($IILlLLl, $aMimes){ $IILlLLL =mb_strtoupper(get_file_ext($IILlLLl)); if(isset($aMimes[$IILlLLL])){ $ftype =$aMimes[$IILlLLL]; }else{ $ftype ="application/octet-stream"; }return $ftype; }function TTT1llT($oname, $fsize, $status, $aMimes=false, $IILlLL1 ="") {global $IILlLLI; $IILlL1I =$oname; if(!empty($_SERVER['HTTP_USER_AGENT']) && (mb_strpos($_SERVER['HTTP_USER_AGENT'], I5544) !== false)){ $IILlL1I =rawurlencode($IILlL1I); }Header($status); if(strpos($IILlL1I, ",") !== false){ $IILlL1I =str_replace(",", "_", $IILlL1I); }if(is_array($aMimes)) {$IILlLLL =mb_strtoupper(get_file_ext($oname)); if(isset($aMimes[$IILlLLL])){ $IILlL1l =$aMimes[$IILlLLL]; }else{ $IILlL1l ="application/octet-stream"; }Header("Content-disposition: filename=\"$IILlL1I\""); }else {$IILlL1l ="application/force-download; name=\"".$IILlL1I."\""; Header("Content-Disposition: attachment; filename=\"$IILlL1I\""); }if($IILlLLI) {Header("Accept-Ranges: bytes"); }else {Header("Accept-Ranges: none"); }if(is_array($IILlLL1) && sizeof($IILlLL1) >0) {foreach($IILlLL1 as $key=>$val) {Header($val); }}Header("Content-type: ".$IILlL1l); Header(I5545.$fsize); }function TTT1llI(&$content, $IILlLlL) {set_time_limit($IILlLlL); echo $content; flush(); if(connection_aborted()) {exit; }}function TTT1lll($IILlLl1){ global $cms; header('Content-Type: text/html; charset=UTF-8', true); if($IILlLl1 == 'not_found'){ header('Status: 404 Not Found', true, 404); }$IILlL1L =$cms->Gui->ParseLangFile($GLOBALS["LOCAL_FILES_REL_PATH"]."_admin/templates/lang/ftpgetfile.lng"); $cms->Gui->addBlock("ftpgetfile", $GLOBALS["LOCAL_FILES_REL_PATH"]."_admin/templates/ftpgetfile.tpl"); $IIlIL11 =Array(); $IIlIL11["err_message"] =$IILlL1L[$IILlLl1]; echo $cms->Gui->get(I5546, $IIlIL11); die; }if(!isset($cms->VarsGet[I5547]) || empty($cms->VarsGet[I5547])) {$moduleName ="files"; }else {$IILlL11 =$moduleName =$cms->VarsGet[I5547]; if($moduleName == "gallery" || $moduleName == "eshop") $IILlL11 .= "_item"; if(!$cms->Core->IsInstalled($IILlL11)) {TTT1lll(I5541); }}$filename =I5548; switch($moduleName) {case 'srv_backups': require_once $GLOBALS['CLASSES_PATH'].'CMSBackup.php'; $type ='file'; $filename =$oname =I5549; $file_id =intval($cms->VarsGet[I5542]); if($_SIDE=='front') {$IILlLl1 ='access_denied'; }else {$IILl1II =new CMSBackup($db,$file_id); $meta =$IILl1II->meta(); if(($meta)!==false && $meta['sys_type']==ARCH_SYSTYPE_USER) {$filename =$oname =$IILl1II->TIlIlII(); $IILl1Il =$IILl1II->TIlIlIl(); $sql =I5549; }else {$IILlLl1 ='wrong_request'; }}break; case I5550: $sql ="select attach as name, attach_data as body from cms_subs_sent where id='$id'"; $type ="base"; break; case "eshop": if(!$cms->Core->IsInstalled('eshop_digitals')){ TTT1lll(I5541); }$IILl1IL =&$cms->Core->GetModule("eshop_digitals"); $file_id =intval($cms->VarsGet[I5542]); $IILl1I1 =&$cms->Core->GetModule(I5551); $tableName =$IILl1I1->GetTableName(); $pos =mb_strrpos($tableName, "_items"); $dbTablePrefix =mb_substr($tableName, 0, mb_strlen($tableName) -$pos); $IILl1lI =false; $IILl1ll =false; $IILl1lL =I5548; if($_SIDE!="admin") {$IILl1lL =" AND f.active=1"; $IILl1l1 =$cms->Core->GetModOption("eshop_files", "allow_external_files"); if(!$IILl1l1) {$IILl1lL .= " AND f.is_external_file=0"; }}$type ="file"; $sql ="SELECT f.original_fname, f.filename, f.free_download, f.is_external_file FROM ".$dbTablePrefix."_files AS f WHERE f.id='".$file_id.I5552.$IILl1lL; $db->query($sql); if($db->next_record()) {$aFileData =$db->Record; $IILl1lI =$db->Record["free_download"]; $filename =$db->Record["filename"]; if($IILl1lI) {$oname =$db->Record["original_fname"]; $IILl1ll =true; }if($db->Record["is_external_file"] == 1) {$type =I5553; }}else {$IILlLl1 ="wrong_request"; }if($_SIDE!="admin" && !$IILl1lI) {$order_id =intval($cms->VarsGet["order_id"]); $item_id =intval($cms->VarsGet["item_id"]); $file_id =intval($cms->VarsGet[I5542]); $IILlLl1 =$IILl1IL->IsInstalled()?I5548:I5554; $IILlLl1 =$cms->Member->isLoggedIn()?I5548:I5555; if($IILlLl1 == I5548) {$IILlLl1 ="wrong_request"; if($order_id >0 && $item_id >0) {$userId =$cms->Member->getUserInfo(I5542); $IILl1LI =$IILl1IL->GetOption("download_status"); if(!is_array($IILl1LI)) {$IILl1LI =Array($IILl1LI); }$sql ="SELECT ext_data FROM ".$dbTablePrefix."_orders AS o WHERE o.id='".$order_id.I5556.$userId."' AND o.lang='".$lang."' AND o.status IN('".implode("','", $IILl1LI)."')"; $db->query($sql); if($db->next_record()) {$aExtData =unserialize($db->Record[I5557]); $IILl1Ll =intval($aExtData["eshop_digitals"]["expire"]); if($IILl1Ll >time()) {$sql ="SELECT f.original_fname, f.filename, oi.ext_data FROM ".$dbTablePrefix."_order_items AS oi, ".$dbTablePrefix."_files AS f WHERE oi.id_order='".$order_id."' AND oi.id_product='".$item_id."' AND f.id='".$file_id."' AND f.id_product='".$item_id.I5552.$IILl1lL." AND f.lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $aExtData =unserialize($db->Record[I5557]); $IILl1LL =intval($IILl1IL->GetOption("max_download_attempts")); if(isset($aExtData["eshop_digitals"]["download_attempts"][$id]["rest"])) {$IILl1LL =intval($aExtData["eshop_digitals"][I5558][$id]["rest"]); }if($IILl1LL >0) {$filename =$db->Record["filename"]; $oname =$db->Record["original_fname"]; $IILlLl1 =I5548; }else {$IILlLl1 ="no_attempts"; }}}else {$IILlLl1 =I5559; }}}}}else {if(!$IILl1ll) {$sql ="SELECT f.original_fname, f.filename FROM ".$dbTablePrefix."_files AS f WHERE f.id='".$file_id.I5552.$IILl1lL; }}$IILl1Il =$GLOBALS["PRIVATE_PATH"].$IILl1IL->GetOption("eshop_files_path"); break; case I5560: if(!$cms->Core->IsInstalled('gallery_digitals')){ TTT1lll(I5541); }$IILl1L1 =&$cms->Core->GetModule("gallery_item"); $IILl11I =&$cms->Core->GetModule("gallery_digitals"); $file_id =intval($cms->VarsGet[I5542]); $tableName =$IILl1L1->GetTableName(); $pos =mb_strrpos($tableName, "_items"); $dbTablePrefix =mb_substr($tableName, 0, mb_strlen($tableName) -$pos); $IILl1Il =I5548; if($_SIDE!=I5561) {$order_id =intval($cms->VarsGet["order_id"]); $item_id =intval($cms->VarsGet["item_id"]); $IILlLl1 =$IILl1L1->IsInstalled() ?I5548 :I5554; $IILlLl1 =is_object($cms->Member) && $cms->Member->isLoggedIn()? I5548 :I5555; if($IILlLl1 == I5548) {$IILlLl1 ="wrong_request"; if($order_id >0 && $item_id >0) {$userId =$cms->Member->getUserInfo(I5542); $IILl1LI =$IILl11I->GetOption("download_status"); if(!is_array($IILl1LI)) {$IILl1LI =Array($IILl1LI); }$sql ="SELECT ext_data FROM ".$dbTablePrefix."_orders AS o WHERE o.id='".$order_id.I5556.$userId."' AND o.lang='".$lang."' AND o.status IN('".implode("','", $IILl1LI).I5562; $db->query($sql); $sql =I5548; if($db->next_record()) {$aExtData =unserialize($db->Record[I5557]); $IILl1Ll =intval($aExtData["eshop_digitals"]["expire"]); if($IILl1Ll >time()) {$sql ="SELECT f.ext_popup_picture as popup_picture, f.ext_small_picture as small_picture, f.ext_picture as picture, oi.ext_data FROM ".$dbTablePrefix."_order_items AS oi, ".$dbTablePrefix."_items AS f WHERE oi.id_order='".$order_id."' AND oi.id_product='".$item_id."' AND f.id='".$file_id.I5552.$IILl1lL." AND f.lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $aExtData =unserialize($db->Record[I5557]); $IILl1LL =intval($IILl11I->GetOption("max_download_attempts")); if(isset($aExtData[I5563][I5558][$id]["rest"])) {$IILl1LL =intval($aExtData[I5563][I5558][$id]["rest"]); }if($IILl1LL >0) {$IILl11l =$db->Record["popup_picture"]; if(empty($IILl11l)) $IILl11l =$db->Record["picture"]; if(empty($IILl11l)) $IILl11l =$db->Record[I5564]; $filename =I5548; $IILl1Il =I5548; if(is_file($GLOBALS["ROOT_PATH"].$IILl11l)){ $filename =basename($IILl11l); $IILl1Il =dirname($GLOBALS["ROOT_PATH"].$IILl11l)."/"; }$oname =$filename; $IILlLl1 =I5548; }else {$IILlLl1 ="no_attempts"; }}}else {$IILlLl1 =I5559; }}}}}else{ $sql ="SELECT popup_picture, small_picture, picture FROM ".$dbTablePrefix."_items WHERE id='".$file_id."' AND lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $IILl11l =$db->Record["popup_picture"]; if(empty($IILl11l)) $IILl11l =$db->Record["picture"]; if(empty($IILl11l)) $IILl11l =$db->Record[I5564]; if(is_file($GLOBALS[I5565].$IILl11l)){ $filename =basename($IILl11l); $IILl1Il =dirname($GLOBALS[I5565].$IILl11l)."/"; }$oname =$filename; $IILlLl1 =I5548; }}$type ="file"; break; default: $sql ="select original_fname, filename from cms_files where id='$id' ".$IILlLlI.I5566.$moduleName.I5552; $IILl1Il =$GLOBALS[I5567].$IILlLll->GetOption("files_path"); $type ="file"; break; }if($IILlLl1 == I5548) {switch($type) {case I5553: Header($GLOBALS[I5568].' 301 Moved Permanently'); Header("Location: ".$filename, true, 301); exit(); break; case "file": if($sql != I5548) {$db->query($sql); if($db->next_record()){ $filename =$db->Record["filename"]; $oname =$db->Record[I5569]; }}if(!empty($filename)){ if(empty($oname)) $oname =$filename; $filename =$IILl1Il.$filename; if(file_exists($filename)){ $fsize =filesize($filename); if($fsize){ $fp =fopen($filename, "r"); if($fp){ if($moduleName!="eshop") {$IILl11L =$cms->Core->GetProperty("images_mimes"); }if($_SERVER["REQUEST_METHOD"] == I5570) {TTT1llT($oname, $fsize, $status, $IILl11L); exit; }else {$IILlLL1 =Array(); $IILl111 =0; if($IILlLLI) {if(isset($_SERVER["HTTP_RANGE"])) {$pos =mb_strpos($_SERVER["HTTP_RANGE"], "="); if($pos !==false && $pos >0) {$range =mb_substr($_SERVER["HTTP_RANGE"], $pos +1); $pos =mb_strpos($range, I5571); if($pos !== false) {$IILl111 =intval(mb_substr($range, 0, $pos)); $size =intval(mb_substr($range, $pos +1)); if($size <= 0) {$size =$fsize -1; }if($IILl111 >$size) {$IILl111 =0; $size =$fsize -1; }$IILlLL1[] ="Content-Range: bytes ".$IILl111.I5571.$size."/".$fsize; $status =$GLOBALS[I5568]." 206 Partial Content"; $fsize =$size -$IILl111 +1; fseek($fp, $IILl111); }}}else {$IILlLLI =false; }}if($moduleName=="eshop" && $_SIDE!=I5561 && !$IILl1lI) {$IILLIII =true; if(is_object($oSession)) {if(!$oSession->IssetVar("eshop_digitals_download_".$id)) {$oSession->SetVar("eshop_digitals_download_".$id, strtotime($IILl1IL->GetOption("max_time_for_attempt"))); }else {$IILLIIl =$oSession->GetVar("eshop_digitals_download_".$id); if($IILLIIl >time()) {$IILLIII =false; }else {$oSession->SetVar("eshop_digitals_download_".$id, strtotime($IILl1IL->GetOption("max_time_for_attempt"))); }}}if($IILLIII && $IILl111 <100) {$aExtData[I5563][I5558][$id]["rest"] =$IILl1LL -1; if(!isset($aExtData[I5563][I5558][$id]["initial"])) {$aExtData[I5563][I5558][$id]["initial"] =$IILl1IL->GetOption("max_download_attempts"); }$asql =Array(I5557=>addslashes(serialize($aExtData))); $sql =$db->GenUpdateSQL($dbTablePrefix.I5572, $asql, "WHERE id_order='".$order_id."' AND id_product='".$item_id.I5552); $db->query($sql); }}TTT1llT($oname, $fsize, $status, $IILl11L, $IILlLL1); $IILLIIL =true; while($content =fread($fp, $buffer)) {if($IILl111 == 0 && $IILLIIL) {$IILLIIL =false; if($_SIDE!=I5561 && $IILlLll->GetOption("show_download_counter") && $moduleName=="files" && $IILl111 == 0) {$sql ="UPDATE cms_files SET num_downloaded=num_downloaded+1 WHERE id='".$id.I5552; $IILLII1 =new DB_si; $IILLII1->query($sql); $curTime =time(); $IILLIlI =date("i", $curTime); if($IILLIlI <59) {$IILLIll =59; $hour =date("H", $curTime); $expTime =mktime($hour, $IILLIll, 59); }else {$expTime =strtotime ("+1 hours"); }$cms->Core->Cache->ClearAdd("files", 0, I5548, $expTime); }}TTT1llI($content, $IILlLlL); }die(); exit; }}}}}break; case I5573: $db->query($sql); if($db->next_record()) {$oname =$db->Record["name"]; $fbody =$db->Record["body"]; $fsize =mb_strlen($fbody); $pos =0; TTT1llT($oname, $fsize); while($pos <$fsize) {TTT1llI(mb_substr($fbody, $pos, $buffer), $IILlLlL); $pos += $buffer; }exit; }break; }}if($IILlLl1 != I5549){ TTT1lll($IILlLl1); }TTT1lll('not_found'); ?>
Did this file decode correctly?
Original Code
<?php /**
* @copyright 2000-2012 Amiro.CMS. All rights reserved.
* @version $ Id: ftpgetfile.php 519177 2012-10-10 18:35:05 Artem $
* @size 20351 xkqwswptqixlxswgyzrzxluplpqkxyqpgtmrrrgpgnzszplxguwlrxtgiqwqssxiitrupnir
*/ ?>
<?php foreach(array(5537=>"DOHC|GMW",5538=>"IHSuJQD",5539=>'SQtQWtHr`GOG',5540=>"?zNs?GuYJMW='1'",5541=>'nHt|MnDtZJJQS',5542=>"MS",5543=>"?200?hk",5544=>'idmq?',5545=>"wHntQnt+jQnPtO%?",5546=>"ftGPQtfMJQ",5547=>"IHSuJQ",5548=>"",5549=>'',5550=>"DuYD|DQnS",5551=>"QDOHG|MtQI",5552=>"'",5553=>"QxtQrnZJ|fMJQ",5554=>"nHt|MnDtZJJQS",5555=>"nHt|JHPPQS|Mn",5556=>"'?zNs?MS|IQIYQr='",5557=>"Qxt|SZtZ",5558=>"SHCnJHZS|ZttQIGtD",5559=>"HrSQr|QxGMrQS",5560=>"PZJJQrB",5561=>"ZSIMn",5562=>"'{",5563=>"QDOHG|SMPMtZJD",5564=>"DIZJJ|GMWturQ",5565=>"RhhT|gzTo",5566=>"?zNs?IHSuJQ='",5567=>"ihsUjq|gmwTURqd|gzTo",5568=>"dqRVqR|gRhThwhj",5569=>"HrMPMnZJ|fnZIQ",5570=>"oqzs",5571=>"+",5572=>"|HrSQr|MtQID",5573=>"YZDQ") as $i1=>$i2){$i3=strrev("rtrts");define("I".$i1,$i3($i2,'abcdeghijklmopqswyz ~`!@#%^&*()_-+|{}[];:<>,./?ABCDEGHIJKLMOPQSWYZ','ZYWSQPOMLKJIHGEDCBA?/.,><:;][}{|+-_)(*&^%#@!`~ zywsqpomlkjihgedcba'));} $ActiveModule =I5537; $ActiveUpPage =I5538; $ENABLE_BUFFERING =false; if(isset($_GET["lang"])) {$lang =$lang_data =$_GET["lang"]; }if($_SIDE == "front") {$IILlLI1 =1; require_once $GLOBALS['DEFAULT_INCLUDES_PATH'] .files_subpath. I5539; }require_once $GLOBALS['DEFAULT_INCLUDES_PATH'] .'init.php'; if($_SIDE=="admin"){ $cms =&$adm; $IILlLlI =""; }else{ $cms =&$frn; $IILlLlI =I5540; }if(!$cms->Core->IsInstalled('files')){ TTT1lll(I5541); }$IILlLll =&$cms->Core->GetModule("files"); $buffer =$IILlLll->GetOption("buffer"); $IILlLlL =$IILlLll->GetOption("timelimit"); $id =$cms->VarsGet[I5542]; if(!isset($id)||empty($id)){ TTT1lll('unknown_file'); }$IILlLl1 =""; $IILlLLI =$IILlLll->GetOption("partial_download_on"); $status =$GLOBALS["SERVER_PROTOCOL"].I5543; function GetContentType($IILlLLl, $aMimes){ $IILlLLL =mb_strtoupper(get_file_ext($IILlLLl)); if(isset($aMimes[$IILlLLL])){ $ftype =$aMimes[$IILlLLL]; }else{ $ftype ="application/octet-stream"; }return $ftype; }function TTT1llT($oname, $fsize, $status, $aMimes=false, $IILlLL1 ="") {global $IILlLLI; $IILlL1I =$oname; if(!empty($_SERVER['HTTP_USER_AGENT']) && (mb_strpos($_SERVER['HTTP_USER_AGENT'], I5544) !== false)){ $IILlL1I =rawurlencode($IILlL1I); }Header($status); if(strpos($IILlL1I, ",") !== false){ $IILlL1I =str_replace(",", "_", $IILlL1I); }if(is_array($aMimes)) {$IILlLLL =mb_strtoupper(get_file_ext($oname)); if(isset($aMimes[$IILlLLL])){ $IILlL1l =$aMimes[$IILlLLL]; }else{ $IILlL1l ="application/octet-stream"; }Header("Content-disposition: filename=\"$IILlL1I\""); }else {$IILlL1l ="application/force-download; name=\"".$IILlL1I."\""; Header("Content-Disposition: attachment; filename=\"$IILlL1I\""); }if($IILlLLI) {Header("Accept-Ranges: bytes"); }else {Header("Accept-Ranges: none"); }if(is_array($IILlLL1) && sizeof($IILlLL1) >0) {foreach($IILlLL1 as $key=>$val) {Header($val); }}Header("Content-type: ".$IILlL1l); Header(I5545.$fsize); }function TTT1llI(&$content, $IILlLlL) {set_time_limit($IILlLlL); echo $content; flush(); if(connection_aborted()) {exit; }}function TTT1lll($IILlLl1){ global $cms; header('Content-Type: text/html; charset=UTF-8', true); if($IILlLl1 == 'not_found'){ header('Status: 404 Not Found', true, 404); }$IILlL1L =$cms->Gui->ParseLangFile($GLOBALS["LOCAL_FILES_REL_PATH"]."_admin/templates/lang/ftpgetfile.lng"); $cms->Gui->addBlock("ftpgetfile", $GLOBALS["LOCAL_FILES_REL_PATH"]."_admin/templates/ftpgetfile.tpl"); $IIlIL11 =Array(); $IIlIL11["err_message"] =$IILlL1L[$IILlLl1]; echo $cms->Gui->get(I5546, $IIlIL11); die; }if(!isset($cms->VarsGet[I5547]) || empty($cms->VarsGet[I5547])) {$moduleName ="files"; }else {$IILlL11 =$moduleName =$cms->VarsGet[I5547]; if($moduleName == "gallery" || $moduleName == "eshop") $IILlL11 .= "_item"; if(!$cms->Core->IsInstalled($IILlL11)) {TTT1lll(I5541); }}$filename =I5548; switch($moduleName) {case 'srv_backups': require_once $GLOBALS['CLASSES_PATH'].'CMSBackup.php'; $type ='file'; $filename =$oname =I5549; $file_id =intval($cms->VarsGet[I5542]); if($_SIDE=='front') {$IILlLl1 ='access_denied'; }else {$IILl1II =new CMSBackup($db,$file_id); $meta =$IILl1II->meta(); if(($meta)!==false && $meta['sys_type']==ARCH_SYSTYPE_USER) {$filename =$oname =$IILl1II->TIlIlII(); $IILl1Il =$IILl1II->TIlIlIl(); $sql =I5549; }else {$IILlLl1 ='wrong_request'; }}break; case I5550: $sql ="select attach as name, attach_data as body from cms_subs_sent where id='$id'"; $type ="base"; break; case "eshop": if(!$cms->Core->IsInstalled('eshop_digitals')){ TTT1lll(I5541); }$IILl1IL =&$cms->Core->GetModule("eshop_digitals"); $file_id =intval($cms->VarsGet[I5542]); $IILl1I1 =&$cms->Core->GetModule(I5551); $tableName =$IILl1I1->GetTableName(); $pos =mb_strrpos($tableName, "_items"); $dbTablePrefix =mb_substr($tableName, 0, mb_strlen($tableName) -$pos); $IILl1lI =false; $IILl1ll =false; $IILl1lL =I5548; if($_SIDE!="admin") {$IILl1lL =" AND f.active=1"; $IILl1l1 =$cms->Core->GetModOption("eshop_files", "allow_external_files"); if(!$IILl1l1) {$IILl1lL .= " AND f.is_external_file=0"; }}$type ="file"; $sql ="SELECT f.original_fname, f.filename, f.free_download, f.is_external_file FROM ".$dbTablePrefix."_files AS f WHERE f.id='".$file_id.I5552.$IILl1lL; $db->query($sql); if($db->next_record()) {$aFileData =$db->Record; $IILl1lI =$db->Record["free_download"]; $filename =$db->Record["filename"]; if($IILl1lI) {$oname =$db->Record["original_fname"]; $IILl1ll =true; }if($db->Record["is_external_file"] == 1) {$type =I5553; }}else {$IILlLl1 ="wrong_request"; }if($_SIDE!="admin" && !$IILl1lI) {$order_id =intval($cms->VarsGet["order_id"]); $item_id =intval($cms->VarsGet["item_id"]); $file_id =intval($cms->VarsGet[I5542]); $IILlLl1 =$IILl1IL->IsInstalled()?I5548:I5554; $IILlLl1 =$cms->Member->isLoggedIn()?I5548:I5555; if($IILlLl1 == I5548) {$IILlLl1 ="wrong_request"; if($order_id >0 && $item_id >0) {$userId =$cms->Member->getUserInfo(I5542); $IILl1LI =$IILl1IL->GetOption("download_status"); if(!is_array($IILl1LI)) {$IILl1LI =Array($IILl1LI); }$sql ="SELECT ext_data FROM ".$dbTablePrefix."_orders AS o WHERE o.id='".$order_id.I5556.$userId."' AND o.lang='".$lang."' AND o.status IN('".implode("','", $IILl1LI)."')"; $db->query($sql); if($db->next_record()) {$aExtData =unserialize($db->Record[I5557]); $IILl1Ll =intval($aExtData["eshop_digitals"]["expire"]); if($IILl1Ll >time()) {$sql ="SELECT f.original_fname, f.filename, oi.ext_data FROM ".$dbTablePrefix."_order_items AS oi, ".$dbTablePrefix."_files AS f WHERE oi.id_order='".$order_id."' AND oi.id_product='".$item_id."' AND f.id='".$file_id."' AND f.id_product='".$item_id.I5552.$IILl1lL." AND f.lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $aExtData =unserialize($db->Record[I5557]); $IILl1LL =intval($IILl1IL->GetOption("max_download_attempts")); if(isset($aExtData["eshop_digitals"]["download_attempts"][$id]["rest"])) {$IILl1LL =intval($aExtData["eshop_digitals"][I5558][$id]["rest"]); }if($IILl1LL >0) {$filename =$db->Record["filename"]; $oname =$db->Record["original_fname"]; $IILlLl1 =I5548; }else {$IILlLl1 ="no_attempts"; }}}else {$IILlLl1 =I5559; }}}}}else {if(!$IILl1ll) {$sql ="SELECT f.original_fname, f.filename FROM ".$dbTablePrefix."_files AS f WHERE f.id='".$file_id.I5552.$IILl1lL; }}$IILl1Il =$GLOBALS["PRIVATE_PATH"].$IILl1IL->GetOption("eshop_files_path"); break; case I5560: if(!$cms->Core->IsInstalled('gallery_digitals')){ TTT1lll(I5541); }$IILl1L1 =&$cms->Core->GetModule("gallery_item"); $IILl11I =&$cms->Core->GetModule("gallery_digitals"); $file_id =intval($cms->VarsGet[I5542]); $tableName =$IILl1L1->GetTableName(); $pos =mb_strrpos($tableName, "_items"); $dbTablePrefix =mb_substr($tableName, 0, mb_strlen($tableName) -$pos); $IILl1Il =I5548; if($_SIDE!=I5561) {$order_id =intval($cms->VarsGet["order_id"]); $item_id =intval($cms->VarsGet["item_id"]); $IILlLl1 =$IILl1L1->IsInstalled() ?I5548 :I5554; $IILlLl1 =is_object($cms->Member) && $cms->Member->isLoggedIn()? I5548 :I5555; if($IILlLl1 == I5548) {$IILlLl1 ="wrong_request"; if($order_id >0 && $item_id >0) {$userId =$cms->Member->getUserInfo(I5542); $IILl1LI =$IILl11I->GetOption("download_status"); if(!is_array($IILl1LI)) {$IILl1LI =Array($IILl1LI); }$sql ="SELECT ext_data FROM ".$dbTablePrefix."_orders AS o WHERE o.id='".$order_id.I5556.$userId."' AND o.lang='".$lang."' AND o.status IN('".implode("','", $IILl1LI).I5562; $db->query($sql); $sql =I5548; if($db->next_record()) {$aExtData =unserialize($db->Record[I5557]); $IILl1Ll =intval($aExtData["eshop_digitals"]["expire"]); if($IILl1Ll >time()) {$sql ="SELECT f.ext_popup_picture as popup_picture, f.ext_small_picture as small_picture, f.ext_picture as picture, oi.ext_data FROM ".$dbTablePrefix."_order_items AS oi, ".$dbTablePrefix."_items AS f WHERE oi.id_order='".$order_id."' AND oi.id_product='".$item_id."' AND f.id='".$file_id.I5552.$IILl1lL." AND f.lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $aExtData =unserialize($db->Record[I5557]); $IILl1LL =intval($IILl11I->GetOption("max_download_attempts")); if(isset($aExtData[I5563][I5558][$id]["rest"])) {$IILl1LL =intval($aExtData[I5563][I5558][$id]["rest"]); }if($IILl1LL >0) {$IILl11l =$db->Record["popup_picture"]; if(empty($IILl11l)) $IILl11l =$db->Record["picture"]; if(empty($IILl11l)) $IILl11l =$db->Record[I5564]; $filename =I5548; $IILl1Il =I5548; if(is_file($GLOBALS["ROOT_PATH"].$IILl11l)){ $filename =basename($IILl11l); $IILl1Il =dirname($GLOBALS["ROOT_PATH"].$IILl11l)."/"; }$oname =$filename; $IILlLl1 =I5548; }else {$IILlLl1 ="no_attempts"; }}}else {$IILlLl1 =I5559; }}}}}else{ $sql ="SELECT popup_picture, small_picture, picture FROM ".$dbTablePrefix."_items WHERE id='".$file_id."' AND lang='".$lang.I5552; $db->query($sql); $sql =I5548; if($db->next_record()){ $IILl11l =$db->Record["popup_picture"]; if(empty($IILl11l)) $IILl11l =$db->Record["picture"]; if(empty($IILl11l)) $IILl11l =$db->Record[I5564]; if(is_file($GLOBALS[I5565].$IILl11l)){ $filename =basename($IILl11l); $IILl1Il =dirname($GLOBALS[I5565].$IILl11l)."/"; }$oname =$filename; $IILlLl1 =I5548; }}$type ="file"; break; default: $sql ="select original_fname, filename from cms_files where id='$id' ".$IILlLlI.I5566.$moduleName.I5552; $IILl1Il =$GLOBALS[I5567].$IILlLll->GetOption("files_path"); $type ="file"; break; }if($IILlLl1 == I5548) {switch($type) {case I5553: Header($GLOBALS[I5568].' 301 Moved Permanently'); Header("Location: ".$filename, true, 301); exit(); break; case "file": if($sql != I5548) {$db->query($sql); if($db->next_record()){ $filename =$db->Record["filename"]; $oname =$db->Record[I5569]; }}if(!empty($filename)){ if(empty($oname)) $oname =$filename; $filename =$IILl1Il.$filename; if(file_exists($filename)){ $fsize =filesize($filename); if($fsize){ $fp =fopen($filename, "r"); if($fp){ if($moduleName!="eshop") {$IILl11L =$cms->Core->GetProperty("images_mimes"); }if($_SERVER["REQUEST_METHOD"] == I5570) {TTT1llT($oname, $fsize, $status, $IILl11L); exit; }else {$IILlLL1 =Array(); $IILl111 =0; if($IILlLLI) {if(isset($_SERVER["HTTP_RANGE"])) {$pos =mb_strpos($_SERVER["HTTP_RANGE"], "="); if($pos !==false && $pos >0) {$range =mb_substr($_SERVER["HTTP_RANGE"], $pos +1); $pos =mb_strpos($range, I5571); if($pos !== false) {$IILl111 =intval(mb_substr($range, 0, $pos)); $size =intval(mb_substr($range, $pos +1)); if($size <= 0) {$size =$fsize -1; }if($IILl111 >$size) {$IILl111 =0; $size =$fsize -1; }$IILlLL1[] ="Content-Range: bytes ".$IILl111.I5571.$size."/".$fsize; $status =$GLOBALS[I5568]." 206 Partial Content"; $fsize =$size -$IILl111 +1; fseek($fp, $IILl111); }}}else {$IILlLLI =false; }}if($moduleName=="eshop" && $_SIDE!=I5561 && !$IILl1lI) {$IILLIII =true; if(is_object($oSession)) {if(!$oSession->IssetVar("eshop_digitals_download_".$id)) {$oSession->SetVar("eshop_digitals_download_".$id, strtotime($IILl1IL->GetOption("max_time_for_attempt"))); }else {$IILLIIl =$oSession->GetVar("eshop_digitals_download_".$id); if($IILLIIl >time()) {$IILLIII =false; }else {$oSession->SetVar("eshop_digitals_download_".$id, strtotime($IILl1IL->GetOption("max_time_for_attempt"))); }}}if($IILLIII && $IILl111 <100) {$aExtData[I5563][I5558][$id]["rest"] =$IILl1LL -1; if(!isset($aExtData[I5563][I5558][$id]["initial"])) {$aExtData[I5563][I5558][$id]["initial"] =$IILl1IL->GetOption("max_download_attempts"); }$asql =Array(I5557=>addslashes(serialize($aExtData))); $sql =$db->GenUpdateSQL($dbTablePrefix.I5572, $asql, "WHERE id_order='".$order_id."' AND id_product='".$item_id.I5552); $db->query($sql); }}TTT1llT($oname, $fsize, $status, $IILl11L, $IILlLL1); $IILLIIL =true; while($content =fread($fp, $buffer)) {if($IILl111 == 0 && $IILLIIL) {$IILLIIL =false; if($_SIDE!=I5561 && $IILlLll->GetOption("show_download_counter") && $moduleName=="files" && $IILl111 == 0) {$sql ="UPDATE cms_files SET num_downloaded=num_downloaded+1 WHERE id='".$id.I5552; $IILLII1 =new DB_si; $IILLII1->query($sql); $curTime =time(); $IILLIlI =date("i", $curTime); if($IILLIlI <59) {$IILLIll =59; $hour =date("H", $curTime); $expTime =mktime($hour, $IILLIll, 59); }else {$expTime =strtotime ("+1 hours"); }$cms->Core->Cache->ClearAdd("files", 0, I5548, $expTime); }}TTT1llI($content, $IILlLlL); }die(); exit; }}}}}break; case I5573: $db->query($sql); if($db->next_record()) {$oname =$db->Record["name"]; $fbody =$db->Record["body"]; $fsize =mb_strlen($fbody); $pos =0; TTT1llT($oname, $fsize); while($pos <$fsize) {TTT1llI(mb_substr($fbody, $pos, $buffer), $IILlLlL); $pos += $buffer; }exit; }break; }}if($IILlLl1 != I5549){ TTT1lll($IILlLl1); }TTT1lll('not_found');
Function Calls
| None |
Stats
| MD5 | e830fceb5b2ef62eb35b2db01154c71d |
| Eval Count | 0 |
| Decode Time | 447 ms |