[geeklog-cvs] geeklog-1.3/public_html dynamic.js,NONE,1.1 comment.php,1.89,1.90 usersettings.php,1.109,1.110
vinny at iowaoutdoors.org
vinny at iowaoutdoors.org
Sat Feb 5 00:04:20 EST 2005
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv9651/public_html
Modified Files:
comment.php usersettings.php
Added Files:
dynamic.js
Log Message:
Checking in dynamic comments
Index: usersettings.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/usersettings.php,v
retrieving revision 1.109
retrieving revision 1.110
diff -C2 -d -r1.109 -r1.110
*** usersettings.php 15 Dec 2004 15:08:21 -0000 1.109
--- usersettings.php 5 Feb 2005 05:04:18 -0000 1.110
***************
*** 599,605 ****
if (empty ($A['commentlimit'])) $A['commentlimit'] = 100;
$selection = '<select name="commentmode">';
$selection .= COM_optionList ($_TABLES['commentmodes'], 'mode,name',
! $A['commentmode']);
$selection .= '</select>';
$preferences->set_var ('displaymode_selector', $selection);
--- 599,609 ----
if (empty ($A['commentlimit'])) $A['commentlimit'] = 100;
+ $where = '';
+ if( $_CONF['dynamic_comments'] ) {
+ $where = 'mode != \'dynamic\'';
+ }
$selection = '<select name="commentmode">';
$selection .= COM_optionList ($_TABLES['commentmodes'], 'mode,name',
! $A['commentmode'], 1, $where);
$selection .= '</select>';
$preferences->set_var ('displaymode_selector', $selection);
Index: comment.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/comment.php,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -d -r1.89 -r1.90
*** comment.php 28 Jan 2005 04:49:09 -0000 1.89
--- comment.php 5 Feb 2005 05:04:18 -0000 1.90
***************
*** 234,246 ****
switch ( $type ) {
case 'article':
! $result = DB_query ("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (sid = '$sid') AND (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL ('AND') . COM_getTopicSQL ('AND'));
! $A = DB_fetchArray ($result);
! $allowed = $A['count'];
if ( $allowed == 1 ) {
$delete_option = ( SEC_hasRights( 'story.edit' ) &&
! ( SEC_hasAccess( $A['owner_id'], $A['group_id'],
! $A['perm_owner'], $A['perm_group'], $A['perm_members'],
! $A['perm_anon'] ) == 3 ) );
$display .= CMT_userComments ($sid, $title, $type,
COM_applyFilter ($_REQUEST['order']), $format, $cid,
--- 234,250 ----
switch ( $type ) {
case 'article':
! $sql = 'SELECT COUNT(*) AS count, owner_id, group_id, perm_owner, perm_group, '
! . "perm_members, perm_anon FROM {$_TABLES['stories']} WHERE (sid = '$sid') "
! . 'AND (draft_flag = 0) AND (date <= NOW())' . COM_getPermSQL('AND')
! . COM_getTopicSQL('AND') . 'GROUP BY sid';
! $result = DB_query ($sql);
! $B = DB_fetchArray ($result);
! $allowed = $B['count'];
if ( $allowed == 1 ) {
$delete_option = ( SEC_hasRights( 'story.edit' ) &&
! ( SEC_hasAccess( $B['owner_id'], $B['group_id'],
! $B['perm_owner'], $B['perm_group'], $B['perm_members'],
! $B['perm_anon'] ) == 3 ) );
$display .= CMT_userComments ($sid, $title, $type,
COM_applyFilter ($_REQUEST['order']), $format, $cid,
***************
*** 255,267 ****
case 'poll':
! $result = DB_query ("SELECT COUNT(*) AS count FROM {$_TABLES['pollquestions']} WHERE (qid = '$sid')" . COM_getPermSQL ('AND'));
! $A = DB_fetchArray ($result);
! $allowed = $A['count'];
if ( $allowed == 1 ) {
$delete_option = ( SEC_hasRights( 'poll.edit' ) &&
! ( SEC_hasAccess( $A['owner_id'], $A['group_id'],
! $A['perm_owner'], $A['perm_group'], $A['perm_members'],
! $A['perm_anon'] ) == 3 ) );
$display .= CMT_userComments ($sid, $title, $type,
COM_applyFilter ($_REQUEST['order']), $format, $cid,
--- 259,274 ----
case 'poll':
! $sql = 'SELECT COUNT(*) AS count, owner_id, group_id, perm_owner, perm_group, '
! . "perm_members, perm_anon FROM {$_TABLES['pollquestions']} WHERE (qid = '$sid') "
! . COM_getPermSQL('AND') . 'GROUP BY qid';
! $result = DB_query ($sql);
! $B = DB_fetchArray ($result);
! $allowed = $B['count'];
if ( $allowed == 1 ) {
$delete_option = ( SEC_hasRights( 'poll.edit' ) &&
! ( SEC_hasAccess( $B['owner_id'], $B['group_id'],
! $B['perm_owner'], $B['perm_group'], $B['perm_members'],
! $B['perm_anon'] ) == 3 ) );
$display .= CMT_userComments ($sid, $title, $type,
COM_applyFilter ($_REQUEST['order']), $format, $cid,
***************
*** 287,290 ****
--- 294,387 ----
}
+ /**
+ * Hanldes a comment view request for dynamic comments
+ *
+ * @copyright Vincent Furia 2005
+ * @author Vincent Furia <vinny01 AT users DOT sourceforge DOT net>
+ * @return string HTML
+ */
+ function handleFetch() {
+ global $_REQUEST, $_TABLES, $_USER, $_CONF;
+
+ if ( COM_applyFilter($_REQUEST['full']) == 'true' ) {
+ $full = true;
+ } else {
+ $full = false;
+ }
+ $cid = COM_applyFilter ($_REQUEST['cid'], true);
+ if ($cid <= 0) {
+ return "ERROR ACCESS DENIED";
+ }
+
+ $sql = "SELECT c.*, u.username, u.fullname, u.photo, "
+ . "unix_timestamp(c.date) AS nice_date "
+ . "FROM {$_TABLES['comments']} as c, {$_TABLES['users']} as u "
+ . "WHERE c.uid = u.uid AND c.cid = $cid";
+ $A = DB_fetchArray( DB_query($sql) );
+ $sid = $A['sid'];
+ $type = $A['type'];
+
+ switch ( $type ) {
+ case 'article':
+ $sql = 'SELECT COUNT(*) AS count, owner_id, group_id, perm_owner, perm_group, '
+ . "perm_members, perm_anon FROM {$_TABLES['stories']} WHERE (sid = '$sid') "
+ . 'AND (draft_flag = 0) AND (date <= NOW())' . COM_getPermSQL('AND')
+ . COM_getTopicSQL('AND') . 'GROUP BY sid';
+ $result = DB_query ($sql);
+ $B = DB_fetchArray ($result);
+ $allowed = $B['count'];
+
+ if ( $allowed == 1 ) {
+ $delete_option = ( SEC_hasRights( 'story.edit' ) &&
+ ( SEC_hasAccess( $B['owner_id'], $B['group_id'],
+ $B['perm_owner'], $B['perm_group'], $B['perm_members'],
+ $B['perm_anon'] ) == 3 ) );
+ if ( $full ) {
+ $display .= CMT_getComment($A, 'dynamic_comment', 'article',
+ 'ASC', $delete_option);
+ } else {
+ $display .= CMT_getComment($A, 'dynamic_thread', 'article',
+ 'ASC', $delete_option);
+ }
+ } else {
+ $display .= 'ERROR ACCESS DENIED';
+ }
+ break;
+
+ case 'poll':
+ $sql = 'SELECT COUNT(*) AS count, owner_id, group_id, perm_owner, perm_group, '
+ . "perm_members, perm_anon FROM {$_TABLES['pollquestions']} WHERE (qid = '$sid') "
+ . COM_getPermSQL('AND') . 'GROUP BY qid';
+ $result = DB_query ($sql);
+ $B = DB_fetchArray ($result);
+ $allowed = $B['count'];
+
+ if ( $allowed == 1 ) {
+ $delete_option = ( SEC_hasRights( 'poll.edit' ) &&
+ ( SEC_hasAccess( $B['owner_id'], $B['group_id'],
+ $B['perm_owner'], $B['perm_group'], $B['perm_members'],
+ $B['perm_anon'] ) == 3 ) );
+ if ( $full ) {
+ $display .= CMT_getComment($A, 'dynamic_comment', 'poll',
+ 'ASC', $delete_option);
+ } else {
+ $display .= CMT_getComment($A, 'dynamic_thread', 'poll',
+ 'ASC', $delete_option);
+ }
+ } else {
+ $display .= 'ERROR ACCESS DENIED';
+ }
+ break;
+
+ default: // assume comment
+ if ( !($display = PLG_fetchComment($type, $A, $full)) ) {
+ return 'ERROR ACCESS DENIED';
+ }
+ break;
+ }
+
+ return $display;
+ }
+
// MAIN
$display = '';
***************
*** 321,324 ****
--- 418,429 ----
break;
+ case 'fetch':
+ if ( $_CONF['dynamic_comments'] ) {
+ $display .= handleFetch();
+ } else {
+ $display = COM_refresh ($_CONF['site_url'] . '/index.php');
+ }
+ break;
+
case 'report':
$display .= COM_siteHeader ('menu')
--- NEW FILE: dynamic.js ---
// +---------------------------------------------------------------------------+
// | Geeklog 1.3 |
// +---------------------------------------------------------------------------+
// | dynamic.js |
// | Javascript for dynamic comment display |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2005 by the following authors: |
// | |
// | Authors: Vincent Furia <vinny01 AT users DOT sourceforge DOT net> |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
// Global variables defined
var inProgress = false;
var xmlhttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
function loadFragmentInToElement(fragment_url, element_id) {
var element = document.getElementById(element_id);
element.innerHTML = '<img src="/images/dynwait.gif" alt="Loading..."/>Loading ...';
// check to make sure a xmlhttp request isn't in work, if it is try again later
if (inProgress == true) {
setTimeout("loadFragmentInToElement('"+fragment_url+"','"+element_id+"')",100);
return;
}
inProgress = true;
xmlhttp.open("GET", fragment_url, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && inProgress == true) {
element.innerHTML = xmlhttp.responseText;
inProgress = false;
}
}
xmlhttp.send(null);
}
More information about the geeklog-cvs
mailing list