예제 #1
0
 public static function getPublicFile($name = "index.php", $template = "", $lang = "")
 {
     if ($filename = Functions::getPublicFileURL($name, $template, $lang)) {
         return file_get_contents($filename);
     }
     return false;
 }
예제 #2
0
 public function init(array $request = array())
 {
     $defaultcontrolfilename = Functions::getPublicFileURL("../servlet/index.php");
     $defaultviewfilename = Functions::getPublicFileURL("index.html");
     if (isset($this->request["REQUEST_URI"][0]) && !empty($this->request["REQUEST_URI"][0])) {
         if (Functions::isLanguage($this->request["REQUEST_URI"][0])) {
             $this->setLanguage(array_shift($this->request["REQUEST_URI"]));
         }
     } elseif (!in_array(parent::getUserBrowser(), array("ie"))) {
         $redirectforlanguage = true;
     }
     if (isset($this->request["REQUEST_URI"][0]) && !empty($this->request["REQUEST_URI"][0])) {
         $controlfilename = Functions::getPublicFileURL("../servlet/" . $this->request["REQUEST_URI"][0] . ".php");
         $viewfilename = $this->request["REQUEST_URI"][0] . ".html";
         if (is_file($controlfilename)) {
             include $controlfilename;
         } elseif (is_file($viewfilename)) {
             $this->showPage($viewfilename);
         } else {
             $this->showPage("404.html");
         }
     } else {
         if (is_file($defaultcontrolfilename)) {
             include $defaultcontrolfilename;
         } elseif (is_file($defaultviewfilename)) {
             include $defaultviewfilename;
         }
     }
     if (isset($redirectforlanguage)) {
         echo "<script>history.pushState('page', '', '" . Functions::getDefaultURL() . $this->getLanguage() . "/');</script>";
     }
 }
예제 #3
0
 public function init(array $request = array())
 {
     $this->initConstant();
     $defaultcontrolfilename = Functions::getPublicFileURL(SERVLET_SUBFOLDER . "index.php");
     $defaultviewfilename = Functions::getPublicFileURL("index.php");
     if (isset($this->request["REQUEST_URI"][0]) && !in_array(parent::getUserBrowser(), array("ie"))) {
         if (!in_array("ajax", $this->request["REQUEST_URI"])) {
             echo "<script>history.pushState('page', '', '" . Functions::getDefaultURL() . parent::getLanguage() . "/" . Config::$DEFAULT_SERVLET_NAME . "/" . implode("/", $this->request["REQUEST_URI"]) . "');</script>";
         }
         $controlfilename = Functions::getPublicFileURL(SERVLET_SUBFOLDER . $this->request["REQUEST_URI"][0] . ".php");
         $viewfilename = $this->request["REQUEST_URI"][0] . ".html";
         if (is_file($controlfilename)) {
             include $controlfilename;
         } elseif (is_file($viewfilename)) {
             $this->showPage($viewfilename);
         } else {
             include Functions::getPublicFileURL(INCLUDE_SUBFOLDER . "head.php");
             $this->showPage("404.html");
         }
     } else {
         if (is_file($defaultcontrolfilename)) {
             include $defaultcontrolfilename;
         } elseif (is_file($defaultviewfilename)) {
             include $defaultviewfilename;
         }
     }
 }
예제 #4
0
function dispatch($name, $adminO, $object, $request = array())
{
    switch ($name) {
        case "ajax":
            verifyLogin($name, $adminO, $object, $request);
            break;
        case "logout":
            $object->unsetConnected();
            Functions::jsRedirect($adminO::getAdminURL());
            break;
        default:
            if (!$object->isConnected()) {
                include Functions::getPublicFileURL(CURRENT_PAGE_NAME . ".php");
            } else {
                Functions::jsRedirect($adminO::getAdminURL());
            }
    }
}
예제 #5
0
<?php

