예제 #1
0
파일: admin.php 프로젝트: aikianapa/aiki
function admin__settings()
{
    $out = aikiGetForm($_GET["form"], $_GET["mode"]);
    $Item = fileReadItem($_GET["form"], $_GET["mode"]);
    $checkout_list = aikiCheckoutForms();
    if (count($checkout_list) > 0) {
        $Item["checkout_list"] = $checkout_list;
    } else {
        $out->find("select[name=checkout]")->parents(".form-group")->remove();
    }
    $Item["tpllist"] = aikiListTpl();
    $Item["formlist"] = aikiListForms();
    $out->contentSetData($Item);
    return $out->htmlOuter();
}
예제 #2
0
파일: kiDom.php 프로젝트: aikianapa/aiki
 function tagThumbnail($Item = array())
 {
     $bkg = false;
     $img = "";
     $src = $this->attr("src");
     $noimg = $this->attr("noimg");
     $form = $this->attr("form");
     if ($form == "") {
         $form = $Item["form"];
     }
     $item = $this->attr("item");
     if ($item == "") {
         $item = $Item["id"];
     }
     $show = $this->attr("show");
     $class = $this->attr("class");
     $style = $this->attr("style");
     $width = $this->attr("width");
     if ($width == "") {
         $width = "160px";
     }
     $height = $this->attr("height");
     if ($height == "") {
         $height = "120px";
     }
     $offset = $this->attr("offset");
     $contain = $this->attr("contain");
     $srcSrc = $src;
     $srcImg = explode("/", trim($src));
     $srcImg = $srcImg[count($srcImg) - 1];
     $srcExt = explode(".", strtolower(trim($srcImg)));
     $srcExt = $srcExt[count($srcExt) - 1];
     $exts = array("jpg", "gif", "png", "svg", "pdf");
     if (!in_array($srcExt, $exts)) {
         $src = "/engine/uploads/__system/filetypes/{$srcExt}.png";
         $img = "{$srcExt}.png";
         $ext = "png";
     }
     if ($form > "" && $item > "") {
         $Item = fileReadItem($form, $item);
     }
     $json = $this->attr('json');
     if ($json > "") {
         $images = json_decode($json, true);
     } else {
         if (isset($Item["images"])) {
             if (is_array($Item["images"])) {
                 $images = $Item["images"];
             } else {
                 $images = json_decode($Item["images"], true);
             }
         } else {
             $images = "";
         }
     }
     if (is_numeric($this->attr("src"))) {
         $idx = $this->attr("src");
         $this->removeAttr("src");
         $num = true;
     } else {
         $idx = $this->parents("[idx]")->attr("idx");
         if ($idx > "" && $src == "") {
             $num = true;
         } else {
             $idx = 0;
         }
     }
     $size = $this->attr("size");
     if ($size > "") {
         $size = explode(";", $size);
         if (count($size) == 1) {
             $size[1] = $size[0];
         }
         $width = $size[0];
         $height = $size[1];
         if (isset($size[2]) && $size[2] == "src") {
             $bkg = false;
         } else {
             $bkg = true;
         }
     }
     if ($offset > "") {
         $offset = explode(";", $offset);
         if (count($offset) == 1) {
             $offset[1] = $offset[0];
         }
         $top = $offset[1];
         $left = $offset[0];
     } else {
         $top = "15%";
         $left = "50%";
     }
     if (!is_file($_SESSION["app_path"] . $src) && !is_file($_SERVER["DOCUMENT_ROOT"] . $src)) {
         if (isset($Item["img"]) && !isset($Item["images"]) && isset($Item["%images"]) && !is_file($src)) {
             $tmpItem = array();
             $tmpItem["images"] = $Item["%images"];
             $tmpItem["form"] = $Item["%form"];
             $tmpItem["id"] = $Item["%id"];
             $src = aikiGetItemImg($tmpItem, $idx, $noimg);
         } else {
             if ($noimg > "") {
                 $src = $noimg;
             } else {
                 if ($bkg == true) {
                     $src = "/engine/uploads/__system/image.svg";
                     $img = "image.svg";
                     $ext = "svg";
                 }
                 if ($bkg == false) {
                     $src = "/engine/uploads/__system/image.jpg";
                     $img = "image.jpg";
                     $ext = "jpg";
                 }
             }
         }
     }
     $img = explode("/", trim($src));
     $img = $img[count($img) - 1];
     $ext = explode(".", trim($src));
     $ext = $ext[count($ext) - 1];
     if (is_array($images)) {
         if (isset($images[$idx])) {
             $img = $images[$idx]["img"];
         } else {
             $img = "";
         }
         $src = aikiGetItemImg($Item, $idx, $noimg);
         $this->attr("src", $src);
     }
     if ($src == array()) {
         $src = "";
     }
     if ($img == "" and $bkg == true) {
         $src = "/engine/uploads/__system/image.svg";
         $img = "image.svg";
         $ext = "svg";
     }
     if ($src == "" and $bkg == true) {
         $src = "/engine/uploads/__system/image.svg";
         $img = "image.svg";
         $ext = "svg";
     } else {
         if ($src == "" and $bkg == false) {
             $src = "/engine/uploads/__system/image.jpg";
             $img = "image.jpg";
             $ext = "jpg";
         }
         $img = explode("/", $src);
         $img = $img[count($img) - 1];
         $this->attr("img", $img);
         $ext = substr($img, -3);
     }
     if ($ext !== "svg") {
         if ($contain == "true") {
             $thumb = "thumbc";
         } else {
             $thumb = "thumb";
         }
         $src = urldecode($src);
         if (substr($width, -1) == "%" or substr($height, -1) == "%") {
             list($w, $h, $t) = getimagesize($_SERVER["DOCUMENT_ROOT"] . $src);
             $w = ceil($w / 100 * ($width + 0));
             $h = ceil($h / 100 * ($height + 0));
             $src = "/{$thumb}/{$w}x{$h}/src{$src}";
         } else {
             $w = $width + 0;
             $h = $height + 0;
             $src = "/{$thumb}/{$w}x{$h}/src{$src}";
         }
     }
     if ($bkg == true) {
         if (!in_array($srcExt, $exts)) {
             $bSize = "contain";
         } else {
             $bSize = "cover";
         }
         $style .= "width:{$width}; height: {$height}; background: url('{$src}') {$left} {$top} no-repeat; display:inline-block; background-size: {$bSize}; background-clip: content-box;";
         $this->attr("src", "/engine/uploads/__system/transparent.png");
         $this->attr("width", $width);
         $this->attr("height", $height);
     } else {
         if ($ext !== "svg") {
             //			$src.="&h={$height}&zc=1";
             $this->attr("src", $src);
         }
     }
     $this->attr("data-src", $srcSrc);
     $this->attr("data-ext", $srcExt);
     $this->attr("class", $class);
     $this->attr("noimg", $noimg);
     $this->attr("style", $style);
     $this->removeAttr('json');
 }
예제 #3
0
function formSave($form, $datatype = "file", $table = "")
{
    // $datatype: file - file system; mysql = database system
    if ($datatype == "file") {
        $Item = fileReadItem($form, $_POST["id"]);
        if (isset($fields) && is_array($fields)) {
            foreach ($fields as $key => $val) {
                if (isset($_POST[$val])) {
                    $Item[$val] = $_POST[$val];
                }
            }
        } else {
            $Item = $_POST;
        }
        $Item["form"] = $form;
        formPathCheck($form, $Item["id"]);
        //		if ($form=="admin") $Item=adminBeforeFormSave($Item);
        $res = fileSaveItem($form, $Item);
    } else {
        if ($table == "") {
            $table = $form;
        }
        $Item = mysqlReadItem($table, $_POST["id"]);
        if ($Item == FALSE) {
            $Item = "";
            $_POST["id"] = mysqlInsertItem($table, $_POST["id"]);
        }
        $Item = $_POST;
        $Item["form"] = $form;
        formPathCheck($form, $Item["id"]);
        $res = mysqlSaveItem($table, $Item);
    }
    return $res;
}