Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2017-10-30 10:42:51 +01:00
commit b28ff509b1
9 changed files with 72 additions and 27 deletions

View File

@ -146,10 +146,17 @@ class Magic extends \Zotlabs\Web\Controller {
if($x['success']) {
$j = json_decode($x['body'],true);
if($j['success'] && $j['token']) {
$x = strpbrk($dest,'?&');
$args = (($x) ? '&owt=' . $j['token'] : '?f=&owt=' . $j['token']) . (($delegate) ? '&delegate=1' : '');
if($j['success']) {
$token = '';
if($j['encrypted_token']) {
openssl_private_decrypt(base64url_decode($j['encrypted_token']),$token,$channel['channel_prvkey']);
}
else {
$token = $j['token'];
}
$x = strpbrk($dest,'?&');
$args = (($x) ? '&owt=' . $token : '?f=&owt=' . $token) . (($delegate) ? '&delegate=1' : '');
goaway($dest . $args);
}
}

View File

@ -41,7 +41,9 @@ class Owa extends \Zotlabs\Web\Controller {
$ret['success'] = true;
$token = random_string(32);
\Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']);
$ret['token'] = $token;
$result = '';
openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
$ret['encrypted_token'] = base64url_encode($result);
}
}
}

View File

@ -89,22 +89,30 @@ class Page extends \Zotlabs\Web\Controller {
if(! $ignore_language) {
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and (( iconfig.k = 'WEBPAGE' and item_type = %d )
OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1",
and iconfig.k = 'WEBPAGE' and item_type = %d
$sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($lang_page_id),
intval(ITEM_TYPE_WEBPAGE),
intval(ITEM_TYPE_PDL)
intval(ITEM_TYPE_WEBPAGE)
);
}
if(! $r) {
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and (( iconfig.k = 'WEBPAGE' and item_type = %d )
OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1",
and iconfig.k = 'WEBPAGE' and item_type = %d
$sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_TYPE_WEBPAGE)
);
}
if(! $r) {
// no webpage by that name, but we do allow you to load/preview a layout using this module. Try that.
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
and iconfig.k = 'PDL' AND item_type = %d $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_TYPE_WEBPAGE),
intval(ITEM_TYPE_PDL)
);
}
@ -129,7 +137,7 @@ class Page extends \Zotlabs\Web\Controller {
}
return;
}
if($r[0]['title'])
\App::$page['title'] = escape_tags($r[0]['title']);

View File

@ -16,7 +16,7 @@ class Starred extends \Zotlabs\Web\Controller {
if(! $message_id)
killme();
$r = q("SELECT item_flags FROM item WHERE uid = %d AND id = %d LIMIT 1",
$r = q("SELECT item_starred FROM item WHERE uid = %d AND id = %d LIMIT 1",
intval(local_channel()),
intval($message_id)
);

View File

@ -469,8 +469,11 @@ class Comanche {
if(file_exists('Zotlabs/SiteWidget/' . $clsname . '.php'))
require_once('Zotlabs/SiteWidget/' . $clsname . '.php');
elseif(file_exists('widget/' . $clsname . '/' . $clsname . '.php'))
require_once('widget/' . $clsname . '/' . $clsname . '.php');
elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php'))
require_once('Zotlabs/Widget/' . $clsname . '.php');
if(class_exists($nsname)) {
$x = new $nsname;
$f = 'widget';

View File

@ -129,14 +129,44 @@ Some/many of these widgets have restrictions which may restrict the type of page
Creating New Widgets
====================
If you want a widget named 'slugfish', create widget/slugfish.php containing
### Class Widgets
To create a class-based widget named 'slugfish' create a file with the following contents:
````
<?php
namespace Zotlabs\Widget;
class Slugfish {
function widget($args) {
... widget code goes here.
... The function returns a string which is the HTML content of the widget.
... $args is a named array which is passed any [var] variables from the layout editor
... For instance [widget=slugfish][var=count]3[/var][/widget] will populate $args with
... [ 'count' => 3 ]
}
````
The resultant file may be placed in widget/Slugfish/Slugfish.php , or Zotlabs/SiteWidgets/Slugfish.php . It also may be linked from a git repository using util/add_widget_repo.
Traditional function based widget:
If you want a widget named 'slugfish', create widget/widget_slugfish.php containing
<?php
function widget_slugfish($args) {
.. widget code goes here
.. widget code goes here. See above information for class-based widgets for details.
}

View File

@ -369,7 +369,7 @@ function contact_remove($channel_id, $abook_id) {
return false;
$r = q("select * from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d",
$r = q("select id from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d",
dbesc($abook['abook_xchan']),
dbesc($abook['abook_xchan']),
intval($channel_id)

View File

@ -5,17 +5,6 @@ if [ $# -lt 2 ]; then
exit 1
fi
#if [[ $1 != *"//github.com/redmatrix"* && $3 != 'insecure' ]]; then
# echo "";
# echo "This is NOT an official project repository.";
# echo "In order to protect you from unverified and";
# echo "possibly malicious content, this repository";
# echo "will not be linked to your site unless you";
# echo "append the word 'insecure' to the command.";
# echo "";
# exit 1
#fi
mkdir -p extend/widget/$2
mkdir widget > /dev/null 2>&1
git clone $1 extend/widget/$2

6
view/pdl/mod_sources.pdl Normal file
View File

@ -0,0 +1,6 @@
[region=aside]
[widget=settings_menu][/widget]
[/region]
[region=right_aside]
[widget=notifications][/widget]
[/region]