Esempio n. 1
0
 /**
  *
  *
  * @note HTTP 입력 변수로 condition 값이 들어오며 적절한 처리를 하여 JSON 으로 리턴한다.
  *
  * 내부적으로는 Entity::search() 를 사용하므로 where, limit, offset, page, order_by, fields 의 값을 그대로 사용 할 수 있다.
  *
  *
  *  &entity=데이터베이스 테이블
  *  &where=의 값은 entity->search() 의 where SQL 컨디션과 동일
  *  &order_by=SQL ORDER BY 컨디션
  *  &limit=, &offset=, &page= 의 값은 entity::search() 의 것과 동일
  *
  * @return JSON 내부의 동작은 entity::search() 의 것과 동일하지만, 결과는 JSON 으로 리턴한다.
  *
  * @code 쿼리 예제
  * http://philgo.org/?module=overframe&action=index&model=entity.crud.collect&entity=data&order_by=id%20ASC&fields=id,finish,name&where=id%3E3&limit=3
  * @endcode
  */
 public function collect($in)
 {
     $o['fields'] = isset($in['fields']) ? $in['fields'] : '*';
     $o['where'] = isset($in['where']) ? $in['where'] : null;
     $o['order_by'] = isset($in['order_by']) ? $in['order_by'] : 'id DESC';
     $o['limit'] = isset($in['limit']) ? $in['limit'] : 10;
     $o['page'] = isset($in['page']) ? $in['page'] : 1;
     $o['offset'] = isset($in['offset']) ? $in['offset'] : 0;
     $entity_name = $in['entity'];
     $node = node($entity_name);
     $entities = $node->search($o);
     $data = array();
     foreach ($entities as $e) {
         $data[] = $e->getRecord();
     }
     return $data;
 }
