mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
more backticks
This commit is contained in:
parent
c44acb3575
commit
ce6e81c682
11 changed files with 128 additions and 238 deletions
|
@ -185,7 +185,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||
$_SESSION['loadtime'] = datetime_convert();
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT distinct parent AS `item_id`, created from item
|
||||
$r = q("SELECT distinct parent AS item_id, created from item
|
||||
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
||||
WHERE uid = %d $item_normal
|
||||
AND item_wall = 1 $simple_update
|
||||
|
@ -251,10 +251,10 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||
|
||||
$parents_str = ids_to_querystr($r,'item_id');
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`
|
||||
FROM `item`
|
||||
WHERE `item`.`uid` = %d $item_normal
|
||||
AND `item`.`parent` IN ( %s )
|
||||
$items = q("SELECT item.*, item.id AS item_id
|
||||
FROM item
|
||||
WHERE item.uid = %d $item_normal
|
||||
AND item.parent IN ( %s )
|
||||
$sql_extra ",
|
||||
intval(\App::$profile['profile_uid']),
|
||||
dbesc($parents_str)
|
||||
|
|
|
@ -214,8 +214,8 @@ class Display extends \Zotlabs\Web\Controller {
|
|||
|
||||
$r = q("SELECT * from item
|
||||
WHERE mid = '%s'
|
||||
AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = ''
|
||||
AND `item`.`deny_gid` = '' AND item_private = 0 )
|
||||
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
OR uid = %d )
|
||||
$sql_extra )
|
||||
|
@ -258,8 +258,8 @@ class Display extends \Zotlabs\Web\Controller {
|
|||
|
||||
$r = q("SELECT * from item
|
||||
WHERE mid = '%s'
|
||||
AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = ''
|
||||
AND `item`.`deny_gid` = '' AND item_private = 0 )
|
||||
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
OR uid = %d )
|
||||
$sql_extra )
|
||||
|
@ -282,8 +282,8 @@ class Display extends \Zotlabs\Web\Controller {
|
|||
$parents_str = ids_to_querystr($r,'id');
|
||||
if($parents_str) {
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`
|
||||
FROM `item`
|
||||
$items = q("SELECT item.*, item.id AS item_id
|
||||
FROM item
|
||||
WHERE parent in ( %s ) $item_normal ",
|
||||
dbesc($parents_str)
|
||||
);
|
||||
|
@ -321,7 +321,7 @@ class Display extends \Zotlabs\Web\Controller {
|
|||
/*
|
||||
elseif((! $update) && (! {
|
||||
|
||||
$r = q("SELECT `id`, item_flags FROM `item` WHERE `id` = '%s' OR `mid` = '%s' LIMIT 1",
|
||||
$r = q("SELECT id, item_flags FROM item WHERE id = '%s' OR mid = '%s' LIMIT 1",
|
||||
dbesc($item_hash),
|
||||
dbesc($item_hash)
|
||||
);
|
||||
|
|
|
@ -154,13 +154,13 @@ class Item extends \Zotlabs\Web\Controller {
|
|||
$obj_type = ACTIVITY_OBJ_COMMENT;
|
||||
|
||||
if($parent) {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
|
||||
intval($parent)
|
||||
);
|
||||
}
|
||||
elseif($parent_mid && $uid) {
|
||||
// This is coming from an API source, and we are logged in
|
||||
$r = q("SELECT * FROM `item` WHERE `mid` = '%s' AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
|
||||
dbesc($parent_mid),
|
||||
intval($uid)
|
||||
);
|
||||
|
@ -170,7 +170,7 @@ class Item extends \Zotlabs\Web\Controller {
|
|||
$parid = $r[0]['parent'];
|
||||
$parent_mid = $r[0]['mid'];
|
||||
if($r[0]['id'] != $r[0]['parent']) {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = `parent` AND `parent` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = parent AND parent = %d LIMIT 1",
|
||||
intval($parid)
|
||||
);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class Item extends \Zotlabs\Web\Controller {
|
|||
$iconfig = null;
|
||||
|
||||
if($post_id) {
|
||||
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
$i = q("SELECT * FROM item WHERE uid = %d AND id = %d LIMIT 1",
|
||||
intval($profile_uid),
|
||||
intval($post_id)
|
||||
);
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
|
||||
class Msearch extends \Zotlabs\Web\Controller {
|
||||
|
||||
function post() {
|
||||
|
||||
$perpage = (($_POST['n']) ? $_POST['n'] : 80);
|
||||
$page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);
|
||||
$startrec = (($page+1) * $perpage) - $perpage;
|
||||
|
||||
$search = $_POST['s'];
|
||||
if(! strlen($search))
|
||||
killme();
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') ",
|
||||
dbesc($search)
|
||||
);
|
||||
if(count($r))
|
||||
$total = $r[0]['total'];
|
||||
|
||||
$r = q("SELECT `keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') LIMIT %d , %d ",
|
||||
dbesc($search),
|
||||
intval($startrec),
|
||||
intval($perpage)
|
||||
);
|
||||
|
||||
$results = array();
|
||||
if(count($r)) {
|
||||
foreach($r as $rr)
|
||||
$results[] = array(
|
||||
'name' => $rr['name'],
|
||||
'url' => z_root() . '/channel/' . $rr['nickname'],
|
||||
'photo' => z_root() . '/photo/avatar/' . $rr['uid'],
|
||||
'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords'])
|
||||
);
|
||||
}
|
||||
|
||||
$output = array('total' => $total, 'items_page' => $perpage, 'page' => $page + 1, 'results' => $results);
|
||||
|
||||
echo json_encode($output);
|
||||
|
||||
killme();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,70 +1,11 @@
|
|||
<?php
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
class Notifications extends \Zotlabs\Web\Controller {
|
||||
|
||||
function post() {
|
||||
|
||||
if(! local_channel()) {
|
||||
goaway(z_root());
|
||||
}
|
||||
|
||||
$request_id = ((\App::$argc > 1) ? \App::$argv[1] : 0);
|
||||
|
||||
if($request_id === "all")
|
||||
return;
|
||||
|
||||
if($request_id) {
|
||||
|
||||
$r = q("SELECT * FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($request_id),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if(count($r)) {
|
||||
$intro_id = $r[0]['id'];
|
||||
$contact_id = $r[0]['contact-id'];
|
||||
}
|
||||
else {
|
||||
notice( t('Invalid request identifier.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
// If it is a friend suggestion, the contact is not a new friend but an existing friend
|
||||
// that should not be deleted.
|
||||
|
||||
$fid = $r[0]['fid'];
|
||||
|
||||
if($_POST['submit'] == t('Discard')) {
|
||||
$r = q("DELETE FROM `intro` WHERE `id` = %d",
|
||||
intval($intro_id)
|
||||
);
|
||||
if(! $fid) {
|
||||
|
||||
// The check for blocked and pending is in case the friendship was already approved
|
||||
// and we just want to get rid of the now pointless notification
|
||||
|
||||
$r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 AND `blocked` = 1 AND `pending` = 1",
|
||||
intval($contact_id),
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
goaway(z_root() . '/notifications/intros');
|
||||
}
|
||||
if($_POST['submit'] == t('Ignore')) {
|
||||
$r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d",
|
||||
intval($intro_id));
|
||||
goaway(z_root() . '/notifications/intros');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
function get() {
|
||||
|
||||
if(! local_channel()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
|
@ -74,36 +15,32 @@ class Notifications extends \Zotlabs\Web\Controller {
|
|||
nav_set_selected('notifications');
|
||||
|
||||
$o = '';
|
||||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
$r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
$not_tpl = get_markup_template('notify.tpl');
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
$r = q("SELECT * from notify where uid = %d and seen = 0 order by created desc",
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if ($r > 0) {
|
||||
$notifications_available =1;
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros($not_tpl,array(
|
||||
'$item_link' => z_root().'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$notif_content .= t('No more system notifications.');
|
||||
if($r) {
|
||||
$notifications_available = 1;
|
||||
foreach ($r as $it) {
|
||||
$notif_content .= replace_macros(get_markup_template('notify.tpl'),array(
|
||||
'$item_link' => z_root().'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_when' => relative_date($it['created'])
|
||||
));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$notif_content .= t('No more system notifications.');
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl,array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$notif_link_mark_seen' => t('Mark all system notifications seen'),
|
||||
'$notif_content' => $notif_content,
|
||||
'$notifications_available' => $notifications_available,
|
||||
));
|
||||
$o .= replace_macros(get_markup_template('notifications.tpl'),array(
|
||||
'$notif_header' => t('System Notifications'),
|
||||
'$notif_link_mark_seen' => t('Mark all system notifications seen'),
|
||||
'$notif_content' => $notif_content,
|
||||
'$notifications_available' => $notifications_available,
|
||||
));
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
if(! $ob_hash)
|
||||
goaway(z_root() . '/' . $_SESSION['photo_return']);
|
||||
|
||||
$r = q("SELECT `id`, `resource_id` FROM `photo` WHERE ( xchan = '%s' or `uid` = %d ) AND `resource_id` = '%s' LIMIT 1",
|
||||
$r = q("SELECT id, resource_id FROM photo WHERE ( xchan = '%s' or uid = %d ) AND resource_id = '%s' LIMIT 1",
|
||||
dbesc($ob_hash),
|
||||
intval(local_channel()),
|
||||
dbesc(\App::$argv[2])
|
||||
|
@ -241,7 +241,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
|
||||
logger('rotate');
|
||||
|
||||
$r = q("select * from photo where `resource_id` = '%s' and uid = %d and imgscale = 0 limit 1",
|
||||
$r = q("select * from photo where resource_id = '%s' and uid = %d and imgscale = 0 limit 1",
|
||||
dbesc($resource_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
@ -270,7 +270,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
$fsize = strlen($data);
|
||||
}
|
||||
|
||||
$x = q("update photo set content = '%s', filesize = %d, height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 0",
|
||||
$x = q("update photo set content = '%s', filesize = %d, height = %d, width = %d where resource_id = '%s' and uid = %d and imgscale = 0",
|
||||
dbescbin($data),
|
||||
intval($fsize),
|
||||
intval($height),
|
||||
|
@ -285,7 +285,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 1",
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where resource_id = '%s' and uid = %d and imgscale = 1",
|
||||
dbescbin($ph->imageString()),
|
||||
intval($height),
|
||||
intval($width),
|
||||
|
@ -300,7 +300,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 2",
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where resource_id = '%s' and uid = %d and imgscale = 2",
|
||||
dbescbin($ph->imageString()),
|
||||
intval($height),
|
||||
intval($width),
|
||||
|
@ -315,7 +315,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
$width = $ph->getWidth();
|
||||
$height = $ph->getHeight();
|
||||
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where `resource_id` = '%s' and uid = %d and imgscale = 3",
|
||||
$x = q("update photo set content = '%s', height = %d, width = %d where resource_id = '%s' and uid = %d and imgscale = 3",
|
||||
dbescbin($ph->imageString()),
|
||||
intval($height),
|
||||
intval($width),
|
||||
|
@ -333,7 +333,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
if($p) {
|
||||
$ext = $phototypes[$p[0]['mimetype']];
|
||||
|
||||
$r = q("UPDATE `photo` SET `description` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
|
||||
$r = q("UPDATE photo SET description = '%s', allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s' WHERE resource_id = '%s' AND uid = %d",
|
||||
dbesc($desc),
|
||||
dbesc($perm['allow_cid']),
|
||||
dbesc($perm['allow_gid']),
|
||||
|
@ -367,7 +367,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
|
||||
if($item_id) {
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($item_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
|
@ -695,8 +695,8 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$cmd) . '" title="oembed" />' . "\r\n";
|
||||
|
||||
|
||||
$r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
|
||||
AND `imgscale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
|
||||
$r = q("SELECT resource_id, max(imgscale) AS imgscale FROM photo WHERE uid = %d AND album = '%s'
|
||||
AND imgscale <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id",
|
||||
intval($owner_uid),
|
||||
dbesc($album),
|
||||
intval(PHOTO_NORMAL),
|
||||
|
@ -843,8 +843,8 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
|
||||
// fetch image, item containing image, then comments
|
||||
|
||||
$ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,mimetype,height,width,filesize,imgscale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
|
||||
$sql_extra ORDER BY `imgscale` ASC ",
|
||||
$ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,description,album,filename,mimetype,height,width,filesize,imgscale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM photo WHERE uid = %d AND resource_id = '%s'
|
||||
$sql_extra ORDER BY imgscale ASC ",
|
||||
intval($owner_uid),
|
||||
dbesc($datum)
|
||||
);
|
||||
|
@ -875,8 +875,8 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
$order = 'DESC';
|
||||
|
||||
|
||||
$prvnxt = q("SELECT `resource_id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `imgscale` = 0
|
||||
$sql_extra ORDER BY `created` $order ",
|
||||
$prvnxt = q("SELECT resource_id FROM photo WHERE album = '%s' AND uid = %d AND imgscale = 0
|
||||
$sql_extra ORDER BY created $order ",
|
||||
dbesc($ph[0]['album']),
|
||||
intval($owner_uid)
|
||||
);
|
||||
|
@ -993,7 +993,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
|
||||
if((local_channel()) && (local_channel() == $link_item['uid'])) {
|
||||
q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1",
|
||||
q("UPDATE item SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1",
|
||||
intval($link_item['parent']),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -1283,8 +1283,8 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$cmd) . '" title="oembed" />' . "\r\n";
|
||||
|
||||
|
||||
$r = q("SELECT `resource_id`, max(`imgscale`) AS `imgscale` FROM `photo` WHERE `uid` = %d
|
||||
and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`",
|
||||
$r = q("SELECT resource_id, max(imgscale) AS imgscale FROM photo WHERE uid = %d
|
||||
and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id",
|
||||
intval(\App::$data['channel']['channel_id']),
|
||||
intval(PHOTO_NORMAL),
|
||||
intval(PHOTO_PROFILE),
|
||||
|
|
|
@ -173,7 +173,7 @@ class Ping extends \Zotlabs\Web\Controller {
|
|||
);
|
||||
break;
|
||||
case 'all_events':
|
||||
$r = q("update event set `dismissed` = 1 where `dismissed` = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
|
||||
$r = q("update event set dismissed = 1 where dismissed = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
|
||||
intval(local_channel()),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
|
||||
|
@ -325,9 +325,9 @@ class Ping extends \Zotlabs\Web\Controller {
|
|||
$result = array();
|
||||
|
||||
$r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash
|
||||
WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0
|
||||
WHERE event.uid = %d AND dtstart < '%s' AND dtstart > '%s' and dismissed = 0
|
||||
and etype in ( 'event', 'birthday' )
|
||||
ORDER BY `dtstart` DESC LIMIT 1000",
|
||||
ORDER BY dtstart DESC LIMIT 1000",
|
||||
intval(local_channel()),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
|
||||
|
@ -443,10 +443,10 @@ class Ping extends \Zotlabs\Web\Controller {
|
|||
$t5 = dba_timer();
|
||||
|
||||
if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) {
|
||||
$events = q("SELECT etype, dtstart, adjust FROM `event`
|
||||
WHERE `event`.`uid` = %d AND dtstart < '%s' AND dtstart > '%s' and `dismissed` = 0
|
||||
$events = q("SELECT etype, dtstart, adjust FROM event
|
||||
WHERE event.uid = %d AND dtstart < '%s' AND dtstart > '%s' and dismissed = 0
|
||||
and etype in ( 'event', 'birthday' )
|
||||
ORDER BY `dtstart` ASC ",
|
||||
ORDER BY dtstart ASC ",
|
||||
intval(local_channel()),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
|
||||
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
|
||||
|
|
|
@ -16,7 +16,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
|
||||
if((argc() > 2) && (argv(1) === "drop") && intval(argv(2))) {
|
||||
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is_default` = 0 LIMIT 1",
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d AND is_default = 0 LIMIT 1",
|
||||
intval(argv(2)),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
dbesc($profile_guid),
|
||||
intval(local_channel())
|
||||
);
|
||||
$r = q("DELETE FROM `profile` WHERE `id` = %d AND `uid` = %d",
|
||||
$r = q("DELETE FROM profile WHERE id = %d AND uid = %d",
|
||||
intval(argv(2)),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -61,16 +61,16 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
// check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
|
||||
|
||||
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
|
||||
$r0 = q("SELECT id FROM profile WHERE uid = %d",
|
||||
intval(local_channel()));
|
||||
$num_profiles = count($r0);
|
||||
|
||||
$name = t('Profile-') . ($num_profiles + 1);
|
||||
|
||||
$r1 = q("SELECT `fullname`, `photo`, `thumb` FROM `profile` WHERE `uid` = %d AND `is_default` = 1 LIMIT 1",
|
||||
$r1 = q("SELECT fullname, photo, thumb FROM profile WHERE uid = %d AND is_default = 1 LIMIT 1",
|
||||
intval(local_channel()));
|
||||
|
||||
$r2 = q("INSERT INTO `profile` (`aid`, `uid` , `profile_guid`, `profile_name` , `fullname`, `photo`, `thumb`)
|
||||
$r2 = q("INSERT INTO profile (aid, uid , profile_guid, profile_name , fullname, photo, thumb)
|
||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
|
||||
intval(get_account_id()),
|
||||
intval(local_channel()),
|
||||
|
@ -81,7 +81,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
dbesc($r1[0]['thumb'])
|
||||
);
|
||||
|
||||
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile_name` = '%s' LIMIT 1",
|
||||
$r3 = q("SELECT id FROM profile WHERE uid = %d AND profile_name = '%s' LIMIT 1",
|
||||
intval(local_channel()),
|
||||
dbesc($name)
|
||||
);
|
||||
|
@ -97,12 +97,12 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
check_form_security_token_redirectOnErr('/profiles', 'profile_clone', 't');
|
||||
|
||||
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
|
||||
$r0 = q("SELECT id FROM profile WHERE uid = %d",
|
||||
intval(local_channel()));
|
||||
$num_profiles = count($r0);
|
||||
|
||||
$name = t('Profile-') . ($num_profiles + 1);
|
||||
$r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
$r1 = q("SELECT * FROM profile WHERE uid = %d AND id = %d LIMIT 1",
|
||||
intval(local_channel()),
|
||||
intval(\App::$argv[2])
|
||||
);
|
||||
|
@ -119,13 +119,13 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
dbesc_array($r1[0]);
|
||||
|
||||
$r2 = dbq("INSERT INTO `profile` (`"
|
||||
$r2 = dbq("INSERT INTO profile (`"
|
||||
. implode("`, `", array_keys($r1[0]))
|
||||
. "`) VALUES ('"
|
||||
. implode("', '", array_values($r1[0]))
|
||||
. "')" );
|
||||
|
||||
$r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile_name` = '%s' LIMIT 1",
|
||||
$r3 = q("SELECT id FROM profile WHERE uid = %d AND profile_name = '%s' LIMIT 1",
|
||||
intval(local_channel()),
|
||||
dbesc($name)
|
||||
);
|
||||
|
@ -143,7 +143,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
if((argc() > 2) && (argv(1) === 'export')) {
|
||||
|
||||
$r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
$r1 = q("SELECT * FROM profile WHERE uid = %d AND id = %d LIMIT 1",
|
||||
intval(local_channel()),
|
||||
intval(argv(2))
|
||||
);
|
||||
|
@ -181,7 +181,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
if($x)
|
||||
$id = $x[0]['id'];
|
||||
}
|
||||
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($id),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -238,7 +238,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
|
||||
if((argc() > 1) && (argv(1) !== "new") && intval(argv(1))) {
|
||||
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$orig = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval(\App::$argv[1]),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -484,41 +484,41 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
|
||||
}
|
||||
|
||||
$r = q("UPDATE `profile`
|
||||
SET `profile_name` = '%s',
|
||||
`fullname` = '%s',
|
||||
`pdesc` = '%s',
|
||||
`gender` = '%s',
|
||||
`dob` = '%s',
|
||||
`address` = '%s',
|
||||
`locality` = '%s',
|
||||
`region` = '%s',
|
||||
`postal_code` = '%s',
|
||||
`country_name` = '%s',
|
||||
`marital` = '%s',
|
||||
`partner` = '%s',
|
||||
`howlong` = '%s',
|
||||
`sexual` = '%s',
|
||||
`homepage` = '%s',
|
||||
`hometown` = '%s',
|
||||
`politic` = '%s',
|
||||
`religion` = '%s',
|
||||
`keywords` = '%s',
|
||||
`likes` = '%s',
|
||||
`dislikes` = '%s',
|
||||
`about` = '%s',
|
||||
`interest` = '%s',
|
||||
`contact` = '%s',
|
||||
`channels` = '%s',
|
||||
`music` = '%s',
|
||||
`book` = '%s',
|
||||
`tv` = '%s',
|
||||
`film` = '%s',
|
||||
`romance` = '%s',
|
||||
`employment` = '%s',
|
||||
`education` = '%s',
|
||||
`hide_friends` = %d
|
||||
WHERE `id` = %d AND `uid` = %d",
|
||||
$r = q("UPDATE profile
|
||||
SET profile_name = '%s',
|
||||
fullname = '%s',
|
||||
pdesc = '%s',
|
||||
gender = '%s',
|
||||
dob = '%s',
|
||||
address = '%s',
|
||||
locality = '%s',
|
||||
region = '%s',
|
||||
postal_code = '%s',
|
||||
country_name = '%s',
|
||||
marital = '%s',
|
||||
partner = '%s',
|
||||
howlong = '%s',
|
||||
sexual = '%s',
|
||||
homepage = '%s',
|
||||
hometown = '%s',
|
||||
politic = '%s',
|
||||
religion = '%s',
|
||||
keywords = '%s',
|
||||
likes = '%s',
|
||||
dislikes = '%s',
|
||||
about = '%s',
|
||||
interest = '%s',
|
||||
contact = '%s',
|
||||
channels = '%s',
|
||||
music = '%s',
|
||||
book = '%s',
|
||||
tv = '%s',
|
||||
film = '%s',
|
||||
romance = '%s',
|
||||
employment = '%s',
|
||||
education = '%s',
|
||||
hide_friends = %d
|
||||
WHERE id = %d AND uid = %d",
|
||||
dbesc($profile_name),
|
||||
dbesc($name),
|
||||
dbesc($pdesc),
|
||||
|
@ -617,7 +617,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
if($x)
|
||||
$id = $x[0]['id'];
|
||||
}
|
||||
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($id),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -755,7 +755,7 @@ class Profiles extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
else {
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
|
||||
$r = q("SELECT * FROM profile WHERE uid = %d",
|
||||
local_channel());
|
||||
if($r) {
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class Search extends \Zotlabs\Web\Controller {
|
|||
return $o;
|
||||
|
||||
if($tag) {
|
||||
$sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and ttype in ( %d , %d) and term = '%s') ",
|
||||
$sql_extra = sprintf(" AND item.id IN (select oid from term where otype = %d and ttype in ( %d , %d) and term = '%s') ",
|
||||
intval(TERM_OBJ_POST),
|
||||
intval(TERM_HASHTAG),
|
||||
intval(TERM_COMMUNITYTAG),
|
||||
|
@ -88,7 +88,7 @@ class Search extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
else {
|
||||
$regstr = db_getfunc('REGEXP');
|
||||
$sql_extra = sprintf(" AND `item`.`body` $regstr '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||
$sql_extra = sprintf(" AND item.body $regstr '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||
}
|
||||
|
||||
// Here is the way permissions work in the search module...
|
||||
|
@ -165,8 +165,8 @@ class Search extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
if(local_channel()) {
|
||||
$r = q("SELECT $prefix mid, item.id as item_id, item.* from item
|
||||
WHERE ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 )
|
||||
OR ( `item`.`uid` = %d )) OR item.owner_xchan = '%s' )
|
||||
WHERE ((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 )
|
||||
OR ( item.uid = %d )) OR item.owner_xchan = '%s' )
|
||||
$item_normal
|
||||
$sql_extra
|
||||
$suffix $pager_sql ",
|
||||
|
@ -176,8 +176,8 @@ class Search extends \Zotlabs\Web\Controller {
|
|||
}
|
||||
if($r === null) {
|
||||
$r = q("SELECT $prefix mid, item.id as item_id, item.* from item
|
||||
WHERE (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = ''
|
||||
AND `item`.`deny_gid` = '' AND item_private = 0 )
|
||||
WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and owner_xchan in ( " . stream_perms_xchans(($observer) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
$pub_sql ) OR owner_xchan = '%s')
|
||||
$item_normal
|
||||
|
|
|
@ -18,7 +18,7 @@ class Tagrm extends \Zotlabs\Web\Controller {
|
|||
$tag = ((x($_POST,'tag')) ? trim($_POST['tag']) : '');
|
||||
$item = ((x($_POST,'item')) ? intval($_POST['item']) : 0 );
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($item),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -67,7 +67,7 @@ class Tagrm extends \Zotlabs\Web\Controller {
|
|||
$item = intval(argv(2));
|
||||
$tag = argv(3);
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($item),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
@ -107,7 +107,7 @@ class Tagrm extends \Zotlabs\Web\Controller {
|
|||
|
||||
$item = intval(argv(2));
|
||||
|
||||
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$r = q("SELECT * FROM item WHERE id = %d AND uid = %d LIMIT 1",
|
||||
intval($item),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
|
|
@ -18,13 +18,13 @@ class SessionHandler implements \SessionHandlerInterface {
|
|||
function read ($id) {
|
||||
|
||||
if($id) {
|
||||
$r = q("SELECT `sess_data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
|
||||
$r = q("SELECT sess_data FROM session WHERE sid= '%s'", dbesc($id));
|
||||
|
||||
if($r) {
|
||||
return $r[0]['sess_data'];
|
||||
}
|
||||
else {
|
||||
q("INSERT INTO `session` (sess_data, sid, expire) values ('%s', '%s', '%s')",
|
||||
q("INSERT INTO session (sess_data, sid, expire) values ('%s', '%s', '%s')",
|
||||
dbesc(''),
|
||||
dbesc($id),
|
||||
dbesc(time() + 300)
|
||||
|
@ -59,8 +59,8 @@ class SessionHandler implements \SessionHandlerInterface {
|
|||
$expire = time() + (60 * 60 * 24 * 1);
|
||||
}
|
||||
|
||||
q("UPDATE `session`
|
||||
SET `sess_data` = '%s', `expire` = '%s' WHERE `sid` = '%s'",
|
||||
q("UPDATE session
|
||||
SET sess_data = '%s', expire = '%s' WHERE sid = '%s'",
|
||||
dbesc($data),
|
||||
dbesc($expire),
|
||||
dbesc($id)
|
||||
|
@ -76,7 +76,7 @@ class SessionHandler implements \SessionHandlerInterface {
|
|||
|
||||
|
||||
function destroy ($id) {
|
||||
q("DELETE FROM `session` WHERE `sid` = '%s'", dbesc($id));
|
||||
q("DELETE FROM session WHERE sid = '%s'", dbesc($id));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue