1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * edit_cat.php is a part of PhpWebGallery * |
---|
4 | * ------------------- * |
---|
5 | * last update : Tuesday, July 16, 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 | |
---|
19 | if ( $HTTP_GET_VARS['valider'] == 1 ) |
---|
20 | { |
---|
21 | $query = "update $prefixeTable"."categories "; |
---|
22 | if ( $HTTP_POST_VARS['name'] == "" ) |
---|
23 | { |
---|
24 | $query.= "set name = NULL, "; |
---|
25 | } |
---|
26 | else |
---|
27 | { |
---|
28 | $query.= "set name = '".htmlspecialchars( $HTTP_POST_VARS['name'], ENT_QUOTES)."', "; |
---|
29 | } |
---|
30 | if ( $HTTP_POST_VARS['comment'] == "" ) |
---|
31 | { |
---|
32 | $query.= "comment = NULL, "; |
---|
33 | } |
---|
34 | else |
---|
35 | { |
---|
36 | $query.= "comment = '".htmlspecialchars( $HTTP_POST_VARS['comment'], ENT_QUOTES )."', "; |
---|
37 | } |
---|
38 | $query.= "status = '".$HTTP_POST_VARS['status']."' "; |
---|
39 | $query.= "where id = '".$HTTP_GET_VARS['cat']."';"; |
---|
40 | mysql_query( $query ); |
---|
41 | |
---|
42 | $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" ); |
---|
43 | while ( $row = mysql_fetch_array ( $result ) ) |
---|
44 | { |
---|
45 | check_favorites( $row['id'] ); |
---|
46 | } |
---|
47 | |
---|
48 | echo"<div style=\"color:red;text-align:center;\">".$lang['editcat_confirm']." [ <a href=\"".add_session_id_to_url( "./admin.php?page=cat" )."\">".$lang['editcat_back']."</a> ]</div>"; |
---|
49 | } |
---|
50 | |
---|
51 | echo " |
---|
52 | <form action=\"".add_session_id_to_url( "./admin.php?page=edit_cat&cat=".$HTTP_GET_VARS['cat']."&valider=1" )."\" method=\"post\"> |
---|
53 | <table style=\"width:100%;\">"; |
---|
54 | $query = "select a.id,name,dir,status,comment,id_uppercat,site_id,galleries_url"; |
---|
55 | $query.= " from $prefixeTable"."categories as a, $prefixeTable"."sites as b"; |
---|
56 | $query.= " where a.id = ".$HTTP_GET_VARS['cat']; |
---|
57 | $query.= " and a.site_id = b.id;"; |
---|
58 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
59 | $result = get_cat_info( $row['id'] ); |
---|
60 | $array_cat_names = $result['name']; |
---|
61 | echo " |
---|
62 | <tr> |
---|
63 | <th colspan=\"2\">".$lang['editcat_title1']." ".$lang['category']." \"".get_cat_display_name( $array_cat_names, " - ", "font-style:italic;" )."\" [ dir : ".$row['dir']." ]</th> |
---|
64 | </tr>"; |
---|
65 | if ( $row['site_id'] != 1 ) |
---|
66 | { |
---|
67 | echo " |
---|
68 | <tr> |
---|
69 | <td style=\"width:20%;\">Server</td> |
---|
70 | <td class=\"row2\">".$row['galleries_url']."</td> |
---|
71 | </tr>"; |
---|
72 | } |
---|
73 | echo " |
---|
74 | <tr> |
---|
75 | <td style=\"width:20%;\">".$lang['editcat_name']."</td> |
---|
76 | <td class=\"row2\"><input type=\"text\" name=\"name\" value=\"".$row['name']."\" maxlength=\"255\"/></td> |
---|
77 | </tr> |
---|
78 | <tr> |
---|
79 | <td style=\"width:20%;\">".$lang['editcat_comment']."</td> |
---|
80 | <td class=\"row2\"><textarea name=\"comment\" rows=\"5\" cols=\"50\" style=\"overflow:auto\">".$row['comment']."</textarea></td> |
---|
81 | </tr> |
---|
82 | <tr> |
---|
83 | <td style=\"width:20%;\">".$lang['editcat_status']."</td> |
---|
84 | <td class=\"row2\"> |
---|
85 | <select name=\"status\">"; |
---|
86 | // on récupère toutes les status possibles dans la base |
---|
87 | // par l'intermédiaire de la fonction get_enums trouvable |
---|
88 | // dans le fichier config.php |
---|
89 | $option = get_enums( $prefixeTable."categories", "status" ); |
---|
90 | for ( $i = 0; $i < sizeof( $option ); $i++ ) |
---|
91 | { |
---|
92 | if ( $option[$i] == $row['status'] ) |
---|
93 | { |
---|
94 | echo" |
---|
95 | <option selected>$option[$i]</option>"; |
---|
96 | } |
---|
97 | else |
---|
98 | { |
---|
99 | echo" |
---|
100 | <option>$option[$i]</option>"; |
---|
101 | } |
---|
102 | } |
---|
103 | echo" |
---|
104 | </select> |
---|
105 | ".$lang['editcat_status_info']." |
---|
106 | </td> |
---|
107 | </tr> |
---|
108 | <tr> |
---|
109 | <td colspan=\"2\"> </td> |
---|
110 | </tr> |
---|
111 | <tr> |
---|
112 | <td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td> |
---|
113 | </tr> |
---|
114 | </table> |
---|
115 | </form>"; |
---|
116 | ?> |
---|