|
From: <be...@us...> - 2014-04-25 14:12:11
|
Revision: 12497
http://sourceforge.net/p/xoops/svn/12497
Author: beckmi
Date: 2014-04-25 14:12:07 +0000 (Fri, 25 Apr 2014)
Log Message:
-----------
XOOPS 2.5.7 Module Pack update (work in progress): Birthday
Modified Paths:
--------------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/about.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_footer.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_header.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/index.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/main.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/menu.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/changelog.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/credits.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/install.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/lang_diff.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/readme.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/admin.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/help/help.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/help/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/modinfo.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/sql/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/xoops_version.php
Added Paths:
-----------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/storage.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/docs/gpl.txt
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/functions.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/blocks/index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/index.html
Removed Paths:
-------------
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/blocks/b_birthday.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/Numeral.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/NumeralInterface.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/birthday_utils.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/formtextdateselect.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/users_birthday.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/comment_delete.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/comment_edit.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/comment_new.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/comment_post.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/comment_reply.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/footer.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/header.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/images/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/calendarjs.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/comment_functions.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/common.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/function.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/include/search.inc.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/index.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/arabic/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/blocks.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/english/main.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/french/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/persian/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/language/spanish/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/sql/mysql.sql
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/system ?\195?\160 mettre ds system de xoops/
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/birthday_index.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/birthday_user.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/birthday_users.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/templates/blocks/birthday_block_birthday.html
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/user.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/users.php
XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/xoops_users_birthday.sql
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/about.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/about.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/about.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,6 +1,8 @@
<?php
/**
- * Birthday module
+ * ****************************************************************************
+ * boox - MODULE FOR XOOPS
+ * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com)
*
* 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
@@ -9,13 +11,14 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * @copyright The XOOPS Project (http://www.xoops.org)
- * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
- * @package birthday
- * @since 2.5.0
- * @author XOOPS Module Team
- * @version $Id $
- **/
+ * @copyright Hervé Thouzard (http://www.herve-thouzard.com)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
+ * @package boox
+ * @author Hervé Thouzard (http://www.herve-thouzard.com)
+ *
+ * Version : $Id:
+ * ****************************************************************************
+ */
include_once dirname(__FILE__) . '/admin_header.php';
@@ -26,4 +29,4 @@
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
-include 'admin_footer.php';
\ No newline at end of file
+include 'admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_footer.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_footer.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_footer.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,6 +1,8 @@
<?php
/**
- * Birthday module
+ * ****************************************************************************
+ * boox - MODULE FOR XOOPS
+ * Copyright (c) Herv� Thouzard (http://www.herve-thouzard.com)
*
* 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
@@ -9,13 +11,14 @@
* 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.gnu.org/licenses/gpl-2.0.html GNU Public License
- * @package birthday
- * @since 2.5.0
- * @author XOOPS Module Team
- * @version $Id $
-**/
+ * @copyright Herv� Thouzard (http://www.herve-thouzard.com)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
+ * @package boox
+ * @author Herv� Thouzard (http://www.herve-thouzard.com)
+ *
+ * Version : $Id:
+ * ****************************************************************************
+ */
echo "<div class='adminfooter'>\n"
." <div style='text-align: center;'>\n"
@@ -24,4 +27,4 @@
." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
."</div>";
-xoops_cp_footer();
\ No newline at end of file
+xoops_cp_footer();
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_header.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_header.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/admin_header.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,6 +1,8 @@
<?php
/**
- * Birthday module
+ * ****************************************************************************
+ * boox - MODULE FOR XOOPS
+ * Copyright (c) Herv� Thouzard (http://www.herve-thouzard.com)
*
* 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
@@ -9,13 +11,14 @@
* 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.gnu.org/licenses/gpl-2.0.html GNU Public License
- * @package birthday
- * @since 2.5.0
- * @author XOOPS Module Team
- * @version $Id $
-**/
+ * @copyright Herv� Thouzard (http://www.herve-thouzard.com)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
+ * @package boox
+ * @author Herv� Thouzard (http://www.herve-thouzard.com)
+ *
+ * Version : $Id:
+ * ****************************************************************************
+ */
$path = dirname(dirname(dirname(dirname(__FILE__))));
include_once $path . '/mainfile.php';
@@ -24,22 +27,21 @@
global $xoopsModule;
-$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');
+$thisModDir = $GLOBALS['xoopsModule']->getVar('dirname');
-//if functions.php file exist
-//require_once dirname(dirname(__FILE__)) . '/include/functions.php';
+require_once dirname(dirname(__FILE__)) . '/include/functions.php';
// Load language files
-xoops_loadLanguage('admin', $thisModuleDir);
-xoops_loadLanguage('modinfo', $thisModuleDir);
-xoops_loadLanguage('main', $thisModuleDir);
+xoops_loadLanguage('admin', $thisModDir);
+xoops_loadLanguage('modinfo', $thisModDir);
+xoops_loadLanguage('main', $thisModDir);
$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
-if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){
+if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) {
include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
- }else{
- redirect_header("../../../admin.php", 5, _AM_BIRTHDAY_MODULEADMIN_MISSING, false);
- }
\ No newline at end of file
+ } else {
+ redirect_header("../../../admin.php", 5, _AM_BOOX_MODULEADMIN_MISSING, false);
+ }
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/index.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/index.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/index.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,7 +1,7 @@
<?php
/**
* ****************************************************************************
- * Birthday - MODULE FOR XOOPS
+ * boox - MODULE FOR XOOPS
* Copyright (c) Herv\xE9 Thouzard (http://www.herve-thouzard.com)
*
* You may not change or alter any portion of this comment or credits
@@ -13,22 +13,21 @@
*
* @copyright Herv\xE9 Thouzard (http://www.herve-thouzard.com)
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
- * @package birthday
+ * @package boox
* @author Herv\xE9 Thouzard (http://www.herve-thouzard.com)
*
* Version : $Id:
* ****************************************************************************
*/
-
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php';
include_once dirname(__FILE__) . '/admin_header.php';
xoops_cp_header();
- $indexAdmin = new ModuleAdmin();
+ $indexAdmin = new ModuleAdmin();
echo $indexAdmin->addNavigation('index.php');
echo $indexAdmin->renderIndex();
-include "admin_footer.php";
\ No newline at end of file
+include 'admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/main.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/main.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/main.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,184 +1,174 @@
<?php
/**
* ****************************************************************************
- * birthday - MODULE FOR XOOPS
- * Copyright (c) Herv� Thouzard of Instant Zero (http://www.herve-thouzard.com/)
- * Created on 10 juil. 08 at 11:38:52
+ * boox - MODULE FOR XOOPS
+ * Copyright (c) Herv� Thouzard (http://www.herve-thouzard.com)
+ *
+ * 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 Herv� Thouzard (http://www.herve-thouzard.com)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
+ * @package boox
+ * @author Herv� Thouzard (http://www.herve-thouzard.com)
+ *
* Version : $Id:
* ****************************************************************************
*/
+
require_once '../../../include/cp_header.php';
-require_once '../include/common.php';
-require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
-require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
+require_once XOOPS_ROOT_PATH.'/modules/boox/include/functions.php';
+require_once XOOPS_ROOT_PATH.'/modules/boox/class/storage.php';
include_once 'admin_header.php';
$indexAdmin = new ModuleAdmin();
+// ********************************************************************************************************************
+// **** Main
+// ********************************************************************************************************************
$op = 'default';
if (isset($_POST['op'])) {
- $op = $_POST['op'];
-} elseif ( isset($_GET['op'])) {
- $op = $_GET['op'];
+ $op=$_POST['op'];
+} elseif (isset($_GET['op'])) {
+ $op=$_GET['op'];
}
+$storage = new boox_storage();
-// Lecture de certains param�tres de l'application ********************************************************************
-$limit = birthday_utils::getModuleOption('perpage'); // Nombre maximum d'�l�ments � afficher
-$baseurl = BIRTHDAY_URL.'admin/'.basename(__FILE__); // URL de ce script
-$conf_msg = birthday_utils::javascriptLinkConfirm(_AM_BIRTHDAY_CONF_DELITEM);
-$images_width = birthday_utils::getModuleOption('images_width');
-$images_height = birthday_utils::getModuleOption('images_height');
-$destname = '';
-
-$cacheFolder = XOOPS_UPLOAD_PATH.'/'.BIRTHDAY_DIRNAME;
-if(!is_dir($cacheFolder)) {
- mkdir($cacheFolder, 0777);
- file_put_contents($cacheFolder.'/index.html', '<script>history.go(-1);</script>');
+/**
+ * @param string $content
+ * @param string $filename
+ */
+function edit_file_content($content='', $filename='')
+{
+ require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
+ $sform = new XoopsThemeForm(_AM_BOOX_FILE, 'ffile', XOOPS_URL.'/modules/boox/admin/main.php', 'post');
+ if (xoops_trim($filename) != '') {
+ $sform->addElement(new XoopsFormHidden('filename', $filename), false);
+ } else {
+ $sform->addElement(new XoopsFormText(_AM_BOOX_FILENAME, 'filename', 50, 255, $filename), true);
+ $sform->addElement(new XoopsFormHidden('newfile', '1'), false);
+ }
+ $sform->addElement(new XoopsFormHidden('op', 'save'), false);
+ $editor = boox_getWysiwygForm(_AM_BOOX_CONTENT, 'file_content', $content, 15, 60, 'content_hidden');
+ if ($editor) {
+ $sform->addElement($editor,false);
+ }
+ $button_tray = new XoopsFormElementTray('' ,'');
+ $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
+ $button_tray->addElement($submit_btn);
+ $sform->addElement($button_tray);
+ $sform->display();
}
-
-switch($op)
-{
- // ****************************************************************************************************************
- case 'default': // List birthdays and show form to add a someone
- // ****************************************************************************************************************
+switch ($op) {
+ case 'addfile': // Add a new file
xoops_cp_header();
- //echo '<h1>'.birthday_utils::getModuleName().'</h1>';
echo $indexAdmin->addNavigation('main.php');
+ edit_file_content();
+ break;
+ case 'save': // Save a file after it was edited (or created)
+ $folder_storage = xoops_trim(boox_getmoduleoption('foldertosave'));
+ if (!isset($_POST['filename'])) {
+ redirect_header( 'main.php', 3, _AM_BOOX_ERROR1);
+ }
-
- $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
- $itemsCount = $hBdUsersBirthday->getCount();
- if($itemsCount > $limit) {
- $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start');
+ if (substr($folder_storage,-1,1) != '/') {
+ $folder_storage .= '/';
}
- if(isset($pagenav) && is_object($pagenav)) {
- echo "<div align='right'>".$pagenav->renderNav()."</div>";
- }
- if($itemsCount > 0) {
- $class = '';
- //$items = $hBdUsersBirthday->getItems($start, $limit, 'birthday_lastname');
-
- $tblItems = array();
- //$critere = new Criteria($this->keyName, 0 ,'<>');
- $critere = new Criteria('birthday_id', 0 ,'<>');
- $critere->setLimit($limit);
- $critere->setStart($start);
- $critere->setSort('birthday_lastname');
-// $critere->setOrder($order);
-// $tblItems = $this->getObjects($critere, $idAsKey);
-
-
-
- $items = $hBdUsersBirthday->getObjects($start, $limit, 'birthday_lastname');
-
-
-
- echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>";
- echo "<tr><th align='center'>"._BIRTHDAY_DATE."</th><th align='center'>"._BIRTHDAY_USERNAME."</th><th align='center'>"._BIRTHDAY_LASTNAME.', '._BIRTHDAY_FIRSTNAME."</th><th align='center'>"._AM_BIRTHDAY_ACTION."</th></tr>";
- foreach ($items as $item) {
- $class = ($class == 'even') ? 'odd' : 'even';
- $id = $item->getVar('birthday_id');
- $user = null;
- $user = $item->getXoopsUser();
- $uname = '';
- if(is_object($user)) {
- $uname = $user->getVar('uname');
- }
- $action_edit = "<a href='$baseurl?op=edit&id=".$id."' title='"._EDIT."'>".$birdthday_icones['edit'].'</a>';
- $action_delete = "<a href='$baseurl?op=delete&id=".$id."' title='"._DELETE."'".$conf_msg.">".$birdthday_icones['delete'].'</a>';
-
- echo "<tr class='".$class."'>\n";
- echo "<td align='center'>".birthday_utils::SQLDateToHuman($item->getVar('birthday_date'))."</td>";
- echo "<td align='center'>".$uname.'</td>';
- echo "<td align='center'>".$item->getFullName().'</td>';
- echo "<td align='center'>".$action_edit.' '.$action_delete.'</td>';
- echo "</tr>\n";
- }
- echo "</table>\n";
- if(isset($pagenav) && is_object($pagenav)) {
- echo "<div align='left'>".$pagenav->renderNav()."</div>";
- }
- echo "<br /><br />\n";
- }
- $item = $hBdUsersBirthday->create(true);
- $form = $hBdUsersBirthday->getForm($item, $baseurl);
- $form->display();
+ $filename = $_POST['filename'];
+ $content = $_POST['file_content'];
+ if (get_magic_quotes_gpc()) {
+ $content = stripslashes($content);
+ }
+ if (boox_getmoduleoption('trimcontent')) {
+ $content = xoops_trim($content);
+ }
+ $fp = fopen($folder_storage.$filename,'w') or die(_AM_BOOX_ERROR1);
+ fwrite($fp,$content);
+ fclose($fp);
+ if (isset($_POST['newfile'])) {
+ $storage->getAllFiles();
+ $storage->addfiles($filename);
+ $storage->store();
+ }
+ redirect_header('main.php',2,_AM_BOOX_DBUPDATED);
break;
- // ****************************************************************************************************************
- case 'maintain': // Maintenance des tables et du cache
- // ****************************************************************************************************************
- xoops_cp_header();
- require_once '../xoops_version.php';
- $tables = array();
- foreach ($modversion['tables'] as $table) {
- $tables[] = $xoopsDB->prefix($table);
- }
- if(count($tables) > 0) {
- $list = implode(',', $tables);
- $xoopsDB->queryF('CHECK TABLE '.$list);
- $xoopsDB->queryF('ANALYZE TABLE '.$list);
- $xoopsDB->queryF('OPTIMIZE TABLE '.$list);
- }
- birthday_utils::updateCache();
- $hBdUsersBirthday->forceCacheClean();
- birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 2);
- break;
-
- // ****************************************************************************************************************
- case 'edit': // Edition d'un utilisateur existant
- // ****************************************************************************************************************
- xoops_cp_header();
+ case 'edit':
+ xoops_cp_header();
echo $indexAdmin->addNavigation('main.php');
- $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
- if(empty($id)) {
- birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5);
- }
- // Item exits ?
- $item = null;
- $item = $hBdUsersBirthday->get($id);
- if(!is_object($item)) {
- birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5);
- }
- $form = $hBdUsersBirthday->getForm($item, $baseurl);
- $form->display();
+ if (!isset($_GET['filename'])) {
+ redirect_header( 'main.php', 3, _AM_BOOX_ERROR1);
+ }
+ $folder_storage = xoops_trim(boox_getmoduleoption('foldertosave'));
+ if (substr($folder_storage,-1,1) != '/') {
+ $folder_storage .= '/';
+ }
+ $filename = $_GET['filename'];
+ $fp = fopen($folder_storage.$filename,'r') or die(sprintf(_AM_BOOX_ERROR3,$filename));
+ $content = fread($fp, filesize($folder_storage.$filename));
+ fclose($fp);
+ edit_file_content($content, $filename);
break;
- // ****************************************************************************************************************
- case 'saveedit': // Enregistrement des modifications
- // ****************************************************************************************************************
- xoops_cp_header();
- echo $indexAdmin->addNavigation('main.php');
- $result = $hBdUsersBirthday->saveUser();
- if($result) {
- birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1);
- } else {
- birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3);
+ case 'delete': // Delete a file
+ if (!isset($_GET['filename'])) {
+ redirect_header( 'main.php', 3, _AM_BOOX_ERROR1);
}
+ $filename = $_GET['filename'];
+ $storage->getAllFiles();
+ $storage->delete($filename);
+ $storage->store();
+ $folder_storage = xoops_trim(boox_getmoduleoption('foldertosave'));
+ if (substr($folder_storage,-1,1) != '/') {
+ $folder_storage .= '/';
+ }
+ @unlink($folder_storage.$filename);
+ redirect_header('main.php',2,_AM_BOOX_DBUPDATED);
break;
- // ****************************************************************************************************************
- case 'delete': // Suppression d'un utilisateur
- // ****************************************************************************************************************
- $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
- if(empty($id)) {
- birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5);
- }
- // Item exits ?
- $item = null;
- $item = $hBdUsersBirthday->get($id);
- if(!is_object($item)) {
- birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5);
- }
- $result = $hBdUsersBirthday->deleteUser($item);
- if($result) {
- birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1);
- } else {
- birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3);
+ default: // Default action, list existing files
+ $folder_storage = xoops_trim(boox_getmoduleoption('foldertosave'));
+ if (substr($folder_storage,-1,1) != '/') {
+ $folder_storage .= '/';
}
+ xoops_cp_header();
+ echo $indexAdmin->addNavigation('main.php');
+ $indexAdmin->addItemButton(_AM_BOOX_ADD, 'main.php?op=addfile', 'add', '');
+ echo $indexAdmin->renderButton('left', '');
+ echo '<h4>'._AM_BOOX_FILES.'</h4>';
+ $files = array();
+ $files = $storage->getAllFiles();
+ echo '<table border="0" align="center" width="95%">';
+ echo '<tr>';
+ echo '<th align="center">'._AM_BOOX_FILE.'</th>';
+ echo '<th align="center">'._AM_BOOX_COMMAND.'</th>';
+ echo '<th align="center">'._AM_BOOX_ACTION.'</th>';
+ echo '</tr>';
+ $class='';
+ foreach ($files as $file) {
+ $class = ($class == 'even') ? 'odd' : 'even';
+ $action_edit = '<a title="'._EDIT.'" href="main.php?op=edit&filename='.urlencode($file).'"><img border="0" src="../assets/images/edit.gif" /></a>';
+ $action_delete = '<a '.boox_JavascriptLinkConfirm(_AM_BOOX_CONFIRM).' title="'._DELETE.'" href="main.php?op=delete&filename='.urlencode($file).'"><img border="0" src="../assets/images/delete.gif" /></a>';
+ $command = "<{php}>include_once '".$folder_storage.$file."';<{/php}>";
+ echo "<tr class='".$class."'>";
+ echo '<td>'.$file.'</td>';
+ echo '<td>'.$command.'</td>';
+ echo "<td align='center'>".$action_edit.' '.$action_delete.'</td>';
+ echo "</tr>";
+ }
+ $class = ($class == 'even') ? 'odd' : 'even';
+ //echo "<tr class='".$class."'><td colspan='3' align='center'><br /><form method='post' name='fadd' id='fadd' action='main.php'><input type='hidden' name='op' value='addfile' /><input type='submit' name='btngo' value='"._AM_BOOX_ADD."' /></form><br /></td></tr>";
+ echo '</table><br/>';
+
+ //echo "<br /><div align='center'><a href='http://xoops.instant-zero.com' target='_blank'><img src='../assets/images/instantzero.gif'></a></div>";
+ break;
}
-include "admin_footer.php";
-//xoops_cp_footer();
\ No newline at end of file
+include 'admin_footer.php';
+//xoops_cp_footer();
Modified: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/menu.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/menu.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/admin/menu.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,9 +1,22 @@
<?php
/**
* ****************************************************************************
- * Birthday - MODULE FOR XOOPS
- * Script made by Herv\xE9 Thouzard (http://www.herve-thouzard.com/)
- * Created on 10 jully. 08 at 11:32:40
+ * boox - MODULE FOR XOOPS
+ * Copyright (c) Herv� Thouzard (http://www.herve-thouzard.com)
+ *
+ * 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 Herv� Thouzard (http://www.herve-thouzard.com)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
+ * @package boox
+ * @author Herv� Thouzard (http://www.herve-thouzard.com)
+ *
+ * Version : $Id:
* ****************************************************************************
*/
@@ -14,20 +27,19 @@
$module = $module_handler->getByDirname($dirname);
$pathIcon32 = $module->getInfo('icons32');
-$adminmenu = array();
-$i = 1;
-$adminmenu[$i]["title"] = _MI_BIRTHDAY_HOME;
-$adminmenu[$i]["link"] = "admin/index.php";
+xoops_loadLanguage('admin', $dirname);
+
+$i = 0;
+$adminmenu[$i]["title"] = _MI_BOOX_MENU_00;
+$adminmenu[$i]["link"] = 'admin/index.php';
$adminmenu[$i]["icon"] = $pathIcon32.'/home.png';
-$i++;
-$adminmenu[$i]["title"] = _MI_BIRTHDAY_BIRTHDAYS;
-$adminmenu[$i]["link"] = "admin/main.php";
-$adminmenu[$i]["icon"] = './images/cake.png';
-//$i++;
-//$adminmenu[$i]["title"] = _MI_BIRTHDAY_MAINTAIN;
-//$adminmenu[$i]["link"] = "admin/main.php?op=maintain";
-//$adminmenu[$i]["icon"] = './images/maintenance.png';
-$i++;
-$adminmenu[$i]["title"] =_MI_BIRTHDAY_ABOUT;
-$adminmenu[$i]["link"] = "admin/about.php";
-$adminmenu[$i]["icon"] = $pathIcon32.'/about.png';
\ No newline at end of file
+
+++$i;
+$adminmenu[$i]["title"] = _MI_BOOX_MENU_01;
+$adminmenu[$i]["link"] = 'admin/main.php';
+$adminmenu[$i]["icon"] = $pathIcon32.'/manage.png';
+
+++$i;
+$adminmenu[$i]["title"] = _MI_BOOX_ADMIN_ABOUT;
+$adminmenu[$i]["link"] = 'admin/about.php';
+$adminmenu[$i]["icon"] = $pathIcon32.'/about.png';
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png
===================================================================
(Binary files differ)
Index: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png 2014-04-25 14:12:07 UTC (rev 12497)
Property changes on: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/boox_logo.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif
===================================================================
(Binary files differ)
Index: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif 2014-04-25 14:12:07 UTC (rev 12497)
Property changes on: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/delete.gif
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif
===================================================================
(Binary files differ)
Index: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif 2014-04-25 14:12:07 UTC (rev 12497)
Property changes on: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/edit.gif
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/index.html (rev 0)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/images/index.html 2014-04-25 14:12:07 UTC (rev 12497)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/index.html (rev 0)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/assets/index.html 2014-04-25 14:12:07 UTC (rev 12497)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Deleted: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/blocks/b_birthday.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/blocks/b_birthday.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/blocks/b_birthday.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,38 +0,0 @@
-<?php
-function b_birthday_show($options) {
- global $xoopsUser;
- $block = array();
- include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php';
- $start = 0;
- $limit = intval($options[0]);
- $itemsCount = $hBdUsersBirthday->getTodayBirthdaysCount();
- $users = $hBdUsersBirthday->getTodayBirthdays($start, $limit);
- if(count($users) > 0) {
- foreach($users as $user) {
- $block['birthday_today_users'][] = $user->toArray();
- }
- }
- if($itemsCount > $limit) {
- $block['birthday_today_more'] = true;
- } else {
- $block['birthday_today_more'] = false;
- }
-
- if (is_object($xoopsUser) && birthday_utils::getModuleOption('enable_users')) {
- $block['birthday_today_mypage'] = true;
- } else {
- $block['birthday_today_mypage'] = false;
- }
- return $block;
-}
-
-function b_birthday_edit($options)
-{
- include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php';
- $form = '';
- $form .= "<table border='0'>";
- $form .= '<tr><td>'._MB_BIRTHDAY_MAX_ITEMS."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>\n";
- $form .= "</table>\n";
- return $form;
-}
-?>
Deleted: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/Numeral.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/Numeral.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/Numeral.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,580 +0,0 @@
-<?php
-require_once XOOPS_ROOT_PATH.'/modules/birthday/class/NumeralInterface.php';
-// {{{ Class Text_CAPTCHA_Numeral
-// +----------------------------------------------------------------------+
-// | PHP version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 David Coallier |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of David Coallier nor the names of his contributors |
-// | may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: David Coallier <da...@ag...> |
-// +----------------------------------------------------------------------+
-//
-/**
- * Class used for numeral captchas
- *
- * This class is intended to be used to generate
- * numeral captchas as such as:
- * Example:
- * Give me the answer to "54 + 2" to prove that you are human.
- *
- * @author David Coallier <da...@ag...>
- * @package Text_CAPTCHA_Numeral
- * @category CAPTCHA
- */
-class birthday_Text_CAPTCHA_Numeral implements birthday_Text_CAPTCHA_Numeral_Interface
-{
- // {{{ Variables
- /**
- * Minimum range value
- *
- * This variable holds the minimum range value
- * default set to "1"
- *
- * @access private
- * @var integer $minValue The minimum range value
- */
- private $minValue = '1';
-
- /**
- * Maximum range value
- *
- * This variable holds the maximum range value
- * default set to "50"
- *
- * @access private
- * @var integer $maxValue The maximum value of the number range
- */
- private $maxValue = '50';
-
- /**
- * Operators
- *
- * The valid operators to use
- * in the numeral captcha. We could
- * use / and * but not yet.
- *
- * @access private
- * @var array $operators The operations for the captcha
- */
- private $operators = array();
-
- /**
- * Operator to use
- *
- * This variable is basically the operation
- * that we're going to be using in the
- * numeral captcha we are about to generate.
- *
- * @access private
- * @var string $operator The operation's operator
- */
- private $operator = '';
-
- /**
- * Mathematical Operation
- *
- * This is the mathematical operation
- * that we are displaying to the user.
- *
- * @access private
- * @var string $operation The math operation
- */
- private $operation = '';
-
- /**
- * First number of the operation
- *
- * This variable holds the first number
- * of the numeral operation we are about
- * to generate.
- *
- * @access private
- * @var integer $firstNumber The first number of the operation
- */
- private $firstNumber = '';
-
- /**
- * Second Number of the operation
- *
- * This variable holds the value of the
- * second variable of the operation we are
- * about to generate for the captcha.
- *
- * @access private
- * @var integer $secondNumber The second number of the operation
- */
- private $secondNumber = '';
-
- /**
- * The operation answer
- *
- * The answer to the numeral operation
- * we are about to do.
- *
- * @access private
- * @var integer $answer The mathematical operation answer value.
- */
- private $answer;
-
- /**
- * A constant that indicates the complexity of mathematical operations
- *
- * @access public
- *
- */
- const TEXT_CAPTCHA_NUMERAL_COMPLEXITY_ELEMENTARY = 1;
-
-
- /**
- * A constant that indicates the complexity of mathematical operations
- *
- * @access public
- *
- */
- const TEXT_CAPTCHA_NUMERAL_COMPLEXITY_HIGH_SCHOOL = 2;
-
-
- /**
- * A constant that indicates the complexity of mathematical operations
- *
- * @access public
- *
- */
- const TEXT_CAPTCHA_NUMERAL_COMPLEXITY_UNIVERSITY = 4;
-
-
-
- // }}}
- // {{{ Constructor
- /**
- * Constructor with different levels of mathematical operations sets
- *
- * @param constant $complexityType
- */
- public function __construct($complexityType = self::TEXT_CAPTCHA_NUMERAL_COMPLEXITY_ELEMENTARY)
- {
-
- switch ($complexityType) {
- case 2:
- $this->operators = array('+', '-', '*');
- break;
- case 4:
- $this->operators = array('+', '-', '*', '%', '/');
- break;
- case 1:
- default:
- $this->operators = array('-', '+');
- break;
- }
-
- $this->generateFirstNumber();
- $this->generateSecondNumber();
- $this->generateOperator();
- $this->generateOperation();
- }
- // }}}
- // {{{ private function setRangeMinimum
- /**
- * Set Range Minimum value
- *
- * This function give the developer the ability
- * to set the range minimum value so the operations
- * can be bigger, smaller, etc.
- *
- * @access private
- * @param integer $minValue The minimum value
- */
- private function setRangeMinimum($minValue = '1')
- {
- $this->minValue = (int)$minValue;
- }
- // }}}
- // {{{ private function generateFirstNumber
- /**
- * Sets the first number
- *
- * This function sets the first number
- * of the operation by calling the generateNumber
- * function that generates a random number.
- *
- * @access private
- * @see $this->firstNumber, $this->generateNumber
- */
- private function generateFirstNumber()
- {
- $this->setFirstNumber($this->generateNumber());
- }
- // }}}
- // {{{ private function generateSecondNumber
- /**
- * Sets second number
- *
- * This function sets the second number of the
- * operation by calling generateNumber()
- *
- * @access private
- * @see $this->secondNumber, $this->generateNumber()
- */
- private function generateSecondNumber()
- {
- $this->setSecondNumber($this->generateNumber());
- }
- // }}}
- // {{{ private function generateOperator
- /**
- * Sets the operation operator
- *
- * This function sets the operation operator by
- * getting the array value of an array_rand() of
- * the $this->operators() array.
- *
- * @access private
- * @see $this->operators, $this->operator
- */
- private function generateOperator()
- {
- $this->operator = $this->operators[array_rand($this->operators)];
- }
- // }}}
- // {{{ private function setAnswer
- /**
- * Sets the answer value
- *
- * This function will accept the parameters which is
- * basically the result of the function we have done
- * and it will set $this->answer with it.
- *
- * @access private
- * @param integer $answerValue The answer value
- * @see $this->answer
- */
- private function setAnswer($answerValue)
- {
- $this->answer = $answerValue;
- return $this;
- }
- // }}}
- // {{{ private function setFirstNumber
- /**
- * Set First number
- *
- * This function sets the first number
- * to the value passed to the function
- *
- * @access private
- * @param integer $value The first number value.
- * @return object $this The self object
- */
- private function setFirstNumber($value)
- {
- $this->firstNumber = (int)$value;
- return $this;
- }
- // }}}
- // {{{ private function setSecondNumber
- /**
- * Sets the second number
- *
- * This function sets the second number
- * with the value passed to it.
- *
- * @access private
- * @param integer $value The second number new value.
- * @return object $this The self object
- */
- private function setSecondNumber($value)
- {
- $this->secondNumber = (int)$value;
- return $this;
- }
- // }}}
- // {{{ private function setOperation
- /**
- * Set operation
- *
- * This variable sets the operation variable
- * by taking the firstNumber, secondNumber and operator
- *
- * @access private
- * @see $this->operation
- */
- private function setOperation()
- {
- $this->operation = $this->getFirstNumber() . ' ' .
- $this->operator . ' ' .
- $this->getSecondNumber();
- return $this;
- }
- // }}}
- // {{{ private function generateNumber
- /**
- * Generate a number
- *
- * This function takes the parameters that are in
- * the $this->maxValue and $this->minValue and get
- * the random number from them using mt_rand()
- *
- * @access private
- * @return integer Random value between minValue and maxValue
- */
- private function generateNumber()
- {
- return mt_rand($this->minValue, $this->maxValue);
- }
- // }}}
- // {{{ private function doAdd
- /**
- * Adds values
- *
- * This function will add the firstNumber and the
- * secondNumber value and then call setAnswer to
- * set the answer value.
- *
- * @access private
- * @see $this->firstNumber, $this->secondNumber, $this->setAnswer()
- */
- private function doAdd()
- {
- $answer = $this->getFirstNumber() + $this->getSecondNumber();
- $this->setAnswer($answer);
- }
- // }}}
- // {{{ private function doMultiplication
- /**
- * Do Multiplication
- *
- * This method will multiply two numbers
- *
- * @access private
- * @see $this->firstNumber, $this->secondNumber, $this->setAnswer
- *
- */
- private function doMultiplication()
- {
- $this->setAnswer($this->getFirstNumber() * $this->getSecondNumber());
- }
- // }}}
- // {{{ private function doDivision
- /**
- * Do Division
- *
- * This function executes a division based on the two
- * numbers.
- *
- * @param integer $firstNumber The first number of the operation.
- * This is by default set to null.
- *
- * @param integer $secondNumber The second number of the operation
- * This is by default set to null.
- *
- */
- private function doDivision($firstNumber = null, $secondNumber = null)
- {
- if (is_null($firstNumber)) {
- $firstNumber = $this->getFirstNumber();
- }
-
- if (is_null($secondNumber)) {
- $secondNumber = $this->getSecondNumber();
- }
-
- if ($secondNumber == 0) {
- ++$secondNumber;
- $this->doDivision($firstNumber, $secondNumber);
- return;
- }
-
- if ($firstNumber % $secondNumber != 0) {
- --$firstNumber;
- --$secondNumber;
-
- $this->doDivision($firstNumber, $secondNumber);
- return;
- }
-
- $this->setFirstNumber($firstNumber)
- ->setSecondNumber($secondNumber)
- ->setOperation()
- ->setAnswer($this->getFirstNumber() / $this->getSecondNumber());
- }
- // }}}
- // {{{ private function doModulus
- /**
- * Do modulus
- *
- * This method will do a modulus operation between two numbers
- *
- *
- * @access private
- * @see $this->firstNumber, $this->secondNumber, $this->setAnswer()
- *
- */
- private function doModulus()
- {
- $this->setAnswer($this->getFirstNumber() % $this->getSecondNumber());
- }
- // }}}
- // {{{ private function doSubstract
- /**
- * Does a substract on the values
- *
- * This function executes a substraction on the firstNumber
- * and the secondNumber to then call $this->setAnswer to set
- * the answer value.
- *
- * If the firstnumber value is smaller than the secondnumber value
- * then we regenerate the first number and regenerate the operation.
- *
- * @access private
- * @see $this->firstNumber, $this->secondNumber, $this->setAnswer()
- */
- private function doSubstract()
- {
- $first = $this->getFirstNumber();
- $second = $this->getSecondNumber();
-
- /**
- * Check if firstNumber is smaller than secondNumber
- */
- if ($first < $second) {
- $this->setFirstNumber($second)
- ->setSecondNumber($first)
- ->setOperation();
- }
-
- $answer = $this->getFirstNumber() - $this->getSecondNumber();
- $this->setAnswer($answer);
- }
- // }}}
- // {{{ private function generateOperation
- /**
- * Generate the operation
- *
- * This function will call the setOperation() function
- * to set the operation string that will be called
- * to display the operation, and call the function necessary
- * depending on which operation is set by this->operator.
- *
- * @access private
- * @see $this->setOperation(), $this->operator
- */
- private function generateOperation()
- {
- $this->setOperation();
-
- switch ($this->operator) {
- case '+':
- $this->doAdd();
- break;
- case '-':
- $this->doSubstract();
- break;
- case '*':
- $this->doMultiplication();
- break;
- case '%':
- $this->doModulus();
- break;
- case '/':
- $this->doDivision();
- break;
- default:
- $this->doAdd();
- break;
- }
- }
- // }}}
- // {{{ public function getOperation
- /**
- * Get operation
- *
- * This function will get the operation
- * string from $this->operation
- *
- * @access public
- * @return string The operation String
- */
- public function getOperation()
- {
- return $this->operation;
- }
- // }}}
- // {{{ public function getAnswer
- /**
- * Get the answer value
- *
- * This function will retrieve the answer
- * value from this->answer and return it so
- * we can then display it to the user.
- *
- * @access public
- * @return string The operation answer value.
- */
- public function getAnswer()
- {
- return $this->answer;
- }
- // }}}
- // {{{ public function getFirstNumber
- /**
- * Get the first number
- *
- * This function will get the first number
- * value from $this->firstNumber
- *
- * @access public
- * @return integer $this->firstNumber The firstNumber
- */
- public function getFirstNumber()
- {
- return $this->firstNumber;
- }
- // }}}
- // {{{ public function getSecondNumber
- /**
- * Get the second number value
- *
- * This function will return the second number value
- *
- * @access public
- * @return integer $this->secondNumber The second number
- */
- public function getSecondNumber()
- {
- return $this->secondNumber;
- }
- // }}}
-}
-// }}}
-?>
Deleted: XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/NumeralInterface.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/NumeralInterface.php 2014-04-25 14:05:48 UTC (rev 12496)
+++ XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/birthday/class/NumeralInterface.php 2014-04-25 14:12:07 UTC (rev 12497)
@@ -1,102 +0,0 @@
-<?php
-// {{{ Disclaimer
-// +----------------------------------------------------------------------+
-// | PHP version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 David Coallier |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of David Coallier nor the names of his contributors |
-// | may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: David Coallier <da...@ag...> |
-// +----------------------------------------------------------------------+
-// }}}
-// {{{ Text_CAPTCHA_Numeral_Interface
-/**
- * Text CAPTCHA Numeral Interface
- *
- * This is the textcaptchanumeral interface
- * that is called everytime a new instance of
- * Text_CAPTCHA_Numeral is called.
- *
- * @author David Coallier <da...@ag...>
- * @package Text_CAPTCHA_Numeral
- * @category CAPTCHA
- */
-interface birthday_Text_CAPTCHA_Numeral_Interface
-{
- // {{{ public function getOperation
- /**
- * Get operation
- *
- * This function will get the operation
- * string from $this->operation
- *
- * @access public
- */
- public function getOperation();
- // }}}
- // {{{ public function getAnswer
- /**
- * Get the answer value
- *
- * This function will retrieve the answer
- * value from this->answer and return it so
- * we can then display it to the user.
- *
- * @access public
- */
- public function getAnswer();
- // }}}
- // {{{ public function getFirstNumber
- /**
- * Get the first number
- *
- * This function ...
[truncated message content] |