Cpg1.4.2 > Cpg142 / Bridge / Vbulletin30.inc.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Cpg1.4.2

Download:
cpg1.4.2.zip

Category:
Image Galleries

Archive Content:

Cpg142

Cpg142 > Albums > Edit

Cpg142 > Albums

Cpg142 > Albums > Userpics

Cpg142

Cpg142 > Bridge

Cpg142

Cpg142 > Docs

Cpg142 > Docs > Pics

Cpg142 > Docs

Cpg142 > Docs > Theme

Cpg142 > Docs

Cpg142

Cpg142 > Images

Cpg142 > Images > Flags

Cpg142 > Images

Cpg142 > Images > Smiles

Cpg142 > Images

Cpg142

Cpg142 > Include

Cpg142 > Include > Makers

Cpg142 > Include

Cpg142

Cpg142 > Lang

Cpg142

Cpg142 > Logs

Cpg142

Cpg142 > Plugins > Sample

Cpg142 > Plugins > Sef Urls

Cpg142

Cpg142 > Sql

Cpg142

Cpg142 > Themes > Classic > Images

Cpg142 > Themes > Classic

Cpg142 > Themes > Eyeball > Images

Cpg142 > Themes > Eyeball

Cpg142 > Themes > Fruity > Images

Cpg142 > Themes > Fruity

Cpg142 > Themes > Hardwired > Images

Cpg142 > Themes > Hardwired

Cpg142 > Themes > Igames > Images

Cpg142 > Themes > Igames

Cpg142 > Themes > Mac Ox X > Images

Cpg142 > Themes > Mac Ox X

Cpg142 > Themes > Project Vii > Images

Cpg142 > Themes > Project Vii

Cpg142 > Themes > Rainy Day > Images

Cpg142 > Themes > Rainy Day

Cpg142 > Themes > Sample > Images

Cpg142 > Themes > Sample

Cpg142 > Themes > Water Drop > Images

Cpg142 > Themes > Water Drop

Cpg142

Vbulletin30.inc.php:


<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License,  or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.2
  $Source: /cvsroot/coppermine/devel/bridge/vbulletin30.inc.php, v $
  $Revision: 1.24 $
  $Author: gaugau $
  $Date: 2005/10/25 01:16:09 $
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Switch that allows overriding the bridge manager with hard-coded values
define('USE_BRIDGEMGR',  1);

require 
'bridge/udb_base.inc.php';

class 
cpg_udb extends core_udb {

    function 
cpg_udb()
    {
        global 
$BRIDGE;
        
        if (!
USE_BRIDGEMGR) {
            
$this->boardurl 'http://www.yousite.com/vb3';
            require_once(
'../vb3/includes/config.php');

        } else {
            
$this->boardurl $BRIDGE['full_forum_url'];
            require_once(
$BRIDGE['relative_path_to_config_file'] . 'includes/config.php');
            
$this->use_post_based_groups $BRIDGE['use_post_based_groups'];
        }
        
        
$this->multigroups 1;
        
        
// Database connection settings
        
$this->db = array(
            
'name' => $dbname,
            
'host' => $servername $servername 'localhost',
            
'user' => $dbusername,
            
'password' => $dbpassword,
            
'prefix' =>$tableprefix
        
);
        
        
// Board table names
        
$this->table = array(
            
'users' => 'user',
            
'groups' => 'usergroup',
            
'sessions' => 'session'
        
);

        
// Derived full table names
        
$this->usertable '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['users'];
        
$this->groupstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['groups'];
        
$this->sessionstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['sessions'];
        
        
// Table field names
        
$this->field = array(
            
'username' => 'username',  // name of 'username' field in users table
            
'user_id' => 'userid',  // name of 'id' field in users table
            
'password' => 'password',  // name of 'password' field in users table
            
'email' => 'email',  // name of 'email' field in users table
            
'regdate' => 'joindate',  // name of 'registered' field in users table
            
'location' => "''",  // name of 'location' field in users table
            
'website' => 'homepage',  // name of 'website' field in users table
            
'usertbl_group_id' => 'usergroupid',  // name of 'group id' field in users table
            
'grouptbl_group_id' => 'usergroupid',  // name of 'group id' field in groups table
            
'grouptbl_group_name' => 'title' // name of 'group name' field in groups table
        
);
        
        
// Pages to redirect to
        
$this->page = array(
            
'register' => '/register.php',
            
'editusers' => '/memberlist.php',
            
'edituserprofile' => "/membe.php?u=",
        );
        
        
// Group ids - admin and guest only.
        
$this->admingroups = array(6);
        
$this->guestgroup $this->use_post_based_groups 101 3;
        
        
// Use a special function to collect groups for cpg groups table
        
$this->group_overrride 0;
        
        
// Cookie settings - used in following functions only
        
$this->cookie_name $cookieprefix;
        
        
// Connect to db
        
$this->connect();
    }

    
// definition of how to extract id,  name,  group from a session cookie
    
function session_extraction()
    {
        if (isset(
$_COOKIE[$this->cookie_name 'sessionhash'])) {
            
$session_id addslashes($_COOKIE[$this->cookie_name 'sessionhash']);
            
            
$sql "SELECT u.{$this->field['user_id']},  u.{$this->field['username']},  u.{$this->field['grouptbl_group_id']}+100 AS usergroupid FROM {$this->usertable} AS u,  {$this->sessionstable} AS s WHERE s.{$this->field['user_id']}=u.{$this->field['user_id']} AND s.sessionhash='$session_id'";
            
            
$result cpg_db_query($sql,  $this->link_id);
            
            if (
mysql_num_rows($result)){
                
$row mysql_fetch_array($result);
                return 
$row;
            } else {
                return 
false;
            }
        }
    }
    
    
// Get groups of which user is member
    
function get_groups($row)
    {
        
$data[0] = in_array($row[$this->field['usertbl_group_id']] - 100,  $this->admingroups) ? 2;
        
        if (
$this->use_post_based_groups){
            
$sql "SELECT g.{$this->field['usertbl_group_id']}+100 AS group_id,  u.* FROM {$this->usertable} AS u,  {$this->groupstable} as g WHERE g.{$this->field['grouptbl_group_id']} = u.{$this->field['usertbl_group_id']} AND u.{$this->field['user_id']} = '{$row[$this->field['user_id']]}'";

            
$result cpg_db_query($sql,  $this->link_id);
        
            
$row mysql_fetch_array($result);
            
            
$data[0] = $row['group_id'];
            
            if (
$row['membergroupids']){
                
$groups explode(', ',  $row['membergroupids']);
                foreach (
$groups as $id => $group){
                    
$data[] = $group+100;
                }    
            }
        }
        
        return 
$data;
    }
    
    
// definition of how to extract an id and password hash from a cookie
    
function cookie_extraction()
    {
        return 
false;
    }
    
    
// definition of actions required to convert a password from user database form to cookie form
    
function udb_hash_db($password)
    {
        return 
$password// unused
    
}

    function 
login_page()
    {
        
$this->redirect("/index.php");
    }

    function 
logout_page()
    {
        
$this->redirect("/login.php?do=logout&u=".USER_ID);
    }
}

// and go !
$cpg_udb = new cpg_udb;
?>



Other Image Galleries Scripts:

WebMaster Resources Home

©RingsWorld.com