Changeset 10 for trunk/admin
- Timestamp:
- May 17, 2003, 12:49:14 PM (21 years ago)
- Location:
- trunk/admin
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/admin.php
r9 r10 36 36 case 'historique': 37 37 $titre = $lang['title_history']; $page_valide = true; break; 38 case ' miseajour':38 case 'update': 39 39 $titre = $lang['title_update']; $page_valide = true; break; 40 40 case 'configuration': … … 116 116 $vtp->setVar( $handle, 'summary.link', 117 117 add_session_id( $link_start.'waiting' ) ); 118 $query = 'select id from '. $prefixeTable.'waiting;';118 $query = 'select id from '.PREFIX_TABLE.'waiting;'; 119 119 $result = mysql_query( $query ); 120 120 $nb_waiting = ''; … … 129 129 $vtp->setVar( $handle, 'summary.indent', '' ); 130 130 $vtp->setVar( $handle, 'summary.link', 131 add_session_id( $link_start.' miseajour' ) );131 add_session_id( $link_start.'update' ) ); 132 132 $vtp->setVar( $handle, 'summary.name', $lang['menu_update'] ); 133 133 $vtp->closeSession( $handle, 'summary' ); -
trunk/admin/cat.php
r2 r10 1 1 <?php 2 2 /*************************************************************************** 3 * this file is a part of PhpWebGallery*3 * cat.php * 4 4 * ------------------- * 5 * version : 1.3 * 6 * url : http://phpwebgallery.net * 7 * help : http://forum.phpwebgallery.net * 8 * author : Pierrick LE GALL * 5 * application : PhpWebGallery 1.3 * 6 * website : http://www.phpwebgallery.net * 7 * author : Pierrick LE GALL <pierrick@z0rglub.com> * 9 8 * * 10 9 ***************************************************************************/ … … 33 32 // and rank of the category to move 34 33 $query = 'select id_uppercat,rank'; 35 $query.= ' from '. $prefixeTable.'categories';34 $query.= ' from '.PREFIX_TABLE.'categories'; 36 35 $query.= ' where id = '.$_GET['up']; 37 36 $query.= ';'; … … 42 41 // just above at the same level 43 42 $query = 'select id,rank'; 44 $query.= ' from '. $prefixeTable.'categories';43 $query.= ' from '.PREFIX_TABLE.'categories'; 45 44 $query.= ' where rank < '.$rank; 46 45 if ( $level == '' ) … … 59 58 $replaced_cat = $row['id']; 60 59 // 3. exchanging ranks between the two categories 61 $query = 'update '. $prefixeTable.'categories';60 $query = 'update '.PREFIX_TABLE.'categories'; 62 61 $query.= ' set rank = '.$new_rank; 63 62 $query.= ' where id = '.$_GET['up']; 64 63 $query.= ';'; 65 64 mysql_query( $query ); 66 $query = 'update '. $prefixeTable.'categories';65 $query = 'update '.PREFIX_TABLE.'categories'; 67 66 $query.= ' set rank = '.$rank; 68 67 $query.= ' where id = '.$replaced_cat; … … 75 74 // and rank of the category to move 76 75 $query = 'select id_uppercat,rank'; 77 $query.= ' from '. $prefixeTable.'categories';76 $query.= ' from '.PREFIX_TABLE.'categories'; 78 77 $query.= ' where id = '.$_GET['down']; 79 78 $query.= ';'; … … 84 83 // just below at the same level 85 84 $query = 'select id,rank'; 86 $query.= ' from '. $prefixeTable.'categories';85 $query.= ' from '.PREFIX_TABLE.'categories'; 87 86 $query.= ' where rank > '.$rank; 88 87 if ( $level == '' ) … … 101 100 $replaced_cat = $row['id']; 102 101 // 3. exchanging ranks between the two categories 103 $query = 'update '. $prefixeTable.'categories';102 $query = 'update '.PREFIX_TABLE.'categories'; 104 103 $query.= ' set rank = '.$new_rank; 105 104 $query.= ' where id = '.$_GET['down']; 106 105 $query.= ';'; 107 106 mysql_query( $query ); 108 $query = 'update '. $prefixeTable.'categories';107 $query = 'update '.PREFIX_TABLE.'categories'; 109 108 $query.= ' set rank = '.$rank; 110 109 $query.= ' where id = '.$replaced_cat; … … 115 114 function ordering( $id_uppercat ) 116 115 { 117 global $prefixeTable;118 119 116 $rank = 1; 120 117 121 118 $query = 'select id'; 122 $query.= ' from '. $prefixeTable.'categories';119 $query.= ' from '.PREFIX_TABLE.'categories'; 123 120 if ( !is_numeric( $id_uppercat ) ) 124 121 { … … 134 131 while ( $row = mysql_fetch_array( $result ) ) 135 132 { 136 $query = 'update '. $prefixeTable.'categories';133 $query = 'update '.PREFIX_TABLE.'categories'; 137 134 $query.= ' set rank = '.$rank; 138 135 $query.= ' where id = '.$row['id']; … … 149 146 $uppercat_visible, $level ) 150 147 { 151 global $ prefixeTable,$lang,$conf,$sub,$vtp;148 global $lang,$conf,$sub,$vtp; 152 149 153 150 // searching the min_rank and the max_rank of the category 154 151 $query = 'select min(rank) as min, max(rank) as max'; 155 $query.= ' from '. $prefixeTable.'categories';152 $query.= ' from '.PREFIX_TABLE.'categories'; 156 153 if ( !is_numeric( $id_uppercat ) ) 157 154 { … … 181 178 182 179 $query = 'select id,name,dir,nb_images,status,rank,site_id'; 183 $query.= ' from '. $prefixeTable.'categories';180 $query.= ' from '.PREFIX_TABLE.'categories'; 184 181 if ( !is_numeric( $id_uppercat ) ) 185 182 { -
trunk/admin/configuration.php
r9 r10 4 4 * ------------------- * 5 5 * application : PhpWebGallery 1.3 * 6 * website : http://www.phpwebgallery.net * 6 7 * author : Pierrick LE GALL <pierrick@z0rglub.com> * 7 8 * * … … 35 36 "ý" => "y", "ÿ" => "y"); 36 37 //------------------------------ verification and registration of modifications 37 $conf_infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 38 'acces', 'session_id_size', 'session_time', 39 'session_keyword', 'max_user_listbox', 'show_comments', 40 'nb_comment_page', 'upload_available', 41 'upload_maxfilesize', 'upload_maxwidth', 42 'upload_maxheight', 'upload_maxwidth_thumbnail', 43 'upload_maxheight_thumbnail' ); 44 $default_user_infos = array( 'nb_image_line', 'nb_line_page', 'theme', 45 'language', 'maxwidth', 'maxheight', 'expand', 46 'show_nb_comments', 'short_period', 'long_period', 47 'template' ); 38 $conf_infos = 39 array( 'prefixe_thumbnail','webmaster','mail_webmaster','acces', 40 'session_id_size','session_time','session_keyword','max_user_listbox', 41 'show_comments','nb_comment_page','upload_available', 42 'upload_maxfilesize', 'upload_maxwidth','upload_maxheight', 43 'upload_maxwidth_thumbnail','upload_maxheight_thumbnail' ); 44 $default_user_infos = 45 array( 'nb_image_line','nb_line_page','theme','language','maxwidth', 46 'maxheight','expand','show_nb_comments','short_period','long_period', 47 'template' ); 48 48 $error = array(); 49 49 $i = 0; … … 53 53 if ( $_POST['empty_session_table'] == 1 ) 54 54 { 55 $query = 'delete from '. $prefixeTable.'sessions';55 $query = 'delete from '.PREFIX_TABLE.'sessions'; 56 56 $query.= ' where expiration < '.time().';'; 57 57 mysql_query( $query ); … … 59 59 // deletion of site as asked 60 60 $query = 'select id'; 61 $query.= ' from '. $prefixeTable.'sites';61 $query.= ' from '.PREFIX_TABLE.'sites'; 62 62 $query.= " where galleries_url <> './galleries/';"; 63 63 $result = mysql_query( $query ); … … 183 183 if ( sizeof( $error ) == 0 ) 184 184 { 185 mysql_query( 'delete from '. $prefixeTable.'config;' );186 $query = 'insert into '. $prefixeTable.'config';185 mysql_query( 'delete from '.PREFIX_TABLE.'config;' ); 186 $query = 'insert into '.PREFIX_TABLE.'config'; 187 187 $query.= ' ('; 188 188 for ( $i = 0; $i < sizeof( $conf_infos ); $i++ ) … … 220 220 $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1]; 221 221 222 $query = 'update '. $prefixeTable.'users';222 $query = 'update '.PREFIX_TABLE.'users'; 223 223 $query.= ' set'; 224 224 for ( $i = 0; $i < sizeof( $default_user_infos ); $i++ ) … … 272 272 $query.= $conf_infos[$i]; 273 273 } 274 $query .= ' from '. $prefixeTable.'config;';274 $query .= ' from '.PREFIX_TABLE.'config;'; 275 275 276 276 $row = mysql_fetch_array( mysql_query( $query ) ); … … 293 293 $query.= $default_user_infos[$i]; 294 294 } 295 $query .= ' from '. $prefixeTable.'users';295 $query .= ' from '.PREFIX_TABLE.'users'; 296 296 $query.= " where username = 'guest'"; 297 297 $query.= ';'; … … 309 309 // language 310 310 $vtp->setGlobalVar( $sub, 'conf_confirmation', $lang['conf_confirmation'] ); 311 $vtp->setGlobalVar( $sub, 'conf_remote_site_title', 312 $lang['conf_remote_site_title'] ); 311 $vtp->setGlobalVar( $sub, 'remote_site', $lang['remote_site'] ); 313 312 $vtp->setGlobalVar( $sub, 'delete', $lang['delete'] ); 314 313 $vtp->setGlobalVar( $sub, 'conf_remote_site_delete_info', … … 886 885 //------------------------------------------------ remote sites administration 887 886 $query = 'select id,galleries_url'; 888 $query.= ' from '. $prefixeTable.'sites';887 $query.= ' from '.PREFIX_TABLE.'sites'; 889 888 $query.= " where galleries_url <> './galleries/';"; 890 889 $result = mysql_query( $query ); -
trunk/admin/create_listing_file.php
r2 r10 1 1 <?php 2 $prefixe_thumbnail = "TN-";2 $prefixe_thumbnail = 'TN-'; 3 3 4 $conf['picture_ext'] = array ( 'jpg', 'gif', 'png', 'JPG', 'GIF', 'PNG' ); 5 6 $listing = ''; 7 8 $end = strrpos( $_SERVER['PHP_SELF'], '/' ) + 1; 9 $local_folder = substr( $_SERVER['PHP_SELF'], 0, $end ); 10 $url = 'http://'.$_SERVER['HTTP_HOST'].$local_folder; 11 12 $listing.= "<url>$url</url>"; 4 13 5 $tab_ext = array ( 'jpg', 'JPG','gif','GIF','png','PNG' ); 14 // get_dirs retourne un tableau contenant tous les sous-répertoires d'un 15 // répertoire 16 function get_dirs( $rep, $indent, $level ) 17 { 18 $sub_rep = array(); 19 $i = 0; 20 $dirs = ""; 21 if ( $opendir = opendir ( $rep ) ) 22 { 23 while ( $file = readdir ( $opendir ) ) 24 { 25 if ( $file != "." 26 and $file != ".." 27 and is_dir ( $rep."/".$file ) 28 and $file != "thumbnail" ) 29 { 30 $sub_rep[$i++] = $file; 31 } 32 } 33 } 34 // write of the dirs 35 for ( $i = 0; $i < sizeof( $sub_rep ); $i++ ) 36 { 37 $dirs.= "\n".$indent.'<dir'.$level.' name="'.$sub_rep[$i].'">'; 38 $dirs.= get_pictures( $rep.'/'.$sub_rep[$i], $indent.' ' ); 39 $dirs.= get_dirs( $rep.'/'.$sub_rep[$i], $indent.' ', $level + 1 ); 40 $dirs.= "\n".$indent.'</dir'.$level.'>'; 41 } 42 return $dirs; 43 } 6 44 7 $listing = ""; 8 9 $local_folder = substr( $PHP_SELF, 0, strrpos( $PHP_SELF, "/" ) + 1 ); 10 $url = "http://".$HTTP_HOST.$local_folder; 11 $listing.= "<url>$url</url>"; 12 13 // get_dirs retourne un tableau contenant tous les sous-répertoires d'un répertoire 14 function get_dirs( $rep, $indent, $level ) 15 { 16 $sub_rep = array(); 17 $i = 0; 18 $dirs = ""; 19 if ( $opendir = opendir ( $rep ) ) 20 { 21 while ( $file = readdir ( $opendir ) ) 22 { 23 if ( $file != "." && $file != ".." && is_dir ( $rep."/".$file ) && $file != "thumbnail" ) 24 { 25 $sub_rep[$i++] = $file; 26 } 27 } 28 } 29 // write of the dirs 30 for ( $i = 0; $i < sizeof( $sub_rep ); $i++ ) 31 { 32 $dirs.= "\n".$indent."<dir".$level.">"; 33 $dirs.= "\n".$indent."\t<name>".$sub_rep[$i]."</name>"; 34 $dirs.= get_pictures( $rep."/".$sub_rep[$i], $indent."\t" ); 35 $dirs.= get_dirs( $rep."/".$sub_rep[$i], $indent."\t", $level + 1 ); 36 $dirs.= "\n".$indent."</dir".$level.">"; 37 } 38 return $dirs; 39 } 40 41 function is_image ( $filename ) 42 { 43 global $tab_ext; 44 if ( in_array ( substr ( strrchr($filename,"."), 1, strlen ( $filename ) ), $tab_ext ) ) 45 { 46 return true; 47 } 48 else 49 { 50 return false; 51 } 52 } 53 54 function TN_exist ( $dir, $file ) 55 { 56 global $tab_ext, $prefixe_thumbnail; 57 58 $titre = substr ( $file, 0, -4 ); 59 for ( $i = 0; $i < sizeof ( $tab_ext ); $i++ ) 60 { 61 $test = $dir."/thumbnail/".$prefixe_thumbnail.$titre.".".$tab_ext[$i]; 62 if ( is_file ( $test ) ) 63 { 64 return $tab_ext[$i]; 65 } 66 } 67 return false; 68 } 45 // get_extension returns the part of the string after the last "." 46 function get_extension( $filename ) 47 { 48 return substr( strrchr( $filename, '.' ), 1, strlen ( $filename ) ); 49 } 69 50 70 function get_pictures( $rep, $indent ) 71 { 72 $pictures = array(); 73 $i = 0; 74 $tn_ext = ""; 75 $root = ""; 76 if ( $opendir = opendir ( $rep ) ) 77 { 78 while ( $file = readdir ( $opendir ) ) 79 { 80 if ( is_image( $file ) && $tn_ext = TN_exist( $rep, $file ) ) 81 { 82 $pictures[$i] = array(); 83 $pictures[$i]['file'] = $file; 84 $pictures[$i]['tn_ext'] = $tn_ext; 85 $pictures[$i]['date'] = date( "Y-m-d", filemtime ( $rep."/".$file ) ); 86 $pictures[$i]['filesize'] = floor ( filesize( $rep."/".$file ) / 1024 ); 87 $image_size = @getimagesize( $rep."/".$file ); 88 $pictures[$i]['width'] = $image_size[0]; 89 $pictures[$i]['height'] = $image_size[1]; 90 $i++; 91 } 92 } 93 } 94 // write of the node <root> with all the pictures at the root of the directory 95 $root.= "\n".$indent."<root>"; 96 if ( sizeof( $pictures ) > 0 ) 97 { 98 for( $i = 0; $i < sizeof( $pictures ); $i++ ) 99 { 100 $root.= "\n".$indent."\t<picture>"; 101 $root.= "\n".$indent."\t\t<file>".$pictures[$i]['file']."</file>"; 102 $root.= "\n".$indent."\t\t<tn_ext>".$pictures[$i]['tn_ext']."</tn_ext>"; 103 $root.= "\n".$indent."\t\t<date>".$pictures[$i]['date']."</date>"; 104 $root.= "\n".$indent."\t\t<filesize>".$pictures[$i]['filesize']."</filesize>"; 105 $root.= "\n".$indent."\t\t<width>".$pictures[$i]['width']."</width>"; 106 $root.= "\n".$indent."\t\t<height>".$pictures[$i]['height']."</height>"; 107 $root.= "\n".$indent."\t</picture>"; 108 } 109 } 110 $root.= "\n".$indent."</root>"; 111 return $root; 112 } 51 // get_filename_wo_extension returns the part of the string before the last 52 // ".". 53 // get_filename_wo_extension( 'test.tar.gz' ) -> 'test.tar' 54 function get_filename_wo_extension( $filename ) 55 { 56 return substr( $filename, 0, strrpos( $filename, '.' ) ); 57 } 113 58 114 $listing.= get_dirs( ".", "", 0 ); 59 function is_image( $filename ) 60 { 61 global $conf; 115 62 116 if ( $fp = @fopen("./listing.xml","w") ) 117 { 118 fwrite( $fp, $listing ); 119 fclose( $fp ); 120 } 121 else 122 { 123 echo "impossible de créer ou d'écrire dans le fichier listing.xml"; 124 } 63 if ( !is_dir( $filename ) 64 and in_array( get_extension( $filename ), $conf['picture_ext'] ) ) 65 { 66 return true; 67 } 68 return false; 69 } 125 70 126 //echo str_replace( "\t", " ", nl2br( htmlspecialchars( $listing, ENT_QUOTES ) ) ); 127 echo "listing.xml created"; 71 function TN_exists( $dir, $file ) 72 { 73 global $conf, $prefixe_thumbnail; 74 75 $titre = get_filename_wo_extension( $file ); 76 77 for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ ) 78 { 79 $base_tn_name = $dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.'; 80 $ext = $conf['picture_ext'][$i]; 81 if ( is_file( $base_tn_name.$ext ) ) 82 { 83 return $ext; 84 } 85 } 86 echo 'The thumbnail is missing for '.$dir.'/'.$file; 87 echo '-> '.$dir.'/thumbnail/'.$prefixe_thumbnail.$titre.'.xxx'; 88 echo ' ("xxx" can be : '; 89 for ( $i = 0; $i < sizeof ( $conf['picture_ext'] ); $i++ ) 90 { 91 if ( $i > 0 ) 92 { 93 echo ', '; 94 } 95 echo '"'.$conf['picture_ext'][$i].'"'; 96 } 97 echo ')<br />'; 98 return false; 99 } 100 101 function get_pictures( $rep, $indent ) 102 { 103 $pictures = array(); 104 105 $tn_ext = ''; 106 $root = ''; 107 if ( $opendir = opendir ( $rep ) ) 108 { 109 while ( $file = readdir ( $opendir ) ) 110 { 111 if ( is_image( $file ) and $tn_ext = TN_exists( $rep, $file ) ) 112 { 113 $picture = array(); 114 115 $picture['file'] = $file; 116 $picture['tn_ext'] = $tn_ext; 117 $picture['date'] = date('Y-m-d',filemtime( $rep.'/'.$file ) ); 118 $picture['filesize'] = floor( filesize( $rep."/".$file ) / 1024 ); 119 $image_size = @getimagesize( $rep."/".$file ); 120 $picture['width'] = $image_size[0]; 121 $picture['height'] = $image_size[1]; 122 123 array_push( $pictures, $picture ); 124 } 125 } 126 } 127 // write of the node <root> with all the pictures at the root of the 128 // directory 129 $root.= "\n".$indent."<root>"; 130 if ( sizeof( $pictures ) > 0 ) 131 { 132 for( $i = 0; $i < sizeof( $pictures ); $i++ ) 133 { 134 $root.= "\n".$indent.' '; 135 $root.= '<picture'; 136 $root.= ' file="'. $pictures[$i]['file']. '"'; 137 $root.= ' tn_ext="'. $pictures[$i]['tn_ext']. '"'; 138 $root.= ' date="'. $pictures[$i]['date']. '"'; 139 $root.= ' filesize="'. $pictures[$i]['filesize']. '"'; 140 $root.= ' width="'. $pictures[$i]['width']. '"'; 141 $root.= ' height="'. $pictures[$i]['height']. '"'; 142 $root.= ' />'; 143 } 144 } 145 $root.= "\n".$indent.'</root>'; 146 return $root; 147 } 148 149 $listing.= get_dirs( '.', '', 0 ); 150 151 if ( $fp = @fopen("./listing.xml","w") ) 152 { 153 fwrite( $fp, $listing ); 154 fclose( $fp ); 155 } 156 else 157 { 158 echo "I can't write the file listing.xml"; 159 } 160 161 echo "listing.xml created"; 128 162 ?> -
trunk/admin/edit_cat.php
r2 r10 19 19 if ( $HTTP_GET_VARS['valider'] == 1 ) 20 20 { 21 $query = "update $prefixeTable"."categories ";21 $query = "update PREFIX_TABLE"."categories "; 22 22 if ( $HTTP_POST_VARS['name'] == "" ) 23 23 { … … 40 40 mysql_query( $query ); 41 41 42 $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );42 $result = mysql_query( "select id from PREFIX_TABLE"."users where pseudo != '".$conf['webmaster']."';" ); 43 43 while ( $row = mysql_fetch_array ( $result ) ) 44 44 { … … 53 53 <table style=\"width:100%;\">"; 54 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";55 $query.= " from PREFIX_TABLE"."categories as a, PREFIX_TABLE"."sites as b"; 56 56 $query.= " where a.id = ".$HTTP_GET_VARS['cat']; 57 57 $query.= " and a.site_id = b.id;"; … … 87 87 // par l'intermédiaire de la fonction get_enums trouvable 88 88 // dans le fichier config.php 89 $option = get_enums( $prefixeTable."categories", "status" );89 $option = get_enums( PREFIX_TABLE."categories", "status" ); 90 90 for ( $i = 0; $i < sizeof( $option ); $i++ ) 91 91 { -
trunk/admin/historique.php
r2 r10 19 19 if ( $HTTP_GET_VARS['empty'] == 1 ) 20 20 { 21 mysql_query( "delete from $prefixeTable"."history;" );21 mysql_query( "delete from PREFIX_TABLE"."history;" ); 22 22 } 23 23 define (NB_JOUR_HISTO,"7"); … … 29 29 // time (); nous donne le nombre de secondes actuelle 30 30 $date_ref = time() - (7*24*60*60); 31 $result = mysql_query( "select date,login,IP,categorie,page,titre,commentaire from $prefixeTable"."history where date > '$date_ref' order by date desc;");31 $result = mysql_query( "select date,login,IP,categorie,page,titre,commentaire from PREFIX_TABLE"."history where date > '$date_ref' order by date desc;"); 32 32 echo"<div style=\"text-align:center;\"><a href=\"".add_session_id_to_url( "./admin.php?page=historique&empty=1" )."\">empty / vider</a></div>"; 33 33 echo"<div style=\"color:green;text-align:center;margin:10px\">"; … … 72 72 // 2. affichage de tous les évènements pour le jour donné 73 73 // entre la veille à 23h59m59s et le jour même 23h59m59s 74 $result = mysql_query("select date,login,IP,categorie,page,titre,commentaire from $prefixeTable"."history where date > '$debut' and date < '$fin' order by date desc;");74 $result = mysql_query("select date,login,IP,categorie,page,titre,commentaire from PREFIX_TABLE"."history where date > '$debut' and date < '$fin' order by date desc;"); 75 75 $fin = $debut; 76 76 // on recule le début d'une journée complète -
trunk/admin/infos_images.php
r2 r10 54 54 // 1. options individuelles 55 55 $query = "select id,file "; 56 $query.= "from $prefixeTable"."images ";56 $query.= "from PREFIX_TABLE"."images "; 57 57 $query.= "where cat_id = ".$page['cat']." "; 58 58 $result = mysql_query( $query ); … … 66 66 if ( isset( $HTTP_POST_VARS[$name] ) ) 67 67 { 68 $query = "update $prefixeTable"."images ";68 $query = "update PREFIX_TABLE"."images "; 69 69 if ( $HTTP_POST_VARS[$name] == "" ) 70 70 { … … 107 107 if ( $HTTP_POST_VARS['use_common_author'] == 1 ) 108 108 { 109 $query = "update $prefixeTable"."images ";109 $query = "update PREFIX_TABLE"."images "; 110 110 if ( $HTTP_POST_VARS['author_cat'] == "" ) 111 111 { … … 126 126 { 127 127 $date = date_convert( $HTTP_POST_VARS['date_creation_cat'] ); 128 $query = "update $prefixeTable"."images ";128 $query = "update PREFIX_TABLE"."images "; 129 129 if ( $HTTP_POST_VARS['date_creation_cat'] == "" ) 130 130 { … … 201 201 </tr>"; 202 202 $query = "select id,file,comment,author,tn_ext,name,date_creation"; 203 $query.= " from $prefixeTable"."images";203 $query.= " from PREFIX_TABLE"."images"; 204 204 $query.= " where cat_id = ".$page['cat']; 205 205 $query.= $conf['order_by']; -
trunk/admin/install.php
r2 r10 15 15 * * 16 16 ***************************************************************************/ 17 18 19 17 function header_install() 18 { 19 $output = " 20 20 <html> 21 21 <head> … … 126 126 <tr> 127 127 <td class=\"contenucellule\">"; 128 129 128 return $output; 129 } 130 130 131 132 133 131 function footer_install() 132 { 133 $output = " 134 134 </td> 135 135 </tr> … … 140 140 </body> 141 141 </html>"; 142 143 142 return $output; 143 } 144 144 145 146 147 148 149 150 145 if ( isset( $HTTP_GET_VARS['language'] ) ) 146 { 147 $isadmin = true; 148 $lang = array(); 149 include( "../language/".$HTTP_GET_VARS['language'].".php" ); 150 } 151 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 152 /*---------------------------------------Step 1------------------------------------*/ 153 if ( $HTTP_GET_VARS['step'] == 1 ) 154 { 155 $erreur1 = true; 156 $message = ""; 157 // création du fichier de configuration de connexion à la BD mysql 158 if( isset( $HTTP_POST_VARS['cfgBase'] ) && isset( $HTTP_POST_VARS['cfgUser'] ) && isset( $HTTP_POST_VARS['cfgPassword'] ) && isset( $HTTP_POST_VARS['cfgHote'] ) ) 159 { 160 if ( @mysql_connect( $HTTP_POST_VARS['cfgHote'], $HTTP_POST_VARS['cfgUser'], $HTTP_POST_VARS['cfgPassword'] ) ) 161 { 162 if ( @mysql_select_db($HTTP_POST_VARS['cfgBase'] ) ) 163 { 164 $message.= "<div class=\"info\">".$lang['step1_confirmation']."</div>"; 165 $erreur1 = false; 166 } 167 else 168 { 169 $message.= "<div class=\"erreur\">".$lang['step1_err_db']."</div>"; 170 } 171 } 172 else 173 { 174 $message.= "<div class=\"erreur\">".$lang['step1_err_server']."</div>"; 175 } 176 176 177 178 179 180 181 182 fwrite( $fp, "<?php\n\t\$cfgBase='".$HTTP_POST_VARS['cfgBase']."';\n\t\$cfgUser='".$HTTP_POST_VARS['cfgUser']."';\n\t\$cfgPassword='".$HTTP_POST_VARS['cfgPassword']."';\n\t\$cfgHote='".$HTTP_POST_VARS['cfgHote']."';\n\t\$prefixeTable='".$HTTP_POST_VARS['prefixe']."';\n?>" );183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 177 if ( !$erreur1 ) 178 { 179 // écriture du fichier de configuration 180 if ( $fp = @fopen("../include/mysql.inc.php","a+") ) 181 { 182 fwrite( $fp, "<?php\n\t\$cfgBase='".$HTTP_POST_VARS['cfgBase']."';\n\t\$cfgUser='".$HTTP_POST_VARS['cfgUser']."';\n\t\$cfgPassword='".$HTTP_POST_VARS['cfgPassword']."';\n\t\$cfgHote='".$HTTP_POST_VARS['cfgHote']."';\n\t\PREFIX_TABLE='".$HTTP_POST_VARS['prefixe']."';\n?>" ); 183 fclose( $fp ); 184 } 185 $cfgHote = ""; 186 $cfgUser = ""; 187 $cfgPassword = ""; 188 $cfgBase = ""; 189 include ( "../include/mysql.inc.php" ); 190 $erreur2 = true; 191 if ( @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) ) 192 { 193 if ( @mysql_select_db ( $cfgBase ) ) 194 { 195 $erreur2 = false; 196 } 197 } 198 if ( $erreur2 ) 199 { 200 $message.="<br /><br />".$lang['step1_err_copy']." :<br /> 201 201 -----------------------------------------------------<br /> 202 202 <div style=\"color:blue;\"><?php<br /> … … 205 205 \$cfgPassword = '".$HTTP_POST_VARS['cfgPassword']."';<br /> 206 206 \$cfgHote = '".$HTTP_POST_VARS['cfgHote']."';<br /> 207 \ $prefixeTable= '".$HTTP_POST_VARS['prefixe']."';<br />207 \PREFIX_TABLE = '".$HTTP_POST_VARS['prefixe']."';<br /> 208 208 ?></div> 209 209 -----------------------------------------------------<br />"; 210 211 212 213 214 215 216 217 218 219 220 221 222 210 $message.= "<div style=\"text-align:center;\">".$lang['step1_err_copy_2']."<br />"; 211 $message.= "<a href=\"install.php?step=2&language=".$HTTP_GET_VARS['language']."\">".$lang['step1_err_copy_next']."</a></div>"; 212 } 213 else 214 { 215 $url = "install.php?step=2&language=".$HTTP_GET_VARS['language']; 216 header("Request-URI: $url"); 217 header("Content-Location: $url"); 218 header("Location: $url"); 219 exit(); 220 } 221 } 222 } 223 223 224 225 226 227 224 echo header_install(); 225 if ( isset( $message ) && $message != "" ) 226 { 227 echo" 228 228 <table width=\"100%\"> 229 229 <tr> … … 234 234 </tr> 235 235 </table>"; 236 237 238 239 236 } 237 if ( $erreur1 ) 238 { 239 echo" 240 240 <form method=\"post\" action=\"install.php?step=1&language=".$HTTP_GET_VARS['language']."\"> 241 241 <table width=\"100%\"> … … 249 249 <td>".$lang['step1_host']."</td> 250 250 <td align=center><input type='text' name='cfgHote' value='"; 251 252 253 254 255 256 257 258 259 251 if ( !isset( $HTTP_POST_VARS['cfgHote'] ) ) 252 { 253 echo"localhost"; 254 } 255 else 256 { 257 echo $HTTP_POST_VARS['cfgHote']; 258 } 259 echo"'></td> 260 260 <td class=\"row2\">".$lang['step1_host_info']."</td> 261 261 </tr> … … 278 278 <td>".$lang['step1_prefix']."</td> 279 279 <td align=center><input type='text' name='prefixe' value='"; 280 281 282 283 284 285 286 287 288 280 if ( !isset( $HTTP_POST_VARS['prefixe'] ) ) 281 { 282 echo"phpwebgallery_"; 283 } 284 else 285 { 286 echo $HTTP_POST_VARS['prefixe']; 287 } 288 echo"'></td> 289 289 <td class=\"row2\">".$lang['step1_prefix_info']."</td> 290 290 </tr> … … 297 297 </table> 298 298 </form>"; 299 300 301 302 303 304 305 306 307 299 } 300 echo footer_install(); 301 } 302 /*---------------------------------------Step 2------------------------------------*/ 303 else if ( $HTTP_GET_VARS['step'] == 2 ) 304 { 305 include( "../include/mysql.inc.php" ); 306 mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or die ( "erreur de connexion au serveur" ); 307 mysql_select_db( $cfgBase ) or die ( "erreur de connexion a la base de donnees" ); 308 308 309 310 311 $query = "CREATE TABLE ".$prefixeTable."categories (309 if ( !isset( $HTTP_POST_VARS['submit'] ) ) 310 { 311 $query = "CREATE TABLE ".PREFIX_TABLE."categories ( 312 312 id tinyint(3) unsigned NOT NULL auto_increment, 313 313 date_dernier date NOT NULL default '0000-00-00', … … 322 322 PRIMARY KEY (id) 323 323 );"; 324 325 $query = "CREATE TABLE ".$prefixeTable."comments (324 mysql_query( $query ); 325 $query = "CREATE TABLE ".PREFIX_TABLE."comments ( 326 326 id int(11) unsigned NOT NULL auto_increment, 327 327 image_id smallint(5) unsigned NOT NULL default '0', … … 331 331 PRIMARY KEY (id) 332 332 );"; 333 334 $query = "CREATE TABLE ".$prefixeTable."config (333 mysql_query( $query ); 334 $query = "CREATE TABLE ".PREFIX_TABLE."config ( 335 335 periode_courte smallint(5) unsigned NOT NULL default '7', 336 336 periode_longue smallint(5) unsigned NOT NULL default '14', … … 353 353 upload_maxheight_thumbnail smallint(5) unsigned NOT NULL default '100' 354 354 );"; 355 356 $query = "CREATE TABLE ".$prefixeTable."favorites (355 mysql_query( $query ); 356 $query = "CREATE TABLE ".PREFIX_TABLE."favorites ( 357 357 user_id smallint(5) unsigned NOT NULL default '0', 358 358 image_id smallint(5) unsigned NOT NULL default '0', 359 359 KEY user_id (user_id,image_id) 360 360 );"; 361 362 $query = "CREATE TABLE ".$prefixeTable."history (361 mysql_query( $query ); 362 $query = "CREATE TABLE ".PREFIX_TABLE."history ( 363 363 date int(11) NOT NULL default '0', 364 364 login varchar(15) default NULL, … … 369 369 commentaire varchar(200) default NULL 370 370 );"; 371 372 $query = "CREATE TABLE ".$prefixeTable."images (371 mysql_query( $query ); 372 $query = "CREATE TABLE ".PREFIX_TABLE."images ( 373 373 id smallint(5) unsigned NOT NULL auto_increment, 374 374 file varchar(255) NOT NULL default '', … … 387 387 KEY cat_id (cat_id) 388 388 );"; 389 390 $query = "CREATE TABLE ".$prefixeTable."restrictions (389 mysql_query( $query ); 390 $query = "CREATE TABLE ".PREFIX_TABLE."restrictions ( 391 391 user_id smallint(5) unsigned NOT NULL default '0', 392 392 cat_id tinyint(3) unsigned NOT NULL default '0', 393 393 PRIMARY KEY (user_id,cat_id) 394 394 );"; 395 396 $query = "CREATE TABLE ".$prefixeTable."sessions (395 mysql_query( $query ); 396 $query = "CREATE TABLE ".PREFIX_TABLE."sessions ( 397 397 id varchar(255) binary NOT NULL default '', 398 398 user_id smallint(5) unsigned NOT NULL default '0', … … 401 401 PRIMARY KEY (id) 402 402 );"; 403 404 $query = "CREATE TABLE ".$prefixeTable."sites (403 mysql_query( $query ); 404 $query = "CREATE TABLE ".PREFIX_TABLE."sites ( 405 405 id tinyint(4) NOT NULL auto_increment, 406 406 galleries_url varchar(255) NOT NULL default '', … … 408 408 UNIQUE KEY galleries_url (galleries_url) 409 409 );"; 410 411 $query = "CREATE TABLE ".$prefixeTable."users (410 mysql_query( $query ); 411 $query = "CREATE TABLE ".PREFIX_TABLE."users ( 412 412 id smallint(5) unsigned NOT NULL auto_increment, 413 413 pseudo varchar(20) binary NOT NULL default '', … … 424 424 UNIQUE KEY pseudo (pseudo) 425 425 );"; 426 427 $query = "CREATE TABLE ".$prefixeTable."waiting (426 mysql_query( $query ); 427 $query = "CREATE TABLE ".PREFIX_TABLE."waiting ( 428 428 id int(10) unsigned NOT NULL auto_increment, 429 429 cat_id tinyint(3) unsigned NOT NULL default '0', … … 435 435 PRIMARY KEY (id) 436 436 );"; 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 mysql_query( "delete from $prefixeTable"."config" );483 $query = "insert into $prefixeTable"."config (webmaster,mail_webmaster) values ('$webmaster','".$HTTP_POST_VARS['mail_webmaster']."')";484 485 $query = "insert into $prefixeTable"."sites values (1, './galleries/');";486 487 $query = "insert into $prefixeTable"."users (pseudo,password,status,language) values ('$webmaster','".md5( $pwdWebmaster )."','admin','".$HTTP_GET_VARS['language']."')";488 489 mysql_query("insert into $prefixeTable"."users (pseudo,password,status,language) values ('visiteur','".md5( "" )."','visiteur','".$HTTP_GET_VARS['language']."')");490 491 492 437 mysql_query( $query ); 438 } 439 if ( isset( $HTTP_POST_VARS['submit'] ) ) 440 { 441 $configuration = false; 442 $erreur = ""; 443 $nb_erreur = 0; 444 // le pseudo du webmaster ne doit pas 445 // 1. être vide 446 // 2. commencer ou se terminer par un espace 447 // 3. comporter les caractères ' ou " 448 // Notes sur le pseudo du webmaster : 449 // - lorsque l'on trouve plusieurs occurences 450 // consécutives du caractère espace, on réduit à une seule occurence 451 if ( $HTTP_POST_VARS['webmaster'] == "" ) 452 { 453 $erreur .= "<li>".$lang['step2_err_login1']."</li>"; 454 $nb_erreur++; 455 } 456 $webmaster = ereg_replace( "[ ]{2,}", " ", $HTTP_POST_VARS['webmaster'] ); 457 if ( ereg( "^.* $", $webmaster ) || ereg( "^ .*$", $webmaster) ) 458 { 459 $erreur .= "<li>".$lang['step2_err_login2']."</li>"; 460 $nb_erreur++; 461 } 462 if ( ereg( "'",$webmaster ) || ereg( "\"",$webmaster ) ) 463 { 464 $erreur .= "<li>".$lang['step2_err_login3']."</li>"; 465 $nb_erreur++; 466 } 467 // on vérifie que le password rentré correspond bien à la confirmation faite par l'utilisateur 468 if ( $HTTP_POST_VARS['pwdWebmaster'] != $HTTP_POST_VARS['pwdWebmasterConf'] ) 469 { 470 $erreur .= "<li>".$lang['step2_err_pass']."</li>"; 471 $nb_erreur++; 472 } 473 // le mail doit être conforme à qqch du type : nom@serveur.com 474 if( !ereg("([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+)", $HTTP_POST_VARS['mail_webmaster'] ) ) 475 { 476 $erreur .= "<li>".$lang['step2_err_mail']."</li>"; 477 $nb_erreur++; 478 } 479 // on met à jour les paramètres de l'application dans le cas où il n'y aucune erreur 480 if ( $nb_erreur == 0 ) 481 { 482 mysql_query( "delete from PREFIX_TABLE"."config" ); 483 $query = "insert into PREFIX_TABLE"."config (webmaster,mail_webmaster) values ('$webmaster','".$HTTP_POST_VARS['mail_webmaster']."')"; 484 mysql_query($query); 485 $query = "insert into PREFIX_TABLE"."sites values (1, './galleries/');"; 486 mysql_query($query); 487 $query = "insert into PREFIX_TABLE"."users (pseudo,password,status,language) values ('$webmaster','".md5( $pwdWebmaster )."','admin','".$HTTP_GET_VARS['language']."')"; 488 mysql_query($query); 489 mysql_query("insert into PREFIX_TABLE"."users (pseudo,password,status,language) values ('visiteur','".md5( "" )."','visiteur','".$HTTP_GET_VARS['language']."')"); 490 $configuration = true; 491 } 492 } 493 493 494 495 496 497 494 echo header_install(); 495 if ( $configuration ) 496 { 497 echo" 498 498 <table width=\"100%\"> 499 499 <tr> … … 507 507 </tr> 508 508 </table>"; 509 510 511 512 513 514 509 } 510 else 511 { 512 if ( $nb_erreur > 0 ) 513 { 514 echo" 515 515 <table width=100%> 516 516 <tr> … … 527 527 </tr> 528 528 </table>"; 529 530 529 } 530 echo" 531 531 <form method=\"post\" action=\"install.php?step=2&language=".$HTTP_GET_VARS['language']."\"> 532 532 <table width=100%> … … 567 567 </table> 568 568 </form>"; 569 570 571 572 573 574 575 576 577 569 } 570 echo footer_install(); 571 } 572 /*----------------------------------Language choice------------------------------------*/ 573 else 574 { 575 include( "../include/functions.php" ); 576 echo header_install(); 577 echo" 578 578 <form method=\"get\" action=\"install.php\"> 579 579 <input type=\"hidden\" name=\"step\" value=\"1\"/> … … 582 582 <td align=\"center\"> 583 583 <select name=\"language\">"; 584 585 586 587 584 $languages = get_languages( "../language/" ); 585 for ( $i = 0; $i < sizeof ( $languages ); $i++ ) 586 { 587 echo" 588 588 <option>".$languages[$i]."</option>"; 589 590 589 } 590 echo" 591 591 </select> 592 592 <input type=\"submit\" value=\"Go\"> … … 595 595 </table> 596 596 </form>"; 597 598 597 echo footer_install(); 598 } 599 599 ?> -
trunk/admin/perm.php
r2 r10 19 19 if ( isset( $HTTP_GET_VARS['user_id'] ) ) 20 20 { 21 $query = "select id,pseudo,status from $prefixeTable"."users where id = '".$HTTP_GET_VARS['user_id']."';";21 $query = "select id,pseudo,status from PREFIX_TABLE"."users where id = '".$HTTP_GET_VARS['user_id']."';"; 22 22 $result = mysql_query( $query ); 23 23 $row = mysql_fetch_array( $result ); … … 52 52 if ( isset( $HTTP_GET_VARS['user_id'] ) ) 53 53 { 54 mysql_query ( "delete from $prefixeTable"."restrictions where user_id = ".$HTTP_GET_VARS['user_id'].";" );55 $result = mysql_query ( "select id from $prefixeTable"."categories;" );54 mysql_query ( "delete from PREFIX_TABLE"."restrictions where user_id = ".$HTTP_GET_VARS['user_id'].";" ); 55 $result = mysql_query ( "select id from PREFIX_TABLE"."categories;" ); 56 56 while ( $row = mysql_fetch_array ( $result ) ) 57 57 { … … 59 59 if ( $HTTP_POST_VARS[$nom_select] == 1 ) 60 60 { 61 mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$HTTP_GET_VARS['user_id']."','".$row['id']."');" );61 mysql_query ( "insert into PREFIX_TABLE"."restrictions (user_id,cat_id) values ('".$HTTP_GET_VARS['user_id']."','".$row['id']."');" ); 62 62 } 63 63 } … … 67 67 else if ( isset( $HTTP_GET_VARS['cat_id'] ) ) 68 68 { 69 mysql_query ( "delete from $prefixeTable"."restrictions where cat_id = '".$page['cat']."';" );70 $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );69 mysql_query ( "delete from PREFIX_TABLE"."restrictions where cat_id = '".$page['cat']."';" ); 70 $result = mysql_query( "select id from PREFIX_TABLE"."users where pseudo != '".$conf['webmaster']."';" ); 71 71 while ( $row = mysql_fetch_array ( $result ) ) 72 72 { … … 74 74 if ( $HTTP_POST_VARS[$nom_select] == 1 ) 75 75 { 76 mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$row['id']."','".$page['cat']."');" );76 mysql_query ( "insert into PREFIX_TABLE"."restrictions (user_id,cat_id) values ('".$row['id']."','".$page['cat']."');" ); 77 77 } 78 78 check_favorites( $row['id'] ); … … 84 84 function display_cat_manager( $id_uppercat, $indent, $uppercat_authorized, $level, $restriction ) 85 85 { 86 global $prefixeTable,$lang,$conf;86 global PREFIX_TABLE,$lang,$conf; 87 87 88 88 $output = ""; … … 122 122 123 123 $query = "select id,name,dir,rank"; 124 $query.= " from $prefixeTable"."categories";124 $query.= " from PREFIX_TABLE"."categories"; 125 125 if ( !is_numeric( $id_uppercat ) ) 126 126 { … … 215 215 <table style=\"width:100%;\">"; 216 216 217 $result = mysql_query( "select id,pseudo,status from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" );217 $result = mysql_query( "select id,pseudo,status from PREFIX_TABLE"."users where pseudo != '".$conf['webmaster']."';" ); 218 218 $i = 0; 219 219 while ( $row = mysql_fetch_array( $result ) ) -
trunk/admin/user_add.php
r9 r10 64 64 $_POST['status'] = 'guest'; 65 65 } 66 $option = get_enums( $prefixeTable.'users', 'status' );66 $option = get_enums( PREFIX_TABLE.'users', 'status' ); 67 67 for ( $i = 0; $i < sizeof( $option ); $i++ ) 68 68 { -
trunk/admin/user_list.php
r9 r10 42 42 { 43 43 $query = 'select username'; 44 $query.= ' from '. $prefixeTable.'users';44 $query.= ' from '.PREFIX_TABLE.'users'; 45 45 $query.= ' where id = '.$_GET['delete']; 46 46 $query.= ';'; … … 66 66 { 67 67 $query = 'select count(*) as nb_result'; 68 $query.= ' from '. $prefixeTable.'users';68 $query.= ' from '.PREFIX_TABLE.'users'; 69 69 $query.= ' where id = '.$_GET['delete']; 70 70 $query.= ';'; … … 104 104 105 105 $query = 'select id,username,status,mail_address'; 106 $query.= ' from '. $prefixeTable.'users';106 $query.= ' from '.PREFIX_TABLE.'users'; 107 107 $query.= ' order by status asc, username asc'; 108 108 $query.= ';'; … … 218 218 $query = 'select'; 219 219 $query.= ' id,mail_address'; 220 $query.= ' from '. $prefixeTable.'users';220 $query.= ' from '.PREFIX_TABLE.'users'; 221 221 $query.= ';'; 222 222 $result = mysql_query( $query ); -
trunk/admin/user_modify.php
r9 r10 31 31 $query = 'select'; 32 32 $query.= ' username,status,mail_address'; 33 $query.= ' from '. $prefixeTable.'users';33 $query.= ' from '.PREFIX_TABLE.'users'; 34 34 $query.= ' where id = '.$_GET['user_id']; 35 35 $query.= ';'; … … 108 108 $_POST['status'] = 'guest'; 109 109 } 110 $option = get_enums( $prefixeTable.'users', 'status' );110 $option = get_enums( PREFIX_TABLE.'users', 'status' ); 111 111 for ( $i = 0; $i < sizeof( $option ); $i++ ) 112 112 { -
trunk/admin/waiting.php
r2 r10 20 20 { 21 21 $query = "select id,cat_id,file,tn_ext"; 22 $query.= " from $prefixeTable"."waiting";22 $query.= " from PREFIX_TABLE"."waiting"; 23 23 $query.= ";"; 24 24 $result = mysql_query( $query ); … … 28 28 if ( isset( $HTTP_POST_VARS[$key] ) ) 29 29 { 30 $query = "delete from $prefixeTable"."waiting";30 $query = "delete from PREFIX_TABLE"."waiting"; 31 31 $query.= " where id = ".$row['id']; 32 32 $query.= ";"; … … 60 60 </tr>"; 61 61 $query = "select id,cat_id,file,username,mail_address,date,tn_ext"; 62 $query.= " from $prefixeTable"."waiting";62 $query.= " from PREFIX_TABLE"."waiting"; 63 63 $query.= " order by cat_id"; 64 64 $query.= ";";
Note: See TracChangeset
for help on using the changeset viewer.