Exemple #1
0
 function SaveLastUrl()
 {
     $s = ew_ServerVar("SCRIPT_NAME");
     $q = ew_ServerVar("QUERY_STRING");
     if ($q != "") {
         $s .= "?" . $q;
     }
     if ($this->LastUrl() == $s) {
         $s = "";
     }
     @setcookie(EW_PROJECT_NAME . '[LastUrl]', $s);
 }
 function getReturnUrl()
 {
     $name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL;
     // Get referer URL automatically
     if (ew_ServerVar("HTTP_REFERER") != "" && ew_ReferPage() != ew_CurrentPage() && ew_ReferPage() != "login.php") {
         // Referer not same page or login page
         $_SESSION[$name] = ew_ServerVar("HTTP_REFERER");
     }
     // Save to Session
     if (@$_SESSION[$name] != "") {
         return $_SESSION[$name];
     } else {
         return "card_typelist.php";
     }
 }
Exemple #3
0
 if ($restoreDbFile) {
     $fn = ew_UploadPathEx(TRUE, @$_GET["path"]) . $obj->Value;
     if (file_exists($fn)) {
         $pathinfo = pathinfo($fn);
         $ext = strtolower($pathinfo['extension']);
         if (in_array($ext, explode(',', EW_IMAGE_ALLOWED_FILE_EXT))) {
             $size = getimagesize($fn);
             if ($size) {
                 header("Content-type: {$size['mime']}");
             }
             echo ew_ResizeFileToBinary($fn, $width, $height, $quality);
         }
     }
 } else {
     // If not IE, get the content type
     if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE) {
         $tmpfname = tempnam(ew_TmpFolder(), 'tmp');
         $handle = fopen($tmpfname, "w");
         fwrite($handle, $obj->Value);
         fclose($handle);
         $size = getimagesize($tmpfname);
         if ($size) {
             header("Content-type: {$size['mime']}");
         }
         @unlink($tmpfname);
     }
     if ($resize) {
         $obj->Resize($width, $height, $quality);
     }
     echo $obj->Value;
     exit;
 function Page_Main()
 {
     // Get key
     if (@$_GET["rider_id"] != "") {
         $this->rider_id->setQueryStringValue($_GET["rider_id"]);
     } else {
         $this->Page_Terminate();
         // Exit
         exit;
     }
     $objBinary = new cUpload('rider', 'x_rider_pic');
     // Show thumbnail
     $bShowThumbnail = @$_GET["showthumbnail"] == "1";
     if (@$_GET["thumbnailwidth"] == "" && @$_GET["thumbnailheight"] == "") {
         $iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH;
         // Set default width
         $iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT;
         // Set default height
     } else {
         if (@$_GET["thumbnailwidth"] != "") {
             $iThumbnailWidth = $_GET["thumbnailwidth"];
             if (!is_numeric($iThumbnailWidth) || $iThumbnailWidth < 0) {
                 $iThumbnailWidth = 0;
             }
         }
         if (@$_GET["thumbnailheight"] != "") {
             $iThumbnailHeight = $_GET["thumbnailheight"];
             if (!is_numeric($iThumbnailHeight) || $iThumbnailHeight < 0) {
                 $iThumbnailHeight = 0;
             }
         }
     }
     $sFilter = $this->KeyFilter();
     // Set up filter (SQL WHERE clause) and get return SQL
     // SQL constructor in rider class, riderinfo.php
     $this->CurrentFilter = $sFilter;
     $sSql = $this->SQL();
     $conn =& $this->Connection();
     if ($this->Recordset = $conn->Execute($sSql)) {
         if (!$this->Recordset->EOF) {
             if (ob_get_length()) {
                 ob_end_clean();
             }
             $objBinary->Value = $this->Recordset->fields('rider_pic');
             $objBinary->Value = $objBinary->Value;
             if ($bShowThumbnail) {
                 ew_ResizeBinary($objBinary->Value, $iThumbnailWidth, $iThumbnailHeight);
             }
             $data = $objBinary->Value;
             if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE) {
                 header("Content-type: " . ew_ContentType(substr($data, 0, 11), $this->Recordset->fields('rider_pic')));
             }
             if (trim(strval($this->Recordset->fields('rider_pic'))) != "") {
                 header("Content-Disposition: attachment; filename=\"" . $this->Recordset->fields('rider_pic') . "\"");
             }
             if (substr($data, 0, 2) == "PK" && strpos($data, "[Content_Types].xml") > 0 && strpos($data, "_rels") > 0 && strpos($data, "docProps") > 0) {
                 // Fix Office 2007 documents
                 if (substr($data, -4) != "") {
                     $data .= "";
                 }
             }
             echo $data;
         }
         $this->Recordset->Close();
     }
 }
