Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<?php
2
/*************************
3
  Coppermine Photo Gallery
4
  ************************
5
  Copyright (c) 2003-2005 Coppermine Dev Team
6
  v1.1 originaly written by Gregory DEMAR
7
 
8
  This program is free software; you can redistribute it and/or modify
9
  it under the terms of the GNU General Public License as published by
10
  the Free Software Foundation; either version 2 of the License, or
11
  (at your option) any later version.
12
  ********************************************
13
  Coppermine version: 1.3.3
14
  $Source: /cvsroot/coppermine/stable/reviewcom.php,v $
15
  $Revision: 1.6 $
16
  $Author: gaugau $
17
  $Date: 2005/04/19 03:17:11 $
18
**********************************************/
19
 
20
define('IN_COPPERMINE', true);
21
define('REVIEWCOM_PHP', true);
22
 
23
require('include/init.inc.php');
24
 
25
if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
26
// Delete comments if form is posted
27
$nb_com_del = 0;
28
if (isset($HTTP_POST_VARS['cid_array'])) {
29
    $cid_array = $HTTP_POST_VARS['cid_array'];
30
    $cid_set = '';
31
    foreach ($cid_array as $cid)
32
    $cid_set .= ($cid_set == '') ? '(' . $cid : ', ' . $cid;
33
    $cid_set .= ')';
34
 
35
    db_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE msg_id IN $cid_set");
36
    $nb_com_del = mysql_affected_rows();
37
}
38
 
39
$result = db_query("SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE 1");
40
$nbEnr = mysql_fetch_array($result);
41
$comment_count = $nbEnr[0];
42
 
43
if (!$comment_count) cpg_die(INFORMATION , $lang_reviewcom_php['no_comment'], __FILE__, __LINE__);
44
 
45
$start = isset($HTTP_GET_VARS['start']) ? (int)$HTTP_GET_VARS['start'] : 0;
46
$count = isset($HTTP_GET_VARS['count']) ? $HTTP_GET_VARS['count'] : 25;
47
$next_target = $PHP_SELF . '?start=' . ($start + $count) . '&count=' . $count;
48
$prev_target = $PHP_SELF . '?start=' . max(0, $start - $count) . '&count=' . $count;
49
$s50 = $count == 50 ? 'selected' : '';
50
$s75 = $count == 75 ? 'selected' : '';
51
$s100 = $count == 100 ? 'selected' : '';
52
 
53
if ($start + $count < $comment_count) {
54
    $next_link = "<a href=\"$next_target\"><b>{$lang_reviewcom_php['see_next']}</b></a>&nbsp;&nbsp;-&nbsp;&nbsp;";
55
} else {
56
    $next_link = '';
57
}
58
 
59
if ($start > 0) {
60
    $prev_link = "<a href=\"$prev_target\"><b>{$lang_reviewcom_php['see_prev']}</b></a>&nbsp;&nbsp;-&nbsp;&nbsp;";
61
} else {
62
    $prev_link = '';
63
}
64
 
65
pageheader($lang_reviewcom_php['title']);
66
starttable(-1, $lang_reviewcom_php['title'], 3);
67
echo <<<EOT
68
    <form action="$PHP_SELF?start=$start&count=$count" method="post">
69
 
70
EOT;
71
 
72
if ($nb_com_del > 0) {
73
    $msg_txt = sprintf($lang_reviewcom_php['n_comm_del'], $nb_com_del);
74
    echo <<<EOT
75
        <tr>
76
                <td class="tableh2" colspan="3" align="center">
77
                        <br /><b>$msg_txt</b><br /><br />
78
                </td>
79
        </tr>
80
 
81
EOT;
82
}
83
 
84
echo <<<EOT
85
        <tr>
86
                <td class="tableb" colspan="3">
87
                        $prev_link
88
                        $next_link
89
                        <b>{$lang_reviewcom_php['n_comm_disp']}</b>
90
                        <select onChange="if(this.options[this.selectedIndex].value) window.location.href='$PHP_SELF?start=$start&count='+this.options[this.selectedIndex].value;"  name="count" class="listbox">
91
                                <option value="25">25</option>
92
                                <option value="50" $s50>50</option>
93
                                <option value="75" $s75>75</option>
94
                                <option value="100" $s100>100</option>
95
                        </select>
96
                </td>
97
        </tr>
98
 
99
EOT;
100
 
101
$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, {$CONFIG['TABLE_COMMENTS']}.pid as pid, aid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']} WHERE {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid ORDER BY msg_id DESC LIMIT $start, $count");
102
 
103
while ($row = mysql_fetch_array($result)) {
104
    $thumb_url =  get_pic_url($row, 'thumb');
105
    if (!is_image($row['filename'])) {
106
        $image_info = getimagesize($thumb_url);
107
        $row['pwidth'] = $image_info[0];
108
        $row['pheight'] = $image_info[1];
109
    }
110
    $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['alb_list_thumb_size']);
111
    $thumb_link = 'displayimage.php?pos=' . - $row['pid'];
112
    $msg_date = localised_date($row['msg_date'], $comment_date_fmt);
113
    echo <<<EOT
114
        <tr>
115
        <td colspan="2" class="tableh2" valign="top">
116
                <table cellpadding="0" cellspacing="0" border ="0">
117
                        <tr>
118
                        <td><input name="cid_array[]" type="checkbox" value="{$row['msg_id']}">
119
                        <td><img src="images/spacer.gif" width="5" height="1" /><br/></td>
120
                        <td><b>{$row['msg_author']}</b> - {$msg_date}</td>
121
                        </tr>
122
                </table>
123
                </td>
124
        </tr>
125
        <tr>
126
        <td class="tableb" valign="top" width="100%">
127
                        {$row['msg_body']}
128
                </td>
129
            <td class="tableb" align="center">
130
                        <a href="$thumb_link" target="_blank"><img src="$thumb_url" {$image_size['geom']} class="image" border="0"><br /></a>
131
        </td>
132
        </tr>
133
 
134
EOT;
135
    flush();
136
}
137
 
138
mysql_free_result($result);
139
 
140
echo <<<EOT
141
        <tr>
142
            <td colspan="3" align="center" class="tablef">
143
                        <input type="submit" value="{$lang_reviewcom_php['del_comm']}" class="button">
144
                </td>
145
        </form>
146
        </tr>
147
 
148
EOT;
149
endtable();
150
pagefooter();
151
ob_end_flush();
152
 
153
?>