Index: extensions/meta/admin/admin.php
===================================================================
--- extensions/meta/admin/admin.php	(revision 29428)
+++ extensions/meta/admin/admin.php	(revision 29429)
@@ -1,6 +1,8 @@
 <?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+if (!defined('PHPWG_ROOT_PATH'))
+    die('Hacking attempt!');
 global $template, $conf, $user;
-include_once(PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php');
+include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php');
 load_language('plugin.lang', meta_PATH);
 $my_base_url = get_admin_plugin_menu_link(__FILE__);
@@ -12,5 +14,4 @@
 
 //-------------------------------------------------------- sections definitions
-
 // TAB gest
 if (!isset($_GET['tab']))
@@ -18,319 +19,262 @@
 else
     $page['tab'] = $_GET['tab'];
-
 $tabsheet = new tabsheet();
-$tabsheet->add('gestion',
-               l10n('meta_onglet_gestion'),
-               $my_base_url.'&amp;tab=gestion');
-$tabsheet->add('persometa',
-               l10n('Personal Metadata'),
-               $my_base_url.'&amp;tab=persometa');
-
-	$MPC = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ContactForm';"));
-	if($MPC['state'] == 'active')
-	{
-$tabsheet->add('contactmeta',
-               l10n('Contact page Metadata'),
-               $my_base_url.'&amp;tab=contactmeta');
-	}
-	$MAP = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'AdditionalPages';"));
-	if($MAP['state'] == 'active')
-	{
-$tabsheet->add('AdditionalPagesmeta',
-               l10n('Additional Pages Metadata'),
-               $my_base_url.'&amp;tab=AdditionalPagesmeta');
-	}
-			   
-$tabsheet->add('description',
-               l10n('meta_onglet_description'),
-               $my_base_url.'&amp;tab=description');
+$tabsheet->add('gestion', l10n('meta_onglet_gestion'), $my_base_url . '&amp;tab=gestion');
+$tabsheet->add('persometa', l10n('Personal Metadata'), $my_base_url . '&amp;tab=persometa');
+
+$MPC = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ContactForm';"));
+if ($MPC['state'] == 'active') {
+    $tabsheet->add('contactmeta', l10n('Contact page Metadata'), $my_base_url . '&amp;tab=contactmeta');
+}
+$MAP = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'AdditionalPages';"));
+if ($MAP['state'] == 'active') {
+    $tabsheet->add('AdditionalPagesmeta', l10n('Additional Pages Metadata'), $my_base_url . '&amp;tab=AdditionalPagesmeta');
+}
+
+$tabsheet->add('description', l10n('meta_onglet_description'), $my_base_url . '&amp;tab=description');
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
 
 // Tab gest
-switch ($page['tab'])
-{
-  case 'gestion':
+switch ($page['tab']) {
+    case 'gestion':
 
 //read metadata list
-$groups = array();
-$query = '
+        $groups = array();
+        $query = '
 select id,metaname
   FROM ' . meta_TABLE . '
   ORDER BY metaname ASC;';
-$result = pwg_query($query);
-
-while ($row = pwg_db_fetch_assoc($result))
-	{
-  $groups[$row['id']] = $row['metaname'];
-	}
-
-    $selected = 0;
-	$options[] = l10n('meta_select2');
-	$options['a'] = '----------------------';
-
-
-  foreach ($groups as $metalist => $metalist2)
-	{
-    $options[$metalist] = $metalist2;
-	}
-  $template->assign(
-    'gestionA',
-    array(
-      'OPTIONS' => $options,
-      'SELECTED' => $selected
-      ));
-
+        $result = pwg_query($query);
+        while ($row = pwg_db_fetch_assoc($result)) {
+            $groups[$row['id']] = $row['metaname'];
+        }
+        $selected = 0;
+        $options[] = l10n('meta_select2');
+        $options['a'] = '----------------------';
+
+        foreach ($groups as $metalist => $metalist2) {
+            $options[$metalist] = $metalist2;
+        }
+        $template->assign(
+                'gestionA', array(
+            'OPTIONS' => $options,
+            'SELECTED' => $selected
+        ));
 
 //edit meta
-if (isset($_POST['submitchoixmeta']) and is_numeric($_POST['metalist']) and (!$_POST['metalist'])==0)
-	{
-$lire=$_POST['metalist'];
-	$query = '
+        if (isset($_POST['submitchoixmeta']) and is_numeric($_POST['metalist']) and ( !$_POST['metalist']) == 0) {
+            $lire = $_POST['metalist'];
+            $query = '
 select id,metaname,metaval
   FROM ' . meta_TABLE . '
-  WHERE id = \''.$lire.'\'
-  ;';
-$result = pwg_query($query);
-
-$row = pwg_db_fetch_assoc($result);
-$chname=$row['metaname'];
-$chval=$row['metaval'];
-
-  $selected2 = "";
-  
-  $template->assign(
-    'meta_edit',
-    array(
-      'VALUE' => $chname,
-      'CONTENT' => $chval,
-      'SELECTED' => $selected2
-      ));
-	}
+  WHERE id = \'' . $lire . '\'
+  ;';
+            $result = pwg_query($query);
+
+            $row = pwg_db_fetch_assoc($result);
+            $chname = $row['metaname'];
+            $chval = $row['metaval'];
+
+            $selected2 = "";
+
+            $template->assign(
+                    'meta_edit', array(
+                'VALUE' => $chname,
+                'CONTENT' => $chval,
+                'SELECTED' => $selected2
+            ));
+        }
 
 //inser metadata in table
-if (isset($_POST['submitinsmeta']))
-	{
-	$query = '
+        if (isset($_POST['submitinsmeta'])) {
+            $query = '
 UPDATE ' . meta_TABLE . '
-  SET metaval= \''.$_POST['inser'].'\'
-  WHERE metaname = \''.$_POST['invisible'].'\'
+  SET metaval= \'' . $_POST['inser'] . '\'
+  WHERE metaname = \'' . $_POST['invisible'] . '\'
     ;';
-$result = pwg_query($query);
-array_push($page['infos'], l10n('Metadata updated'));
-	}
-
-    break;
+            $result = pwg_query($query);
+            array_push($page['infos'], l10n('Metadata updated'));
+        }
+        break;
 
 //description TAB
-  case 'description':
-
-$blockdesc = 'description';
-$template->assign(
-	$blockdesc,
-	array(
-	  'meta'=>l10n('meta_name'),
-	  ));
-	break;
+    case 'description':
+        $blockdesc = 'description';
+        $template->assign(
+                $blockdesc, array(
+            'meta' => l10n('meta_name'),
+        ));
+        break;
 
 // TAB personnal metadata
-  case 'persometa':
-
-  $template->assign(
-	'metapersoT',
-	array(
-	  'meta'=>l10n('meta_name'),
-	  ));
-$admin_base_url = $my_base_url.'&amp;tab=persometa';
-$metapersos = pwg_query("SELECT * FROM `". METAPERSO_TABLE .";");
-
-if (pwg_db_num_rows($metapersos)) {	
- while ($metaperso = pwg_db_fetch_assoc($metapersos))
-	{
-    $items = array(
-      'METANAME' => $metaperso['metaname'],
-      'METAVAL' => $metaperso['metaval'],
-      'METATYPE' => $metaperso['metatype'],
-	  'U_DELETE' => $admin_base_url.'&amp;delete='.$metaperso['id'],
-      'U_EDIT' => $admin_base_url.'&amp;edit='.$metaperso['id'],
-		);
-		
-	$template->append('metapersos', $items);
-  	}
-}
- if (isset($_POST['submitaddpersonalmeta']))
-	{
-	  $template->assign(
-	'meta_edit2',
-	array(
-	  'meta'=>l10n('meta_name'),
-	  'METAID' => 0,
-	  ));
-	}
-
- if (isset($_POST['submitaddmetaperso']))
-	{
-		$query = '
+    case 'persometa':
+        $template->assign(
+                'metapersoT', array(
+            'meta' => l10n('meta_name'),
+        ));
+        $admin_base_url = $my_base_url . '&amp;tab=persometa';
+        $metapersos = pwg_query("SELECT * FROM `" . METAPERSO_TABLE . ";");
+
+        if (pwg_db_num_rows($metapersos)) {
+            while ($metaperso = pwg_db_fetch_assoc($metapersos)) {
+                $items = array(
+                    'METANAME' => $metaperso['metaname'],
+                    'METAVAL' => $metaperso['metaval'],
+                    'METATYPE' => $metaperso['metatype'],
+                    'U_DELETE' => $admin_base_url . '&amp;delete=' . $metaperso['id'],
+                    'U_EDIT' => $admin_base_url . '&amp;edit=' . $metaperso['id'],
+                );
+
+                $template->append('metapersos', $items);
+            }
+        }
+        if (isset($_POST['submitaddpersonalmeta'])) {
+            $template->assign(
+                    'meta_edit2', array(
+                'meta' => l10n('meta_name'),
+                'METAID' => 0,
+            ));
+        }
+
+        if (isset($_POST['submitaddmetaperso'])) {
+            $query = '
 DELETE 
   FROM ' . METAPERSO_TABLE . '
-  WHERE id = '.$_POST['invisibleID'].'
-  ;';
-$result = pwg_query($query);
-	
-	
-	$q = '
-INSERT INTO ' . $prefixeTable . 'metaperso(metaname,metaval,metatype)VALUES ("'.$_POST['insername'].'","'.$_POST['inserval'].'","'.$_POST['insertype'].'");';
-    pwg_query($q);
-	$_SESSION['page_infos'] = array(l10n('Personal metadata update'));
-	redirect($admin_base_url);  
-	}
-	
-	  if (isset($_GET['edit']))
-  {
-    check_input_parameter('edit', $_GET, false, PATTERN_ID);
-
-		$query = '
+  WHERE id = ' . $_POST['invisibleID'] . '
+  ;';
+            $result = pwg_query($query);
+            $q = '
+INSERT INTO ' . $prefixeTable . 'metaperso(metaname,metaval,metatype)VALUES ("' . $_POST['insername'] . '","' . $_POST['inserval'] . '","' . $_POST['insertype'] . '");';
+            pwg_query($q);
+            $_SESSION['page_infos'] = array(l10n('Personal metadata update'));
+            redirect($admin_base_url);
+        }
+
+        if (isset($_GET['edit'])) {
+            check_input_parameter('edit', $_GET, false, PATTERN_ID);
+
+            $query = '
 select id,metaname,metaval,metatype
   FROM ' . METAPERSO_TABLE . '
-  WHERE id = \''.$_GET['edit'].'\'
-  ;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);	
-  $template->assign(
-    'meta_edit2',
-    array(
-      'METAID' => $row['id'],
-	  'METANAME' => $row['metaname'],
-      'METAVAL' => $row['metaval'],
-      'METATYPE' => $row['metatype'],
-      ));	
-	
-  }
-		
-	if (isset($_GET['delete']))
-{
-  check_input_parameter('delete', $_GET, false, PATTERN_ID);
-  
-  $query = '
+  WHERE id = \'' . $_GET['edit'] . '\'
+  ;';
+            $result = pwg_query($query);
+            $row = pwg_db_fetch_assoc($result);
+            $template->assign(
+                    'meta_edit2', array(
+                'METAID' => $row['id'],
+                'METANAME' => $row['metaname'],
+                'METAVAL' => $row['metaval'],
+                'METATYPE' => $row['metatype'],
+            ));
+        }
+
+        if (isset($_GET['delete'])) {
+            check_input_parameter('delete', $_GET, false, PATTERN_ID);
+            $query = '
 DELETE
-  FROM '.METAPERSO_TABLE.'
-  WHERE id = '.$_GET['delete'].'
+  FROM ' . METAPERSO_TABLE . '
+  WHERE id = ' . $_GET['delete'] . '
 ;';
-  pwg_query($query);
- 
-  $_SESSION['page_infos'] = array(l10n('Personal metadata update'));
-  redirect($admin_base_url);
-}
-	
-	
-	break;
-
-	case 'contactmeta':
-if (empty($conf['contactmeta']))
- {
- $conf['contactmeta'] = ',';
- }
-
-$metacontact = explode(',', $conf['contactmeta']);
-	
-	$template->assign('contactmetaT',
-    array('CMKEY' => $metacontact[0],'CMDESC' => $metacontact[1],));
-
-if (isset($_POST['submitcm']))
-	{
-$INSCM = $_POST['inser'].",".$_POST['inser2'];
-conf_update_param('contactmeta', $INSCM);
-array_push($page['infos'], l10n('Metadata updated'));
-$template->assign(
-    'contactmetaT',
-	array('CMKEY' => stripslashes($_POST['inser']),'CMDESC' => stripslashes($_POST['inser2'])));
-	}
-	
-	break;
-	
-	case 'AdditionalPagesmeta':
-if (!defined('TITLE_AP_TABLE')) define('TITLE_AP_TABLE', $prefixeTable.'title_ap');
-$groups = array();
-$query = '
+            pwg_query($query);
+
+            $_SESSION['page_infos'] = array(l10n('Personal metadata update'));
+            redirect($admin_base_url);
+        }
+        break;
+
+    case 'contactmeta':
+        if (empty($conf['contactmeta'])) {
+            $conf['contactmeta'] = ',';
+        }
+        $metacontact = explode(',', $conf['contactmeta']);
+        $template->assign('contactmetaT', array('CMKEY' => $metacontact[0], 'CMDESC' => $metacontact[1],));
+
+        if (isset($_POST['submitcm'])) {
+            $INSCM = $_POST['inser'] . "," . $_POST['inser2'];
+            conf_update_param('contactmeta', $INSCM);
+            array_push($page['infos'], l10n('Metadata updated'));
+            $template->assign(
+                    'contactmetaT', array('CMKEY' => stripslashes($_POST['inser']), 'CMDESC' => stripslashes($_POST['inser2'])));
+        }
+        break;
+
+    case 'AdditionalPagesmeta':
+        if (!defined('TITLE_AP_TABLE'))
+            define('TITLE_AP_TABLE', $prefixeTable . 'title_ap');
+        $groups = array();
+        $query = '
 select id,title
   FROM ' . ADD_PAGES_TABLE . '
   ORDER BY id ASC;';
-$result = pwg_query($query);
-	
-	while ($row = pwg_db_fetch_assoc($result))
-	{
-  $groups[$row['id']] = $row['id'].' : '.$row['title'];
-	}
-	
-	$selected = 0;
-	$options[] = l10n('Choose it page');
-	$options['a'] = '----------------------';
-	
-foreach($groups as $listid => $listid2)
-	{
-    $options[$listid] = $listid2;
-	}
-  $template->assign(
-    'gestionC',
-    array(
-	  'OPTIONS' => $options,
-      'SELECTED' => $selected
-      ));
-	
-	if (isset($_POST['submitchoixAP'])and is_numeric($_POST['APchoix']) and (!$_POST['APchoix'])==0)
-	{
-$lire=$_POST['APchoix'];
-	$query = '
+        $result = pwg_query($query);
+        while ($row = pwg_db_fetch_assoc($result)) {
+            $groups[$row['id']] = $row['id'] . ' : ' . $row['title'];
+        }
+
+        $selected = 0;
+        $options[] = l10n('Choose it page');
+        $options['a'] = '----------------------';
+
+        foreach ($groups as $listid => $listid2) {
+            $options[$listid] = $listid2;
+        }
+        $template->assign(
+                'gestionC', array(
+            'OPTIONS' => $options,
+            'SELECTED' => $selected
+        ));
+
+        if (isset($_POST['submitchoixAP'])and is_numeric($_POST['APchoix']) and ( !$_POST['APchoix']) == 0) {
+            $lire = $_POST['APchoix'];
+            $query = '
 select id,metaKeyap,metadesap
   FROM ' . META_AP_TABLE . '
-  WHERE id = \''.$lire.'\'
-  ;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-$metaKeyapap=$row['metaKeyap'];
-$metadesap=$row['metadesap'];
-
-$query = '
+  WHERE id = \'' . $lire . '\'
+  ;';
+            $result = pwg_query($query);
+            $row = pwg_db_fetch_assoc($result);
+            $metaKeyapap = $row['metaKeyap'];
+            $metadesap = $row['metadesap'];
+
+            $query = '
 select id,title
   FROM ' . ADD_PAGES_TABLE . '
-  WHERE id = \''.$lire.'\'
+  WHERE id = \'' . $lire . '\'
     ;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-$idap=$row['id'];
-$nameap=$row['title'];
-
-  $selected3 = 0;
-  
-  $template->assign(
-    'ap_edit',
-    array(
-      'VALUE' => $idap,
-	  'VALUEN' => $nameap,
-      'CONTENTMKAP' => $metaKeyapap,
-	  'CONTENTMDAP' => $metadesap,
-      'SELECTED' => $selected3
-      ));
-	}
-
-if (isset($_POST['submitinsapm']))
-	{
-	$query = '
+            $result = pwg_query($query);
+            $row = pwg_db_fetch_assoc($result);
+            $idap = $row['id'];
+            $nameap = $row['title'];
+
+            $selected3 = 0;
+
+            $template->assign(
+                    'ap_edit', array(
+                'VALUE' => $idap,
+                'VALUEN' => $nameap,
+                'CONTENTMKAP' => $metaKeyapap,
+                'CONTENTMDAP' => $metadesap,
+                'SELECTED' => $selected3
+            ));
+        }
+
+        if (isset($_POST['submitinsapm'])) {
+            $query = '
 DELETE 
   FROM ' . META_AP_TABLE . '
-  WHERE id = \''.$_POST['invisible'].'\'
-  ;';
-$result = pwg_query($query);
-	$q = '
-INSERT INTO ' . $prefixeTable . 'meta_ap(id,metaKeyap,metadesap)VALUES ('.$_POST['invisible'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'");';
-    pwg_query($q);
-	array_push($page['infos'], l10n('Metadata updated'));
-	}
-	
-	break;
-	
-} 
-
-$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
+  WHERE id = \'' . $_POST['invisible'] . '\'
+  ;';
+            $result = pwg_query($query);
+            $q = '
+INSERT INTO ' . $prefixeTable . 'meta_ap(id,metaKeyap,metadesap)VALUES (' . $_POST['invisible'] . ',"' . $_POST['inser'] . '","' . $_POST['inser2'] . '");';
+            pwg_query($q);
+            array_push($page['infos'], l10n('Metadata updated'));
+        }
+        break;
+}
+
+$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 ?>
Index: extensions/meta/initadmin.php
===================================================================
--- extensions/meta/initadmin.php	(revision 29428)
+++ extensions/meta/initadmin.php	(revision 29429)
@@ -1,33 +1,32 @@
 <?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+if (!defined('PHPWG_ROOT_PATH'))
+    die('Hacking attempt!');
 
 
 //Add link menu
 add_event_handler('get_admin_plugin_menu_links', 'meta_admin_menu');
-function meta_admin_menu($menu)
-{
-  load_language('plugin.lang', meta_PATH);
-  array_push($menu, array(
-	'NAME' => l10n('Manage tag Metadata'),
-    'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php')));
-  return $menu;
+
+function meta_admin_menu($menu) {
+    load_language('plugin.lang', meta_PATH);
+    array_push($menu, array(
+        'NAME' => l10n('Manage tag Metadata'),
+        'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php')));
+    return $menu;
 }
 
