admin.php 1.2 KB
Newer Older
Jan Grewe's avatar
Jan Grewe committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');

if (isset($_POST['submit'])) {
  if(isset($_POST['cdn_enabled'])) {
    $cdn_enabled = 'true';
  }else{
    $cdn_enabled = 'false';
  }
  $q = 'UPDATE '.CONFIG_TABLE.' SET value="'.$cdn_enabled.'" WHERE param="cdn_enabled"';
  pwg_query($q);
  $q = 'UPDATE '.CONFIG_TABLE.' SET value="'.$_POST['cdn_count'].'" WHERE param="cdn_count"';
  pwg_query($q);
  $q = 'UPDATE '.CONFIG_TABLE.' SET value="'.$_POST['cdn_host'].'" WHERE param="cdn_host"';
  pwg_query($q);
  list($conf['cdn_enabled']) = array_from_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param = "cdn_enabled"', 'value');
  list($conf['cdn_count']) = array_from_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param = "cdn_count"', 'value');
  list($conf['cdn_host']) = array_from_query('SELECT value FROM '.CONFIG_TABLE.' WHERE param = "cdn_host"', 'value');
}

$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');

$template->assign(
    array(
      'CDN_ENABLED' => $conf['cdn_enabled'],
      'CDN_COUNT'    => $conf['cdn_count'],
      'CDN_HOST'    => $conf['cdn_host'],
    )
);

$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
?>