remove a couple of mysql reserved words from being used as table or row names. For this round we're getting 'group' and 'desc'. Warning: potentially destabilising as this touches a lot of code.

This commit is contained in:
friendica 2013-12-22 18:37:39 -08:00
parent eff38538ee
commit 1a42580ad4
20 changed files with 73 additions and 60 deletions

View File

@ -46,7 +46,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1085 ); define ( 'DB_UPDATE_VERSION', 1086 );
define ( 'EOL', '<br />' . "\r\n" ); define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -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 `group_member` WHERE `uid` = %d", intval($channel_id));
q("DELETE FROM `event` 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)); q("DELETE FROM `item` WHERE `uid` = %d", intval($channel_id));

View File

@ -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"; $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()) intval(local_user())
); );

View File

@ -15,7 +15,7 @@ function format_event_html($ev) {
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n"; $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="' $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' )) . 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']) if($ev['summary'])
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]'; $o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
if($ev['desc']) if($ev['description'])
$o .= '[event-description]' . $ev['desc'] . '[/event-description]'; $o .= '[event-description]' . $ev['description'] . '[/event-description]';
if($ev['start']) if($ev['start'])
$o .= '[event-start]' . $ev['start'] . '[/event-start]'; $o .= '[event-start]' . $ev['start'] . '[/event-start]';
@ -75,7 +75,7 @@ function format_event_bbcode($ev) {
function bbtovcal($s) { function bbtovcal($s) {
$o = ''; $o = '';
$ev = bbtoevent($s); $ev = bbtoevent($s);
if($ev['desc']) if($ev['description'])
$o = format_event_html($ev); $o = format_event_html($ev);
return $o; return $o;
} }
@ -90,7 +90,7 @@ function bbtoevent($s) {
$ev['summary'] = $match[1]; $ev['summary'] = $match[1];
$match = ''; $match = '';
if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match)) if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
$ev['desc'] = $match[1]; $ev['description'] = $match[1];
$match = ''; $match = '';
if(preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is",$s,$match)) if(preg_match("/\[event\-start\](.*?)\[\/event\-start\]/is",$s,$match))
$ev['start'] = $match[1]; $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']); $date_b = (($b['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$b['start']) : $b['start']);
if($date_a === $date_b) if($date_a === $date_b)
return strcasecmp($a['desc'],$b['desc']); return strcasecmp($a['description'],$b['description']);
return strcmp($date_a,$date_b); return strcmp($date_a,$date_b);
} }
@ -178,7 +178,7 @@ function event_store($arr) {
`start` = '%s', `start` = '%s',
`finish` = '%s', `finish` = '%s',
`summary` = '%s', `summary` = '%s',
`desc` = '%s', `description` = '%s',
`location` = '%s', `location` = '%s',
`type` = '%s', `type` = '%s',
`adjust` = %d, `adjust` = %d,
@ -193,7 +193,7 @@ function event_store($arr) {
dbesc($arr['start']), dbesc($arr['start']),
dbesc($arr['finish']), dbesc($arr['finish']),
dbesc($arr['summary']), dbesc($arr['summary']),
dbesc($arr['desc']), dbesc($arr['description']),
dbesc($arr['location']), dbesc($arr['location']),
dbesc($arr['type']), dbesc($arr['type']),
intval($arr['adjust']), intval($arr['adjust']),
@ -266,7 +266,7 @@ function event_store($arr) {
$arr['mid'] = item_message_id(); $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) 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' ) ", VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']), intval($arr['uid']),
@ -278,7 +278,7 @@ function event_store($arr) {
dbesc($arr['start']), dbesc($arr['start']),
dbesc($arr['finish']), dbesc($arr['finish']),
dbesc($arr['summary']), dbesc($arr['summary']),
dbesc($arr['desc']), dbesc($arr['description']),
dbesc($arr['location']), dbesc($arr['location']),
dbesc($arr['type']), dbesc($arr['type']),
intval($arr['adjust']), intval($arr['adjust']),

View File

@ -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 // 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. // 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) intval($r)
); );
if(count($z) && $z[0]['deleted']) { 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -31,13 +31,13 @@ function group_add($uid,$name,$public = 0) {
$dups = false; $dups = false;
$hash = random_string() . $name; $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) if($r)
$dups = true; $dups = true;
} while($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' ) ", VALUES( '%s', %d, %d, '%s' ) ",
dbesc($hash), dbesc($hash),
intval($uid), intval($uid),
@ -53,7 +53,7 @@ function group_add($uid,$name,$public = 0) {
function group_rmv($uid,$name) { function group_rmv($uid,$name) {
$ret = false; $ret = false;
if(x($uid) && x($name)) { 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -104,7 +104,7 @@ function group_rmv($uid,$name) {
); );
// remove group // 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -119,7 +119,7 @@ function group_rmv($uid,$name) {
function group_byname($uid,$name) { function group_byname($uid,$name) {
if((! $uid) || (! strlen($name))) if((! $uid) || (! strlen($name)))
return false; 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), intval($uid),
dbesc($name) dbesc($name)
); );
@ -132,7 +132,7 @@ function group_byname($uid,$name) {
function group_rec_byhash($uid,$hash) { function group_rec_byhash($uid,$hash) {
if((! $uid) || (! strlen($hash))) if((! $uid) || (! strlen($hash)))
return false; 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), intval($uid),
dbesc($hash) dbesc($hash)
); );
@ -207,7 +207,7 @@ function mini_group_select($uid,$group = '') {
$grps = array(); $grps = array();
$o = ''; $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) intval($uid)
); );
$grps[] = array('name' => '', 'hash' => '0', 'selected' => ''); $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']) intval($_SESSION['uid'])
); );
$member_of = array(); $member_of = array();
@ -302,7 +302,7 @@ function expand_groups($a) {
$groups = implode(',', $x); $groups = implode(',', $x);
if($groups) 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(); $ret = array();
if($r) if($r)
@ -314,7 +314,7 @@ function expand_groups($a) {
function member_of($c) { 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) dbesc($c)
); );