+//add prefiltre photo
+add_event_handler('loc_begin_admin', 'metaPadminf', 55);
+add_event_handler('loc_begin_admin_page', 'metaPadminA', 55);
 
-//add prefiltre photo
-add_event_handler('loc_begin_admin', 'metaPadminf',55);
-add_event_handler('loc_begin_admin_page', 'metaPadminA',55);
+function metaPadminf() {
+    global $template;
+    $template->set_prefilter('picture_modify', 'metaPadminfT');
+}
 
-function metaPadminf()
-	{
-	global $template;
-	$template->set_prefilter('picture_modify', 'metaPadminfT');
-	}
+function metaPadminfT($content, &$smarty) {
+    $search = '#</form>#';
 
-function metaPadminfT($content, &$smarty)
-	{
-  $search = '#</form>#';
-  
-  $replacement = '
+    $replacement = '
 	<div>
 		<fieldset>
@@ -48,65 +47,60 @@
 </form>';
 
-  return preg_replace($search, $replacement, $content);
-	}
- 
-function metaPadminA()
-	{
-	load_language('plugin.lang', meta_PATH);
-if (isset($_GET['image_id']))
- {
- 	global $template, $prefixeTable;
-$query = '
+    return preg_replace($search, $replacement, $content);
+}
+
+function metaPadminA() {
+    load_language('plugin.lang', meta_PATH);
+    if (isset($_GET['image_id'])) {
+        global $template, $prefixeTable;
+        $query = '
 select id,metaKeyimg,metadesimg
   FROM ' . meta_img_TABLE . '
-  WHERE id = '.$_GET['image_id'].'
+  WHERE id = ' . $_GET['image_id'] . '
   ;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-$chvalimg=$row['metaKeyimg'];
-$chvalimgdes=$row['metadesimg'];
- 
-  $template->assign(
-    array(
-      'metaCONTENT' => $chvalimg,
-      'metaCONTENT2' => $chvalimgdes,
-      ));
- }
- 
-if (isset($_POST['submetaphoto']))
- {
- 	$query = '
+        $result = pwg_query($query);
+        $row = pwg_db_fetch_assoc($result);
+        $chvalimg = $row['metaKeyimg'];
+        $chvalimgdes = $row['metadesimg'];
+
+        $template->assign(
+                array(
+                    'metaCONTENT' => $chvalimg,
+                    'metaCONTENT2' => $chvalimgdes,
+        ));
+    }
+
+    if (isset($_POST['submetaphoto'])) {
+        $query = '
 DELETE 
   FROM ' . meta_img_TABLE . '
-  WHERE id = '.$_GET['image_id'].'
+  WHERE id = ' . $_GET['image_id'] . '
   ;';
-$result = pwg_query($query);
-	$q = '
-INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES ('.$_GET['image_id'].',"'.$_POST['insermetaKP'].'","'.$_POST['insermetaDP'].'");';
-    pwg_query($q);
-  
-  $template->assign(
-    array(
-      'metaCONTENT' => $_POST['insermetaKP'],
-      'metaCONTENT2' => $_POST['insermetaDP'],
-      ));
-  }
-	}
-	
+        $result = pwg_query($query);
+        $q = '
+INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES (' . $_GET['image_id'] . ',"' . $_POST['insermetaKP'] . '","' . $_POST['insermetaDP'] . '");';
+        pwg_query($q);
+
+        $template->assign(
+                array(
+                    'metaCONTENT' => $_POST['insermetaKP'],
+                    'metaCONTENT2' => $_POST['insermetaDP'],
+        ));
+    }
+}
+
 //add prefiltre album
 add_event_handler('loc_end_cat_modify', 'metaAadminf');
 add_event_handler('loc_end_cat_modify', 'metaAadminA');
 
