source: trunk/admin/waiting.php @ 19

Last change on this file since 19 was 19, checked in by z0rglub, 21 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1<?php
2/***************************************************************************
3 *                     waiting.php is a part of PhpWebGallery              *
4 *                            -------------------                          *
5 *   last update          : Monday, October 28, 2002                         *
6 *   email                : pierrick@z0rglub.com                           *
7 *                                                                         *
8 ***************************************************************************/
9
10/***************************************************************************
11 *                                                                         *
12 *   This program is free software; you can redistribute it and/or modify  *
13 *   it under the terms of the GNU General Public License as published by  *
14 *   the Free Software Foundation;                                         *
15 *                                                                         *
16 ***************************************************************************/
17        include_once( "./include/isadmin.inc.php" );
18        //-------------------------------------------------------------- mise à jour
19        if ( isset( $HTTP_POST_VARS['submit'] ) )
20        {
21                $query = "select id,cat_id,file,tn_ext";
22                $query.= " from PREFIX_TABLE"."waiting";
23                $query.= ";";
24                $result = mysql_query( $query );
25                while ( $row = mysql_fetch_array( $result ) )
26                {
27                        $key = "validate-".$row['id'];
28                        if ( isset( $HTTP_POST_VARS[$key] ) )
29                        {
30                                $query = "delete from PREFIX_TABLE"."waiting";
31                                $query.= " where id = ".$row['id'];
32                                $query.= ";";
33                                mysql_query( $query );
34                                if ( $HTTP_POST_VARS[$key] == "false" )
35                                {
36                                        // we have to delete the picture and the thumbnail if it exists
37                                        $cat = get_cat_info( $row['cat_id'] );
38                                        unlink( ".".$cat['dir'].$row['file'] );
39                                        if ( $row['tn_ext'] != "" )
40                                        {
41                                                $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
42                                                unlink( ".".$cat['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'] );
43                                        }
44                                }
45                        }
46                }
47        }
48        //--------------------------------------------------------------- formulaire
49        $cat_names = array();
50        echo "
51                <form action=\"".add_session_id_to_url( "./admin.php?page=waiting" )."\" method=\"post\">
52                        <table style=\"width:100%;\">
53                                <tr>
54                                        <th style=\"width:20%;\">".$lang['category']."</th>
55                                        <th style=\"width:20%;\">".$lang['date']."</th>
56                                        <th style=\"width:20%;\">".$lang['file']."</th>
57                                        <th style=\"width:20%;\">".$lang['thumbnail']."</th>
58                                        <th style=\"width:20%;\">".$lang['author']."</th>
59                                        <th style=\"width:1px;\">&nbsp;</th>
60                                </tr>";
61        $query = "select id,cat_id,file,username,mail_address,date,tn_ext";
62        $query.= " from PREFIX_TABLE"."waiting";
63        $query.= " order by cat_id";
64        $query.= ";";
65        $result = mysql_query( $query );
66        $i = 0;
67        while ( $row = mysql_fetch_array( $result ) )
68        {
69                $style = "";
70                if ( $i%2 == 0 )
71                {
72                        $style = "class=\"row2\"";
73                }
74                if ( !isset( $cat_names[$row['cat_id']] ) )
75                {
76                        $cat = get_cat_info( $row['cat_id'] );
77                        $cat_names[$row['cat_id']] = array();
78                        $cat_names[$row['cat_id']]['dir'] = ".".$cat['dir'];
79                        $cat_names[$row['cat_id']]['display_name'] = get_cat_display_name( $cat['name'], " - ", "font-style:italic;" );
80                }
81                echo "
82                                <tr>
83                                        <td $style style=\"white-space:nowrap;\">".$cat_names[$row['cat_id']]['display_name']."</td>
84                                        <td $style style=\"white-space:nowrap;\">".$lang['day'][date( "w", $row['date'] )].date( " j ", $row['date'] ).$lang['month'][date( "n", $row['date'] )].date( " Y G:i", $row['date'] )."</td>
85                                        <td $style style=\"white-space:nowrap;\">
86                                                <a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir'].$row['file']."\">".$row['file']."</td>
87                                        </td>
88                                        <td $style style=\"white-space:nowrap;\">";
89                if ( $row['tn_ext'] != "" )
90                {
91                        $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
92                        echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
93                }
94                else
95                {
96                        echo "&nbsp;";
97                }
98                echo "
99                                        </td>
100                                        <td $style style=\"white-space:nowrap;\">
101                                                <a href=\"mailto:".$row['mail_address']."\">".$row['username']."</a>
102                                        </td>
103                                        <td $style style=\"white-space:nowrap;\">
104                                                <input type=\"radio\" name=\"validate-".$row['id']."\" value=\"true\" />".$lang['submit']."
105                                                <input type=\"radio\" name=\"validate-".$row['id']."\" value=\"false\" />".$lang['delete']."
106                                        </td>
107                                </tr>";
108                $i++;
109        }
110        echo "
111                                <tr>
112                                        <td colspan=\"5\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\" style=\"margin:5px;\" /></td>
113                                </tr>";
114        echo "
115                        </table>
116                </form>";
117?>
Note: See TracBrowser for help on using the repository browser.