source: branches/release-1_3/admin/update.php @ 272

Last change on this file since 272 was 272, checked in by z0rglub, 20 years ago

improved again function insert_local_category : only one multiple insert
query, one update for uppercats field

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.5 KB
Line 
1<?php
2/***************************************************************************
3 *                                update.php                               *
4 *                            ------------------                           *
5 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: update.php 272 2004-01-11 00:05:10Z z0rglub $
9 *                                                                         *
10 ***************************************************************************/
11
12/***************************************************************************
13 *                                                                         *
14 *   This program is free software; you can redistribute it and/or modify  *
15 *   it under the terms of the GNU General Public License as published by  *
16 *   the Free Software Foundation;                                         *
17 *                                                                         *
18 ***************************************************************************/
19
20include_once( './include/isadmin.inc.php' );
21//------------------------------------------------------------------- functions
22function insert_local_category( $id_uppercat )
23{
24  global $conf, $page, $user, $lang;
25 
26  $uppercats = '';
27               
28  // 0. retrieving informations on the category to display
29  $cat_directory = '../galleries';
30               
31  if ( is_numeric( $id_uppercat ) )
32  {
33    $query = 'SELECT name,uppercats,dir';
34    $query.= ' FROM '.PREFIX_TABLE.'categories';
35    $query.= ' WHERE id = '.$id_uppercat;
36    $query.= ';';
37    $row = mysql_fetch_array( mysql_query( $query ) );
38    $uppercats = $row['uppercats'];
39    $name      = $row['name'];
40    $dir       = $row['dir'];
41
42    $upper_array = explode( ',', $uppercats );
43
44    $local_dir = '';
45
46    $database_dirs = array();
47    $query = 'SELECT id,dir';
48    $query.= ' FROM '.PREFIX_TABLE.'categories';
49    $query.= ' WHERE id IN ('.$uppercats.')';
50    $query.= ';';
51    $result = mysql_query( $query );
52    while( $row = mysql_fetch_array( $result ) )
53    {
54      $database_dirs[$row['id']] = $row['dir'];
55    }
56    foreach ( $upper_array as $id ) {
57      $local_dir.= $database_dirs[$id].'/';
58    }
59
60    $cat_directory.= '/'.$local_dir;
61
62    // 1. display the category name to update
63    $src = '../template/'.$user['template'].'/admin/images/puce.gif';
64    $output = '<img src="'.$src.'" alt="&gt;" />';
65    $output.= '<span style="font-weight:bold;">'.$name.'</span>';
66    $output.= ' [ '.$dir.' ]';
67    $output.= '<div class="retrait">';
68
69    // 2. we search pictures of the category only if the update is for all
70    //    or a cat_id is specified
71    if ( isset( $page['cat'] ) or $_GET['update'] == 'all' )
72    {
73      $output.= insert_local_image( $cat_directory, $id_uppercat );
74    }
75  }
76
77  $sub_dirs = get_category_directories( $cat_directory );
78
79  $sub_category_dirs = array();
80  $query = 'SELECT id,dir';
81  $query.= ' FROM '.PREFIX_TABLE.'categories';
82  $query.= ' WHERE site_id = 1';
83  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
84  else                           $query.= ' AND id_uppercat = '.$id_uppercat;
85  $query.= ' AND dir IS NOT NULL'; // virtual categories not taken
86  $query.= ';';
87  $result = mysql_query( $query );
88  while ( $row = mysql_fetch_array( $result ) )
89  {
90    $id = intval($row['id']);
91    $sub_category_dirs[$id] = $row['dir'];
92  }
93 
94  // 3. we have to remove the categories of the database not present anymore
95  foreach ( $sub_category_dirs as $id => $dir ) {
96    if ( !in_array( $dir, $sub_dirs ) ) delete_category( $id );
97  }
98
99  // array of new categories to insert
100  $inserts = array();
101 
102  foreach ( $sub_dirs as $sub_dir ) {
103    // 5. Is the category already existing ? we create a subcat if not
104    //    existing
105    $category_id = array_search( $sub_dir, $sub_category_dirs );
106    if ( !is_numeric( $category_id ) )
107    {
108      if ( preg_match( '/^[a-zA-Z0-9-_.]+$/', $sub_dir ) )
109      {
110        $value = '';
111        $name = str_replace( '_', ' ', $sub_dir );
112
113        $value.= "('".$sub_dir."','".$name."',1";
114        if ( !is_numeric( $id_uppercat ) ) $value.= ',NULL';
115        else                               $value.= ','.$id_uppercat;
116        $value.= ",'undef'";
117        $value.= ')';
118        array_push( $inserts, $value );
119      }
120      else
121      {
122        $output.= '<span style="color:red;">"'.$sub_dir.'" : ';
123        $output.= $lang['update_wrong_dirname'].'</span><br />';
124      }
125    }
126  }
127
128  // we have to create the category
129  if ( count( $inserts ) > 0 )
130  {
131    $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
132    $query.= ' (dir,name,site_id,id_uppercat,uppercats) VALUES ';
133    $query.= implode( ',', $inserts );
134    $query.= ';';
135    mysql_query( $query );
136    // updating uppercats field
137    $query = 'UPDATE '.PREFIX_TABLE.'categories';
138    $query.= ' SET uppercats = ';
139    if ( $uppercats != '' ) $query.= "CONCAT('".$uppercats."',',',id)";
140    else                    $query.= 'id';
141    $query.= ' WHERE id_uppercat ';
142    if (!is_numeric($id_uppercat)) $query.= 'IS NULL';
143    else                           $query.= '= '.$id_uppercat;
144    $query.= ';';
145    mysql_query( $query );
146  }
147
148  // Recursive call on the sub-categories (not virtual ones)
149  $query = 'SELECT id';
150  $query.= ' FROM '.PREFIX_TABLE.'categories';
151  $query.= ' WHERE site_id = 1';
152  if (!is_numeric($id_uppercat)) $query.= ' AND id_uppercat IS NULL';
153  else                           $query.= ' AND id_uppercat = '.$id_uppercat;
154  $query.= ' AND dir IS NOT NULL'; // virtual categories not taken
155  $query.= ';';
156  $result = mysql_query( $query );
157  while ( $row = mysql_fetch_array( $result ) )
158  {
159    $output.= insert_local_category( $row['id'] );
160  }
161
162  if ( is_numeric( $id_uppercat ) )
163  {
164    $output.= '</div>';
165  }
166  return $output;
167}
168
169function insert_local_image( $rep, $category_id )
170{
171  global $lang,$conf,$count_new;
172
173  $output = '';
174  // we have to delete all the images from the database that :
175  //     - are not in the directory anymore
176  //     - don't have the associated thumbnail available anymore
177  $query = 'SELECT id,file,tn_ext';
178  $query.= ' FROM '.PREFIX_TABLE.'images';
179  $query.= ' WHERE storage_category_id = '.$category_id;
180  $query.= ';';
181  $result = mysql_query( $query );
182  while ( $row = mysql_fetch_array( $result ) )
183  {
184    $lien_image = $rep.'/'.$row['file'];
185    $lien_thumbnail = $rep.'/thumbnail/'.$conf['prefix_thumbnail'];
186    $lien_thumbnail.= get_filename_wo_extension( $row['file'] );
187    $lien_thumbnail.= '.'.$row['tn_ext'];
188               
189    if ( !is_file ( $lien_image ) or !is_file ( $lien_thumbnail ) )
190    {
191      if ( !is_file ( $lien_image ) )
192      {
193        $output.= $row['file'];
194        $output.= ' <span style="font-weight:bold;">';
195        $output.= $lang['update_disappeared'].'</span><br />';
196      }
197      if ( !is_file ( $lien_thumbnail ) )
198      {
199        $output.= $row['file'];
200        $output.= ' : <span style="font-weight:bold;">';
201        $output.= $lang['update_disappeared_tn'].'</span><br />';
202      }
203      // suppression de la base :
204      delete_image( $row['id'] );
205    }
206  }
207               
208  // searching the new images in the directory
209  $pictures = array();         
210  $tn_ext = '';
211  if ( $opendir = opendir( $rep ) )
212  {
213    while ( $file = readdir( $opendir ) )
214    {
215      if ( is_file( $rep.'/'.$file ) and is_image( $rep.'/'.$file ) )
216      {
217        // is the picture waiting for validation by an administrator ?
218        $query = 'SELECT id,validated,infos';
219        $query.= ' FROM '.PREFIX_TABLE.'waiting';
220        $query.= ' WHERE storage_category_id = '.$category_id;
221        $query.= " AND file = '".$file."'";
222        $query.= ';';
223        $result = mysql_query( $query );
224        $waiting = mysql_fetch_array( $result );
225        if (mysql_num_rows( $result ) == 0 or $waiting['validated'] == 'true')
226        {
227          if ( $tn_ext = TN_exists( $rep, $file ) )
228          {
229            // is the picture already in the database ?
230            $query = 'SELECT id';
231            $query.= ' FROM '.PREFIX_TABLE.'images';
232            $query.= ' WHERE storage_category_id = '.$category_id;
233            $query.= " AND file = '".$file."'";
234            $query.= ';';
235            $result = mysql_query( $query );
236            if ( mysql_num_rows( $result ) == 0 )
237            {
238              // the name of the file must not use acentuated characters or
239              // blank space..
240              if ( preg_match( '/^[a-zA-Z0-9-_.]+$/', $file ) )
241              {
242                $picture = array();
243                $picture['file']     = $file;
244                $picture['tn_ext']   = $tn_ext;
245                $picture['date'] = date( 'Y-m-d', filemtime($rep.'/'.$file) );
246                $picture['filesize'] = floor( filesize($rep.'/'.$file) / 1024);
247                $image_size = @getimagesize( $rep.'/'.$file );
248                $picture['width']    = $image_size[0];
249                $picture['height']   = $image_size[1];
250                if ( $waiting['validated'] == 'true' )
251                {
252                  // retrieving infos from the XML description of
253                  // $waiting['infos']
254                  $infos = nl2br( $waiting['infos'] );
255                  $picture['author']        = getAttribute( $infos, 'author' );
256                  $picture['comment']       = getAttribute( $infos, 'comment');
257                  $unixtime = getAttribute( $infos, 'date_creation' );
258                  $picture['date_creation'] = '';
259                  if ( $unixtime != '' )
260                    $picture['date_creation'] = date( 'Y-m-d', $unixtime );
261                  $picture['name']          = getAttribute( $infos, 'name' );
262                  // deleting the waiting element
263                  $query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
264                  $query.= ' WHERE id = '.$waiting['id'];
265                  $query.= ';';
266                  mysql_query( $query );
267                }
268                array_push( $pictures, $picture );
269              }
270              else
271              {
272                $output.= '<span style="color:red;">"'.$file.'" : ';
273                $output.= $lang['update_wrong_dirname'].'</span><br />';
274              }
275
276            }
277          }
278          else
279          {
280            $output.= '<span style="color:red;">';
281            $output.= $lang['update_missing_tn'].' : '.$file;
282            $output.= ' (<span style="font-weight:bold;">';
283            $output.= $conf['prefix_thumbnail'];
284            $output.= get_filename_wo_extension( $file ).'.XXX</span>';
285            $output.= ', XXX = ';
286            $output.= implode( ', ', $conf['picture_ext'] );
287            $output.= ')</span><br />';
288          }
289        }
290      }
291    }
292  }
293  // inserting the pictures found in the directory
294  foreach ( $pictures as $picture ) {
295    $query = 'INSERT INTO '.PREFIX_TABLE.'images';
296    $query.= ' (file,storage_category_id,date_available,tn_ext';
297    $query.= ',filesize,width,height';
298    $query.= ',name,author,comment,date_creation)';
299    $query.= ' VALUES ';
300    $query.= "('".$picture['file']."','".$category_id."'";
301    $query.= ",'".$picture['date']."','".$picture['tn_ext']."'";
302    $query.= ",'".$picture['filesize']."','".$picture['width']."'";
303    $query.= ",'".$picture['height']."','".$picture['name']."'";
304    $query.= ",'".$picture['author']."','".$picture['comment']."'";
305    if ( $picture['date_creation'] != '' )
306    {
307      $query.= ",'".$picture['date_creation']."'";
308    }
309    else
310    {
311      $query.= ',NULL';
312    }
313    $query.= ');';
314    mysql_query( $query );
315    $count_new++;
316    // retrieving the id of newly inserted picture
317    $query = 'SELECT id';
318    $query.= ' FROM '.PREFIX_TABLE.'images';
319    $query.= ' WHERE storage_category_id = '.$category_id;
320    $query.= " AND file = '".$picture['file']."'";
321    $query.= ';';
322    list( $image_id ) = mysql_fetch_array( mysql_query( $query ) );
323    // adding the link between this picture and its storage category
324    $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
325    $query.= ' (image_id,category_id) VALUES ';
326    $query.= ' ('.$image_id.','.$category_id.')';
327    $query.= ';';
328    mysql_query( $query );
329
330    $output.= $picture['file'];
331    $output.= ' <span style="font-weight:bold;">';
332    $output.= $lang['update_research_added'].'</span>';
333    $output.= ' ('.$lang['update_research_tn_ext'].' '.$picture['tn_ext'].')';
334    $output.= '<br />';
335  }
336  return $output;
337}
338
339// remote_images verifies if a file named "listing.xml" is present is the
340// admin directory. If it is the case, creation of a remote picture storage
341// site if it doesn't already exists. Then, the function calls
342// insert_remote_category for this remote site on the root category.
343function remote_images()
344{
345  global $conf, $lang, $vtp, $sub;
346
347  // 1. is there a file listing.xml ?
348  if ( !( $xml_content = getXmlCode( 'listing.xml' ) ) )
349  {
350    return false;
351  }
352  $url = getContent( getChild( $xml_content, 'url' ) );
353  $vtp->setVar( $sub, 'remote_update.url', $url );
354
355  // 2. is the site already existing ?
356  $query = 'SELECT id';
357  $query.= ' FROM '.PREFIX_TABLE.'sites';
358  $query.= " WHERE galleries_url = '".$url."'";
359  $query.= ';';
360  $result = mysql_query( $query );
361  if ( mysql_num_rows($result ) == 0 )
362  {
363    // we have to register this site in the database
364    $query = 'INSERT INTO '.PREFIX_TABLE.'sites';
365    $query.= " (galleries_url) VALUES ('".$url."')";
366    $query.= ';';
367    mysql_query( $query );
368    $site_id = mysql_insert_id();
369  }
370  else
371  {
372    // we get the already registered id
373    $row = mysql_fetch_array( $result );
374    $site_id = $row['id'];
375  }
376
377  // 3. available dirs in the file
378  $categories = insert_remote_category( $xml_content, $site_id, 'NULL', 0 );
379  $vtp->setVar( $sub, 'remote_update.categories', $categories );
380}
381
382// insert_remote_category searchs the "dir" node of the xml_dir given and
383// insert the contained categories if the are not in the database yet. The
384// function also deletes the categories that are in the database and not in
385// the xml_file.
386function insert_remote_category( $xml_dir, $site_id, $id_uppercat, $level )
387{
388  global $conf,$user;
389
390  $output = '';
391  $categories = array();
392  $list_dirs = getChildren( $xml_dir, 'dir'.$level );
393  for ( $i = 0; $i < sizeof( $list_dirs ); $i++ )
394  {
395    // is the category already existing ?
396    $category_id = '';
397    $dir = getAttribute( $list_dirs[$i], 'name' );
398    $categories[$i] = $dir;
399
400    $src = '../template/'.$user['template'].'/admin/images/puce.gif';
401    $output.= '<img src="'.$src.'" alt="&gt;" />';
402    $output.= '<span style="font-weight:bold;">'.$dir.'</span>';
403    $output.= '<div class="retrait">';
404
405    $query = 'SELECT id';
406    $query.= ' FROM '.PREFIX_TABLE.'categories';
407    $query.= ' WHERE site_id = '.$site_id;
408    $query.= " AND dir = '".$dir."'";
409    if ( $id_uppercat == 'NULL' )
410    {
411      $query.= ' AND id_uppercat IS NULL';
412    }
413    else
414    {
415      $query.= ' AND id_uppercat = '.$id_uppercat;
416    }
417    $query.= ';';
418    $result = mysql_query( $query );
419    if ( mysql_num_rows( $result ) == 0 )
420    {
421      $name = str_replace( '_', ' ', $dir );
422      // we have to create the category
423      $query = 'INSERT INTO '.PREFIX_TABLE.'categories';
424      $query.= ' (name,dir,site_id,id_uppercat) VALUES ';
425      $query.= "('".$name."','".$dir."',".$site_id;
426      if ( !is_numeric( $id_uppercat ) )
427      {
428        $query.= ',NULL';
429      }
430      else
431      {
432        $query.= ','.$id_uppercat;
433      }
434      $query.= ');';
435      mysql_query( $query );
436      $category_id = mysql_insert_id();
437    }
438    else
439    {
440      // we get the already registered id
441      $row = mysql_fetch_array( $result );
442      $category_id = $row['id'];
443    }
444    $output.= insert_remote_image( $list_dirs[$i], $category_id );
445    $output.= insert_remote_category( $list_dirs[$i], $site_id,
446                                      $category_id, $level+1 );
447    $output.= '</div>';
448  }
449  // we have to remove the categories of the database not present in the xml
450  // file (ie deleted from the picture storage server)
451  $query = 'SELECT dir,id';
452  $query.= ' FROM '.PREFIX_TABLE.'categories';
453  $query.= ' WHERE site_id = '.$site_id;
454  if ( !is_numeric( $id_uppercat ) )
455  {
456    $query.= ' AND id_uppercat IS NULL';
457  }
458  else
459  {
460    $query.= ' AND id_uppercat = '.$id_uppercat;
461  }
462  $query.= ';';
463  $result = mysql_query( $query );
464  while ( $row = mysql_fetch_array( $result ) )
465  {
466    // is the category in the xml file ?
467    if ( !in_array( $row['dir'], $categories ) )
468    {
469      delete_category( $row['id'] );
470    }
471  }
472
473  return $output;
474}
475       
476// insert_remote_image searchs the "root" node of the xml_dir given and
477// insert the contained pictures if the are not in the database yet.
478function insert_remote_image( $xml_dir, $category_id )
479{
480  global $count_new,$lang;
481
482  $output = '';
483  $root = getChild( $xml_dir, 'root' );
484  $pictures = array();
485  $xml_pictures = getChildren( $root, 'picture' );
486  for ( $j = 0; $j < sizeof( $xml_pictures ); $j++ )
487  {
488    //<picture file="albatros.jpg" tn_ext="png" date="2002-04-14"
489    //  filesize="35" width="640" height="480" />
490    $file     = getAttribute( $xml_pictures[$j], 'file' );
491    $tn_ext   = getAttribute( $xml_pictures[$j], 'tn_ext' );
492    $date     = getAttribute( $xml_pictures[$j], 'date' ); 
493    $filesize = getAttribute( $xml_pictures[$j], 'filesize' );
494    $width    = getAttribute( $xml_pictures[$j], 'width' );
495    $height   = getAttribute( $xml_pictures[$j], 'height' );
496                       
497    $pictures[$j] = $file;
498                       
499    // is the picture already existing in the database ?
500    $query = 'SELECT id,tn_ext';
501    $query.= ' FROM '.PREFIX_TABLE.'images';
502    $query.= ' WHERE storage_category_id = '.$category_id;
503    $query.= " AND file = '".$file."'";
504    $query.= ';';
505    $result = mysql_query( $query );
506    $query = '';
507    if ( mysql_num_rows( $result ) == 0 )
508    {
509      $query = 'INSERT INTO '.PREFIX_TABLE.'images';
510      $query.= ' (file,storage_category_id,date_available,tn_ext';
511      $query.= ',filesize,width,height)';
512      $query.= ' VALUES (';
513      $query.= "'".$file."'";
514      $query.= ",'".$category_id."'";
515      $query.= ",'".$date."'";
516      $query.= ",'".$tn_ext."'";
517      $query.= ",'".$filesize."'";
518      $query.= ",'".$width."'";
519      $query.= ",'".$height."'";
520      $query.= ')';
521      $query.= ';';
522      mysql_query( $query );
523      // retrieving the id of newly inserted picture
524      $query = 'SELECT id';
525      $query.= ' FROM '.PREFIX_TABLE.'images';
526      $query.= ' WHERE storage_category_id = '.$category_id;
527      $query.= " AND file = '".$file."'";
528      $query.= ';';
529      list( $image_id ) = mysql_fetch_array( mysql_query( $query ) );
530      // adding the link between this picture and its storage category
531      $query = 'INSERT INTO '.PREFIX_TABLE.'image_category';
532      $query.= ' (image_id,category_id) VALUES ';
533      $query.= ' ('.$image_id.','.$category_id.')';
534      $query.= ';';
535      mysql_query( $query );
536
537      $output.= $file;
538      $output.= ' <span style="font-weight:bold;">';
539      $output.= $lang['update_research_added'].'</span>';
540      $output.= ' ('.$lang['update_research_tn_ext'].' '.$tn_ext.')<br />';
541
542      $count_new++;
543    }
544    else
545    {
546      // is the tn_ext the same in the xml file and in the database ?
547      $row = mysql_fetch_array( $result );
548      if ( $row['tn_ext'] != $tn_ext )
549      {
550        $query = 'UPDATE '.PREFIX_TABLE.'images';
551        $query.= ' SET';
552        $query.= " tn_ext = '".$tn_ext."'";
553        $query.= ' WHERE storage_category_id = '.$category_id;
554        $query.= " AND file = '".$file."'";
555        $query.= ';';
556      }
557    }
558    // execution of the query
559    if ( $query != '' )
560    {
561      mysql_query( $query );
562    }
563  }
564  // we have to remove the pictures of the database not present in the xml file
565  // (ie deleted from the picture storage server)
566  $query = 'SELECT id,file';
567  $query.= ' FROM '.PREFIX_TABLE.'images';
568  $query.= ' WHERE storage_category_id = '.$category_id;
569  $query.= ';';
570  $result = mysql_query( $query );
571  while ( $row = mysql_fetch_array( $result ) )
572  {
573    // is the file in the xml file ?
574    if ( !in_array( $row['file'], $pictures ) )
575    {
576      delete_image( $row['id'] );
577    }
578  }
579  return $output;
580}
581//----------------------------------------------------- template initialization
582$sub = $vtp->Open( '../template/'.$user['template'].'/admin/update.vtp' );
583$tpl = array( 'update_default_title', 'update_only_cat', 'update_all',
584              'update_research_conclusion', 'update_deletion_conclusion',
585              'remote_site', 'update_part_research' );
586templatize_array( $tpl, 'lang', $sub );
587$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
588//-------------------------------------------- introduction : choices of update
589// Display choice if "update" var is not specified
590check_cat_id( $_GET['update'] );
591if ( !isset( $_GET['update'] )
592     and !( isset( $page['cat'] )
593            or $_GET['update'] == 'cats'
594            or $_GET['update'] == 'all' ) )
595{
596  $vtp->addSession( $sub, 'introduction' );
597  // only update the categories, not the pictures.
598  $url = add_session_id( './admin.php?page=update&amp;update=cats' );
599  $vtp->setVar( $sub, 'introduction.only_cat:url', $url );
600  // update the entire tree folder
601  $url = add_session_id( './admin.php?page=update&amp;update=all' );
602  $vtp->setVar( $sub, 'introduction.all:url', $url );
603  $vtp->closeSession( $sub, 'introduction' );
604}
605//------------------------------------------------- local update : ../galleries
606else
607{
608  $start = get_moment();
609  $count_new = 0;
610  $count_deleted = 0;
611  $vtp->addSession( $sub, 'local_update' );
612  if ( isset( $page['cat'] ) )
613  {
614    $categories = insert_local_category( $page['cat'] );
615  }
616  else
617  {
618    $categories = insert_local_category( 'NULL' );
619  }
620  $end = get_moment();
621  echo get_elapsed_time( $start, $end ).' for update <br />';
622  $vtp->setVar( $sub, 'local_update.categories', $categories );
623  $vtp->setVar( $sub, 'local_update.count_new', $count_new );
624  $vtp->setVar( $sub, 'local_update.count_deleted', $count_deleted );
625  $vtp->closeSession( $sub, 'local_update' );
626}
627//------------------------------------------------- remote update : listing.xml
628if ( @is_file( './listing.xml' ) )
629{
630  $count_new = 0;
631  $count_deleted = 0;
632  $vtp->addSession( $sub, 'remote_update' );
633
634  remote_images();
635  $vtp->setVar( $sub, 'remote_update.count_new', $count_new );
636  $vtp->setVar( $sub, 'remote_update.count_deleted', $count_deleted );
637
638  $vtp->closeSession( $sub, 'remote_update' );
639}
640//---------------------------------------- update informations about categories
641if ( isset( $_GET['update'] )
642     or isset( $page['cat'] )
643     or @is_file( './listing.xml' ) )
644{
645  update_category( 'all' );
646  synchronize_all_users();
647}
648//----------------------------------------------------------- sending html code
649$vtp->Parse( $handle , 'sub', $sub );
650?>
Note: See TracBrowser for help on using the repository browser.