Changeset 1524 for branches/multiuser/util.php
- Timestamp:
- 08/05/06 11:53:58 (2 years ago)
- Files:
-
- 1 modified
-
branches/multiuser/util.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/multiuser/util.php
r1516 r1524 339 339 // check whether we already have this item 340 340 if ($guid) { 341 $sql = "select id,unread, md5sum, guid, pubdate from ".getTable("item") 342 ." where cid=$cid and guid='$guid'"; 341 $sql = "select id, i2u.flgunread,i2u.flgdeleted, md5sum, guid, pubdate " 342 ."from " 343 .getTable('item2user') ." i2u " 344 ."left join " 345 .getTable('item') ." i " 346 ." on (i2u.fkiid=i.id) " 347 ." where cid=$cid and guid='$guid'"; 343 348 } else { 344 $sql = "select id,unread, md5sum, guid, pubdate from ".getTable("item") 345 ." where cid=$cid and url='$url' and title='$dbtitle'" 346 ." and (pubdate is NULL OR pubdate=$sec)"; 349 $sql = "select id, i2u.flgunread,i2u.flgdeleted, md5sum, guid, pubdate " 350 ."from " 351 .getTable('item2user') ." i2u " 352 ."left join " 353 .getTable('item') ." i " 354 ." on (i2u.fkiid=i.id) " 355 ." where cid=$cid and url='$url' and title='$dbtitle'" 356 ." and (pubdate is NULL OR pubdate=$sec)"; 347 357 } 348 358 349 359 $subres = rss_query($sql); 350 list ($indb, $ state, $dbmd5sum, $dbGuid, $dbPubDate) = rss_fetch_row($subres);360 list ($indb, $unread,$deleted, $dbmd5sum, $dbGuid, $dbPubDate) = rss_fetch_row($subres); 351 361 352 362 if ($indb) { 353 363 $itemIdsInFeed[] = $indb; 354 if (! ($state & RSS_MODE_DELETED_STATE)&& $md5sum != $dbmd5sum) {364 if (!$deleted && $md5sum != $dbmd5sum) { 355 365 // the md5sums do not match. 356 366 if($allowUpdates) { // Are we allowed update items in the db? … … 360 370 $sql = "update ".getTable("item") 361 371 ." set "." description='".rss_real_escape_string($description)."', " 362 ." unread = unread | ".RSS_MODE_UNREAD_STATE363 ." ,md5sum='$md5sum'" . " where cid=$cid and id=$indb";364 372 //." unread = unread | ".RSS_MODE_UNREAD_STATE 373 ." md5sum='$md5sum'" . " where cid=$cid and id=$indb"; 374 365 375 rss_query($sql); 376 377 rss_query("update " .getTable('item2user') . " i2u set i2u.flgunread=1 where i2u.fkiid=$indb"); 366 378 $updatedIds[] = $indb; 367 379 continue; … … 375 387 $sql = "insert into ".getTable("item") 376 388 ." (cid, added, title, url, enclosure," 377 ." description, author, unread,pubdate, md5sum, guid) "389 ." description, author, pubdate, md5sum, guid) " 378 390 ." values ("."$cid, now(), '$dbtitle', " 379 391 ." '$url', '".rss_real_escape_string($enclosure)."', '" 380 392 .rss_real_escape_string($description)."', '" 381 393 .rss_real_escape_string($author)."', " 382 ." $mode,$sec, '$md5sum', '$guid')";394 ." $sec, '$md5sum', '$guid')"; 383 395 384 396 rss_query($sql); 385 397 386 398 $newIid = rss_insert_id(); 399 $uid=$GLOBALS['rssuser']->getUserId(); 400 $prv=($mode & RSS_MODE_PRIVATE_STATE) ?"1":"0"; 401 rss_query( 402 "insert into " .getTable('item2user') 403 ." (fkiid,fkuid,fkcid,flgunread,flgprivate) " 404 ." values ($newIid, $uid, $cid, 1, $prv) " 405 ); 406 387 407 $itemIdsInFeed[] = $newIid; 388 408 $updatedIds[] = $newIid; … … 884 904 885 905 $sql = "select count(*) from " 886 .getTable("item") ."i, ".getTable('channels')."c " 887 ." where i.unread & ".RSS_MODE_UNREAD_STATE. " and not(i.unread & " . 888 RSS_MODE_DELETED_STATE .") and i.cid=c.id " 906 .getTable("item2user") ."i2u, ".getTable('channels')."c " 907 ." where " 908 ." i2u.fkuid = " . rss_user_id() 909 ." and i2u.flgunread=1 and i2u.flgdeleted=0 and i2u.fkcid=c.id " 889 910 ." and not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 890 911 891 912 if (hidePrivate()) { 892 $sql .= " and not(i.unread & ".RSS_MODE_PRIVATE_STATE.")";913 $sql .= " and i2u.flgprivate=0"; 893 914 } 894 915
