示例#1
0
文件: dict.php 项目: aikianapa/aiki
function dict__edit()
{
    $form = $_GET["form"];
    $out = ki::fromFile("http://{$_SERVER["HTTP_HOST"]}/engine/forms/{$form}/{$form}_edit.php");
    $Item = aikiReadItem("dict", $_GET["id"]);
    if ($_GET["id"] == "_new") {
        $Item["id"] = newIdRnd();
    } else {
        $out->find("#dictEditForm .nav-tabs li:eq(1)")->addClass("set_active");
    }
    $out->find("form button[data-formsave]")->parents(".form-group")->remove();
    $Item["form"] = $form;
    if (isset($Item["data"])) {
        $Item["data"] = json_encode($Item["data"]);
    }
    $out->contentSetData($Item);
    return $out->outerHtml();
}
示例#2
0
文件: setup.php 项目: aikianapa/aiki
$_SESSION["app_path"] = $_SERVER["DOCUMENT_ROOT"];
$_SESSION["engine_path"] = "{$_SERVER['DOCUMENT_ROOT']}/engine";
include_once "{$_SESSION["engine_path"]}/engine.php";
if (is_file("{$_SERVER['DOCUMENT_ROOT']}/contents/admin/settings")) {
    header("Refresh: 0; URL=http://{$_SERVER["HTTP_HOST"]}/login.htm");
    die;
}
comPathCheck();
copy("{$_SESSION["engine_path"]}/.htaccess", "{$_SERVER['DOCUMENT_ROOT']}/.htaccess");
copy("{$_SESSION["engine_path"]}/tpl/default.php", "{$_SERVER['DOCUMENT_ROOT']}/tpl/default.php");
copy("{$_SESSION["engine_path"]}/uploads/__system/index.php", "{$_SERVER['DOCUMENT_ROOT']}/index.php");
chmod("{$_SERVER['DOCUMENT_ROOT']}/.htaccess", 0766);
chmod("{$_SERVER['DOCUMENT_ROOT']}/tpl/default.php", 0766);
chmod("{$_SERVER['DOCUMENT_ROOT']}/index.php", 0766);
recurse_copy("{$_SESSION["engine_path"]}/uploads/__contents", "{$_SERVER['DOCUMENT_ROOT']}/contents");
$__page = ki::fromFile("{$_SESSION["engine_path"]}/tpl/admin.php");
$form = aikiGetForm("admin", "settings");
foreach ($form->find(".form-group") as $fg) {
    if (!$fg->hasClass("setup")) {
        $fg->remove();
    }
}
$form->find("[data-role=multiinput]")->remove();
$form->find("ul.nav li:not(.active)")->remove();
$__page->find("script[src=/engine/tpl/js/admin.js])")->remove();
$__page->find("head title")->html("Настройки");
$__page->find("head")->prepend("<script src='/engine/js/jquery.min.js'></script>");
$__page->find("head")->append("<link rel='stylesheet' href='/engine/appUI/css/bootstrap.min.css'>");
$__page->find("head")->prepend("<script src='/engine/js/jquery.min.js'></script>");
$__page->find("head")->append("<script src='/engine/bootstrap/js/bootstrap.min.js'></script>");
$__page->find("head")->append("<script src='/engine/js/functions.js'></script>");
示例#3
0
文件: kiDom.php 项目: aikianapa/aiki
 function tagGallery($Item)
 {
     $vars = $this->attr("vars");
     $src = $this->attr("src");
     $id = $this->attr("id");
     if ($vars > "") {
         $Item = attrAddData($vars, $Item);
     }
     $inner = ki::fromFile($_SESSION['engine_path'] . "/tpl/gallery.php");
     if ($src == "") {
         if (trim($this->html()) > "<p>&nbsp;</p>") {
             $inner->find(".comGallery")->html($this->html());
         }
     } else {
         $file = $_SESSION["prj_path"] . $src;
         if (is_file($_SERVER["DOCUMENT_ROOT"] . $file)) {
             $src = $file;
         }
         if (substr($src, 0, 7) != "http://") {
             if (substr($src, 0, 1) != "/") {
                 $src = "/" . $src;
             }
             $src = $_SERVER['DOCUMEN_ROOT'] . $src;
         }
         $inner->find(".comGallery")->html(ki::fromFile($src));
     }
     $this->html($inner);
     if ($id > "") {
         $this->find("#comGallery")->attr("id", $id);
     }
     $this->contentSetData($Item);
     $this->find(".comGallery")->removeAttr("vars");
     $this->find(".comGallery")->removeAttr("from");
     $this->find(".comGallery img[visible!=1]")->parents(".thumbnail")->remove();
     if (count($this->find(".comGallery")->children()) > 0) {
         $this->after($this->html());
     }
     $this->remove();
 }
