flashchat-6-0-8 and PHP fusion V7.02.03

Escrita por , 30 July 2011

Flashchat 6.0.8 and PHP-FUSION V7.02.03 Integration.
Works also with older version PHP-FUSION v7.02.01 in fact the script was created using this version then tested the version previously announced..

Download available PHP-FUSION v7.02.03

In the v7.01.04 and maybe lower the php-fusion team still used md5() hashed to encrypt the user_passoword, but in version 7.02.01 and over the encryption was updated for use of more secured hashes..
This is good, better protection overall..

  • Connect the usernames from database.
  • Super Admin becomes Admin in Flashchat 6.0.8
  • Admin user Without any privileges in PHP-FUSION becomes Moderator in Flashchat 6.0.8
  • Auto login when user is logged in PHP-FUSION V7 site.
  • Login to the chat and to the site using Flashchat login Form..
  • User banned cannot login the chat if is banned from the PHP-FUSION site itself..

The php files that we need to create are the following:

In the folder “/inc/cmses” create “fusion7_02_03CMS.php” will use this higher version because I created the script thinking in this specific version..

<?php
/*
 * Integration fix by Neumann Valle aka utan, july 30, 2011
 * original code and post at http://vcomputadoras.com/flashchat-6-0-8-php-fusionv7-02-03/
 * where php-fusion used hash_hmac() for hashing passwords.
 * 
 * */
ini_set('display_errors', 'OFF');
error_reporting(E_ALL);

$fusion_root_path = realpath(dirname(__FILE__) . '/../../../') . '/';

require_once($fusion_root_path . 'config.php');

class FusionCMS {

    var $userid;
    var $loginStmt;
    var $getUserStmt;
	var $getUsersaltStmt;
    var $getUsersStmt;

    function FusionCMS()
	{
	  $this->getUserStmt = new Statement('SELECT user_id AS id, user_name AS login, user_level FROM '.DB_PREFIX.'users WHERE user_id=? LIMIT 1');
      $this->getUsersStmt = new Statement('SELECT user_id AS id, user_name as login FROM '.DB_PREFIX.'users');

      $this->userid = NULL;

      if (isset($_COOKIE[COOKIE_PREFIX."user"])) {
        $cookie_vars = explode('.', $_COOKIE[COOKIE_PREFIX."user"]);
	    $cookie_1 = is_numeric($cookie_vars['0']) ? $cookie_vars['0'] : NULL;
        $cookie_2 = (preg_match('/^[0-9a-z]{32}$/', $cookie_vars['1']) ? $cookie_vars['1'] : '');

        $this->userid = $cookie_1;
      }

    }


    function isLoggedIn() {
        return $this->userid;
    }

    function getRoles($group) {
        $rv = ROLE_USER;

        if ($group == 101)
        {
          $rv = ROLE_USER;
        }

        if ($GLOBALS['fc_config']['liveSupportMode'] && $group == 101)
        {
          $rv = ROLE_CUSTOMER;
        }

        if ($group == 102)
        {
          $rv = ROLE_MODERATOR;
        }

        if ($group == 103)
        {
          $rv = ROLE_ADMIN;
        }

        return $rv;

    }

    function getUserProfile($userid) {

        if ($userid == SPY_USERID) $rv = NULL;

        elseif ($user = $this->getUser($userid)) {

          $rv = ($id = $this->isLoggedIn() && ($id == $userid)) ?  '../edit_profile.php' : '../profile.php?lookup=' . $userid;

          return $rv;
        }
    }


    function getUser($userid) {

      // if ($userid == SPY_USERID) return NULL;

      $rv = NULL;

      if(($rs = $this->getUserStmt->process($userid)) && ($rec = $rs->next())) {
        $rec['roles'] = $this->getRoles($rec['user_level']);
        $rv = $rec;
      }
      return $rv;
    }

    function login($login, $password) {
	$this->loginStmt = new Statement("SELECT * FROM ".DB_PREFIX."users WHERE user_name='".$login."'");
	
      $rs = $this->loginStmt->process();
      $rec = $rs->next();
	  
	  if ((hash_hmac($rec['user_algo'] , $password , $rec['user_salt'])) === $rec['user_password'])
	  {

       if ($rec['user_status']) return NULL; /* user is banned from the site */
        $cookieExpiration = time() + 172800;
	
	    $key = hash_hmac($rec['user_algo'], $rec['user_id'].$cookieExpiration, $rec['user_salt']);
		$hash = hash_hmac($rec['user_algo'], $rec['user_id'].$cookieExpiration, $key );
		
        $cookie_value = $rec['user_id'].".".$cookieExpiration.".".$hash;
		setcookie(COOKIE_PREFIX."user", $cookie_value, $cookieExpiration, '/', '', '0');

        return $rec['user_id'];

      }

    }

