separate objs/things from taxonomy
This commit is contained in:
parent
1447499776
commit
3852b5ce7f
2
boot.php
2
boot.php
@ -50,7 +50,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
|
|||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H');
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1149 );
|
define ( 'DB_UPDATE_VERSION', 1150 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
@ -1,17 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
|
||||||
cli_startup();
|
|
||||||
|
|
||||||
require_once('mod/help.php');
|
function importdoc_run($argv, $argc){
|
||||||
|
|
||||||
|
cli_startup();
|
||||||
|
|
||||||
|
require_once('mod/help.php');
|
||||||
|
|
||||||
|
|
||||||
|
update_docs_dir('doc/*');
|
||||||
|
|
||||||
|
}
|
||||||
|
if (array_search(__file__,get_included_files())===0){
|
||||||
|
importdoc_run($argv,$argc);
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
function update_docs_dir($s) {
|
function update_docs_dir($s) {
|
||||||
$f = basename($s);
|
$f = basename($s);
|
||||||
$d = dirname($s);
|
$d = dirname($s);
|
||||||
if($s === 'doc/html')
|
if($s === 'doc/html')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$files = glob("$d/$f");
|
$files = glob("$d/$f");
|
||||||
if($files) {
|
if($files) {
|
||||||
foreach($files as $fi) {
|
foreach($files as $fi) {
|
||||||
@ -25,7 +38,4 @@ function update_docs_dir($s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_docs_dir('doc/*');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ function get_things($profile_hash,$uid) {
|
|||||||
|
|
||||||
$sql_extra = (($profile_hash) ? " and obj_page = '" . $profile_hash . "' " : '');
|
$sql_extra = (($profile_hash) ? " and obj_page = '" . $profile_hash . "' " : '');
|
||||||
|
|
||||||
$r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and uid = %d and obj_type = %d $sql_extra order by obj_verb, term",
|
$r = q("select * from obj where obj_channel = %d and obj_type = %d $sql_extra order by obj_verb, obj_term",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval(TERM_OBJ_THING)
|
intval(TERM_OBJ_THING)
|
||||||
);
|
);
|
||||||
@ -357,8 +357,8 @@ function get_things($profile_hash,$uid) {
|
|||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$rr['profile_name'] = '';
|
$rr['profile_name'] = '';
|
||||||
if(! in_array($rr['term_hash'],$profile_hashes))
|
if(! in_array($rr['obj_obj'],$profile_hashes))
|
||||||
$profile_hashes[] = $rr['term_hash'];
|
$profile_hashes[] = $rr['obj_obj'];
|
||||||
}
|
}
|
||||||
stringify_array_elms($profile_hashes);
|
stringify_array_elms($profile_hashes);
|
||||||
if(! $profile_hash) {
|
if(! $profile_hash) {
|
||||||
@ -390,7 +390,7 @@ function get_things($profile_hash,$uid) {
|
|||||||
$l = q("select xchan_name, xchan_url from likes left join xchan on likee = xchan_hash where
|
$l = q("select xchan_name, xchan_url from likes left join xchan on likee = xchan_hash where
|
||||||
target_type = '%s' and target_id = '%s' and channel_id = %d",
|
target_type = '%s' and target_id = '%s' and channel_id = %d",
|
||||||
dbesc(ACTIVITY_OBJ_THING),
|
dbesc(ACTIVITY_OBJ_THING),
|
||||||
dbesc($rr['term_hash']),
|
dbesc($rr['obj_obj']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ function get_things($profile_hash,$uid) {
|
|||||||
if(! $things[$rr['obj_verb']])
|
if(! $things[$rr['obj_verb']])
|
||||||
$things[$rr['obj_verb']] = array();
|
$things[$rr['obj_verb']] = array();
|
||||||
|
|
||||||
$things[$rr['obj_verb']][] = array('term' => $rr['term'],'url' => $rr['url'],'img' => $rr['imgurl'], 'profile' => $rr['profile_name'],'term_hash' => $rr['term_hash'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
|
$things[$rr['obj_verb']][] = array('term' => $rr['obj_term'],'url' => $rr['obj_url'],'img' => $rr['obj_imgurl'], 'profile' => $rr['profile_name'],'term_hash' => $rr['obj_obj'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
|
||||||
}
|
}
|
||||||
$sorted_things = array();
|
$sorted_things = array();
|
||||||
if($things) {
|
if($things) {
|
||||||
|
@ -823,6 +823,11 @@ CREATE TABLE IF NOT EXISTS `obj` (
|
|||||||
`obj_type` int(10) unsigned NOT NULL DEFAULT '0',
|
`obj_type` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`obj_obj` char(255) NOT NULL DEFAULT '',
|
`obj_obj` char(255) NOT NULL DEFAULT '',
|
||||||
`obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
|
`obj_channel` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`obj_term` char(255) NOT NULL DEFAULT '',
|
||||||
|
`obj_url` char(255) NOT NULL DEFAULT '',
|
||||||
|
`obj_imgurl` char(255) NOT NULL DEFAULT '',
|
||||||
|
`obj_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`obj_edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`allow_cid` mediumtext NOT NULL,
|
`allow_cid` mediumtext NOT NULL,
|
||||||
`allow_gid` mediumtext NOT NULL,
|
`allow_gid` mediumtext NOT NULL,
|
||||||
`deny_cid` mediumtext NOT NULL,
|
`deny_cid` mediumtext NOT NULL,
|
||||||
@ -832,6 +837,11 @@ CREATE TABLE IF NOT EXISTS `obj` (
|
|||||||
KEY `obj_page` (`obj_page`),
|
KEY `obj_page` (`obj_page`),
|
||||||
KEY `obj_type` (`obj_type`),
|
KEY `obj_type` (`obj_type`),
|
||||||
KEY `obj_channel` (`obj_channel`),
|
KEY `obj_channel` (`obj_channel`),
|
||||||
|
KEY `obj_term` (`obj_term`),
|
||||||
|
KEY `obj_url` (`obj_url`),
|
||||||
|
KEY `obj_imgurl` (`obj_imgurl`),
|
||||||
|
KEY `obj_created` (`obj_created`),
|
||||||
|
KEY `obj_edited` (`obj_edited`),
|
||||||
KEY `obj_obj` (`obj_obj`)
|
KEY `obj_obj` (`obj_obj`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -812,6 +812,11 @@ CREATE TABLE "obj" (
|
|||||||
"obj_type" bigint NOT NULL DEFAULT '0',
|
"obj_type" bigint NOT NULL DEFAULT '0',
|
||||||
"obj_obj" text NOT NULL DEFAULT '',
|
"obj_obj" text NOT NULL DEFAULT '',
|
||||||
"obj_channel" bigint NOT NULL DEFAULT '0',
|
"obj_channel" bigint NOT NULL DEFAULT '0',
|
||||||
|
"obj_term" char(255) NOT NULL DEFAULT '',
|
||||||
|
"obj_url" char(255) NOT NULL DEFAULT '',
|
||||||
|
"obj_imgurl" char(255) NOT NULL DEFAULT '',
|
||||||
|
"obj_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
|
"obj_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
"allow_cid" text NOT NULL,
|
"allow_cid" text NOT NULL,
|
||||||
"allow_gid" text NOT NULL,
|
"allow_gid" text NOT NULL,
|
||||||
"deny_cid" text NOT NULL,
|
"deny_cid" text NOT NULL,
|
||||||
@ -824,6 +829,11 @@ create index "obj_page" on obj ("obj_page");
|
|||||||
create index "obj_type" on obj ("obj_type");
|
create index "obj_type" on obj ("obj_type");
|
||||||
create index "obj_channel" on obj ("obj_channel");
|
create index "obj_channel" on obj ("obj_channel");
|
||||||
create index "obj_obj" on obj ("obj_obj");
|
create index "obj_obj" on obj ("obj_obj");
|
||||||
|
create index "obj_term" on obj ("obj_term");
|
||||||
|
create index "obj_url" on obj ("obj_url");
|
||||||
|
create index "obj_imgurl" on obj ("obj_imgurl");
|
||||||
|
create index "obj_created" on obj ("obj_created");
|
||||||
|
create index "obj_edited" on obj ("obj_edited");
|
||||||
|
|
||||||
CREATE TABLE "outq" (
|
CREATE TABLE "outq" (
|
||||||
"outq_hash" text NOT NULL,
|
"outq_hash" text NOT NULL,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1149 );
|
define( 'UPDATE_VERSION' , 1150 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1748,3 +1748,31 @@ function update_r1148() {
|
|||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1149() {
|
||||||
|
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
||||||
|
$r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_created timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
|
ADD obj_edited timestamp NOT NULL DEFAULT '0001-01-01 00:00:00' ");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$r1 = q("ALTER TABLE obj ADD obj_term CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_url CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_imgurl CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD obj_created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
ADD obj_edited DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
$r2 = q("create index obj_term on obj ( obj_term ) ");
|
||||||
|
$r3 = q("create index obj_url on obj ( obj_url ) ");
|
||||||
|
$r4 = q("create index obj_imgurl on obj ( obj_imgurl ) ");
|
||||||
|
$r5 = q("create index obj_created on obj ( obj_created ) ");
|
||||||
|
$r6 = q("create index obj_edited on obj ( obj_edited ) ");
|
||||||
|
$r = $r1 && $r2 && $r3 && $r4 && $r5 && $r6;
|
||||||
|
if($r)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
|
}
|
13
mod/like.php
13
mod/like.php
@ -117,8 +117,7 @@ function like_content(&$a) {
|
|||||||
}
|
}
|
||||||
elseif($obj_type == 'thing') {
|
elseif($obj_type == 'thing') {
|
||||||
|
|
||||||
$r = q("select * from obj left join term on obj_obj = term_hash where term_hash != ''
|
$r = q("select * from obj where obj_type = %d and obj_obj = '%s' limit 1",
|
||||||
and obj_type = %d and term_hash = '%s' limit 1",
|
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
dbesc(argv(2))
|
dbesc(argv(2))
|
||||||
);
|
);
|
||||||
@ -146,18 +145,18 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
$links = array();
|
$links = array();
|
||||||
$links[] = array('rel' => 'alternate', 'type' => 'text/html',
|
$links[] = array('rel' => 'alternate', 'type' => 'text/html',
|
||||||
'href' => z_root() . '/thing/' . $r[0]['term_hash']);
|
'href' => z_root() . '/thing/' . $r[0]['obj_obj']);
|
||||||
if($r[0]['imgurl'])
|
if($r[0]['imgurl'])
|
||||||
$links[] = array('rel' => 'photo', 'href' => $r[0]['imgurl']);
|
$links[] = array('rel' => 'photo', 'href' => $r[0]['obj_imgurl']);
|
||||||
|
|
||||||
$target = json_encode(array(
|
$target = json_encode(array(
|
||||||
'type' => $tgttype,
|
'type' => $tgttype,
|
||||||
'title' => $r[0]['term'],
|
'title' => $r[0]['obj_term'],
|
||||||
'id' => z_root() . '/thing/' . $r[0]['term_hash'],
|
'id' => z_root() . '/thing/' . $r[0]['obj_obj'],
|
||||||
'link' => $links
|
'link' => $links
|
||||||
));
|
));
|
||||||
|
|
||||||
$plink = '[zrl=' . z_root() . '/thing/' . $r[0]['term_hash'] . ']' . $r[0]['term'] . '[/zrl]';
|
$plink = '[zrl=' . z_root() . '/thing/' . $r[0]['obj_obj'] . ']' . $r[0]['obj_term'] . '[/zrl]';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,16 +66,16 @@ function thing_init(&$a) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if($term_hash) {
|
if($term_hash) {
|
||||||
$t = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and obj_type = %d and term_hash = '%s' limit 1",
|
$t = q("select * from obj where obj_obj = '%s' and obj_channel = %d limit 1",
|
||||||
intval(TERM_OBJ_THING),
|
dbesc($term_hash),
|
||||||
dbesc($term_hash)
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
if(! $t) {
|
if(! $t) {
|
||||||
notice( t('Item not found.') . EOL);
|
notice( t('Item not found.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$orig_record = $t[0];
|
$orig_record = $t[0];
|
||||||
if($photo != $orig_record['imgurl']) {
|
if($photo != $orig_record['obj_imgurl']) {
|
||||||
$arr = import_profile_photo($photo,get_observer_hash(),true);
|
$arr = import_profile_photo($photo,get_observer_hash(),true);
|
||||||
$local_photo = $arr[0];
|
$local_photo = $arr[0];
|
||||||
$local_photo_type = $arr[3];
|
$local_photo_type = $arr[3];
|
||||||
@ -83,10 +83,11 @@ function thing_init(&$a) {
|
|||||||
else
|
else
|
||||||
$local_photo = $orig_record['imgurl'];
|
$local_photo = $orig_record['imgurl'];
|
||||||
|
|
||||||
$r = q("update term set term = '%s', url = '%s', imgurl = '%s' where term_hash = '%s' and uid = %d",
|
$r = q("update obj set obj_term = '%s', obj_url = '%s', obj_imgurl = '%s', obj_edited = '%s' where obj_obj = '%s' and uid = %d",
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc(($url) ? $url : z_root() . '/thing/' . $term_hash),
|
dbesc(($url) ? $url : z_root() . '/thing/' . $term_hash),
|
||||||
dbesc($local_photo),
|
dbesc($local_photo),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
dbesc($term_hash),
|
dbesc($term_hash),
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
@ -113,10 +114,9 @@ function thing_init(&$a) {
|
|||||||
$local_photo_type = $arr[3];
|
$local_photo_type = $arr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from term where uid = %d and otype = %d and type = %d and term = '%s' limit 1",
|
$r = q("select * from obj where obj_channel = %d and obj_type = %d and obj_term = '%s' limit 1",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
intval(TERM_THING),
|
|
||||||
dbesc($name)
|
dbesc($name)
|
||||||
);
|
);
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
@ -139,14 +139,21 @@ function thing_init(&$a) {
|
|||||||
dbesc($name)
|
dbesc($name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$term = $r[0];
|
|
||||||
|
|
||||||
$r = q("insert into obj ( obj_page, obj_verb, obj_type, obj_channel, obj_obj) values ('%s','%s', %d, %d, '%s') ",
|
$created = datetime_convert();
|
||||||
|
$url = (($url) ? $url : z_root() . '/thing/' . $hash);
|
||||||
|
|
||||||
|
$r = q("insert into obj ( obj_page, obj_verb, obj_type, obj_channel, obj_obj, obj_term, obj_url, obj_imgurl, obj_created, obj_edited ) values ('%s','%s', %d, %d, '%s','%s','%s','%s','%s','%s') ",
|
||||||
dbesc($profile['profile_guid']),
|
dbesc($profile['profile_guid']),
|
||||||
dbesc($verb),
|
dbesc($verb),
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($term['term_hash'])
|
dbesc($hash),
|
||||||
|
dbesc($name),
|
||||||
|
dbesc($url),
|
||||||
|
dbesc(($photo) ? $local_photo : ''),
|
||||||
|
dbesc($created),
|
||||||
|
dbesc($created)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
@ -155,10 +162,10 @@ function thing_init(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info( t('Thing added'));
|
info( t('Thing added'));
|
||||||
|
|
||||||
if($activity) {
|
if($activity) {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $term['url']));
|
$links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $url));
|
||||||
if($local_photo)
|
if($local_photo)
|
||||||
$links[] = array('rel' => 'photo', 'type' => $local_photo_type, 'href' => $local_photo);
|
$links[] = array('rel' => 'photo', 'type' => $local_photo_type, 'href' => $local_photo);
|
||||||
|
|
||||||
@ -166,10 +173,10 @@ function thing_init(&$a) {
|
|||||||
|
|
||||||
$obj = json_encode(array(
|
$obj = json_encode(array(
|
||||||
'type' => $objtype,
|
'type' => $objtype,
|
||||||
'id' => $term['url'],
|
'id' => $url,
|
||||||
'link' => $links,
|
'link' => $links,
|
||||||
'title' => $term['term'],
|
'title' => $name,
|
||||||
'content' => $term['term']
|
'content' => $name
|
||||||
));
|
));
|
||||||
|
|
||||||
$bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
|
$bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
|
||||||
@ -182,7 +189,7 @@ function thing_init(&$a) {
|
|||||||
$arr['item_thread_top'] = 1;
|
$arr['item_thread_top'] = 1;
|
||||||
|
|
||||||
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
|
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
|
||||||
$plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';
|
$plink = '[zrl=' . $url . ']' . $name . '[/zrl]';
|
||||||
|
|
||||||
$arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
|
$arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
|
||||||
|
|
||||||
@ -218,7 +225,7 @@ function thing_content(&$a) {
|
|||||||
|
|
||||||
if(argc() == 2) {
|
if(argc() == 2) {
|
||||||
|
|
||||||
$r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and obj_type = %d and term_hash = '%s' limit 1",
|
$r = q("select * from obj where obj_type = %d and obj_obj = '%s' limit 1",
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
dbesc(argv(1))
|
dbesc(argv(1))
|
||||||
);
|
);
|
||||||
@ -249,7 +256,7 @@ function thing_content(&$a) {
|
|||||||
if(argc() == 3 && argv(1) === 'edit') {
|
if(argc() == 3 && argv(1) === 'edit') {
|
||||||
$thing_hash = argv(2);
|
$thing_hash = argv(2);
|
||||||
|
|
||||||
$r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and obj_type = %d and term_hash = '%s' limit 1",
|
$r = q("select * from obj where obj_type = %d and obj_obj = '%s' limit 1",
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
dbesc($thing_hash)
|
dbesc($thing_hash)
|
||||||
);
|
);
|
||||||
@ -269,11 +276,11 @@ function thing_content(&$a) {
|
|||||||
'$activity' => array('activity',t('Post an activity'),true,t('Only sends to viewers of the applicable profile')),
|
'$activity' => array('activity',t('Post an activity'),true,t('Only sends to viewers of the applicable profile')),
|
||||||
'$thing_hash' => $thing_hash,
|
'$thing_hash' => $thing_hash,
|
||||||
'$thing_lbl' => t('Name of thing e.g. something'),
|
'$thing_lbl' => t('Name of thing e.g. something'),
|
||||||
'$thething' => $r[0]['term'],
|
'$thething' => $r[0]['obj_term'],
|
||||||
'$url_lbl' => t('URL of thing (optional)'),
|
'$url_lbl' => t('URL of thing (optional)'),
|
||||||
'$theurl' => $r[0]['url'],
|
'$theurl' => $r[0]['obj_url'],
|
||||||
'$img_lbl' => t('URL for photo of thing (optional)'),
|
'$img_lbl' => t('URL for photo of thing (optional)'),
|
||||||
'$imgurl' => $r[0]['imgurl'],
|
'$imgurl' => $r[0]['obj_imgurl'],
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit')
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -283,7 +290,7 @@ function thing_content(&$a) {
|
|||||||
if(argc() == 3 && argv(1) === 'drop') {
|
if(argc() == 3 && argv(1) === 'drop') {
|
||||||
$thing_hash = argv(2);
|
$thing_hash = argv(2);
|
||||||
|
|
||||||
$r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and obj_type = %d and term_hash = '%s' limit 1",
|
$r = q("select * from obj where obj_type = %d and obj_obj = '%s' limit 1",
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
dbesc($thing_hash)
|
dbesc($thing_hash)
|
||||||
);
|
);
|
||||||
@ -298,10 +305,6 @@ function thing_content(&$a) {
|
|||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
$x = q("delete from term where term_hash = '%s' and uid = %d",
|
|
||||||
dbesc($thing_hash),
|
|
||||||
intval(local_channel())
|
|
||||||
);
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<h2>{{$header}}</h2>
|
<h2>{{$header}}</h2>
|
||||||
{{if $thing}}
|
{{if $thing}}
|
||||||
<div class="thing-show">
|
<div class="thing-show">
|
||||||
{{if $thing.imgurl}}<img src="{{$thing.imgurl}}" width="175" height="175" alt="{{$thing.term}}" />{{/if}}
|
{{if $thing.obj_imgurl}}<img src="{{$thing.obj_imgurl}}" width="175" height="175" alt="{{$thing.obj_term}}" />{{/if}}
|
||||||
<a href="{{$thing.url}}" >{{$thing.term}}</a>
|
<a href="{{$thing.obj_url}}" >{{$thing.obj_term}}</a>
|
||||||
</div>
|
</div>
|
||||||
{{if $canedit}}
|
{{if $canedit}}
|
||||||
<div class="thing-edit-links">
|
<div class="thing-edit-links">
|
||||||
<a href="thing/edit/{{$thing.term_hash}}" title="{{$edit}}" class="btn btn-default" ><i class="icon-pencil thing-edit-icon"></i></a>
|
<a href="thing/edit/{{$thing.obj_obj}}" title="{{$edit}}" class="btn btn-default" ><i class="icon-pencil thing-edit-icon"></i></a>
|
||||||
<a href="thing/drop/{{$thing.term_hash}}" onclick="return confirmDelete();" title="{{$delete}}" class="btn btn-default" ><i class="icon-trash drop-icons"></i></a>
|
<a href="thing/drop/{{$thing.obj_obj}}" onclick="return confirmDelete();" title="{{$delete}}" class="btn btn-default" ><i class="icon-trash drop-icons"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="thing-edit-links-end"></div>
|
<div class="thing-edit-links-end"></div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
Reference in New Issue
Block a user