Basic ability to create "things"
This commit is contained in:
parent
230aeb782e
commit
cdc66da52f
7
boot.php
7
boot.php
@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
|
|||||||
define ( 'RED_PLATFORM', 'Red Matrix' );
|
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', 1046 );
|
define ( 'DB_UPDATE_VERSION', 1047 );
|
||||||
|
|
||||||
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' );
|
||||||
@ -322,10 +322,7 @@ define ( 'TERM_CATEGORY', 3 );
|
|||||||
define ( 'TERM_PCATEGORY', 4 );
|
define ( 'TERM_PCATEGORY', 4 );
|
||||||
define ( 'TERM_FILE', 5 );
|
define ( 'TERM_FILE', 5 );
|
||||||
define ( 'TERM_SAVEDSEARCH', 6 );
|
define ( 'TERM_SAVEDSEARCH', 6 );
|
||||||
define ( 'TERM_HAVETHING', 7 );
|
define ( 'TERM_THING', 7 );
|
||||||
define ( 'TERM_WANTTHING', 8 );
|
|
||||||
define ( 'TERM_LIKETHING', 9 );
|
|
||||||
define ( 'TERM_NOLIKETHING', 10 );
|
|
||||||
|
|
||||||
define ( 'TERM_OBJ_POST', 1 );
|
define ( 'TERM_OBJ_POST', 1 );
|
||||||
define ( 'TERM_OBJ_PHOTO', 2 );
|
define ( 'TERM_OBJ_PHOTO', 2 );
|
||||||
|
@ -829,6 +829,7 @@ CREATE TABLE IF NOT EXISTS `term` (
|
|||||||
`term` char(255) NOT NULL,
|
`term` char(255) NOT NULL,
|
||||||
`url` char(255) NOT NULL,
|
`url` char(255) NOT NULL,
|
||||||
`imgurl` char(255) NOT NULL,
|
`imgurl` char(255) NOT NULL,
|
||||||
|
`term_hash` char(255) NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY (`tid`),
|
PRIMARY KEY (`tid`),
|
||||||
KEY `oid` (`oid`),
|
KEY `oid` (`oid`),
|
||||||
KEY `otype` (`otype`),
|
KEY `otype` (`otype`),
|
||||||
@ -836,7 +837,8 @@ CREATE TABLE IF NOT EXISTS `term` (
|
|||||||
KEY `term` (`term`),
|
KEY `term` (`term`),
|
||||||
KEY `uid` (`uid`),
|
KEY `uid` (`uid`),
|
||||||
KEY `aid` (`aid`),
|
KEY `aid` (`aid`),
|
||||||
KEY `imgurl` (`imgurl`)
|
KEY `imgurl` (`imgurl`),
|
||||||
|
KEY `term_hash` (`term_hash`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tokens` (
|
CREATE TABLE IF NOT EXISTS `tokens` (
|
||||||
@ -933,7 +935,7 @@ CREATE TABLE IF NOT EXISTS `xlink` (
|
|||||||
KEY `xlink_link` (`xlink_link`),
|
KEY `xlink_link` (`xlink_link`),
|
||||||
KEY `xlink_updated` (`xlink_updated`),
|
KEY `xlink_updated` (`xlink_updated`),
|
||||||
KEY `xlink_rating` (`xlink_rating`)
|
KEY `xlink_rating` (`xlink_rating`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `xprof` (
|
CREATE TABLE IF NOT EXISTS `xprof` (
|
||||||
`xprof_hash` char(255) NOT NULL,
|
`xprof_hash` char(255) NOT NULL,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1046 );
|
define( 'UPDATE_VERSION' , 1047 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -565,3 +565,10 @@ ADD INDEX ( `site_register` ) ");
|
|||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1046() {
|
||||||
|
$r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '',
|
||||||
|
ADD INDEX ( `term_hash` ) ");
|
||||||
|
if($r)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
||||||
|
43
mod/thing.php
Normal file
43
mod/thing.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php /** @file */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function thing_init(&$a) {
|
||||||
|
|
||||||
|
if(! local_user())
|
||||||
|
return;
|
||||||
|
|
||||||
|
$account_id = $a->get_account();
|
||||||
|
|
||||||
|
$name = escape_tags($_REQUEST['term']);
|
||||||
|
$url = $_REQUEST['link'];
|
||||||
|
$photo = $_REQUEST['photo'];
|
||||||
|
|
||||||
|
$hash = random_string();
|
||||||
|
|
||||||
|
|
||||||
|
if(! $name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$r = q("insert into term ( aid, uid, oid, otype, type, term, url, imgurl, term_hash )
|
||||||
|
values( %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||||
|
intval($account_id),
|
||||||
|
intval(local_user()),
|
||||||
|
0,
|
||||||
|
TERM_OBJ_THING,
|
||||||
|
TERM_THING,
|
||||||
|
dbesc($name),
|
||||||
|
dbesc(($url) ? $url : z_root() . '/thing/' . $hash),
|
||||||
|
dbesc(($photo) ? $photo : ''),
|
||||||
|
dbesc($hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function thing_content(&$a) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user