本文整理汇总了PHP中AJXP_Logger::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Logger::debug方法的具体用法?PHP AJXP_Logger::debug怎么用?PHP AJXP_Logger::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Logger
的用法示例。
在下文中一共展示了AJXP_Logger::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFile
/**
* Creates a new file in the directory
*
* Data will either be supplied as a stream resource, or in certain cases
* as a string. Keep in mind that you may have to support either.
*
* After succesful creation of the file, you may choose to return the ETag
* of the new file here.
*
* The returned ETag must be surrounded by double-quotes (The quotes should
* be part of the actual string).
*
* If you cannot accurately determine the ETag, you should not return it.
* If you don't store the file exactly as-is (you're transforming it
* somehow) you should also not return an ETag.
*
* This means that if a subsequent GET to this new file does not exactly
* return the same contents of what was submitted here, you are strongly
* recommended to omit the ETag.
*
* @param string $name Name of the file
* @param resource|string $data Initial payload
* @return null|string
*/
public function createFile($name, $data = null)
{
try {
$name = ltrim($name, "/");
AJXP_Logger::debug("CREATE FILE {$name}");
AJXP_Controller::findActionAndApply("mkfile", array("dir" => $this->path, "filename" => $name), array());
if ($data != null && is_file($this->getUrl() . "/" . $name)) {
$p = $this->path . "/" . $name;
$this->getAccessDriver()->nodeWillChange($p, intval($_SERVER["CONTENT_LENGTH"]));
//AJXP_Logger::debug("Should now copy stream or string in ".$this->getUrl()."/".$name);
if (is_resource($data)) {
$stream = fopen($this->getUrl() . "/" . $name, "w");
stream_copy_to_stream($data, $stream);
fclose($stream);
} else {
if (is_string($data)) {
file_put_contents($data, $this->getUrl() . "/" . $name);
}
}
$toto = null;
$this->getAccessDriver()->nodeChanged($toto, $p);
}
$node = new AJXP_Sabre_NodeLeaf($this->path . "/" . $name, $this->repository, $this->getAccessDriver());
if (isset($this->children)) {
$this->children = null;
}
return $node->getETag();
} catch (Exception $e) {
AJXP_Logger::debug("Error " . $e->getMessage(), $e->getTraceAsString());
return null;
}
}
示例2: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (!isset($httpVars["simple_uploader"]) && !isset($httpVars["xhr_uploader"])) {
return false;
}
AJXP_Logger::debug("SimpleUploadProc is active");
$result = $postProcessData["processor_result"];
if (isset($httpVars["simple_uploader"])) {
print "<html><script language=\"javascript\">\n";
if (isset($result["ERROR"])) {
$message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext('" . str_replace("'", "\\'", $message) . "');";
} else {
print "\n if(parent.ajaxplorer.actionBar.multi_selector) parent.ajaxplorer.actionBar.multi_selector.submitNext();";
}
print "</script></html>";
} else {
if (isset($result["ERROR"])) {
$message = $result["ERROR"]["MESSAGE"] . " (" . $result["ERROR"]["CODE"] . ")";
exit($message);
} else {
exit("OK");
}
}
}
示例3: parseSpecificContributions
protected function parseSpecificContributions(&$contribNode)
{
parent::parseSpecificContributions($contribNode);
if (isset($this->actions["share"])) {
$disableSharing = false;
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
if ($downloadFolder == "") {
$disableSharing = true;
} else {
if (!is_dir($downloadFolder) || !is_writable($downloadFolder)) {
AJXP_Logger::debug("Disabling Public links, {$downloadFolder} is not writeable!", array("folder" => $downloadFolder, "is_dir" => is_dir($downloadFolder), "is_writeable" => is_writable($downloadFolder)));
$disableSharing = true;
} else {
if (AuthService::usersEnabled()) {
$loggedUser = AuthService::getLoggedUser();
if ($loggedUser != null && AuthService::isReservedUserId($loggedUser->getId())) {
$disableSharing = true;
}
} else {
$disableSharing = true;
}
}
}
if ($disableSharing) {
unset($this->actions["share"]);
$actionXpath = new DOMXPath($contribNode->ownerDocument);
$publicUrlNodeList = $actionXpath->query('action[@name="share"]', $contribNode);
$publicUrlNode = $publicUrlNodeList->item(0);
$contribNode->removeChild($publicUrlNode);
}
}
}
示例4: __construct
/** Construction. This kills the current session if any started, and restart the given session */
public function __construct($name, $killPreviousSession = false, $loadPreviousSession = false, $saveHandlerType = "files", $saveHandlerData = null)
{
AJXP_Logger::debug("Switching to session " . $name);
if (session_id() == "") {
if (isset($saveHandlerData)) {
session_set_save_handler($saveHandlerData["open"], $saveHandlerData["close"], $saveHandlerData["read"], $saveHandlerData["write"], $saveHandlerData["destroy"], $saveHandlerData["gc"]);
} else {
if (ini_get("session.save_handler") != $saveHandlerType) {
ini_set('session.save_handler', $saveHandlerType);
}
}
// Start a default session and save on the handler
session_start();
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
session_write_close();
} else {
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
}
// Please note that there is no start here, session might be already started
if (session_id() != "") {
// There was a previous session
if ($killPreviousSession) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
}
AJXP_Logger::debug("Closing previous session " . session_name() . " / " . session_id());
session_write_close();
session_regenerate_id(false);
$_SESSION = array();
}
if (isset($saveHandlerData)) {
session_set_save_handler($saveHandlerData["open"], $saveHandlerData["close"], $saveHandlerData["read"], $saveHandlerData["write"], $saveHandlerData["destroy"], $saveHandlerData["gc"]);
} else {
if (ini_get("session.save_handler") != $saveHandlerType) {
ini_set('session.save_handler', $saveHandlerType);
}
}
if ($loadPreviousSession) {
AJXP_Logger::debug("Restoring previous session" . SessionSwitcher::$sessionArray[0]['id']);
session_id(SessionSwitcher::$sessionArray[0]['id']);
} else {
$newId = md5(SessionSwitcher::$sessionArray[0]['id'] . $name);
session_id($newId);
}
session_name($name);
session_start();
AJXP_Logger::debug("Restarted session " . session_name() . " / " . session_id(), $_SESSION);
}
示例5: initRepository
function initRepository()
{
if (is_array($this->pluginConf)) {
$this->driverConf = $this->pluginConf;
} else {
$this->driverConf = array();
}
$wrapperData = $this->detectStreamWrapper(true);
AJXP_Logger::debug("Detected wrapper data", $wrapperData);
$this->wrapperClassName = $wrapperData["classname"];
$this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
$consumerKey = $this->repository->getOption("CONSUMER_KEY");
$consumerSecret = $this->repository->getOption("CONSUMER_SECRET");
$oauth = new Dropbox_OAuth_PEAR($consumerKey, $consumerSecret);
// TOKENS IN SESSION?
if (!empty($_SESSION["OAUTH_DROPBOX_TOKENS"])) {
return;
}
// TOKENS IN FILE ?
$tokens = $this->getTokens($this->repository->getId());
if (!empty($tokens)) {
$_SESSION["OAUTH_DROPBOX_TOKENS"] = $tokens;
return;
}
// OAUTH NEGOCIATION
if (isset($_SESSION['DROPBOX_NEGOCIATION_STATE'])) {
$state = $_SESSION['DROPBOX_NEGOCIATION_STATE'];
} else {
$state = 1;
}
switch ($state) {
case 1:
$tokens = $oauth->getRequestToken();
//print_r($tokens);
// Note that if you want the user to automatically redirect back, you can
// add the 'callback' argument to getAuthorizeUrl.
//echo "Step 2: You must now redirect the user to:\n";
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 2;
$_SESSION['oauth_tokens'] = $tokens;
throw new Exception("Please go to <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"" . $oauth->getAuthorizeUrl() . "\">" . $oauth->getAuthorizeUrl() . "</a> to authorize the access to your dropbox. Then try again to switch to this repository.");
case 2:
$oauth->setToken($_SESSION['oauth_tokens']);
$tokens = $oauth->getAccessToken();
$_SESSION['DROPBOX_NEGOCIATION_STATE'] = 3;
$_SESSION['OAUTH_DROPBOX_TOKENS'] = $tokens;
$this->setTokens($this->repository->getId(), $tokens);
return;
}
throw new Exception("Impossible to find the tokens for accessing the dropbox repository");
}
示例6: initPath
/**
* Initialize the stream from the given path.
* Concretely, transform ajxp.webdav:// into webdav://
*
* @param string $path
* @return mixed Real path or -1 if currentListing contains the listing : original path converted to real path
*/
protected static function initPath($path, $streamType, $storeOpenContext = false, $skipZip = false)
{
$url = AJXP_Utils::safeParseUrl($path);
$repoId = $url["host"];
$repoObject = ConfService::getRepositoryById($repoId);
if (!isset($repoObject)) {
$e = new Exception("Cannot find repository with id " . $repoId);
self::$lastException = $e;
throw $e;
}
$path = $url["path"];
$host = $repoObject->getOption("HOST");
$hostParts = parse_url($host);
if ($hostParts["scheme"] == "https" && !extension_loaded("openssl")) {
$e = new Exception("Warning you must have the openssl PHP extension loaded to connect an https server!");
self::$lastException = $e;
throw $e;
}
$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($hostParts, $repoObject);
$user = $credentials["user"];
$password = $credentials["password"];
if ($user != null && $password != null) {
$host = ($hostParts["scheme"] == "https" ? "webdavs" : "webdav") . "://{$user}:{$password}@" . $hostParts["host"];
if (isset($hostParts["port"])) {
$host .= ":" . $hostParts["port"];
}
} else {
$host = str_replace(array("http", "https"), array("webdav", "webdavs"), $host);
}
// MAKE SURE THERE ARE NO // OR PROBLEMS LIKE THAT...
$basePath = $repoObject->getOption("PATH");
if ($basePath[strlen($basePath) - 1] == "/") {
$basePath = substr($basePath, 0, -1);
}
if ($basePath[0] != "/") {
$basePath = "/{$basePath}";
}
$path = AJXP_Utils::securePath($path);
if ($path[0] == "/") {
$path = substr($path, 1);
}
// SHOULD RETURN webdav://host_server/uri/to/webdav/folder
AJXP_Logger::debug(__CLASS__, __FUNCTION__, $host . $basePath . "/" . $path);
return $host . $basePath . "/" . $path;
}
示例7: postProcess
public function postProcess($action, $httpVars, $postProcessData)
{
if (!self::$active) {
return false;
}
AJXP_Logger::debug("FlexProc is active=" . self::$active, $postProcessData);
$result = $postProcessData["processor_result"];
if (isset($result["SUCCESS"]) && $result["SUCCESS"] === true) {
header('HTTP/1.0 200 OK');
//die("200 OK");
} else {
if (isset($result["ERROR"]) && is_array($result["ERROR"])) {
$code = $result["ERROR"]["CODE"];
$message = $result["ERROR"]["MESSAGE"];
//header("HTTP/1.0 $code $message");
die("Error {$code} {$message}");
}
}
}
示例8: makeZip
function makeZip($src, $dest, $basedir)
{
@set_time_limit(0);
require_once AJXP_BIN_FOLDER . "/pclzip.lib.php";
$filePaths = array();
foreach ($src as $item) {
$realFile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $this->urlBase . "/" . AJXP_Utils::securePath($item));
$basedir = trim(dirname($realFile));
$filePaths[] = array(PCLZIP_ATT_FILE_NAME => $realFile, PCLZIP_ATT_FILE_NEW_SHORT_NAME => basename($item));
}
AJXP_Logger::debug("Pathes", $filePaths);
AJXP_Logger::debug("Basedir", array($basedir));
self::$filteringDriverInstance = $this;
$archive = new PclZip($dest);
$vList = $archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $basedir, PCLZIP_OPT_NO_COMPRESSION, PCLZIP_OPT_ADD_TEMP_FILE_ON);
if (!$vList) {
throw new Exception("Zip creation error : ({$dest}) " . $archive->errorInfo(true));
}
self::$filteringDriverInstance = null;
return $vList;
}
示例9: init
public function init($options)
{
parent::init($options);
if (!extension_loaded("openssl")) {
return;
}
$keyFile = $this->getPluginWorkDir(true) . "/agent.pem";
if (file_exists($keyFile)) {
return;
}
$config = array("digest_alg" => "sha1", "private_key_bits" => 1024, "private_key_type" => OPENSSL_KEYTYPE_RSA);
// Create the private and public key
$res = openssl_pkey_new($config);
if ($res === false) {
AJXP_Logger::error(__CLASS__, __FUNCTION__, "Warning, OpenSSL is active but could not correctly generate a key for Zoho Editor. Please make sure the openssl.cnf file is correctly set up.");
while ($message = openssl_error_string()) {
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "Open SSL Error: " . $message);
}
} else {
openssl_pkey_export_to_file($res, $keyFile);
}
}
示例10: __construct
/** Construction. This kills the current session if any started, and restart the given session */
public function __construct($name, $cleanPreviousSession = false)
{
if (session_id() == "") {
// Mysterious fix, necessary for joomla.
ini_set('session.save_handler', 'files');
// Start a default session and save on the handler
session_start();
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
AJXP_Logger::debug("Session switching 1: ", SessionSwitcher::$sessionArray);
session_write_close();
} else {
SessionSwitcher::$sessionArray[] = array('id' => session_id(), 'name' => session_name());
}
// Please note that there is no start here, session might be already started
if (session_id() != "") {
// There was a previous session
if ($cleanPreviousSession) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
session_destroy();
}
// Close the session
session_write_close();
session_regenerate_id(false);
$_SESSION = array();
// Need to generate a new session id
}
// Mysterious fix, necessary for joomla.
ini_set('session.save_handler', 'files');
$newId = md5(SessionSwitcher::$sessionArray[0]['id'] . $name);
AJXP_Logger::debug("Session switching new id: ", $newId);
session_id($newId);
session_name($name);
session_start();
}
示例11: copyOrMoveSelection
public function copyOrMoveSelection($actionName, &$httpVars, $filesVars)
{
if ($actionName != "rename") {
$init = $this->initDirAndSelection($httpVars, array("DEST_DIR" => AJXP_Utils::decodeSecureMagic($httpVars["dest"])));
$this->commitMessageParams = "To:" . $httpVars["dest"] . ";items:";
} else {
$init = $this->initDirAndSelection($httpVars, array(), true);
}
AJXP_Logger::debug("Entering SVN MAnager for action {$actionName}", $init);
$action = 'copy';
if ($actionName == "move" || $actionName == "rename") {
$action = 'move';
}
foreach ($init["SELECTION"] as $selectedFile) {
if ($actionName == "rename") {
$destFile = dirname($selectedFile) . "/" . AJXP_Utils::decodeSecureMagic($httpVars["filename_new"]);
$this->commitMessageParams = "To:" . $httpVars["filename_new"] . ";item:" . $httpVars["file"];
} else {
$destFile = $init["DEST_DIR"] . "/" . basename($selectedFile);
}
$this->addIfNotVersionned(str_replace($init["DIR"], "", $selectedFile), $selectedFile);
$res = ExecSvnCmd("svn {$action}", array($selectedFile, $destFile), '');
}
if ($actionName != "rename") {
$this->commitMessageParams .= "[" . implode(",", $init["SELECTION"]) . "]";
}
$this->commitChanges($actionName, $httpVars, $filesVars);
if ($actionName != "rename") {
$this->commitChanges($actionName, array("dir" => $httpVars["dest"]), $filesVars);
}
AJXP_Logger::logAction("CopyMove/Rename (svn delegate)", array("files" => $init["SELECTION"]));
AJXP_XMLWriter::header();
AJXP_XMLWriter::sendMessage("The selected files/folders have been copied/moved (by SVN)", null);
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
}
示例12: trim
$requestUri = $_SERVER["REQUEST_URI"];
$end = trim(substr($requestUri, strlen($baseURI . "/")));
$rId = null;
if ((!empty($end) || $end === "0") && $end[0] != "?") {
$parts = explode("/", $end);
$pathBase = $parts[0];
$repositoryId = $pathBase;
$repository = ConfService::getRepositoryById($repositoryId);
if ($repository == null) {
$repository = ConfService::getRepositoryByAlias($repositoryId);
if ($repository != null) {
$repositoryId = $repository->getId();
}
}
if ($repository == null) {
AJXP_Logger::debug("not found, dying {$repositoryId}");
die('You are not allowed to access this service');
}
$rId = $repositoryId;
$rootDir = new AJXP_Sabre_Collection("/", $repository, null);
$server = new Sabre\DAV\Server($rootDir);
$server->setBaseUri($baseURI . "/" . $pathBase);
} else {
$rootDir = new AJXP_Sabre_RootCollection("root");
$server = new Sabre\DAV\Server($rootDir);
$server->setBaseUri($baseURI);
}
if ((AJXP_Sabre_AuthBackendBasic::detectBasicHeader() || ConfService::getCoreConf("WEBDAV_FORCE_BASIC")) && ConfService::getAuthDriverImpl()->getOption("TRANSMIT_CLEAR_PASS")) {
$authBackend = new AJXP_Sabre_AuthBackendBasic($rId);
} else {
$authBackend = new AJXP_Sabre_AuthBackendDigest($rId);
示例13: checkPassword
public function checkPassword($login, $pass, $seed)
{
if (!extension_loaded('radius')) {
AJXP_Logger::logAction("RADIUS: php radius extension is missing, please install it.");
return false;
}
$res = radius_auth_open();
$this->prepareRequest($res, $login, $pass, $seed);
$req = radius_send_request($res);
if (!$req) {
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "RADIUS: Could not send request (" . radius_strerror($res) . ")");
return false;
}
switch ($req) {
case RADIUS_ACCESS_ACCEPT:
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "RADIUS: authentication for user \"" . $login . "\" successful");
radius_close($res);
return true;
case RADIUS_ACCESS_REJECT:
AJXP_Logger::logAction("RADIUS: authentication for user \"" . $login . "\" failed");
break;
default:
AJXP_Logger::debug(__CLASS__, __FUNCTION__, "RADIUS: unknwon return value " . $req);
break;
}
radius_close($res);
return false;
}
示例14: checkBruteForceLogin
/**
* Determines whether the user is try to make many attemps
* @static
* @param $loginArray
* @return bool
*/
static function checkBruteForceLogin(&$loginArray)
{
$serverAddress = "";
if (isset($_SERVER['REMOTE_ADDR'])) {
$serverAddress = $_SERVER['REMOTE_ADDR'];
} else {
$serverAddress = $_SERVER['SERVER_ADDR'];
}
$login = null;
if (isset($loginArray[$serverAddress])) {
$login = $loginArray[$serverAddress];
}
if (is_array($login)) {
$login["count"]++;
} else {
$login = array("count" => 1, "time" => time());
}
$loginArray[$serverAddress] = $login;
if ($login["count"] > 3) {
if (AJXP_SERVER_DEBUG) {
AJXP_Logger::debug("DEBUG : IGNORING BRUTE FORCE ATTEMPTS!");
return true;
}
return FALSE;
}
return TRUE;
}
示例15: runCommandInBackground
/**
* @param $cmd
* @param $logFile
* @return UnixProcess|null
*/
public static function runCommandInBackground($cmd, $logFile)
{
if (PHP_OS == "WIN32" || PHP_OS == "WINNT" || PHP_OS == "Windows") {
if (AJXP_SERVER_DEBUG) {
$cmd .= " > " . $logFile;
}
if (class_exists("COM") && ConfService::getCoreConf("CLI_USE_COM")) {
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C {$cmd}", 0, false);
} else {
$basePath = str_replace("/", DIRECTORY_SEPARATOR, AJXP_INSTALL_PATH);
$tmpBat = implode(DIRECTORY_SEPARATOR, array($basePath, "data", "tmp", md5(time()) . ".bat"));
$cmd = "@chcp 1252 > nul \r\n" . $cmd;
$cmd .= "\n DEL " . chr(34) . $tmpBat . chr(34);
AJXP_Logger::debug("Writing file {$cmd} to {$tmpBat}");
file_put_contents($tmpBat, $cmd);
pclose(popen('start /b "CLI" "' . $tmpBat . '"', 'r'));
}
} else {
$process = new UnixProcess($cmd, AJXP_SERVER_DEBUG ? $logFile : null);
AJXP_Logger::debug("Starting process and sending output dev null");
return $process;
}
}