source: extensions/GThumb/admin.php @ 12678

Last change on this file since 12678 was 12678, checked in by patdenice, 12 years ago

Add GThumb+ plugin

File size: 1.8 KB
RevLine 
[12678]1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5global $template, $conf;
6
7load_language('plugin.lang', GTHUMB_PATH);
8include_once(GTHUMB_PATH.'functions.inc.php');
9include(dirname(__FILE__).'/config_default.inc.php');
10$params = $conf['GThumb'];
11
12// Save configuration
13if (isset($_POST['submit']))
14{
15  $params  = array(
16    'height'          => $_POST['height'],
17    'margin'          => $_POST['margin'],
18    'nb_image_page'   => $_POST['nb_image_page'],
19    'big_thumb'       => !empty($_POST['big_thumb']),
20    'cache_big_thumb' => !empty($_POST['cache_big_thumb']),
21    'method'          => $_POST['method'],
22  );
23
24  if (!is_numeric($params['height']))
25  {
26    array_push($page['errors'], 'Thumbnails max height must be an integer.');
27  }
28  if (!is_numeric($params['margin']))
29  {
30    array_push($page['errors'], 'Margin between thumbnails must be an integer.');
31  }
32  if (!is_numeric($params['nb_image_page']))
33  {
34    array_push($page['errors'], 'Number of photos per page must be an integer.');
35  }
36
37  if (empty($page['errors']))
38  {
39    $query = '
40  UPDATE ' . CONFIG_TABLE . '
41    SET value="' . addslashes(serialize($params)) . '"
42    WHERE param="GThumb"
43    LIMIT 1';
44    pwg_query($query);
45   
46    array_push($page['infos'], l10n('Information data registered in database'));
47  }
48}
49
50// Configuration du template
51$template->assign(
52  array(
53    'HEIGHT'          => $params['height'],
54    'MARGIN'          => $params['margin'],
55    'NB_IMAGE_PAGE'   => $params['nb_image_page'],
56    'BIG_THUMB'       => $params['big_thumb'],
57    'CACHE_BIG_THUMB' => $params['cache_big_thumb'],
58    'METHOD'          => $params['method'],
59  )
60);
61
62$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl'));
63$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
64
65?>
Note: See TracBrowser for help on using the repository browser.