Exemple #5
0
function ew_CurrentUrl()
{
    $s = ew_ScriptName();
    $q = ew_ServerVar("QUERY_STRING");
    if ($q != "") {
        $s .= "?" . $q;
    }
    return $s;
}
 function Page_Main()
 {
     global $conn, $exam_data;
     // Get key
     if (@$_GET["ExamDataNo"] != "") {
         $exam_data->ExamDataNo->setQueryStringValue($_GET["ExamDataNo"]);
     } else {
         $this->Page_Terminate();
         // Exit
         exit;
     }
     $objBinary = new cUpload('exam_data', 'x_Soap');
     // Show thumbnail
     $bShowThumbnail = @$_GET["showthumbnail"] == "1";
     if (@$_GET["thumbnailwidth"] == "" && @$_GET["thumbnailheight"] == "") {
         $iThumbnailWidth = EW_THUMBNAIL_DEFAULT_WIDTH;
         // Set default width
         $iThumbnailHeight = EW_THUMBNAIL_DEFAULT_HEIGHT;
         // Set default height
     } else {
         if (@$_GET["thumbnailwidth"] != "") {
             $iThumbnailWidth = $_GET["thumbnailwidth"];
             if (!is_numeric($iThumbnailWidth) || $iThumbnailWidth < 0) {
                 $iThumbnailWidth = 0;
             }
         }
         if (@$_GET["thumbnailheight"] != "") {
             $iThumbnailHeight = $_GET["thumbnailheight"];
             if (!is_numeric($iThumbnailHeight) || $iThumbnailHeight < 0) {
                 $iThumbnailHeight = 0;
             }
         }
     }
     if (@$_GET["quality"] != "") {
         $quality = $_GET["quality"];
         if (!is_numeric($quality)) {
             $quality = 75;
         }
         // Set Default
     } else {
         $quality = 75;
     }
     $sFilter = $exam_data->KeyFilter();
     // Set up filter (SQL WHERE clause) and get return SQL
     // SQL constructor in exam_data class, exam_datainfo.php
     $exam_data->CurrentFilter = $sFilter;
     $sSql = $exam_data->SQL();
     if ($rs = $conn->Execute($sSql)) {
         if (!$rs->EOF) {
             if (strpos(ew_ServerVar("HTTP_USER_AGENT"), "MSIE") === FALSE) {
                 header("Content-type: images");
             }
             $objBinary->Value = $rs->fields('Soap');
             if ($bShowThumbnail) {
                 ew_ResizeBinary($objBinary->Value, $iThumbnailWidth, $iThumbnailHeight, $quality);
             }
             $data = $objBinary->Value;
             if (substr($data, 0, 2) == "PK" && strpos($data, "[Content_Types].xml") > 0 && strpos($data, "_rels") > 0 && strpos($data, "docProps") > 0) {
                 // Fix Office 2007 documents
                 if (substr($data, -4) != "") {
                     $data .= "";
                 }
             }
             echo $data;
         }
         $rs->Close();
     }
 }
