Exemple #1
0
            if ($action === "zip") {
                fail(0, "zipped download is disabled", !$options["zippedDownload"]);
                list($hrefs) = checkKeys(array("hrefs"));
                require_h5ai("/php/inc/ZipIt.php");
                $zipit = new ZipIt($h5ai);
                $hrefs = explode(":", trim($hrefs));
                $zipFile = $zipit->zip($hrefs);
                if (is_string($zipFile)) {
                    $response = array('status' => 'ok', 'id' => basename($zipFile), 'size' => filesize($zipFile));
                } else {
                    $response = array('status' => 'failed', 'code' => $zipFile);
                }
                echo json_encode($response);
            } else {
                if ($action === "getzip") {
                    list($id) = checkKeys(array("id"));
                    fail(1, "zipped file not found: " . $id, !preg_match("/^h5ai-zip-/", $id));
                    $zipFile = str_replace("\\", "/", sys_get_temp_dir()) . "/" . $id;
                    fail(2, "zipped file not found: " . $id, !file_exists($zipFile));
                    header("Content-Disposition: attachment; filename=\"h5ai-selection.zip\"");
                    header("Content-Type: application/octet-stream");
                    header("Content-Length: " . filesize($zipFile));
                    header("Connection: close");
                    readfile($zipFile);
                } else {
                    fail(1, "unsupported 'action' specified");
                }
            }
        }
    }
}
Exemple #2
0
         $image->thumb($mode, $width, $height);
         $image->showDest();
     }
 } else {
     if ($action === "tree") {
         list($href) = checkKeys(array("href"));
         require_once "inc/Tree.php";
         $absHref = trim($href);
         $absPath = $h5ai->getAbsPath($absHref);
         $tree = new TreeEntry($h5ai, $absPath, $absHref);
         $tree->loadContent();
         echo $tree->contentToHtml();
     } else {
         if ($action === "zip") {
             fail(0, "zipped download is disabled", !$options["zippedDownload"]);
             list($hrefs) = checkKeys(array("hrefs"));
             require_once "inc/ZipIt.php";
             $zipit = new ZipIt($h5ai);
             $hrefs = explode(":", trim($hrefs));
             $zipFile = $zipit->zip($hrefs);
             if ($zipFile === false) {
                 fail(2, "something went wrong while building the zip");
             }
             header("Content-Disposition: attachment; filename=\"h5ai-selection.zip\"");
             header("Content-Type: application/force-download");
             header("Content-Length: " . filesize($zipFile));
             header("Connection: close");
             readfile($zipFile);
         } else {
             fail(1, "unsupported 'action' specified");
         }
Exemple #3
0
                exit_error('Error', $msg);
            }
        }
        $key = strtok("\n");
    }
}
session_require(array('isloggedin' => 1));
$u =& user_get_object(user_getid());
if (!$u || !is_object($u)) {
    exit_error('Error', 'Could Not Get User');
} elseif ($u->isError()) {
    exit_error('Error', $u->getErrorMessage());
}
if (getStringFromRequest('submit')) {
    $authorized_keys = getStringFromRequest('authorized_keys');
    checkKeys($authorized_keys);
    if (!$u->setAuthorizedKeys($authorized_keys)) {
        exit_error('Error', 'Could not update SSH authorized keys: ' . db_error());
    }
    session_redirect("/account/");
} else {
    // not valid registration, or first time to page
    site_user_header(array('title' => 'Change Authorized Keys'));
    echo _('<p>To avoid having to type your password every time for your CVS/SSH developer account, you may upload your public key(s) here and they will be placed on the CVS server in your ~/.ssh/authorized_keys file. This is done by a cron job, so it may not happen immediately.  Please allow for a one hour delay.</p><p>To generate a public key, run the program \'ssh-keygen\' (you can use both protocol 1 or 2). The public key will be placed at \'~/.ssh/identity.pub\' (protocole 1) and \'~/.ssh/id_dsa.pub\' or \'~/.ssh/id_rsa.pub\' (protocole 2). Read the ssh documentation for further information on sharing keys.</p>');
    ?>

<form action="<?php 
    echo getStringFromServer('PHP_SELF');
    ?>
" method="post">
<p><?php