-function metaAadminf()
- {
-	global $template;
-	$template->set_prefilter('album_properties', 'metaAadminfT');
- }
+function metaAadminf() {
+    global $template;
+    $template->set_prefilter('album_properties', 'metaAadminfT');
+}
 
-function metaAadminfT($content, &$smarty)
- {
-  $search = '#</form>#';
-  
-  $replacement = '
+function metaAadminfT($content, &$smarty) {
+    $search = '#</form>#';
+
+    $replacement = '
   	<div>
 		
@@ -129,49 +123,46 @@
   ';
 
-  return preg_replace($search, $replacement, $content);
- }
+    return preg_replace($search, $replacement, $content);
+}
 
- function metaAadminA()
-	{ 
-		load_language('plugin.lang', meta_PATH);
-if (isset($_GET['cat_id']))
- {
- 	global $template, $prefixeTable;
-$query = '
+function metaAadminA() {
+    load_language('plugin.lang', meta_PATH);
+    if (isset($_GET['cat_id'])) {
+        global $template, $prefixeTable;
+        $query = '
 select id,metaKeycat,metadescat
   FROM ' . meta_cat_TABLE . '
-  WHERE id = '.$_GET['cat_id'].'
+  WHERE id = ' . $_GET['cat_id'] . '
   ;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-$chvalcat=$row['metaKeycat'];
-$chvalcatdes=$row['metadescat'];
-  
-  $template->assign(
-    array(
-      'metaCONTENT' => $chvalcat,
-	  'metaCONTENT2' => $chvalcatdes,
-      ));
- }
- 
-if (isset($_POST['submetaalbum']))
- {
-	$query = '
+        $result = pwg_query($query);
+        $row = pwg_db_fetch_assoc($result);
+        $chvalcat = $row['metaKeycat'];
+        $chvalcatdes = $row['metadescat'];
+
+        $template->assign(
+                array(
+                    'metaCONTENT' => $chvalcat,
+                    'metaCONTENT2' => $chvalcatdes,
+        ));
+    }
+
+    if (isset($_POST['submetaalbum'])) {
+        $query = '
 DELETE 
   FROM ' . meta_cat_TABLE . '
-  WHERE id = '.$_GET['cat_id'].'
+  WHERE id = ' . $_GET['cat_id'] . '
   ;';
-$result = pwg_query($query);
-	$q = '
-INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES ('.$_GET['cat_id'].',"'.$_POST['insermetaKA'].'","'.$_POST['insermetaDA'].'");';
-    pwg_query($q);
+        $result = pwg_query($query);
+        $q = '
+INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES (' . $_GET['cat_id'] . ',"' . $_POST['insermetaKA'] . '","' . $_POST['insermetaDA'] . '");';
+        pwg_query($q);
 
-  $template->assign(
-    array(
-      'metaCONTENT' => $_POST['insermetaKA'],
-	  'metaCONTENT2' => $_POST['insermetaDA'],
-      ));
-  }
-	}
+        $template->assign(
+                array(
+                    'metaCONTENT' => $_POST['insermetaKA'],
+                    'metaCONTENT2' => $_POST['insermetaDA'],
+        ));
+    }
+}
 
 ?>
