mongo commit

This commit is contained in:
Mike Macgirvin 2010-07-12 16:43:59 -07:00
commit e0e2a032cf
9 changed files with 61 additions and 20 deletions

View file

@ -11,11 +11,18 @@ function item_post(&$a) {
$uid = $_SESSION['uid'];
$parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0);
$profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
if(! can_write_wall($a,$profile_uid)) {
notice("Permission denied." . EOL) ;
return;
}
$body = escape_tags(trim($_POST['body']));
if(! strlen($body)) {
notice("Empty post discarded." . EOL );
goaway($a->get_baseurl() . "/profile/$profile_uid");
}
if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id'])))
$contact_id = $_SESSION['visitor_id'];
else {
@ -53,9 +60,16 @@ function item_post(&$a) {
dbesc($hash));
if(count($r)) {
$post_id = $r[0]['id'];
if(! $parent)
if($parent) {
$r = q("UPDATE `item` SET `last-child` = 0 WHERE `parent` = %d ",
intval($parent)
);
}
else {
$parent = $post_id;
$r = q("UPDATE `item` SET `parent` = %d, `visible` = 1
}
$r = q("UPDATE `item` SET `parent` = %d, `last-child` = 1, `visible` = 1
WHERE `id` = %d LIMIT 1",
intval($parent),
intval($post_id));

View file

@ -65,12 +65,12 @@ function notifications_content(&$a) {
'$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
'$hide_text' => ((strlen($sql_extra)) ? 'Show Ignored Requests' : 'Hide Ignored Requests')
));
dbg(2);
$r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.*
FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
intval($_SESSION['uid']));
dbg(0);
if(($r !== false) && (count($r))) {

View file

@ -98,6 +98,7 @@ function profile_content(&$a) {
require_once("include/bbcode.php");
require_once('include/security.php');
$a->page['htmlhead'] .= '<script type="text/javascript" src="include/jquery.js" ></script>';
$groups = array();
$tab = 'posts';
@ -143,8 +144,6 @@ function profile_content(&$a) {
}
dbg(2);
// TODO
// Alter registration and settings
// and profile to update contact table when names and photos change.
@ -216,11 +215,10 @@ dbg(2);
$tpl = file_get_contents('view/wall_item.tpl');
if(count($r)) {
for($x = 0; $x < count($r); $x ++) {
$rr = $r[$x];
foreach($r as $rr) {
$comment = '';
if(can_write_wall($a,$a->profile['profile_uid'])) {
if((($x + 1) < count($r)) && ($r[$x+1]['parent'] != $rr['parent'])) {
if($rr['last-child']) {
$comment = replace_macros($template,array(
'$id' => $rr['item_id'],
'$parent' => $rr['parent'],