Changeset 6825


Ignore:
Timestamp:
Aug 31, 2010, 7:08:47 PM (14 years ago)
Author:
Eric
Message:

Bug fixed on adding new users in NBM list
Adding changelog.txt.php file
Version 1.0.2 hard coded

Location:
extensions/NBM_Subscriber
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBM_Subscriber/main.inc.php

    r6750 r6825  
    22/*
    33Plugin Name: NBM Subscriber
    4 Version: 1.0.1
     4Version: 1.0.2
    55Description: Permet aux visiteurs inscrits de gérer eux-même leur abonnement à la notification par mail (NBM) - Allows registered visitors to manage their own subscription to the notification by mail (NBM)
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=397
     
    4747  global $conf, $user;
    4848 
    49   if (!empty($_POST['NBM_Subscription']) && in_array( $_POST['NBM_Subscription'], array('true', 'false')))
     49  include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php');
     50 
     51  $query = '
     52SELECT *
     53FROM '.USER_MAIL_NOTIFICATION_TABLE.'
     54WHERE user_id = \''.$user['id'].'\'
     55';
     56 
     57  $count = pwg_db_num_rows(pwg_query($query));
     58 
     59  if ($count == 0)
     60  {
     61    $inserts = array();
     62    $check_key_list = array();
     63   
     64    // Calculate key
     65    $nbm_user['check_key'] = find_available_check_key();
     66
     67    // Save key
     68    array_push($check_key_list, $nbm_user['check_key']);
     69   
     70    // Insert new nbm_users
     71    array_push
     72    (
     73      $inserts,
     74        array
     75        (
     76          'user_id' => $user['id'],
     77          'check_key' => $nbm_user['check_key'],
     78          'enabled' => 'false' // By default if false, set to true with specific functions
     79        )
     80    );
     81
     82    mass_inserts(USER_MAIL_NOTIFICATION_TABLE, array('user_id', 'check_key', 'enabled'), $inserts); 
     83  }
     84  elseif ($count != 0 and !empty($_POST['NBM_Subscription']) && in_array($_POST['NBM_Subscription'], array('true', 'false')))
    5085  {
    5186    $query = '
Note: See TracChangeset for help on using the changeset viewer.