[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/skins/ -> _subscriptions.php (source)

   1  <?php
   2  /**

   3   * This is the template that displays the user subscriptions form

   4   *

   5   * This file is not meant to be called directly.

   6   * It is meant to be called by an include in the main.page.php template.

   7   * To display a feedback, you should call a stub AND pass the right parameters

   8   * For example: /blogs/index.php?disp=profile

   9   * Note: don't code this URL by hand, use the template functions to generate it!

  10   *

  11   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.

  12   * See also {@link http://sourceforge.net/projects/evocms/}.

  13   *

  14   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}.

  15   *

  16   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)

  17   *

  18   * @package evoskins

  19   *

  20   * @todo dh> Allow limiting to current blog and list of "public" ones (e.g. with blog_disp_bloglist==1)

  21   *

  22   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  23   * @author fplanque: Francois PLANQUE.

  24   *

  25   * @version $Id: _subscriptions.php,v 1.17 2007/09/28 09:29:03 fplanque Exp $

  26   */
  27  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  28  
  29  /**

  30   * @var DB

  31   */
  32  global $DB;
  33  
  34  if( ! is_logged_in() )
  35  { // must be logged in!
  36      echo '<p>', T_( 'You are not logged in.' ), '</p>';
  37      return;
  38  }
  39  
  40  // fp> Note: This will "fail" if the user clicks on the 'subscriptions' link from the subscriptions page

  41  $redirect_to = param( 'redirect_to', 'string', '' );
  42  
  43  
  44  /**

  45   * form to update the profile

  46   * @var Form

  47   */
  48  $Form = & new Form( $htsrv_url.'subs_update.php', 'SubsForm' );
  49  
  50  $Form->begin_form( 'bComment' );
  51      $Form->hidden( 'checkuser_id', $current_User->ID );
  52      $Form->hidden( 'redirect_to', url_rel_to_same_host($redirect_to, $htsrv_url) );
  53  
  54      $Form->begin_fieldset( T_('Global settings') );
  55  
  56          $Form->info( T_('Login'), $current_User->get('login') );
  57  
  58          $Form->text( 'newuser_email', $current_User->get( 'email' ), 40, T_('Email'), '', 100, 'bComment' );
  59  
  60          $Form->checkbox( 'newuser_notify', $current_User->get( 'notify' ), T_('Notifications'), T_('Check this to receive a notification whenever one of <strong>your</strong> posts receives comments, trackbacks, etc.') );
  61  
  62      $Form->end_fieldset();
  63  
  64      $Form->begin_fieldset( T_('Blog subscriptions') );
  65  
  66          // Gte those blogs for which we have already subscriptions (for this user)

  67          $sql = 'SELECT blog_ID, blog_shortname, sub_items, sub_comments
  68                    FROM T_blogs INNER JOIN T_subscriptions ON ( blog_ID = sub_coll_ID AND sub_user_ID = '.$current_User->ID.' )
  69                                INNER JOIN T_coll_settings ON ( blog_ID = cset_coll_ID AND cset_name = "allow_subscriptions" AND cset_value = "1" )
  70                   WHERE blog_in_bloglist <> 0';
  71          $blog_subs = $DB->get_results( $sql );
  72  
  73          $encountered_current_blog = false;
  74          $subs_blog_IDs = array();
  75          foreach( $blog_subs AS $blog_sub )
  76          {
  77              if( $blog_sub->blog_ID == $Blog->ID )
  78              {
  79                  $encountered_current_blog = true;
  80              }
  81  
  82              $subs_blog_IDs[] = $blog_sub->blog_ID;
  83              $subscriptions = array(
  84                      array( 'sub_items_'.$blog_sub->blog_ID,    '1', T_('Posts'),    $blog_sub->sub_items ),
  85                      array( 'sub_comments_'.$blog_sub->blog_ID, '1', T_('Comments'), $blog_sub->sub_comments )
  86                  );
  87              $Form->checklist( $subscriptions, 'subscriptions', format_to_output( $blog_sub->blog_shortname, 'htmlbody' ) );
  88          }
  89  
  90          if( $Blog->get_setting( 'allow_subscriptions' ) )
  91          {
  92              if( !$encountered_current_blog )
  93              {    // Propose current blog too:
  94                  $subs_blog_IDs[] = $Blog->ID;
  95                  $subscriptions = array(
  96                          array( 'sub_items_'.$Blog->ID,    '1', T_('Posts'),    0 ),
  97                          array( 'sub_comments_'.$Blog->ID, '1', T_('Comments'), 0 )
  98                      );
  99                  $Form->checklist( $subscriptions, 'subscriptions', $Blog->dget('shortname') );
 100              }
 101          }
 102          else
 103          {
 104              $Form->info( $Blog->dget('shortname'), T_('Subscriptions are not allowed for this blog.') );
 105          }
 106  
 107          $Form->hidden( 'subs_blog_IDs', implode( ',', $subs_blog_IDs ) );
 108  
 109      $Form->end_fieldset();
 110  
 111  $Form->end_form( array( array( '', '', T_('Update'), 'SaveButton' ),
 112                          array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 113  
 114  
 115  /*

 116   * $Log: _subscriptions.php,v $

 117   * Revision 1.17  2007/09/28 09:29:03  fplanque

 118   * fixes

 119   *

 120   * Revision 1.16  2007/04/26 00:11:04  fplanque

 121   * (c) 2007

 122   *

 123   * Revision 1.15  2007/03/18 01:39:55  fplanque

 124   * renamed _main.php to main.page.php to comply with 2.0 naming scheme.

 125   * (more to come)

 126   *

 127   * Revision 1.14  2006/12/16 01:30:47  fplanque

 128   * Setting to allow/disable email subscriptions on a per blog basis

 129   *

 130   * Revision 1.13  2006/12/16 00:38:48  fplanque

 131   * Cleaned up subscription db handling

 132   *

 133   * Revision 1.12  2006/12/07 23:13:14  fplanque

 134   * @var needs to have only one argument: the variable type

 135   * Otherwise, I can't code!

 136   *

 137   * Revision 1.11  2006/10/17 17:20:07  blueyed

 138   * TODO

 139   *

 140   * Revision 1.10  2006/10/15 21:30:46  blueyed

 141   * Use url_rel_to_same_host() for redirect_to params.

 142   *

 143   * Revision 1.9  2006/07/06 19:56:29  fplanque

 144   * no message

 145   *

 146   * Revision 1.8  2006/04/11 21:22:26  fplanque

 147   * partial cleanup

 148   *

 149   */
 150  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics