示例#1
0
 function checkViewLang($type, $id)
 {
     global $_SLANG;
     $reallangid;
     switch ($type) {
         case 'articlelist':
         case 'page':
             $row = $this->db->row_select_one("channels", "id={$id}");
             empty($row) && exitRes($_SLANG['webcore.channel.ne']);
             $reallangid = $row['langid'];
             break;
         case 'productlist':
             $row = $this->db->row_select_one("procates", "id={$id}");
             empty($row) && exitRes($_SLANG['webcore.cate.ne']);
             $reallangid = $row['langid'];
             break;
         case 'product':
             $row = $this->db->row_select_one("products", "id={$id}");
             empty($row) && exitRes($_SLANG['webcore.product.ne']);
             $reallangid = $row['langid'];
             break;
         case 'view':
             $row = $this->db->row_select_one("articles", "id={$id}");
             empty($row) && exitRes($_SLANG['webcore.art.ne']);
             $reallangid = $row['langid'];
             break;
     }
     setCookies("langid", $reallangid, 3600 * 24 * 365);
     $tourl = '';
     unset($_GET['langid']);
     foreach ($_GET as $getkey => $getvalue) {
         !empty($getvalue) && ($tourl .= "&{$getkey}={$getvalue}");
     }
     $tourl = "{$type}.php?langid={$reallangid}{$tourl}";
     //exit($tourl);
     _header_("location:{$tourl}");
 }
示例#2
0
    exitRes($_SLANG['attachment.referr']);
}
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
if (empty($id)) {
    exitRes($_SLANG['attachment.fileid.ne']);
}
$row = $db->row_select_one("attachments", "id={$id}");
if (empty($row)) {
    exitRes($_SLANG['attachment.file.ne']);
}
$filepath = "uploadfile/attachment/" . $row['filepath'];
//if is image and redirect
//if(intval($_GET['r'])==1 && $row['type']==1){
if ($row['type'] == 1) {
    if (!file_exists(ATT_PATH . "/" . $filepath)) {
        exitRes($_SLANG['attachment.filedel']);
    }
    $filepath = getUrlPath() . '/' . $filepath;
    $filepath = preg_replace('/\\/' . ADMIN_DIR . '\\//i', '/', $filepath);
    //ob_end_clean();
    header("HTTP/1.1 301 Moved Permanently");
    header("Last-Modified:" . date('r'));
    header("Expires: " . date('r', time() + 86400));
    header("Location:{$filepath}");
    exit;
}
$filepath = ATT_PATH . "/uploadfile/attachment/" . $row['filepath'];
$filename = stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($row['filename']) : $row['filename'];
ob_end_clean();
_header_('Content-Encoding: none');
_header_('Content-Type: application/octet-stream');