예제 #1
0
파일: tree.php 프로젝트: ForAEdesWeb/AEW10
function _printTreeConflicted($product, $parent, $folder, $path = "")
{
    static $treeNode = 0;
    static $aFolder = array();
    $exceptions = array('.', '..', 'jaupdater.comment.txt');
    if ($parent == 0) {
        $treeNode = 0;
        $aFolder = array();
    }
    $md5CheckSums = new CheckSumsMD5();
    $str = "";
    // Root node
    if ($parent == 0) {
        $str .= "var d = new dTree('d'); \r\n";
        $str .= "d.add(0,-1,' <a href=\\'javascript: d.openAll();\\' style=\\'color:black\\'>[Open all]<\\/a> <a href=\\'javascript: d.closeAll();\\' style=\\'color:black\\'>[Close all]<\\/a>', '#', ''); \r\n";
    }
    $handle = opendir($folder);
    $found = false;
    while (($entry = readdir($handle)) !== false) {
        if (!in_array($entry, $exceptions)) {
            $found = true;
            $treeNode++;
            $item = $folder . $entry;
            if (JFolder::exists($item)) {
                $str .= "d.add(" . $treeNode . "," . $parent . ",' " . $entry . "','#', 'folder'); \r\n";
                $aFolder[$treeNode] = array();
                $aFolder[$treeNode]['parent'] = $parent;
                $str .= _printTreeConflicted($product, $treeNode, $item . '/', $path . $entry . "/");
            } else {
                $location = $path . $entry;
                $fileLive = $product->getFilePath($location);
                if (JFile::exists($fileLive)) {
                    $status = $md5CheckSums->getCheckSum($item) == $md5CheckSums->getCheckSum($fileLive) ? "solved" : "bmodified";
                }
                $str .= "d.add(" . $treeNode . "," . $parent . ",' " . $entry . "','#', '" . $location . "', '', '" . JA_DTREE_IMG_PATH . "icon_" . $status . ".gif','',0,'dtree_status_" . $status . "'); \r\n";
                $aFolder[$parent]['status'][$status] = $status;
                $aFolder[$treeNode]['status'][$status] = $status;
            }
        }
    }
    closedir($handle);
    if (!$found) {
        //folder is empty
        $aFolder[$parent]['status']['empty'] = 'empty';
        $aFolder[$treeNode]['status']['empty'] = 'empty';
    }
    if ($parent == 0) {
        $str .= printNodeAsArray($treeNode, $aFolder);
    }
    return $str;
}
예제 #2
0
 function genChecksum()
 {
     $md5CheckSums = new CheckSumsMD5();
     $location = $this->getLocation();
     $cnt = count($location);
     $crc = new stdClass();
     foreach ($location as $name => $path) {
         if ($this->isIgnore($name)) {
             continue;
         }
         if (is_dir($path)) {
             if ($name != 'location') {
                 $crc->{$name} = $md5CheckSums->dumpCRCObject($path);
             } else {
                 $crc = $md5CheckSums->dumpCRCObject($path);
             }
         } elseif (is_file($path)) {
             $crc->{$name} = $md5CheckSums->getCheckSum($path);
         }
     }
     return json_encode($crc);
 }
예제 #3
0
 function getVersionChecksum($path)
 {
     $cache = $path . "jaupdater.checksum.json";
     if (is_file($cache)) {
         return file_get_contents($cache);
     } else {
         $md5CheckSums = new CheckSumsMD5();
         $fp = fopen($cache, 'wb');
         $crc = $md5CheckSums->dumpCRCObject($path);
         $json = json_encode($crc);
         fwrite($fp, $json);
         fclose($fp);
         return $json;
     }
 }
예제 #4
0
 function getVersionChecksum($path)
 {
     $cache = $path . "jaupdater.checksum.json";
     if (JFile::exists($cache)) {
         return file_get_contents($cache);
     } else {
         $md5CheckSums = new CheckSumsMD5();
         $crc = $md5CheckSums->dumpCRCObject($path);
         $json = json_encode($crc);
         JFile::write($cache, $json);
         return $json;
     }
 }
예제 #5
0
 function genChecksum()
 {
     $md5CheckSums = new CheckSumsMD5();
     $crc = $md5CheckSums->dumpCRCObject($this->getLocation());
     return json_encode($crc);
 }