Esempio n. 2
0
         $size = explode("x", $tmp_tab_path_info[5]);
         $newurl = __cachefolderimg__ . "/" . $tmp_tab_path_info[2] . "/" . implode("_", $tmp_tab_path_info) . "." . $ext;
         if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $newurl)) {
             if (!is_dir($_SERVER["DOCUMENT_ROOT"] . __cachefolderimg__ . "/" . $tmp_tab_path_info[2])) {
                 mkdir($_SERVER["DOCUMENT_ROOT"] . __cachefolderimg__ . "/" . $tmp_tab_path_info[2]);
             }
             smart_resize_image($_SERVER["DOCUMENT_ROOT"] . $url, $size[0], $size[1], true, $_SERVER["DOCUMENT_ROOT"] . $newurl, false);
         }
         $url = $newurl;
     }
     readfile($_SERVER["DOCUMENT_ROOT"] . $url);
     die;
 }
 if (trim($tmp_tab_path_info[1]) == "download") {
     if (trim($tmp_tab_path_info[2]) == "all") {
         $tbl_info = node($tmp_tab_path_info[3]);
         $tbl_file = contextfile($tmp_tab_path_info[3]);
         //creation du répertoire
         //print $_SERVER["DOCUMENT_ROOT"].__uploaddirfront__."arbre".$tab_path_info[3];
         @mkdir($_SERVER["DOCUMENT_ROOT"] . __uploaddirfront__ . "arbre" . $tmp_tab_path_info[3]);
         //copie des fichiers
         for ($i = 0; $i < count($tbl_file); $i++) {
             copy($_SERVER["DOCUMENT_ROOT"] . __uploaddirfront__ . __racinebd__ . "fichiers" . $tbl_file[$i]["fichiers_id"] . "." . $tbl_file[$i]["ext"], $_SERVER["DOCUMENT_ROOT"] . __uploaddirfront__ . "arbre" . $tmp_tab_path_info[3] . "/" . str_replace("." . $tbl_file[$i]["ext"], "", $tbl_file[$i]["nom_fichier"]) . $tbl_file[$i]["fichiers_id"] . "." . $tbl_file[$i]["ext"]);
         }
         //die;
         $filename = $_SERVER["DOCUMENT_ROOT"] . __uploaddirfront__ . urlencode($tbl_info["titre1"]);
         //print "zip -r ".$filename." ".$_SERVER["DOCUMENT_ROOT"].__uploaddirfront__."arbre".$tab_path_info[3];
         //die;
         exec("zip -r " . $filename . " " . $_SERVER["DOCUMENT_ROOT"] . __uploaddirfront__ . "arbre" . $tmp_tab_path_info[3]);
         header("Cache-control: private");
         // fix for IE
Esempio n. 3
0
<?php

$tbl_info = node();
Esempio n. 4
0
<?php

echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
function node($url)
{
    return '<url>
    <loc>http://myoption.ru/' . trim($url) . '</loc>
</url>' . "\n";
}
foreach ($articles as $key => $first_level) {
    echo node($first_level['url']);
    if ($first_level['children']) {
        foreach ($first_level['children'] as $k => $second_level) {
            echo node($second_level['url']);
            if ($second_level['articles']) {
                foreach ($second_level['articles'] as $item) {
                    echo node($item['url']);
                }
            }
        }
    }
}
foreach ($pages as $key => $page) {
    echo node($page['url']);
}
echo '</urlset>';
Esempio n. 5
0
function rulesuserfront()
{
    /*
      print function_exists(rulesuserfrontcustom());
      die;*/
    if (!function_exists(rulesuserfrontcustom)) {
        //print "icijc";
        if ($_GET["arbre"] != "") {
            $tbl_info = node();
            $sql = "select content_id from " . __racinebd__ . "groupefront_user gfu inner join " . __racinebd__ . "groupefront_content gfc on gfu.groupefront_id=gfc.groupefront_id and content_id='" . $tbl_info["content_id"] . "' and userfront_id=" . $_SESSION["userfront_id"];
            //print $sql;
            $link = query($sql);
            if (num_rows($link) == 0) {
                return false;
            } else {
                return true;
            }
        }
    } else {
        return rulesuserfrontcustom();
    }
}
Esempio n. 6
0
function nodelistgp($grandpere = 0, $limit = 0, $orderby = "a.ordre", $gabarit_id = 0, $where = '', $etat_id = 0, $version_id = 0, $langue_id = 0)
{
    $langue_id = $langue_id == 0 && $_GET["la_langue"] == "" ? __defaultlangueid__ : ($langue_id != "" ? $langue_id : $_GET["la_langue"]);
    $grandpere = $grandpere === 0 ? $_GET["arbre"] : $grandpere;
    $limit = $limit == 0 ? "" : "limit " . $limit;
    $orderby = "order by " . $orderby;
    $etat_id = $etat_id == 0 ? $_GET["etat_id"] : $etat_id;
    $version_id = $version_id == 0 ? $_GET["version_id"] : $version_id;
    $gabarit_id = $gabarit_id == 0 ? "" : "and a.gabarit_id in(" . $gabarit_id . ")";
    $sql = "select a.arbre_id from \r\n          " . __racinebd__ . "content c1 inner join " . __racinebd__ . "contenu c on c1.contenu_id=c.contenu_id  \r\n          inner join " . __racinebd__ . "arbre a on ((c.arbre_id=a.arbre_id and a.arbre_id_alias is null) or (c.arbre_id=a.arbre_id_alias and a.arbre_id_alias is not null)) and c.langue_id=" . __defaultlangueid__ . "\r\n          inner join " . __racinebd__ . "gabarit g on g.gabarit_id=a.gabarit_id\r\n          inner join " . __racinebd__ . "arbre a2 on a.pere=a2.arbre_id  \r\n          and a.etat_id in(" . $etat_id . ") and c1.version_id in(" . $version_id . ")\r\n          and a.supprimer=0 and a2.pere=" . $grandpere . " " . $gabarit_id . " " . $where . " " . $orderby . " " . $limit;
    /*
    $sql="select arbre_id from arbre a
            inner join gabarit g on a.gabarit_id=g.gabarit_id and a.supprimer=0 and a.pere=".$pere." ".$gabarit_id."  
            ".$where." ".$orderby." ".$limit;
    */
    //print $sql;
    $link = query($sql);
    $tbl_result_final = array();
    while ($tbl_result = fetch($link)) {
        $tbl = node($tbl_result["arbre_id"], $etat_id, $version_id, $langue_id);
        if ($tbl["arbre_id"] != "") {
            $tbl_result_final[] = $tbl;
        }
    }
    return $limit == "limit 1" ? $tbl_result_final[0] : $tbl_result_final;
}
Esempio n. 7
0
 public function exists($tablename = null)
 {
     $attend = node('philgo_attend');
     $tablename = $attend->getTableName();
     return parent::exists($tablename);
 }
Esempio n. 8
0
 public function test_name()
 {
     test(node('abc')->getTableName() == 'abc_node_entity');
 }
Esempio n. 9
0
function generate($i, $map)
{
    $arr = coord($i);
    $x = $arr[0];
    $y = $arr[1];
    $map[$x][$y] = ' ';
    $next = array();
    if ($x - 2 > 0) {
        $next[myCount($next)] = array(-2, 0);
    }
    if ($x + 2 < NODE_WIDTH - 1) {
        $next[myCount($next)] = array(+2, 0);
    }
    if ($y - 2 > 0) {
        $next[myCount($next)] = array(0, -2);
    }
    if ($y + 2 < NODE_HEIGHT - 1) {
        $next[myCount($next)] = array(0, +2);
    }
    myShuffle($next);
    foreach ($next as $d) {
        if ($map[$y + $d[1]][$x + $d[0]] != ' ') {
            $map[$y + $d[1] / 2][$x + $d[0] / 2] = ' ';
            generate(node($x + $d[0], $y + $d[1]), $map);
        }
    }
    return null;
}