//adding sql-file in the root
        }
        $backup = true;
        //Output
        if (file_exists($targetSql) and filesize($targetSql) > 0) {
            $mysql_link = fileLink($targetSql, 'MySQL');
        } else {
            $mysql_link = '<span style="display: inline-block; width: 90px;">MySQL:</span>No Backup!';
        }
        if (file_exists($targetTar)) {
            $files_link = fileLink($targetTar, 'Files');
        } else {
            $files_link = '<span style="display: inline-block; width: 90px;">Files:</span>No Backup!';
        }
        if (file_exists($targetCom)) {
            $combi_link = fileLink($targetCom, 'MySQL & Files');
        }
    }
}
//Remove Backups
if (!empty($_POST["removeBackup"])) {
    if (!empty($_POST["removeBackup"])) {
        foreach (glob("{$targetPath}/*") as $file) {
            $extension = pathinfo($file, PATHINFO_EXTENSION);
            if (in_array($extension, array("tar", "sql", "txt"))) {
                unlink($file);
            }
        }
        rmdir($targetPath);
    }
}
Exemple #2
0
function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
{
    global $config, $lang, $rep, $passrev, $peg, $passRevString;
    $path = '';
    if (!$treeview) {
        $level = $limit;
    }
    // TODO: Fix node links to use the path and number of peg revision (if exists)
    // This applies to file detail, log, and RSS -- leave the download link as-is
    for ($n = 0; $n <= $level; $n++) {
        $path .= $subs[$n] . '/';
    }
    // List each file in the current directory
    $loop = 0;
    $last_index = 0;
    $accessToThisDir = $rep->hasReadAccess($path, false);
    $downloadRevString = $rev ? 'rev=' . $rev . '&amp;peg=' . $rev . '&amp;' : '';
    $openDir = false;
    $logList = $svnrep->getList($path, $rev);
    if ($logList) {
        foreach ($logList->entries as $entry) {
            $isDir = $entry->isdir;
            if (!$isDir && $level != $limit) {
                continue;
                // Skip any files outside the current directory
            }
            $file = $entry->file;
            $isDirString = $isDir ? 'isdir=1&amp;' : '';
            // Only list files/directories that are not designated as off-limits
            $access = $isDir ? $rep->hasReadAccess($path . $file, true) : $accessToThisDir;
            if ($access) {
                $listing[$index]['rowparity'] = $index % 2;
                if ($isDir) {
                    $listing[$index]['filetype'] = $openDir ? 'diropen' : 'dir';
                    $openDir = isset($subs[$level + 1]) && (!strcmp($subs[$level + 1] . '/', $file) || !strcmp($subs[$level + 1], $file));
                } else {
                    $listing[$index]['filetype'] = strtolower(strrchr($file, '.'));
                    $openDir = false;
                }
                $listing[$index]['isDir'] = $isDir;
                $listing[$index]['openDir'] = $openDir;
                $listing[$index]['level'] = $treeview ? $level : 0;
                $listing[$index]['node'] = 0;
                // t-node
                $listing[$index]['path'] = $path . $file;
                $listing[$index]['filelink'] = fileLink($path, $file);
                $listing[$index]['logurl'] = $config->getURL($rep, $path . $file, 'log') . $isDirString . $passRevString;
                if ($treeview) {
                    $listing[$index]['compare_box'] = '<input type="checkbox" name="compare[]" value="' . fileLink($path, $file, true) . '@' . $passrev . '" onclick="checkCB(this)" />';
                }
                if ($config->showLastMod) {
                    $listing[$index]['committime'] = $entry->committime;
                    $listing[$index]['revision'] = $entry->rev;
                    $listing[$index]['author'] = $entry->author;
                    $listing[$index]['age'] = $entry->age;
                    $listing[$index]['date'] = $entry->date;
                    $listing[$index]['revurl'] = $config->getURL($rep, $path . $file, 'revision') . 'rev=' . $entry->rev . ($isDir ? '&amp;isdir=1' : '');
                }
                if ($rep->isDownloadAllowed($path . $file)) {
                    $downloadurl = $config->getURL($rep, $path . $file, 'dl') . $downloadRevString;
                    if ($isDir) {
                        $listing[$index]['downloadurl'] = $downloadurl . 'isdir=1';
                        $listing[$index]['downloadplainurl'] = '';
                    } else {
                        $listing[$index]['downloadplainurl'] = $downloadurl;
                        $listing[$index]['downloadurl'] = '';
                    }
                } else {
                    $listing[$index]['downloadplainurl'] = '';
                    $listing[$index]['downloadurl'] = '';
                }
                if ($rep->isRssEnabled()) {
                    $rssurl = $config->getURL($rep, $path . $file, 'rss');
                    // RSS should always point to the latest revision, so don't include rev
                    $listing[$index]['rssurl'] = $rssurl . $isDirString . ($peg ? 'peg=' . $peg : '');
                }
                $loop++;
                $index++;
                $last_index = $index;
                if ($isDir && $level != $limit) {
                    if (isset($subs[$level + 1]) && !strcmp(htmlentities($subs[$level + 1], ENT_QUOTES) . '/', htmlentities($file))) {
                        $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
                        $index = count($listing);
                    }
                }
            }
        }
    }
    // For an expanded tree, give the last entry an "L" node to close the grouping
    if ($treeview && $last_index != 0) {
        $listing[$last_index - 1]['node'] = 1;
        // l-node
    }
    return $listing;
}