query("SELECT lid, title, ext_src FROM $table_photos WHERE lid=$lid AND status>0"); list($lid, $title, $ext_src) = $xoopsDB->fetchRow($result); // путь к файлу на сервере $file_saved = "$photos_dir/$lid"."_src.$ext_src"; // проверяем на месте ли файл if(!file_exists($file_saved)) die(_MD_NO_SUCH_FILE); $nameSaved = " ".$lid." ".$title; // имя с которым файл будет отдан пользователю $file_display = $xoopsConfig['sitename'].pc_text_clear(translit($nameSaved)).".".$ext_src; //увеличевыем счётчик скачиваний на 1 $xoopsDB->queryF( "UPDATE $table_photos SET hits=hits+1 WHERE lid='$lid' AND status>0" ) ; //отдаём файл if(filesize($file_saved) < 8388608){ header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file_saved)); if (preg_match("/MSIE ([0-9]\.[0-9]{1,2})/", $HTTP_USER_AGENT)) { header('Content-Disposition: inline; filename="'.$file_display.'"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Disposition: attachment; filename="'.$file_display.'"'); header('Expires: 0'); header('Pragma: no-cache'); } readfile($file_saved); }else{ $url = "$photos_url/$lid"."_src.$ext_src"; header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Location: $url"); } exit(); } // если пользователь отказался от условий редирект на страницу работы if($agree === 2){ redirect_header( $mod_url.'/photo.php?lid='.intval($_POST['lid']) , 3 , _MD_CHANCEL ) ; exit ; }else{ // вывод страницы по умолчанию $xoopsOption['template_main'] = 'myalbum_agree.html'; include XOOPS_ROOT_PATH . "/header.php" ; $prs = $xoopsDB->query( "SELECT lid, title, ext, ext_src, status FROM $table_photos WHERE lid=$lid AND status>0" ) ; $p = $xoopsDB->fetchArray( $prs ) ; // если запрос не чего не вернул выход. if( $p == false ) { redirect_header( $mod_url.'/' , 3 , _ALBM_NOMATCH ) ; exit ; } $photo = myalbum_get_array_for_photo_assign( $p ) ; $xoopsTpl->assign_by_ref( 'photo' , $photo ) ; // запрос к таблице модуля xoopsFaq и получение, условий доступа к исходнику $prs = $xoopsDB->query('SELECT contents_title, contents_contents FROM '.$xoopsDB->prefix('xoopsfaq_contents').' WHERE contents_visible=1 AND contents_id=11'); list($contents_title, $contents_contents) = $xoopsDB->fetchRow($prs); // отправляем переменные в шаблон $xoopsTpl->assign('xoops_meta_robots', 'noindex,nofollow'); $xoopsTpl->assign( 'xoops_pagetitle' , $contents_title.' - '.$photo['title'] ) ; $xoopsTpl->assign('agreeText', $myts->makeTareaData4Show($contents_contents, 0)); include( XOOPS_ROOT_PATH . "/footer.php" ) ; } ?>