示例#4
0
function getTemplate($tpl = NULL, $path = FALSE)
{
    // устаревшая функция
    if ($tpl == NULL && isset($_SESSION["engine_tpl"])) {
        $tpl = $_SESSION["engine_tpl"];
    }
    if (!isset($_GET["mode"])) {
        $_GET["mode"] = "show";
        $_GET["form"] = "page";
        $_GET["id"] = "home";
    } else {
        $mode = $_GET["mode"];
        $form = $_GET["form"];
        if ($tpl == NULL) {
            $tpl = "{$_GET["form"]}_{$_GET["mode"]}.php";
        }
    }
    if ($_GET["mode"] == "show" && $_GET["form"] == "login") {
        $tpl = "login.php";
    }
    if ($path == FALSE) {
        $tpl = "/tpl/" . $tpl;
        $current = "";
        $res = false;
        if ($res == false && is_file($_SESSION["prj_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) {
            $current = $_SESSION["prj_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php";
            $res = true;
        }
        if ($res == false && is_file($_SESSION["app_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) {
            $current = $_SESSION["app_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php";
            $res = true;
        }
        if ($res == false && is_file($_SESSION["root_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) {
            $current = $_SESSION["root_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php";
            $res = true;
        }
        if ($res == false && is_file($_SESSION["engine_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php")) {
            $current = $_SESSION["engine_path"] . "/forms/{$_GET["form"]}_{$_GET["mode"]}.php";
            $res = true;
        }
        if ($res == false && is_file($_SESSION["engine_path"] . "/forms/common/common_{$_GET["mode"]}.php")) {
            $current = $_SESSION["engine_path"] . "/forms/{common/common_{$_GET["mode"]}.php";
            $res = true;
        }
        if ($res == false && is_file($_SESSION["app_path"] . $tpl)) {
            $current = $_SESSION["app_path"] . $tpl;
            $res = true;
        }
        if ($res == false && is_file($_SESSION["root_path"] . $tpl)) {
            $current = $_SESSION["root_path"] . $tpl;
            $res = true;
        }
        if ($res == false && is_file($_SESSION["engine_path"] . $tpl)) {
            $current = $_SESSION["engine_path"] . $tpl;
            $res = true;
        }
        $current = str_replace($_SESSION["root_path"], "", $current);
        if (isset($_GET["form"]) && $_GET["form"] > "") {
            $form = $_GET["form"];
        }
        if (isset($_GET["mode"]) && $_GET["mode"] > "") {
            $mode = $_GET["mode"];
        }
        if (!isset($_SESSION["getTpl"])) {
            // нужно, чтобы небыло зацикливания
            $inc = array("{$_SESSION["root_path"]}/forms/{$_GET["form"]}.php", "{$_SESSION["root_path"]}/forms/{$_GET["form"]}/{$_GET["form"]}.php", "{$_SESSION["engine_path"]}/forms/{$_GET["form"]}.php", "{$_SESSION["engine_path"]}/forms/{$_GET["form"]}/{$_GET["form"]}.php");
            $res = FALSE;
            foreach ($inc as $k => $file) {
                if (is_file("{$file}") && $res == FALSE) {
                    include_once "{$file}";
                    $res = TRUE;
                }
            }
            include_once "{$_SESSION["engine_path"]}/forms/common/common.php";
            $res = false;
            $_SESSION["getTpl"] = true;
            if ($res == false && is_callable($mode)) {
                $__page = $mode();
                $res = true;
            }
            $call = "{$form}_{$mode}";
            if ($res == false && is_callable($call)) {
                $__page = $call();
                $res = true;
            }
            // в проектах
            $call = "common__{$mode}";
            if ($res == false && is_callable($call)) {
                $__page = $call();
                $res = true;
            }
            // в общем случае
            $call = "{$form}__{$mode}";
            if ($res == false && is_callable($call)) {
                $__page = $call();
                $res = true;
            }
            // в engine
            unset($_SESSION["getTpl"]);
        }
        if (!isset($__page) or !is_object($__page) && $current > "") {
            $__page = ki::fromFile("{$_SERVER["DOCUMENT_ROOT"]}{$current}");
        }
        if (!is_object($__page) && $current == "") {
            $__page = ki::fromString("");
        }
    } else {
        if (!is_file($tpl)) {
            $tpl = "{$_SERVER["DOCUMENT_ROOT"]}/{$tpl}";
        }
        $__page = ki::fromFile($tpl);
    }
    return $__page;
}