/[drupal]/contributions/modules/phpbb/phpbb.module
ViewVC logotype

Diff of /contributions/modules/phpbb/phpbb.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.17.4.1, Thu Mar 29 13:19:44 2007 UTC revision 1.17.4.2, Thu Jun 7 17:37:39 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: phpbb.module,v 1.15 2007/02/10 19:38:49 arkepp Exp $  // $Id: phpbb.module,v 1.20 2007/06/02 16:19:49 arkepp Exp $
3    
4  /**  /**
5   * http://drupal.org/node/32818   * http://drupal.org/node/32818
6   * See INSTALL.txt, you also need phpbb.htaccess   * See INSTALL.txt, you also need phpbb.htaccess
7   * Many thanks to: Jimbo, brdwor   * Many thanks to: Jimbo, brdwor for general patches
8     *
9     * Drupal 5.1 port by: maartenvg
10   */   */
11    
12  /**  /**
# Line 76  function phpbb_user($op, &$edit, &$user, Line 78  function phpbb_user($op, &$edit, &$user,
78                  case 'insert':                  case 'insert':
79                          // Insert a minimal user.                          // Insert a minimal user.
80                          $query = "INSERT INTO " . $prefix ."users (`user_id`,`username`,`user_password`,`user_regdate`,`user_email`,`user_timezone`) "                          $query = "INSERT INTO " . $prefix ."users (`user_id`,`username`,`user_password`,`user_regdate`,`user_email`,`user_timezone`) "
81                                                          ." VALUES(" . $edit['uid'] . ",'" . _phpbb_encode($edit['name']) . "','".md5(_phpbb_encode($edit['pass']))."'," . time() . ",'" . $edit['mail'] . "',1.0)";                                          ." VALUES(" . $edit['uid'] . ",'" . _phpbb_encode($edit['name']) . "','".md5(_phpbb_encode($edit['pass']))."'," . time() . ",'" . $edit['mail'] . "',1.0)";
82                          $res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");                          $res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");
83    
84                          // Insert a group for the user                          // Insert a group for the user
85                          if ( 1 != $edit['uid']) {                          if ( 1 != $edit['uid']) {
86    
87                                  $query =        "INSERT INTO " . $prefix . "groups (`group_type`,`group_name`,`group_description`,`group_moderator`,`group_single_user`) "                                  $query =        "INSERT INTO " . $prefix . "groups (`group_type`,`group_name`,`group_description`,`group_moderator`,`group_single_user`) "
88                                                                          ." VALUES( 1,'" . _phpbb_encode($edit['name']) ."','Personal User',0,1)";                                                  ." VALUES( 1,'" . _phpbb_encode($edit['name']) ."','Personal User',0,1)";
89                                  $res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");                                  $res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");
90                                  $group_id = mysql_insert_id($phpbb_dbc);                                  $group_id = mysql_insert_id($phpbb_dbc);
91    
# Line 196  function phpbb_user($op, &$edit, &$user, Line 198  function phpbb_user($op, &$edit, &$user,
198      $query = "SELECT topic_id FROM " . $prefix ."topics WHERE `topic_poster`= ". $user->uid ;      $query = "SELECT topic_id FROM " . $prefix ."topics WHERE `topic_poster`= ". $user->uid ;
199      $topic_res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");      $topic_res = mysql_query($query, $phpbb_dbc) or die('Query failed: ' . mysql_error() . " \n" . $query . "\n");
200    
201      $items['no_topics'] = array('title' => t('Antall tr&aring;der startet:'),      $items['no_topics'] = array('title' => t('Number of topics in phpBB:'),
202          'value' => mysql_num_rows($topic_res),          'value' => mysql_num_rows($topic_res),
203          'class' => 'member'          'class' => 'member'
204        );        );
205      $items['no_posts'] = array('title' => t('Antall innlegg:'),      $items['no_posts'] = array('title' => t('Number of posts in phpBB:'),
206        'value' => mysql_num_rows($post_res),        'value' => mysql_num_rows($post_res),
207        'class' => 'member'        'class' => 'member'
208      );      );
# Line 223  function phpbb_perm() { Line 225  function phpbb_perm() {
225   * Implementation of hook_block   * Implementation of hook_block
226   *   *
227   */   */
228  function phpbb_block($op = 'list', $delta = 0, $edit = array() ) {  
229    if ($op == 'list') {   function phpbb_block($op = 'list', $delta = 0, $edit = array() ) {
230      $blocks[0]['info'] = variable_get('phpbb_block0_title', t('phpBB Topics'));          switch ($op) {
231           return $blocks;                  case 'list':
232    }                          $blocks[0]['info'] = t(variable_get('phpbb_block0_title', 'phpBB Topics'));
233    else {                          return $blocks;
234      switch ($delta) {                  case 'configure':
235        case 0:                          $form = array();
236                          $block['subject'] = variable_get('phpbb_block0_title', t('phpBB Topics'));                          return $form;
237                    case 'save':
238                            // stub, no special data to save
239                            return;
240                    case 'view': // fall through
241                    default:
242                            $block['subject'] = t(variable_get('phpbb_block0_title','phpBB Topics'));
243                          $block['content'] = _phpbb_display_block_0();                          $block['content'] = _phpbb_display_block_0();
244        break;                          return $block;
245            }
       case 1:  
                         //Not used  
                 break;  
     }  
          return $block;  
   }  
246  }  }
247    
248  /**  /**

Legend:
Removed from v.1.17.4.1  
changed lines
  Added in v.1.17.4.2

  ViewVC Help
Powered by ViewVC 1.1.2