Esempio n. 1
0
function _ordersAfterSaveItem($Item)
{
    if ($_POST["order"] == "on") {
        _ordersMail($Item);
        $_SESSION["order_id"] = newIdRnd();
    }
    return $Item;
}
Esempio n. 2
0
function _commentsBeforeSaveItem($Item)
{
    if (!isset($Item["id"]) or $Item["id"] == "_new") {
        $Item["id"] = newIdRnd();
    }
    if (!isset($Item["date"]) or $Item["date"] == "") {
        $Item["date"] = date("Y-m-d H:i:s");
    }
    return $Item;
}
Esempio n. 3
0
function news__edit()
{
    $out = aikiGetForm($_GET["form"], $_GET["mode"]);
    $Item = aikiReadItem("news", $_GET["id"]);
    if ($_GET["id"] == "_new") {
        $Item["id"] = newIdRnd();
    }
    $Item = _newsBeforeShowItem($Item);
    $out->contentSetData($Item);
    return $out->htmlOuter();
}
Esempio n. 4
0
function prod__edit()
{
    $out = aikiGetForm($_GET["form"], $_GET["mode"]);
    $Item = aikiReadItem($_GET["form"], $_GET["id"]);
    $Item["form"] = $_GET["form"];
    if ($_GET["id"] == "_new") {
        $Item["id"] = newIdRnd();
    }
    $out->contentSetData($Item);
    return $out->outerHtml();
}
Esempio n. 5
0
function common__edit()
{
    $out = aikiGetForm($_GET["form"], $_GET["mode"]);
    if (!isset($_GET["id"]) or $_GET["id"] == "_new" or $_GET["id"] == "") {
        $_GET["id"] = newIdRnd();
    }
    $Item = aikiReadItem($_GET["form"], $_GET["id"]);
    $Item["form"] = $_GET["form"];
    $out->contentSetData($Item);
    $i = 0;
    return clearValueTags($out->outerHtml());
}
Esempio n. 6
0
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();
}
Esempio n. 7
0
function page__edit()
{
    $out = aikiGetForm($_GET["form"], $_GET["mode"]);
    $Item = aikiReadItem("page", $_GET["id"]);
    if ($_GET["id"] == "_new") {
        $Item["id"] = newIdRnd();
        $Item["template"] = $_SESSION["settings"]["template"];
    }
    $Item["tpllist"] = aikiListTpl();
    $out->contentSetData($Item);
    $options = $out->find("select[name=template] option");
    foreach ($options as $opt) {
        if (strpos($opt->attr("value"), ".inc.")) {
            $opt->remove();
        }
    }
    return $out->outerHtml();
}
Esempio n. 8
0
function users__reg_mail($text)
{
    $Item = $_POST;
    $Item["id"] = newIdRnd();
    $Item["form"] = "users";
    $Item["password"] = md5($Item["password"]);
    $mt = explode(" ", microtime());
    $Item["verify"] = dechex(ceil($mt[0] * 1000000 . time()));
    if (!isset($Item["login"])) {
        $Item["login"] = $Item["email"];
    }
    aikiSaveItem("users", $Item);
    $_POST["link"] = "http://{$_SERVER['HTTP_HOST']}/engine/ajax.php?mode=activation&form=users&item={$Item['id']}&code={$Item['verify']}";
    $_POST["login"] = $Item["login"];
    $text->contentSetValues($_POST);
    $text = $text->find("#mail_text")->outerHtml();
    if (isset($_POST["email"]) && $_POST["email"] > "") {
        mail($_POST["email"] . "," . $_SESSION["settings"]["email"], "Регистрация", $text, "From: {$_SERVER["HTTP_HOST"]} <{$_SESSION['settings']['email']}>\nContent-Type: text/html; charset=UTF-8");
    }
}
Esempio n. 9
0
 function tagDataPagination($size = 10)
 {
     $len = count($this->children());
     $pages = intval($len / $size);
     if ($len / $size - $pages > 0) {
         $pages = $pages + 1;
     }
     if ($pages > 1) {
         $id = $this->attr("id");
         if ($id == "") {
             $id = newIdRnd();
             $this->attr("id", $id);
         }
         $class = "page-" . $id;
         $this->after("<ul id='" . $class . "' class='pagination'></ul>");
         for ($i = 1; $i <= $pages; $i++) {
             //$this->append("<div class='".$class." hidden' id='".$class."-".$i."'></div>");
             $this->next("#{$class}")->append("<li><a href='#' data='" . $class . "-" . $i . "'>{$i}</a></li>");
         }
         $pos = 0;
         $list = $this->children()->not(".{$class}");
         foreach ($list as $child) {
             if (!$child->is("textarea")) {
                 $cur = intval($pos / $size) + 1;
                 $child->attr("data-page", "{$class}-{$cur}");
                 //$this->find("#{$class}-{$cur}")->append($child);
                 $pos = $pos + 1;
             }
         }
         unset($child, $list);
     }
     $this->removeAttr("data-pagination");
 }
Esempio n. 10
0
function comSession()
{
    $_SESSION["cache"] = 0;
    $_SESSION["_new"] = newIdRnd();
    $_SESSION["app_path"] = "{$_SERVER['DOCUMENT_ROOT']}";
    $_SESSION["root_path"] = "{$_SERVER['DOCUMENT_ROOT']}";
    $_SESSION["HTTP_HOST"] = $_SERVER['HTTP_HOST'];
    $domain = explode(".", str_replace("www.", "", strtolower($_SERVER["HTTP_HOST"])));
    if (count($domain) == 3 and $_SESSION["projects"] == "on") {
        if ($domain[0] != "www") {
            $_SESSION["project"] = $domain[0];
            $_SESSION["app_path"] .= "/projects/" . $domain[0];
            if (!is_dir($_SESSION["app_path"])) {
                //if (!is_dir($_SESSION["app_path"])) {mkdir($_SESSION["app_path"]);}
            }
        }
    } else {
        $_SESSION["project"] = "";
    }
    $_SESSION["prj_path"] = str_replace($_SESSION["root_path"], "", $_SESSION["app_path"]);
    if (!isset($_SESSION["User"])) {
        $_SESSION["User"] = "******";
    }
    include_once "{$_SESSION["engine_path"]}/functions.php";
    if (!isset($_SESSION["order_id"])) {
        $_SESSION["order_id"] = get_order_id();
    }
    if (!is_file($_SESSION["app_path"] . "/contents/dict/user_role")) {
        copy("{$_SESSION["engine_path"]}/uploads/__contents/dict/user_role", $_SESSION["app_path"] . "/contents/dict/user_role");
    }
}