Ejemplo n.º 1
0
 // Paste clipboard here
 //--------------------
 if (!$_SESSION) {
     $buffer .= '<tr><td>Paste clipboard here...</td><td><strong style="color:#F00;">Failed; clipboard doesn\'t exist</strong></td></tr>';
     $redir = false;
 } else {
     if ($file) {
         $buffer .= '<tr><td>Paste clipboard here...</td><td><strong style="color:#F00;">Failed; not in a folder</strong></td></tr>';
         $redir = false;
     } else {
         foreach ($_SESSION['clip'] as $i => $tfilen) {
             if ($_SESSION['cliptype'] == 'c') {
                 $tfiletn = filefrompath($tfilen);
                 $buffer .= "<tr><td>Copying '{$tfiletn}'...</td><td>";
                 if ($tfilen == $d . $tfiletn) {
                     $tfiletn = addbeforeext($tfiletn, ' (copy)');
                 }
                 if (fm_copy($tfilen, $d . $tfiletn, $conflict)) {
                     $buffer .= '<strong style="color:#090;">Successful</strong>';
                     $acted[] = file2id($tfiletn);
                     unset($_SESSION['clip'][$i]);
                 } else {
                     if (fm_exists($d . $tfiletn)) {
                         $buffer .= '<strong style="color:#F00;">Failed, file/folder already exists</strong>';
                         $redir = false;
                     } else {
                         $buffer .= '<strong style="color:#F00;">Failed, permission error</strong>';
                         $redir = false;
                     }
                 }
             }
Ejemplo n.º 2
0
function fm_unusedfilename($file)
{
    $ofile = $file;
    $i = 1;
    while (fm_exists($file)) {
        $file = addbeforeext($ofile, ' (' . $i . ')');
        $i++;
    }
    return $file;
}