Index: extensions/meta/main.inc.php
===================================================================
--- extensions/meta/main.inc.php	(revision 29428)
+++ extensions/meta/main.inc.php	(revision 29429)
@@ -1,3 +1,4 @@
 <?php
+
 /*
   Plugin Name: meta
@@ -26,5 +27,4 @@
     include_once(dirname(__FILE__) . '/initadmin.php');
 }
-
 
 //Gestion des meta dans le header
@@ -163,5 +163,4 @@
 function add_metacat() {
     global $template, $page, $meta_infos;
-
     //meta categories
     if (!empty($page['category']['id'])) {
@@ -194,6 +193,5 @@
 function add_metaimg() {
     global $template, $page, $meta_infos;
-
-    //meta images
+//meta images
     if (!empty($page['image_id'])) {
         $query = '
@@ -219,5 +217,5 @@
         if (!empty($row['metadesimg'])) {
             $template->assign('PLUG_META', $photoDesED);
-        }else {
+        } else {
             $meta_infosph = array();
             $meta_infosph['title'] = $template->get_template_vars('PAGE_TITLE');
@@ -225,7 +223,7 @@
             $meta_infosph['descimg'] = $template->get_template_vars('COMMENT_IMG');
             if (!empty($meta_infosph['descimg'])) {
-                $template->assign('PLUG_META', strip_tags($meta_infosph['descimg']).' - '.$meta_infosph['title']);
-            }else{
-                $template->assign('PLUG_META', $meta_infosph['title'].' - '.$meta_infosph['gt']);
+                $template->assign('PLUG_META', strip_tags($meta_infosph['descimg']) . ' - ' . $meta_infosph['title']);
+            } else {
+                $template->assign('PLUG_META', $meta_infosph['title'] . ' - ' . $meta_infosph['gt']);
             }
         }
@@ -235,5 +233,4 @@
 function set_meta_back() {
     global $template, $meta_infos;
-
     $template->assign
             (array
Index: extensions/meta/maintain.inc.php
===================================================================
--- extensions/meta/maintain.inc.php	(revision 29428)
+++ extensions/meta/maintain.inc.php	(revision 29429)
@@ -1,17 +1,17 @@
 <?php
 
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-function plugin_activate()
-{
-	    global $prefixeTable, $template;
-		define('meta_DIR' , basename(dirname(__FILE__)));
-		define('meta_PATH' , PHPWG_PLUGINS_PATH . meta_DIR . '/');
-		define('meta_TABLE' , $prefixeTable . 'meta');
-		define('meta_img_TABLE' , $prefixeTable . 'meta_img');
-		define('meta_cat_TABLE' , $prefixeTable . 'meta_cat');
-		define('METAPERSO_TABLE', $prefixeTable.'metaperso');
-
-	$query = "CREATE TABLE IF NOT EXISTS ". METAPERSO_TABLE ." (
+if (!defined('PHPWG_ROOT_PATH'))
+    die('Hacking attempt!');
+
+function plugin_activate() {
+    global $prefixeTable, $template;
+    define('meta_DIR', basename(dirname(__FILE__)));
+    define('meta_PATH', PHPWG_PLUGINS_PATH . meta_DIR . '/');
+    define('meta_TABLE', $prefixeTable . 'meta');
+    define('meta_img_TABLE', $prefixeTable . 'meta_img');
+    define('meta_cat_TABLE', $prefixeTable . 'meta_cat');
+    define('METAPERSO_TABLE', $prefixeTable . 'metaperso');
+
+    $query = "CREATE TABLE IF NOT EXISTS " . METAPERSO_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL auto_increment,
 metaname VARCHAR( 255 ) NOT NULL ,
@@ -19,125 +19,119 @@
 metatype VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-
-  if (!isset($conf['contactmeta']))
-  {
-  	conf_update_param('contactmeta', ',');
-  }
-  
-  	if (!defined('META_AP_TABLE')) define('META_AP_TABLE', $prefixeTable.'meta_ap');	
-	$query = "CREATE TABLE IF NOT EXISTS ". META_AP_TABLE ." (
+    $result = pwg_query($query);
+
+    if (!isset($conf['contactmeta'])) {
+        conf_update_param('contactmeta', ',');
+    }
+
+    if (!defined('META_AP_TABLE'))
+        define('META_AP_TABLE', $prefixeTable . 'meta_ap');
+    $query = "CREATE TABLE IF NOT EXISTS " . META_AP_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeyap VARCHAR( 255 ) NOT NULL ,
 metadesap VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-	
-	
+    $result = pwg_query($query);
+
 //Gestion MAJ2
-$majm2='meta 2.1.0';
-$query = '
+    $majm2 = 'meta 2.1.0';
+    $query = '
 select param,value
 	FROM ' . CONFIG_TABLE . '
-  WHERE param = \''.$majm2.'\'
+  WHERE param = \'' . $majm2 . '\'
 	;';
-$result = pwg_query($query);
-
-$row = pwg_db_fetch_assoc($result);
-$majparam2=$row['param'];
-$majvalue2=$row['value'];
-
-if (!$majvalue2==1)
- {
+    $result = pwg_query($query);
+
+    $row = pwg_db_fetch_assoc($result);
+    $majparam2 = $row['param'];
+    $majvalue2 = $row['value'];
+
+    if (!$majvalue2 == 1) {
 
 //Gestion MAJ1
-$majm1='meta 2.0.5';
-$query = '
+        $majm1 = 'meta 2.0.5';
+        $query = '
 select param,value
 	FROM ' . CONFIG_TABLE . '
-  WHERE param = \''.$majm1.'\'
+  WHERE param = \'' . $majm1 . '\'
 	;';
-$result = pwg_query($query);
-
-$row = pwg_db_fetch_assoc($result);
-$majparam1=$row['param'];
-$majvalue1=$row['value'];
-
-if (!$majvalue1==1)
-	{
-if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img');
-	$query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." (
+        $result = pwg_query($query);
+
+        $row = pwg_db_fetch_assoc($result);
+        $majparam1 = $row['param'];
+        $majvalue1 = $row['value'];
+
+        if (!$majvalue1 == 1) {
+            if (!defined('meta_img_TABLE'))
+                define('meta_img_TABLE', $prefixeTable . 'meta_img');
+            $query = "CREATE TABLE IF NOT EXISTS " . meta_img_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeyimg VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-
-if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat');	
-	$query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." (
+            $result = pwg_query($query);
+
+            if (!defined('meta_cat_TABLE'))
+                define('meta_cat_TABLE', $prefixeTable . 'meta_cat');
+            $query = "CREATE TABLE IF NOT EXISTS " . meta_cat_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeycat VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-
-	$query = '
+            $result = pwg_query($query);
+
+            $query = '
 select id
   FROM ' . CATEGORIES_TABLE . '
   ORDER BY id DESC;';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-
-$comp=$row['id']+1;	
-$i=1;
-
-	while($i < $comp)
-		{
-	$query = '
+            $result = pwg_query($query);
+            $row = pwg_db_fetch_assoc($result);
+
+            $comp = $row['id'] + 1;
+            $i = 1;
+
+            while ($i < $comp) {
+                $query = '
 select id,metaKeywords
   FROM ' . CATEGORIES_TABLE . '
-  WHERE id = \''.$i.'\'';
-$result = pwg_query($query);
-$row = pwg_db_fetch_assoc($result);
-
-		if(!$row['id']==0 and !$row['metaKeywords']==0)
-			{
-	$query = '
-INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES ('.$row['id'].',"'.$row['metaKeywords'].'");';
-	$result = pwg_query($query);
-			}
-	++$i;
-		}
-	
-	$query = ' ALTER TABLE '. CATEGORIES_TABLE .' DROP COLUMN `metaKeywords`';
-    pwg_query($query);
-	
-	$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm1.'",1,"MAJ meta");';
-    pwg_query($query);
-	$majvalue1==1;
-	$maj =0;
-	}
-	
-		
-	  $q = '
-ALTER TABLE '.meta_cat_TABLE.' ADD COLUMN metadescat VARCHAR( 255 ) NOT NULL ';
-  pwg_query($q);
-  
-  	  $q = '
-ALTER TABLE '.meta_img_TABLE.' ADD COLUMN metadesimg VARCHAR( 255 ) NOT NULL ';
-  pwg_query($q);
-	
-	$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm2.'",1,"MAJ meta");';
-    pwg_query($query);
-
-    $template->delete_compiled_templates(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); 
-	
-	$majvalue2==1;
-	$maj =0;
- }
+  WHERE id = \'' . $i . '\'';
+                $result = pwg_query($query);
+                $row = pwg_db_fetch_assoc($result);
+
+                if (!$row['id'] == 0 and ! $row['metaKeywords'] == 0) {
+                    $query = '
+INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat)VALUES (' . $row['id'] . ',"' . $row['metaKeywords'] . '");';
+                    $result = pwg_query($query);
+                }
+                ++$i;
+            }
+
+            $query = ' ALTER TABLE ' . CATEGORIES_TABLE . ' DROP COLUMN `metaKeywords`';
+            pwg_query($query);
+
+            $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("' . $majm1 . '",1,"MAJ meta");';
+            pwg_query($query);
+            $majvalue1 == 1;
+            $maj = 0;
+        }
+
+        $q = '
+ALTER TABLE ' . meta_cat_TABLE . ' ADD COLUMN metadescat VARCHAR( 255 ) NOT NULL ';
+        pwg_query($q);
+
+        $q = '
+ALTER TABLE ' . meta_img_TABLE . ' ADD COLUMN metadesimg VARCHAR( 255 ) NOT NULL ';
+        pwg_query($q);
+
+        $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("' . $majm2 . '",1,"MAJ meta");';
+        pwg_query($query);
+
+        $template->delete_compiled_templates(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
+
+        $majvalue2 == 1;
+        $maj = 0;
+    }
 }
 
-function plugin_install()
-{
-	global $conf, $prefixeTable;
-
+function plugin_install() {
+    global $conf, $prefixeTable;
     $q = 'CREATE TABLE ' . $prefixeTable . 'meta(
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
@@ -147,39 +141,42 @@
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;';
     pwg_query($q);
-	
-	$q = '
+
+    $q = '
 INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (1,"author","","name");';
     pwg_query($q);
-	
-	$q = '
+
+    $q = '
 INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (2,"keywords","","name");';
     pwg_query($q);
-	
-	$q = '
+
+    $q = '
 INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (3,"Description","","name");';
     pwg_query($q);
-	
-	$q = '
+
+    $q = '
 INSERT INTO ' . $prefixeTable . 'meta(id,metaname,metaval,metatype)VALUES (4,"robots","follow","name");';
     pwg_query($q);
 
-if (!defined('meta_img_TABLE')) define('meta_img_TABLE', $prefixeTable.'meta_img');
-	$query = "CREATE TABLE IF NOT EXISTS ". meta_img_TABLE ." (
+    if (!defined('meta_img_TABLE'))
+        define('meta_img_TABLE', $prefixeTable . 'meta_img');
+    $query = "CREATE TABLE IF NOT EXISTS " . meta_img_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeyimg VARCHAR( 255 ) NOT NULL ,
 metadesimg VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-
-if (!defined('meta_cat_TABLE')) define('meta_cat_TABLE', $prefixeTable.'meta_cat');	
-	$query = "CREATE TABLE IF NOT EXISTS ". meta_cat_TABLE ." (
+    $result = pwg_query($query);
+
+    if (!defined('meta_cat_TABLE'))
+        define('meta_cat_TABLE', $prefixeTable . 'meta_cat');
+    $query = "CREATE TABLE IF NOT EXISTS " . meta_cat_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeycat VARCHAR( 255 ) NOT NULL ,
 metadescat VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-	
-if (!defined('METAPERSO_TABLE')) define('METAPERSO_TABLE', $prefixeTable.'metaperso');
-	$query = "CREATE TABLE IF NOT EXISTS ". METAPERSO_TABLE ." (
+    $result = pwg_query($query);
+
+    if (!defined('METAPERSO_TABLE'))
+        define('METAPERSO_TABLE', $prefixeTable . 'metaperso');
+    $query = "CREATE TABLE IF NOT EXISTS " . METAPERSO_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL auto_increment,
 metaname VARCHAR( 255 ) NOT NULL ,
@@ -187,59 +184,52 @@
 metatype VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-
-	$majm1='meta 2.0.5';
-	$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm1.'",1,"MAJ meta");';
+    $result = pwg_query($query);
+
+    $majm1 = 'meta 2.0.5';
+    $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("' . $majm1 . '",1,"MAJ meta");';
     pwg_query($query);
 
-	$majm2='meta 2.1.0';
-	$query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("'.$majm2.'",1,"MAJ meta");';
-    pwg_query($query);	
-	
-	
-
-  if (empty($conf['contactmeta']))
-  {
-  	conf_update_param('contactmeta', '');
-  }
-  
-  	if (!defined('META_AP_TABLE')) define('META_AP_TABLE', $prefixeTable.'meta_ap');	
-	$query = "CREATE TABLE IF NOT EXISTS ". META_AP_TABLE ." (
+    $majm2 = 'meta 2.1.0';
+    $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("' . $majm2 . '",1,"MAJ meta");';
+    pwg_query($query);
+
+    if (empty($conf['contactmeta'])) {
+        conf_update_param('contactmeta', '');
+    }
+
+    if (!defined('META_AP_TABLE'))
+        define('META_AP_TABLE', $prefixeTable . 'meta_ap');
+    $query = "CREATE TABLE IF NOT EXISTS " . META_AP_TABLE . " (
 id SMALLINT( 5 ) UNSIGNED NOT NULL ,
 metaKeyap VARCHAR( 255 ) NOT NULL ,
 metadesap VARCHAR( 255 ) NOT NULL ,
 PRIMARY KEY (id))DEFAULT CHARSET=utf8;";
-	$result = pwg_query($query);
-	
-	
-	
+    $result = pwg_query($query);
 }
 
-function plugin_uninstall()
-{
-
-	$majm1='meta 2.0.5';
-	$majm2='meta 2.1.0';
-    
-	global $prefixeTable;
-
-	$q = 'DROP TABLE ' . $prefixeTable . 'meta;';
-    pwg_query($q);
-
-	$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="'.$majm1.'" LIMIT 1;';
-    pwg_query($q);
-	
-	$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="'.$majm2.'" LIMIT 1;';
-    pwg_query($q);
-	
-	$q = 'DROP TABLE ' . $prefixeTable . 'meta_img;';
-    pwg_query($q);
-
-	$q = 'DROP TABLE ' . $prefixeTable . 'meta_cat;';
-    pwg_query($q);
-	
-	conf_delete_param('contactmeta');
+function plugin_uninstall() {
+
+    $majm1 = 'meta 2.0.5';
+    $majm2 = 'meta 2.1.0';
+
+    global $prefixeTable;
+
+    $q = 'DROP TABLE ' . $prefixeTable . 'meta;';
+    pwg_query($q);
+
+    $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="' . $majm1 . '" LIMIT 1;';
+    pwg_query($q);
+
+    $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="' . $majm2 . '" LIMIT 1;';
+    pwg_query($q);
+
+    $q = 'DROP TABLE ' . $prefixeTable . 'meta_img;';
+    pwg_query($q);
+
+    $q = 'DROP TABLE ' . $prefixeTable . 'meta_cat;';
+    pwg_query($q);
+
+    conf_delete_param('contactmeta');
 }
 
-
 ?>
Index: extensions/meta/persometa.tpl
===================================================================
--- extensions/meta/persometa.tpl	(revision 29428)
+++ extensions/meta/persometa.tpl	(revision 29429)
@@ -1,3 +1,3 @@
-  {foreach from=$metapersos item=metaperso}
+{foreach from=$metapersos item=metaperso}
 <meta {$metaperso.METATYPE}="{$metaperso.METANAME}" content="{$metaperso.METAVAL}">
-  {/foreach}  
+{/foreach}
