function get_tree($dir, &$ret_array) { foreach (glob($dir . "/*") as $file_path) { if (is_file($file_path)) { $filename = basename($file_path); if ($filename == "index.tts.php") { include $file_path; foreach ($treeIndex as $toolName => $subArray) { if ($toolName == "title") { continue; } array_push($ret_array, '<li data-options="attributes:{file_path:\'' . $file_path . '\', tool_name:\'' . $toolName . '\'}">'); array_push($ret_array, "<span>" . $subArray["name"] . "</span>"); array_push($ret_array, "</li>"); } } } else { if (file_exists($file_path . "/index.tts.php")) { include $file_path . "/index.tts.php"; array_push($ret_array, '<li data-options="state:\'closed\'">'); array_push($ret_array, "<span>" . $treeIndex["title"] . "</span>"); array_push($ret_array, "<ul>"); get_tree($file_path, $ret_array); array_push($ret_array, "</ul>"); array_push($ret_array, "</li>"); } } } }
function get_tree($id = 0, $open_nodes, $level = 0, $url = "") { global $cid; $furl = $url; $level++; $style = $level == 1 ? " style=\"margin-left: 0px; padding-left: 0px;\"" : ""; $db = new sql(); $db->connect(); $res = $db->query(_QUERY . " where pid={$id} order by sortorder"); if ($db->num_rows($res) > 0) { $s .= "<ul{$style}>\n"; while ($data = $db->fetch_array($res)) { $gc = got_child($data["id"]); $img = $gc ? $open_nodes[$data["id"]] ? "minus" : "plus" : "dot"; $img1 = $gc ? $open_nodes[$data["id"]] ? "folderopen" : "folder" : "page"; $pid = $open_nodes[$data["id"]] ? $data["pid"] : $data["id"]; $checked = $data["id"] == $cid ? " checked" : ""; $url .= "/" . $data["url"]; $a_o = $gc ? "<a href=\"?id={$pid}\" class=\"{$class}\" id=\"tree\">" : ""; $a_c = $gc ? "</a>" : ""; $s .= "<li>{$a_o}<img src=\"../i/" . $img . ".gif\" alt=\"\" border=\"0\" align=\"absmiddle\" height=\"20\" width=\"20\" style=\"margin: 3px;\"><input type=\"radio\" name=\"sel\" id =\"sel\" value=\"" . $url . "/\" align=\"middle\" style=\"border-width: 0px\" onClick=\"onSelect()\"{$checked}><img src=\"../i/{$img1}.gif\" alt=\"\" border=\"0\" align=\"absmiddle\" height=\"20\" width=\"20\" style=\"margin: 3px;\"><span id=\"name" . $data["id"] . "\">" . $data["title"] . "</span>{$a_c}</li>\n"; if ($open_nodes[$data["id"]]) { $s .= get_tree($data["id"], $open_nodes, $level, $url); } else { $url = $furl; } } $s .= "</ul>\n"; return $s; } else { return; } }
function get_tree($dir) { $res = ""; $handle = opendir($dir); $files = array(); $dirs = array(); while (($file = readdir($handle)) !== false) { if ($file[0] != ".") { if (is_dir($dir . "/" . $file)) { $dirs[] = $file; } else { $files[] = $file; } } } closedir($handle); sort($files); sort($dirs); $files = array_merge($dirs, $files); for ($i = 0; $i < count($files); $i++) { $file = $files[$i]; $res .= "{"; $res .= "\"text\": \"" . $file . "\""; $path = $dir . "/" . $file; if (is_dir($path)) { $res .= ", \"icon\": \"images/blue-folder.png\""; $res .= ", \"children\": [" . get_tree($path) . "]"; } else { $res .= ", \"icon\": \"images/blue-document.png\""; } $res .= "}"; if ($i + 1 != count($files)) { $res .= ","; } } return $res; }
function get_tree($start) { $dh = @opendir($start); $block_size = @explode("/", $start); for ($i = 1; $i < sizeof($block_size); $i++) { $block .= "<font color=#999999>|</font>"; } unset($buff); while ($dir = @readdir($dh)) { if ($dir == "." || $dir == "..") { continue; } if (!($dh2 = @opendir("{$start}/{$dir}"))) { continue; } $buff[] = $dir; @closedir($dh2); } @sort($buff); for ($i = 0; $i < sizeof($buff); $i++) { echo $block . " <font color=#999999>+</font> {$buff[$i]}(" . substr(sprintf('%o', fileperms("{$start}/{$buff[$i]}")), -4) . ")<br>\n"; get_tree("{$start}/{$buff[$i]}"); } @closedir($dh); }
<?php $str = get_tree($project_id); $prjurl = "project_view.php?recordID=" . $project_id . "&pagetab=allprj"; ?> <link rel="StyleSheet" href="dtree/dtree.css" type="text/css" /> <script type="text/javascript" src="dtree/dtree.js"></script> <body onLoad="javascript: d.openTo(<?php if ($pagename == "project_view.php") { echo "-1"; } else { echo $node_id_task; } ?> ,true);"> <script type="text/javascript" language="javascript"> function TuneHeight() { var frm = document.getElementById("frame_content"); var subWeb = document.frames ? document.frames["main_frame"].document : frm.contentDocument; if(frm != null && subWeb != null) { frm.height = subWeb.body.scrollHeight;} } $(document).ready(function() {
<?php require '../../utility/common.php'; list($user_id, $tree, $name) = logged_in(); validate_key(); $groupids = array(); $select_db = connect('select'); foreach ($_POST['add'] as $key => $value) { $parentgroups = get_path_to($select_db, $value); for ($i = 0; $i < count($parentgroups); $i++) { if (!in_array($parentgroups[$i]['id'], $groupids)) { array_push($groupids, $parentgroups[$i]['id']); } } } $insert_db = connect('insert'); $stmt = $insert_db->prepare('INSERT IGNORE INTO group_users VALUES (:userid, :groupid)'); $stmt->bindParam(':userid', $user_id, PDO::PARAM_INT); $stmt->bindParam(':groupid', $group_id, PDO::PARAM_INT); for ($i = 0; $i < count($groupids); $i++) { $group_id = $groupids[$i]; $stmt->execute(); } session_start(); $_SESSION['tree'] = get_tree($select_db, $user_id); session_commit(); header('Location: ../groups.php');
function get_tree($path = '.', $clean_path = '', $title = '') { $tree = array(); $ignore = array('config.json', 'cgi-bin', '.', '..'); $dh = @opendir($path); $index = 0; // Build array of paths $paths = array(); while (false !== ($file = readdir($dh))) { $paths[$file] = $file; } // Close the directory handle closedir($dh); // Sort paths sort($paths); // Loop through the paths // while(false !== ($file = readdir($dh))){ foreach ($paths as $file) { // Check that this file is not to be ignored if (!in_array($file, $ignore)) { $full_path = "{$path}/{$file}"; $clean_sort = clean_sort($file); $url = $clean_path . '/' . $clean_sort; $clean_name = clean_name($clean_sort); // Title if (empty($title)) { $full_title = $clean_name; } else { $full_title = $title . ': ' . $clean_name; } if (is_dir("{$path}/{$file}")) { // Directory $tree[$clean_sort] = array('type' => 'folder', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url, 'tree' => get_tree($full_path, $url, $full_title)); } else { // File $tree[$clean_sort] = array('type' => 'file', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url); } } $index++; } return $tree; }
function get_tree($path = '.', $clean_path = '', $title = '', $first = true, $language = null) { $options = get_options(); $tree = array(); $ignore = get_ignored(); $dh = @opendir($path); $index = 0; // Build array of paths $paths = array(); while (false !== ($file = readdir($dh))) { $paths[$file] = $file; } // Close the directory handle closedir($dh); // Sort paths sort($paths); if ($first && $language !== null) { $language_path = $language . "/"; } else { $language_path = ""; } // Loop through the paths // while(false !== ($file = readdir($dh))){ foreach ($paths as $file) { // Check that this file or folder is not to be ignored if (!in_array($file, $ignore) && $file[0] !== '.') { $full_path = "{$path}/{$file}"; $clean_sort = clean_sort($file); // If clean_urls is set to false and this is the first branch of the tree, append index.php to the clean_path. if ($options['clean_urls'] == false) { if ($first) { $url = $clean_path . '/' . $language_path . 'index.php/' . $clean_sort; } else { $url = $clean_path . '/' . $language_path . $clean_sort; } } else { $url = $clean_path . '/' . $language_path . $clean_sort; } $clean_name = clean_name($clean_sort); // Title if (empty($title)) { $full_title = $clean_name; } else { $full_title = $title . ': ' . $clean_name; } if (is_dir("{$path}/{$file}")) { // Directory $tree[$clean_sort] = array('type' => 'folder', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url, 'tree' => get_tree($full_path, $url, $full_title, false, $language)); } else { // File $tree[$clean_sort] = array('type' => 'file', 'name' => $clean_name, 'title' => $full_title, 'path' => $full_path, 'clean' => $clean_sort, 'url' => $url); } } $index++; } return $tree; }
<?php require '../../utility/common.php'; logged_out(); validate_key(); $params = validate_params('POST', array('username', 'password'), array(0, 0), array(0, 0)); if (!$params) { error('invalid form data', '/account/login.php'); } $select_db = connect('select'); $stmt = dbexec($select_db, 'SELECT * FROM users WHERE username = ?', array($params['username']), array(PDO::PARAM_STR)); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (count($row) == 0) { //user is not in database, they need to sign up, or they have not activated their account yet error('You need to sign up first', '../login.php'); } elseif (!is_null($row['activation_key'])) { error('You have not activated your account yet', '../login.php'); } if (password_verify($params['password'], $row['password'])) { session_start(); session_regenerate_id(true); //stop session fixation $_SESSION['name'] = $row['username']; $_SESSION['user_id'] = $row['id']; $_SESSION['tree'] = get_tree($select_db, $row['id']); session_commit(); header('Location: /home/home.php'); } else { //users password was entered incorrectly error('Wrong password', '/account/login.php'); }
documentation and/or other materials provided with the distribution. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. */ require_once 'libs/functions.php'; $options = get_options(); $tree = get_tree("docs", $base_url); $homepage_url = homepage_url($tree); $docs_url = docs_url($tree); $page = load_page($tree); // If a timezone has been set in the config file, override the default PHP timezone for this application. if (isset($options['timezone'])) { date_default_timezone_set($options['timezone']); } // Redirect to docs, if there is no homepage if ($homepage && $homepage_url !== '/') { header('Location: ' . $homepage_url); } ?> <!doctype html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<?php } ?> <?php } ?> </div> <div class="myModalWrap"> <div class="modalBody"> <div id="close-modal" class="close-m">X</div> <h3>Выберите основной вид деятельности:</h3> <?php $par_id = get_all_parent_id(); echo "<div id='okved'></div>"; foreach ($par_id as $id) { get_tree($id); } ?> <p><a href="#" onclick="return false" id="close-modal">Готово</a></p> </div> </div> <?php wp_footer(); ?> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Interface de Test</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="userscript.js"></script> </head> <body id="main_body" > <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); require_once 'class.binarytree.php'; require_once 'class.binarynode.php'; require_once 'parsingFunctions2.php'; echo "Hell yeah!<br />"; $tree = get_tree("34/555"); $tree->traverse(); ?> </body>
<style> h3 {display:inline} </style> </head> <body style="background-color:#effaff;"> <h4>广告后台常用工具平台</h4> <a target="_blank" href="./readme.php">readme</a> <div style="height:10px;" name="just-for-row-space"></div> <div class="yui3-g"> <div class="yui3-u-1-4 mycontainer" id="file_index"> <?php include "./php/showTree.php"; $ret_array = array(); array_push($ret_array, '<ul id="tt" class="easyui-tree">'); get_tree(".", $ret_array); array_push($ret_array, '</ul>'); echo implode("\n", $ret_array); ?> </div> <div class="yui3-u-3-4 mycontainer" id="file_content" style="background:#f5f5f5"> </div> </div> <script> $("#tt").tree({ onClick: function(node) { var index_tts_file = node.attributes["file_path"]; var tool_name = node.attributes["tool_name"]; $("div#file_content").html("").load("./php/fileContent.php", {"file_path":index_tts_file, "tool_name": tool_name});
/** +---------------------------------------------------------- * 取得article表内容:热门/置顶/推荐/图文 * 示例:{:ShowArt([0],[10],[1],[0]);} [] 代表参数可省略 +---------------------------------------------------------- * @access article +---------------------------------------------------------- * @param int $num 开始位置[缺省为0] * @param int $num2 结束位置[缺省为10] * @param int $target 打开方式:0:原窗口(默认),1:新窗口 * @param int $max 0:热门(orderby hits)1:置顶(istop),2:推荐(ishot),3图文(isimg) * @param int $typeid :栏目ID +-------------------------------------------------------------------- */ function ShowArt($num, $num2, $target, $conditions, $typeid = 0) { $article = M('article'); $map['status'] = 1; if ($typeid != 0) { $arr = get_tree($typeid); $map['typeid'] = array('in', $arr); } if (!isset($target) or $target == 0) { $tar = ''; } else { $tar = "target=\"_blank\""; } if (!isset($num)) { $num = 0; } if (!isset($num2)) { $num = 10; } switch ($conditions) { case 0: $field = '*'; $data = 'hits desc'; break; case 1: $map['istop'] = 1; //置顶 $field = '*'; $data = 'addtime desc'; break; case 2: $map['ishot'] = 1; //推荐 $field = '*'; $data = 'addtime desc'; break; case 3: $map['isimg'] = 1; //图文 $field = '*'; $data = 'addtime desc'; break; default: $map['isimg'] = 1; $field = '*'; $data = ''; } $list = $article->where($map)->field($field)->order($data)->limit($num . ',' . $num2)->select(); //释放内存 unset($map, $field, $num, $num2, $article); if (!$list) { return '没有文章'; exit; } $html = ''; $img = ''; foreach ($list as $v) { if ($conditions == 3) { $img = "<img src=\"__ROOT__{$v['imgurl']}\" width=\"160px\" height=\"126px\"><br>"; } $url = U('articles/' . $v['aid']); $html .= "\n<li><a href=\"{$url}\" {$tar}>{$img}{$v['title']}</a></li>"; } //释放内存 unset($list); return $html; }
function get_tree(&$data, $parentId = 0) { global $str; $str .= '<ul>'; foreach ($data as $key => $value) { if ($value['pid'] == $parentId) { unset($data[$key]); $str .= "<li>|--<a href='/'>" . $value['name'] . '</a></li>'; get_tree($data, $value['id']); } } $str .= '</ul>'; return $str; }
<?php $prefixeCodesCanaux = $_GET["prefixeCodesCanaux"]; $demoUrlDir = '_all_pack/' . $prefixeCodesCanaux; $ok = false; // On verifie si le dossier client existe sinon on le créé if (!file_exists($demoUrlDir)) { @mkdir($demoUrlDir); } $clientDirList = get_tree($demoUrlDir); $clientDir = '' . $clientDirList . ''; // Recuperation function glob_free($dir, $patern = '*') { $tab = ''; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $ext = explode('.', $file); $ext = $ext[count($ext) - 1]; if ($ext == $patern || $patern == "*" && $file != '.' && $file != '..') { $tab[] = $dir . $file; } } closedir($dh); } } return $tab; } function get_tree($path = './') {
documentation and/or other materials provided with the distribution. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. */ require_once 'libs/functions.php'; $options = get_options(); $tree = get_tree("docs"); $homepage_url = homepage_url($tree); $docs_url = docs_url($tree); // Redirect to docs, if there is no homepage if ($homepage && $homepage_url !== '/') { header('Location: ' . $homepage_url); } ?> <!doctype html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <html> <head> <title><?php
function get_tree($pid, $arr, $num, $cats_old_zhyh) { global $catstr; $child = getchild($pid, $arr); if (is_array($child)) { $total = count($child); foreach ($child as $id => $sa) { $pstr = ''; for ($i = 0; $i <= $num; $i++) { $pstr = $pstr . ($num ? ' ' : ' '); } $children = array(); $zhyhcount = 0; $children = getchild($id, $arr); $zhyhcount = count($children); if ($zhyhcount == 0) { if (@in_array($id, $cats_old_zhyh)) { $selected_zhyh = " checked"; } else { $selected_zhyh = " "; } $zhyh = '<input type="checkbox" class="nfl" name="supplier_cat_id[]" id="supplier_cat_id" value="' . $id . '" ' . $selected_zhyh . '>'; } else { $zhyh = ''; } $catstr = $catstr . $pstr . $zhyh . $sa['name'] . " <br>"; $num++; get_tree($sa['id'], $arr, $num, $cats_old_zhyh); $num--; } } else { return; } }
if (!isset($language) || $language === null) { $homepage_url = homepage_url($tree); $docs_url = docs_url($tree); } else { $homepage_url = "/"; } $docs_url = docs_url($tree); $url_params = url_params(); if (count($options['languages']) > 0 && count($url_params) > 0 && strlen($url_params[0]) > 0) { $language = array_shift($url_params); $base_path = "docs/" . $language; } else { $language = null; $base_path = "docs"; } $tree = get_tree($base_path, $base_url, '', true, $language); $page = load_page($tree, $url_params); // If a timezone has been set in the config file, override the default PHP timezone for this application. if (isset($options['timezone'])) { date_default_timezone_set($options['timezone']); } // Redirect to docs, if there is no homepage if ($homepage && $homepage_url !== '/') { header('Location: ' . $homepage_url); } ?> <!doctype html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
function get_tree($path, $level) { global $conf_chroot, $conf_sort_dirs; $path_components = explode('/', $path); $current_path = $conf_chroot . "/"; $ret = array(); // construct the path we are now traversing if ($level > 0) { for ($i = 0; $i <= $level; $i++) { $current_path .= $path_components[$i] . "/"; } } if (($dh = opendir($current_path)) === FALSE) { die("Fatal error trying to read directory: {$path}<br>"); } while (($dir = readdir($dh)) !== FALSE) { if (is_dir("{$current_path}/{$dir}") && $dir != '.' && $dir != '..') { if (count($path_components) > $level + 1 && $dir == $path_components[$level + 1]) { $ret[$dir] = get_tree($path, $level + 1); } else { $ret[$dir] = FALSE; } } } closedir($dh); if ($conf_sort_dirs) { ksort($ret); } return $ret; }
$canalNumeroAgent = $table->numéro_agent; $canalNom = $table->nom; $canalInfos = array($canalStatut, $canalNumeroAgent, $canalNom); } } mysql_close($link); return $canalInfos; } $prefixeCodesCanaux = $_GET["prefixeCodesCanaux"]; $demo_url_dir = '_all_pack/' . $prefixeCodesCanaux; $ok = false; // On verifie si le dossier client existe sinon on le créé if (!file_exists($demo_url_dir)) { @mkdir($demo_url_dir); } $clientDirList = get_tree($demo_url_dir); $clientDir = '' . $clientDirList . ''; // Recuperation function glob_free($dir, $patern = '*') { $tab = ''; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $ext = explode('.', $file); $ext = $ext[count($ext) - 1]; if ($ext == $patern || $patern == "*" && $file != '.' && $file != '..') { $tab[] = $dir . $file; } } closedir($dh);