From: <wis...@us...> - 2012-02-21 14:30:41
|
Revision: 9040 http://xoops.svn.sourceforge.net/xoops/?rev=9040&view=rev Author: wishcraft Date: 2012-02-21 14:30:29 +0000 (Tue, 21 Feb 2012) Log Message: ----------- samPHPweb - SAM 1.02 - See http://spacialaudio.com for SAM Broadcast the PC Component of this XOOPS Module Added Paths: ----------- XoopsModules/sam/ XoopsModules/sam/releases/ XoopsModules/sam/releases/1.02/ XoopsModules/sam/releases/1.02/modules/ XoopsModules/sam/releases/1.02/modules/sam/ XoopsModules/sam/releases/1.02/modules/sam/admin/ XoopsModules/sam/releases/1.02/modules/sam/admin/about.php XoopsModules/sam/releases/1.02/modules/sam/admin/header.php XoopsModules/sam/releases/1.02/modules/sam/admin/index.php XoopsModules/sam/releases/1.02/modules/sam/admin/menu.php XoopsModules/sam/releases/1.02/modules/sam/blocks/ XoopsModules/sam/releases/1.02/modules/sam/blocks/index.html XoopsModules/sam/releases/1.02/modules/sam/blocks/sam_block_partnerlinks.php XoopsModules/sam/releases/1.02/modules/sam/class/ XoopsModules/sam/releases/1.02/modules/sam/class/adz.php XoopsModules/sam/releases/1.02/modules/sam/class/category.php XoopsModules/sam/releases/1.02/modules/sam/class/categorylist.php XoopsModules/sam/releases/1.02/modules/sam/class/database/ XoopsModules/sam/releases/1.02/modules/sam/class/database/database.php XoopsModules/sam/releases/1.02/modules/sam/class/database/databasefactory.php XoopsModules/sam/releases/1.02/modules/sam/class/database/index.html XoopsModules/sam/releases/1.02/modules/sam/class/database/mysqldatabase.php XoopsModules/sam/releases/1.02/modules/sam/class/disk.php XoopsModules/sam/releases/1.02/modules/sam/class/event.php XoopsModules/sam/releases/1.02/modules/sam/class/eventtime.php XoopsModules/sam/releases/1.02/modules/sam/class/fixedlist.php XoopsModules/sam/releases/1.02/modules/sam/class/fixedlist_item.php XoopsModules/sam/releases/1.02/modules/sam/class/historylist.php XoopsModules/sam/releases/1.02/modules/sam/class/index.html XoopsModules/sam/releases/1.02/modules/sam/class/model/ XoopsModules/sam/releases/1.02/modules/sam/class/model/index.html XoopsModules/sam/releases/1.02/modules/sam/class/model/joint.php XoopsModules/sam/releases/1.02/modules/sam/class/model/read.php XoopsModules/sam/releases/1.02/modules/sam/class/model/sammodel.php XoopsModules/sam/releases/1.02/modules/sam/class/model/stats.php XoopsModules/sam/releases/1.02/modules/sam/class/model/sync.php XoopsModules/sam/releases/1.02/modules/sam/class/model/write.php XoopsModules/sam/releases/1.02/modules/sam/class/object.php XoopsModules/sam/releases/1.02/modules/sam/class/queuelist.php XoopsModules/sam/releases/1.02/modules/sam/class/requestlist.php XoopsModules/sam/releases/1.02/modules/sam/class/songlist.php XoopsModules/sam/releases/1.02/modules/sam/css/ XoopsModules/sam/releases/1.02/modules/sam/css/request.css XoopsModules/sam/releases/1.02/modules/sam/css/request.error.css XoopsModules/sam/releases/1.02/modules/sam/css/songinfo.css XoopsModules/sam/releases/1.02/modules/sam/css/style.css XoopsModules/sam/releases/1.02/modules/sam/docs/ XoopsModules/sam/releases/1.02/modules/sam/docs/changelog.txt XoopsModules/sam/releases/1.02/modules/sam/docs/credits.txt XoopsModules/sam/releases/1.02/modules/sam/docs/index.html XoopsModules/sam/releases/1.02/modules/sam/docs/install.txt XoopsModules/sam/releases/1.02/modules/sam/docs/lang_diff.txt XoopsModules/sam/releases/1.02/modules/sam/docs/licence.txt XoopsModules/sam/releases/1.02/modules/sam/docs/readme.txt XoopsModules/sam/releases/1.02/modules/sam/images/ XoopsModules/sam/releases/1.02/modules/sam/images/buy.png XoopsModules/sam/releases/1.02/modules/sam/images/home.png XoopsModules/sam/releases/1.02/modules/sam/images/index.html XoopsModules/sam/releases/1.02/modules/sam/images/info.png XoopsModules/sam/releases/1.02/modules/sam/images/logo.png XoopsModules/sam/releases/1.02/modules/sam/images/menu/ XoopsModules/sam/releases/1.02/modules/sam/images/menu/email.png XoopsModules/sam/releases/1.02/modules/sam/images/menu/play.png XoopsModules/sam/releases/1.02/modules/sam/images/menu/speaker.png XoopsModules/sam/releases/1.02/modules/sam/images/menu/tb-file-list.png XoopsModules/sam/releases/1.02/modules/sam/images/request.png XoopsModules/sam/releases/1.02/modules/sam/images/sam_slogo.png XoopsModules/sam/releases/1.02/modules/sam/include/ XoopsModules/sam/releases/1.02/modules/sam/include/code.playing.php XoopsModules/sam/releases/1.02/modules/sam/include/code.playlist.php XoopsModules/sam/releases/1.02/modules/sam/include/code.request.php XoopsModules/sam/releases/1.02/modules/sam/include/code.songcheck.php XoopsModules/sam/releases/1.02/modules/sam/include/code.songinfo.php XoopsModules/sam/releases/1.02/modules/sam/include/header.php XoopsModules/sam/releases/1.02/modules/sam/include/index.html XoopsModules/sam/releases/1.02/modules/sam/include/xml.php XoopsModules/sam/releases/1.02/modules/sam/index.php XoopsModules/sam/releases/1.02/modules/sam/js/ XoopsModules/sam/releases/1.02/modules/sam/js/common.js XoopsModules/sam/releases/1.02/modules/sam/js/jquery.corner.js XoopsModules/sam/releases/1.02/modules/sam/language/ XoopsModules/sam/releases/1.02/modules/sam/language/english/ XoopsModules/sam/releases/1.02/modules/sam/language/english/admin.php XoopsModules/sam/releases/1.02/modules/sam/language/english/blocks.php XoopsModules/sam/releases/1.02/modules/sam/language/english/help/ XoopsModules/sam/releases/1.02/modules/sam/language/english/help/help.html XoopsModules/sam/releases/1.02/modules/sam/language/english/help/index.html XoopsModules/sam/releases/1.02/modules/sam/language/english/main.php XoopsModules/sam/releases/1.02/modules/sam/language/english/modinfo.php XoopsModules/sam/releases/1.02/modules/sam/playing.php XoopsModules/sam/releases/1.02/modules/sam/playlist.php XoopsModules/sam/releases/1.02/modules/sam/request.php XoopsModules/sam/releases/1.02/modules/sam/songcheck.js.php XoopsModules/sam/releases/1.02/modules/sam/songinfo.php XoopsModules/sam/releases/1.02/modules/sam/sql/ XoopsModules/sam/releases/1.02/modules/sam/sql/index.html XoopsModules/sam/releases/1.02/modules/sam/templates/ XoopsModules/sam/releases/1.02/modules/sam/templates/blocks/ XoopsModules/sam/releases/1.02/modules/sam/templates/blocks/index.html XoopsModules/sam/releases/1.02/modules/sam/templates/blocks/sam_block_partnerlinks.html XoopsModules/sam/releases/1.02/modules/sam/templates/index.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_error.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_footer.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_header.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_playing.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_playlist.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_request.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_request_error.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_songcheck.html XoopsModules/sam/releases/1.02/modules/sam/templates/sam_songinfo.html XoopsModules/sam/releases/1.02/modules/sam/xoops_version.php XoopsModules/sam/releases/1.02/uploads/ XoopsModules/sam/releases/1.02/uploads/sam/ XoopsModules/sam/releases/1.02/uploads/sam/na.png XoopsModules/sam/trunk/ XoopsModules/sam/trunk/modules/ XoopsModules/sam/trunk/modules/sam/ XoopsModules/sam/trunk/modules/sam/admin/ XoopsModules/sam/trunk/modules/sam/admin/about.php XoopsModules/sam/trunk/modules/sam/admin/header.php XoopsModules/sam/trunk/modules/sam/admin/index.php XoopsModules/sam/trunk/modules/sam/admin/menu.php XoopsModules/sam/trunk/modules/sam/blocks/ XoopsModules/sam/trunk/modules/sam/blocks/index.html XoopsModules/sam/trunk/modules/sam/blocks/sam_block_partnerlinks.php XoopsModules/sam/trunk/modules/sam/class/ XoopsModules/sam/trunk/modules/sam/class/adz.php XoopsModules/sam/trunk/modules/sam/class/category.php XoopsModules/sam/trunk/modules/sam/class/categorylist.php XoopsModules/sam/trunk/modules/sam/class/database/ XoopsModules/sam/trunk/modules/sam/class/database/database.php XoopsModules/sam/trunk/modules/sam/class/database/databasefactory.php XoopsModules/sam/trunk/modules/sam/class/database/index.html XoopsModules/sam/trunk/modules/sam/class/database/mysqldatabase.php XoopsModules/sam/trunk/modules/sam/class/disk.php XoopsModules/sam/trunk/modules/sam/class/event.php XoopsModules/sam/trunk/modules/sam/class/eventtime.php XoopsModules/sam/trunk/modules/sam/class/fixedlist.php XoopsModules/sam/trunk/modules/sam/class/fixedlist_item.php XoopsModules/sam/trunk/modules/sam/class/historylist.php XoopsModules/sam/trunk/modules/sam/class/index.html XoopsModules/sam/trunk/modules/sam/class/model/ XoopsModules/sam/trunk/modules/sam/class/model/index.html XoopsModules/sam/trunk/modules/sam/class/model/joint.php XoopsModules/sam/trunk/modules/sam/class/model/read.php XoopsModules/sam/trunk/modules/sam/class/model/sammodel.php XoopsModules/sam/trunk/modules/sam/class/model/stats.php XoopsModules/sam/trunk/modules/sam/class/model/sync.php XoopsModules/sam/trunk/modules/sam/class/model/write.php XoopsModules/sam/trunk/modules/sam/class/object.php XoopsModules/sam/trunk/modules/sam/class/queuelist.php XoopsModules/sam/trunk/modules/sam/class/requestlist.php XoopsModules/sam/trunk/modules/sam/class/songlist.php XoopsModules/sam/trunk/modules/sam/css/ XoopsModules/sam/trunk/modules/sam/css/request.css XoopsModules/sam/trunk/modules/sam/css/request.error.css XoopsModules/sam/trunk/modules/sam/css/songinfo.css XoopsModules/sam/trunk/modules/sam/css/style.css XoopsModules/sam/trunk/modules/sam/docs/ XoopsModules/sam/trunk/modules/sam/docs/changelog.txt XoopsModules/sam/trunk/modules/sam/docs/credits.txt XoopsModules/sam/trunk/modules/sam/docs/index.html XoopsModules/sam/trunk/modules/sam/docs/install.txt XoopsModules/sam/trunk/modules/sam/docs/lang_diff.txt XoopsModules/sam/trunk/modules/sam/docs/licence.txt XoopsModules/sam/trunk/modules/sam/docs/readme.txt XoopsModules/sam/trunk/modules/sam/images/ XoopsModules/sam/trunk/modules/sam/images/buy.png XoopsModules/sam/trunk/modules/sam/images/home.png XoopsModules/sam/trunk/modules/sam/images/index.html XoopsModules/sam/trunk/modules/sam/images/info.png XoopsModules/sam/trunk/modules/sam/images/logo.png XoopsModules/sam/trunk/modules/sam/images/menu/ XoopsModules/sam/trunk/modules/sam/images/menu/email.png XoopsModules/sam/trunk/modules/sam/images/menu/play.png XoopsModules/sam/trunk/modules/sam/images/menu/speaker.png XoopsModules/sam/trunk/modules/sam/images/menu/tb-file-list.png XoopsModules/sam/trunk/modules/sam/images/request.png XoopsModules/sam/trunk/modules/sam/images/sam_slogo.png XoopsModules/sam/trunk/modules/sam/include/ XoopsModules/sam/trunk/modules/sam/include/code.playing.php XoopsModules/sam/trunk/modules/sam/include/code.playlist.php XoopsModules/sam/trunk/modules/sam/include/code.request.php XoopsModules/sam/trunk/modules/sam/include/code.songcheck.php XoopsModules/sam/trunk/modules/sam/include/code.songinfo.php XoopsModules/sam/trunk/modules/sam/include/header.php XoopsModules/sam/trunk/modules/sam/include/index.html XoopsModules/sam/trunk/modules/sam/include/xml.php XoopsModules/sam/trunk/modules/sam/index.php XoopsModules/sam/trunk/modules/sam/js/ XoopsModules/sam/trunk/modules/sam/js/common.js XoopsModules/sam/trunk/modules/sam/js/jquery.corner.js XoopsModules/sam/trunk/modules/sam/language/ XoopsModules/sam/trunk/modules/sam/language/english/ XoopsModules/sam/trunk/modules/sam/language/english/admin.php XoopsModules/sam/trunk/modules/sam/language/english/blocks.php XoopsModules/sam/trunk/modules/sam/language/english/help/ XoopsModules/sam/trunk/modules/sam/language/english/help/help.html XoopsModules/sam/trunk/modules/sam/language/english/help/index.html XoopsModules/sam/trunk/modules/sam/language/english/main.php XoopsModules/sam/trunk/modules/sam/language/english/modinfo.php XoopsModules/sam/trunk/modules/sam/playing.php XoopsModules/sam/trunk/modules/sam/playlist.php XoopsModules/sam/trunk/modules/sam/request.php XoopsModules/sam/trunk/modules/sam/songcheck.js.php XoopsModules/sam/trunk/modules/sam/songinfo.php XoopsModules/sam/trunk/modules/sam/sql/ XoopsModules/sam/trunk/modules/sam/sql/index.html XoopsModules/sam/trunk/modules/sam/templates/ XoopsModules/sam/trunk/modules/sam/templates/blocks/ XoopsModules/sam/trunk/modules/sam/templates/blocks/index.html XoopsModules/sam/trunk/modules/sam/templates/blocks/sam_block_partnerlinks.html XoopsModules/sam/trunk/modules/sam/templates/index.html XoopsModules/sam/trunk/modules/sam/templates/sam_error.html XoopsModules/sam/trunk/modules/sam/templates/sam_footer.html XoopsModules/sam/trunk/modules/sam/templates/sam_header.html XoopsModules/sam/trunk/modules/sam/templates/sam_playing.html XoopsModules/sam/trunk/modules/sam/templates/sam_playlist.html XoopsModules/sam/trunk/modules/sam/templates/sam_request.html XoopsModules/sam/trunk/modules/sam/templates/sam_request_error.html XoopsModules/sam/trunk/modules/sam/templates/sam_songcheck.html XoopsModules/sam/trunk/modules/sam/templates/sam_songinfo.html XoopsModules/sam/trunk/modules/sam/xoops_version.php XoopsModules/sam/trunk/uploads/ XoopsModules/sam/trunk/uploads/sam/ XoopsModules/sam/trunk/uploads/sam/na.png Added: XoopsModules/sam/releases/1.02/modules/sam/admin/about.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/admin/about.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/admin/about.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,76 @@ +<?php +// $Id: about.php 5204 2010-09-06 20:10:52Z mageg $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2000 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// 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 // +// ------------------------------------------------------------------------ // +// Author: XOOPS Foundation // +// URL: http://www.xoops.org/ // +// Project: The XOOPS Project // +// ------------------------------------------------------------------------- // + + include ('header.php'); + xoops_loadLanguage('admin', 'sam'); + + xoops_cp_header(); + + $aboutAdmin = new ModuleAdmin(); + echo $aboutAdmin->addNavigation('admin/about.php'); + + $paypalitemno='SAM175'; + $about = $aboutAdmin->renderabout($paypalitemno, false); + $donationform = array( 0 => '<form name="donation" id="donation" action="http://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', + 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">'.constant('_AM_SAM_ABOUT_MAKEDONATE').'</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="'._SUBMIT.'" title="'._SUBMIT.'" type="submit"></td></tr></tbody></table>', + 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', 'D'=>'', + 3 => '', + 4 => '<!-- Start Form Validation JavaScript //--> +<script type="text/javascript"> +<!--// +function xoopsFormValidate_donation() { var myform = window.document.donation; +var hasSelected = false; var selectBox = myform.item[A][amount];for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true && selectBox.options[i].value != \'\') { hasSelected = true; break; } }if (!hasSelected) { window.alert("Please enter Donation Amount"); selectBox.focus(); return false; }return true; +} +//--></script> +<!-- End Form Validation JavaScript //-->'); + $paypalform = array( 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', + 1 => '<input name="cmd" value="_s-xclick" type="hidden">', + 2 => '<input name="hosted_button_id" value="%s" type="hidden">', + 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', + 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', + 5 => '</form>'); + for($key=0;$key<=4;$key++) { + switch ($key) { + case 2: + $donationform[$key] = sprintf($donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (strlen($GLOBALS['xoopsUser']->getVar('name'))>0?$GLOBALS['xoopsUser']->getVar('name'). ' ['.$GLOBALS['xoopsUser']->getVar('uname').']':$GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), XOOPS_LICENSE_KEY, strtoupper($GLOBALS['samModule']->getVar('dirname')), strtoupper($GLOBALS['samModule']->getVar('dirname')). ' '.$GLOBALS['samModule']->getVar('name')); + break; + } + } + + $istart = strpos($about, ($paypalform[0]), 1); + $iend = strpos($about, ($paypalform[5]), $istart+1)+strlen($paypalform[5])-1; + echo (substr($about, 0, $istart-1)); + echo implode("\n", $donationform); + echo (substr($about, $iend+1, strlen($about)-$iend-1)); + + xoops_cp_footer(); + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/admin/header.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/admin/header.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/admin/header.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,54 @@ +<?php + + require_once (dirname(dirname(dirname(dirname(__FILE__)))).'/include/cp_header.php'); + + if (!defined('_CHARSET')) + define ("_CHARSET","UTF-8"); + if (!defined('_CHARSET_ISO')) + define ("_CHARSET_ISO","ISO-8859-1"); + + $GLOBALS['myts'] = MyTextSanitizer::getInstance(); + + $module_handler = xoops_gethandler('module'); + $config_handler = xoops_gethandler('config'); + $GLOBALS['samModule'] = $module_handler->getByDirname('sam'); + $GLOBALS['samModuleConfig'] = $config_handler->getConfigList($GLOBALS['samModule']->getVar('mid')); + + xoops_load('pagenav'); + xoops_load('xoopslists'); + xoops_load('xoopsformloader'); + + include_once $GLOBALS['xoops']->path('class'.DS.'xoopsmailer.php'); + include_once $GLOBALS['xoops']->path('class'.DS.'xoopstree.php'); + + if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); + }else{ + echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks"); + } + + $GLOBALS['samImageIcon'] = XOOPS_URL .'/'. $GLOBALS['samModule']->getInfo('icons16'); + $GLOBALS['samImageAdmin'] = XOOPS_URL .'/'. $GLOBALS['samModule']->getInfo('icons32'); + + if ($GLOBALS['xoopsUser']) { + $moduleperm_handler =& xoops_gethandler('groupperm'); + if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['samModule']->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups())) { + redirect_header(XOOPS_URL, 1, _NOPERM); + exit(); + } + } else { + redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM); + exit(); + } + + if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { + include_once(XOOPS_ROOT_PATH."/class/template.php"); + $GLOBALS['xoopsTpl'] = new XoopsTpl(); + } + + $GLOBALS['xoopsTpl']->assign('pathImageIcon', $GLOBALS['samImageIcon']); + $GLOBALS['xoopsTpl']->assign('pathImageAdmin', $GLOBALS['samImageAdmin']); + + error_reporting(E_ALL); + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/admin/index.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/admin/index.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/admin/index.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,70 @@ +<?php +// $Id: directory.php 5204 2010-09-06 20:10:52Z mageg $ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2000 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// 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 // +// ------------------------------------------------------------------------ // +// Author: XOOPS Foundation // +// URL: http://www.xoops.org/ // +// Project: The XOOPS Project // +// ------------------------------------------------------------------------- // + + include ('header.php'); + xoops_loadLanguage('admin', 'sam'); + + xoops_cp_header(); + + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('admin/index.php'); + + $indexAdmin = new ModuleAdmin(); + + if (empty($GLOBALS['samModuleConfig']['db_type'])||empty($GLOBALS['samModuleConfig']['db_host'])||empty($GLOBALS['samModuleConfig']['db_name'])||empty($GLOBALS['samModuleConfig']['db_user'])||empty($GLOBALS['samModuleConfig']['db_pass'])||empty($GLOBALS['samModuleConfig']['db_charset'])||empty($GLOBALS['samModuleConfig']['sam_host'])||empty($GLOBALS['samModuleConfig']['sam_port'])) { + $indexAdmin->addInfoBox(_AM_SAM_PREF_NEEDTOBESET); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_TYPE."</label>", empty($GLOBALS['samModuleConfig']['db_type'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_type'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_HOST."</label>", empty($GLOBALS['samModuleConfig']['db_host'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_host'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_NAME."</label>", empty($GLOBALS['samModuleConfig']['db_name'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_name'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_USER."</label>", empty($GLOBALS['samModuleConfig']['db_user'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_user'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_PASS."</label>", empty($GLOBALS['samModuleConfig']['db_pass'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_pass'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_DB_CHARSET."</label>", empty($GLOBALS['samModuleConfig']['db_charset'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['db_charset'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_SAM_HOST."</label>", empty($GLOBALS['samModuleConfig']['sam_host'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['sam_host'])?'Red':'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_PREF_NEEDTOBESET, "<label>"._AM_SAM_PREF_SAM_PORT."</label>", empty($GLOBALS['samModuleConfig']['sam_port'])?_NO:_YES, empty($GLOBALS['samModuleConfig']['sam_port'])?'Red':'Green'); + } else { + $songlist_handler = xoops_getmodulehandler('songlist', 'sam'); + $requestlist_handler = xoops_getmodulehandler('requestlist', 'sam'); + $indexAdmin->addInfoBox(_AM_SAM_COUNTS); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_SONGS."</label>", $songlist_handler->getCount(NULL), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_BROADCAST_SONGS."</label>", $songlist_handler->getCount(new Criteria('`songrights`', 'broadcast')), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_DOWNLOAD_SONGS."</label>", $songlist_handler->getCount(new Criteria('`songrights`', 'download')), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_ONDEMAND_SONGS."</label>", $songlist_handler->getCount(new Criteria('`songrights`', 'on-demand')), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_ROAYALTYFREE_SONGS."</label>", $songlist_handler->getCount(new Criteria('`songrights`', 'royaltyfree')), 'Green'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_REQUESTS."</label>", $requestlist_handler->getCount(NULL), 'Orange'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_NEW_REQUESTS."</label>", $requestlist_handler->getCount(new Criteria('`status`', 'new')), 'Orange'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_PENDING_REQUESTS."</label>", $requestlist_handler->getCount(new Criteria('`status`', 'pending')), 'Orange'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_IGNORED_REQUESTS."</label>", $requestlist_handler->getCount(new Criteria('`status`', 'ignored')), 'Orange'); + $indexAdmin->addInfoBoxLine(_AM_SAM_COUNTS, "<label>"._AM_SAM_THEREARE_PLAYED_REQUESTS."</label>", $requestlist_handler->getCount(new Criteria('`status`', 'played')), 'Orange'); + } + echo $indexAdmin->renderIndex(); + xoops_cp_footer(); + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/admin/menu.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/admin/menu.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/admin/menu.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,32 @@ +<?php +/** + * Extended User Profile + * + * 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 XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package profile + * @since 2.3.0 + * @author Jan Pedersen + * @author Taiwen Jiang <ph...@us...> + * @version $Id: menu.php 2021 2008-08-31 02:02:45Z phppp $ + */ +$module_handler = xoops_gethandler('module'); +$GLOBALS['profileModule'] = $module_handler->getByDirname('sam'); +$adminmenu = array(); +$adminmenu[0]['title'] = _MI_SAM_DASHBOARD; +$adminmenu[0]['icon'] = '../../'.$GLOBALS['profileModule']->getInfo('icons32').'/about.png'; +$adminmenu[0]['image'] = '../../'.$GLOBALS['profileModule']->getInfo('icons32').'/about.png'; +$adminmenu[0]['link'] = "admin/index.php"; +$adminmenu[1]['title'] = _MI_SAM_ABOUT; +$adminmenu[1]['icon'] = '../../'.$GLOBALS['profileModule']->getInfo('icons32').'/about.png'; +$adminmenu[1]['image'] = '../../'.$GLOBALS['profileModule']->getInfo('icons32').'/about.png'; +$adminmenu[1]['link'] = "admin/about.php"; + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/blocks/index.html =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/blocks/index.html (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/blocks/index.html 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/blocks/sam_block_partnerlinks.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/blocks/sam_block_partnerlinks.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/blocks/sam_block_partnerlinks.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,34 @@ +<?php + + +function b_sam_block_partnerlinks_show( $options ) +{ + xoops_loadLanguage('blocks', 'sam'); + xoops_loadLanguage('modinfo', 'sam'); + + $config_handler = xoops_gethandler('config'); + $module_handler = xoops_gethandler('module'); + $GLOBALS['samModule'] = $module_handler->getByDirname('sam'); + $GLOBALS['samModuleConfig'] = $config_handler->getConfigList($_Mod->getVar('mid')); + + $block = array(); + $block = $GLOBALS['samModuleConfig']; + $block['username'] = $options[0]; + + $GLOBALS['xoTheme']->addScript(sprintf(_BL_SAM_ADDTHIS_JAVASCRIPT, $options[0]), array('type'=>'text/javascript')); + + return $block; +} + + +function b_sam_block_partnerlinks_edit( $options ) +{ + xoops_load('XoopsFormLoader'); + xoops_loadLanguage('blocks', 'uitabs'); + + $username = new XoopsFormText('', 'options[0]', 25, 40, $options[0]); + + $form = _BL_SAM_ADDTHIS_USERNAME.$username->render()."<br/>"; + return $form ; +} +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/adz.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/adz.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/adz.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,83 @@ +<?php +// $Autho: wishcraft $ + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} + +include_once dirname(__FILE__).'/object.php'; +/** + * Class for compunds + * @author Simon Roberts <si...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class SamAdz extends SamObject +{ + + function SamAdz($id = null) + { + $this->initVar('ID', XOBJ_DTYPE_INT, null, false); + $this->initVar('PROVIDERID', XOBJ_DTYPE_INT, null, false); + $this->initVar('CAMPAIGNID', XOBJ_DTYPE_INT, null, false); + $this->initVar('CATEGORYID', XOBJ_DTYPE_INT, null, false); + $this->initVar('DATE_START', XOBJ_DTYPE_TXTBOX, null, false, 10); + $this->initVar('DATE_END', XOBJ_DTYPE_TXTBOX, null, false, 10); + $this->initVar('SONGTYPE', XOBJ_DTYPE_TXTBOX, "A", false, 1); + $this->initVar('LOCALFILENAME', XOBJ_DTYPE_TXTBOX, null, false, 200); + $this->initVar('LOCALSTATUS', XOBJ_DTYPE_TXTBOX, 'download', false, 10); + $this->initVar('DOWNLOAD_URL', XOBJ_DTYPE_TXTBOX, null, false, 200); + $this->initVar('LASTUPDATE', XOBJ_DTYPE_TXTBOX, null, false, 19); + $this->initVar('DESCRIPTION', XOBJ_DTYPE_TXTBOX, null, false, 100); + $this->initVar('DATE_END', XOBJ_DTYPE_TXTBOX, null, false, 10); + $this->initVar('CAMPAIGNACTIVE', XOBJ_DTYPE_TXTBOX, 'yes', false, 3); + $this->initVar('STATUS', XOBJ_DTYPE_TXTBOX, 'active', false, 10); + $this->initVar('WEIGHT', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('GLOBALWEIGHT', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('DURATION', XOBJ_DTYPE_INT, null, false); + $this->initVar('FILESIZE', XOBJ_DTYPE_INT, null, false); + $this->initVar('DATE_PLAYED', XOBJ_DTYPE_TXTBOX, null, false, 19); + $this->initVar('DATE_CATEGORY_PLAYED', XOBJ_DTYPE_TXTBOX, null, false, 19); + $this->initVar('DATE_CAMPAIGN_PLAYED', XOBJ_DTYPE_TXTBOX, null, false, 19); + $this->initVar('DATE_VALID', XOBJ_DTYPE_TXTBOX, null, false, 19); + $this->initVar('SPINS', XOBJ_DTYPE_INT, null, false); + $this->initVar('PERFORMANCES', XOBJ_DTYPE_INT, null, false); + $this->initVar('SPINS_MAX', XOBJ_DTYPE_INT, null, false); + $this->initVar('cap_day', XOBJ_DTYPE_INT, null, false); + $this->initVar('cap_day_cnt', XOBJ_DTYPE_INT, null, false); + $this->initVar('DAYS', XOBJ_DTYPE_TXTBOX, null, false, 100); + $this->initVar('HOURS', XOBJ_DTYPE_TXTBOX, null, false, 100); + $this->initVar('BLOCKED', XOBJ_DTYPE_TXTBOX, null, false, 3); + $this->initVar('LOCALWEIGHT', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('LOCALBALANCE', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('SORTID', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('EXTERNALID', XOBJ_DTYPE_INT, null, false); + $this->initVar('SYNCINFO', XOBJ_DTYPE_TXTBOX, null, false, 200); + $this->initVar('PROGRESS', XOBJ_DTYPE_DECIMAL, null, false); + $this->initVar('timematrix', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('min_separation', XOBJ_DTYPE_INT, null, false); + $this->initVar('min_separation_campaign', XOBJ_DTYPE_INT, null, false); + + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class SamAdzHandler extends SamPersistableObjectHandler +{ + function __construct(&$db) + { + $this->db = $db =& SamDatabaseFactory::getDatabaseConnection(); + parent::__construct($db, "adz", 'SamAdz', "ID", "PROVIDERID"); + } +} + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/category.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/category.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/category.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,48 @@ +<?php +// $Autho: wishcraft $ + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} + +include_once dirname(__FILE__).'/object.php'; +/** + * Class for compunds + * @author Simon Roberts <si...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class SamCategory extends SamObject +{ + + function SamCategory($id = null) + { + $this->initVar('ID', XOBJ_DTYPE_INT, null, false); + $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, false, 100); + $this->initVar('parentID', XOBJ_DTYPE_INT, null, false); + $this->initVar('levelindex', XOBJ_DTYPE_INT, null, false); + $this->initVar('itemindex', XOBJ_DTYPE_INT, null, false); + + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class SamCategoryHandler extends SamPersistableObjectHandler +{ + function __construct(&$db) + { + $this->db = $db =& SamDatabaseFactory::getDatabaseConnection(); + parent::__construct($db, "category", 'SamCategory', "ID", "name"); + } +} + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/categorylist.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/categorylist.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/categorylist.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,47 @@ +<?php +// $Autho: wishcraft $ + +if (!defined('XOOPS_ROOT_PATH')) { + exit(); +} + +include_once dirname(__FILE__).'/object.php'; +/** + * Class for compunds + * @author Simon Roberts <si...@xo...> + * @copyright copyright (c) 2009-2003 XOOPS.org + * @package kernel + */ +class SamCategorylist extends SamObject +{ + + function SamCategorylist($id = null) + { + $this->initVar('ID', XOBJ_DTYPE_INT, null, false); + $this->initVar('songID', XOBJ_DTYPE_INT, null, false); + $this->initVar('categoryID', XOBJ_DTYPE_INT, null, false); + $this->initVar('sortID', XOBJ_DTYPE_DECIMAL, null, false); + + } + +} + + +/** +* XOOPS policies handler class. +* This class is responsible for providing data access mechanisms to the data source +* of XOOPS user class objects. +* +* @author Simon Roberts <si...@ch...> +* @package kernel +*/ +class SamCategorylistHandler extends SamPersistableObjectHandler +{ + function __construct(&$db) + { + $this->db = $db =& SamDatabaseFactory::getDatabaseConnection(); + parent::__construct($db, "categorylist", 'SamCategorylist', "ID", "sortID"); + } +} + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/database/database.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/database/database.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/database/database.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,114 @@ +<?php +/** + * Abstract base class for XOOPS Database access classes + * + * 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 XOOPS project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage database + * @since 1.0.0 + * @author Kazumi Ono <on...@xo...> + * @version $Id: database.php 8066 2011-11-06 05:09:33Z beckmi $ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * make sure this is only included once! + */ +if (defined('SAM_C_DATABASE_INCLUDED')) { + return; +} + +define('SAM_C_DATABASE_INCLUDED', 1); + +/** + * Abstract base class for Database access classes + * + * @abstract + * @author Kazumi Ono <on...@xo...> + * @package kernel + * @subpackage database + */ +class SamDatabase +{ + /** + * Prefix for tables in the database + * + * @var string + */ + var $prefix = ''; + + /** + * reference to a {@link SamLogger} object + * + * @see SamLogger + * @var object SamLogger + */ + var $logger; + + /** + * If statements that modify the database are selected + * + * @var boolean + */ + var $allowWebChanges = false; + + /** + * constructor + * + * will always fail, because this is an abstract class! + */ + function SamDatabase() + { + // exit('Cannot instantiate this class directly'); + } + + /** + * assign a {@link SamLogger} object to the database + * + * @see SamLogger + * @param object $logger reference to a {@link SamLogger} object + */ + + function setLogger(&$logger) + { + $this->logger = &$logger; + } + + /** + * set the prefix for tables in the database + * + * @param string $value table prefix + */ + function setPrefix($value) + { + $this->prefix = $value; + } + + /** + * attach the prefix.'_' to a given tablename + * + * if tablename is empty, only prefix will be returned + * + * @param string $tablename tablename + * @return string prefixed tablename, just prefix if tablename is empty + */ + function prefix($tablename = '') + { + if ($tablename != '') { + return $this->prefix . '_' . $tablename; + } else { + return $this->prefix; + } + } +} + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/database/databasefactory.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/database/databasefactory.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/database/databasefactory.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,108 @@ +<?php +/** + * Factory Class for XOOPS Database + * + * 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 XOOPS project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage database + * @version $Id: databasefactory.php 8066 2011-11-06 05:09:33Z beckmi $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * SamDatabaseFactory + * + * @package Kernel + * @author Kazumi Ono <on...@xo...> + * @access public + */ +class SamDatabaseFactory +{ + /** + * SamDatabaseFactory::SamDatabaseFactory() + */ + function SamDatabaseFactory() + { + if (!isset($GLOBALS['samModuleConfig'])||!is_array($GLOBALS['samModuleConfig'])) { + $config_handler = xoops_gethandler('config'); + $module_handler = xoops_gethandler('module'); + $GLOBALS['samModule'] = $module_handler->getDirname('sam'); + $GLOBALS['samModuleConfig'] = $config_handler->getConfigList($GLOBALS['samModule']->getVar('mid')); + } + } + + /** + * Get a reference to the only instance of database class and connects to DB + * + * if the class has not been instantiated yet, this will also take + * care of that + * + * @static + * @staticvar object The only instance of database class + * @return object Reference to the only instance of database class + */ + function &getDatabaseConnection() + { + + static $instance; + if (!isset($instance)) { + if (file_exists($file = XOOPS_ROOT_PATH . '/modules/sam/class/database/' . $GLOBALS['samModuleConfig']['db_type'] . 'database.php')) { + require_once $file; + if (!$GLOBALS['samModuleConfig']['db_proxy']) { + $class = 'Sam' . ucfirst($GLOBALS['samModuleConfig']['db_type']) . 'DatabaseSafe'; + } else { + $class = 'Sam' . ucfirst($GLOBALS['samModuleConfig']['db_type']) . 'DatabaseProxy'; + } + $xoopsPreload =& XoopsPreload::getInstance(); + $xoopsPreload->triggerEvent('sam.class.database.databasefactory.connection', array(&$class)); + $instance = new $class(); + $instance->setLogger(XoopsLogger::getInstance()); + $instance->setPrefix($GLOBALS['samModuleConfig']['db_prefix']); + if (!$instance->connect()) { + trigger_error('notrace:Unable to connect to SAM database, please check database settings for the SAM Module in the module preferences!', E_USER_ERROR); + } + } else { + trigger_error('notrace:Failed to load database of type: ' . $GLOBALS['samModuleConfig']['db_type'] . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); + } + } + return $instance; + } + + /** + * Gets a reference to the only instance of database class. Currently + * only being used within the installer. + * + * @static + * @staticvar object The only instance of database class + * @return object Reference to the only instance of database class + */ + function &getDatabase() + { + static $database; + if (!isset($database)) { + if (file_exists($file = XOOPS_ROOT_PATH . '/modules/sam/class/database/' . $GLOBALS['samModuleConfig']['db_type'] . 'database.php')) { + include_once $file; + if (!$GLOBALS['samModuleConfig']['db_proxy']) { + $class = 'Sam' . ucfirst($GLOBALS['samModuleConfig']['db_type']) . 'DatabaseSafe'; + } else { + $class = 'Sam' . ucfirst($GLOBALS['samModuleConfig']['db_type']) . 'DatabaseProxy'; + } + unset($database); + $database = new $class(); + } else { + trigger_error('notrace:Failed to load database of type: ' . $GLOBALS['samModuleConfig']['db_type'] . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING); + } + } + return $database; + } +} + +?> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/database/index.html =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/database/index.html (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/database/index.html 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/sam/releases/1.02/modules/sam/class/database/mysqldatabase.php =================================================================== --- XoopsModules/sam/releases/1.02/modules/sam/class/database/mysqldatabase.php (rev 0) +++ XoopsModules/sam/releases/1.02/modules/sam/class/database/mysqldatabase.php 2012-02-21 14:30:29 UTC (rev 9040) @@ -0,0 +1,404 @@ +<?php +/** + * MySQL access + * + * 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 XOOPS project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package kernel + * @subpackage database + * @since 1.0.0 + * @author Kazumi Ono <on...@xo...> + * @version $Id: mysqldatabase.php 8066 2011-11-06 05:09:33Z beckmi $ + */ +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * @package kernel + * @subpackage database + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + */ + +/** + * base class + */ +include_once XOOPS_ROOT_PATH . '/modules/sam/class/database/database.php'; +// xoops_load( 'xoopsdatabase' ); +/** + * connection to a mysql database + * + * @abstract + * @author Kazumi Ono <on...@xo...> + * @copyright copyright (c) 2000-2003 XOOPS.org + * @package kernel + * @subpackage database + */ +class SamMySQLDatabase extends SamDatabase +{ + /** + * Database connection + * + * @var resource + */ + var $conn; + + /** + * connect to the database + * + * @param bool $selectdb select the database now? + * @return bool successful? + */ + function connect($selectdb = true) + { + static $db_charset_set; + + if (!extension_loaded('mysql')) { + trigger_error('notrace:mysql extension not loaded', E_USER_ERROR); + return false; + } + + $this->allowWebChanges = ($_SERVER['REQUEST_METHOD'] != 'GET'); + if (XOOPS_DB_PCONNECT == 1) { + $this->conn = @mysql_pconnect($GLOBALS['samModuleConfig']['db_host'], $GLOBALS['samModuleConfig']['db_user'], $GLOBALS['samModuleConfig']['db_pass']); + } else { + $this->conn = @mysql_connect($GLOBALS['samModuleConfig']['db_host'], $GLOBALS['samModuleConfig']['db_user'], $GLOBALS['samModuleConfig']['db_pass']); + } + + if (!$this->conn) { + $this->logger->addQuery('', $this->error(), $this->errno()); + return false; + } + if ($selectdb != false) { + if (!mysql_select_db($GLOBALS['samModuleConfig']['db_name'])) { + $this->logger->addQuery('', $this->error(), $this->errno()); + return false; + } + } + if (!isset($db_charset_set) && defined('XOOPS_DB_CHARSET') && XOOPS_DB_CHARSET) { + $this->queryF("SET NAMES '" . $GLOBALS['samModuleConfig']['db_charset'] . "'"); + } + $db_charset_set = 1; + $this->queryF("SET SQL_BIG_SELECTS = 1"); + return true; + } + + /** + * generate an ID for a new row + * + * This is for compatibility only. Will always return 0, because MySQL supports + * autoincrement for primary keys. + * + * @param string $sequence name of the sequence from which to get the next ID + * @return int always 0, because mysql has support for autoincrement + */ + function genId($sequence) + { + return 0; // will use auto_increment + } + + /** + * Get a result row as an enumerated array + * + * @param resource $result + * @return array + */ + function fetchRow($result) + { + return @mysql_fetch_row($result); + } + + /** + * Fetch a result row as an associative array + * + * @return array + */ + function fetchArray($result) + { + return @mysql_fetch_assoc($result); + } + + /** + * Fetch a result row as an associative array + * + * @return array + */ + function fetchBoth($result) + { + return @mysql_fetch_array($result, MYSQL_BOTH); + } + + /** + * SamMySQLDatabase::fetchObjected() + * + * @param mixed $result + * @return + */ + function fetchObject($result) + { + return @mysql_fetch_object($result); + } + + /** + * Get the ID generated from the previous INSERT operation + * + * @return int + */ + function getInsertId() + { + return mysql_insert_id($this->conn); + } + + /** + * Get number of rows in result + * + * @param resource $ query result + * @return int + */ + function getRowsNum($result) + { + return @mysql_num_rows($result); + } + + /** + * Get number of affected rows + * + * @return int + */ + function getAffectedRows() + { + return mysql_affected_rows($this->conn); + } + + /** + * Close MySQL connection + */ + function close() + { + mysql_close($this->conn); + } + + /** + * will free all memory associated with the result identifier result. + * + * @param resource $ query result + * @return bool TRUE on success or FALSE on failure. + */ + function freeRecordSet($result) + { + return mysql_free_result($result); + } + + /** + * Returns the text of the error message from previous MySQL operation + * + * @return bool Returns the error text from the last MySQL function, or '' (the empty string) if no error occurred. + */ + function error() + { + return @mysql_error(); + } + + /** + * Returns the numerical value of the error message from previous MySQL operation + * + * @return int Returns the error number from the last MySQL function, or 0 (zero) if no error occurred. + */ + function errno() + { + return @mysql_errno(); + } + + /** + * Returns escaped string text with single quotes around it to be safely stored in database + * + * @param string $str unescaped string text + * @return string escaped string text with single quotes around + */ + function quoteString($str) + { + return $this->quote($str); + } + + /** + * Quotes a string for use in a query. + */ + function quote($string) + { + return "'" . str_replace("\\\"", '"', str_replace("\\"", '"', mysql_real_escape_string($string, $this->conn))) . "'"; + } + + /** + * perform a query on the database + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @return resource query result or FALSE if successful + * or TRUE if successful and no result + */ + function queryF($sql, $limit = 0, $start = 0) + { + if (!empty($limit)) { + if (empty($start)) { + $start = 0; + } + $sql = $sql . ' LIMIT ' . (int) $start . ', ' . (int) $limit; + } + $this->logger->startTime('query_time'); + $result = mysql_query($sql, $this->conn); + $this->logger->stopTime('query_time'); + $query_time = $this->logger->dumpTime('query_time', true); + if ($result) { + $this->logger->addQuery($sql, null, null, $query_time); + return $result; + } else { + $this->logger->addQuery($sql, $this->error(), $this->errno(), $query_time); + return false; + } + } + + /** + * perform a query + * + * This method is empty and does nothing! It should therefore only be + * used if nothing is exactly what you want done! ;-) + * + * @param string $sql a valid MySQL query + * @param int $limit number of records to return + * @param int $start offset of first record to return + * @abstract + */ + function query($sql, $limit = 0, $start = 0) + { + } + + /** + * perform queries from SQL dump file in a batch + * + * @param string $file file path to an SQL dump file + * @return bool FALSE if failed reading SQL file or TRUE if the file has been read and queries executed + */ + function queryFromFile($file) + { + if (false !== ($fp = fopen($file, 'r'))) { + include_once XOOPS_ROOT_PATH . '/class/database/sqlutility.php'; + $sql_queries = trim(fread($fp, filesize($file))); + SqlUtility::splitMySqlFile($pieces, $sql_queries); + foreach ($pieces as $query) { + // [0] contains the prefixed query + // [4] contains unprefixed table name + $prefixed_query = SqlUtility::prefixQuery(trim($query), $this->prefix()); + if ($prefixed_query != false) { + $this->query($prefixed_query[0]); + } + } + return true; + } + return false; + } + + /** + * Get field name + * + * @param resource $result query result + * @param int $ numerical field index + * @return string + */ + function getFieldName($result, $offset) + { + return mysql_field_name($result, $offset); + } + + /** + * Get field type + * + * @param resource $result query result + * @param int $offset numerical field index + * @return string + */ +... [truncated message content] |