コード例 #1
0
     delete_dir('files/' . $show);
     c_println('Deleted old files on server');
 }
 if (!file_exists('files/' . $show)) {
     mkdir('files/' . $show, 0777, true);
 }
 //Create folder if it doesn't exist
 if (!file_exists('zip')) {
     mkdir('zip', 0777, true);
 }
 //Create folder if it doesn't exist
 $j = 0;
 foreach ($episodes as $episode) {
     $print = '';
     $data = json_decode(file_get_contents($episode['url'] . '?output=json'), true);
     $title = str_replace('-', ' ', no_special_char($data['context']['title']));
     //TODO, fix encoding bug so there is no need to remove special char
     $thumb = $episode['cover'];
     $year = $episode['year'];
     $date = $episode['aired'];
     $m3u8 = file($data['video']['videoReferences'][1]['url']);
     $m3u8 = $m3u8[count($m3u8) - 1];
     $plot = '';
     $j++;
     //Update number of loops (episodes)
     if ($j > 99) {
         $j = sprintf('%03d', $j);
     } else {
         $j = sprintf('%02d', $j);
     }
     //Convert episodes so it has leading zeros. 2 or 3 depending on how big number
コード例 #2
0
ファイル: auto_dropzone.php プロジェクト: eauland/ShareMe
 {
     if ($e > 0 && $e < 7) {
         $errors = [1 => e('The file to big for the server\'s config', false), 2 => e('The file to big for this page', false), 3 => e('There was a problem during upload (file was truncated)', false), 4 => e('No file upload', false), 5 => e('No temp folder', false), 6 => e('Write error on server', false)];
         return $errors[$e];
     } elseif ($e > 7) {
         return true;
     } else {
         return false;
     }
 }
 /*function secure($file){
     return preg_replace('#(.+)\.php#i','$1.SECURED_PHP',$file);
   }*/
 if (isset($_FILES['myfile'])) {
     //$sFileName=no_special_char(secure($_FILES['myfile']['name']));
     $sFileName = no_special_char($_FILES['myfile']['name']);
     $sFileType = $_FILES['myfile']['type'];
     $sFileSize = intval(bytesToSize1024($_FILES['myfile']['size'], 1));
     $sFileError = error2msg($_FILES['myfile']['error']);
     $sFileExt = pathinfo($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $sFileName, PATHINFO_EXTENSION);
     $ok = '<li class="DD_file DD_success ' . $sFileExt . '">   
      <span class="DD_filename">' . $sFileName . '</span>
      [<em class="DD_filetype">' . $sFileType . '</em>, 
      <em class="DD_filesize">' . $sFileSize . '</em>] [OK]
      </li>';
     $notok = '<li class="DD_file DD_error">   
         <span class="DD_filename">' . $sFileName . '</span>
         [<em class="DD_filetype">' . $sFileType . '</em>, 
         <em class="DD_filesize">' . $sFileSize . '</em>] ' . e('Upload error', false) . '
         </li>';
     if (empty($sFileName)) {
コード例 #3
0
            }
        } else {
            $rights[$profile] = array();
        }
    }
    save($_SESSION['profiles_rights_file'], $rights);
    header('location:index.php?p=edit_profiles&token=' . TOKEN . '&msg=' . e('Changes saved', false));
    exit;
}
# Editor
if (isset($_POST['editor_content']) && !empty($_POST['editor_filename']) && is_allowed('markdown editor')) {
    $extension = pathinfo($_POST['editor_filename'], PATHINFO_EXTENSION);
    if (empty($extension)) {
        $_POST['editor_filename'] .= '.md';
    }
    $file = no_special_char($_POST['editor_filename']);
    $path = addslash_if_needed($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $_SESSION['current_path']);
    if (is_file($path . $file) && !isset($_POST['overwrite'])) {
        $file = rename_item($file, $path);
    }
    file_put_contents($path . $file, $_POST['editor_content']);
    if (!isset($_POST['overwrite'])) {
        $id = addID($path . $file);
        $tree = add_branch($path . $file, $id, $_SESSION['login'], $tree);
    }
    header('location:index.php?p=admin&token=' . TOKEN . '&msg=' . $_POST['editor_filename'] . ' ' . e('Changes saved', false));
    exit;
}
# Config change
if (isset($_POST['config']) && is_allowed('config page')) {
}
コード例 #4
0
        store($ids);
    } elseif (is_dir($f)) {
        // suppression d'un dossier
        rrmdir($f);
        rrmdir('thumbs/' . $f);
        // supprimer les id
        purgeIDs();
    }
    header('location:index.php?p=admin&token=' . returnToken());
    exit;
}
// renommer un fichier ou dossier
if (!empty($_GET['id']) && !empty($_GET['newname']) && is_owner($_GET['id'])) {
    $oldfile = id2file($_GET['id']);
    $path = dirname($oldfile) . '/';
    $newfile = $path . no_special_char($_GET['newname']);
    if ($newfile != basename($oldfile) && check_path($newfile)) {
        // si le nouveau nom du fichier existe on le modifie
        if (is_file($newfile) || is_dir($newfile)) {
            $newfile = $path . rename_item(basename($newfile));
        }
        if (is_dir($oldfile)) {
            // pour les dossier on doit changer le chemin de tout les élément qu'il contient
            foreach ($ids as $id => $path) {
                $ids[$id] = str_replace($oldfile, $newfile, $path);
            }
        }
        rename($oldfile, $newfile);
        rename(get_thumbs_name($oldfile), get_thumbs_name($newfile));
        $ids[$_GET['id']] = $newfile;
        store($ids);