	function userInRole($userid, $role) {
		if($user = $this->getUser($userid)) {
			return ($user['roles'] == $role);
		}
		return false;
	}

    function logout() {

    }

    function getUsers() {

        $rv = $this->getUsersStmt->process();
        return $rv;

    }

	function getGender($userid) {
        // 'M' for Male, 'F' for Female, NULL for undefined
        return NULL;
    }
}
$GLOBALS['fc_config']['db'] = array(
    'host' => $db_host,
    'user' => $db_user,
    'pass' => $db_pass,
    'base' => $db_name,
    'pref' => DB_PREFIX . 'fc_'
    );

$GLOBALS['fc_config']['cms'] = new FusionCMS();


foreach($GLOBALS['fc_config']['languages'] as $k => $v) {
    $GLOBALS['fc_config']['languages'][$k]['dialog']['login']['moderator'] = '';
}

?>

Now we need to override “consts.php” located in the “install_files” folder with the new content .. copy paste everything overriding the old content..

<?php
/**
 ** Constants used for installation file.
 **/

define('INC_DIR', dirname(__FILE__) . '/../inc/');//for config.php

define('NAVY_FILE_SIZE', 1992);//necessary for check uploaded in binary mode

define('CHAT_ROOMS', 'The Lounge, Hollywood, Tech Talk, Current Events');//default rooms

define('CONFIG_FILE', INC_DIR . 'config.php');

define('INST_DIR', './install_files/');

