~includeonce('../config.tmpl') ~includeonce('../config/spell.tmpl') ~includeonce('../lib/ressources.tmpl') ~includeonce('../lib/ressources_ressources.tmpl') ~includeonce('../site/utils.tmpl') ~includeonce('../lib/admin.tmpl') ~includeonce('../lib/html.tmpl') ~map_filenamevar('res_id','res_table') ~if(~integer(~get('res_table'))>0, { ~get_res_info(~get('res_table'),'res'), ~redirect('~get_site_url()admin/edit_sections,~get('res_id'),~get('res[table]').html') }) ~set('res_id',~integer(~get('res_id'))) ~set('res_type',~res_table_to_res_type(~get('res_table'))) ~get_res_info(~get('res_type'),'res') ~set('res_name',~get('res[name]')) ~if( ~file_exists('~getconf('templatedir')lib/~get('res_table').tmpl'), ~includeonce('../lib/~get('res_table').tmpl') ) ~include('../site/admin.header.tmpl','Gestion section ~getpost('id')') ~if(~getpost('id')!='', ~list(~get('database'), "SELECT id FROM ~get('res_table')_sections WHERE id=~integer(~getpost('id'))", 'LF',~set('id',~fld('id')) ) ) ~if(~get('id')!='', 'Modification de la section ~getpost('longname')', 'Ajout de la section ~getpost('longname')' ) : ~set('ok',1) ~if(!~preg('/^([a-z]+)$/',~getpost('section')), '~set('ok',0)Le format d\'adresse n\'est pas le bon.' ) ~list(~get('database'), "SELECT id FROM ~get('res_table')_sections WHERE section='~addslashes(~getpost('section'))' ~if(~get('id'), "AND id!='~get('id')'") ", 'LF','~set('ok',0)Le nom existe déjà' ) ~if(~get('ok')==1, '~if(~get('id')=='', ~list(~get('database'),"INSERT INTO ~get('res_table')_sections(section,longname,state,main) VALUES( '~addslashes(~getpost('section'))', '~addslashes(~getpost('longname'))', '~if(~getpost('state')!='','1','0')', '~if(~getpost('main')!='','1','0')' )") , ~list(~get('database'),"UPDATE ~get('res_table')_sections SET section='~addslashes(~getpost('section'))', longname='~addslashes(~getpost('longname'))', state='~if(~getpost('state')!='','1','0')', main='~if(~getpost('main')!='','1','0')' WHERE id=~integer(~get('id')) ") ) ~if(~get('id')=='',~list(~get('database'),"SELECT last_insert_id() AS last",'LF',~set('id',~fld('last')))) OK !
Retour à l\'édition. ') ~include("../site/admin.footer.tmpl")