$admin = Models::getAdminObject();
$request = $this->request;
if ($admin->isConnected()) {
    include Functions::getPublicFileURL(INCLUDE_SUBFOLDER . "head.php");
    include Functions::getPublicFileURL(INCLUDE_SUBFOLDER . "header.php");
    include Functions::getPublicFileURL(INCLUDE_SUBFOLDER . "left.header.php");
    include Functions::getPublicFileURL("index.php");
    include Functions::getPublicFileURL(INCLUDE_SUBFOLDER . "footer.php");
} else {
    Functions::jsRedirect($this::getAdminURL() . "login");
}
예제 #6
0
        case "gallerypictures":
            return array("%%PICTURE%%" => $object->getPicture());
            break;
        case "category":
            return array("%%ID%%" => $object->getId(), "%%NAME%%" => $object->getName());
            break;
    }
    return array();
}
if (strcmp("fr", Config::$CURRENT_LANGUAGE) == 0) {
    $current = "-page";
} else {
    $current = "";
}
$this->html->setCommonArray(array("%%INDEXCLASS%%" => "", "%%PORTFOLIO%%" => "current" . $current, "%%BLOG%%" => "", "%%SERVICES%%" => "", "%%ABOUT%%" => "", "%%CONTACT%%" => ""));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/head.html"));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/header.html"));
$gallerypictures = Models::getGalleryObject();
$gallery = Models::getGalleryObject();
$category = Models::getCategoryObject();
$pagename = "portfolio";
if (isset($this->request["REQUEST_URI"][1]) && $gallery->existId(substr($this->request["REQUEST_URI"][1], 0, strpos($this->request["REQUEST_URI"][1], "_")))) {
    $gallery->fetchGalleryById(substr($this->request["REQUEST_URI"][1], 0, strpos($this->request["REQUEST_URI"][1], "_")));
    $gallerypictures->fetchAllFiles(substr($this->request["REQUEST_URI"][1], 0, strpos($this->request["REQUEST_URI"][1], "_")));
    $pagename = "portfolio.detail";
} else {
    $gallery->fetchAllGalleries();
}
$category->fetchCategoryByType("gallery");
echo $this->html->getReplacedHTMLRepeatedBlockByModelObject(array("gallery" => $gallery, "gallerypictures" => $gallerypictures, "category" => $category), Functions::getPublicFileURL("pages/" . $pagename . ".html"), "getReplaceChars");
echo $this->html->getFilteredText(Functions::getPublicFile("includes/footer.html"));
예제 #7
0
<?php

$pagename = "administrator";
$object = Models::getAdminObject();
?>
<div class="rightpanel">
	<ul class="breadcrumbs">
		<li><a href="<?php 
echo $adminO::getAdminDir();
?>
"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
		<li><a href="<?php 
echo $adminO::getAdminDir() . $pagename;
?>
">Liste des administrateurs</a></li>
	</ul>
	<div>
		<?php 
include Functions::getPublicFileURL(PAGE_LIST_SUBFOLDER . $pagename . ".php");
?>
	</div>
</div>
<script>
		function reload(){
			reloadLastProduct();
			reloadAdministrator();
			reloadHeader();
		}
</script>
예제 #8
0
        case "slide":
            return array("%%PICTURE%%" => $object->getPicture());
            break;
        case "category":
            $product = Models::getProductObject();
            $product->fetchProductByCategoryId($object->getId());
            return array("%%ID%%" => $object->getId(), "%%NAME%%" => $object->getName(), "%%CATEGORY_URL%%" => Functions::getDefaultURL() . "product/" . str_replace(" ", "_", $object->getName()), "%%PICTURE%%" => $object->getPicture(), "%%LOGO%%" => $object->getLogo(), "%%DESCRIPTION%%" => $object->getDescription(), "%%COUNT%%" => $product->getCount(), "%%SELECTED%%" => defined("CATEGORY_NAME") && $object->getIdFromName(str_replace("_", " ", CATEGORY_NAME)) == $object->getId() ? "selected" : "");
            break;
    }
    return array();
}
if (strcmp("fr", Config::$CURRENT_LANGUAGE) == 0) {
    $current = "-page";
} else {
    $current = "";
}
$this->html->setCommonArray(array("%%INDEXCLASS%%" => "current" . $current, "%%PORTFOLIO%%" => "", "%%PRODUCT%%" => "", "%%BLOG%%" => "", "%%SERVICES%%" => "", "%%ABOUT%%" => "", "%%CONTACT%%" => ""));
$category = Models::getCategoryObject();
$product = Models::getProductObject();
$gallery = Models::getGalleryObject();
$improve = Models::getImproveObject();
$slide = Models::getSlideObject();
$category->fetchCategoryByType("product");
$product->fetchAllProducts(0, 4);
$gallery->fetchAllGalleries(0, 4);
$improve->fetchAllImproves();
$slide->fetchAllFiles();
echo $this->html->getFilteredText(Functions::getPublicFile("includes/head.html"));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/header.html"));
echo $this->html->getReplacedHTMLRepeatedBlockByModelObject(array("category" => $category, "products" => $product, "gallery" => $gallery, "slide" => $slide, "improve" => $improve, "improve1" => $improve), Functions::getPublicFileURL("index.html"), "getReplaceChars");
echo $this->html->getFilteredText(Functions::getPublicFile("includes/footer.html"));
예제 #9
0
<?php

