Ejemplo n.º 1
0
 public static function mode()
 {
     if (isResmac() === true) {
         return false;
     }
     // Tamir moduna geçildiği durumnda tadilat makinesi olarak belirlenmeyen
     // diğer kullanıcı bilgisayarlarında herhangi bir hata ile karşı karşıya
     // kalmamaları için hata raporlama kapatılıyor.
     error_reporting(0);
     global $application;
     // Config/Repair.php dosyasında tadilata alınacak sayfalar belirtilir.
     // Burada ayarlarda belirtilen sayfa isimleri bilgisi alınıyor.
     $restoration = $application['restoration'];
     $restorationPages = $restoration['pages'];
     $routePage = strtolower($restoration['routePage']);
     $currentPath = strtolower(currentPath());
     // Eğer Config/Repair.php dosyasında pages = "all" olarrak alınmış ise
     // tüm sayfalar için tadilat modu uygulanıyor demektir.
     if (is_string($restorationPages)) {
         if ($restorationPages === "all") {
             if ($currentPath !== $routePage) {
                 redirect($restoration['routePage']);
             }
         }
     }
     // Sayfalar tek tek çağrılıyor..
     if (is_array($restorationPages) && !empty($restorationPages)) {
         // Eğer Config/Repair.php dosyasında pages = array("all") olarrak alınmış ise
         // tüm sayfalar için tadilat modu uygulanıyor demektir.
         if ($restorationPages[0] === "all") {
             if ($currentPath !== $routePage) {
                 redirect($restoration['routePage']);
             }
         }
         foreach ($restorationPages as $k => $rp) {
             // Yönlendirme sayfası bir anahtar-değer çifti içeriyorsa bu sayfaya yönlenmesi sağlanır
             if (strstr($currentPath, strtolower($k))) {
                 redirect($rp);
             } else {
                 // Eğer gelen sayfa o anki url içinde geçiyorsa yani sonuc -1 den büyükse
                 // yönlendirme sayfası olarak belirlene sayfaya yönlendir.
                 if (strstr($currentPath, strtolower($rp))) {
                     if ($currentPath !== $routePage) {
                         redirect($restoration['routePage']);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
function restorationPath($path = '')
{
    if (isResmac() === true) {
        $newPath = preg_replace('/^' . rtrim(APPDIR, '/') . '/', rtrim(RESDIR, '/'), $path);
        if (file_exists($newPath)) {
            return $newPath;
        } else {
            return $path;
        }
    }
    return $path;
}