From: <be...@us...> - 2013-06-26 08:29:31
|
Revision: 11788 http://sourceforge.net/p/xoops/svn/11788 Author: beckmi Date: 2013-06-26 08:29:27 +0000 (Wed, 26 Jun 2013) Log Message: ----------- Adding RandomQuote Added Paths: ----------- XoopsModules/randomquote/ XoopsModules/randomquote/branches/ XoopsModules/randomquote/releases/ XoopsModules/randomquote/trunk/ XoopsModules/randomquote/trunk/randomquote/ XoopsModules/randomquote/trunk/randomquote/admin/ XoopsModules/randomquote/trunk/randomquote/admin/admin_header.php XoopsModules/randomquote/trunk/randomquote/admin/index.php XoopsModules/randomquote/trunk/randomquote/admin/menu.php XoopsModules/randomquote/trunk/randomquote/blocks/ XoopsModules/randomquote/trunk/randomquote/blocks/index.html XoopsModules/randomquote/trunk/randomquote/blocks/random_quote.php XoopsModules/randomquote/trunk/randomquote/images/ XoopsModules/randomquote/trunk/randomquote/images/slogo.png XoopsModules/randomquote/trunk/randomquote/language/ XoopsModules/randomquote/trunk/randomquote/language/english/ XoopsModules/randomquote/trunk/randomquote/language/english/index.html XoopsModules/randomquote/trunk/randomquote/language/english/main.php XoopsModules/randomquote/trunk/randomquote/language/english/modinfo.php XoopsModules/randomquote/trunk/randomquote/language/index.html XoopsModules/randomquote/trunk/randomquote/sql/ XoopsModules/randomquote/trunk/randomquote/sql/index.html XoopsModules/randomquote/trunk/randomquote/sql/mysql.sql XoopsModules/randomquote/trunk/randomquote/templates/ XoopsModules/randomquote/trunk/randomquote/templates/blocks/ XoopsModules/randomquote/trunk/randomquote/templates/blocks/index.html XoopsModules/randomquote/trunk/randomquote/templates/blocks/random_quote_block.html XoopsModules/randomquote/trunk/randomquote/templates/index.html XoopsModules/randomquote/trunk/randomquote/xoops_version.php Added: XoopsModules/randomquote/trunk/randomquote/admin/admin_header.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/admin/admin_header.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/admin/admin_header.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,28 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // + +include "../../../mainfile.php"; +include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php"; +include XOOPS_ROOT_PATH."/include/cp_functions.php"; +if ( $xoopsUser ) { + $xoopsModule = XoopsModule::getByDirname("randomquote"); + if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) { + redirect_header(XOOPS_URL."/",3,_NOPERM); + exit(); + } +} else { + redirect_header(XOOPS_URL."/",3,_NOPERM); + exit(); +} +if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) { + include "../language/".$xoopsConfig['language']."/main.php"; +} else { + include "../language/english/main.php"; +} +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/admin/admin_header.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/admin/index.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/admin/index.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/admin/index.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,163 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // + +include_once "admin_header.php"; + +$op = "list"; + +if (isset($_GET)) { + foreach ($_GET as $k => $v) { + $$k = $v; + } +} + +if (isset($_POST)) { + foreach ($_POST as $k => $v) { + $$k = $v; + } +} + +if ( !empty($contents_preview) ) { + $myts =& MyTextSanitizer::getInstance(); + xoops_cp_header(); + + $html = empty($nohtml) ? 1 : 0; + $smiley = empty($nosmiley) ? 1 : 0; + $xcode = empty($noxcode) ? 1 : 0; + $p_title = $myts->makeTboxData4Preview($album); + $p_contents = $myts->makeTareaData4Preview($comentario, $html, $smiley, $xcode); + echo"<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'> + <table width='100%' border='0' cellpadding='4' cellspacing='1'> + <tr class='bg3' align='center'><td align='left'>$p_title</td></tr><tr class='bg1'><td>$p_contents</td></tr></table></td></tr></table><br />"; + $album = $myts->makeTboxData4PreviewInForm($album); + $comentario = $myts->makeTareaData4PreviewInForm($comentario); + include "contentsform.php"; + + xoops_cp_footer(); + exit(); +} + +if ($op == "list") { + // List quoete in database, and form for add new. + $myts =& MyTextSanitizer::getInstance(); + xoops_cp_header(); + + echo " + <h4 style='text-align:left;'>"._RQ_TITLE."</h4> + <form action='index.php' method='post'> + <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='bg2'> + <table width='100%' border='0' cellpadding='4' cellspacing='1'> + <tr class='bg3' align='center'><td align='left'>"._RQ_TEXTO."</td><td>"._RQ_AUTOR."</td><td> </td></tr>"; + $result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("citas")); + $count = 0; + while ( list($id, $texto, $autor) = $xoopsDB->fetchRow($result) ) { + $texto=$myts->makeTboxData4Edit($texto); + $autor=$myts->makeTboxData4Edit($autor); + echo "<tr class='bg1'><td align='left'> + <input type='hidden' value='$id' name='id[]' /> + <input type='hidden' value='$texto' name='oldtexto[]' /> + <textarea name='newtexto[]' rows='2'>$texto</textarea> + </td> + <td align='center'> + <input type='hidden' value='$autor' name='oldautor[]' /> + <input type='text' value='$autor' name='newautor[]' maxlength='255' size='20' /> + </td> + <td nowrap='nowrap' align='right'><a href='index.php?op=del&id=".$id."&ok=0'>"._DELETE."</a></td></tr>"; + $count++; + } + if ($count > 0) { + echo "<tr align='center' class='bg3'><td colspan='4'><input type='submit' value='"._SUBMIT."' /><input type='hidden' name='op' value='edit' /></td></tr>"; + } + echo "</table></td></tr></table></form> + <br /><br /> + <h4 style='text-align:left;'>"._RQ_ADD."</h4> + <form action='index.php' method='post'> + <table border='0' cellpadding='0' cellspacing='0' width='100%'> + <tr> + <td class='bg2'> + <table width='100%' border='0' cellpadding='4' cellspacing='1'> + <tr nowrap='nowrap'> + <td class='bg3'>"._RQ_AUTOR." </td> + <td class='bg1'> + <input type='text' name='autor' size='30' maxlength='255' /> + </td></tr> + <tr nowrap='nowrap'> + <td class='bg3'>"._RQ_TEXTO." </td> + <td class='bg1'> + <textarea name='texto' cols='20' rows='3'></textarea> + </td></tr> + <tr> + <td class='bg3'> </td> + <td class='bg1'> + <input type='hidden' name='op' value='add' /> + <input type='submit' value='"._SUBMIT."' /> + </td></tr> + </table> + </td></tr> + </table> + </form>"; + + xoops_cp_footer(); + exit(); +} + +if ($op == "add") { + // Add quote + $myts =& MyTextSanitizer::getInstance(); + $artista = $myts->makeTboxData4Save($autor); + $texto = $myts->makeTboxData4Save($texto); + $newid = $xoopsDB->genId($xoopsDB->prefix("citas")."id"); + $sql = "INSERT INTO ".$xoopsDB->prefix("citas")." (id, autor, texto) VALUES (".$newid.", '".$autor."', '".$texto."')"; + if (!$xoopsDB->query($sql)) { + xoops_cp_header(); + echo "Could not add category"; + xoops_cp_footer(); + } else { + redirect_header("index.php?op=list",1,_XD_DBSUCCESS); + } + exit(); +} + +if ($op == "edit") { + // Edit quotes + $myts =& MyTextSanitizer::getInstance(); + $count = count($newautor); + for ($i = 0; $i < $count; $i++) { + if ( $newautor[$i] != $oldautor[$i] || $newtexto[$i] != $oldtexto[$i]) { + $autor = $myts->makeTboxData4Save($newautor[$i]); + $texto = $myts->makeTboxData4Save($newtexto[$i]); + $sql = "UPDATE ".$xoopsDB->prefix("citas")." SET autor='".$autor."',texto='".$texto."' WHERE id=".$id[$i].""; + $xoopsDB->query($sql); + } + } + redirect_header("index.php?op=list",1,_XD_DBSUCCESS); + exit(); +} + +if ($op == "del") { + // Delete quote + if ($ok == 1) { + $sql = "DELETE FROM ".$xoopsDB->prefix("citas")." WHERE id = ".$id ; + if (!$xoopsDB->query($sql)) { + xoops_cp_header(); + echo "Could not delete category"; + xoops_cp_footer(); + } else { + redirect_header("index.php?op=list",1,_XD_DBSUCCESS); + } + exit(); + } else { + xoops_cp_header(); + xoops_confirm(array('op' => 'del', 'id' => $id, 'ok' => 1), 'index.php', _RQ_SUREDEL); + xoops_cp_footer(); + exit(); + } +} + +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/admin/index.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/admin/menu.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/admin/menu.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/admin/menu.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,12 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // + +$adminmenu[0]['title'] = _RQ_MENU; +$adminmenu[0]['link'] = "admin/index.php"; +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/admin/menu.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/blocks/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/blocks/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/blocks/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/blocks/random_quote.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/blocks/random_quote.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/blocks/random_quote.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,25 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // + +/****************************************************************************** + * Function: random_quote_show + * Input : void + * Output : $texto: Text of the quote + $autor: Autor of the quote + ******************************************************************************/ +function random_quote_show() { + global $xoopsDB; + $block = array(); + $result = $xoopsDB->query("SELECT texto, autor FROM ".$xoopsDB->prefix("citas")." ORDER BY RAND() LIMIT 1"); + list($texto, $autor)= $xoopsDB->fetchRow($result); + $block['texto']=$texto; + $block['autor']=$autor; + return $block; +} +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/blocks/random_quote.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/images/slogo.png =================================================================== (Binary files differ) Index: XoopsModules/randomquote/trunk/randomquote/images/slogo.png =================================================================== --- XoopsModules/randomquote/trunk/randomquote/images/slogo.png 2013-06-26 06:57:10 UTC (rev 11787) +++ XoopsModules/randomquote/trunk/randomquote/images/slogo.png 2013-06-26 08:29:27 UTC (rev 11788) Property changes on: XoopsModules/randomquote/trunk/randomquote/images/slogo.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/language/english/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/language/english/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/language/english/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/language/english/main.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/language/english/main.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/language/english/main.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,17 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // + +define("_RQ_TITLE","RANDOM QUOTES"); +define("_RQ_TEXTO","Text"); +define("_RQ_ADD","Add Quote"); +define("_RQ_AUTOR","Autor"); +define("_XD_DBSUCCESS","Database updated"); +define("_RQ_SUREDEL","Are you sure of delete the quote?"); + +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/language/english/main.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/language/english/modinfo.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/language/english/modinfo.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/language/english/modinfo.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,24 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // +// Module Info + +// The name of this module +define("_RQ_NAME","Random Quotes"); + +// A brief description of this module +define("_RQ_DESC","Insert a block with random quotes."); + +// Names of admin menu items +define("_RQ_MENU","Add/Edit Quotes"); + +// Names of blocks for this module (Not all module has blocks) +define("_RQ_BNAME","The Quote"); +define("_RQ_BDESC","Shows a random quote"); + +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/language/english/modinfo.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: XoopsModules/randomquote/trunk/randomquote/language/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/language/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/language/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/sql/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/sql/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/sql/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/sql/mysql.sql =================================================================== --- XoopsModules/randomquote/trunk/randomquote/sql/mysql.sql (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/sql/mysql.sql 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,13 @@ +# +# Table structure for table `citas` +# + +CREATE TABLE citas ( + id int(11) NOT NULL auto_increment, + texto text , + autor text , + PRIMARY KEY (id), + KEY id (id) +) TYPE=MyISAM; + +INSERT INTO `citas` VALUES (1, 'Xoops is super :-)', 'Zirafka'); \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/templates/blocks/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/templates/blocks/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/templates/blocks/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/templates/blocks/random_quote_block.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/templates/blocks/random_quote_block.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/templates/blocks/random_quote_block.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,2 @@ +<div class="blockContent"><em> <{$block.texto}></em><p align="right"><strong><{$block.autor}></strong></p></div> + Added: XoopsModules/randomquote/trunk/randomquote/templates/index.html =================================================================== --- XoopsModules/randomquote/trunk/randomquote/templates/index.html (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/templates/index.html 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/randomquote/trunk/randomquote/xoops_version.php =================================================================== --- XoopsModules/randomquote/trunk/randomquote/xoops_version.php (rev 0) +++ XoopsModules/randomquote/trunk/randomquote/xoops_version.php 2013-06-26 08:29:27 UTC (rev 11788) @@ -0,0 +1,59 @@ +<?php +// ------------------------------------------------------------------------ // +// Random Quotes Module for // +// XOOPS - PHP Content Management System 2.0 // +// Versión 1.0.0 // +// Copyright (c) 2002 Mario Figge // +// http://www.zona84.com // +// ------------------------------------------------------------------------- // +// 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. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +$modversion['name'] = _RQ_NAME; +$modversion['version'] = 1.1; +$modversion['description'] = _RQ_DESC; +$modversion['credits'] = "Egg McMuffin"; +$modversion['author'] = "Mario Figge http://www.zona84.com/"; +$modversion['help'] = "randomquote.html"; +$modversion['license'] = "GPL see LICENSE"; +$modversion['official'] = 1; +$modversion['image'] = "images/slogo.png"; +$modversion['dirname'] = "randomquote"; + +// Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin) +// All tables should not have any prefix! +$modversion['sqlfile']['mysql'] = "sql/mysql.sql"; +//$modversion['sqlfile']['postgresql'] = "sql/pgsql.sql"; + +// Tables created by sql file (without prefix!) +$modversion['tables'][0] = "citas"; + +// Admin things +$modversion['hasAdmin'] = 1; +$modversion['adminindex'] = "admin/index.php"; +$modversion['adminmenu'] = "admin/menu.php"; + +// Blocks +$modversion['blocks'][1]['file'] = "random_quote.php"; +$modversion['blocks'][1]['name'] = _RQ_BNAME; +$modversion['blocks'][1]['description'] = _RQ_BDESC; +$modversion['blocks'][1]['show_func'] = "random_quote_show"; +$modversion['blocks'][1]['template'] = 'random_quote_block.html'; + +?> \ No newline at end of file Property changes on: XoopsModules/randomquote/trunk/randomquote/xoops_version.php ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |