Index: /extensions/event_cats/admin/autolog_entries.inc.php
===================================================================
--- /extensions/event_cats/admin/autolog_entries.inc.php	(revision 21651)
+++ /extensions/event_cats/admin/autolog_entries.inc.php	(revision 21652)
@@ -104,5 +104,5 @@
           elseif ($a == 3) { // Image
             $url_end.= ($url_end == '') ? '' : '&amp;img='.$arg2;
-            $t = mysql_fetch_row(pwg_query("
+            $t = pwg_db_fetch_row(pwg_query("
              SELECT `name`, `file`
              FROM `".IMAGES_TABLE."`
Index: /extensions/event_cats/admin/autolog_new.inc.php
===================================================================
--- /extensions/event_cats/admin/autolog_new.inc.php	(revision 21651)
+++ /extensions/event_cats/admin/autolog_new.inc.php	(revision 21652)
@@ -111,5 +111,5 @@
   (count($ec_lists['user_ids']) == 0) ? 'style = "display:none;"' : ''
 );
-$template->assign('ec_no_assoc', ((mysql_num_rows(pwg_query("
+$template->assign('ec_no_assoc', ((pwg_db_num_rows(pwg_query("
   SELECT *
   FROM `".IMAGE_CATEGORY_TABLE."`
Index: /extensions/event_cats/admin/evntcats_admin.php
===================================================================
--- /extensions/event_cats/admin/evntcats_admin.php	(revision 21651)
+++ /extensions/event_cats/admin/evntcats_admin.php	(revision 21652)
@@ -101,5 +101,5 @@
   );
   
-  $ec_exist_entries = (mysql_num_rows(pwg_query("
+  $ec_exist_entries = (pwg_db_num_rows(pwg_query("
     SELECT * FROM `".EVNTCATS_TABLE."`
     WHERE `code` IS NOT NULL ;
Index: /extensions/event_cats/include/ec_conf.inc.php
===================================================================
--- /extensions/event_cats/include/ec_conf.inc.php	(revision 21651)
+++ /extensions/event_cats/include/ec_conf.inc.php	(revision 21652)
@@ -37,5 +37,5 @@
 // following instructions :
 /*
-$t = mysql_fetch_row(pwg_query("
+$t = pwg_db_fetch_row(pwg_query("
   SELECT `value`
   FROM `".CONFIG_TABLE."`
@@ -123,11 +123,11 @@
 
 $t = array(); $u = '0'; $v = false;
-if ($v = (
-  ($t = mysql_fetch_row(pwg_query("
-    SELECT `value`
-    FROM `".CONFIG_TABLE."`
-    WHERE `param` = 'event_cats';
-  "))) !== false)
-) {
+$r = pwg_query("
+  SELECT `value`
+  FROM `".CONFIG_TABLE."`
+  WHERE `param` = 'event_cats';
+");
+if (pwg_db_num_rows($r)) {
+  $t = pwg_db_fetch_row($r);
   $v = (count($ec_conf = explode(',', $t[0])) == count($ec_conf_index));
   $u = $ec_conf[0];
Index: /extensions/event_cats/include/evntcats_admin_funcs.inc.php
===================================================================
--- /extensions/event_cats/include/evntcats_admin_funcs.inc.php	(revision 21651)
+++ /extensions/event_cats/include/evntcats_admin_funcs.inc.php	(revision 21652)
@@ -79,5 +79,5 @@
   $page['errors'][] =
    sprintf(l10n('ec_DB_problem'), $n).
-   'MySQL error '.mysql_errno().', "'.mysql_error().'"';
+   'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
   return false;
 }
@@ -137,5 +137,5 @@
     $t2 = 0; $t3 = false; $t4 = false;
     while ( // The check is executed once at minimum
-      !($t3 = mysql_fetch_row(pwg_query("
+      !($t3 = pwg_db_fetch_row(pwg_query("
         SELECT `id`
         FROM `".GROUPS_TABLE."`
@@ -154,5 +154,5 @@
      $page['errors'][] =
       sprintf(l10n('ec_group_create_pb'), $_POST['groupname']).' (1) : '.
-      'MySQL error '.mysql_errno().', "'.mysql_error().'"';
+      'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
     if (
       pwg_query("
@@ -162,5 +162,5 @@
     ) $page['errors'][] =
       sprintf(l10n('ec_group_create_pb'), $_POST['groupname']).' (2) : '.
-      'MySQL error '.mysql_errno().', "'.mysql_error().'"';
+      'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
     else $page['infos'][] = sprintf(
       l10n('ec_group_create_OK2'),
@@ -176,5 +176,5 @@
       array_key_exists($_POST['ec_in_up_cat'], $ec_lists['categories'])
     ) {
-      if (mysql_num_rows(pwg_query("
+      if (pwg_db_num_rows(pwg_query("
         SELECT `id`
         FROM `".CATEGORIES_TABLE."`
@@ -197,5 +197,5 @@
          );
         mass_inserts(GROUP_ACCESS_TABLE,array('group_id','cat_id'), $inserts);
-        if (mysql_errno() == 0)
+        if (pwg_db_errno() == 0)
          $page['infos'][] = sprintf(
            l10n('ec_group_create_OK2'),
@@ -206,5 +206,5 @@
           l10n('ec_assoc_pb'),
           $_POST['groupname'],$ec_lists['categories'][$_POST['ec_in_up_cat']]
-         ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"';
+         ).' : MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
       }
     }
@@ -241,5 +241,5 @@
           l10n('ec_assoc_pb'),
           $_POST['groupname'],$ec_lists['add_pages'][$_POST['ec_in_up_aps']]
-         ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"';
+         ).' : MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
         else $page['infos'][] = sprintf(
          l10n('ec_group_create_OK2'),
@@ -274,5 +274,5 @@
           AND `user_id` = '$ec_user_id';
       ");
-      while ($row = mysql_fetch_array($result))
+      while ($row = pwg_db_fetch_assoc($result))
        $granteds[$row['cat_id']][] = $row['user_id'];
       $inserts = array();
@@ -285,5 +285,5 @@
       if (count($inserts) != 0) {
         mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $inserts);
-        if (mysql_errno() == 0)
+        if (pwg_db_errno() == 0)
          $page['infos'][] = sprintf(
            l10n('ec_group_create_OK2'),
@@ -294,5 +294,5 @@
           l10n('ec_assoc_pb'),
           $_POST['login'], $ec_lists['categories'][$_POST['ec_in_up_cat']]
-         ).' : MySQL error '.mysql_errno().', "'.mysql_error().'"';
+         ).' : MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
       }
     }
@@ -553,5 +553,5 @@
   $arg2p = ($arg2 == 'NULL') ? 'IS NULL' : ' = '.$arg2;
   $ec_user_idp = ($ec_user_id == 'NULL') ? 'IS NULL' : ' = '.$ec_user_id;
-  if (($t1 = mysql_fetch_row(pwg_query("
+  $r = pwg_query("
     SELECT `id`
     FROM `".EVNTCATS_TABLE."`
@@ -563,5 +563,7 @@
       AND `forced`  = '".$forced."'
       AND `comment` = '".$comment."'
-  "))) !== false) { // print("<pre>$arg1 $arg2<br>$q</pre>");
+  ");
+  if (pwg_db_num_rows($r)) { // print("<pre>$arg1 $arg2<br>$q</pre>");
+    $t1 = pwg_db_fetch_row();
     $page['errors'][] = sprintf(l10n('ec_entry_already_exists'), $t1[0]);
     return false;
@@ -570,11 +572,11 @@
   // Delete other entries using the same code, if needed
   if ($del_other) {
-    if ((
-      $t1 = mysql_fetch_row(pwg_query("
-        SELECT `code`
-        FROM `".EVNTCATS_TABLE."`
-        WHERE `id` = ".$_POST['ec_entry_sel']
-      ))) === false
-    ) die('Entry not found in DB ?!');
+    $r = pwg_query("
+      SELECT `code`
+      FROM `".EVNTCATS_TABLE."`
+      WHERE `id` = ".$_POST['ec_entry_sel']
+    );
+    if (!pwg_db_num_rows($r)) die('Entry not found in DB ?!');
+    $t1 = pwg_db_fetch_row($r);
     $r = pwg_query("
       SELECT `id`
@@ -583,5 +585,5 @@
        AND `id` <> ".$_POST['ec_entry_sel']
     );
-    while ($t2 = mysql_fetch_row($r)) if (!ec_delete_entry_OK($t2[0]))
+    while ($t2 = pwg_db_fetch_row($r)) if (!ec_delete_entry_OK($t2[0]))
      return false;
   }
@@ -608,5 +610,5 @@
       $page['errors'][] =
        l10n('ec_entry_create_pb').' : '.
-       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
+       'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"'
       ;
       $ret = false;
@@ -616,5 +618,5 @@
       $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced');
       $page['infos'][] =
-       sprintf(l10n('ec_entry_create_OK'), mysql_insert_id()).
+       sprintf(l10n('ec_entry_create_OK'), pwg_db_insert_id()).
        $ec_code.' => '.
        $ec_lists['user_ids'][$ec_user_id].$forced
@@ -639,5 +641,5 @@
       $page['errors'][] =
        l10n('ec_entry_create_pb').' : '.
-       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
+       'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"'
       ;
       $ret = false;
@@ -662,12 +664,14 @@
 function ec_delete_entry_OK($ec_id) {
   global $page;
-  if (count($t = mysql_fetch_row(pwg_query("
+  $r = pwg_query("
     SELECT `code`
     FROM `".EVNTCATS_TABLE."`
     WHERE `id` = $ec_id;
-  "))) == 0) {
+  ");
+  if (!pwg_db_num_rows($r)) {
     $page['errors'][] = sprintf(l10n('ec_entry_dont_exist'), $ec_id);
     return false;
   }
+  $t = pwg_db_fetch_row($r);
   if (pwg_query("
     DELETE FROM `".EVNTCATS_TABLE."`
@@ -677,5 +681,5 @@
      sprintf(l10n('ec_entry_del_nok'),
      $ec_id).
-     'MySQL error '.mysql_errno().', "'.mysql_error().'"';
+     'MySQL error '.pwg_db_errno().', "'.pwg_db_error().'"';
     return false;
   }
Index: /extensions/event_cats/include/evntcats_main_funcs.inc.php
===================================================================
--- /extensions/event_cats/include/evntcats_main_funcs.inc.php	(revision 21651)
+++ /extensions/event_cats/include/evntcats_main_funcs.inc.php	(revision 21652)
@@ -77,10 +77,11 @@
  */
 function ec_image_exists($cat, $img) {
-  return (mysql_fetch_row(pwg_query("
+  $r = pwg_query("
     SELECT *
     FROM `".IMAGE_CATEGORY_TABLE."` 
     WHERE `category_id` = ".$cat."
      AND `image_id` = ".$img
-  )) !== false);
+  );
+  return (bool)pwg_num_rows($r);
 }
 
@@ -207,5 +208,5 @@
   if (defined('ADD_PAGES_TABLE')) {
     $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`;");
-    while ($r = mysql_fetch_array($res)) {
+    while ($r = pwg_db_fetch_assoc($res)) {
       $a = (is_in($r['title'], '/user_id=')) ?
        explode('/user_id=' , $r['title']) : array($r['title']);
@@ -281,5 +282,5 @@
     ORDER BY `id`
   ");
-  while ($r = mysql_fetch_assoc($q))
+  while ($r = pwg_db_fetch_assoc($q))
    $ec_lists['ec_table'][intval($r['id'])] = $r;
   
@@ -395,5 +396,5 @@
   // certain group (in groups, level (friends, family, contacts),
   // or user status (generic))
-  $types_entry_exists = (($t = mysql_fetch_row(pwg_query("
+  $r = pwg_query("
     SELECT `arg2`
     FROM `".EVNTCATS_TABLE."`
@@ -402,6 +403,13 @@
       AND `arg2` IS NOT NULL
     LIMIT 1;
-  "))) !== false);
-  $ec_lists['types_granted'] = ($types_entry_exists) ? $t[0] : 0;
+  ");
+  if (pwg_db_num_rows($r)) {
+    $types_entry_exists = true;
+    list($ec_lists['types_granted']) = pwg_db_fetch_row($r);
+  }
+  else {
+    $types_entry_exists = false;
+    $ec_lists['types_granted'] = 0;
+  }
   
   return $types_entry_exists;
@@ -495,5 +503,5 @@
           AND `user_id` > 2;
       ");
-      while ($row = mysql_fetch_array($result)) {
+      while ($row = pwg_db_fetch_assoc($result)) {
         if (!isset($user_granted_from_type[$row['level']])) {
           $user_granted_from_type[$row['level']] = array();
@@ -534,5 +542,5 @@
         AND `user_id` > 2;
     ");
-    while ($row = mysql_fetch_array($result)) {
+    while ($row = pwg_db_fetch_assoc($result)) {
       if (!isset($granted_groups[$row['group_id']])) {
         $granted_groups[$row['group_id']] = array();
Index: /extensions/event_cats/main.inc.php
===================================================================
--- /extensions/event_cats/main.inc.php	(revision 21651)
+++ /extensions/event_cats/main.inc.php	(revision 21652)
@@ -249,5 +249,5 @@
     ");
     $insert = array();
-    while ($row = mysql_fetch_assoc($result))
+    while ($row = pwg_db_fetch_assoc($result))
      $insert[] = "(".$new_user['id'].",".$row['cat_id'].")";
     if (!empty($insert)) pwg_query("
@@ -263,5 +263,5 @@
     ");
     $insert = array();
-    while ($row = mysql_fetch_assoc($result))
+    while ($row = pwg_db_fetch_assoc($result))
      $insert[] = "(".$new_user['id'].",".$row['group_id'].")";
     if (!empty($insert)) pwg_query("
@@ -277,5 +277,5 @@
     ");
     $insert = array();
-    while ($row = mysql_fetch_assoc($result))
+    while ($row = pwg_db_fetch_assoc($result))
      $insert[] = "(".$new_user['id'].",".$row['level'].")";
     if (!empty($insert)) pwg_query("
