Merge branch 'dev' into sabre32

This commit is contained in:
Mario Vavti 2016-06-15 08:42:51 +02:00
commit 9a0dff08bc
6 changed files with 160 additions and 10 deletions

View File

@ -16,14 +16,14 @@ require_once('include/zot.php');
require_once('include/widgets.php');
require_once('include/photos.php');
/* @brief Initialize the connection-editor
*
*
*/
class Connedit extends \Zotlabs\Web\Controller {
/* @brief Initialize the connection-editor
*
*
*/
function init() {
if(! local_channel())
@ -51,7 +51,7 @@ class Connedit extends \Zotlabs\Web\Controller {
*
*/
function post() {
function post() {
if(! local_channel())
return;
@ -357,7 +357,7 @@ class Connedit extends \Zotlabs\Web\Controller {
*
*/
function get() {
function get() {
$sort_type = 0;
$o = '';
@ -418,6 +418,12 @@ class Connedit extends \Zotlabs\Web\Controller {
goaway(z_root() . '/connedit/' . $contact_id);
}
if($cmd === 'resetphoto') {
q("update xchan set xchan_photo_date = '2001-01-01 00:00:00' where xchan_hash = '%s' limit 1",
dbesc($orig_record[0]['xchan_hash'])
);
$cmd = 'refresh';
}
if($cmd === 'refresh') {
if($orig_record[0]['xchan_network'] === 'zot') {

80
Zotlabs/Module/README.md Normal file
View File

@ -0,0 +1,80 @@
Zotlabs/Module
==============
This directory contains controller modules for handling web requests. The
lowercase class name indicates the head of the URL path which this module
handles. There are other methods of attaching (routing) URL paths to
controllers, but this is the primary method used in this project.
Module controllers MUST reside in this directory and namespace to be
autoloaded (unless other specific routing methods are employed). They
typically use and extend the class definition in Zotlabs/Web/Controller
as a template.
Template:
<?php
namespace Zotlabs\Web;
class Controller {
function init() {}
function post() {}
function get() {}
}
Typical Module declaration for the '/foo' URL route:
<?php
namespace Zotlabs\Module;
class Foo extends \Zotlabs\Web\Controller {
function init() {
// init() handler goes here
}
function post() {
// post handler goes here
}
function get() {
return 'Hello world.' . EOL;
}
}
This model provides callbacks for public functions named init(), post(),
and get(). init() is always called. post() is called if $_POST variables
are present, and get() is called if none of the prior functions terminated
the handler. The get() method typically retuns a string which represents
the contents of the content region of the resulting page. Modules which emit
json, xml or other machine-readable formats typically emit their contents
inside the init() function and call 'killme()' to terminate the Module.
Modules are passed the URL path as argc,argv arguments. For a path such as
https://mysite.something/foo/bar/baz
The app will typically invoke the Module class 'Foo' and pass it
$x = argc(); // $x = 3
$x = argv(0); // $x = 'foo'
$x = argv(1); // $x = 'bar'
$x = argv(2); // $x = 'baz'
These are handled in a similar fashion to their counterparts in the Unix shell
or C/C++ languages. Do not confuse the argc(),argv() functions with the
global variables $argc,$argv which are passed to command line programs. These
are handled separately by command line and Zotlabs/Daemon class functions.

View File

@ -3,6 +3,8 @@
namespace Zotlabs\Storage;
use Sabre\DAV;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
/**
* @brief Authentication backend class for DAV.
@ -145,6 +147,57 @@ class BasicAuth extends DAV\Auth\Backend\AbstractBasic {
return true;
}
/**
* When this method is called, the backend must check if authentication was
* successful.
*
* The returned value must be one of the following
*
* [true, "principals/username"]
* [false, "reason for failure"]
*
* If authentication was successful, it's expected that the authentication
* backend returns a so-called principal url.
*
* Examples of a principal url:
*
* principals/admin
* principals/user1
* principals/users/joe
* principals/uid/123457
*
* If you don't use WebDAV ACL (RFC3744) we recommend that you simply
* return a string such as:
*
* principals/users/[username]
*
* @param RequestInterface $request
* @param ResponseInterface $response
* @return array
*/
function check(RequestInterface $request, ResponseInterface $response) {
if(local_channel()) {
return [ true, $this->principalPrefix . $this->channel_name ];
}
$auth = new \Sabre\HTTP\Auth\Basic(
$this->realm,
$request,
$response
);
$userpass = $auth->getCredentials();
if (!$userpass) {
return [false, "No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured"];
}
if (!$this->validateUserPass($userpass[0], $userpass[1])) {
return [false, "Username or password was incorrect"];
}
return [true, $this->principalPrefix . $userpass[0]];
}
protected function check_module_access($channel_id) {
if($channel_id && \App::$module === 'cdav') {
$x = get_pconfig($channel_id,'cdav','enabled');

View File

@ -10,3 +10,4 @@ class Controller {
function get() {}
}

View File

@ -6,5 +6,5 @@
<dt><a href='#' onclick='contextualHelpFocus("#wiki-get-history", 0); return false;' title="Pulsar para resaltar el elemento...">Historial de la página</a></dt>
<dd>Cada revisión de una página se salva para permitir su rápida recuperación. Pulsar en la pestaña <b>Historial</b> para ver las revisiones de la página, incluyendo la fecha y el autor de cada una. El botón de reversión cargará la revisión seleccionada, pero no salvará automáticamente la página.</dd>
<dt><a href='#' onclick='contextualHelpFocus("#wiki_page_list", 1); return false;' title="Pulsar para resaltar el elemento...">Páginas</a></dt>
<dd>La lista de páginas en el wiki aparece en el panel <b>Páginas del wiki</b>. Antes de salvar las páginas editadas usando el control <b>Página</b> en el menú desplegable, puede <a href='#' onclick='contextualHelpFocus("#id_commitMsg", 0); return false;' title="Pulsar para resaltar el elemento...">escribir un mensaje personalizado</a> que se verá en el visor <a href='#' onclick='contextualHelpFocus("#wiki-get-history", 0); return false;' title="Pulsar para resaltar el elemento..."><b>Historial de la página</b> junto con la revisión.</dd>
<dd>La lista de páginas en el wiki aparece en el panel <b>Páginas del wiki</b>. Antes de salvar las páginas editadas usando el control <b>Página</b> en el menú desplegable, puede <a href='#' onclick='contextualHelpFocus("#id_commitMsg", 0); return false;' title="Pulsar para resaltar el elemento...">escribir un mensaje personalizado</a> que se verá en el visor <a href='#' onclick='contextualHelpFocus("#wiki-get-history", 0); return false;' title="Pulsar para resaltar el elemento..."><b>Historial de la página</b></a> junto con la revisión.</dd>
</dl>

View File

@ -0,0 +1,10 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>Ogni wiki è una raccolta di pagine, composta di file di testo formattati con Markdown.</dd>
<dt><a href="#" onclick='contextualHelpFocus("#wiki_list", 1); return false;' title="Fai click per evidenziare l'elemento...">Elenco dei Wiki</a></dt>
<dd>I Wiki del canale <i>che sei abilitato a vedere</i> sono elencati nel pannello laterale.</dd>
<dt><a href="#" onclick='contextualHelpFocus("#wiki-get-history", 0); return false;' title="Fai click per evidenziare l'elemento...">Cronologia della pagina</a></dt>
<dd>Le revisioni di ogni pagina vengono salvate per rendere possibile un ripristino veloce. Fai click sulla tab <b>Cronologia</b> per vedere l'elenco delle revisioni, con autore e data delle stesse. Il bottone di ripristino riporterà alla revisione selezionata, senza salvare automaticamente la pagina.</dd>
<dt><a href="#" onclick='contextualHelpFocus("#wiki_page_list", 1); return false;' title="Fai click per evidenziare l'elemento...">Pagine</a></dt>
<dd>L'elenco delle pagine del wiki si trova nel pannello <b>Pagine del wiki</b>. Prima di salvare le modifiche con il menu a discela <b>Pagina</b>, puoi <a href="#" onclick='contextualHelpFocus("#id_commitMsg", 0); return false;' title="Fai click per evidenziare l'elemento...">inserire un messaggio</a> che verrà visualizzato nella visualizzazione della <a href="#" onclick='contextualHelpFocus("#wiki-get-history", 0); return false;' title="Fai click per evidenziare l'elemento..."><b>storia della pagina</b></a> insieme alla revisione.</dd>
</dl>