View File

@ -408,7 +408,7 @@ function identity_basic_export($channel_id) {
$ret['hubloc'] = $r; $ret['hubloc'] = $r;
} }
$r = q("select * from `group` where uid = %d ", $r = q("select * from `groups` where uid = %d ",
intval($channel_id) intval($channel_id)
); );

View File

@ -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 ) "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) ";
if($arr['gid'] && $uid) { 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($arr['group']),
intval($uid) intval($uid)
); );

View File

@ -319,7 +319,7 @@ function photos_list_photos($channel,$observer,$album = '') {
$ret = array('success' => false); $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($channel_id),
intval(PHOTO_NORMAL), intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE) intval(PHOTO_PROFILE)

View File

@ -386,7 +386,7 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f
if(! function_exists('init_groups_visitor')) { if(! function_exists('init_groups_visitor')) {
function init_groups_visitor($contact_id) { function init_groups_visitor($contact_id) {
$groups = array(); $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) dbesc($contact_id)
); );
if(count($r)) { if(count($r)) {

View File

@ -240,7 +240,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`start` datetime NOT NULL, `start` datetime NOT NULL,
`finish` datetime NOT NULL, `finish` datetime NOT NULL,
`summary` text NOT NULL, `summary` text NOT NULL,
`desc` text NOT NULL, `description` text NOT NULL,
`location` text NOT NULL, `location` text NOT NULL,
`type` char(255) NOT NULL, `type` char(255) NOT NULL,
`nofinish` tinyint(1) NOT NULL DEFAULT '0', `nofinish` tinyint(1) NOT NULL DEFAULT '0',
@ -319,7 +319,7 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `group` ( CREATE TABLE IF NOT EXISTS `groups` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hash` char(255) NOT NULL DEFAULT '', `hash` char(255) NOT NULL DEFAULT '',
`uid` int(10) unsigned NOT NULL, `uid` int(10) unsigned NOT NULL,
@ -639,7 +639,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
`created` datetime NOT NULL, `created` datetime NOT NULL,
`edited` datetime NOT NULL, `edited` datetime NOT NULL,
`title` char(255) NOT NULL, `title` char(255) NOT NULL,
`desc` text NOT NULL, `description` text NOT NULL,
`album` char(255) NOT NULL, `album` char(255) NOT NULL,
`filename` char(255) NOT NULL, `filename` char(255) NOT NULL,
`type` char(128) NOT NULL DEFAULT 'image/jpeg', `type` char(128) NOT NULL DEFAULT 'image/jpeg',

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1085 ); define( 'UPDATE_VERSION' , 1086 );
/** /**
* *
@ -935,3 +935,16 @@ function update_r1084() {
return UPDATE_FAILED; return UPDATE_FAILED;
} }
function update_r1085() {
$r1 = q("ALTER TABLE `photo` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
$r2 = q("RENAME TABLE `group` TO `groups`");
$r3 = q("ALTER TABLE `event` CHANGE `desc` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ");
if($r1 && $r2 && $r3)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -39,7 +39,7 @@ function acl_init(&$a){
// count groups and contacts // count groups and contacts
if ($type=='' || $type=='g'){ if ($type=='' || $type=='g'){
$r = q("SELECT COUNT(`id`) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra", $r = q("SELECT COUNT(`id`) AS g FROM `groups` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
intval(local_user()) intval(local_user())
); );
$group_count = (int)$r[0]['g']; $group_count = (int)$r[0]['g'];
@ -94,14 +94,14 @@ function acl_init(&$a){
if ($type=='' || $type=='g'){ if ($type=='' || $type=='g'){
$r = q("SELECT `group`.`id`, `group`.`hash`, `group`.`name`, $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`,
GROUP_CONCAT(DISTINCT `group_member`.`xchan` SEPARATOR ',') as uids GROUP_CONCAT(DISTINCT `group_member`.`xchan` SEPARATOR ',') as uids
FROM `group`,`group_member` FROM `groups`,`group_member`
WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
AND `group_member`.`gid`=`group`.`id` AND `group_member`.`gid`=`groups`.`id`
$sql_extra $sql_extra
GROUP BY `group`.`id` GROUP BY `groups`.`id`
ORDER BY `group`.`name` ORDER BY `groups`.`name`
LIMIT %d,%d", LIMIT %d,%d",
intval(local_user()), intval(local_user()),
intval($start), intval($start),

View File

@ -20,7 +20,7 @@ function contactgroup_content(&$a) {
if((argc() > 1) && (intval(argv(1)))) { if((argc() > 1) && (intval(argv(1)))) {
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", $r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval(argv(1)), intval(argv(1)),
intval(local_user()) intval(local_user())
); );

View File

@ -108,7 +108,7 @@ function events_post(&$a) {
$datarray['start'] = $start; $datarray['start'] = $start;
$datarray['finish'] = $finish; $datarray['finish'] = $finish;
$datarray['summary'] = $summary; $datarray['summary'] = $summary;
$datarray['desc'] = $desc; $datarray['description'] = $desc;
$datarray['location'] = $location; $datarray['location'] = $location;
$datarray['type'] = $type; $datarray['type'] = $type;
$datarray['adjust'] = $adjust; $datarray['adjust'] = $adjust;

View File

@ -45,7 +45,7 @@ function fbrowser_content($a){
$path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album); $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album);
} }
$r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc` $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description`
FROM `photo` WHERE `uid` = %d $sql_extra FROM `photo` WHERE `uid` = %d $sql_extra
GROUP BY `resource_id` $sql_extra2", GROUP BY `resource_id` $sql_extra2",
intval(local_user()) intval(local_user())

View File

@ -30,7 +30,7 @@ function group_post(&$a) {
if((argc() == 2) && (intval(argv(1)))) { if((argc() == 2) && (intval(argv(1)))) {
check_form_security_token_redirectOnErr('/group', 'group_edit'); check_form_security_token_redirectOnErr('/group', 'group_edit');
$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(argv(1)), intval(argv(1)),
intval(local_user()) intval(local_user())
); );
@ -44,7 +44,7 @@ function group_post(&$a) {
$public = intval($_POST['public']); $public = intval($_POST['public']);
if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) { if((strlen($groupname)) && (($groupname != $group['name']) || ($public != $group['visible']))) {
$r = q("UPDATE `group` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d LIMIT 1", $r = q("UPDATE `groups` SET `name` = '%s', visible = %d WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc($groupname), dbesc($groupname),
intval($public), intval($public),
intval(local_user()), intval(local_user()),
@ -97,7 +97,7 @@ function group_content(&$a) {
check_form_security_token_redirectOnErr('/group', 'group_drop', 't'); check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
if(intval(argv(2))) { if(intval(argv(2))) {
$r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `name` FROM `groups` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(argv(2)), intval(argv(2)),
intval(local_user()) intval(local_user())
); );
@ -132,7 +132,7 @@ function group_content(&$a) {
if((argc() > 1) && (intval(argv(1)))) { if((argc() > 1) && (intval(argv(1)))) {
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", $r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
intval(argv(1)), intval(argv(1)),
intval(local_user()) intval(local_user())
); );

View File

@ -314,7 +314,7 @@ function import_post(&$a) {
. implode("', '", array_values($group)) . implode("', '", array_values($group))
. "')" ); . "')" );
} }
$r = q("select * from `group` where uid = %d", $r = q("select * from `groups` where uid = %d",
intval($channel['channel_id']) intval($channel['channel_id'])
); );
if($r) { if($r) {

View File

@ -49,7 +49,7 @@ function lockview_content(&$a) {
stringify_array_elms($deny_users,true); stringify_array_elms($deny_users,true);
if(count($allowed_groups)) { if(count($allowed_groups)) {
$r = q("SELECT name FROM `group` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )"); $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $allowed_groups) . " )");
if($r) if($r)
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b>' . $rr['name'] . '</b>'; $l[] = '<b>' . $rr['name'] . '</b>';
@ -61,7 +61,7 @@ function lockview_content(&$a) {
$l[] = $rr['xchan_name']; $l[] = $rr['xchan_name'];
} }
if(count($deny_groups)) { if(count($deny_groups)) {
$r = q("SELECT name FROM `group` WHERE hash IN ( " . implode(', ', $deny_groups) . " )"); $r = q("SELECT name FROM `groups` WHERE hash IN ( " . implode(', ', $deny_groups) . " )");
if($r) if($r)
foreach($r as $rr) foreach($r as $rr)
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>'; $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';

View File

@ -69,7 +69,7 @@ function network_content(&$a, $update = 0, $load = false) {
$_GET['order'] = 'post'; $_GET['order'] = 'post';
if($gid) { if($gid) {
$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($gid), intval($gid),
intval(local_user()) intval(local_user())
); );

View File

@ -281,7 +281,7 @@ function photos_post(&$a) {
); );
if(count($p)) { if(count($p)) {
$ext = $phototypes[$p[0]['type']]; $ext = $phototypes[$p[0]['type']];
$r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%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', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource_id` = '%s' AND `uid` = %d",
dbesc($desc), dbesc($desc),
dbesc($albname), dbesc($albname),
dbesc($str_contact_allow), dbesc($str_contact_allow),
@ -299,7 +299,7 @@ function photos_post(&$a) {
/* Don't make the item visible if the only change was the album name */ /* Don't make the item visible if the only change was the album name */
$visibility = 0; $visibility = 0;
if($p[0]['desc'] !== $desc || strlen($rawtags)) if($p[0]['description'] !== $desc || strlen($rawtags))
$visibility = 1; $visibility = 1;
if(! $item_id) { if(! $item_id) {
@ -507,7 +507,7 @@ function photos_post(&$a) {
$arr['object'] .= xmlify('<link rel="photo" type="'.$p[0]['type'].'" href="' . $tagged[3]['photo'] . '" />' . "\n"); $arr['object'] .= xmlify('<link rel="photo" type="'.$p[0]['type'].'" href="' . $tagged[3]['photo'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n"; $arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . ACTIVITY_OBJ_PHOTO . '</type><title>' . $p[0]['desc'] . '</title><id>' $arr['target'] = '<target><type>' . ACTIVITY_OBJ_PHOTO . '</type><title>' . $p[0]['description'] . '</title><id>'
. $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '</id>'; . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '</id>';
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>'; $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource_id'] . '" />' . "\n" . '<link rel="preview" type="'.$p[0]['type'].'" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource_id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
@ -751,7 +751,7 @@ function photos_content(&$a) {
else else
$order = 'DESC'; $order = 'DESC';
$r = q("SELECT `resource_id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s' $r = q("SELECT `resource_id`, `id`, `filename`, type, max(`scale`) AS `scale`, `description` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
AND `scale` <= 4 and (photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY `resource_id` ORDER BY `created` $order LIMIT %d , %d", AND `scale` <= 4 and (photo_flags = %d or photo_flags = %d ) $sql_extra GROUP BY `resource_id` ORDER BY `created` $order LIMIT %d , %d",
intval($owner_uid), intval($owner_uid),
dbesc($album), dbesc($album),
@ -819,11 +819,11 @@ function photos_content(&$a) {
if($a->get_template_engine() === 'internal') { if($a->get_template_engine() === 'internal') {
$imgalt_e = template_escape($rr['filename']); $imgalt_e = template_escape($rr['filename']);
$desc_e = template_escape($rr['desc']); $desc_e = template_escape($rr['description']);
} }
else { else {
$imgalt_e = $rr['filename']; $imgalt_e = $rr['filename'];
$desc_e = $rr['desc']; $desc_e = $rr['description'];
} }
@ -864,7 +864,7 @@ function photos_content(&$a) {
// fetch image, item containing image, then comments // fetch image, item containing image, then comments
$ph = q("SELECT aid,uid,xchan,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 `resource_id` = '%s' $ph = q("SELECT aid,uid,xchan,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 `resource_id` = '%s'
and (photo_flags = %d or photo_flags = %d ) $sql_extra ORDER BY `scale` ASC ", and (photo_flags = %d or photo_flags = %d ) $sql_extra ORDER BY `scale` ASC ",
intval($owner_uid), intval($owner_uid),
dbesc($datum), dbesc($datum),
@ -1020,7 +1020,7 @@ function photos_content(&$a) {
if($can_post) { if($can_post) {
$album_e = $ph[0]['album']; $album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc']; $caption_e = $ph[0]['description'];
$aclselect_e = populate_acl($ph[0]); $aclselect_e = populate_acl($ph[0]);
$edit = array( $edit = array(
@ -1190,7 +1190,7 @@ function photos_content(&$a) {
'$photo' => $photo, '$photo' => $photo,
'$prevlink' => $prevlink, '$prevlink' => $prevlink,
'$nextlink' => $nextlink, '$nextlink' => $nextlink,
'$desc' => $ph[0]['desc'], '$desc' => $ph[0]['description'],
'$tags' => $tags_e, '$tags' => $tags_e,
'$edit' => $edit, '$edit' => $edit,
'$likebuttons' => $likebuttons, '$likebuttons' => $likebuttons,