Ignore:
Timestamp:
Apr 12, 2011, 5:20:10 PM (13 years ago)
Author:
flop25
Message:

all the admin page works
real icon set added
todo: front end, localization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Icons_Set/admin.php

    r10299 r10326  
    1212{
    1313        check_pwg_token();
     14        $conf_iconset = @unserialize($conf['iconset']);//pwg_db_real_escape_string(serialize($conf_iconset))
     15        $conf_themes=$conf_iconset['themes'];
     16        $conf_icons=$conf_iconset['icons'];
     17        $conf_icons=$conf_iconset['icons'];
     18        $error_update='';
     19        $update_ok='';
     20        foreach ($conf_themes as $theme_id => $iconset) // theme supprimé
     21        {
     22                if (isset($_POST[$theme_id]) and isset($conf_themes[$theme_id]) and $conf_themes[$theme_id]!=$_POST[$theme_id] and in_array($_POST[$theme_id], $conf_icons))
     23                {
     24                        $conf_themes[$theme_id]=$_POST[$theme_id];
     25                        $update_ok.=$theme_id.' / ';
     26                }
     27                elseif (empty($_POST[$theme_id]) and $conf_themes[$theme_id]!=$_POST[$theme_id])
     28                {
     29                        $conf_themes[$theme_id]='';
     30                        $update_ok.=$theme_id.' / ';
     31                }
     32                elseif (!isset($_POST[$theme_id]) or !isset($conf_themes[$theme_id]) or (!in_array($_POST[$theme_id], $conf_icons) and !empty($_POST[$theme_id])) )
     33                {
     34                        $error_update.=$theme_id.' / ';
     35                }
     36        }
     37        $conf['iconset']=array(
     38                'themes'=>$conf_themes,
     39                'icons'=>$conf_icons
     40                );
     41  $query = '
     42    UPDATE '.CONFIG_TABLE.'
     43    SET value="'.pwg_db_real_escape_string(serialize($conf['iconset'])).'"
     44    WHERE param="iconset"
     45    LIMIT 1';
     46  pwg_query($query);
     47        if (!empty($error_update)) {    array_push($page['infos'], l10n('iconset_error_update').$error_update );         }
     48        if (!empty($update_ok)) {       array_push($page['infos'], l10n('iconset_update_ok').$update_ok );       }
     49        load_conf_from_db();
    1450}
    1551////////////////////////////////////////////////
     
    117153    LIMIT 1';
    118154  pwg_query($query);
     155        load_conf_from_db();
    119156        if (!empty($info_new_theme)) {  array_push($page['infos'], l10n('iconset_info_new_theme').$info_new_theme );     }
    120157        if (!empty($info_new_icon)) {   array_push($page['infos'], l10n('iconset_info_new_icon').$info_new_icon );       }
     
    144181$values=array();
    145182$output=array();
     183$template->func_combine_css(array(
     184        'path' => 'themes/default/iconset.css',
     185        ),
     186        $smarty
     187);
     188
    146189foreach ($conf_icons as $iconset)
    147190{
     
    153196  'icon_file' => $iconsetconf['icon_file'],
    154197  'css_file' => $iconsetconf['css_file'],
     198  'css_file_admin' => $iconsetconf['css_file_admin'],
    155199        );
    156200        $values[]=$iconset;
    157201        $output[]=$iconsetconf['name'];
     202        $template->func_combine_css(array(
     203                'path' => $iconsetconf['css_file_admin'],
     204                ),
     205                $smarty
     206        );
    158207}
    159208$template->assign(array(
     
    173222        $smarty
    174223);
     224
    175225$template->set_filename('plugin_admin_content', dirname(__FILE__) .'/template/admin.tpl');
    176226$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Note: See TracChangeset for help on using the changeset viewer.