From: <be...@us...> - 2012-07-31 12:33:00
|
Revision: 9959 http://xoops.svn.sourceforge.net/xoops/?rev=9959&view=rev Author: beckmi Date: 2012-07-31 12:32:51 +0000 (Tue, 31 Jul 2012) Log Message: ----------- Adding MyPoints (by Trabis) Added Paths: ----------- XoopsModules/mypoints/ XoopsModules/mypoints/branches/ XoopsModules/mypoints/releases/ XoopsModules/mypoints/trunk/ XoopsModules/mypoints/trunk/mypoints/ XoopsModules/mypoints/trunk/mypoints/admin/ XoopsModules/mypoints/trunk/mypoints/admin/about.php XoopsModules/mypoints/trunk/mypoints/admin/functions.php XoopsModules/mypoints/trunk/mypoints/admin/header.php XoopsModules/mypoints/trunk/mypoints/admin/index.php XoopsModules/mypoints/trunk/mypoints/admin/menu.php XoopsModules/mypoints/trunk/mypoints/changelog.txt XoopsModules/mypoints/trunk/mypoints/class/ XoopsModules/mypoints/trunk/mypoints/class/about.php XoopsModules/mypoints/trunk/mypoints/class/index.html XoopsModules/mypoints/trunk/mypoints/class/plugin.php XoopsModules/mypoints/trunk/mypoints/class/relation.php XoopsModules/mypoints/trunk/mypoints/class/user.php XoopsModules/mypoints/trunk/mypoints/images/ XoopsModules/mypoints/trunk/mypoints/images/bg.png XoopsModules/mypoints/trunk/mypoints/images/left_both.png XoopsModules/mypoints/trunk/mypoints/images/right_both.png XoopsModules/mypoints/trunk/mypoints/images/slogo.png XoopsModules/mypoints/trunk/mypoints/images/xuupslogo.png XoopsModules/mypoints/trunk/mypoints/include/ XoopsModules/mypoints/trunk/mypoints/include/functions.php XoopsModules/mypoints/trunk/mypoints/include/index.html XoopsModules/mypoints/trunk/mypoints/index.php XoopsModules/mypoints/trunk/mypoints/language/ XoopsModules/mypoints/trunk/mypoints/language/english/ XoopsModules/mypoints/trunk/mypoints/language/english/about.php XoopsModules/mypoints/trunk/mypoints/language/english/admin.php XoopsModules/mypoints/trunk/mypoints/language/english/blocks.php XoopsModules/mypoints/trunk/mypoints/language/english/index.html XoopsModules/mypoints/trunk/mypoints/language/english/main.php XoopsModules/mypoints/trunk/mypoints/language/english/modinfo.php XoopsModules/mypoints/trunk/mypoints/language/index.html XoopsModules/mypoints/trunk/mypoints/mypoints.php XoopsModules/mypoints/trunk/mypoints/plugins/ XoopsModules/mypoints/trunk/mypoints/plugins/arms.php XoopsModules/mypoints/trunk/mypoints/plugins/forum.php XoopsModules/mypoints/trunk/mypoints/plugins/index.html XoopsModules/mypoints/trunk/mypoints/plugins/myalbum.php XoopsModules/mypoints/trunk/mypoints/plugins/mydownloads.php XoopsModules/mypoints/trunk/mypoints/plugins/mylinks.php XoopsModules/mypoints/trunk/mypoints/plugins/newbb.php XoopsModules/mypoints/trunk/mypoints/plugins/news.php XoopsModules/mypoints/trunk/mypoints/plugins/publisher.php XoopsModules/mypoints/trunk/mypoints/plugins/system.php XoopsModules/mypoints/trunk/mypoints/plugins/tutorials.php XoopsModules/mypoints/trunk/mypoints/plugins/webshow.php XoopsModules/mypoints/trunk/mypoints/plugins/wfsections.php XoopsModules/mypoints/trunk/mypoints/plugins/xoopstube.php XoopsModules/mypoints/trunk/mypoints/readme.txt XoopsModules/mypoints/trunk/mypoints/sql/ XoopsModules/mypoints/trunk/mypoints/sql/index.html XoopsModules/mypoints/trunk/mypoints/sql/mysql.sql XoopsModules/mypoints/trunk/mypoints/templates/ XoopsModules/mypoints/trunk/mypoints/templates/index.html XoopsModules/mypoints/trunk/mypoints/templates/mypoints_about.html XoopsModules/mypoints/trunk/mypoints/templates/mypoints_mypoints.html XoopsModules/mypoints/trunk/mypoints/templates/mypoints_showall.html XoopsModules/mypoints/trunk/mypoints/xoops_version.php Added: XoopsModules/mypoints/trunk/mypoints/admin/about.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/admin/about.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/admin/about.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,30 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mypoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: about.php 0 2009-11-14 18:47:04Z trabis $ + */ + +include_once dirname(__FILE__) . '/header.php'; + +include_once dirname(dirname(__FILE__)) . '/class/about.php'; +xoops_cp_header(); +mypoints_adminmenu(2); +$aboutObj = new MypointsAbout(); +$aboutObj->render(); +xoops_cp_footer(); + +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/admin/functions.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/admin/functions.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/admin/functions.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mytabs + * @since 1.0 + * @author trabis <lus...@gm...> + .* @author InstantZero http://xoops.instant-zero.com + * @version $Id: functions.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +function mypoints_adminmenu($currentoption = 0, $breadcrumb = '') +{ + /* Nice buttons styles */ + echo " + <style type='text/css'> + #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; } + #buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/mypoints/images/bg.png') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px; } + #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; } + #buttonbar li { display:inline; margin:0; padding:0; } + #buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/mypoints/images/left_both.png') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; } + #buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/mypoints/images/right_both.png') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; } + /* Commented Backslash Hack hides rule from IE5-Mac \*/ + #buttonbar a span {float:none;} + /* End IE5-Mac hack */ + #buttonbar a:hover span { color:#333; } + #buttonbar #current a { background-position:0 -150px; border-width:0; } + #buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; } + #buttonbar a:hover { background-position:0% -150px; } + #buttonbar a:hover span { background-position:100% -150px; } + </style> + "; + global $xoopsModule, $xoopsConfig; + + $tblColors = array('', '', ''); + if ($currentoption >= 0) { + $tblColors[$currentoption] = 'current'; + } + + xoops_loadLanguage('modinfo', 'mypoints'); + + echo "<div id='buttontop'>"; + echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\"><tr>"; + echo "<td style=\"width: 60%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\"><a class=\"nobutton\" href=\"../../system/admin.php?fct=preferences&op=showmod&mod=" . $xoopsModule->getVar('mid') . "\">" . _AM_MYPOINTS_GENERALSET . "</a>"; + echo " | <a href=\"../index.php\">" . _AM_MYPOINTS_GOTOMOD . "</a></td>"; + echo "<td style=\"width: 40%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;\"><b>" . $xoopsModule->name() . " " . _AM_MYPOINTS_MODULEADMIN . "</b> " . $breadcrumb . "</td>"; + echo "</tr></table>"; + echo "</div>"; + + echo "<div id='buttonbar'>"; + echo "<ul>"; + echo "<li id='" . $tblColors[0] . "'><a href=\"index.php\"\"><span>" ._MI_MYPOINTS_ADMMENU1 . "</span></a></li>\n"; + echo "<li id='" . $tblColors[2] . "'><a href=\"about.php\"\"><span>" ._MI_MYPOINTS_ADMMENU2 . "</span></a></li>\n"; + echo "</ul></div><div> </div>"; +} +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/admin/header.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/admin/header.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/admin/header.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,24 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: header.php 0 2009-11-14 18:47:04Z trabis $ + */ +include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; +include_once dirname(__FILE__) . '/functions.php'; +include_once dirname(dirname(__FILE__)) . '/include/functions.php'; + +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/admin/index.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/admin/index.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/admin/index.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,205 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: index.php 0 2009-11-14 18:47:04Z trabis $ + */ +include_once dirname(__FILE__) . '/header.php'; + +$choice = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; + +function mypoints_index() +{ + global $xoopsUser, $xoopsModule, $xoopsModuleConfig; + + $plugin_handler = xoops_getmodulehandler('plugin'); + + xoops_cp_header(); + mypoints_adminmenu(0); + $module_handler = xoops_gethandler('module'); + $since = $xoopsModuleConfig['countsince']; + + $criteria = new CriteriaCompo(new Criteria('isactive', 1)); + $modules = $module_handler->getObjects($criteria, true); + unset($criteria); + //get list of useritems_count plugins + $items_plugins = array(); + foreach ($modules as $moduleid => $module) { + $info = array(); + $info = mypoints_getPluginInfo( $module->getVar('dirname') , 'useritems_count'); + if (is_array($info) && count($info) > 0) { + include_once $info['plugin_path']; + if (function_exists(@$info['func'])) { + $items_plugins[$moduleid] = $module; + } + } + unset($info); + } + + //get list of uservotes_count plugins + $votes_plugins = array(); + foreach ($modules as $moduleid=>$module) { + $info = array(); + $info = mypoints_getPluginInfo( $module->getVar('dirname') , 'uservotes_count'); + if (is_array($info) && count($info) > 0) { + include_once $info['plugin_path']; + if (function_exists(@$info['func'])) { + $votes_plugins[$moduleid] = $module; + } + } + unset($info); + } + + echo "<h3>" . _AM_MYPOINTS_PLUGINS . "</h3>"; + echo "<form action ='index.php?op=submit' method=post>"; + echo "<table border = '0' cellpadding = '2' cellspacing = '1' width=100% class = outer>"; + echo "<tr class = bg3><td>" . _AM_MYPOINTS_MODULENAME . "</td><td>" + . _AM_MYPOINTS_PLUGINTYPE . "</td><td>" + . _AM_MYPOINTS_PLUGINNAME . "</td><td>" + . _AM_MYPOINTS_STATUS . "</td><td> </td><td>" + . _AM_MYPOINTS_POINTS . "</td></tr>"; + + foreach ($items_plugins as $moduleid => $module) { + $plugin = $plugin_handler->getByModuleType($moduleid, 'items'); + $actif = is_object($plugin) ? $plugin->getVar('pluginisactive') : 0; + $multi = is_object($plugin) ? $plugin->getVar('pluginmulti') : 1; + $name = is_object($plugin) ? $plugin->getVar('pluginname') : $module->getVar('name'); + unset($plugin); + + echo "<tr>"; + echo "<td class = head>" . $module->getVar('name') . "</td>"; + echo "<td class = head>" . _AM_MYPOINTS_PLUGINITEMS . "</td>"; + echo "<td class = 'even'><input type='text' name='items_name[" . $module->getVar('mid') . "]' size=20 value='" . $name . "'></td>"; + echo "<td class = 'even'><select name=items_actif[" . $module->getVar('mid') . "]>"; + + $sel = ""; + if ($actif == "1") { + $sel = "SELECTED"; + } + echo "<option " . $sel . " value=\"1\">" . _AM_MYPOINTS_ACTIVE . "\n</option>\n"; + $sel = ""; + if ($actif == "0") { + $sel = "SELECTED"; + } + echo "<option " . $sel . " value=\"0\">" . _AM_MYPOINTS_INACTIVE . "\n</option>\n"; + echo "</select></td>"; + echo "<td class = 'even'>" . _AM_MYPOINTS_MULTI . "</td>"; + echo "<td class = 'even'><input type='text' name='items_multi[" . $module->getVar('mid')."]' size=2 value='" . $multi . "'></td>"; + echo "</tr>"; + } + + foreach ($votes_plugins as $moduleid => $module) { + $plugin = $plugin_handler->getByModuleType($moduleid, 'votes'); + $actif = is_object($plugin) ? $plugin->getVar('pluginisactive') : 0; + $multi = is_object($plugin) ? $plugin->getVar('pluginmulti') : 1; + $name = is_object($plugin) ? $plugin->getVar('pluginname') : $module->getVar('name'); + unset($plugin); + + echo "<tr>"; + echo "<td class = head>" . $module->getVar('name') . "</td>"; + echo "<td class = head>" . _AM_MYPOINTS_PLUGINVOTES . "</td>"; + echo "<td class = 'even'><input type='text' name='votes_name[" . $module->getVar('mid') . "]' size=20 value='" . $name . "'></td>"; + echo "<td class = 'even'><select name=votes_actif[" . $module->getVar('mid') . "]>"; + $sel = ""; + if ($actif == "1") { + $sel = "SELECTED"; + } + echo "<option " . $sel . " value=\"1\">" . _AM_MYPOINTS_ACTIVE . "\n</option>\n"; + $sel = ""; + if ($actif == "0") { + $sel = "SELECTED"; + } + echo "<option " . $sel . " value=\"0\">" . _AM_MYPOINTS_INACTIVE . "\n</option>\n"; + echo "</select></td>"; + echo "<td class = 'even'>" . _AM_MYPOINTS_MULTI . "</td>"; + echo "<td class = 'even'><input type='text' name='votes_multi[" . $module->getVar('mid') . "]' size=2 value='" . $multi . "'></td>"; + echo "</tr>"; + } + + echo "</table><p>"; + echo "<input type='hidden' name='ok' VALUE='1'>"; + echo "<input type='submit' value='" . _AM_MYPOINTS_GO . "'>"; + echo "</form>"; + + xoops_cp_footer(); +} + +function mypoints_update_plugins() +{ + global $xoopsUser, $xoopsDB; + $plugin_handler = xoops_getmodulehandler('plugin'); + if (sizeof($_POST) > 0) { + $plugin_handler->deleteAll(); + if (isset($_POST['items_actif'])) { + foreach ($_POST['items_actif'] as $moduleid => $value) { + $criteria = new CriteriaCompo(new Criteria('pluginmid', $moduleid)); + $criteria->add(new Criteria('plugintype', 'items'), 'AND'); + $criteria->setLimit(1); + $plugins =& $plugin_handler->getObjects($criteria); + unset($criteria); + $plugin = !empty($plugins) ? $plugins[0] : $plugin_handler->create(); + $plugin->setVar('plugintype', 'items'); + $plugin->setVar('pluginmid', $moduleid); + $plugin->setVar('pluginisactive', $value); + if (isset($_POST['items_multi'][$moduleid])) { + $plugin->setVar('pluginmulti', $_POST['items_multi'][$moduleid]); + } + if (isset($_POST['items_name'][$moduleid])) { + $plugin->setVar('pluginname', $_POST['items_name'][$moduleid]); + } + $plugin_handler->insert($plugin); + unset($plugin); + } + } + if (isset($_POST['votes_actif'])) { + foreach($_POST['votes_actif'] as $moduleid => $value) { + $criteria = new CriteriaCompo(new Criteria('pluginmid', $moduleid)); + $criteria->add(new Criteria('plugintype', 'votes'), 'AND'); + $criteria->setLimit(1); + $plugins = $plugin_handler->getObjects($criteria); + unset($criteria); + $plugin = !empty($plugins) ? $plugins[0] : $plugin_handler->create(); + $plugin->setVar('plugintype', 'votes'); + $plugin->setVar('pluginmid', $moduleid); + $plugin->setVar('pluginisactive', $value); + if (isset($_POST['votes_multi'][$moduleid])) { + $plugin->setVar('pluginmulti', $_POST['votes_multi'][$moduleid]); + } + if (isset($_POST['votes_name'][$moduleid])) { + $plugin->setVar('pluginname', $_POST['votes_name'][$moduleid]); + } + $plugin_handler->insert($plugin); + unset($plugin); + } + } + } + + mypoints_updatePoints(1); + redirect_header('index.php', 1, _AM_MYPOINTS_DONE); + exit; +} + +switch ($choice) { + case "submit": + mypoints_update_plugins(); + break; + + default: + mypoints_index(); + break; +} + +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/admin/menu.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/admin/menu.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/admin/menu.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,25 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mypoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: menu.php 0 2009-11-14 18:47:04Z trabis $ + */ +$adminmenu[0]['title'] = _MI_MYPOINTS_ADMMENU1; +$adminmenu[0]['link'] = "admin/index.php"; + +$adminmenu[1]['title'] = _MI_MYPOINTS_ADMMENU2; +$adminmenu[1]['link'] = "admin/about.php"; +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/changelog.txt =================================================================== --- XoopsModules/mypoints/trunk/mypoints/changelog.txt (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/changelog.txt 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,13 @@ +<b><u>=> Version 1.0 (2009-11-14)</u></b> +- Xoops 2.4 compatible only + +<b><u>=> Version 1.0 RC (2009-06-05)</u></b> +- Fixed : Points were not auto updating +- Added : Plugin for publisher module + +<b><u>=> Version 1.0 Beta (2008-10-11)</u></b> +- Added : Templates +- Added : mypoints.php + +<b><u>=> Version 1.0 Alpha (2008-06-11)</u></b> +- First public release of the module. Added: XoopsModules/mypoints/trunk/mypoints/class/about.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/class/about.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/class/about.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -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. + */ + +/** + * @copyright The XUUPS Project http://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mypoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @author The SmartFactory http://www.smartfactory.ca + * @version $Id: about.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +/** + * Class About is a simple class that lets you build an about page + * @author The SmartFactory <www.smartfactory.ca> + */ +class MypointsAbout +{ + var $_lang_aboutTitle; + var $_lang_author_info; + var $_lang_developer_lead; + var $_lang_developer_contributor; + var $_lang_developer_website; + var $_lang_developer_email; + var $_lang_developer_credits; + var $_lang_module_info; + var $_lang_module_status; + var $_lang_module_release_date; + var $_lang_module_demo; + var $_lang_module_support; + var $_lang_module_bug; + var $_lang_module_submit_bug; + var $_lang_module_feature; + var $_lang_module_submit_feature; + var $_lang_module_disclaimer; + var $_lang_author_word; + var $_lang_version_history; + var $_lang_by; + var $_tpl; + + function __construct($aboutTitle = 'About') + { + xoops_loadLanguage('about', 'mypoints'); + $this->_aboutTitle = $aboutTitle; + + $this->_lang_developer_contributor = _AB_MYPOINTS_DEVELOPER_CONTRIBUTOR; + $this->_lang_developer_website = _AB_MYPOINTS_DEVELOPER_WEBSITE; + $this->_lang_developer_email = _AB_MYPOINTS_DEVELOPER_EMAIL; + $this->_lang_developer_credits = _AB_MYPOINTS_DEVELOPER_CREDITS; + $this->_lang_module_info = _AB_MYPOINTS_MODULE_INFO; + $this->_lang_module_status = _AB_MYPOINTS_MODULE_STATUS; + $this->_lang_module_release_date =_AB_MYPOINTS_MODULE_RELEASE_DATE ; + $this->_lang_module_demo = _AB_MYPOINTS_MODULE_DEMO; + $this->_lang_module_support = _AB_MYPOINTS_MODULE_SUPPORT; + $this->_lang_module_bug = _AB_MYPOINTS_MODULE_BUG; + $this->_lang_module_submit_bug = _AB_MYPOINTS_MODULE_SUBMIT_BUG; + $this->_lang_module_feature = _AB_MYPOINTS_MODULE_FEATURE; + $this->_lang_module_submit_feature = _AB_MYPOINTS_MODULE_SUBMIT_FEATURE; + $this->_lang_module_disclaimer = _AB_MYPOINTS_MODULE_DISCLAIMER; + $this->_lang_author_word = _AB_MYPOINTS_AUTHOR_WORD; + $this->_lang_version_history = _AB_MYPOINTS_VERSION_HISTORY; + + } + + function sanitize($value) + { + $myts =& MyTextSanitizer::getInstance(); + return $myts->displayTarea($value, 1); + } + + function render() + { + global $xoopsModule; + $module_handler =& xoops_gethandler('module'); + $versioninfo =& $module_handler->get($xoopsModule->getVar('mid')); + + $this->_tpl = new XoopsTpl(); + $this->_tpl->assign('module_url', XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/"); + $this->_tpl->assign('module_image', $versioninfo->getInfo('image')); + $this->_tpl->assign('module_name', $versioninfo->getInfo('name')); + $this->_tpl->assign('module_version', $versioninfo->getInfo('version')); + $this->_tpl->assign('module_status_version', $versioninfo->getInfo('status_version')); + + // Left headings... + if ($versioninfo->getInfo('author_realname') != '') { + $author_name = $versioninfo->getInfo('author') . " (" . $versioninfo->getInfo('author_realname') . ")"; + } else { + $author_name = $versioninfo->getInfo('author'); + } + $this->_tpl->assign('module_author_name', $author_name); + $this->_tpl->assign('module_license', $versioninfo->getInfo('license')); + $this->_tpl->assign('module_credits', $versioninfo->getInfo('credits')); + + // Developers Information + $this->_tpl->assign('module_developer_lead', $versioninfo->getInfo('developer_lead')); + $this->_tpl->assign('module_developer_contributor', $versioninfo->getInfo('developer_contributor')); + $this->_tpl->assign('module_developer_website_url', $versioninfo->getInfo('developer_website_url')); + $this->_tpl->assign('module_developer_website_name', $versioninfo->getInfo('developer_website_name')); + $this->_tpl->assign('module_developer_email', $versioninfo->getInfo('developer_email')); + + $people = $versioninfo->getInfo('people'); + if ($people) { + $this->_tpl->assign('module_people_developers', isset($people['developers']) ? array_map(array($this, 'sanitize'), $people['developers']) : false); + $this->_tpl->assign('module_people_testers', isset($people['testers']) ? array_map(array($this, 'sanitize'), $people['testers']) : false); + $this->_tpl->assign('module_people_translaters', isset($people['translaters']) ? array_map(array($this, 'sanitize'), $people['translaters']) : false); + $this->_tpl->assign('module_people_documenters', isset($people['documenters']) ? array_map(array($this, 'sanitize'), $people['documenters']) : false); + $this->_tpl->assign('module_people_other', isset($people['other']) ? array_map(array($this, 'sanitize'), $people['other']) : false); + } + //$this->_tpl->assign('module_developers', $versioninfo->getInfo('developer_email')); + + // Module Development information + $this->_tpl->assign('module_date', $versioninfo->getInfo('date')); + $this->_tpl->assign('module_status', $versioninfo->getInfo('status')); + $this->_tpl->assign('module_demo_site_url', $versioninfo->getInfo('demo_site_url')); + $this->_tpl->assign('module_demo_site_name', $versioninfo->getInfo('demo_site_name')); + $this->_tpl->assign('module_support_site_url', $versioninfo->getInfo('support_site_url')); + $this->_tpl->assign('module_support_site_name', $versioninfo->getInfo('support_site_name')); + $this->_tpl->assign('module_submit_bug', $versioninfo->getInfo('submit_bug')); + $this->_tpl->assign('module_submit_feature', $versioninfo->getInfo('submit_feature')); + + // Warning + $this->_tpl->assign('module_warning', $this->sanitize($versioninfo->getInfo('warning'))); + + // Author's note + $this->_tpl->assign('module_author_word', $versioninfo->getInfo('author_word')); + + // For changelog thanks to 3Dev + if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/changelog.txt')) { + $filesize = filesize($file); + $handle = fopen($file, 'r'); + $this->_tpl->assign('module_version_history', $this->sanitize(fread($handle, $filesize))); + fclose($handle); + } + + $this->_tpl->display('db:mypoints_about.html'); + } +} + +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/class/index.html =================================================================== --- XoopsModules/mypoints/trunk/mypoints/class/index.html (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/class/index.html 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/class/plugin.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/class/plugin.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/class/plugin.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,69 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: plugin.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +class MypointsPlugin extends XoopsObject +{ + /** + * constructor + */ + function __construct() + { + $this->initVar("pluginid", XOBJ_DTYPE_INT); + $this->initVar("pluginmid", XOBJ_DTYPE_INT); + $this->initVar('pluginname', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('plugintype', XOBJ_DTYPE_TXTBOX, 'items'); + $this->initVar("pluginmulti", XOBJ_DTYPE_INT,1); + $this->initVar("pluginisactive", XOBJ_DTYPE_INT,1); + } +} + +class MypointspluginHandler extends XoopsPersistableObjectHandler +{ + /** + * constructor + */ + function __construct(&$db) + { + parent::__construct($db, "mypoints_plugin", 'MypointsPlugin', "pluginid", "pluginmid"); + } + + function getByModuleType($mid, $type) + { + $plugin = false; + $mid = intval($mid); + if ($mid > 0) { + $sql = 'SELECT * FROM '.$this->db->prefix('mypoints_plugin') + . ' WHERE pluginmid=' . $mid + .' AND plugintype=' . $this->db->quoteString($type); + if (!$result = $this->db->query($sql)) { + return $plugin; + } + $numrows = $this->db->getRowsNum($result); + if ($numrows == 1) { + $plugin = new Mypointsplugin(); + $plugin->assignVars($this->db->fetchArray($result)); + } + } + return $plugin; + } +} +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/class/relation.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/class/relation.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/class/relation.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,66 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: relation.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +class MypointsRelation extends XoopsObject +{ + /** + * constructor + */ + function __construct() + { + $this->initVar("relationid", XOBJ_DTYPE_INT); + $this->initVar("relationuid", XOBJ_DTYPE_INT); + $this->initVar("relationpid", XOBJ_DTYPE_INT); + $this->initVar("relationpoints", XOBJ_DTYPE_INT); + } +} + +class MypointsRelationHandler extends XoopsPersistableObjectHandler +{ + /** + * constructor + */ + function __construct(&$db) + { + parent::__construct($db, "mypoints_relation", 'MypointsRelation', "relationid", "relationpid"); + } + + function getByPluginUid($pid , $uid) + { + $relation = false; + $pid = intval($pid); + $uid = intval($uid); + $sql = 'SELECT * FROM '.$this->db->prefix('mypoints_relation') + . ' WHERE relationpid=' . $pid + . ' AND relationuid=' . $uid; + if (!$result = $this->db->query($sql)) { + return $relation; + } + $numrows = $this->db->getRowsNum($result); + if ($numrows == 1) { + $relation = new MypointsRelation(); + $relation->assignVars($this->db->fetchArray($result)); + } + return $relation; + } +} +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/class/user.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/class/user.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/class/user.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,47 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: user.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +class MypointsUser extends XoopsObject +{ + /** + * constructor + */ + function MypointsUser() + { + $this->initVar("useruid", XOBJ_DTYPE_INT, 0); + $this->initVar('useruname', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar("userpoints", XOBJ_DTYPE_INT,0); + } +} + +class MypointsUserHandler extends XoopsPersistableObjectHandler +{ + /** + * constructor + */ + function __construct(&$db) + { + parent::__construct($db, "mypoints_user", 'MypointsUser', "useruid", "useruname"); + } + +} +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/images/bg.png =================================================================== (Binary files differ) Property changes on: XoopsModules/mypoints/trunk/mypoints/images/bg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/mypoints/trunk/mypoints/images/left_both.png =================================================================== (Binary files differ) Property changes on: XoopsModules/mypoints/trunk/mypoints/images/left_both.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/mypoints/trunk/mypoints/images/right_both.png =================================================================== (Binary files differ) Property changes on: XoopsModules/mypoints/trunk/mypoints/images/right_both.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/mypoints/trunk/mypoints/images/slogo.png =================================================================== (Binary files differ) Property changes on: XoopsModules/mypoints/trunk/mypoints/images/slogo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/mypoints/trunk/mypoints/images/xuupslogo.png =================================================================== (Binary files differ) Property changes on: XoopsModules/mypoints/trunk/mypoints/images/xuupslogo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsModules/mypoints/trunk/mypoints/include/functions.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/include/functions.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/include/functions.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,160 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package MyPoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: functions.php 0 2009-11-14 18:47:04Z trabis $ + */ + +defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); + +function mypoints_pluginExecute($dirname, $items, $since, $func = 'useritems_count') +{ + global $xoopsUser, $xoopsConfig, $xoopsDB; + + $ret = array(); + $plugins_path = XOOPS_ROOT_PATH . '/modules/mypoints/plugins'; + $plugin_info = mypoints_getPluginInfo($dirname , $func) ; + + if (empty($plugin_info) || empty($plugin_info['plugin_path'])) { + return false; + } + + include_once $plugin_info['plugin_path']; + + // call the plugin + if (function_exists(@$plugin_info['func'])) { + // get the list of items + $ret = $plugin_info['func']($items, $since); + } + + return $ret; +} + +function mypoints_getPluginInfo($dirname , $func = 'useritems_count') +{ + global $xoopsConfig; + $language = $xoopsConfig['language']; + // get $mytrustdirname for D3 modules + $mytrustdirname = '' ; + if (defined('XOOPS_TRUST_PATH') && file_exists(XOOPS_ROOT_PATH . "/modules/{$dirname}/mytrustdirname.php")) { + @include XOOPS_ROOT_PATH . "/modules/{$dirname}/mytrustdirname.php"; + $d3module_plugin_file = XOOPS_TRUST_PATH . "/modules/{$mytrustdirname}/include/mypoints.plugin.php"; + } + + $module_plugin_file = XOOPS_ROOT_PATH . "/modules/{$dirname}/include/mypoints.plugin.php" ; + $builtin_plugin_file = XOOPS_ROOT_PATH . "/modules/mypoints/plugins/{$dirname}.php" ; + + if (file_exists($module_plugin_file)) { + // module side (1st priority) + $ret = array( + 'plugin_path' => $module_plugin_file, + 'func' => $dirname . '_' . $func, + 'type' => 'module'); + } else if (!empty($mytrustdirname) && file_exists($d3module_plugin_file)) { + // D3 module's plugin under xoops_trust_path (2nd priority) + $ret = array( + 'plugin_path' => $d3module_plugin_file, + 'func' => $mytrustdirname . '_' . $func, + 'type' => 'module (D3)'); + } else if (file_exists($builtin_plugin_file)) { + // built-in plugin under modules/mypoints (3rd priority) + $ret = array( + 'plugin_path' => $builtin_plugin_file, + 'func' => $dirname . '_' . $func, + 'type' => 'built-in'); + } else { + $ret = array(); + } + + return $ret; +} + +////// +// Update the Users Scores (refresh table) +////// +function mypoints_updatePoints($force = 0) +{ + global $xoopsDB, $xoopsModuleConfig; + + $module_handler = xoops_gethandler('module'); + $plugin_handler = xoops_getmodulehandler('plugin'); + $user_handler = xoops_getmodulehandler('user'); + $relation_handler = xoops_getmodulehandler('relation'); + + $refreshtime = $xoopsModuleConfig['refreshtime']; + $since = strtotime($xoopsModuleConfig['countsince']); + $countwebm = $xoopsModuleConfig['countadmin']; + + $user = $user_handler->get(0); + $timestamp = 0; + if (is_object($user)) { + $timestamp = $user->getVar('useruname'); + } + + if (((time() - $timestamp) >= $refreshtime) || $force == 1) { + // Timer expired, update table + // Set date of update + $user_handler->deleteAll(); + $relation_handler->deleteAll(); + + $user = $user_handler->create(); + $user->setVar('useruid', 0); + $user->setVar('useruname', time()); + $user->setVar('userpoints', 0); + $user_handler->insert($user); + + // Prep to calculate user points + if ($countwebm == 0) { + $query = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " WHERE rank = '0' ORDER BY uid"); + } else { + $query = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " ORDER BY uid"); + } + $users = array(); + while (list($uid,$uname) = $xoopsDB->fetchRow($query)) { + + // Calculate User Points + $points = 0; + $criteria = new CriteriaCompo(new Criteria('pluginisactive', 1)); + //$criteria->add(new Criteria('plugintype', 'items'), 'AND'); + $plugins = $plugin_handler->getObjects($criteria); + foreach ($plugins as $plugin) { + $moduleid = $plugin->getVar('pluginmid'); + $module = $module_handler->get($moduleid); + $count = mypoints_pluginExecute($module->getVar('dirname') , $uid, $since, 'user' . $plugin->getVar('plugintype') . '_count'); + if ($count > 0) { + $relation = $relation_handler->create(); + $relation->setVar('relationuid', $uid); + $relation->setVar('relationpid', $plugin->getVar('pluginid')); + $relation->setVar('relationpoints', $count); + $relation_handler->insert($relation); + unset($relation); + $points = $points + ($count * $plugin->getVar('pluginmulti')); + } + unset($module); + } + + if ($points > 0) { + $user = $user_handler->create(); + $user->setVar('useruid', $uid); + $user->setVar('useruname', $uname); + $user->setVar('userpoints', $points); + $user_handler->insert($user); + unset($user); + } + } + } +} +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/include/index.html =================================================================== --- XoopsModules/mypoints/trunk/mypoints/include/index.html (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/include/index.html 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/index.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/index.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/index.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,119 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mypoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: index.php 0 2009-11-14 18:47:04Z trabis $ + */ + +include_once dirname(dirname(dirname(__FILE__))) . '/mainfile.php'; + +include_once XOOPS_ROOT_PATH . '/modules/mypoints/include/functions.php'; + +$xoopsOption['template_main'] = 'mypoints_showall.html'; +include_once XOOPS_ROOT_PATH . '/header.php'; + +$details = isset($_GET['det']) ? intval($_GET['det']) : 0; + +$plugin_handler = xoops_getmodulehandler('plugin'); +$relation_handler = xoops_getmodulehandler('relation'); +$user_handler = xoops_getmodulehandler('user'); + +$refreshtime = $xoopsModuleConfig['refreshtime']; +$since = strtotime($xoopsModuleConfig['countsince']); +$countwebm = $xoopsModuleConfig['countadmin']; +$limit = $xoopsModuleConfig['memberstoshow']; + +$xoopsTpl->assign('topmessage', sprintf(_MA_MYPOINTS_TOPMESSAGE, $limit, $xoopsConfig['sitename'])); + +if ($refreshtime < 60) { + $refreshtimes = $refreshtime ; + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LSECOND : _MA_MYPOINTS_LSECONDS; +} else if ($refreshtime < 3600) { + $refreshtimes = intval($refreshtime / 60); + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LMINUTE : _MA_MYPOINTS_LMINUTES; +} else if ($refreshtime < 86400) { + $refreshtimes = intval($refreshtime / 3600); + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LHOUR : _MA_MYPOINTS_LHOURS; +} else { + $refreshtimes = intval($refreshtime / 86400); + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LDAY : _MA_MYPOINTS_LDAYS; +} + +$xoopsTpl->assign('updatemessage', sprintf(_MA_MYPOINTS_UPDATEMESSAGE, $refreshtimes, $message)); +$xoopsTpl->assign('sincemessage', sprintf(_MA_MYPOINTS_SINCEMESSAGE, formatTimeStamp($since, "m", $xoopsConfig['server_TZ']))); + + +$criteria = new CriteriaCompo(new Criteria('pluginisactive', 1)); +//$criteria->add(new Criteria('plugintype', 'items'), 'AND'); +$criteria->setSort('pluginmulti'); +$criteria->setOrder('DESC'); +$plugins = $plugin_handler->getObjects($criteria); +unset($criteria); + +if ($details == 1) { + foreach ($plugins as $plugin) { + $myplugins[]['pluginname'] = $plugin->getVar('pluginname'); + } + $xoopsTpl->assign('plugins', $myplugins); +} + +$criteria = new CriteriaCompo(); +$criteria->setSort('userpoints'); +$criteria->setOrder('DESC'); +$criteria->setLimit($limit); +//$criteria->setStart($start); +$users = $user_handler->getObjects($criteria); +$myusers = array(); + +$i = 1; +foreach ($users as $user) { + if ($user->getVar('userpoints') > 0) { + $myusers[$i]['rank'] = $i; + $myusers[$i]['link'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $user->getVar('useruid') . "'>" . $user->getVar('useruname') . "</a>"; + if ($details == 1) { + foreach ($plugins as $plugin){ + $relation = $relation_handler->getByPluginUid($plugin->getVar('pluginid'), $user->getVar('useruid')); + $points = is_object($relation) ? $relation->getVar('relationpoints') : 0; + $myusers[$i]['pluginpoints'][] = $points; + } + } + $myusers[$i]['points'] = $user->getVar('userpoints'); + $i++; + } +} + +$xoopsTpl->assign('users', $myusers); + +$detailslink = "<a href='index.php?det="; +if ($details == 1) { + $detailslink .= "0' title='" . _MA_MYPOINTS_MOREOFF . "'>" . _MA_MYPOINTS_MOREOFF . "</a>"; +} else { + $detailslink .= "1' title='" . _MA_MYPOINTS_MOREON . "'>" . _MA_MYPOINTS_MOREON . "</a>"; +} +$xoopsTpl->assign('detailslink', $detailslink); + +$message = ''; +foreach ($plugins as $plugin) { + $message .= $plugin->getVar('pluginname').' : '; + $points = $plugin->getVar('pluginmulti') == 1 ? _MA_MYPOINTS_LPOINT : _MA_MYPOINTS_LPOINTS; + $message .= $plugin->getVar('pluginmulti'). ' ' . $points . '<br />'; +} + +$xoopsTpl->assign('howtoearnmessage', $message); +mypoints_updatePoints(); + +include_once XOOPS_ROOT_PATH . '/footer.php'; +?> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/language/english/about.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/about.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/about.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,25 @@ +<?php +define('_AB_MYPOINTS_AUTHOR_INFO', 'Contributors information'); +define('_AB_MYPOINTS_AUTHOR_WORD', "The Author's Word"); +define('_AB_MYPOINTS_BY', 'By'); +define('_AB_MYPOINTS_DEVELOPER_CONTRIBUTOR', 'Contributor(s)'); +define('_AB_MYPOINTS_DEVELOPER_CREDITS', 'Credits'); +define('_AB_MYPOINTS_DEVELOPER_EMAIL', 'Email'); +define('_AB_MYPOINTS_DEVELOPER_WEBSITE', 'Website'); +define('_AB_MYPOINTS_MODULE_BUG', 'Report a bug for this module'); +define('_AB_MYPOINTS_MODULE_DEMO', 'Demo Site'); +define('_AB_MYPOINTS_MODULE_DISCLAIMER', 'Disclaimer'); +define('_AB_MYPOINTS_MODULE_FEATURE', 'Suggest a new feature for this module'); +define('_AB_MYPOINTS_MODULE_INFO', 'Module Developpment Informations'); +define('_AB_MYPOINTS_MODULE_RELEASE_DATE', 'Release date'); +define('_AB_MYPOINTS_MODULE_STATUS', 'Status'); +define('_AB_MYPOINTS_MODULE_SUBMIT_BUG', 'Submit a bug'); +define('_AB_MYPOINTS_MODULE_SUBMIT_FEATURE', 'Request a feature'); +define('_AB_MYPOINTS_MODULE_SUPPORT', 'Official support site'); +define('_AB_MYPOINTS_PEOPLE_DEVELOPERS', 'Developers'); +define('_AB_MYPOINTS_PEOPLE_TESTERS', 'Testers'); +define('_AB_MYPOINTS_PEOPLE_DOCUMENTERS', 'Documenters'); +define('_AB_MYPOINTS_PEOPLE_TRANSLATERS', 'Translaters'); +define('_AB_MYPOINTS_PEOPLE_OTHER', 'Other contributors'); +define('_AB_MYPOINTS_VERSION_HISTORY', 'Version History'); +?> Added: XoopsModules/mypoints/trunk/mypoints/language/english/admin.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/admin.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/admin.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,21 @@ +<?php +define("_AM_MYPOINTS_MODULEADMIN", "module administration"); +define("_AM_MYPOINTS_GENERALSET", "General Settings"); +define("_AM_MYPOINTS_GOTOMOD", "Go to module"); + +define("_AM_MYPOINTS_PLUGINS", "Plugins administration"); +define("_AM_MYPOINTS_MODULENAME", "Module name"); +define("_AM_MYPOINTS_PLUGINNAME", "Plugin name"); +define("_AM_MYPOINTS_PLUGINTYPE", "Plugin type"); +define("_AM_MYPOINTS_PLUGINITEMS", "Items"); +define("_AM_MYPOINTS_PLUGINVOTES", "Votes"); +define("_AM_MYPOINTS_STATUS", "Status"); + +define("_AM_MYPOINTS_POINTS", "Points"); +define("_AM_MYPOINTS_ACTIVE", "Active"); +define("_AM_MYPOINTS_INACTIVE", "Inactive"); + +define("_AM_MYPOINTS_MULTI", "Multiply by"); +define("_AM_MYPOINTS_GO", "Save and Update"); +define("_AM_MYPOINTS_DONE", "Done!"); +?> Added: XoopsModules/mypoints/trunk/mypoints/language/english/blocks.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/blocks.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/blocks.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,6 @@ +<?php +// Author: Trabis +// URL: http://www.xuups.com +// E-Mail: lus...@gm... +define("_MB_MYPOINTS_DISPLAYC","Display %s comments"); +?> Added: XoopsModules/mypoints/trunk/mypoints/language/english/index.html =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/index.html (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/index.html 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/language/english/main.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/main.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/main.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,37 @@ +<?php +// Author: Trabis +// URL: http://www.xuups.com +// E-Mail: lus...@gm... +define('_MA_MYPOINTS_TITLE','Title'); +define('_MA_MYPOINTS_TOPMESSAGE','The %s most active members of %s'); +define('_MA_MYPOINTS_USERTOPMESSAGE','Points earned by %s'); +define('_MA_MYPOINTS_UPDATEMESSAGE','All points are updated after %s %s'); +define('_MA_MYPOINTS_SINCEMESSAGE','Counting since : %s'); + +define('_MA_MYPOINTS_LHOURS','hours'); +define('_MA_MYPOINTS_LHOUR','hour'); +define('_MA_MYPOINTS_LDAYS','days'); +define('_MA_MYPOINTS_LDAY','day'); +define('_MA_MYPOINTS_LMINUTES','minutes'); +define('_MA_MYPOINTS_LMINUTE','minute'); +define('_MA_MYPOINTS_LSECONDS','seconds'); +define('_MA_MYPOINTS_LSECOND','second'); + +define('_MA_MYPOINTS_RANK','Rank'); +define('_MA_MYPOINTS_MEMBER','Member'); +define('_MA_MYPOINTS_TOTALPOINTS','Total points'); +define('_MA_MYPOINTS_MOREON','Details ON'); +define('_MA_MYPOINTS_MOREOFF','Details OFF'); +define('_MA_MYPOINTS_HOWEARNPOINTS','How can I earn Points?'); + +define('_MA_MYPOINTS_PLUGIN','Plugin'); +define('_MA_MYPOINTS_ITEMS','Items'); +define('_MA_MYPOINTS_MULTI','Multiply'); + +define('_MA_MYPOINTS_SVOTE','%s Vote'); +define('_MA_MYPOINTS_SSUBMISSION','%s Submission'); + +define('_MA_MYPOINTS_LPOINT','point'); +define('_MA_MYPOINTS_LPOINTS','points'); +define('_MA_MYPOINTS_SPOINTS','Points'); +?> Added: XoopsModules/mypoints/trunk/mypoints/language/english/modinfo.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/english/modinfo.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/english/modinfo.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,34 @@ +<?php +// Author: Trabis +// URL: http://www.xuups.com +// E-Mail: lus...@gm... + +//general +define("_MI_MYPOINTS_NAME","My points"); +define("_MI_MYPOINTS_DSC","Pluginable module that allows you to give your members points for each submission or vote"); +//blocks +define("_MI_MYPOINTS_BNAME1","Members points"); +//admin menu +define("_MI_MYPOINTS_ADMMENU1","Plugins"); +define("_MI_MYPOINTS_ADMMENU2","About"); +//menu +define("_MI_MYPOINTS_SHOWALL","Top members"); +define("_MI_MYPOINTS_MYPOINTS","My points"); +//configs +define("_MI_MYPOINTS_NAMEDISPLAY","Name display"); +define("_MI_MYPOINTS_NAMEDISPLAY_DSC","How would you like to display the members names?"); +define("_MI_MYPOINTS_DISPLAYNAME1","User name"); +define("_MI_MYPOINTS_DISPLAYNAME2","Real name"); + +define("_MI_MYPOINTS_MEMBERSTOSHOW","Members to show"); +define("_MI_MYPOINTS_MEMBERSTOSHOW_DSC","How many members you want to show in the top list?"); + +define("_MI_MYPOINTS_REFRESHTIME","Refresh time"); +define("_MI_MYPOINTS_REFRESHTIME_DSC","Time between points updates. Set this is seconds."); + +define("_MI_MYPOINTS_COUNTADMIN","Count point for admins"); +define("_MI_MYPOINTS_COUNTADMIN_DSC","Do you want to show admins in the top list?"); + +define("_MI_MYPOINTS_COUNTSINCE","Count since"); +define("_MI_MYPOINTS_COUNTSINCE_DSC","Count points since this date."); +?> Added: XoopsModules/mypoints/trunk/mypoints/language/index.html =================================================================== --- XoopsModules/mypoints/trunk/mypoints/language/index.html (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/language/index.html 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsModules/mypoints/trunk/mypoints/mypoints.php =================================================================== --- XoopsModules/mypoints/trunk/mypoints/mypoints.php (rev 0) +++ XoopsModules/mypoints/trunk/mypoints/mypoints.php 2012-07-31 12:32:51 UTC (rev 9959) @@ -0,0 +1,116 @@ +<?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://www.xuups.com + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Mypoints + * @since 1.0 + * @author trabis <lus...@gm...> + * @version $Id: mypoints.php 0 2009-11-14 18:47:04Z trabis $ + */ + +include_once dirname(dirname(dirname(__FILE__))) . '/mainfile.php'; + +$uid = 0; + +if (is_object($xoopsUser) && $xoopsUser->getVar('uid') > 0) { + $uid = $xoopsUser->getVar('uid'); + $thisUser =& $xoopsUser; +} + +if (isset($_GET['uid'])){ + $getuid = intval($_GET['uid']); + $getUser = new xoopsUser($getuid); + if (is_object($getUser) && $getUser->isactive()) { + $uid = $getuid; + $thisUser =& $getUser; + } else { + $uid = 0; + } +} + +if ($uid == 0) { + redirect_header(XOOPS_URL . '/modules/mypoints/index.php', 2, _NOPERM); + exit(); +} + +include_once XOOPS_ROOT_PATH . '/modules/mypoints/include/functions.php'; + +$xoopsOption['template_main'] = 'mypoints_mypoints.html'; +include_once XOOPS_ROOT_PATH . '/header.php'; + +$plugin_handler = xoops_getmodulehandler('plugin'); +$relation_handler = xoops_getmodulehandler('relation'); +$user_handler = xoops_getmodulehandler('user'); + +$refreshtime = $xoopsModuleConfig['refreshtime']; +$since = strtotime($xoopsModuleConfig['countsince']); +$countwebm = $xoopsModuleConfig['countadmin']; +$limit = $xoopsModuleConfig['memberstoshow']; + +$xoopsTpl->assign('topmessage', sprintf(_MA_MYPOINTS_USERTOPMESSAGE, $thisUser->getVar('uname'))); + +if ($refreshtime < 60) { + $refreshtimes = $refreshtime ; + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LSECOND : _MA_MYPOINTS_LSECONDS; +} else if ($refreshtime < 3600) { + $refreshtimes = intval($refreshtime / 60); + $message = $refreshtimes == 1 ? _MA_MYPOINTS_LMI... [truncated message content] |