本文整理汇总了PHP中ConfService::setRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::setRepository方法的具体用法?PHP ConfService::setRepository怎么用?PHP ConfService::setRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::setRepository方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPubliclet
/** Load a uncyphered publiclet */
function loadPubliclet($data)
{
// create driver from $data
$className = $data["DRIVER"] . "AccessDriver";
if ($data["EXPIRE_TIME"] && time() > $data["EXPIRE_TIME"]) {
// Remove the publiclet, it's done
if (strstr(PUBLIC_DOWNLOAD_FOLDER, $_SERVER["SCRIPT_FILENAME"]) !== FALSE) {
unlink($_SERVER["SCRIPT_FILENAME"]);
}
echo "Link is expired, sorry.";
exit;
}
// Check password
if (strlen($data["PASSWORD"])) {
if ($_POST['password'] != $data["PASSWORD"]) {
echo "<html><head><link rel='stylesheet' type='text/css' href='allz.css'/></head><body><form action='' method='post'><div class='dialogBox' style='display:block;width:20%;left:40%;'><div class='dialogTitle'><img width='16' height='16' align='top' src='public_url.png'> AjaXplorer Public Download</div><div class='dialogContent'>A password is required for this download :<br><input type='password' name='password' style='width:100%;'><br><div class='dialogButtons'><input width='22' height='22' type='image' name='ok' src='dialog_ok_apply.png' title='Download' class='dialogButton'></div></div></div></form></body></html>";
exit(1);
}
}
$filePath = INSTALL_PATH . "/plugins/access." . $data["DRIVER"] . "/class." . $className . ".php";
if (!is_file($filePath)) {
die("Warning, cannot find driver for conf storage! ({$name}, {$filePath})");
}
require_once $filePath;
$driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]);
$driver->loadManifest();
$driver->init($data["REPOSITORY"], $data["OPTIONS"]);
ConfService::setRepository($data["REPOSITORY"]);
$driver->initRepository();
$driver->switchAction($data["ACTION"], array("file" => $data["FILE_PATH"]), "");
}
示例2: loadPubliclet
/** Load a uncyphered publiclet */
function loadPubliclet($data)
{
// create driver from $data
$className = $data["DRIVER"] . "AccessDriver";
if ($data["EXPIRE_TIME"] && time() > $data["EXPIRE_TIME"]) {
// Remove the publiclet, it's done
if (strstr(realpath($_SERVER["SCRIPT_FILENAME"]), realpath(PUBLIC_DOWNLOAD_FOLDER)) !== FALSE) {
$hash = md5(serialize($data));
require_once INSTALL_PATH . "/server/classes/class.PublicletCounter.php";
PublicletCounter::delete($hash);
unlink($_SERVER["SCRIPT_FILENAME"]);
}
echo "Link is expired, sorry.";
exit;
}
// Check password
if (strlen($data["PASSWORD"])) {
if (!isset($_POST['password']) || $_POST['password'] != $data["PASSWORD"]) {
$content = file_get_contents(INSTALL_PATH . "/client/html/public_links.html");
$language = "en";
if (isset($_GET["lang"])) {
$language = $_GET["lang"];
}
$messages = array();
if (is_file(INSTALL_PATH . "/client/i18n/{$language}.php")) {
include INSTALL_PATH . "/client/i18n/{$language}.php";
$messages = $mess;
}
if (preg_match_all("/AJXP_MESSAGE(\\[.*?\\])/", $content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$messId = str_replace("]", "", str_replace("[", "", $match[1]));
if (isset($messages[$messId])) {
$content = str_replace("AJXP_MESSAGE[{$messId}]", $messages[$messId], $content);
}
}
}
echo $content;
exit(1);
}
}
$filePath = INSTALL_PATH . "/plugins/access." . $data["DRIVER"] . "/class." . $className . ".php";
if (!is_file($filePath)) {
die("Warning, cannot find driver for conf storage! ({$name}, {$filePath})");
}
require_once $filePath;
$driver = new $className($data["PLUGIN_ID"], $data["BASE_DIR"]);
$driver->loadManifest();
$driver->init($data["REPOSITORY"], $data["OPTIONS"]);
ConfService::setRepository($data["REPOSITORY"]);
$driver->initRepository();
// Increment counter
$hash = md5(serialize($data));
require_once INSTALL_PATH . "/server/classes/class.PublicletCounter.php";
PublicletCounter::increment($hash);
// Now call switchAction
//@todo : switchAction should not be hard coded here!!!
// Re-encode file-path as it will be decoded by the action.
try {
$driver->switchAction($data["ACTION"], array("file" => SystemTextEncoding::toUTF8($data["FILE_PATH"])), "");
} catch (Exception $e) {
die($e->getMessage());
}
}