| scriptor |
|
|---|---|
|
I use the flashchat with the old plugin from seditio. it works good, but when i´m logged in and want to open the chat i must login me in the chat too... and about the cotonti auth system i don´t know enough to repair it self.
Here the file that looks if you logged in: <?php
// integration class for Seditio v100+ (http://www.neocrome.net/)
//error_reporting(E_ALL);
$seditio_root_path = realpath(dirname(__FILE__) . '/../../../') . '/';
include($seditio_root_path . 'datas/config.php');
class seditioCMS {
var $userid;
var $loginStmt;
var $getUserStmt;
var $getUsersStmt;
function seditioCMS() {
$this->loginStmt = new Statement("SELECT user_id AS id, user_name AS login, user_password AS password FROM {$GLOBALS['db_prefix']}users WHERE user_name=? LIMIT 1");
$this->getUserStmt = new Statement("SELECT user_id AS id, user_name AS login, user_maingrp, user_avatar, user_gender FROM {$GLOBALS['db_prefix']}users WHERE user_id=? LIMIT 1");
$this->getUsersStmt = new Statement("SELECT user_id AS id, user_name as login FROM {$GLOBALS['db_prefix']}users");
$this->userid = NULL;
if(isset($_SESSION['rsedition'])) $this->userid = $_SESSION['rsedition'];
}
function isLoggedIn() {
return $this->userid;
}
function getRoles($status) {
$rv = ROLE_NOBODY; // Banned by default
if($status['user_maingrp'] == 1) $rv = ROLE_ANY; // Guests = no access
if($status['user_maingrp'] == 2) $rv = ROLE_ANY; // Inactive = no access
if($status['user_maingrp'] == 3) $rv = ROLE_NOBODY; // Banned = no access
if($status['user_maingrp'] == 4) $rv = ROLE_USER; // Member = user access
if($status['user_maingrp'] == 7) $rv = ROLE_USER;
if($status['user_maingrp'] == 8) $rv = ROLE_USER;
if($status['user_maingrp'] == 5) $rv = ROLE_ADMIN; // Administrators = admin access
if($status['user_maingrp'] == 6) $rv = ROLE_MODERATOR; // Moderators = moderator access
if($status['user_maingrp'] == 10) $rv = ROLE_MODERATOR;
// Additional user groups (replace x with grpid) = user access
// if($status['user_maingrp'] == x) $rv = ROLE_MODERATOR; // Additional user groups (replace x with grpid) = moderator access
// if($status['user_maingrp'] == x) $rv = ROLE_ADMIN; // Additional user groups (replace x with grpid) = admin access
return $rv;
}
function getUserProfile($userid) {
if ($userid == SPY_USERID) $rv = NULL;
elseif ($user = $this->getUser($userid)) {
$rv = "../flashchat_sed_users.php?m=details&id=" . $userid;
}
return $rv;
}
function getUser($userid) {
$rv = NULL;
if(($rs = $this->getUserStmt->process($userid)) && ($rec = $rs->next())) {
$rec['roles'] = $this->getRoles($rec);
$rv = $rec;
}
return $rv;
}
function login($login, $password) {
$rs = $this->loginStmt->process($login);
$this->userid = null;
if ( ($rec = $rs->next()) &&
($rec['password'] == md5($password))
) $this->userid = $rec['id'];
return $this->userid;
}
function userInRole($userid, $role) {
if($rs = $this->getUser($userid)) return ($this->getRoles($rs) == $role);
return false;
}
function logout() {
}
function getUsers() {
return $this->getUsersStmt->process();
}
function getGender($userid) {
// 'M' for Male, 'F' for Female, NULL for undefined
$sex = $this->getUserStmt->process($userid);
if($gender = $sex->next()) {
if($gender['user_gender'] == 'F') return 'F';
if($gender['user_gender'] == 'M') return 'M';
}
return NULL;
}
function getPhoto($userid) {
$rs = $this->getUserStmt->process($userid);
if($rec = $rs->next()) {
$fileExt = explode(',', $GLOBALS['fc_config']['photoloading']['allowFileExt']);
$oldFile = './nick_image/' . $userid . '.';
$fs = reset($fileExt);
while($fs) {
if(file_exists($oldFile . $fs)) return $oldFile . $fs;
$fs = next($fileExt);
}
if(!empty($rec['user_photo'])) return '../' . $rec['user_photo'];
if(!empty($rec['user_avatar'])) return '../' . $rec['user_avatar'];
}
return '';
}
}
$GLOBALS['fc_config']['db'] = array(
'host' => $cfg['mysqlhost'],
'user' => $cfg['mysqluser'],
'pass' => $cfg['mysqlpassword'],
'base' => $cfg['mysqldb'],
'pref' => "sed_fc_",
);
$GLOBALS['db_prefix'] = 'sed_';
$GLOBALS['fc_config']['cms'] = new seditioCMS();
foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
$GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}
?>[url=http://www.freak-forum.de]Freak-Forum.de[/url] - The Freakstyle Community<br />
[url=http://www.adelmann-solutions.com]adelmann-solutions, webdesign Freiburg[/url] |