function getReplaceChars($object, $name = "")
{
    switch ($name) {
        case "improve":
            return array("%%ID%%" => $object->getId(), "%%NAME%%" => $object->getName(), "%%CONTENT%%" => $object->getContent(), "%%PICTURE%%" => $object->getPicture());
            break;
        case "improve1":
            return array("%%ID%%" => $object->getId());
            break;
    }
    return array();
}
if (strcmp("fr", Config::$CURRENT_LANGUAGE) == 0) {
    $current = "-page";
} else {
    $current = "";
}
$datetime1 = new DateTime(date("Y-m-d"));
$datetime2 = new DateTime('1986-01-01');
$interval = $datetime1->diff($datetime2);
$this->html->setCommonArray(array("%%INDEXCLASS%%" => "", "%%PORTFOLIO%%" => "", "%%BLOG%%" => "", "%%SERVICES%%" => "", "%%ABOUT%%" => "current" . $current, "%%CONTACT%%" => "", "%%AGE%%" => $interval->format('%y')));
$improve = Models::getImproveObject();
$improve->fetchAllImproves();
echo $this->html->getFilteredText(Functions::getPublicFile("includes/head.html"));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/header.html"));
echo $this->html->getReplacedHTMLRepeatedBlockByModelObject(array("improve" => $improve, "improve1" => $improve), Functions::getPublicFileURL("pages/about.html"), "getReplaceChars");
echo $this->html->getFilteredText(Functions::getPublicFile("includes/footer.html"));
예제 #10
0
            return array("%%ID%%" => $object->getId(), "%%NAME%%" => $object->getName(), "%%CATEGORY_URL%%" => Functions::getDefaultURL() . "product/" . str_replace(" ", "_", $object->getName()), "%%PICTURE%%" => $object->getPicture(), "%%DESCRIPTION%%" => $object->getDescription(), "%%COUNT%%" => $product->getCount(), "%%SELECTED%%" => defined("CATEGORY_NAME") && $object->getIdFromName(str_replace("_", " ", CATEGORY_NAME)) == $object->getId() ? "selected" : "");
            break;
    }
    return array();
}
$page = "product";
if (isset($this->request["REQUEST_URI"][1])) {
    define("CATEGORY_NAME", $this->request["REQUEST_URI"][1]);
}
if (strcmp("fr", Config::$CURRENT_LANGUAGE) == 0) {
    $current = "-page";
} else {
    $current = "";
}
$this->html->setCommonArray(array("%%INDEXCLASS%%" => "", "%%PORTFOLIO%%" => "", "%%BLOG%%" => "", "%%PRODUCT%%" => "current" . $current, "%%SERVICES%%" => "", "%%ABOUT%%" => "", "%%CONTACT%%" => ""));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/head.html"));
echo $this->html->getFilteredText(Functions::getPublicFile("includes/header.html"));
$product = Models::getProductObject();
$category = Models::getCategoryObject();
$title = "Nos produits";
if (defined("CATEGORY_NAME") && $product->existCategoryId($category->getIdFromName(str_replace("_", " ", CATEGORY_NAME)))) {
    $product->fetchProductByCategoryId($category->getIdFromName(str_replace("_", " ", CATEGORY_NAME)));
    $title = ucfirst(str_replace("_", " ", CATEGORY_NAME));
    $page = "product.detail";
} else {
    $product->fetchProductByDistinctCategory();
}
$category->fetchCategoryByType("product");
$this->html->setCommonArray(array("%%TITLE%%" => $title));
echo $this->html->getReplacedHTMLRepeatedBlockByModelObject(array("product" => $product, "category" => $category), Functions::getPublicFileURL("pages/" . $page . ".html"), "getReplaceChars");
echo $this->html->getFilteredText(Functions::getPublicFile("includes/footer.html"));