Exemple #7
0
function ew_UserAgent()
{
    $ua = ew_ServerVar("HTTP_USER_AGENT");
    $os = "";
    $agent = "";
    $mobile = "";
    $version = 0;
    // Detect OS
    if (preg_match("/windows|win32/i", $ua)) {
        $os = "windows";
    } elseif (preg_match("/macintosh/i", $ua)) {
        $os = "macintosh";
    } elseif (preg_match("/linux/i", $ua)) {
        $os = "linux";
    } elseif (preg_match("/rhino/i", $ua)) {
        $os = 'rhino';
    }
    // Modern KHTML browsers should qualify as Safari X-Grade
    $webkit = 0;
    if (preg_match("/KHTML/", $ua)) {
        $webkit = 1;
    }
    // Modern WebKit browsers are at least X-Grade
    if (preg_match("/AppleWebKit\\/([^\\s]*)/i", $ua, $m)) {
        $webkit = $m[1];
        // Mobile browser check
        if (preg_match("/ Mobile\\//i", $ua)) {
            $mobile = "Apple";
            // Check if iPhone or iPod Touch
            if (preg_match("/OS ([^\\s]*)/i", $ua, $m)) {
                $os = "iOS";
                $version = str_replace("_", ".", $m[1]);
                // Get iOS version
            }
            if (preg_match("/iPad/i", $ua, $m)) {
                $agent = "iPad";
            } elseif (preg_match("/iPod/i", $ua, $m)) {
                $agent = "iPod";
            } elseif (preg_match("/iPhone/i", $ua, $m)) {
                $agent = "iPhone";
            }
        } else {
            if (preg_match("/NokiaN[^\\/]*\\//i", $ua, $m)) {
                // Nokia N-series, ex: NokiaN95
                $os = "nokia";
                $mobile = $m[0];
                $agent = $mobile;
            }
            if (preg_match("/webOS/i", $ua, $m)) {
                $os = "WebOS";
                $mobile = $os;
                $agent = $mobile;
                if (preg_match("/webOS\\/([^\\s]*);/i", $ua, $m)) {
                    $agent = substr($m[0], 0, -1);
                    $version = $m[1];
                    // WebOS
                }
            }
            if (preg_match("/ Android/i", $ua, $m)) {
                $mobile = "Android";
                if (preg_match("/Android ([^\\s]*);/i", $ua, $m)) {
                    $agent = substr($m[0], 0, -1);
                    $version = $m[1];
                    // Android
                }
            }
            if (preg_match("/BlackBerry ([^\\s]*);/i", $ua, $m)) {
                $os = "BlackBerry";
                $mobile = $os;
                $agent = substr($m[0], 0, -1);
                $version = $m[1];
            }
            if (preg_match("/PlayBook/i", $ua)) {
                $os = "BackBerry";
                $mobile = $os;
                $agent = "PlayBook";
                if (preg_match("/ RIM Tablet OS ([^\\s]*);/i", $ua, $m)) {
                    $os = "RIM Tablet OS";
                    $version = $m[1];
                }
            }
        }
        if (preg_match("/Chrome\\/([^\\s]*)/i", $ua, $m)) {
            $agent = "Chrome";
            $version = $m[1];
            // Chrome
        } elseif ($mobile == "" && preg_match("/Safari\\//", $ua) && preg_match("/Version\\/([0-9\\.]+)/", $ua, $m)) {
            $agent = "Safari";
            $version = $m[1];
            // Safari
        } elseif (preg_match("/AdobeAIR\\/([^\\s]*)/i", $ua, $m)) {
            $agent = "AdobeAIR";
            $version = $m[0];
            // Adobe AIR 1.0 or better
        }
    }
    if ($webkit == 0) {
        // Not webkit
        if (preg_match("/Opera[\\s\\/]([^\\s]*)/i", $ua, $m)) {
            $agent = "Opera";
            $version = $m[1];
            if (preg_match("/Version\\/([^\\s]*)/i", $ua, $m)) {
                $version = $m[1];
                // Opera 10+
            }
            if (preg_match("/Opera Mini[^;]* /i", $ua, $m)) {
                $mobile = $m[0];
                // Ex: Opera Mini/2.0.4509/1316
            }
        } else {
            // Not Opera or webkit
            if (preg_match("/MSIE\\s([^;]*)/i", $ua, $m)) {
                $agent = "MSIE";
                $version = $m[1];
            } elseif (preg_match("/Firefox\\/([^\\s]*)/i", $ua, $m)) {
                $agent = "Firefox";
                $version = $m[1];
            } else {
                // Not Opera, webkit, ie, Firefox
                if (preg_match("/Gecko\\/([^\\s]*)/i", $ua, $m)) {
                    $agent = "Gecko";
                    // Gecko detected, look for revision
                    if (preg_match("/rv:([^\\s\\)]*)/i", $ua, $m)) {
                        $version = $m[1];
                    }
                }
            }
        }
    }
    $a[] = $os;
    $a[] = $agent;
    $a[] = $mobile;
    $ver = explode(".", $version);
    for ($i = 0; $i < count($ver); $i++) {
        $a[] = $ver[$i];
    }
    return $a;
}