Ignore:
Timestamp:
Jun 13, 2013, 2:01:34 PM (11 years ago)
Author:
mistic100
Message:

use serialized array for config + custom upgrade process

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Back2Front/admin.php

    r12361 r23177  
    33
    44global $conf, $template;
    5 load_language('plugin.lang', B2F_PATH);
    6 $conf['back2front'] = explode(',', $conf['back2front']);
    75
    8 include_once(B2F_PATH.'functions.inc.php');
     6include_once(B2F_PATH . 'include/functions.inc.php');
    97
    108// Enregistrement de la configuration
     
    1210{
    1311  $conf['back2front'] = array(
    14     $conf['back2front'][0],
    15     $_POST['switch_mode'],
    16     $_POST['transition'],
    17     $_POST['position'],
    18     serialize(stripslashes_deep(str_replace(array("'",'"',','), null, $_POST['link_name']))),
    19     isset($_POST['show_thumbnail']),
    20   );
     12    'versos_cat' => $conf['back2front']['versos_cat'],
     13    'switch_mode' => $_POST['switch_mode'],
     14    'transition' => $_POST['transition'],
     15    'position' => $_POST['position'],
     16    'link_name' => stripslashes_deep($_POST['link_name']),
     17    'show_thumbnail' => isset($_POST['show_thumbnail']),
     18    );
    2119 
    22   conf_update_param('back2front', implode (',', $conf['back2front']));
     20  conf_update_param('back2front', serialize($conf['back2front']));
    2321  array_push($page['infos'], l10n('Information data registered in database'));
    2422}
    2523
    2624// Gestion des langues pour le bloc menu
    27 $conf['back2front'][4] = unserialize($conf['back2front'][4]);
    2825$template->append('link_name', array(
    2926  'LANGUAGE_NAME' => l10n('Default'),
    3027  'LANGUAGE_CODE' => 'default',
    31   'VALUE' => @$conf['back2front'][4]['default'],
    32   )
    33 );
     28  'VALUE' => @$conf['back2front']['link_name']['default'],
     29  ));
     30 
    3431foreach (get_languages() as $language_code => $language_name)
    3532{
     
    3734    'LANGUAGE_NAME' => $language_name,
    3835    'LANGUAGE_CODE' => $language_code,
    39     'VALUE' => isset($conf['back2front'][4][$language_code]) ? $conf['back2front'][4][$language_code] : '',
    40     )
    41   );
     36    'VALUE' => @$conf['back2front']['link_name'][$language_code],
     37    ));
    4238}
    4339
    4440$template->assign(array(
    4541  'B2F_PATH' => B2F_PATH,
    46   'SWITCH_MODE' => $conf['back2front'][1],
    47   'TRANSITION' => $conf['back2front'][2],
    48   'POSITION' => $conf['back2front'][3],
    49   'SHOW_THUMBNAIL' => $conf['back2front'][5],
    50 ));
     42  'SWITCH_MODE' => $conf['back2front']['switch_mode'],
     43  'TRANSITION' => $conf['back2front']['transition'],
     44  'POSITION' => $conf['back2front']['position'],
     45  'SHOW_THUMBNAIL' => $conf['back2front']['show_thumbnail'],
     46  ));
    5147 
    52 $template->set_filename('back2front_conf', dirname(__FILE__).'/template/admin.tpl');
     48$template->set_filename('back2front_conf', realpath(B2F_PATH.'template/admin.tpl'));
    5349$template->assign_var_from_handle('ADMIN_CONTENT', 'back2front_conf');
    5450
Note: See TracChangeset for help on using the changeset viewer.