1. #1
    Ext User
    Join Date
    Sep 2007
    Vote Rating
    SkoalFyfan is on a distinguished road


    Question Tree Help! Blank root folder?! Json is correct?

    Tree Help! Blank root folder?! Json is correct?

    I'm trying to generate a tree on my local folder.

    Here is my json code:
    // from php manual page
    function formatBytes($val, $digits = 3, $mode = "SI", $bB = "B"){ //$mode == "SI"|"IEC", $bB == "b"|"B"
       $si = array("", "K", "M", "G", "T", "P", "E", "Z", "Y");
       $iec = array("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi");
       switch(strtoupper($mode)) {
           case "SI" : $factor = 1000; $symbols = $si; break;
           case "IEC" : $factor = 1024; $symbols = $iec; break;
           default : $factor = 1000; $symbols = $si; break;
       switch($bB) {
           case "b" : $val *= 8; break;
           default : $bB = "B"; break;
       for($i=0;$i<count($symbols)-1 && $val>=$factor;$i++)
           $val /= $factor;
       $p = strpos($val, ".");
       if($p !== false && $p > $digits) $val = round($val);
       elseif($p !== false) $val = round($val, $digits-$p);
       return round($val, $digits) . " " . $symbols[$i] . $bB;
    Modified the end here so its my local folder by making it ./
    $dir = isset($_REQUEST['lib'])&&$_REQUEST['lib'] == 'yui' ? '../../../' : './';
    $node = isset($_REQUEST['node'])?$_REQUEST['node']:"";
    if(strpos($node, '..') !== false){
        die('Nice try buddy.');
    $nodes = array();
    $d = dir($dir.$node);
    while($f = $d->read()){
        if($f == '.' || $f == '..' || substr($f, 0, 1) == '.')continue;
        $lastmod = date('M j, Y, g:i a',filemtime($dir.$node.'/'.$f));
            $qtip = 'Type: Folder<br />Last Modified: '.$lastmod;
            $nodes[] = array('text'=>$f, 'id'=>$node.'/'.$f/*, 'qtip'=>$qtip*/, 'cls'=>'folder');
            $size = formatBytes(filesize($dir.$node.'/'.$f), 2);
            $qtip = 'Type: JavaScript File<br />Last Modified: '.$lastmod.'<br />Size: '.$size;
            $nodes[] = array('text'=>$f, 'id'=>$node.'/'.$f, 'leaf'=>true/*, 'qtip'=>$qtip, 'qtipTitle'=>$f */, 'cls'=>'file');
    echo json_encode($nodes);
    The issue is that the root folder only renders and there is no expandable tree? Here is the result of the json if I manually go to the get-nodes.php file.

    Everything looks fine to me? I'm sure this is a common problem and just hope someone can point me in the right direction?

    *UPDATE*: I've noticed in Firebug that the POST Response gets stuck with "Loading..." ???

  2. #2
    Ext User
    Join Date
    Jul 2007
    Vote Rating
    devnull is an unknown quantity at this point



    if the response is getting stuck, then usually something on the server side is causing the php script to fail. i doubt it would cause problems, but i dont think you need to escape slashes.
    it might also help to include the javascript code that is responsible for doing something with this.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi