Example #1
0
/**
 * Grab all the versioning data regarding the $file inside the $directory
 *
 * @param string $directory
 * @param string $file
 */
function GetFileVersionInfo($directory, $file)
{
    global $files, $remote;
    $filefullpath = $directory . '/' . $file;
    if (check_if_image($file)) {
        $d = file_get_contents($filefullpath);
        $s = filesize($filefullpath);
        //strlen( $encoded_image );
    } else {
        $d = str_replace("\r\n", "\n", file_get_contents_utf8($filefullpath));
        $s = strlen($d);
    }
    $files[$directory][$file]['update'] = '';
    $files[$directory][$file]['local']['versionFile'] = $file;
    $files[$directory][$file]['local']['versionMD5'] = _getsha($file, $filefullpath);
    //sha1_file($filefullpath);
    $files[$directory][$file]['local']['versionSize'] = $s;
    $files[$directory][$file]['local']['versionDesc'] = '';
    $files[$directory][$file]['local']['versionDate'] = '';
    $files[$directory][$file]['local']['versionAuthor'] = '';
    $files[$directory][$file]['local']['update'] = '';
}
Example #2
0
if (isset($_GET['printconf']) && $_GET['printconf'] == 1) {
    echo '<div align="left">';
    aprint($roster->config);
    echo '</div></div></div></div></div></div>';
    // End tier 1 element
    return;
}
// If a FileDiff is requested, display the header of the file and display Warning / Confirmation
if (isset($_POST['filename']) && isset($_POST['downloadsvn'])) {
    if ($_POST['downloadsvn'] == 'confirmation') {
        //Do confirmation stuff
        $filename = $_POST['filename'];
        if (is_file($filename)) {
            $path_parts = pathinfo($filename);
            $file = $path_parts['basename'];
            $md5local = _getsha($file, $filename);
        } else {
            $md5local = "Local File does not exist yet";
        }
        $filefullpath = 'https://api.github.com/repos/ulminia/wowroster/contents/' . $filename;
        $d = $roster->api->Git->GetFile($filefullpath);
        $s = mb_convert_encoding($d['content'], 'UTF-8', mb_detect_encoding($d['content'], 'UTF-8, ISO-8859-1', true));
        $md5remote = $d['sha'];
        if ($md5remote === false) {
            roster_die("[ERROR] Cannot Read Sha Remote File\n");
        }
        $data = explode('\\n', $s);
        $filesvnsource = base64_decode($s);
        //mb_convert_encoding($d['content'], 'UTF-8', mb_detect_encoding($d['content'], 'UTF-8, ISO-8859-1', true));//urlgrabber(ROSTER_SVNREMOTE.'?getfile='.$filename.'&mode=diff');
        if ($filesvnsource === false) {
            roster_die("[ERROR] Cannot Read Remote File\n");