Changeset 2260 for trunk/admin


Ignore:
Timestamp:
Mar 7, 2008, 3:07:55 AM (16 years ago)
Author:
rvelices
Message:
  • some more smarty migration (admin upload ws_checker profile and plugin)
Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/upload.php

    r1915 r2260  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | file          : $Id$
     
    144144waiting_tabsheet();
    145145
    146 $template->assign_vars(array(
     146$template->assign(array(
    147147  'F_ACTION'=>str_replace( '&', '&', $_SERVER['REQUEST_URI'])
    148148  ));
     
    157157$query.= ';';
    158158$result = pwg_query( $query );
    159 $i = 0;
    160159while ( $row = mysql_fetch_array( $result ) )
    161160{
     
    170169  }
    171170  $preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file'];
    172   $class='row1';
    173   if ( $i++ % 2== 0 ) $class='row2';
    174 
    175   $template->assign_block_vars(
    176     'picture',
     171
     172  $tpl_var =
    177173    array(
    178       'WAITING_CLASS'=>$class,
    179174      'CATEGORY_IMG'=>$cat_names[$row['storage_category_id']]['display_name'],
    180175      'ID_IMG'=>$row['id'],
     
    187182      'UPLOAD_EMAIL'=>get_email_address_as_display_text($row['mail_address']),
    188183      'UPLOAD_USERNAME'=>$row['username']
    189       )
    190184    );
    191185
     
    199193    $url.= 'thumbnail/'.$thumbnail;
    200194
    201     $template->assign_block_vars(
    202       'picture.thumbnail',
     195    $tpl_var['thumbnail'] =
    203196      array(
    204197        'PREVIEW_URL_TN_IMG' => $url,
     
    207200            (substr($thumbnail, 0, 10)).'...' : $thumbnail,
    208201        'FILE_TN_TITLE' => $thumbnail
    209         )
    210202      );
    211203  }
    212 
     204  $template->append('pictures', $tpl_var);
    213205  array_push($list, $row['id']);
    214206}
    215207
    216 $template->assign_vars(
    217   array(
    218     'LIST' => implode(',', $list)
    219     )
    220   );
     208$template->assign('LIST',implode(',', $list) );
    221209
    222210//----------------------------------------------------------- sending html code
  • trunk/admin/ws_checker.php

    r2201 r2260  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    6 // +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
     6// +-----------------------------------------------------------------------+
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    155154  $chk_partner = $add_partner;
    156155 
    157   $template->assign_block_vars(
    158     'update_result',
    159     array(
    160       'UPD_ELEMENT'=> l10n('ws_adding_legend').l10n('ws_success_upd'),
    161       )
     156  $template->append(
     157    'update_results',
     158    l10n('ws_adding_legend').l10n('ws_success_upd')
    162159  );
    163160}
     
    177174    WHERE id = '.$uid.'; ';
    178175    pwg_query($query);
    179     $template->assign_block_vars(
    180       'update_result',
    181       array(
    182         'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_success_upd'),
    183         )
     176    $template->append(
     177      'update_results',
     178      l10n('ws_update_legend').l10n('ws_success_upd')
    184179    );
    185180  } else {
    186     $template->assign_block_vars(
    187       'update_result',
    188       array(
    189         'UPD_ELEMENT'=> l10n('ws_update_legend').l10n('ws_failed_upd'),
    190         )
     181    $template->append(
     182      'update_results',
     183      l10n('ws_update_legend').l10n('ws_failed_upd')
    191184    );
    192185  }
     
    203196               WHERE id = '.$uid.'; ';
    204197    pwg_query($query);
    205     $template->assign_block_vars(
    206       'update_result',
    207       array(
    208         'UPD_ELEMENT'=> l10n('ws_delete_legend').l10n('ws_success_upd'),
    209         )
     198    $template->append(
     199      'update_results',
     200      l10n('ws_delete_legend').l10n('ws_success_upd')
    210201    );
    211202  } else {
    212     $template->assign_block_vars(
    213       'update_result',
    214       array(
    215         'UPD_ELEMENT'=> l10n('Not selected / Not confirmed')
    216         .l10n('ws_failed_upd'),
    217         )
     203    $template->append(
     204      'update_results',
     205      l10n('Not selected / Not confirmed').l10n('ws_failed_upd')
    218206    );
    219207  }
     
    253241  );
    254242
    255 $selected = 'selected="selected"';
    256 $num=0;
    257 if ( $acc_list > 0 )
    258 {
    259   $template->assign_block_vars(
    260     'acc_list', array() );
    261 }
    262243
    263244// Access List
    264245while ($row = mysql_fetch_array($result))
    265246{
    266   $num++;
    267247  $chk_partner = ( $chk_partner == '' ) ? $row['name'] : $chk_partner;
    268   $template->assign_block_vars(
    269     'acc_list.access',
     248  $template->append(
     249    'access_list',
    270250     array(
    271        'CLASS' => ($num % 2 == 1) ? 'row1' : 'row2',
    272251       'ID'               => $row['id'],
    273252       'NAME'             =>
     
    278257       'LIMIT'            => $row['limit'],
    279258       'COMMENT'          => $row['comment'],
    280        'SELECTED'         => '',
    281259     )
    282260  );
    283261}
    284262
    285 $template->assign_block_vars(
    286   'add_request',
    287    array(
    288      'VALUE'=> '',
    289      'CONTENT' => '',
    290      'SELECTED' => $selected,
    291    )
    292 );
    293 foreach ($req_type_list as $value) {
    294 
    295   $template->assign_block_vars(
    296     'add_request',
    297      array(
    298        'VALUE'=> $value,
    299        'CONTENT' => $value,
    300        'SELECTED' => '',
    301      )
    302   );
    303 }
    304 
    305 foreach ($conf['ws_allowed_limit'] as $value) {
    306   $template->assign_block_vars(
    307     'add_limit',
    308      array(
    309        'VALUE'=> $value,
    310        'CONTENT' => $value,
    311        'SELECTED' => ($conf['ws_allowed_limit'][0] == $value) ? $selected:'',
    312      )
    313   );
    314 }
     263$template->assign('add_requests', $req_type_list);
     264
     265$template->assign('add_limits', $conf['ws_allowed_limit'] );
    315266
    316267// Postponed Start Date
    317268// By default 0, 1, 2, 3, 5, 7, 14 or 30 days
    318 foreach ($conf['ws_postponed_start'] as $value) {
     269/*foreach ($conf['ws_postponed_start'] as $value) {
    319270  $template->assign_block_vars(
    320271    'add_start',
     
    325276     )
    326277  );
    327 }
     278}*/
    328279
    329280// Durations (Allowed Web Services Period)
    330281// By default 10, 5, 2, 1 year(s) or 6, 3, 1 month(s) or 15, 10, 7, 5, 1, 0 day(s)
    331 foreach ($conf['ws_durations'] as $value) {
    332   $template->assign_block_vars(
    333     'add_end',
    334      array(
    335        'VALUE'=> $value,
    336        'CONTENT' => $value,
    337        'SELECTED' => ($conf['ws_durations'][3] == $value) ? $selected:'',
    338      )
    339   );
    340   if ( $acc_list > 0 )
    341   {
    342     $template->assign_block_vars(
    343       'acc_list.upd_end',
    344        array(
    345          'VALUE'=> $value,
    346          'CONTENT' => $value,
    347          'SELECTED' => ($conf['ws_durations'][3] == $value) ? $selected:'',
    348        )
    349     );
    350   }
    351 }
     282$template->assign('add_ends', $conf['ws_durations']);
     283
    352284if ( $chk_partner !== '' )
    353285{
    354   $request = get_absolute_root_url().'ws.php?method=pwg.getVersion&format=rest&'
    355            . "partner=$chk_partner" ;
    356   $session = curl_init($request);
    357   curl_setopt ($session, CURLOPT_POST, true);
    358   curl_setopt($session, CURLOPT_HEADER, true);
    359   curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    360   $response = curl_exec($session);
    361   curl_close($session);
    362   $status_code = array();
    363   preg_match('/\d\d\d/', $response, $status_code);
    364   switch( $status_code[0] ) {
    365         case 200:
    366       $ws_status = l10n('Web Services under control');
    367                 break;
    368         case 503:
    369                 $ws_status = 'PhpWebGallery Web Services failed and returned an '
    370                  . 'HTTP status of 503. Service is unavailable. An internal '
    371                  . 'problem prevented us from returning data to you.';
    372                 break;
    373         case 403:
    374                 $ws_status = 'PhpWebGallery Web Services failed and returned an '
    375                  . 'HTTP status of 403. Access is forbidden. You do not have '
    376                  . 'permission to access this resource, or are over '
    377                  . 'your rate limit.';
    378                 break;
    379         case 400:
    380                 // You may want to fall through here and read the specific XML error
    381                 $ws_status = 'PhpWebGallery Web Services failed and returned an '
    382                  . 'HTTP status of 400. Bad request. The parameters passed '
    383                  . 'to the service did not match as expected. The exact '
    384                  . 'error is returned in the XML response.';
    385                 break;
    386         default:
    387                 $ws_status = 'PhpWebGallery Web Services returned an unexpected HTTP '
    388                  . 'status of:' . $status_code[0];
    389   }
    390   $template->assign_block_vars(
    391     'acc_list.ws_status',
    392      array(
    393        'VALUE'=> $ws_status,
    394      )
    395   );
     286  if (function_exists('curl_init'))
     287  {
     288    $request = get_absolute_root_url().'ws.php?method=pwg.getVersion&format=rest&'
     289             . "partner=$chk_partner" ;
     290    $session = curl_init($request);
     291    curl_setopt ($session, CURLOPT_POST, true);
     292    curl_setopt($session, CURLOPT_HEADER, true);
     293    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
     294    $response = curl_exec($session);
     295    curl_close($session);
     296    $status_code = array();
     297    preg_match('/\d\d\d/', $response, $status_code);
     298    switch( $status_code[0] ) {
     299        case 200:
     300        $ws_status = l10n('Web Services under control');
     301                break;
     302        case 503:
     303                $ws_status = 'PhpWebGallery Web Services failed and returned an '
     304                   . 'HTTP status of 503. Service is unavailable. An internal '
     305                   . 'problem prevented us from returning data to you.';
     306                break;
     307        case 403:
     308                $ws_status = 'PhpWebGallery Web Services failed and returned an '
     309                   . 'HTTP status of 403. Access is forbidden. You do not have '
     310                   . 'permission to access this resource, or are over '
     311                   . 'your rate limit.';
     312                break;
     313        case 400:
     314                // You may want to fall through here and read the specific XML error
     315                $ws_status = 'PhpWebGallery Web Services failed and returned an '
     316                   . 'HTTP status of 400. Bad request. The parameters passed '
     317                   . 'to the service did not match as expected. The exact '
     318                   . 'error is returned in the XML response.';
     319                break;
     320        default:
     321                $ws_status = 'PhpWebGallery Web Services returned an unexpected HTTP '
     322                   . 'status of:' . $status_code[0];
     323    }
     324  }
     325  else
     326  {
     327    $ws_status = 'Cannot check - curl not installed';
     328  }
     329  $template->assign( 'WS_STATUS', $ws_status );
    396330}
    397331
Note: See TracChangeset for help on using the changeset viewer.