$cmss = array(
			//'aedatingCMS' => 'aeDating 2.0/3.0 (FlashChat is built in to aeDating 3.x)',
			//'aedatingCMS2'=> 'aeDating 2.0/3.0 (which only permits access to Gold members)',
			//'aedating4CMS'=> 'aeDating 4.0',
			'azdgCMS'     => 'AZDG Dating Lite 2.1.2',
			'cpgNukeCMS'  => 'CPGNuke',
			'cpgNukeDragonfly921CMS'  => 'CPGNuke Dragonfly 9.2.1',
			'datingProCMS'=> 'Dating Pro',
			'e107CMS'     => 'e107 0.617',
			'eMeetingCMS' => 'eMeeting',
			'efriendsCMS497' => 'Alstrasoft E-friends 4.9.7',
			'fusionCMS'   => 'PHP Fusion 4.0.0',
			'fusionCMS2'  => 'PHP Fusion 5.0.1',
			'fusion6CMS'  => 'PHP Fusion 6',
			'fusion7CMS'  => 'PHP Fusion 7.01.04',
			'fusion7_02_03CMS' => 'PHP Fusion 7.02.03',
			'geeklogCMS'  => 'GeekLog 1.3.9',
			'joomlaCMS'	  => 'Joomla 1.1',
			'ipbCMS'      => 'Invision Power Board (IPB) 2.0.0',
			'ipbCMS2'     => 'Invision Power Board (IPB) 2.0.3',
			'ipbCMS2'     => 'Invision Power Board (IPB) 2.1.0',
			'ipb30CMS'     => 'Invision Power Board (IPB) 3.0.3',
			'lunabyteCMS' => 'LunaByte / Enigma 1.3',
			'mamboCMS'    => 'Mambo 4.5.0',
			'mamboCMS2'   => 'Mambo 4.5.2',
			'mambo465CMS'   => 'Mambo 4.6.5',
			
			'mdproCMS'    => 'MD-Pro 1.0.7',
			'mdpro1081CMS'    => 'MD-Pro 1.0.81',
			'moodleCMS'   => 'Moodle',
			'moodle16CMS' => 'Moodle 1.6',
			'moodle17CMS' => 'Moodle 1.7',
			'moodle18CMS' => 'Moodle 1.8',
			'moodle19CMS' => 'Moodle 1.9',
			'osdateCMS'   => 'osDate Dating System',
			'phpBB2CMS'	  => 'phpBB 2.0.10 and above',
			'phpBB3CMS'	  => 'phpBB 3.0.B2 and above',
			'phpBB307CMS'	  => 'phpBB 3.0.2 and above',
			'phpBB305CMS'	  => 'phpBB 3.0.5 and above',
			//'phpNukeModCMS'	=> 'PHP-Nuke 7.3(module version)',
			'phpNukeCMS73'	=> 'PHP-Nuke 7.3',
			'phpNukeCMS76'	=> 'PHP-Nuke 7.6',
			'phpNukeCMS78'	=> 'PHP-Nuke 7.8',
			//'postNukeModCMS'	=> 'PostNuke 0.726-3(module version)',
			'postNukeCMS'	=> 'PostNuke 0.726-3',
			'postNukeCMS0762'	=> 'PostNuke 0.762',
			'phorumCMS518' => 'Phorum 5.1.8',
            'phorumCMS527' => 'Phorum 5.2.7',
			'smfCMS'	=> 'Simple Machines 1.0',
			'smfCMS2'	=> 'Simple Machines 1.1',
			'smfCMS20'	=> 'Simple Machines 2.0',
			'ubbCMS'	=> 'UBB.Threads 6.5',
			'ubb70CMS'	=> 'UBB.Threads 7.0',
			'ubb71CMS'	=> 'UBB.Threads 7.1',
			'ubb74CMS'	=> 'UBB.Threads 7.4',
			'vbulletin30CMS'=> 'vBulletin 3.0',
			'vbulletin35CMS'=> 'vBulletin 3.5',
			'vbulletin36CMS'=> 'vBulletin 3.6',
			'vbulletin37CMS'=> 'vBulletin 3.7',
			'vbulletin38CMS'=> 'vBulletin 3.8',
			'vbulletin40CMS'=> 'vBulletin 4.0',
			'webDateCMS'    => 'Web Date',
			'wotCMS2'	=> 'WoltLab Burning Board 2.3.4',
			'wowCMS'	=> 'WowBB 1.6.1',
			'wowCMS2'	=> 'WowBB 1.6.2',
			'wowCMS165'	=> 'WowBB 1.6.5',
			'wowCMS170'	=> 'WowBB 1.7',
			'xmbCMS'	=> 'XMB 1.9.1',
			'xoopsCMS'	=> 'Xoops 2.0.7',
			'xoops2016CMS'	=> 'Xoops 2.0.16',
			'phpkitCMS' => 'phpkit 1.6.1',
			'MyBBCMS'	=> 'MyBB 1.0',
			'easysiteCMS' => 'EasySite 3.2.5',
			'SBDatingCMS' => 'Softbiz Dating',
			'phpFox108' => 'phpFox 1.0.8',
			'phpFox11' => 'phpFox 1.1',
			'phpFox16CMS' => 'phpFox 1.6',
			'inspirations31CMS'   => 'Inspirations 3.1',
			'drupalCMS' => 'Drupal',
			'drupal613CMS' => 'Drupal 6.1.3',
			'punbbCMS'        => 'punBB 1.2.10',
			'wordpress22CMS' => 'WordPress 2.1.0 - 2.7',
			);


?>

Now that will do it, Install the chat as usual, when the integration page come up , chose to install PHP fusion V7.02.03.
I have installed the script using the root folder where all the php-fusion files resides, the “FLASHCHAT” folder is with the php-fusion files.

Please leave message about any error or suggestions.. if you don’t leave any feed back then I will not be able to fix problems with the script.. please leave a comment good or bad.. thanks for reading..

Categorias : Guias para la Web,integrations,php y algo mas Etiquetas :

Comentarios
31 July 2011

Just curious why every cms file flashchat has was coded into this file? Being this is done in the install. Flashchat will then know what cms file to look at so not sure the point of all that extra code. Other then that thank you for the time on this. I’m sure others will want this. I already see it on Darren’s site.

Echo by klj2000
31 July 2011

hi,

Well if I have only put the php-fusion string there when installing there would be only that option to install, I wanted to add it and not strip the code for in case this same user wanted to use a different CMS..

regards.

Echo by UTAN
7 November 2011

Hey. This dosen’t work šŸ™

When I have chosen v7.02.03 and click on continue there is just af blank white page..

It can find step 2..

