aboutsummaryrefslogtreecommitdiffstats
path: root/include/comanche.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2015-03-04 00:03:19 +0100
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2015-03-04 00:15:24 +0100
commit0d601563d02d7e9b7414586486f1623a93cf958b (patch)
tree0dfa8f1ed5a68c610f474d4d56ede35bad48f49f /include/comanche.php
parent2d38e58adbf47a0c318100ffd08b7d90b827158f (diff)
downloadvolse-hubzilla-0d601563d02d7e9b7414586486f1623a93cf958b.tar.gz
volse-hubzilla-0d601563d02d7e9b7414586486f1623a93cf958b.tar.bz2
volse-hubzilla-0d601563d02d7e9b7414586486f1623a93cf958b.zip
Some cleanups and documentation.
Fixed some wrong variable names. Initialized some variables before using them. Removed some checks for STATUSNET_PRIVACY_COMPATIBILITY in include/security.php as it does not seem to be defined anywhere.
Diffstat (limited to 'include/comanche.php')
-rw-r--r--include/comanche.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/include/comanche.php b/include/comanche.php
index b181d415a..9db375c38 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -15,23 +15,22 @@ require_once('include/widgets.php');
// page layout from the given description
-function pdl_selector($uid,$current="") {
-
+function pdl_selector($uid, $current="") {
$o = '';
- $sql_extra = item_permissions_sql($uid);
+ //$sql_extra = item_permissions_sql($uid);
$r = q("select item_id.*, mid from item_id left join item on iid = item.id where item_id.uid = %d and item_id.uid = item.uid and service = 'PDL' order by sid asc",
- intval($owner)
+ intval($uid)
);
$arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r);
call_hooks('pdl_selector',$arr);
$entries = $arr['entries'];
- $current = $arr['current'];
-
- $o .= "<select name=\"pdl_select\" id=\"pdl_select\" size=\"1\" >";
+ $current = $arr['current'];
+
+ $o .= '<select name="pdl_select" id="pdl_select" size="1">';
$entries[] = array('title' => t('Default'), 'mid' => '');
foreach($entries as $selection) {
$selected = (($selection == $current) ? ' selected="selected" ' : '');
@@ -40,16 +39,17 @@ function pdl_selector($uid,$current="") {
$o .= '</select>';
return $o;
-}
+}
-function comanche_parser(&$a,$s) {
+function comanche_parser(&$a, $s) {
+ $matches = array();
$cnt = preg_match_all("/\[comment\](.*?)\[\/comment\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $s = str_replace($mtch[0],'',$s);
+ $s = str_replace($mtch[0], '', $s);
}
}
@@ -99,14 +99,14 @@ function comanche_parser(&$a,$s) {
function comanche_menu($name,$class = '') {
$channel_id = comanche_get_channel_id();
if($channel_id) {
- $m = menu_fetch($name,$channel_id,get_observer_hash());
- return menu_render($m,$class);
+ $m = menu_fetch($name,$channel_id, get_observer_hash());
+ return menu_render($m, $class);
}
}
function comanche_replace_region($match) {
$a = get_app();
- if(array_key_exists($match[1],$a->page)) {
+ if(array_key_exists($match[1], $a->page)) {
return $a->page[$match[1]];
}
}
@@ -121,15 +121,15 @@ function comanche_get_channel_id() {
$channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
if((! $channel_id) && (local_channel()))
$channel_id = local_channel();
+
return $channel_id;
}
function comanche_block($name) {
-
+ $o = '';
$channel_id = comanche_get_channel_id();
-
+
if($channel_id) {
- $o = '';
$r = q("select * from item inner join item_id on iid = item.id and item_id.uid = item.uid and item.uid = %d and service = 'BUILDBLOCK' and sid = '%s' limit 1",
intval($channel_id),
dbesc($name)
@@ -138,11 +138,12 @@ function comanche_block($name) {
$o = '<div class="widget bblock">';
if($r[0]['title'])
$o .= '<h3>' . $r[0]['title'] . '</h3>';
- $o .= prepare_text($r[0]['body'],$r[0]['mimetype']);
- $o .= '</div>';
+ $o .= prepare_text($r[0]['body'], $r[0]['mimetype']);
+ $o .= '</div>';
}
}
+
return $o;
}
@@ -154,8 +155,9 @@ function comanche_block($name) {
// of what template and webpage options we might desire.
function comanche_webpage(&$a,$s) {
-
$ret = array();
+ $matches = array();
+
$cnt = preg_match_all("/\[authored\](.*?)\[\/authored\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
@@ -170,9 +172,10 @@ function comanche_webpage(&$a,$s) {
// the global app environment, or config storage until we implement argument passing
-function comanche_widget($name,$text) {
- $a = get_app();
+function comanche_widget($name, $text) {
$vars = array();
+ $matches = array();
+
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
@@ -186,12 +189,13 @@ function comanche_widget($name,$text) {
}
-function comanche_region(&$a,$s) {
+function comanche_region(&$a, $s) {
+ $matches = array();
$cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s);
+ $s = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $s);
}
}
@@ -244,7 +248,3 @@ function register_page_template($arr) {
get_app()->page_layouts[$arr['template']] = array($arr['variant']);
return;
}
-
-
-
-