[geeklog-cvs] geeklog: Cleaned code up a bit
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Tue Dec 13 11:14:50 EST 2011
changeset 8457:27abb3a93f2c
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/27abb3a93f2c
user: Tom <websitemaster at cogeco.net>
date: Tue Dec 13 11:02:09 2011 -0500
description:
Cleaned code up a bit
diffstat:
public_html/lib-common.php | 14 ++++++++------
system/classes/story.class.php | 33 +--------------------------------
2 files changed, 9 insertions(+), 38 deletions(-)
diffs (102 lines):
diff -r 4270412a6322 -r 27abb3a93f2c public_html/lib-common.php
--- a/public_html/lib-common.php Tue Dec 06 20:18:46 2011 -0500
+++ b/public_html/lib-common.php Tue Dec 13 11:02:09 2011 -0500
@@ -2252,7 +2252,6 @@
if ($branch_level_skip == 0) {
// Make sure to show topics for proper language only
- //if ($_TOPICS[$count_topic]['access'] > 0 && !$_TOPICS[$count_topic]['hidden'] && (($lang_id == '') || ($lang_id != '' && ($_TOPICS[$count_topic]['language_id'] == $lang_id || $_TOPICS[$count_topic]['language_id'] == '')))) {
if ($_TOPICS[$count_topic]['exclude'] == 0 && $_TOPICS[$count_topic]['access'] > 0 && !$_TOPICS[$count_topic]['hidden'] && (($lang_id == '') || ($lang_id != '' && ($_TOPICS[$count_topic]['language_id'] == $lang_id)))) {
$branch_spaces = "";
for ($branch_count = $start_branch; $branch_count <= $_TOPICS[$count_topic]['branch_level'] ; $branch_count++) {
@@ -4200,7 +4199,9 @@
$storysql['pgsql'] = "SELECT sid,uid,date AS day,title,introtext,postmode";
$storysql['mssql'] = "SELECT sid,uid,date AS day,title,CAST(introtext AS text) AS introtext,CAST(bodytext AS text) AS introtext";
- $commonsql = " FROM {$_TABLES['stories']} WHERE draft_flag = 0 AND date <= NOW() AND date >= '{$lastrun}'";
+ $commonsql = " FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta
+ WHERE draft_flag = 0 AND date <= NOW() AND date >= '{$lastrun}'
+ AND ta.type = 'article' AND ta.id = sid ";
$topicsql = "SELECT tid FROM {$_TABLES['topics']}"
. COM_getPermSQL( 'WHERE', $U['uuid'] );
@@ -4226,13 +4227,14 @@
$TIDS = array_intersect( $TIDS, $ETIDS );
}
- if( count( $TIDS ) > 0)
- {
- $commonsql .= " AND (tid IN ('" . implode( "','", $TIDS ) . "'))";
+ if( count( $TIDS ) > 0) {
+ // We have list of Daily Digest topic ids that user has access too and that the user wants a report on
+ $commonsql .= " AND (ta.tid IN ('" . implode( "','", $TIDS ) . "'))";
}
$commonsql .= COM_getPermSQL( 'AND', $U['uuid'] );
- $commonsql .= ' ORDER BY featured DESC, date DESC';
+ $commonsql .= ' GROUP BY sid
+ ORDER BY featured DESC, date DESC';
$storysql['mysql'] .= $commonsql;
$storysql['mssql'] .= $commonsql;
diff -r 4270412a6322 -r 27abb3a93f2c system/classes/story.class.php
--- a/system/classes/story.class.php Tue Dec 06 20:18:46 2011 -0500
+++ b/system/classes/story.class.php Tue Dec 13 11:02:09 2011 -0500
@@ -465,7 +465,7 @@
. 'u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, ' . 't.perm_owner, t.perm_group, t.perm_members, t.perm_anon ' . 'FROM ' . $_TABLES['storysubmission'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topics'] . ' AS t WHERE (s.uid = u.uid) AND' . ' (s.tid = t.tid) AND (sid = \'' . $sid . '\')';
$sql['pgsql'] = 'SELECT s.*, UNIX_TIMESTAMP(s.date) AS unixdate, '
. 'u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, ' . 't.perm_owner, t.perm_group, t.perm_members, t.perm_anon ' . 'FROM ' . $_TABLES['storysubmission'] . ' AS s, ' . $_TABLES['users'] . ' AS u, ' . $_TABLES['topics'] . ' AS t WHERE (s.uid = u.uid) AND' . ' (s.tid = t.tid) AND (sid = \'' . $sid . '\')';
- */
+ */
$sql['mysql'] = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, u.username, u.fullname, u.photo, u.email, t.topic, t.imageurl, t.group_id, t.perm_owner, t.perm_group, t.perm_members, t.perm_anon
FROM {$_TABLES['storysubmission']} AS s, {$_TABLES['users']} AS u, {$_TABLES['topics']} AS t, {$_TABLES['topic_assignments']} AS ta
WHERE (s.uid = u.uid) AND (ta.tid = t.tid) AND (sid = '$sid')
@@ -1060,32 +1060,10 @@
$this->_introtext = PLG_replaceTags($this->_introtext, '', true);
$this->_bodytext = PLG_replaceTags($this->_bodytext, '', true);
-
-
-
-
-
- /*
- $result = DB_query('SELECT group_id,perm_owner,perm_group,perm_members,perm_anon FROM ' .
- "{$_TABLES['topics']} WHERE tid = '{$tmptid}'" .
- COM_getTopicSQL('AND'));
-
- if (DB_numRows($result) == 0) {
- // user doesn't have access to this topic - bail
- return STORY_NO_ACCESS_TOPIC;
- }
-
- $T = DB_fetchArray($result);
- */
-
-
if (!TOPIC_hasMultiTopicAccess('topic')) {
// user doesn't have access to one or more topics - bail
return STORY_NO_ACCESS_TOPIC;
}
-
-
-
if (($_CONF['storysubmission'] == 1) && !SEC_hasRights('story.submit')) {
@@ -1787,15 +1765,6 @@
return $return;
}
- /**
- * Set the TID to a new value.
- *
- * @param $tid int ID of the topic to set
- */
-// function setTid($tid)
-// {
-// $this->_tid = $tid;
-// }
/**
* Perform a security check and return permission level.
More information about the geeklog-cvs
mailing list