Echo by 3123
7 November 2011

Hi,

Can you tell me if there is any error in your server logs or in your page?

more info is required so we can continue further…

best wishes.

Echo by UTAN
8 November 2011

hm.. I don’t know how to explain it better.. I have oploaded consts.php and fusion7_02_03CMS.php

In install.php I choose php fusion v7.02.03, and click on continue, but when I do that it is only a blank page.. Nothing happens.. In step 2 in the installation there is only a blank page.

Echo by 3123
8 November 2011

Hi,

If you have a white page means that you have a php error, thats why I ask for the server error trow so we can debug..

please provide that to continuing further..

regards.

Echo by UTAN
8 November 2011

How do I do that?

hmm.. try it yourself on my page:

http://www.oddsportal.dk/chat/install.php

Echo by 3123
8 November 2011

Yes,

I see that you get a whit page, but you need to provide the server error log, its not showing in the browser…
most likely you copy pasted the code wrongly or left didnt copied entirely that’s why I need the server errors…

I need that or else I can be able to help…

regards

Echo by UTAN
8 November 2011

I will provide the server error log to you, but can you tell me how to do it?

How do I provide the server error log?

Echo by 3123
8 November 2011

Hey it work now.. It didn’t copy the whole code before..

But I still have a problem. When I change something in the general settings in the admin panel, e.g the language. Then it wont automatic login anymore.. I have to login again, and when I type the right username and password it just stops on the blue screen.. hmm

I get this error when trying to login the admin panel:

Fatal error: Call to a member function next() on a non-object in /var/www/oddsportal.dk/public_html/chat/inc/cmses/statelessCMS.php on line 132

Echo by 3123
8 November 2011

Hi,

the error shown that you arent using php-fusion cms, you are using stateless CMS…

Fatal error: Call to a member function next() on a non-object in /var/www/oddsportal.dk/public_html/chat/inc/cmses/statelessCMS.php on line 132

now just install the chat as normal and dont anything in control panel, it is possible that you changed the CMS setting in there and that why it gives you that error..

regards.

Echo by UTAN
8 November 2011

Arhh okaay..

But why cant I choose phpfusion 7.02.03 istead of stateless CMS? There is only up to phpfusion 6..

How can I administrate the settings if I dont use the admin panel?

Echo by 3123
8 November 2011

Hi,

I am sorry I am confused, I thought you managed to install PHP-FUSION v7.02.03 CMS didnt you?

I went and try installed PHP-FUSION v7.02.03 and it seemed to install up to the point that a previous install were done, please read again carefully the integration and install the chat using PHP-FUSION v7.02.03 option in the document where all the CMS are placed…

regards.

Echo by UTAN
8 November 2011

Tes I have installed it and it works..

But in the Admin panel in stateless CMS(free for all).. Is it possible to have it as php fusion 7.02.03 instead?

Echo by 3123
9 November 2011

Ok,

Destroy the database table leave it blank so I can go install it myself…

please do so and made a user account to test with..

please dont install just delete tables and leave it blank, I will install it myself to see whats the real issue..

regards.

Echo by UTAN
9 November 2011

Ey šŸ™‚

I have now deleted all the tables, and it is ready to download now.

You try install it now: http://www.oddsportal.dk/chat/install.php

Sign into the admin panel(chat/admin) and try change e.g the language to danish and see whats happens.:

username: admin
Password: test1234

Echo by 3123
9 November 2011

Hi,

Installed correctly, you have a danish language issue but that has nothing to do with the registration…

The registration works fine, so either go to their forum to ask for a fix on their language files or use the chat in different language..

best regards.

Echo by UTAN
9 November 2011

But try sign out of the admin panel, and sign in again..

You will get this error now:

Fatal error: Call to a member function next() on a non-object in /var/www/oddsportal.dk/public_html/chat/inc/cmses/statelessCMS.php on line 132

This error is the only problem I have :/

Echo by 3123
9 November 2011

Hi,

there is not problem with the integration, it is possible that you got bugs from the script and your php version…

Regards.

Echo by UTAN
9 November 2011

Arhh okaay.. But is it possible to change the language, theme and things like that in the files?

I tried changing it in the config_importer file, but nothing happened..

Which files do I need to look at to change some of the the administration things, as language, theme ?

Echo by 3123
Deja tu comentario

(requerido)

(requerido)