Changeset 13
- Timestamp:
- May 17, 2003, 1:42:03 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r12 r13 20 20 function is_image( $filename, $create_thumbnail = false ) 21 21 { 22 global $tab_ext_create_TN, $conf; 23 24 $is_image = false; 22 global $conf; 25 23 26 24 if ( is_file ( $filename ) ) … … 35 33 and ( $size[2] == 1 or $size[2] == 2 or $size[2] == 3 ) ) 36 34 { 37 $is_image =true;35 return true; 38 36 } 39 37 } … … 43 41 and ( $size[2] == 2 or $size[2] == 3 ) ) 44 42 { 45 $is_image =true;43 return true; 46 44 } 47 45 } 48 46 } 49 return $is_image;47 return false; 50 48 } 51 49 -
trunk/include/config.inc.php
r2 r13 21 21 $lang = array(); 22 22 23 include_once( PREFIXE_INCLUDE.'./include/mysql.inc.php' );24 23 include_once( PREFIXE_INCLUDE.'./include/functions.inc.php' ); 25 24 include_once( PREFIXE_INCLUDE.'./include/vtemplate.class.php' ); 26 // 25 27 26 // How to change the order of display for images in a category ? 28 27 // … … 47 46 $conf['site_url'] = 'http://www.phpwebgallery.net'; 48 47 $conf['forum_url'] = 'http://forum.phpwebgallery.net'; 48 $conf['picture_ext'] = array ( 'jpg','JPG','gif','GIF','png','PNG' ); 49 $conf['document_ext'] = array( 'doc','pdf','zip' ); 49 50 50 51 database_connection(); … … 74 75 $query.= $infos[$i]; 75 76 } 76 $query .= ' from '. $prefixeTable.'config;';77 $query .= ' from '.PREFIX_TABLE.'config;'; 77 78 78 79 $row = mysql_fetch_array( mysql_query( $query ) ); -
trunk/include/functions.inc.php
r9 r13 18 18 include( 'functions_session.inc.php' ); 19 19 include( 'functions_category.inc.php' ); 20 include( 'functions_xml.inc.php' ); 20 21 21 22 //----------------------------------------------------------- generic functions … … 129 130 } 130 131 132 // get_extension returns the part of the string after the last "." 133 function get_extension( $filename ) 134 { 135 return substr( strrchr( $filename, '.' ), 1, strlen ( $filename ) ); 136 } 137 138 // get_filename_wo_extension returns the part of the string before the last 139 // ".". 140 // get_filename_wo_extension( 'test.tar.gz' ) -> 'test.tar' 141 function get_filename_wo_extension( $filename ) 142 { 143 return substr( $filename, 0, strrpos( $filename, '.' ) ); 144 } 145 131 146 // get_dirs retourne un tableau contenant tous les sous-répertoires d'un 132 147 // répertoire … … 203 218 return $picture_size; 204 219 } 205 206 220 //-------------------------------------------- PhpWebGallery specific functions 207 221 … … 279 293 function database_connection() 280 294 { 281 global $cfgHote,$cfgUser,$cfgPassword,$cfgBase; 295 // $cfgHote,$cfgUser,$cfgPassword,$cfgBase; 296 297 $xml_content = getXmlCode( PREFIXE_INCLUDE.'./include/database_config.xml' ); 298 $mysql_conf = getChild( $xml_content, 'mysql' ); 299 300 $cfgHote = getAttribute( $mysql_conf, 'host' ); 301 $cfgUser = getAttribute( $mysql_conf, 'user' ); 302 $cfgPassword = getAttribute( $mysql_conf, 'password' ); 303 $cfgBase = getAttribute( $mysql_conf, 'base' ); 304 282 305 @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) 283 306 or die ( "Could not connect to server" ); 284 307 @mysql_select_db( $cfgBase ) 285 308 or die ( "Could not connect to database" ); 309 310 define( PREFIX_TABLE, getAttribute( $mysql_conf, 'tablePrefix' ) ); 286 311 } 287 312 288 313 function pwg_log( $file, $category, $picture = '' ) 289 314 { 290 global $conf, $user , $prefixeTable;315 global $conf, $user; 291 316 292 317 if ( $conf['log'] ) 293 318 { 294 $query = 'insert into '. $prefixeTable.'history';319 $query = 'insert into '.PREFIX_TABLE.'history'; 295 320 $query.= ' (date,login,IP,file,category,picture) values'; 296 321 $query.= " (".time().", '".$user['pseudo']."'"; -
trunk/include/functions_category.inc.php
r9 r13 17 17 function get_subcats_id( $cat_id ) 18 18 { 19 global $prefixeTable;20 21 19 $restricted_cat = array(); 22 20 $i = 0; 23 21 24 $query = "select id"; 25 $query.= " from $prefixeTable"."categories"; 26 $query.= " where id_uppercat = $cat_id;"; 22 $query = 'select id'; 23 $query.= ' from '.PREFIX_TABLE.'categories'; 24 $query.= ' where id_uppercat = '.$cat_id; 25 $query.= ';'; 27 26 $result = mysql_query( $query ); 28 27 while ( $row = mysql_fetch_array( $result ) ) … … 41 40 function check_restrictions( $category_id ) 42 41 { 43 global $user,$lang ,$prefixeTable;42 global $user,$lang; 44 43 45 44 if ( is_user_allowed( $category_id, $user['restrictions'] ) > 0 ) … … 58 57 function check_cat_id( $cat ) 59 58 { 60 global $page,$prefixeTable; 59 global $page; 60 61 61 unset( $page['cat'] ); 62 62 if ( isset( $cat ) ) … … 64 64 if ( is_numeric( $cat ) ) 65 65 { 66 $query = "select id from $prefixeTable"."categories where id = $cat;"; 66 $query = 'select id'; 67 $query.= ' from '.PREFIX_TABLE.'categories'; 68 $query.= ' where id = '.$cat; 69 $query. ';'; 67 70 $result = mysql_query( $query ); 68 71 if ( mysql_num_rows( $result ) != 0 ) … … 81 84 function display_cat( $id_uppercat, $indent, $restriction, $tab_expand ) 82 85 { 83 global $ prefixeTable,$user,$lang,$conf,$page,$vtp,$handle;86 global $user,$lang,$conf,$page,$vtp,$handle; 84 87 85 88 $query = 'select name,id,date_dernier,nb_images,dir'; 86 $query.= ' from '. $prefixeTable.'categories';89 $query.= ' from '.PREFIX_TABLE.'categories'; 87 90 $query.= ' where id_uppercat'; 88 91 if ( $id_uppercat == "" ) … … 202 205 function get_nb_subcats( $id ) 203 206 { 204 global $ prefixeTable,$user;207 global $user; 205 208 206 209 $query = 'select count(*) as count'; 207 $query.= ' from '. $prefixeTable.'categories';210 $query.= ' from '.PREFIX_TABLE.'categories'; 208 211 $query.= ' where id_uppercat = '.$id; 209 212 for ( $i = 0; $i < sizeof( $user['restrictions'] ); $i++ ) … … 219 222 function get_total_image( $id, $restriction ) 220 223 { 221 global $prefixeTable;222 223 224 $total = 0; 224 225 225 226 $query = 'select id,nb_images'; 226 $query.= ' from '. $prefixeTable.'categories';227 $query.= ' from '.PREFIX_TABLE.'categories'; 227 228 $query.= ' where id_uppercat'; 228 229 if ( !is_numeric( $id ) ) … … 260 261 function get_cat_info( $id ) 261 262 { 262 global $prefixeTable;263 264 263 $cat = array(); 265 264 $cat['name'] = array(); 266 265 267 266 $query = 'select nb_images,id_uppercat,comment,site_id,galleries_url,dir'; 268 $query.= ' from '. $prefixeTable.'categories as a';269 $query.= ', '. $prefixeTable.'sites as b';267 $query.= ' from '.PREFIX_TABLE.'categories as a'; 268 $query.= ', '.PREFIX_TABLE.'sites as b'; 270 269 $query.= ' where a.id = '.$id; 271 270 $query.= ' and a.site_id = b.id;'; … … 285 284 { 286 285 $query = 'select name,dir,id_uppercat'; 287 $query.= ' from '. $prefixeTable.'categories';286 $query.= ' from '.PREFIX_TABLE.'categories'; 288 287 $query.= ' where id = '.$row['id_uppercat'].';'; 289 288 $row = mysql_fetch_array( mysql_query( $query ) ); … … 360 359 function initialize_category( $calling_page = 'category' ) 361 360 { 362 global $p refixeTable,$page,$lang,$user,$conf;361 global $page,$lang,$user,$conf; 363 362 364 363 if ( isset( $page['cat'] ) ) … … 398 397 399 398 $query = 'select count(*) as nb_total_images'; 400 $query.= ' from '. $prefixeTable.'images';399 $query.= ' from '.PREFIX_TABLE.'images'; 401 400 $query.= $page['where']; 402 401 $query.= ';'; … … 409 408 $page['title'] = $lang['favorites']; 410 409 411 $page['where'] = ', '. $prefixeTable.'favorites';410 $page['where'] = ', '.PREFIX_TABLE.'favorites'; 412 411 $page['where'].= ' where user_id = '.$user['id']; 413 412 $page['where'].= ' and image_id = id'; 414 413 415 414 $query = 'select count(*) as nb_total_images'; 416 $query.= ' from '. $prefixeTable.'favorites';415 $query.= ' from '.PREFIX_TABLE.'favorites'; 417 416 $query.= ' where user_id = '.$user['id']; 418 417 $query.= ';'; … … 429 428 430 429 $query = 'select count(*) as nb_total_images'; 431 $query.= ' from '. $prefixeTable.'images';430 $query.= ' from '.PREFIX_TABLE.'images'; 432 431 $query.= $page['where']; 433 432 $query.= ';'; -
trunk/include/functions_session.inc.php
r9 r13 37 37 $key .= chr( mt_rand( 65, 90 ) ); 38 38 } 39 else if ( $c == 1 )40 41 42 39 else if ( $c == 1 ) 40 { 41 $key .= chr( mt_rand( 97, 122 ) ); 42 } 43 43 else 44 44 { … … 51 51 function session_create( $username ) 52 52 { 53 global $conf ,$prefixeTable,$REMOTE_ADDR;53 global $conf; 54 54 // 1. searching an unused sesison key 55 55 $id_found = false; … … 58 58 $generated_id = generate_key(); 59 59 $query = 'select id'; 60 $query.= ' from '. $prefixeTable.'sessions';60 $query.= ' from '.PREFIX_TABLE.'sessions'; 61 61 $query.= " where id = '".$generated_id."';"; 62 62 $result = mysql_query( $query ); … … 68 68 // 2. retrieving id of the username given in parameter 69 69 $query = 'select id'; 70 $query.= ' from '. $prefixeTable.'users';70 $query.= ' from '.PREFIX_TABLE.'users'; 71 71 $query.= " where username = '".$username."';"; 72 72 $row = mysql_fetch_array( mysql_query( $query ) ); 73 73 $user_id = $row['id']; 74 74 // 3. inserting session in database 75 $expiration = $conf['session_time'] *60+time();76 $query = 'insert into '. $prefixeTable.'sessions';75 $expiration = $conf['session_time'] * 60 + time(); 76 $query = 'insert into '.PREFIX_TABLE.'sessions'; 77 77 $query.= ' (id,user_id,expiration,ip) values'; 78 78 $query.= "('".$generated_id."','".$user_id; 79 $query.= "','".$expiration."','".$ REMOTE_ADDR."');";79 $query.= "','".$expiration."','".$_SERVER['REMOTE_ADDR']."');"; 80 80 mysql_query( $query ); 81 81 -
trunk/include/functions_user.inc.php
r9 r13 39 39 $login, $password, $password_conf, $mail_address, $status = 'guest' ) 40 40 { 41 global $ prefixeTable, $lang;41 global $lang; 42 42 43 43 $error = array(); … … 67 67 { 68 68 $query = 'select id'; 69 $query.= ' from '. $prefixeTable.'users';69 $query.= ' from '.PREFIX_TABLE.'users'; 70 70 $query.= " where username = '".$login."';"; 71 71 $result = mysql_query( $query ); … … 107 107 $query.= $infos[$i]; 108 108 } 109 $query.= ' from '. $prefixeTable.'users';109 $query.= ' from '.PREFIX_TABLE.'users'; 110 110 $query.= " where username = 'guest';"; 111 111 $row = mysql_fetch_array( mysql_query( $query ) ); 112 112 // 2. adding new user 113 $query = 'insert into '. $prefixeTable.'users';113 $query = 'insert into '.PREFIX_TABLE.'users'; 114 114 $query.= ' ('; 115 115 $query.= ' username,password,mail_address,status'; … … 146 146 // 3. retrieving the id of the newly created user 147 147 $query = 'select id'; 148 $query.= ' from '. $prefixeTable.'users';148 $query.= ' from '.PREFIX_TABLE.'users'; 149 149 $query.= " where username = '".$login."';"; 150 150 $row = mysql_fetch_array( mysql_query( $query ) ); … … 152 152 // 4. adding restrictions to the new user, the same as the user "guest" 153 153 $query = 'select cat_id'; 154 $query.= ' from '. $prefixeTable.'restrictions as r';155 $query.= ','. $prefixeTable.'users as u ';154 $query.= ' from '.PREFIX_TABLE.'restrictions as r'; 155 $query.= ','.PREFIX_TABLE.'users as u '; 156 156 $query.= ' where u.id = r.user_id'; 157 157 $query.= " and u.username = 'guest';"; … … 159 159 while( $row = mysql_fetch_array( $result ) ) 160 160 { 161 $query = 'insert into '. $prefixeTable.'restrictions';161 $query = 'insert into '.PREFIX_TABLE.'restrictions'; 162 162 $query.= ' (user_id,cat_id) values'; 163 163 $query.= ' ('.$user_id.','.$row['cat_id'].');'; … … 171 171 $use_new_password = false, $password = '' ) 172 172 { 173 global $prefixeTable;174 175 173 $error = array(); 176 174 $i = 0; … … 184 182 if ( sizeof( $error ) == 0 ) 185 183 { 186 $query = 'update '. $prefixeTable.'users';184 $query = 'update '.PREFIX_TABLE.'users'; 187 185 $query.= " set status = '".$status."'"; 188 186 if ( $use_new_password ) … … 225 223 function get_restrictions( $user_id, $user_status, $check_invisible ) 226 224 { 227 global $prefixeTable;228 229 225 // 1. getting the ids of the restricted categories 230 $query = "select cat_id"; 231 $query.= " from $prefixeTable"."restrictions"; 232 $query.= " where user_id = $user_id;"; 226 $query = 'select cat_id'; 227 $query.= ' from '.PREFIX_TABLE.'restrictions'; 228 $query.= ' where user_id = '.$user_id; 229 $query.= ';'; 233 230 $result = mysql_query( $query ); 234 231 $i = 0; … … 244 241 { 245 242 $query = 'select id'; 246 $query.= ' from '. $prefixeTable.'categories';243 $query.= ' from '.PREFIX_TABLE.'categories'; 247 244 $query.= " where status='invisible';"; 248 245 $result = mysql_query( $query ); … … 261 258 function get_all_restrictions( $user_id, $user_status ) 262 259 { 263 global $prefixeTable;264 265 260 $restricted_cat = get_restrictions( $user_id, $user_status, true ); 266 261 $i = sizeof( $restricted_cat ); … … 282 277 function is_user_allowed( $category_id, $restrictions ) 283 278 { 284 global $user ,$prefixeTable;279 global $user; 285 280 286 281 $lowest_category_id = $category_id; … … 289 284 while ( !$is_root and !in_array( $category_id, $restrictions ) ) 290 285 { 291 $query = "select id_uppercat"; 292 $query.= " from $prefixeTable"."categories"; 293 $query.= " where id = $category_id;"; 286 $query = 'select id_uppercat'; 287 $query.= ' from '.PREFIX_TABLE.'categories'; 288 $query.= ' where id = '.$category_id; 289 $query.= ';'; 294 290 $row = mysql_fetch_array( mysql_query( $query ) ); 295 291 if ( $row['id_uppercat'] == "" ) -
trunk/include/user.inc.php
r9 r13 38 38 $query_user.= $infos[$i]; 39 39 } 40 $query_user.= ' from '. $prefixeTable.'users';40 $query_user.= ' from '.PREFIX_TABLE.'users'; 41 41 $query_done = false; 42 42 $user['is_the_guest'] = false; … … 45 45 { 46 46 $page['session_id'] = $_GET['id']; 47 $query = "select user_id, expiration, ip "; 48 $query.= "from $prefixeTable"."sessions "; 49 $query.= "where id = '".$_GET['id']."';"; 47 $query = 'select user_id,expiration,ip'; 48 $query.= ' from '.PREFIX_TABLE.'sessions'; 49 $query.= " where id = '".$_GET['id']."'"; 50 $query.= ';'; 50 51 $result = mysql_query( $query ); 51 52 if ( mysql_num_rows( $result ) > 0 ) … … 56 57 // deletion of the session from the database, 57 58 // because it is out-of-date 58 $delete_query = "delete from ".$prefixeTable."sessions"; 59 $delete_query.= " where id = ".$page['session_id'].";"; 59 $delete_query = 'delete from '.PREFIX_TABLE.'sessions'; 60 $delete_query.= " where id = '".$page['session_id']."'"; 61 $delete_query.= ';'; 60 62 mysql_query( $delete_query ); 61 63 } 62 64 else 63 65 { 64 if ( $ REMOTE_ADDR== $row['ip'] )66 if ( $_SERVER['REMOTE_ADDR'] == $row['ip'] ) 65 67 { 66 68 $query_user .= ' where id = '.$row['user_id']; … … 84 86 { 85 87 $user[$infos[$i]] = $row[$infos[$i]]; 86 // If the field is true or false, the variable is transformed into a boolean87 // value.88 // If the field is true or false, the variable is transformed into a 89 // boolean value. 88 90 if ( $row[$infos[$i]] == 'true' || $row[$infos[$i]] == 'false' ) 89 91 { -
trunk/language/francais.php
r9 r13 204 204 if ( $isadmin ) 205 205 { 206 // start version 1.3 207 // general for admin section 208 $lang['remote_site'] = 'Site distant'; 209 // end version 1.3 210 206 211 // page admin 207 212 // start version 1.3 … … 292 297 $lang['conf_comments_comments_number_info'] = 'nombre de commentaire à afficher sur chaque page. Le nombre de commentaires pour une image reste illimité. Entrer un nombre entre 5 et 50.'; 293 298 $lang['conf_err_comment_number'] = 'le nombre de commentaires par page doit être compris entre 5 et 50 inclus.'; 294 $lang['conf_remote_site_title'] = 'Site distant'; 299 // start version 1.3 300 // $lang['conf_remote_site_title'] = 'Site distant'; 301 // end version 1.3 295 302 $lang['conf_remote_site_delete_info'] = 'Supprimer un site revient à supprimer toutes les images et les catégories en relation avec ce site.'; 296 303 $lang['conf_upload_title'] = 'Configurer l\'upload des utilisateurs'; … … 506 513 $lang['help_database'][0] = 'Une fois les fichiers placés correctement et les miniatures placées ou créées, cliquez sur "MaJ base d\'images" dans le menu de la zone d\'administration.'; 507 514 508 $lang['help_remote_title'] = 'Site distant'; 515 // start version 1.3 516 // $lang['help_remote_title'] = 'Site distant'; 517 // end version 1.3 509 518 $lang['help_remote'][0] = 'PhpWebGallery offre la possibilité d\'utiliser plusieurs serveurs pour stocker les images qui composeront votre galerie. Cela peut être utile si votre galerie est installée sur une espace limité et que vous avez une grande quantité d\'images à montrer. Suivez la procédure suivante :'; 510 519 $lang['help_remote'][1] = '1. éditez le fichier "create_listing_file.php" (vous le trouverez dans le répertoire "admin"), en modifiant la ligne "$prefixe_thumbnail = "TN-";" si le préfixe pour vos miniatures n\'est pas "TN-".'; -
trunk/template/default/upload.vtp
r2 r13 1 1 <html> 2 2 <head> 3 {# page_style}4 <title>{#upload_ page_title}</title>3 {#style} 4 <title>{#upload_title}</title> 5 5 </head> 6 6 <body> … … 52 52 </tr> 53 53 <tr> 54 <td class="menu">{# reg_mail_address}</td>54 <td class="menu">{#mail_address}</td> 55 55 <td align="center" style="padding:10px;"> 56 56 <input name="mail_address" type="text" value="{#user_mail_address}" />
Note: See TracChangeset
for help on using the changeset viewer.