|
From: OryNider <ory...@us...> - 2007-06-06 23:49:20
|
Update of /cvsroot/mxbb/mx_counter In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31579 Added Files: db_install.php db_uninstall.php index.htm mx_counter.pak mx_counter.php readme.txt Log Message: --- NEW FILE: db_uninstall.php --- <?php /** * * @package mxBB Portal Module - mx_counter * @version $Id: db_uninstall.php,v 1.1 2007/06/06 23:49:09 orynider Exp $ * @copyright (c) 2004-2006, OryNider, ory...@rd... * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define('IN_PORTAL', true); if ( !defined('IN_ADMIN') ) { $mx_root_path = '../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($mx_root_path . 'common.'.$phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); if( !$userdata['session_logged_in'] ) { die("Hacking attempt(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } // // End session management // } $sql = array(); $sql[] = "DROP TABLE IF EXISTS " . $mx_table_prefix . "counter_config"; $sql[] = "DROP TABLE IF EXISTS " . $mx_table_prefix . "counter_session"; $n = 0; $message = "<b>This list is a result of the SQL queries needed to uninstall Counter Module Addon</b><br/><br/>"; while($sql[$n]) { $message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : ''; if( !$result = $db->sql_query($sql[$n]) ) { $message .= '<b><font color=#FF0000>[Error or Already removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } else { $message .='<b><font color=#0000fF>[Removed]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />'; } $n++; } $message .= ' <br />If you get some Error, relax, this is normal when updating modules'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Installation Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: mx_counter.php --- <?php /** * * @package mxBB Portal Module - mx_counter * @version $Id: mx_counter.php,v 1.1 2007/06/06 23:49:12 orynider Exp $ * @copyright (c) 2002-2006 [Florin Bodin] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // ERROR HANDLING // //error_reporting( E_ALL ); // // Read Block Settings // $title = $mx_block->block_info['block_title']; $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); // // Get general counter information // include($module_root_path . 'includes/' . 'counter_common.'.$phpEx); //Set a cookie for the counter so we know we have been here before setcookie($board_config['cookie_name'] . '_mx_counter',"set",time() + 31536000,$board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); //check cookie global $HTTP_COOKIE_VARS; if($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_mx_counter']) { $bInc=false; } else { $bInc=true; } $digitpath = $counter_config['digitpath']; $digits = $counter_config['digits']; if (empty($digitpath)) { $digitpath = 'set1'; } if (empty($digits)) { $digits = '5'; } //read old counter data $imagedirectory = $module_root_path . 'numbers/' . $digitpath . '/'; $sql2 = "SELECT * FROM ".COUNTER_SESSION_TABLE." WHERE count_id = 1"; $result2 = $db->sql_query($sql2); if( !($result2 = $db->sql_query($sql2)) ) { mx_message_die(GENERAL_ERROR, "Couldn't query counter session table", "", __LINE__, __FILE__, $sql2); } else { while( $currentcount = $db->sql_fetchrow($result2) ) { $currentcount = $currentcount['currentcount']; //check if we are incrementing counter if($bInc) { $newcount = $currentcount + 1; } else { $newcount = $currentcount; } $numdigits = strlen($newcount); //set each digit to default 0 for ($a=0;$a<$digits;$a++) { $img[$a] = "$imagedirectory"; $img[$a] .= "0.gif"; } //change each digit $actdigits = strlen($newcount); for ($a=0;$a<$actdigits;$a++) { $showdig = substr($newcount, $a, 1); $img[$digits - $actdigits + $a] = "$imagedirectory"; $img[$digits - $actdigits + $a] .= "$showdig.gif"; } //check if we have an overflow if($numdigits > $digits) { $bOver=true; for ($a=0;$a<$digits;$a++) { $img[$a] = "$imagedirectory"; $img[$a] .= "9.gif"; } } //this is what we are ouputing $displayblock = ""; for ($a=0;$a<$digits;$a++) { $displayblock .= "<img src=$img[$a]>"; } //if we incremented, write this value if($bInc) { update_count($newcount); } //$counter_data is the variable that holds the stuff to output $counter_data.=$displayblock; if($bOver == true)$counter_data.='+'; // // Start output of page // $template->set_filenames(array( 'body_block' => 'mx_counter.tpl') ); $template->assign_vars(array( 'BLOCK_SIZE' => ( !empty($block_size) ? $block_size : '100%' ), 'L_TITLE' => ( !empty($lang[$title]) ? $lang[$title] : $title ), 'L_PORTAL_COUNTER' => ( !empty($lang[portal_counter]) ? $lang[portal_counter] : '' ), 'COUNTER_DATA' => $counter_data, 'U_URL' => append_sid(PORTAL_URL . 'index.' . $phpEx . '?block_id=' . $block_id), 'BLOCK_ID' => $block_id, 'S_HIDDEN_FORM_FIELDS' => $s_hidden_fields) ); $template->pparse('body_block'); } } ?> --- NEW FILE: mx_counter.pak --- module=+:75=+:mx_counter=+:modules/mx_counter/=+:Portal Counter=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:75=+:93=+:Portal Counter=+:Counter Block=+:mx_counter.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Portal Counter=+:Demo block=+:93=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 --- NEW FILE: readme.txt --- /********************************************************************************\ | | subject : mxBB-Portal, CMS & portal, module | name : mx_counter | begin : January, 2007 | copyright : (C) 2002-2007 mxBB | mxBB project site : www.mx-system.com | | author : OryNider (see additional credit below) | author site : http://pubory.uv.ro/ | author email : ory...@rd... | | additional credit : Some ideeas of this module are originaly based on the | [ABD] Counter MOD by Andareed (and...@ho...) | | description : This module / block basically, | it is a graphical counter, but integrates into mxBB. | It integrates into the AdminCP, and options like digit lengh, | digit image locations, and counter value can be modified. | It also uses a cookie, so that only truly unique visitors are counted. | The original MOD used a counter.dat file to store the informations, | this version uses the database to do that, more then that | this module uses normal template files instead of just echo. | |********************************************************************************| | | @package mxBB Portal Module - mx_phpCA | @version $Id: readme.txt,v 1.1 2007/06/06 23:49:13 orynider Exp $ | @copyright (c) 2002-2007 [OryNider] mxBB Development Team | @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 | \********************************************************************************/ /********************************************************************************\ | Installation Instructions \********************************************************************************/ Note: In order for this module to install you must have a working phpBB and mxBB installation. 1) Copy the folder: mx_counter into your: {mxBB install}\modules\ folder on your web server. 2) From your website enter mxBB Admin Control Panel. 3) Under mxBB-Portal click on Management. 4) Now click on Modules Setup. 5) Under Module Administration use the pull down menu and choose: mx_counter 6) Press the Install Module button 7) If you have followed the instructions correctly you should now be able to create Mx Counter blocks for inclusion on your pages. 8) chmod 777 upload/chasers/, upload/images/ and upload/payments/ /********************************************************************************\ | End Of Document \********************************************************************************/ --- NEW FILE: db_install.php --- <?php /** * * @package mxBB Portal Module - mx_counter * @version $Id: db_install.php,v 1.1 2007/06/06 23:49:09 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ //ini_set( 'display_errors', '1' ); define( 'IN_PORTAL', true ); if ( !defined( 'IN_ADMIN' ) ) { $mx_root_path = './../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); // End session management if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } } $mx_module_version = '1.0.0'; $mx_module_copy = 'mxBB <i> - Counter</i> module by OryNider & <a href="http://www.mxbb.net" target="_blank">Mx Team</a>'; // If fresh install if ( !$result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "counter_config" ) ) { $message = "<b>This is a fresh install!</b><br/><br/>"; $sql = array(); $sql[] = "DROP TABLE IF EXISTS " . $mx_table_prefix . "counter_config"; $sql[] = "DROP TABLE IF EXISTS " . $mx_table_prefix . "counter_session"; $sql[] = "CREATE TABLE ".$mx_table_prefix."counter_session ( count_id int(11) UNSIGNED NOT NULL auto_increment, currentcount varchar(255) NOT NULL, PRIMARY KEY (count_id) ) TYPE=MyISAM"; $sql[] = "CREATE TABLE " . $mx_table_prefix . "counter_config ( config_name VARCHAR(255) NOT NULL default '', config_value varchar(255) NOT NULL default '', PRIMARY KEY (config_name) ) TYPE=MyISAM"; $sql[] = "INSERT INTO " . $mx_table_prefix . "counter_session VALUES ('count_id', '1')"; $sql[] = "INSERT INTO " . $mx_table_prefix . "counter_config ( config_name , config_value ) VALUES ('digitpath', 'set1')"; $sql[] = "INSERT INTO " . $mx_table_prefix . "counter_config ( config_name , config_value ) VALUES ('digits', '5')"; $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); } else { // If already installed $message = "<b>Module is already installed... consider upgrading ;)</b><br/><br/>"; } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Module Installation/Upgrading/Uninstallation Information - Module specific DB tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> --- NEW FILE: index.htm --- <html> <head> <title>mxBB Counter Module</title> </head> <body> <br /><br /><br /><br /><br /><br /><br /> <center><h1><a href="http://mxbb.net/">mxBB-Portal</a></h1></center> </body> |