From: <be...@us...> - 2012-07-31 12:58:07
|
Revision: 9961 http://xoops.svn.sourceforge.net/xoops/?rev=9961&view=rev Author: beckmi Date: 2012-07-31 12:57:55 +0000 (Tue, 31 Jul 2012) Log Message: ----------- Adding version 5.0 by Trabis Added Paths: ----------- XoopsModules/shoutbox/trunk/shoutbox/admin/ XoopsModules/shoutbox/trunk/shoutbox/admin/index.php XoopsModules/shoutbox/trunk/shoutbox/admin/menu.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxEdit.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxFile.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxList.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxRemove.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxSave.php XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxStatus.php XoopsModules/shoutbox/trunk/shoutbox/blocks/ XoopsModules/shoutbox/trunk/shoutbox/blocks/index.html XoopsModules/shoutbox/trunk/shoutbox/blocks/shoutbox.php XoopsModules/shoutbox/trunk/shoutbox/class/ XoopsModules/shoutbox/trunk/shoutbox/class/database.php XoopsModules/shoutbox/trunk/shoutbox/class/file.php XoopsModules/shoutbox/trunk/shoutbox/class/index.html XoopsModules/shoutbox/trunk/shoutbox/class/shoutbox.php XoopsModules/shoutbox/trunk/shoutbox/header.php XoopsModules/shoutbox/trunk/shoutbox/images/ XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/ XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest1.gif XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest2.gif XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest3.gif XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest4.gif XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest5.gif XoopsModules/shoutbox/trunk/shoutbox/images/index.html XoopsModules/shoutbox/trunk/shoutbox/images/module_logo.png XoopsModules/shoutbox/trunk/shoutbox/images/newlogoblank.png XoopsModules/shoutbox/trunk/shoutbox/images/nonavatar.gif XoopsModules/shoutbox/trunk/shoutbox/images/offline.gif XoopsModules/shoutbox/trunk/shoutbox/images/online.gif XoopsModules/shoutbox/trunk/shoutbox/include/ XoopsModules/shoutbox/trunk/shoutbox/include/functions.php XoopsModules/shoutbox/trunk/shoutbox/include/index.html XoopsModules/shoutbox/trunk/shoutbox/include/module.php XoopsModules/shoutbox/trunk/shoutbox/index.html XoopsModules/shoutbox/trunk/shoutbox/language/ XoopsModules/shoutbox/trunk/shoutbox/language/english/ XoopsModules/shoutbox/trunk/shoutbox/language/english/admin.php XoopsModules/shoutbox/trunk/shoutbox/language/english/blocks.php XoopsModules/shoutbox/trunk/shoutbox/language/english/index.html XoopsModules/shoutbox/trunk/shoutbox/language/english/main.php XoopsModules/shoutbox/trunk/shoutbox/language/english/modinfo.php XoopsModules/shoutbox/trunk/shoutbox/language/index.html XoopsModules/shoutbox/trunk/shoutbox/new_shout.wav XoopsModules/shoutbox/trunk/shoutbox/online.php XoopsModules/shoutbox/trunk/shoutbox/popup.php XoopsModules/shoutbox/trunk/shoutbox/readme.txt XoopsModules/shoutbox/trunk/shoutbox/readme_archive.txt XoopsModules/shoutbox/trunk/shoutbox/shoutframe.php XoopsModules/shoutbox/trunk/shoutbox/shoutpopupframe.php XoopsModules/shoutbox/trunk/shoutbox/sql/ XoopsModules/shoutbox/trunk/shoutbox/sql/mysql.sql XoopsModules/shoutbox/trunk/shoutbox/style/ XoopsModules/shoutbox/trunk/shoutbox/style/index.html XoopsModules/shoutbox/trunk/shoutbox/style/shoutbox2.css XoopsModules/shoutbox/trunk/shoutbox/templates/ XoopsModules/shoutbox/trunk/shoutbox/templates/blocks/ XoopsModules/shoutbox/trunk/shoutbox/templates/blocks/index.html XoopsModules/shoutbox/trunk/shoutbox/templates/blocks/shoutbox_block.html XoopsModules/shoutbox/trunk/shoutbox/templates/index.html XoopsModules/shoutbox/trunk/shoutbox/templates/shoutbox_online.html XoopsModules/shoutbox/trunk/shoutbox/templates/shoutbox_popup.html XoopsModules/shoutbox/trunk/shoutbox/templates/shoutbox_popupframe.html XoopsModules/shoutbox/trunk/shoutbox/templates/shoutbox_popupheader.html XoopsModules/shoutbox/trunk/shoutbox/templates/shoutbox_shoutframe.html XoopsModules/shoutbox/trunk/shoutbox/xoops_version.php Added: XoopsModules/shoutbox/trunk/shoutbox/admin/index.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/index.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/index.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,125 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: index.php 0 2010-01-29 18:47:04Z trabis $ + */ +// Hello admin? +include '../../../include/cp_header.php'; +// Admin! + +function shoutboxDefault() +{ + global $xoopsModuleConfig; + + if($xoopsModuleConfig['storage_type'] == 'database') { + $database = '['._AM_SH_EDIT_INUSE.']'; + $file = ''; + } else if($xoopsModuleConfig['storage_type'] == 'file') { + $database = ''; + $file = '['._AM_SH_EDIT_INUSE.']'; + } + + echo " + <h1>"._AM_SH_CONFIG."</h1> + <br /> + "._AM_SH_CHOOSE." + <ul> + <li><a href='index.php?op=shoutboxList'>" . _AM_SH_EDIT_DB . "</a> $database</li> + <li><a href='index.php?op=shoutboxFile'>" . _AM_SH_EDIT_FILE . "</a> $file</li> + <li><a href='index.php?op=shoutboxStatus'>" . _AM_SH_STATUSOF . "</a></li> + </ul> + <br /> + "; +} + +function shoutboxList() +{ + global $xoopsDB; + include 'shoutboxList.php'; +} + +function shoutboxEdit() +{ + global $xoopsDB; + include 'shoutboxEdit.php'; +} + +function shoutboxSave() +{ + global $xoopsDB; + include 'shoutboxSave.php'; +} + +function shoutboxRemove() +{ + global $xoopsDB; + include 'shoutboxRemove.php'; +} + +function shoutboxFile() +{ + global $xoopsDB; + include 'shoutboxFile.php'; +} + +function shoutboxStatus() +{ + global $xoopsDB, $xoopsModuleConfig; + include 'shoutboxStatus.php'; +} + +$op = empty($_GET["op"]) ? '' : $_GET["op"]; + +switch ($op){ + case "shoutboxList": + xoops_cp_header(); + shoutboxList(); + break; + + case "shoutboxEdit": + xoops_cp_header(); + shoutboxEdit(); + break; + + case "shoutboxSave": + shoutboxSave(); + break; + + case "shoutboxRemove": + shoutboxRemove(); + break; + + case "shoutboxFile": + xoops_cp_header(); + shoutboxFile(); + break; + + case "shoutboxStatus": + xoops_cp_header(); + shoutboxStatus(); + break; + + default: + xoops_cp_header(); + shoutboxDefault(); + break; + +} + +xoops_cp_footer(); +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/menu.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/menu.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/menu.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,28 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: menu.php 0 2010-01-29 18:47:04Z trabis $ + */ + +$adminmenu[1]['title'] = _MI_SHOUTBOX_MENU_DB; +$adminmenu[1]['link'] = "admin/index.php?op=shoutboxList"; +$adminmenu[2]['title'] = _MI_SHOUTBOX_MENU_FILE; +$adminmenu[2]['link'] = "admin/index.php?op=shoutboxFile"; +$adminmenu[3]['title'] = _MI_SHOUTBOX_MENU_STATUS; +$adminmenu[3]['link'] = "admin/index.php?op=shoutboxStatus"; +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxEdit.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxEdit.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxEdit.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,98 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxEdit.php 0 2010-01-29 18:47:04Z trabis $ + */ + +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} + +include_once XOOPS_ROOT_PATH.'/class/module.textsanitizer.php'; + +$sanitizer = new MyTextSanitizer; + +// Check or ID is a number +$id = intval($_GET['id']); + +$handler = xoops_getModuleHandler('database', 'shoutbox'); + +// Check or we got a shout +if (!$obj = $handler->get($id)) { + /** + * Or we got none, or something really strange happend here... + */ + redirect_header("index.php", 3, _AM_SH_INVALID_ID); +} + + +// Make code ready for preview +$shout = $obj->getValues(); +$shout['date'] = $obj->time(_DATESTRING); + +echo " +<form action='index.php?op=shoutboxSave' method='post'> +<table width='100%' class='outer' cellspacing='1'> +<tbody> +<tr> +<th colspan='2'>".sprintf(_AM_SH_EDIT_TITLE, $shout['date'])."</th> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_POSTER."</b> +</td> +<td class='even'>\n"; + +if($shout['uid'] != 0) { + echo "<input type='text' size='30' maxlength='30' name='shoutboxUname' value='$shout[uname]' readonly='readonly' />"; +} else { + echo "<input type='text' size='30' maxlength='30' name='shoutboxUname' value='$shout[uname]' />"; +} +echo " +</td> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_EDIT_FROM."</b> +</td> +<td class='even'> +<input type='text' size='30' maxlength='30' name='shoutboxIp' value='$shout[ip]' /> +</td> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_MESSAGE."</b> +</td> +<td class='even'> +<input type='text' name='shoutboxMessage' size='100' maxlength='200' value='$shout[message]' /> +</td> +</tr> +<tr class='foot'> +<td colspan='2' align='center'> +<input type='hidden' name='id' value='$shout[id]' /> +<input type='hidden' name='uid' value='$shout[uid]' /> + +<input type='submit' name='submit' value='"._SUBMIT."' /> +<input type='button' value='"._CANCEL."' onClick='location=\"index.php?op=shoutboxList\"' /> +</td> +</tr> +</tbody> +</table> +</form> +"; +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxFile.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxFile.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxFile.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,97 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxFile.php 0 2010-01-29 18:47:04Z trabis $ + */ + +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} + +include_once XOOPS_ROOT_PATH . '/class/module.textsanitizer.php'; +$sanitizer =& MyTextSanitizer::getInstance(); + +$path = XOOPS_ROOT_PATH . '/uploads/shoutbox/shout.csv'; +$source = file_get_contents($path); +$source = $sanitizer->htmlSpecialChars($source); +$hash = sha1_file($path); +$invalidhash = false; + +if (!empty($_POST['action']) && $_POST['action'] == 'Update') { + if (empty($_POST['forceUpdate']) && $hash != $_POST['hash']) { + echo "<h1>" . _AM_SH_FILE_HASH_FAILED . "</h1>"; + $invalidhash = true; + $source = $sanitizer->stripSlashesGPC($_POST['shoutboxSource']); + $source = $sanitizer->htmlSpecialChars($source); + } else { + $source = $sanitizer->stripSlashesGPC($_POST['shoutboxSource']); + + if ($file = fopen($path, "w")) { + fwrite($file, $source); + fclose($file); + echo "<h1>"._AM_SH_FILE_UPDATED."</h1>"; + } else { + echo "<h1>"._AM_SH_FILE_FAILED."</h1>"; + } + } +} + +echo " +<form action='index.php?op=shoutboxFile' method='post'> +<table width='100%' class='outer' cellspacing='1'> +<tbody> +<tr> +<th colspan='2'>"._AM_SH_FILE_TITLE."</th> +</tr> +<tr valign='top' align='left'> +<td class='odd' width='20%'> +<b>"._AM_SH_FILE_SOURCE."</b><br /> +"._AM_SH_FILE_SOURCED." +</td> +<td class='even'> +<textarea name='shoutboxSource' rows='25' cols='98%'>$source</textarea> +</td> +</tr>"; + +if ($invalidhash == true) { + echo " + <tr valign='top' align='left'> + <td class='odd' width='20%'> + <b>"._AM_SH_FILE_HASH."</b><br /> + "._AM_SH_FILE_HASHD." + </td> + <td class='even'> + <input type='checkbox' name='forceUpdate' value='yes' checked='checked' /> + </td> + </tr> + "; +} + +echo " +<tr class='foot'> +<td colspan='2' align='center'> +<input type='hidden' name='hash' value='$hash' /> +<input type='hidden' name='action' value='Update' /> +<input type='submit' name='submit' value='"._SUBMIT."' /> +</td> +</tr> +<tbody> +</table> +</form>"; + +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxList.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxList.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxList.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,71 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxList.php 0 2010-01-29 18:47:04Z trabis $ + */ + +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} + +include_once(XOOPS_ROOT_PATH.'/class/module.textsanitizer.php'); +$sanitizer = new MyTextSanitizer; + +echo "<h4 style='text-align: left;'>"._AM_SH_CONFIG."</h4>\n"; +echo " +<table class='outer' width='100%' cellpadding='4' cellspacing='1'> +<tr> +<th width='15%' align='left'>"._AM_SH_POSTER."</th> +<th width='15%' align='left'>"._AM_SH_LIST_TIME."</th> +<th width='55%' align='center'>"._AM_SH_MESSAGE."</th> +<th width='15%' align='right'>"._AM_SH_LIST_ACTION."</th> +</tr>\n"; + +$evodd = "even"; +$result = $xoopsDB->query("SELECT `id`, `uid`, `uname`, `time`, `ip`, `message` FROM ".$xoopsDB->prefix('shoutbox')." ORDER BY `time` DESC LIMIT 0, 50"); + +if(!$xoopsDB->getRowsNum($result)) { + echo "<tr class='even' align='center'><td colspan='4'>"._AM_SH_LIST_NOSHOUTS."</td></tr>"; +} + +while (list($msg_id, $user_id, $uname, $time, $ip, $message) = $xoopsDB->fetchRow($result)) { + + if ($evodd == "even") { + echo "<tr class='even' align='center' valign='top'>\n"; + } else { + echo "<tr class='even' align='center' valign='top'>\n"; + } + + echo "<td align='left'> + <div title='UID: $user_id | IP: $ip'>$uname"; if($user_id == 0) { echo '*'; } echo "</div> + </td> + <td align='left'> + ".formatTimestamp($time, _DATESTRING)." + </td> + <td align='center'> + $message + </td> + <td align='right'> + <a href='index.php?op=shoutboxEdit&id=$msg_id'>"._EDIT."</a> / <a href='index.php?op=shoutboxRemove&id=$msg_id'>"._DELETE."</a> + </td>"; + + echo "</tr>"; +} + +echo "<tr class='foot'><td colspan='4'> </td></tr></table>"; +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxRemove.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxRemove.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxRemove.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,93 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxRemove.php 0 2010-01-29 18:47:04Z trabis $ + */ +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} +$id = intval($_REQUEST['id']); +$handler = xoops_getModuleHandler('database', 'shoutbox'); +// Request or confirmation? +if (!empty($_POST['confirm']) && $_POST['confirm'] == 'yes') { + // Sanitize inputs + $obj = $handler->get($id); + if (is_object($obj) && $handler->delete($obj)) { + redirect_header("index.php", 2, _AM_SH_REMOVE_SUCCES); + } else { + redirect_header("index.php", 4, _AM_SH_REMOVE_FAILURE); + } +} else { + xoops_cp_header(); + // Check or we got a shout + if (!$obj = $handler->get($id)) { + /** + * Or we got none, or something really strange happend here... + */ + redirect_header("index.php", 3, _AM_SH_INVALID_ID); + } + + // Make code ready for preview + $shout = $obj->getValues(); + $shout['date'] = $obj->time(_DATESTRING); + + echo " + <form action='index.php?op=shoutboxRemove' method='post'> + <table width='100%' class='outer' cellspacing='1'> + <tbody> + <tr> + <th colspan='2'>".sprintf(_AM_SH_REMOVE_TITLE, $shout['date'])."</th> + </tr> + <tr valign='top' align='left'> + <td class='odd'> + <b>"._AM_SH_POSTER."</b> + </td> + <td class='even'> + $shout[uname] + </td> + </tr> + <tr valign='top' align='left'> + <td class='odd'> + <b>"._AM_SH_REMOVE_FROM."</b> + </td> + <td class='even'> + $shout[ip] + </td> + </tr> + <tr valign='top' align='left'> + <td class='odd'> + <b>"._AM_SH_MESSAGE."</b> + </td> + <td class='even'> + $shout[message] + </td> + </tr> + <tr class='foot'> + <td colspan='2' align='center'> + <input type='hidden' name='id' value='$shout[id]' /> + <input type='hidden' name='confirm' value='yes' /> + <input type='submit' name='submit' value='"._DELETE."' /> + <input type='button' value='"._CANCEL."' onClick='location=\"index.php?op=shoutboxList\"' /> + </td> + </tr> + </tbody> + </table> + </form> + "; +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxSave.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxSave.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxSave.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,53 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxSave.php 0 2010-01-29 18:47:04Z trabis $ + */ + +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} + +$handler = xoops_getModuleHandler('database', 'shoutbox'); + +$id = intval($_POST['id']); +if (!$obj = $handler->get($id)) { + /** + * Or we got none, or something really strange happend here... + */ + redirect_header("index.php", 3, _AM_SH_INVALID_ID); +} + +if (!preg_match("/^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/", $_POST['shoutboxIp'])) { + // This check is far from perfect but... + exit('Whoops! [ERROR 24]'); +} + +$obj->setVar('uname', $_POST['shoutboxUname']); +$obj->setVar('ip', $_POST['shoutboxIp']); +$obj->setVar('message', $_POST['shoutboxMessage']); + + +// Execute query +if ($handler->insert($obj)) { + redirect_header("index.php", 2, "Shout updated!"); +} else { + redirect_header("index.php", 4, "Error - Could not execute query..."); +} + +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxStatus.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxStatus.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/admin/shoutboxStatus.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,111 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutboxStatus.php 0 2010-01-29 18:47:04Z trabis $ + */ + +if (!defined("XOOPS_MAINFILE_INCLUDED") || !strstr($_SERVER['PHP_SELF'], 'admin/index.php')) { + exit(); +} + +// Count shouts in database and file +// Database: +$query = $xoopsDB->query("SELECT count(*) FROM ".$xoopsDB->prefix("shoutbox")); +$query = $xoopsDB->fetchRow($query); +$count_database = $query[0]; +// File: +$path = XOOPS_ROOT_PATH.'/uploads/shoutbox/shout.csv'; +$count_file = count(file($path)); + +// Size +// Database: +// [Source: http://www.webmasterworld.com/forum88/2069.htm] +$rows = $xoopsDB->queryF("SHOW table STATUS"); +while ($row = $xoopsDB->fetchBoth($rows)) { + if($row['Name'] == $xoopsDB->prefix("shoutbox")) { + $size_database = $row['Data_length'] + $row['Index_length']; + } +} +// File: +$size_file = filesize($path); + +echo " +<table width='100%' class='outer' cellspacing='1'> +<tbody> +<tr> +<th colspan='2'>"._AM_SH_STATUS_TITLE."</th> +</tr> + + +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_STATUS_STORAGETYPE."</b> +</td> +<td class='even'> +$xoopsModuleConfig[storage_type] +</td> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<ul> +<li>"._AM_SH_STATUS_INDB."</li> +</ul> +</td> +<td class='even'> +$count_database +</td> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<ul> +<li>"._AM_SH_STATUS_INFILE."</li> +</ul> +</td> +<td class='even'> +$count_file +</td> +</tr> + + +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_STATUS_SIZEDB."</b> +</td> +<td class='even'> +$size_database bytes +</td> +</tr> +<tr valign='top' align='left'> +<td class='odd'> +<b>"._AM_SH_STATUS_SIZEFILE."</b> +</td> +<td class='even'> +$size_file bytes +</td> +</tr> + + +<tr class='foot'> +<td colspan='2' align='center'> + +</td> +</tr> +</tbody> +</table> +"; +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/blocks/index.html =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/blocks/index.html (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/blocks/index.html 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/blocks/shoutbox.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/blocks/shoutbox.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/blocks/shoutbox.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,68 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutbox.php 0 2010-01-29 18:47:04Z trabis $ + */ + +function b_shoutbox_show($options) +{ + include_once XOOPS_ROOT_PATH . '/modules/shoutbox/include/functions.php'; + global $xoopsUser, $xoopsConfig; + + $module_handler =& xoops_gethandler('module'); + $module =& $module_handler->getByDirname('shoutbox'); + $config_handler =& xoops_gethandler('config'); + $block =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); + + if ($block['captcha_enable']) { + xoops_load('XoopsFormCaptcha'); + $shoutcaptcha = new XoopsFormCaptcha(); + $block['captcha_caption'] = $shoutcaptcha->getCaption(); + $block['captcha_render'] = $shoutcaptcha->render(); + } + + $block['shoutbox_access'] = false; + if (is_object($xoopsUser)) { + $block['shoutbox_access'] = true; + $block['shoutbox_uname'] = $xoopsUser->getVar('uname'); + $block['shoutbox_userid'] = $xoopsUser->getVar('uid'); + } else if ($block['guests_may_post']) { + $block['shoutbox_access'] = true; + $block['shoutbox_uname'] = shoutbox_makeGuestName(); + $block['shoutbox_uid'] = 0; + } + + $block['shoutbox_anonymous'] = $xoopsConfig['anonymous']; + + if ($block['show_smileybar']) { + ob_start(); + include_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; + xoopsSmilies('shoutfield'); + $block['shoutbox_smibar'] = ob_get_contents(); + ob_end_clean(); + $block['shoutbox_smibar'] = str_replace("<a href='#moresmiley' onmouseover='style.cursor=\"hand\"' alt=''","<a href='#moresmiley' onmouseover='style.cursor=\"hand\"' title='More'", $block['shoutbox_smibar']); + } + + if (!is_object($xoopsUser) && !$block['popup_guests']) { + $block['popup'] = false; + } + + return $block; +} + +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/class/database.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/class/database.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/class/database.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,111 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * Shoutbox class + * + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @since 5.0 + * @author trabis <lus...@gm...> + * @version $Id: db.php 0 2010-01-06 18:47:04Z trabis $ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class ShoutboxDatabase extends XoopsObject +{ + /** + * constructor + */ + function ShoutboxDatabase() + { + $this->initVar("id", XOBJ_DTYPE_INT); + $this->initVar("uid", XOBJ_DTYPE_INT); + $this->initVar("uname", XOBJ_DTYPE_TXTBOX); + $this->initVar("time", XOBJ_DTYPE_STIME); + $this->initVar("ip", XOBJ_DTYPE_TXTBOX); + $this->initVar("message", XOBJ_DTYPE_TXTAREA); + + $this->initVar("dohtml", XOBJ_DTYPE_INT, 0); + $this->initVar("doxcode", XOBJ_DTYPE_INT, 0); + $this->initVar("dosmiley", XOBJ_DTYPE_INT, 1); + $this->initVar("doimage", XOBJ_DTYPE_INT, 1); + $this->initVar("dobr", XOBJ_DTYPE_INT, 0); + } + + function time($dateFormat = 's', $format = 'S') + { + return formatTimestamp($this->getVar('time', $format), $dateFormat); + } + +} + +class ShoutboxDatabaseHandler extends XoopsPersistableObjectHandler +{ + function ShoutboxDatabaseHandler(&$db) + { + $this->__construct($db); + } + + function __construct($db) + { + parent::__construct($db, 'shoutbox', 'ShoutboxDatabase', 'id', 'uid'); + } + + function createShout() + { + return $this->create(); + } + + function saveShout($obj) + { + return $this->insert($obj); + } + + function getShouts($limit) + { + $criteria = new CriteriaCompo(); + $criteria->setSort('time'); + $criteria->setOrder('DESC'); + $criteria->setStart(0); + $criteria->setLimit($limit); + return $this->getObjects($criteria); + } + + function pruneShouts($limit) + { + $criteria = new CriteriaCompo(); + $criteria->setSort('id'); + $criteria->setOrder('DESC'); + $criteria->setStart(0); + $criteria->setLimit($limit); + $objs = $this->getList($criteria, true); + unset($criteria); + $criteria = new Criteria('id', '(' . implode(',', array_keys($objs)) . ')', 'NOT IN'); + return $this->deleteAll($criteria); + } + + function deleteShouts() + { + return $this->deleteAll(); + } + + function shoutExists($message, $ip) + { + $myts =& MyTextSanitizer::getInstance(); + $criteria = new CriteriaCompo(new Criteria('message', $myts->addSlashes($message))); + $criteria->add(new Criteria('ip', $ip)); + return $this->getCount($criteria) ? true : false; + } +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/class/file.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/class/file.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/class/file.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,150 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * Shoutbox class + * + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @since 5.0 + * @author trabis <lus...@gm...> + * @version $Id: file.php 0 2010-01-06 18:47:04Z trabis $ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class ShoutboxFile extends XoopsObject +{ + /** + * constructor + */ + function ShoutboxFile() + { + $this->initVar("id", XOBJ_DTYPE_INT); + $this->initVar("uid", XOBJ_DTYPE_INT); + $this->initVar("uname", XOBJ_DTYPE_TXTBOX); + $this->initVar("time", XOBJ_DTYPE_STIME); + $this->initVar("ip", XOBJ_DTYPE_TXTBOX); + $this->initVar("message", XOBJ_DTYPE_TXTAREA); + + $this->initVar("dohtml", XOBJ_DTYPE_INT, 0); + $this->initVar("doxcode", XOBJ_DTYPE_INT, 0); + $this->initVar("dosmiley", XOBJ_DTYPE_INT, 1); + $this->initVar("doimage", XOBJ_DTYPE_INT, 1); + $this->initVar("dobr", XOBJ_DTYPE_INT, 0); + } + + function time($dateFormat = 's', $format = 'S') + { + return formatTimestamp($this->getVar('time', $format), $dateFormat); + } + +} + +class ShoutboxFileHandler extends XoopsPersistableObjectHandler +{ + var $csvfile; + + function ShoutboxFileHandler(&$db) + { + $this->__construct($db); + } + + function __construct($db) + { + $this->csvfile = XOOPS_ROOT_PATH . '/uploads/shoutbox/shout.csv'; + parent::__construct($db, '', 'ShoutboxFile', 'id', 'uid'); + } + + function createShout() + { + return $this->create(); + } + + function saveShout($obj) + { + $f = fopen($this->csvfile, 'a'); + fwrite($f, $obj->getVar('uname', 'n') . '|' . + $obj->getVar('message', 'n') . '|' . + $obj->getVar('time', 'n') . '|' . + $obj->getVar('ip', 'n') . '|' . + $obj->getVar('uid', 'n') . "\n"); + fclose($f); + return true; + } + + function getShouts($limit) + { + $objs = array(); + $shouts = file($this->csvfile); + $count = count($shouts) - 1; + $i = 0; + for ($count; $count >= 0; $count--) { + if ($limit <= $i) { + break; + } + $oneline = array(); + $oneline = explode('|', $shouts[$count]); + + $obj = $this->create(); + $obj->setVar('uname', $oneline[0]); + $obj->setVar('message', $oneline[1]); + $obj->setVar('time', $oneline[2]); + $obj->setVar('ip' , $oneline[3]); + $obj->setVar('uid', $oneline[4]); + $objs[] =& $obj; + unset($obj); + $i++; + } + return $objs; + } + + function pruneShouts($limit) + { + $shouts = file($this->csvfile); + $totrim = count($shouts) - $limit; + if ($totrim > 0) { + for ($i = 0; $i < $totrim; $i++) { + array_shift($shouts); + } + $f = fopen($this->csvfile, 'w'); + foreach ($shouts as $i => $line) { + fputs($f, $line); + } + fclose($f); + } + return true; + } + + function deleteShouts() + { + $f = fopen($this->csvfile, 'w'); + fclose($f); + return true; + } + + function shoutExists($message, $ip) + { + $shouts = file($this->csvfile); + if (!empty($shouts)) { + $count = count($shouts) - 1; + $oneline = explode('|', $shouts[$count]); + if (count($oneline) != 0) { + if ($oneline[3] == $ip && $oneline[1] == $message) { + return true; + } + } + } + return false; + } +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/class/index.html =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/class/index.html (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/class/index.html 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1 @@ +<script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/class/shoutbox.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/class/shoutbox.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/class/shoutbox.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,126 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: shoutbox.php 0 2010-01-29 18:47:04Z trabis $ + */ + +include_once dirname(dirname(__FILE__)) . '/include/functions.php'; + +class Shoutbox +{ + var $handler = ''; + + function Shoutbox($storage_type) + { + $this->handler =& xoops_getModuleHandler($storage_type, 'shoutbox'); + } + + function getDefaultAvatar() + { + if ($value = shoutbox_getOption('guest_avatar')) { + $avatar = XOOPS_URL . "/modules/shoutbox/images/guestavatars/guest" . $value . ".gif"; + } else { + $avatar = XOOPS_URL . '/uploags/blank.gif'; + } + return $avatar; + } + + function saveShout($uid, $uname, $message) + { + $myts =& MyTextSanitizer::getInstance(); + $obj = $this->handler->createShout(); + $obj->setVar('uid', $uid); + $obj->setVar('uname', $uname); + $obj->setVar('time', time()); + $obj->setVar('ip', getenv("REMOTE_ADDR")); + $obj->setVar('message', $message); + + if (!$this->handler->saveShout($obj)) { + return false; + } + + return true; + } + + function getShouts($online, $bbcode, $limit) + { + global $xoopsUser; + $shouts = array(); + $myts =& MyTextSanitizer::getInstance(); + $objs = $this->handler->getShouts($limit); + $i = 0; + foreach ($objs as $obj) { + $uid = $obj->getVar('uid'); + $shouts[$i]['uid'] = $uid; + $shouts[$i]['online'] = 0; + $shouts[$i]['url'] = ''; + $shouts[$i]['email'] = ''; + $shouts[$i]['avatar'] = $this->getDefaultAvatar(); + $shouts[$i]['uname'] = $obj->getVar('uname'); + $shouts[$i]['time'] = $obj->time(shoutbox_getOption('stamp_format')); + $shouts[$i]['ip'] = $obj->getVar('ip'); + + $obj->setVar('doxcode', $bbcode); + + $shouts[$i]['message'] = $myts->censorString($obj->getVar('message')); + if ($wordwrap = shoutbox_getOption('wordwrap_setting')) { + $shouts[$i]['message'] = wordwrap($shouts[$i]['message'], $wordwrap ,"\r\n", true); + } + + if ($uid != 0) { + $thisUser = new XoopsUser($uid); + if ($thisUser->isOnline()) { + $shouts[$i]['online'] = 1; + } + if ($thisUser->getVar("url") != "") { + $shouts[$i]['url'] = $thisUser->getVar("url"); + } + if ($thisUser->getVar("user_viewemail") == 1 || ($xoopsUser && $xoopsUser->isAdmin())) { + $shouts[$i]['email'] = $thisUser->getVar("email"); + } + $shouts[$i]['avatar'] = XOOPS_URL . '/uploads/' . $thisUser->getVar("user_avatar"); + } + $i++; + } + return $shouts; + } + + function pruneShouts($limit) + { + if ($limit > 0) { + return $this->handler->pruneShouts($limit); + } + return false; + } + + function deleteShouts() + { + global $xoopsUser; + if (!empty($xoopsUser) && $xoopsUser->isAdmin()) { + return $this->handler->deleteShouts(); + } + return false; + } + + function shoutExists($message) + { + return $this->handler->shoutExists($message, getenv("REMOTE_ADDR")); + } + +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/header.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/header.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/header.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,49 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author trabis <lus...@gm...> + * @version $Id: header.php 0 2010-01-29 18:47:04Z trabis $ + */ + +include_once dirname(dirname(dirname(__FILE__))) . '/mainfile.php'; +include_once XOOPS_ROOT_PATH . '/class/template.php'; +error_reporting(0); +$GLOBALS['xoopsLogger']->activated = false; +$xoopsTpl = new XoopsTpl(); +$xoopsTpl->xoops_setCaching(0); + +$xoopsTpl->assign( +array( + 'xoops_theme' => $xoopsConfig['theme_set'], + 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/', + 'xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), + 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), + 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), + 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES) +) +); +$xoopsTpl->assign('xoops_js', '<script type="text/javascript" src="'.XOOPS_URL.'/include/xoops.js"></script>'); +if (is_object($xoopsUser)) { + $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin)); +} else { + $xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false)); +} + +if (is_file('style/shoutbox.css')) { + $xoopsTpl->assign('themecss', 'style/shoutbox.css'); +} else { + $xoopsTpl->assign('themecss', xoops_getcss()); +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest1.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest1.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest2.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest2.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest3.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest3.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest4.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest4.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest5.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/guestavatars/guest5.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/index.html =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/images/index.html (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/images/index.html 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1 @@ +<script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/images/module_logo.png =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/module_logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/newlogoblank.png =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/newlogoblank.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/nonavatar.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/nonavatar.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/offline.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/offline.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/images/online.gif =================================================================== (Binary files differ) Property changes on: XoopsModules/shoutbox/trunk/shoutbox/images/online.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/shoutbox/trunk/shoutbox/include/functions.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/include/functions.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/include/functions.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,110 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: functions.php 0 2010-01-29 18:47:04Z trabis $ + */ + +function shoutbox_getOption($option, $dirname = 'shoutbox') +{ + static $modOptions = array(); + if (is_array($modOptions) && array_key_exists($option, $modOptions)) { + return $modOptions[$option]; + } + + $ret = null; + $module_handler =& xoops_gethandler('module'); + $module =& $module_handler->getByDirname($dirname); + $config_handler =& xoops_gethandler('config'); + if ($module) { + $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); + if (isset($moduleConfig[$option])) { + $ret = $moduleConfig[$option]; + } + } + $modOptions[$option] = $ret; + return $ret; +} + +function shoutbox_makeGuestName() +{ + global $xoopsConfig; + $ipadd = getenv('REMOTE_ADDR'); + $iparr = explode('.', $ipadd); + $ipadd = $iparr[0] + $iparr[1] + $iparr[2] + $iparr[3]; + $guestname = $xoopsConfig['anonymous'] . $ipadd; + return $guestname; +} + +function shoutbox_getUserName($uid = 0) +{ + xoops_load('XoopsUserUtility'); + $uname = XoopsUserUtility::getUnameFromId($uid, shoutbox_getOption('user_realname')); + return $uname; +} + +/** + * Most of these functions were written (originally) + * by Florian Solcher <e-xoops.alphalogic.org> + */ +function shoutbox_setCookie($timestamp) +{ + if (empty($_COOKIE['shoutcookie'])) { + setcookie("shoutcookie", $timestamp); + return false; + } + + if ($_COOKIE['shoutcookie'] < $timestamp) { + setcookie("shoutcookie", $timestamp); + return TRUE; + } else { + return FALSE; + } +} + +//irc like commands +function shoutbox_ircLike($command) +{ + global $xoopsModuleConfig, $xoopsUser, $special_stuff_head; + if ($command == "/quit") { + $special_stuff_head .= '<script language="javascript">'; + $special_stuff_head .= ' top.window.close();'; + $special_stuff_head .= '</script>'; + return true; + } + $commandlines=explode(' ',$command); + if (is_array($commandlines)) { + //general commands + //unregistered commands + if (!$xoopsUser) { + if (count($commandlines)==2) { + if (($commandlines[0]=='/nick') && ($commandlines[1]!='')) { + if($xoopsModuleConfig['guests_may_chname'] == 1) { + $special_stuff_head .= '<script language="javascript">'; + $special_stuff_head .= ' top.document.location.href="popup.php?username='.htmlentities($commandlines[1], ENT_QUOTES).'";'; + $special_stuff_head .= '</script>'; + return true; + } else { + return true; + } + } + } + } + } + return false; +} +?> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/include/index.html =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/include/index.html (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/include/index.html 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/shoutbox/trunk/shoutbox/include/module.php =================================================================== --- XoopsModules/shoutbox/trunk/shoutbox/include/module.php (rev 0) +++ XoopsModules/shoutbox/trunk/shoutbox/include/module.php 2012-07-31 12:57:55 UTC (rev 9961) @@ -0,0 +1,151 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/** + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Shoutbox + * @author Alphalogic <alp...@ho...> + * @author tank <tan...@co...> + * @author trabis <lus...@gm...> + * @version $Id: module.php 0 2010-01-29 18:47:04Z trabis $ + */ + +function xoops_module_install_shoutbox(&$module) +{ + $newmid = $module->getVar('mid'); + $groups = array(XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS); + + // retrieve all block ids for this module + $blocks = XoopsBlock::getByModule($newmid, false); + $msgs[] = _MD_AM_GROUP_SETTINGS_ADD; + $gperm_handler =& xoops_gethandler('groupperm'); + foreach ($groups as $mygroup) { + if ($gperm_handler->checkRight('module_admin', 0, $mygroup)) { + $mperm =& $gperm_handler->create(); + $mperm->setVar('gperm_groupid', $mygroup); + $mperm->setVar('gperm_itemid', $newmid); + $mperm->setVar('gperm_name', 'module_admin'); + $mperm->setVar('gperm_modid', 1); + if (!$gperm_handler->insert($mperm)) { + $msgs[] = ' <span style="color:#ff0000;">' . sprintf(_MD_AM_ACCESS_ADMIN_ADD_ERROR, "<strong>" . $mygroup . "</strong>") . "</span>"; + } else { + $msgs[] = " " . sprintf(_MD_AM_ACCESS_ADMIN_ADD, "<strong>" . $mygroup . "</strong>"); + } + unset($mperm); + } + $mperm =& $gperm_handler->create(); + $mperm->setVar('gperm_groupid', $mygroup); + $mperm->setVar('gperm_itemid', $newmid); + $mperm->setVar('gperm_name', 'module_read'); + $mperm->setVar('gperm_modid', 1); + if (!$gperm_handler->insert($mperm)) { + $msgs[] = ' <span style="color:#ff0000;">' . sprintf(_MD_AM_ACCESS_USER_ADD_ERROR, "<strong>" . $mygroup . "</strong>") . "</span>"; + } else { + $msgs[] = ' ' . sprintf(_MD_AM_ACCESS_USER_ADD_ERROR, "<strong>" . $mygroup . "</strong>"); + } + unset($mperm); + foreach ($blocks as $blc) { + $bperm =& $gperm_handler->create(); + $bperm->setVar('gperm_groupid', $mygroup); + $bperm->setVar('gperm_itemid', $blc); + $bperm->setVar('gperm_name', 'block_read'); + $bperm->setVar('gperm_modid', 1); + if (!$gperm_handler->insert($bperm)) { + $msgs[] = ' <span style="color:#ff0000;">' . _MD_AM_BLOCK_ACCESS_ERROR . ' Block ID: <strong>' . $blc . '</strong> Group ID: <strong>' . $mygroup . '</strong></span>'; + } else { + $msgs[] = ' ' . _MD_AM_BLOCK_ACCESS . sprintf(_MD_AM_BLOCK_ID, "<strong>" . $blc . "</strong>") . sprintf(_MD_AM_GROUP_ID, "<strong>" . $mygroup . "</strong>"); + } + unset($bperm); + } + } + unset($blocks); + unset($groups); + + $cacheDir = XOOPS_ROOT_PATH . '/uploads/shoutbox'; + $cacheFile = $cacheDir . '/shout.csv'; + + if (!file_exists($cacheFile)) { + if (!is_dir($cacheDir)) { + if (!mkdir($cacheDir)) { + //$msgs[] = "Failed to create dir!"; + return false; + } else { + //$msgs[] = " Dir /uploads/shoutbox/ succesfully created!"; + chmod($cacheDir, 0777); + } + } + + if ($file = fopen($cacheFile, 'w')) { + if (!fwrite($file, "Shoutbox|Welcome to the Shoutbox v4.x for Xoops|1|111.111.111.111|guest\n")) { + //$msgs[] = " Could not put content in file /uploads/shoutbox/shout.cvs! Please create <i>manually</i>."; + } + fclose($file); + chmod($cacheFile, 0777); + //$msgs[] = " File /uploads/shoutbox/shout.cvs succesfully created!"; + return true; + } else { + //$msgs[] = " Could not create file /uploads/shoutbox/shout.cvs! Please create <i>manually</i>."; + return false; + } + } else { + return true; + } +} + +function xoops_module_uninstall_shoutbox(&$module) +{ + $cacheDir = XOOPS_ROOT_PATH . '/uploads/shoutbox'; + //Always check if a directory exists prior to creation + if (!is_dir($cacheDir)) { + return true; + } else { + return rmdirr($cacheDir); + } +} + +/** + * Delete a file, or a folder and its contents + * + * @author Aidan Lister <ai...@ph...> + * @version 1.0 + * @param string $dirname The directory to delete + * @return bool Returns true on success, false on failure + */ + +function rmdirr($dirname) +{ + // Simple de... [truncated message content] |