aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php2
-rw-r--r--include/acl_selectors.php2
-rw-r--r--include/conversation.php5
-rw-r--r--include/event.php20
-rw-r--r--include/group.php24
-rw-r--r--include/identity.php64
-rwxr-xr-xinclude/items.php2
-rw-r--r--include/photos.php2
-rw-r--r--include/security.php2
9 files changed, 67 insertions, 56 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 59605e463..fd450033c 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -255,7 +255,7 @@ function channel_remove($channel_id, $local = true) {
}
- q("DELETE FROM `group` WHERE `uid` = %d", intval($channel_id));
+ q("DELETE FROM `groups` WHERE `uid` = %d", intval($channel_id));
q("DELETE FROM `group_member` WHERE `uid` = %d", intval($channel_id));
q("DELETE FROM `event` WHERE `uid` = %d", intval($channel_id));
q("DELETE FROM `item` WHERE `uid` = %d", intval($channel_id));
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 930f9967a..749ca75eb 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -14,7 +14,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
- $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval(local_user())
);
diff --git a/include/conversation.php b/include/conversation.php
index d602174b0..99252027d 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1296,15 +1296,18 @@ function prepare_page($item) {
$a = get_app();
$naked = ((get_pconfig($item['uid'],'system','nakedpage')) ? 1 : 0);
+ $observer = $a->get_observer();
+ $zid = ($observer['xchan_addr']);
+
if(array_key_exists('webpage',$a->layout) && array_key_exists('authored',$a->layout['webpage'])) {
if($a->layout['webpage']['authored'] === 'none')
$naked = 1;
// ... other possible options
}
-
return replace_macros(get_markup_template('page_display.tpl'),array(
'$author' => (($naked) ? '' : $item['author']['xchan_name']),
'$auth_url' => (($naked) ? '' : $item['author']['xchan_url']),
+ '$zid' => $zid,
'$date' => (($naked) ? '' : datetime_convert('UTC',date_default_timezone_get(),$item['created'],'Y-m-d H:i')),
'$title' => smilies(bbcode($item['title'])),
'$body' => prepare_body($item,true)
diff --git a/include/event.php b/include/event.php
index 7873de1ef..20c5de09c 100644
--- a/include/event.php
+++ b/include/event.php
@@ -15,7 +15,7 @@ function format_event_html($ev) {
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
- $o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
+ $o .= '<p class="description event-description">' . bbcode($ev['description']) . '</p>' . "\r\n";
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
. datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
@@ -52,8 +52,8 @@ function format_event_bbcode($ev) {
if($ev['summary'])
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
- if($ev['desc'])
- $o .= '[event-description]' . $ev['desc'] . '[/event-description]';
+ if($ev['description'])
+ $o .= '[event-description]' . $ev['description'] . '[/event-description]';
if($ev['start'])
$o .= '[event-start]' . $ev['start'] . '[/event-start]';
@@ -75,7 +75,7 @@ function format_event_bbcode($ev) {
function bbtovcal($s) {
$o = '';
$ev = bbtoevent($s);
- if($ev['desc'])
+ if($ev['description'])
$o = format_event_html($ev);
return $o;
}
@@ -90,7 +90,7 @@ function bbtoevent($s) {
$ev['summary'] = $match[1];
$match = '';
if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
- $ev['desc'] = $match[1];
+ $ev['description'] = $match[1];
$match = '';
if(preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is",$s,$match))
$ev['start'] = $match[1];
@@ -122,7 +122,7 @@ function ev_compare($a,$b) {
$date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['start']) : $b['start']);
if($date_a === $date_b)
- return strcasecmp($a['desc'],$b['desc']);
+ return strcasecmp($a['description'],$b['description']);
return strcmp($date_a,$date_b);
}
@@ -178,7 +178,7 @@ function event_store($arr) {
`start` = '%s',
`finish` = '%s',
`summary` = '%s',
- `desc` = '%s',
+ `description` = '%s',
`location` = '%s',
`type` = '%s',
`adjust` = %d,
@@ -193,7 +193,7 @@ function event_store($arr) {
dbesc($arr['start']),
dbesc($arr['finish']),
dbesc($arr['summary']),
- dbesc($arr['desc']),
+ dbesc($arr['description']),
dbesc($arr['location']),
dbesc($arr['type']),
intval($arr['adjust']),
@@ -266,7 +266,7 @@ function event_store($arr) {
$arr['mid'] = item_message_id();
- $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary, `desc`,location,type,
+ $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type,
adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']),
@@ -278,7 +278,7 @@ function event_store($arr) {
dbesc($arr['start']),
dbesc($arr['finish']),
dbesc($arr['summary']),
- dbesc($arr['desc']),
+ dbesc($arr['description']),
dbesc($arr['location']),
dbesc($arr['type']),
intval($arr['adjust']),
diff --git a/include/group.php b/include/group.php
index c19c83c80..cdd779df2 100644
--- a/include/group.php
+++ b/include/group.php
@@ -14,11 +14,11 @@ function group_add($uid,$name,$public = 0) {
// access lists. What we're doing here is reviving the dead group, but old content which
// was restricted to this group may now be seen by the new group members.
- $z = q("SELECT * FROM `group` WHERE `id` = %d LIMIT 1",
+ $z = q("SELECT * FROM `groups` WHERE `id` = %d LIMIT 1",
intval($r)
);
if(count($z) && $z[0]['deleted']) {
- $r = q("UPDATE `group` SET `deleted` = 0 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("UPDATE `groups` SET `deleted` = 0 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -31,13 +31,13 @@ function group_add($uid,$name,$public = 0) {
$dups = false;
$hash = random_string() . $name;
- $r = q("SELECT id FROM `group` WHERE hash = '%s' LIMIT 1", dbesc($hash));
+ $r = q("SELECT id FROM `groups` WHERE hash = '%s' LIMIT 1", dbesc($hash));
if($r)
$dups = true;
} while($dups == true);
- $r = q("INSERT INTO `group` ( hash, uid, visible, name )
+ $r = q("INSERT INTO `groups` ( hash, uid, visible, name )
VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash),
intval($uid),
@@ -53,7 +53,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) {
$ret = false;
if(x($uid) && x($name)) {
- $r = q("SELECT id, hash FROM `group` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("SELECT id, hash FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -104,7 +104,7 @@ function group_rmv($uid,$name) {
);
// remove group
- $r = q("UPDATE `group` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("UPDATE `groups` SET `deleted` = 1 WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -119,7 +119,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) {
if((! $uid) || (! strlen($name)))
return false;
- $r = q("SELECT * FROM `group` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `name` = '%s' LIMIT 1",
intval($uid),
dbesc($name)
);
@@ -132,7 +132,7 @@ function group_byname($uid,$name) {
function group_rec_byhash($uid,$hash) {
if((! $uid) || (! strlen($hash)))
return false;
- $r = q("SELECT * FROM `group` WHERE `uid` = %d AND `hash` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `groups` WHERE `uid` = %d AND `hash` = '%s' LIMIT 1",
intval($uid),
dbesc($hash)
);
@@ -207,7 +207,7 @@ function mini_group_select($uid,$group = '') {
$grps = array();
$o = '';
- $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval($uid)
);
$grps[] = array('name' => '', 'hash' => '0', 'selected' => '');
@@ -246,7 +246,7 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
);
- $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
+ $r = q("SELECT * FROM `groups` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval($_SESSION['uid'])
);
$member_of = array();
@@ -302,7 +302,7 @@ function expand_groups($a) {
$groups = implode(',', $x);
if($groups)
- $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from `group` where hash in ( $groups ))");
+ $r = q("SELECT xchan FROM group_member WHERE gid IN ( select id from `groups` where hash in ( $groups ))");
$ret = array();
if($r)
@@ -314,7 +314,7 @@ function expand_groups($a) {
function member_of($c) {
- $r = q("SELECT `group`.`name`, `group`.`id` FROM `group` LEFT JOIN `group_member` ON `group_member`.`gid` = `group`.`id` WHERE `group_member`.`xchan` = '%s' AND `group`.`deleted` = 0 ORDER BY `group`.`name` ASC ",
+ $r = q("SELECT `groups`.`name`, `groups`.`id` FROM `groups` LEFT JOIN `group_member` ON `group_member`.`gid` = `groups`.`id` WHERE `group_member`.`xchan` = '%s' AND `groups`.`deleted` = 0 ORDER BY `groups`.`name` ASC ",
dbesc($c)
);
diff --git a/include/identity.php b/include/identity.php
index 80f02a9c5..be4e4be93 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -71,23 +71,34 @@ function validate_channelname($name) {
/**
- * @function create_dir_account()
+ * @function create_sys_channel()
* Create a system channel - which has no account attached
*
- * Currently unused.
- *
*/
-function create_dir_account() {
+function create_sys_channel() {
+ if(get_sys_channel())
+ return;
create_identity(array(
'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
- 'nickname' => 'dir',
- 'name' => 'Directory',
- 'pageflags' => PAGE_DIRECTORY_CHANNEL|PAGE_HIDDEN,
- 'publish' => 0
+ 'nickname' => 'sys',
+ 'name' => 'System',
+ 'pageflags' => PAGE_SYSTEM,
+ 'publish' => 0,
+ 'xchanflags' => XCHAN_FLAGS_SYSTEM
));
}
+function get_sys_channel() {
+ $r = q("select * from channel left join xchan on channel_hash = xchan_hash where (channel_pageflags & %d) limit 1",
+ intval(PAGE_SYSTEM)
+ );
+ if($r)
+ return $r[0];
+ return false;
+}
+
+
/**
* @channel_total()
* Return the total number of channels on this site. No filtering is performed.
@@ -145,7 +156,7 @@ function create_identity($arr) {
$name = escape_tags($arr['name']);
$pageflags = ((x($arr,'pageflags')) ? intval($arr['pageflags']) : PAGE_NORMAL);
-
+ $xchanflags = ((x($arr,'xchanflags')) ? intval($arr['xchanflags']) : XCHAN_FLAGS_NORMAL);
$name_error = validate_channelname($arr['name']);
if($name_error) {
$ret['message'] = $name_error;
@@ -243,7 +254,7 @@ function create_identity($arr) {
$newuid = $ret['channel']['channel_id'];
- $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
+ $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
dbesc($hash),
dbesc($guid),
dbesc($sig),
@@ -258,7 +269,8 @@ function create_identity($arr) {
dbesc($ret['channel']['channel_name']),
dbesc('zot'),
dbesc(datetime_convert()),
- dbesc(datetime_convert())
+ dbesc(datetime_convert()),
+ intval($xchanflags)
);
// Not checking return value.
@@ -396,7 +408,7 @@ function identity_basic_export($channel_id) {
$ret['hubloc'] = $r;
}
- $r = q("select * from `group` where uid = %d ",
+ $r = q("select * from `groups` where uid = %d ",
intval($channel_id)
);
@@ -1111,22 +1123,18 @@ function get_theme_uid() {
}
/**
- * @function get_default_profile_photo($size = 175)
- * Retrieves the path of the default_profile_photo for this system
- * with the specified size.
- * @param int $size
- * one of (175, 80, 48)
- * @returns string
- *
- */
+* @function get_default_profile_photo($size = 175)
+* Retrieves the path of the default_profile_photo for this system
+* with the specified size.
+* @param int $size
+* one of (175, 80, 48)
+* @returns string
+*
+*/
function get_default_profile_photo($size = 175) {
- $scheme = get_config('system','default_profile_photo');
- if(! $scheme)
- $scheme = 'rainbow_man';
- return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg';
+ $scheme = get_config('system','default_profile_photo');
+ if(! $scheme)
+ $scheme = 'rainbow_man';
+ return 'images/default_profile_photos/' . $scheme . '/' . $size . '.jpg';
}
-
-
-
- \ No newline at end of file
diff --git a/include/items.php b/include/items.php
index 26fdc3c5c..465fda543 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3718,7 +3718,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) ";
if($arr['gid'] && $uid) {
- $r = q("SELECT * FROM `group` WHERE id = %d AND uid = %d LIMIT 1",
+ $r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
intval($uid)
);
diff --git a/include/photos.php b/include/photos.php
index 3ccb536a8..e41d1059a 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -319,7 +319,7 @@ function photos_list_photos($channel,$observer,$album = '') {
$ret = array('success' => false);
- $r = q("select resource_id, created, edited, title, `desc`, album, filename, `type`, height, width, `size`, `scale`, profile, photo_flags, allow_cid, allow_gid, deny_cid, deny_gid from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra ",
+ $r = q("select resource_id, created, edited, title, description, album, filename, type, height, width, size, scale, profile, photo_flags, allow_cid, allow_gid, deny_cid, deny_gid from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra ",
intval($channel_id),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE)
diff --git a/include/security.php b/include/security.php
index 296fa450f..138efe3ab 100644
--- a/include/security.php
+++ b/include/security.php
@@ -386,7 +386,7 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f
if(! function_exists('init_groups_visitor')) {
function init_groups_visitor($contact_id) {
$groups = array();
- $r = q("SELECT hash FROM `group` left join group_member on group.id = group_member.gid WHERE xchan = '%s' ",
+ $r = q("SELECT hash FROM `groups` left join group_member on groups.id = group_member.gid WHERE xchan = '%s' ",
dbesc($contact_id)
);
if(count($r)) {