From: <zy...@us...> - 2014-11-26 07:33:46
|
Revision: 12873 http://sourceforge.net/p/xoops/svn/12873 Author: zyspec Date: 2014-11-26 07:33:36 +0000 (Wed, 26 Nov 2014) Log Message: ----------- - commit files missing in previous commit Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php Added Paths: ----------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/contact_block_stats.tpl XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/index.html Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2014-11-26 07:12:14 UTC (rev 12872) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -75,7 +75,7 @@ $column = $contact_handler->contactCleanVars($_POST, 'column', 'contact_mail', 'string'); $valid_column = in_array(trim($column), array('contact_icq', 'contact_mail', 'contact_phone', 'contact_url')); $column = ($valid_column) ? trim($column) : 'contact_mail'; - $timestamp = $contact_handler->contactCleanVars($_POST, 'timestamp', formatTimestamp(xoops_getUserTimestamp(time()), _SHORTDATESTRING), 'string'); + $timestamp = $contact_handler->contactCleanVars($_POST, 'timestamp', formatTimestamp(xoops_getUserTimestamp(time()), 's'), 'string'); $log = $contact_handler->contactLogs($column, $timestamp); /* $timestamp = $contact_handler->contactCleanVars($_POST, 'timestamp', xoops_getUserTimestamp(time()), 'date'); Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/index.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/index.html (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/index.html 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1 @@ +<script>history.go(-1);</script> Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,80 @@ +<?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. +*/ +/** + * Contact stats.php + * + * Xoops Contact - a database driven Contact form + * Displays contact statistics in a block. + * + * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package:: contact + * @subpackage:: blocks + * @author:: zyspec <owners@zyspec> + * @version:: $Id: $ + * @since:: 1.82 + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * + * Show Contact Us stats block + * + * @uses xoops_getmodulehandler + * @uses CriteriaCompo + * @uses ContactContact + * @uses ContactContactHandler + * @param array $options + * + * @return array with count of noreplies, replies & total + */ +function b_contact_stats_show($options) +{ + $dirname = basename(dirname(__DIR__)); + + $block = array(); + + $contact_handler =& xoops_getmodulehandler('contact', $dirname); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('contact_cid', 0)); + $criteria->add(new Criteria('contact_type', 'Contact')); + $criteria->setGroupby('contact_reply'); + $msgCountArray = $contact_handler->getCounts($criteria); + if ((is_array($msgCountArray) && count($msgCountArray) > 0)) { + $block['noreplies'] = (isset($msgCountArray[0])) ? $msgCountArray[0] : 0; + $block[ 'replies'] = (isset($msgCountArray[1])) ? $msgCountArray[1] : 0; + $block[ 'total'] = $block['noreplies'] + $block['replies']; + + // if using departments show number of contacts per department + include_once $GLOBALS['xoops']->path( "modules/{$dirname}/include/functions.php"); +// include_once '../include/functions.php'; + $moduleMgr = contactGetModuleManager(); + if ($moduleMgr->config['form_dept']) { +/* + $module_handler =& xoops_gethandler('module'); + $module =& $module_handler->getByDirname($dirname); + $config_handler =& xoops_gethandler('config'); + $contactConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); + if ($contactConfig['form_dept']) { +*/ + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('contact_cid', 0)); + $criteria->add(new Criteria('contact_type', 'Contact')); + $criteria->setGroupby('contact_department'); + $depts = $contact_handler->getCounts($criteria); + if ((is_array($depts) && count($depts) > 0)) { + $block['depts'] = $depts; + } + } + } + return $block; +} \ No newline at end of file Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,143 @@ +<?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. +*/ + +/** + * Contact form element for form input + * + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL 2} + * @package contact + * @subpackage class + * @since 1.82 + * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ + * @author ZySpec <ow...@zy...> + * @version $Id: $ + */ + +defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * A simple HTML5 type validated input field + */ +class ContactFormValidatedInput extends XoopsFormText +{ + + /** + * Initial type + * + * @var string + * @access private + */ + private $_type; + + /** + * Valid HTML Type array + * + * @var string + * @access private + */ + private $_htmlTypes; + + /** + * Constructor + * + * @param string $caption Caption + * @param string $name "name" attribute + * @param int $size Size + * @param int $maxlength Maximum length of text + * @param string $value Initial text + */ + function __construct($caption, $name, $size, $maxlength, $value = '', $type='text') + { + $this->_htmlTypes = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'range', + 'search', 'tel', 'text', 'time', 'url', 'week'); + $this->setCaption($caption); + $this->setName($name); + $this->_size = intval($size); + $this->_maxlength = intval($maxlength); + $this->setValue($value); + $this->setType($type); + } + + function ContactFormValidatedInput(&$caption, &$name, &$size, &$maxlength, &$value = '', &$type) + { + self::__construct($caption, $name, $size, $maxlength, $value, $type); + } + + /** + * + * XoopsFormText method is included here as an override for the base class (XoopsFormText) + */ + function XoopsFormText(&$caption, &$name, &$size, &$maxlength, $value='') + { + self::__construct($caption, $name, $size, $maxlength, $value, 'text'); + } + + /** + * Get type information value + * + * @return string + */ + function getType() + { + return $this->_type; + } + + /** + * Get HTML types supported + * + * @return array + */ + function getHtmlTypes() + { + return $this->_htmlTypes; + } + + /** + * Set initial text value + * + * @param string|array $value is string, set value; value is array then keys are ('type', 'min', 'max') + */ + function setType($value) + { + if (isset($value)) { + if (is_array($value)) { + $value = isset($value['type']) ? mb_strtolower($value['type']) : 'text'; + $this->_type = in_array($value, $this->_htmlTypes) ? $value : 'text'; + if (in_array($value['type'], array('number', 'date', 'range'))) { + if (isset($value['min'])) { + $this->setExtra("min=" . $value['min']); + } + if (isset($value['max'])) { + $this->setExtra("max=" . $value['max']); + } + } + } else { + $value = isset($value) ? mb_strtolower($value) : 'text'; + $this->_type = in_array($value, $this->_htmlTypes) ? $value : 'text'; + } + } else { + $this->_type = 'text'; + } + } + + /** + * Prepare HTML for output + * + * @return string HTML + */ + function render() + { + $myClasses = $this->getClass(); + $classes = ($myClasses) ? " class='{$myClasses}'" : ""; + return "<input type='" . $this->_type . "' name='" . $this->getName() . "' title='" . $this->getTitle() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $classes . $this->getExtra() . " />"; + } +} Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,51 @@ +<?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. +*/ +/** + * Contact - waiting.php + * + * English language defines for Waiting Module support + * + * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package:: contact + * @subpackage:: plugin + * @author:: XOOPS Module Development Team + * @since:: 1.82 + * @version:: $Id: $ + */ +function b_waiting_contact() +{ +// $contactDB =& XoopsDatabaseFactory::getDatabaseConnection(); + + $block = array(); + + $module_handler =&xoops_gethandler('module'); + $contactModule =&$module_handler->getByDirname('contact'); + $config_handler =& xoops_gethandler('config'); + $contactModuleConfigs =& $config_handler->getConfigsByCat(0, $contactModule->getVar('mid')); + + //check to see if module is active, return if not... + if ($contactModule->isactive()) { + // setup the contact messages + $contact_handler = & xoops_getModuleHandler('contact', 'contact'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('contact_cid', 0, '=')); //don't include replies + $criteria->add(new Criteria('contact_reply', 0, '=')); // only include messages that haven't had a reply + $messageCount = $contact_handler->getCount($criteria); + if ($messageCount) { + $block = array('adminlink' => $GLOBALS['xoops']->url("www/modules/contact/admin/contact.php"), + 'pendingnum' => $messageCount, + 'lang_linkname' => _PI_CONTACT_WAITING_REPLY + ); + } + } + return $block; +} Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,27 @@ +<?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. +*/ +/** + * Contact - blocks.php + * + * English language defines for Waiting Module Blocks + * + * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package:: contact + * @subpackage:: library + * @author:: XOOPS Module Development Team + * @since:: 1.82 + * @version:: $Id: $ + */ +define('_MB_CONTACT_REPLIES', "Replies"); +define('_MB_CONTACT_NOREPLIES', "No Replies"); +define('_MB_CONTACT_TOTAL', "Total"); +define('_MB_CONTACT_BYDEPT', "By Department"); Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,22 @@ +<div id="help-template" class="outer"> + <h1 class="head">Help: + <a class="ui-corner-all tooltip" href="<{$xoops_url}>/modules/contact/admin/index.php" + title="Back to the administration of Contact"> Contact + <img src="<{xoAdminIcons home.png}>" + alt="Back to the Administration of Contact"/> + </a></h1> + + <h4 class="odd">Contact Module</h4> + <p style='margin: 1em 0;'>This module includes the following features:</p> + <ul> + <li style='height: 1.3em;'>Automatically emails contact form to requested contact</li> + <li style='height: 1.3em;'>Allows Administrator to reply to message from module control panel</li> + <li style='height: 1.3em;'>Stores Contact submission in database</li> + <li style='height: 1.3em;'>Allows Administrator to select type of information to collect (URL, Company Name, Location, Address, Phone, etc.) + <li style='height: 1.3em;'>Supports contacting departments</li> + <li style='height: 1.3em;'>Form Captcha based on site settings</li> + <li style='height: 1.3em;'>Ability to require anonymous users to enter email twice on form to ensure it was entered correctly</li> + <li style='height: 1.3em;'>Provides log of users who have filled out Contact form</li> + <li style='height: 1.3em;'>Allows Administrator to prune (delete) messages from the database</li> + </ul> +</div> \ No newline at end of file Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php 2014-11-26 07:33:36 UTC (rev 12873) @@ -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. +*/ +/** + * Contact - waiting.php + * + * English language defines for Waiting Module support + * + * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package:: contact + * @subpackage:: library + * @author:: XOOPS Module Development Team + * @since:: 1.82 + * @version:: $Id: $ + */ +define('_PI_CONTACT_WAITING_REPLY', "Waiting Replies"); Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/contact_block_stats.tpl =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/contact_block_stats.tpl (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/contact_block_stats.tpl 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1,11 @@ +<ul> +<li><{$block.replies}> : <{$smarty.const._MB_CONTACT_REPLIES}></li> +<li><{$block.noreplies}> : <{$smarty.const._MB_CONTACT_NOREPLIES}></li> +<li><{$block.total}> : <{$smarty.const._MB_CONTACT_TOTAL}></li> +</ul> +<div class='inline bolder'><{$smarty.const._MB_CONTACT_BYDEPT}></div> +<{foreach from=$block.depts key=dept item=qty name=deptlp}> +<{if $smarty.foreach.deptlp.first}><ul><{/if}> +<li><{$dept}> : <{$qty}></li> +<{if $smarty.foreach.deptlp.last}></ul><{/if}> +<{/foreach}> Added: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/index.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/index.html (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/blocks/index.html 2014-11-26 07:33:36 UTC (rev 12873) @@ -0,0 +1 @@ +<script>history.go(-1);</script> |
From: <zy...@us...> - 2014-12-21 01:28:31
|
Revision: 12911 http://sourceforge.net/p/xoops/svn/12911 Author: zyspec Date: 2014-12-21 01:28:20 +0000 (Sun, 21 Dec 2014) Log Message: ----------- - updated admin footer to be similar to other modules - changed to use exit() instead of die() for consistency - use XoopsRequest instead of custom function Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php Added Paths: ----------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/license.txt Removed Paths: ------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/licence.txt Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -22,4 +22,14 @@ * @version $Id$ */ +echo "<div class='adminfooter'>\n" + . " <div class='center'>\n" + . " <a href='" . $GLOBALS['xoopsModule']->getInfo('author_website_url') . "' target='_blank'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' title='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' /></a>\n" + . " </div>\n" + . " <div class='center smallsmall italic pad5'>\n" + . " " . _AM_CONTACT_MAINTAINED_BY + . " <a class='tooltip' rel='external' href='http://" . $GLOBALS['xoopsModule']->getInfo('module_website_url') . "' " + . "title='" . _AM_CONTACT_MAINTAINED_TITLE . "'>" . _AM_CONTACT_MAINTAINED_TEXT . "</a>\n" + . " </div>\n" + . "</div>"; xoops_cp_footer(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -27,8 +27,8 @@ // Display Admin header xoops_cp_header(); // Define default value -$op = $contact_handler->contactCleanVars($_REQUEST, 'op', 'list', 'string'); -$contactId = $contact_handler->contactCleanVars($_REQUEST, 'id', '0', 'int'); +$op = XoopsRequest::getString('op', 'list'); +$contactId = XoopsRequest::getInt('id', '0'); $level = ''; // Define scripts @@ -59,8 +59,8 @@ 'sort' => 'contact_id' ); $pageSettingsObj = (object) $pageSettings; //cast contact to a stdClass object - $pageSettingsObj->limit = (isset($_REQUEST['limit'])) ? $contact_handler->contactCleanVars($_REQUEST, 'limit', 0, 'int') : $pageSettingsObj->perpage; - $pageSettingsObj->start = (isset($_REQUEST['start'])) ? $contact_handler->contactCleanVars($_REQUEST, 'start', 0, 'int') : 0; + $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); + $pageSettingsObj->start = XoopsRequest::getInt('start', 0); $contactCount = $contact_handler->contactGetCount('contact_cid'); //count all contacts Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -27,7 +27,7 @@ // Display Admin header xoops_cp_header(); // Define default value -$op = $contact_handler->contactCleanVars($_REQUEST, 'op', 'form', 'string'); +$op = XoopsRequest::getCmd('op', 'form'); switch ($op) { case 'form': @@ -72,17 +72,11 @@ xoops_loadLanguage('main', 'contact'); redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); } - $column = $contact_handler->contactCleanVars($_POST, 'column', 'contact_mail', 'string'); + $column = XoopsRequest::getWord('column', 'contact_mail', 'POST'); $valid_column = in_array(trim($column), array('contact_icq', 'contact_mail', 'contact_phone', 'contact_url')); $column = ($valid_column) ? trim($column) : 'contact_mail'; - $timestamp = $contact_handler->contactCleanVars($_POST, 'timestamp', formatTimestamp(xoops_getUserTimestamp(time()), 's'), 'string'); + $timestamp = XoopsRequest::getString('timestamp', formatTimestamp(xoops_getUserTimestamp(time()), 's'), 'POST'); $log = $contact_handler->contactLogs($column, $timestamp); -/* - $timestamp = $contact_handler->contactCleanVars($_POST, 'timestamp', xoops_getUserTimestamp(time()), 'date'); - $server_timestamp = userTimeToServerTime($timestamp, $GLOBALS['xoopsUser']->getVar('timezone_offset')); - $abs_timestamp = xoops_getUserTimestamp($server_timestamp, 0); - $log = $contact_handler->contactLogs($column, $abs_timestamp); -*/ if (!$log) { $log = array(_AM_CONTACT_LOGS_NOTHING_HERE); } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -22,7 +22,7 @@ * @version $Id$ */ -// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined"); +// defined("XOOPS_ROOT_PATH") || exit("Restricted access"); $module_handler = xoops_gethandler('module'); $module = $module_handler->getByDirname(basename(dirname(__DIR__))); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -28,7 +28,7 @@ // Display Admin header xoops_cp_header(); // Define default value -$op = $contact_handler->contactCleanVars($_REQUEST, 'op', 'list', 'string'); +$op = XoopsRequest::getCmd('op', 'list'); switch ($op) { case 'list': @@ -65,7 +65,7 @@ redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); } $onlyreply = (isset($_POST['onlyreply'])) ? 1 : 0; - $prune_date = $contact_handler->contactCleanVars($_POST, 'prune_date', formatTimestamp(xoops_getUserTimestamp(time())), 'string'); + $prune_date = XoopsRequest::getWord('prune_date', formatTimestamp(xoops_getUserTimestamp(time())), 'POST'); ob_start(); xoops_confirm(array('op' => 'prune_ok', 'prune_date' => $prune_date, @@ -89,8 +89,11 @@ redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); } - $timestamp = $contact_handler->contactCleanVars($_POST, 'prune_date', xoops_getUserTimestamp(time()), 'date'); - $onlyreply = (bool) $contact_handler->contactCleanVars($_POST, 'onlyreply', 0, 'int'); + $timeRequest = XoopsRequest::getString('prune_date', 0); + $timestamp = ($timeRequest) ? strtotime($timeRequest) : xoops_getUserTimestamp(time()); + $onlyreply = XoopsRequest::getBool('onlyreply', false, 'POST'); +// $timestamp = $contact_handler->contactCleanVars($_POST, 'prune_date', xoops_getUserTimestamp(time()), 'date'); +// $onlyreply = (bool) $contact_handler->contactCleanVars($_POST, 'onlyreply', 0, 'int'); $count = (int) $contact_handler->deleteBeforeDate($timestamp, $onlyreply); redirect_header('prune.php', 2, sprintf(_AM_CONTACT_MSG_PRUNE_DELETED, $count)); xoops_cp_footer(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -23,7 +23,7 @@ * @since:: 1.82 */ -defined('XOOPS_ROOT_PATH') or die('Restricted access'); +defined('XOOPS_ROOT_PATH') or exit('Restricted access'); /** * @@ -77,4 +77,4 @@ } } return $block; -} \ No newline at end of file +} Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -22,7 +22,7 @@ * @version $Id: $ */ -//defined("XOOPS_ROOT_PATH") || die("Restricted Access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); +//defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); class Contact extends XoopsObject { @@ -96,11 +96,11 @@ // XOOPS user so don't allow entry of name/email (changed in v1.82) $form->addElement(new XoopsFormHidden('contact_name', $contact_name)); $form->addElement(new XoopsFormHidden('contact_mail', $contact_mail)); - /** @internal re-enable following code (and disable previous) if you want XoopsUser to edit their name/email */ - /* + /** @internal re-enable following code (and disable previous) if you want XoopsUser to edit their name/email */ + /* $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_NAME, 'contact_name', 50, 255, $contact_name), true); $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_MAIL, 'contact_mail', 50, 255, $contact_mail, 'email'), true); - */ + */ } else { $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_NAME, 'contact_name', 50, 255, $contact_name), true); $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_MAIL, 'contact_mail', 50, 255, $contact_mail, 'email'), true); @@ -239,6 +239,7 @@ /** * Get variables passed by $_GET, $_POST, or unknown ($_REQUEST) * + * @deprecated in v1.82 Beta 2 * @param array $global * @param string $key array key to clean (e.g. id) * @param mixed $default key's default value if invalid/no input @@ -400,9 +401,9 @@ $toEmails = array_merge(array($toEmails), $deptEmailAddresses); } } else { // does not use departments or department field does not contain valid email addresses - if (!empty($mailObj->contact_namefrom)) { //take value from ReplyForm, if valid + if (!empty($mailObj->contact_namefrom)) { //take value from ReplyForm, if valid $fromName = $mailObj->contact_namefrom; - } elseif ($GLOBALS['xoopsConfig']['sitename']) { // or take site name if set + } elseif ($GLOBALS['xoopsConfig']['sitename']) { // or take site name if set $fromName = html_entity_decode($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES, 'UTF-8'); } elseif ($GLOBALS['xoopsUser']->uname()) { // or finally use this user's uname $fromName = $GLOBALS['xoopsUser']->uname(); @@ -508,7 +509,7 @@ * Get Count by dB column * @param string $column dB column to count for Contact * - * @return mixed false on failure, integer count of column items + * @return bool|int false on failure, integer count of column items */ public function contactGetCount($column) { @@ -527,7 +528,7 @@ * Get Insert ID * * @deprecated - * @return mixed false on failure, integer of item Id + * @return bool|int false on failure, integer of item Id */ public function getInsertId() { @@ -672,14 +673,14 @@ return array_unique($ret); } - /** - * - * Format Reply message body - adds original message to reply - * @param object $mailObj must include 'contact_orig_message', ['contact_message'] keys - * @param bool $inc_orig true: include original message body in reply, false: don't - * - * @return string reply message body - */ + /** + * + * Format Reply message body - adds original message to reply + * @param object $mailObj must include 'contact_orig_message', ['contact_message'] keys + * @param bool $inc_orig true: include original message body in reply, false: don't + * + * @return string reply message body + */ public function replyBodyFormat(stdClass &$mailObj, $inc_orig=false) { if ($inc_orig) { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -22,7 +22,7 @@ * @version $Id: $ */ -defined('XOOPS_ROOT_PATH') || die('Restricted access'); +defined('XOOPS_ROOT_PATH') || exit('Restricted access'); /** * A simple HTML5 type validated input field Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2014-12-21 01:28:20 UTC (rev 12911) @@ -1,5 +1,12 @@ -Version 1.82 from 2014-11-25 + +Version 1.82 from 2014-12-03 Beta 2 ================================= +- Replaced ContactContact->contactCleanVars function with XoopsRequest +- changed to use exit() instead of die() for consistency +- minor phpdocumentor updates + +Version 1.82 from 2014-11-25 Beta 1 +================================= - Added ability to require visitors to enter email 2X on form (ZySpec) - Added features page to Admin help (ZySpec) - Added date select to Admin log form (ZySpec) Deleted: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/licence.txt =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/licence.txt 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/licence.txt 2014-12-21 01:28:20 UTC (rev 12911) @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. Copied: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/license.txt (from rev 12872, XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/licence.txt) =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/license.txt (rev 0) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/license.txt 2014-12-21 01:28:20 UTC (rev 12911) @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -21,7 +21,7 @@ * @version $Id: $ */ -defined("XOOPS_ROOT_PATH") || die("Restricted Access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); +defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); /** * Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -31,7 +31,7 @@ || !($GLOBALS['xoopsUser'] instanceof XoopsUser) || !($GLOBALS['xoopsUser']->IsAdmin())) { - die("Restricted Access - " . basename($_SERVER['PHP_SELF']) . PHP_EOL); + exit("Restricted access - " . basename($_SERVER['PHP_SELF']) . PHP_EOL); } function rmmdir($dir) Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -26,9 +26,12 @@ //unset($_SESSION); include $GLOBALS['xoops']->path("/header.php"); -$op = $contact_handler->contactCleanVars($_POST, 'op', 'form', 'string'); -$department = $contact_handler->contactCleanVars($_GET, 'contact_department', '', 'string'); +$op = XoopsRequest::getCmd('op', 'form', 'POST'); +$department = XoopsRequest::getString('contact_department', '', 'GET'); +//$op = $contact_handler->contactCleanVars($_POST, 'op', 'form', 'string'); +//$department = $contact_handler->contactCleanVars($_GET, 'contact_department', '', 'string'); + switch ($op) { case 'save': if (empty($_POST['submit']) ) { @@ -57,7 +60,7 @@ $xoopsCaptcha = XoopsCaptcha::getInstance(); if (!$xoopsCaptcha->verify()) { $err[] = $xoopsCaptcha->getMessage(); - redirect_header("index.php", 2, $xoopsCaptcha->getMessage()); + redirect_header("index.php", 2, $xoopsCaptcha->getMessage()); exit(); } @@ -65,14 +68,18 @@ } // check email - $contact_mail = $contact_handler->contactCleanVars($_POST, 'contact_mail', '', 'mail'); - if ('' == $contact_mail) { + $input_mail = XoopsRequest::getString('contact_mail', '', 'POST'); + $contact_mail = checkEmail($input_mail); +// $contact_mail = $contact_handler->contactCleanVars($_POST, 'contact_mail', '', 'mail'); + if (empty($contact_mail)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); exit(); } elseif (!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['form_req_email2']) { - $contact_mail2 = $contact_handler->contactCleanVars($_POST, 'contact_mail2', '', 'mail'); - if ('' == $contact_mail2) { + $input_mail2 = XoopsRequest::getString('contact_mail2', '', 'POST'); + $contact_mail2 = checkEmail($input_mail2); +// $contact_mail2 = $contact_handler->contactCleanVars($_POST, 'contact_mail2', '', 'mail'); + if (empty($contact_mail2)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL2); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); exit(); @@ -106,11 +113,11 @@ } redirect_header($GLOBALS['xoops']->url('www'), 3, $message); - exit(); + exit(); } break; - case 'form'; + case 'form'; default: $contactObj = $contact_handler->create(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php 2014-12-19 22:36:32 UTC (rev 12910) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php 2014-12-21 01:28:20 UTC (rev 12911) @@ -4,6 +4,10 @@ define('_AM_CONTACT_INDEX_NOREPLIES', "There are <span class='red'>%s</span> Messages with no replies in our database"); define('_AM_CONTACT_INDEX_REPLIES', "There are <span class='green'>%s</span> total Replies in our database"); define('_AM_CONTACT_INDEX_TOTAL', "There are <span class='green'>%s</span> total Messages in our database"); +// Text for Admin footer +define('_AM_CONTACT_MAINTAINED_BY', "XOOPS Contact is maintained by the"); +define('_AM_CONTACT_MAINTAINED_TITLE', "Visit XOOPS Community"); +define('_AM_CONTACT_MAINTAINED_TEXT', "XOOPS Community"); // Contact define('_AM_CONTACT_ID', "Id"); define('_AM_CONTACT_SUBJECT', "Subject"); @@ -59,4 +63,4 @@ define('_AM_CONTACT_LOGS_COLUMN_PHONE', "Phone"); define('_AM_CONTACT_LOGS_COLUMN_URL', "URL"); define('_AM_CONTACT_LOGS_NOTHING_HERE', "There are no items meeting this criteria."); -define('_AM_CONTACT_LOGS_BEFORE_DATE', "Show log of authors before"); \ No newline at end of file +define('_AM_CONTACT_LOGS_BEFORE_DATE', "Show log of authors before"); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html 2014-12-19 22:36:32 UTC (rev 12910) +++ Xoop... [truncated message content] |
From: <zy...@us...> - 2015-01-28 19:42:55
|
Revision: 12951 http://sourceforge.net/p/xoops/svn/12951 Author: zyspec Date: 2015-01-28 19:42:52 +0000 (Wed, 28 Jan 2015) Log Message: ----------- * Improved module update script to add some error reporting on failure(s) * Fixed bug in subdirectory removal script on update * added KEY(s) to dB table to improve search performance * changed ContactContactHandler->infoProcessing() to use XoopsRequest * sort departments alphabetically when displayed on contact form * Replaced "Reply" text in admin (./admin/contact.php) with icons * Changed "Submitter" information in admin to be able to email from contact page * Improved ContactContact->contactSendMail() method to improve anti-spam score * Minor source code formatting cleanup Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/about.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/assets/index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/ajax.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/sql/mysql.sql XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/admin/contact_contact.tpl XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/contact_index.tpl XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/about.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/about.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/about.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -29,6 +29,8 @@ include_once $GLOBALS['xoops']->path('www/class/pagenav.php'); include_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); +xoops_load('XoopsRequest'); + $thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); // Load language files @@ -36,8 +38,8 @@ xoops_loadLanguage('modinfo', $thisModuleDir); xoops_loadLanguage('main', $thisModuleDir); -$pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons16')); -$pathIcon32 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons32')); +$pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons16')); +$pathIcon32 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons32')); $pathModuleAdmin = $GLOBALS['xoops']->path('www/' . $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin')); require_once "{$pathModuleAdmin}/moduleadmin/moduleadmin.php"; $admin_class = new ModuleAdmin(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -53,18 +53,15 @@ switch ($op) { case 'list': default: + $pageSettingsObj = new stdClass(); // create a new stdClass object + $pageSettingsObj->perpage = (int) $GLOBALS['xoopsModuleConfig']['admin_perpage']; + $pageSettingsObj->order = 'DESC'; + $pageSettingsObj->sort = 'contact_id'; + $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); + $pageSettingsObj->start = XoopsRequest::getInt('start', 0); - $pageSettings = array('perpage' => $GLOBALS['xoopsModuleConfig']['admin_perpage'], - 'order' => 'DESC', - 'sort' => 'contact_id' - ); - $pageSettingsObj = (object) $pageSettings; //cast contact to a stdClass object - $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); - $pageSettingsObj->start = XoopsRequest::getInt('start', 0); - - $contactCount = $contact_handler->contactGetCount('contact_cid'); //count all contacts - $contacts = $contact_handler->getAdminList($pageSettingsObj, 'contact_cid'); + $contacts = $contact_handler->getAdminList($pageSettingsObj, 'contact_cid'); if ($contactCount > $pageSettingsObj->limit) { $contactPageNavObj = new XoopsPageNav($contactCount, $pageSettingsObj->limit, $pageSettingsObj->start, 'start', 'limit=' . $pageSettingsObj->limit); @@ -81,7 +78,6 @@ break; case 'reply': - if ($contactId > 0) { $obj = $contact_handler->get($contactId); if (!($obj instanceof contact) || (0 != $obj->getVar('contact_cid'))) { @@ -101,8 +97,7 @@ break; case 'doreply': - - $formInput = $contact_handler->infoProcessing($_POST); + $formInput = $contact_handler->infoProcessing('POST'); $mailObj = (object) $formInput; unset($formInput); $deptEmails = array(); @@ -150,7 +145,6 @@ break; case 'view': - $obj = $contact_handler->get($contactId); if (!$obj) { @@ -172,7 +166,6 @@ break; case 'delete': - if (!$contactId) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); exit(); @@ -183,7 +176,6 @@ break; case 'dodelete': - // check to make sure this passes form submission security if ( ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) ) { if ( !$GLOBALS['xoopsSecurity']->check() ) { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -25,7 +25,7 @@ if (!empty($_POST)) { // Info Processing - $mailFormContents = $contact_handler->infoProcessing($_POST); + $mailFormContents = $contact_handler->infoProcessing('POST''); $mailObj = (object) $mailFormContents; // Save info $contactObj = $contact_handler->create(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/assets/index.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/assets/index.html 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/assets/index.html 2015-01-28 19:42:52 UTC (rev 12951) @@ -1 +1,2 @@ - <script>history.go(-1);</script> \ No newline at end of file + +<script>history.go(-1);</script> \ No newline at end of file Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact stats.php * @@ -58,7 +58,6 @@ include_once $GLOBALS['xoops']->path( "modules/{$dirname}/include/functions.php"); // include_once '../include/functions.php'; $moduleMgr = contactGetModuleManager(); - if ($moduleMgr->config['form_dept']) { /* $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname($dirname); @@ -66,6 +65,7 @@ $contactConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); if ($contactConfig['form_dept']) { */ + if ($moduleMgr->config['form_dept']) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0)); $criteria->add(new Criteria('contact_type', 'Contact')); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -23,7 +23,6 @@ */ //defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); - class Contact extends XoopsObject { @@ -131,10 +130,14 @@ // show a drop down with the departments listed $departmentlist = new XoopsFormSelect(_MD_CONTACT_DEPARTMENT, 'contact_department'); $departments = $GLOBALS['xoopsModuleConfig']['contact_dept']; + $listOptions = array(); foreach ($departments as $val) { $valexplode = explode(',', $val); - $departmentlist->addOption($valexplode[0]); + $listOptions[$valexplode[0]] = $valexplode[0]; +// $departmentlist->addOption($valexplode[0]); } + asort($listOptions); + $departmentlist->addOptionArray($listOptions); $form->addElement($departmentlist); } else { $form->addElement(new XoopsFormHidden('contact_department', '')); @@ -301,41 +304,59 @@ /** * * Clean all the incoming Vars from Form(s) - * @param $global global var array ($_POST, $_GET, $_REQUEST) - * @uses {@link Contact::contactCleanVars} + * @param $global global var array (POST, GET, REQUEST) + * @uses {@link XoopsRequest} * * @return array containing clean versions of form variables */ - public function infoProcessing(&$global) + public function infoProcessing($global) { + xoops_load('XoopsRequest'); $contact = array(); - - $contact['contact_cid'] = $this->contactCleanVars($global, 'contact_id', '', 'int'); - $contact['contact_uid'] = $this->contactCleanVars($global, 'contact_uid', '', 'int'); - $contact['contact_name'] = $this->contactCleanVars($global, 'contact_name', '', 'text'); //mb changed from string to text - $contact['contact_namefrom'] = $this->contactCleanVars($global, 'contact_namefrom', '', 'text'); -// $contact['contact_nameto'] = $this->contactCleanVars($global, 'contact_nameto', '', 'text'); //mb changed from string to text - $contact['contact_subject'] = $this->contactCleanVars($global, 'contact_subject', '', 'text'); //mb changed from string to text - $contact['contact_mailfrom'] = $this->contactCleanVars($global, 'contact_mailfrom', '', 'mail'); - $contact['contact_mail'] = $this->contactCleanVars($global, 'contact_mail', '', 'mail'); - $contact['contact_mail2'] = $this->contactCleanVars($global, 'contact_mail2', '', 'mail'); -// $contact['contact_mailto'] = $this->contactCleanVars($global, 'contact_mailto', '', 'mail'); - $contact['contact_url'] = $this->contactCleanVars($global, 'contact_url', '', 'url'); + if (empty($global)) { // will get from $_REQUEST + $from = null; + } elseif (('POST' == strtoupper($global)) || ('GET' == strtoupper($global))) { + $from = strtoupper($global); // will get specifically from $_GET or $_POST + } else { // don't allow other sources + return $contact; + } + $contact['contact_cid'] = XoopsRequest::getInt('contact_id', '', $from); + $contact['contact_uid'] = XoopsRequest::getInt('contact_uid', '', $from); + $contact['contact_name'] = XoopsRequest::getText('contact_name', '', $from); + $contact['contact_namefrom'] = XoopsRequest::getText('contact_namefrom', '', $from); + /* + $contact['contact_nameto'] = XoopsRequest::getText('contact_nameto', '', $from); + */ + $contact['contact_subject'] = XoopsRequest::getText('contact_subject', '', $from); + $email = XoopsRequest::getText('contact_mailfrom', '', $from); + $contact['contact_mailfrom'] = checkEmail($email); + $email = XoopsRequest::getText('contact_mail', '', $from); + $contact['contact_mail'] = checkEmail($email); + $email = XoopsRequest::getText('contact_mail2', '', $from); + $contact['contact_mail2'] = checkEmail($email); + /* + $email = XoopsRequest::getText('contact_mailto', '', $from); + $contact['contact_mailto'] = checkEmail($email); + */ + $url = XoopsRequest::getText('contact_url', '', $from); + $contact['contact_url'] = (!empty($url)) ? filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) : ''; $contact['contact_create'] = time(); - $contact['contact_icq'] = $this->contactCleanVars($global, 'contact_icq', '', 'text'); //mb changed from string to text - $contact['contact_company'] = $this->contactCleanVars($global, 'contact_company', '', 'text'); //mb changed from string to text - $contact['contact_location'] = $this->contactCleanVars($global, 'contact_location', '', 'text'); - $contact['contact_phone'] = $this->contactCleanVars($global, 'contact_phone', '', 'int'); - $contact['contact_department'] = $this->contactCleanVars($global, 'contact_department', _MD_CONTACT_DEFULTDEP, 'string'); + $contact['contact_icq'] = XoopsRequest::getText('contact_icq', '', $from); + $contact['contact_company'] = XoopsRequest::getText('contact_company', '', $from); + $contact['contact_location'] = XoopsRequest::getText('contact_location', '', $from); + $contact['contact_phone'] = XoopsRequest::getInt('contact_phone', '', $from); + $contact['contact_department'] = XoopsRequest::getText('contact_department', _MD_CONTACT_DEFULTDEP, $from); $contact['contact_ip'] = getenv("REMOTE_ADDR"); - $contact['contact_message'] = $this->contactCleanVars($global, 'contact_message', '', 'text'); - $contact['contact_address'] = $this->contactCleanVars($global, 'contact_address', '', 'text'); - $contact['contact_platform'] = $this->contactCleanVars($global, 'contact_platform', 'Web', 'platform'); - $contact['contact_type'] = $this->contactCleanVars($global, 'contact_type', 'Contact', 'type'); - $contact['send_dept'] = $this->contactCleanVars($global, 'send_dept' , 0, 'int'); - $contact['contact_orig_message'] = $this->contactCleanVars($global, 'contact_orig_message' , '', 'text'); - $contact['inc_orig'] = $this->contactCleanVars($global, 'inc_orig', 0, 'int'); + $contact['contact_message'] = XoopsRequest::getText('contact_message', '', $from); + $contact['contact_address'] = XoopsRequest::getText('contact_address', '', $from); + $platform = XoopsRequest::getText('contact_platform', '', $from); + $contact['contact_platform'] = $this->contactPlatform($platform); + $type = XoopsRequest::getText('contact_type', '', $from); + $contact['contact_type'] = $this->contactType($type); + $contact['send_dept'] = XoopsRequest::getInt('send_dept' , 0, $from); + $contact['contact_orig_message'] = XoopsRequest::getText('contact_orig_message' , '', $from); + $contact['inc_orig'] = XoopsRequest::getInt('inc_orig', 0, $from); return $contact; } @@ -361,17 +382,35 @@ } else { $xoopsMailer->setToEmails($GLOBALS['xoopsConfig']['adminmail']); //just send to admin } + if (!in_array($GLOBALS['xoopsConfig']['adminmail'], $deptEmailAddresses)) { + $xoopsMailer->multimailer->addBCC($GLOBALS['xoopsConfig']['adminmail'], 'TMC Administrator'); + } + xoops_loadLanguage('modinfo', 'contact'); // get the language string(s) $myts =& MyTextSanitizer::getInstance(); - $xoopsMailer->setFromName(stripslashes(strip_tags(html_entity_decode($mailObj->contact_name, ENT_QUOTES, 'UTF-8')))); + // pre-process FromName since it came from input field + $fromName = stripslashes(strip_tags(html_entity_decode($mailObj->contact_name, ENT_QUOTES, 'UTF-8'))); + // pre-process Subject since it came from input field + $mailSubject = stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8'))); + + $xoopsMailer->setFromName(ucwords($fromName)); $xoopsMailer->setFromEmail($mailObj->contact_mail); - $xoopsMailer->setSubject(stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8')))); $thisBody = stripslashes(html_entity_decode($mailObj->contact_message, ENT_QUOTES, 'UTF-8')); - $thisBody = $xoopsMailer->multimailer->WrapText($thisBody, 80); +// $thisBody = $xoopsMailer->multimailer->WrapText($thisBody, 80); +// $xoopsMailer->multimailer->set('FromName', ucwords($fromName)); + $xoopsMailer->multimailer->setFrom($mailObj->contact_mail, ucwords($fromName)); + $xoopsMailer->multimailer->set('Subject', $mailSubject); + $xoopsMailer->multimailer->WordWrap = 80; // force wrap of body text at 80 chars for 'bad' clients + $xoopsMailer->multimailer->set('Body', $thisBody); + $xoopsMailer->multimailer->set('AltBody', $thisBody); + $xoopsMailer->setSubject($mailSubject); $xoopsMailer->setBody($thisBody); - - if ($xoopsMailer->send()) { - $message = $myts->htmlSpecialChars($GLOBALS['xoopsModuleConfig']['contact_thankyou']); + if ($xoopsMailer->send($debug = false)) { + if ($debug) { + $message = $xoopsMailer->getSuccess(); + } else { + $message = $myts->htmlSpecialChars($GLOBALS['xoopsModuleConfig']['contact_thankyou']); + } } else { $message = $xoopsMailer->getErrors(); } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact form element for form input Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/ajax.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/ajax.html 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/ajax.html 2015-01-28 19:42:52 UTC (rev 12951) @@ -1,6 +1,11 @@ -<script src="<{$xoops_url}>/browse.php?Frameworks/jquery/jquery.js" type="text/javascript"></script> -<script src="<{$xoops_url}>/browse.php?Frameworks/jquery/plugins/jquery.ui.js" type="text/javascript"></script> -<link rel="stylesheet" href="<{$xoops_url}>/modules/system/css/ui/base/ui.all.css" type="text/css"/> +<script src="<{$xoops_url}>/browse.php?Frameworks/jquery/jquery.js" + type="text/javascript"></script> +<script + src="<{$xoops_url}>/browse.php?Frameworks/jquery/plugins/jquery.ui.js" + type="text/javascript"></script> +<link rel="stylesheet" + href="<{$xoops_url}>/modules/system/css/ui/base/ui.all.css" + type="text/css" /> <script type="text/javascript"> $(function () { @@ -43,27 +48,31 @@ </script> <div class="demo"> - <div id="dialog-form" title="Contact Us"> - <p class="validateTips">Contact us</p> + <div id="dialog-form" title="Contact Us"> + <p class="validateTips">Contact us</p> - <form enctype="multipart/form-data"> - <{xoMemberInfo assign=member_info}> - <label for="name">Name</label> - <input name="contact_name" title="Name" id="contact_name" size="20" maxlength="255" value="<{$xoops_uname}>" type="text" - class="text ui-widget-content ui-corner-all"/> - <br/><label for="email">Email</label> - <input name="contact_mail" title="Email" id="contact_mail" size="20" maxlength="255" value="<{$member_info.email}>" type="text" - class="text ui-widget-content ui-corner-all"/> - <br/><label for="password">Phone</label> - <input name="contact_phone" title="Phone" id="contact_phone" size="20" maxlength="255" value="" type="text" - class="text ui-widget-content ui-corner-all"/> - <br/><label for="password">Subject</label> - <input name="contact_subject" title="Subject" id="contact_subject" size="20" maxlength="255" value="" type="text" - class="text ui-widget-content ui-corner-all"/> - <br/><label for="password">Comment</label> - <textarea name="contact_message" id="contact_message" title="Comment" rows="5" cols="60"></textarea> - <input name="contact_uid" id="contact_uid" value="<{$xoops_userid}>" type="hidden"> - </form> - </div> - <button id="create-user">Contact Us</button> + <form enctype="multipart/form-data"> + <{xoMemberInfo assign=member_info}> <label for="name">Name</label> <input + name="contact_name" title="Name" id="contact_name" size="20" + maxlength="255" value="<{$xoops_uname}>" type="text" + class="text ui-widget-content ui-corner-all" /> <br /> + <label for="email">Email</label> <input name="contact_mail" + title="Email" id="contact_mail" size="20" maxlength="255" + value="<{$member_info.email}>" type="text" + class="text ui-widget-content ui-corner-all" /> <br /> + <label for="password">Phone</label> <input name="contact_phone" + title="Phone" id="contact_phone" size="20" maxlength="255" value="" + type="text" class="text ui-widget-content ui-corner-all" /> <br /> + <label for="password">Subject</label> <input name="contact_subject" + title="Subject" id="contact_subject" size="20" maxlength="255" + value="" type="text" class="text ui-widget-content ui-corner-all" /> + <br /> + <label for="password">Comment</label> + <textarea name="contact_message" id="contact_message" title="Comment" + rows="5" cols="60"></textarea> + <input name="contact_uid" id="contact_uid" value="<{$xoops_userid}>" + type="hidden"> + </form> + </div> + <button id="create-user">Contact Us</button> </div> Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-28 19:42:52 UTC (rev 12951) @@ -1,12 +1,19 @@ +<u>Version 1.82 Beta 3 from 2015-1-28</u> +- Improved module update script to add some error reporting on failure(s) +- Fixed bug in subdirectory removal script on update +- added KEY(s) to dB table to improve search performance +- changed ContactContactHandler->infoProcessing() to use XoopsRequest +- sort departments alphabetically when displayed on contact form +- Replaced "Reply" text in admin (./admin/contact.php) with icons +- Changed "Submitter" information in admin to be able to email from contact page +- Improved ContactContact->contactSendMail() method to improve anti-spam score -Version 1.82 from 2014-12-03 Beta 2 -================================= -- Replaced ContactContact->contactCleanVars function with XoopsRequest -- changed to use exit() instead of die() for consistency -- minor phpdocumentor updates +<u>Version 1.82 Beta 2 from 2014-12-03</u> +- Replaced ContactContactHandler->contactCleanVars function with XoopsRequest +- Changed to use exit() instead of die() for consistency +- Minor phpdocumentor updates -Version 1.82 from 2014-11-25 Beta 1 -================================= +<u>Version 1.82 Beta 1 from 2014-11-25</u> - Added ability to require visitors to enter email 2X on form (ZySpec) - Added features page to Admin help (ZySpec) - Added date select to Admin log form (ZySpec) @@ -32,8 +39,7 @@ - Updated documentation files (changelog.txt, readme.txt) (ZySpec) - Minor code cleanup (ZySpec) -Version 1.81 from 2013-02-24 -================================= +<u>Version 1.81 from 2013-02-24</u> - Rebuild Module (Voltan) - English corrections (Cesag) - PSR-2 code reformatting (Mamba) @@ -47,17 +53,14 @@ - moved all images, CSS, and JS files to /assets (Mamba) - renamed .html Smarty templates to .tpl (Mamba) -Version 1.80 from 2012-1-19 -================================= +<u>Version 1.80 from 2012-1-19</u> - Rebuild Module (Voltan) -Version 1.71 from 2011-12-12 -================================= -- converted to XOOPS Standard Module GUI (Mamba) -- included ModuleAdmin class from (Mage) +<u>Version 1.71 from 2011-12-12</u> +- Converted to XOOPS Standard Module GUI (Mamba) +- Included ModuleAdmin class from (Mage) -Version 1.70 from 11-08-2010 -================================= -- added 2.4.x compatibilty (Trabis) -- added php5.3 compatibilty (Trabis) -- added error checking while sending emails (Trabis) +<u>Version 1.70 from 11-08-2010</u> +- Added 2.4.x compatibilty (Trabis) +- Added php5.3 compatibilty (Trabis) +- Added error checking while sending emails (Trabis) Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -21,7 +21,7 @@ * @version $Id: $ */ -defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); +defined("XOOPS_ROOT_PATH") || exit("Restricted access"); /** * @@ -47,7 +47,7 @@ if ($contactConfig['form_dept']) { // using departments */ if ($moduleMgr->config['form_dept']) { // using departments - // show a drop down with the correct departments listed + // show a drop down with the correct departments listed $myts =& MyTextSanitizer::getInstance(); $depts = $moduleMgr->config['contact_dept']; // $depts = explode('|', $contactConfig['contact_dept']); @@ -93,7 +93,7 @@ $departments = contactGetDepartments(); $dept_emails = array(); foreach ($departments as $thisDept) { - $dept_emails[$thisDept['name']][] = $thisDept['email']; + $dept_emails[$thisDept['name']][] = $thisDept['email']; } if ('' != $dept && array_key_exists($dept, $dept_emails)) { $dept_emails = $dept_emails[$dept]; @@ -125,7 +125,7 @@ $departments = contactGetDepartments(); $dept_names = array(); foreach ($departments as $thisDept) { - $dept_names[] = $thisDept['name']; + $dept_names[] = $thisDept['name']; } $dept_names = array_unique($dept_names); //get rid of duplicates } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -23,7 +23,6 @@ /** * @internal {Make sure you PROTECT THIS FILE - * * This code has the potential to be extremely dangerous!!} */ @@ -31,7 +30,7 @@ || !($GLOBALS['xoopsUser'] instanceof XoopsUser) || !($GLOBALS['xoopsUser']->IsAdmin())) { - exit("Restricted access - " . basename($_SERVER['PHP_SELF']) . PHP_EOL); + exit("Restricted access - " . basename($_SERVER['PHP_SELF']) . PHP_EOL); } function rmmdir($dir) @@ -41,19 +40,23 @@ * - the routine is intentionally limitted for this * install routine's requirements} */ - $dir = preg_replace('/[^a-zA-Z\s\d\_\-]/', $dir); - $dir = $GLOBALS['xoops']->path("/" . $module->dirname . "/{$dir}"); - foreach (glob($dir . '/*') as $file) { - if (is_dir($file)) { - rrmdir($file); + $moduleDir = basename(dirname(__DIR__)); + $dir = preg_replace('/[^a-zA-Z\s\d\_\-\/]/', '', $dir); + $dir = trim($dir, " \t\n\r\0\x0B\/"); //trim leading/trailing spaces and '/' + $path = $GLOBALS['xoops']->path("www/modules/{$moduleDir}/{$dir}"); + $objs = array_diff(scandir($path), array('.','..')); // remove relative dirs + foreach ($objs as $obj) { + if (is_dir("{$path}/{$obj}")) { + rmmdir("{$dir}/{$obj}"); } else { - unlink($file); + unlink("{$path}/$obj"); } } - rmdir($dir); + + return rmdir($path); } -function xoops_module_update_contact($module, $version) +function xoops_module_update_contact(&$module, $version) { $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); @@ -76,46 +79,76 @@ contact_message text NOT NULL, contact_address text NOT NULL, contact_reply tinyint(1) NOT NULL, - PRIMARY KEY (contact_id) + PRIMARY KEY (contact_id), + KEY (contact_uid), + KEY (contact_cid), + KEY (contact_create), + KEY (contact_mail), + KEY (contact_phone), + KEY (contact_platform), + KEY (contact_type) ) ENGINE=MyISAM;"; - $xoopsDB->query($sql); + if (false === $xoopsDB->query($sql)) { + $module->setErrors('Failed to create module (< v1.80) database table'); + return false; + } } if ($version < 181) { + $retVal = true; // Add contact_platform $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD `contact_platform` ENUM('Android','Ios','Web') NOT NULL DEFAULT 'Web'"; - $xoopsDB->query($sql); + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add contact_type $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD `contact_type` ENUM('Contact','Phone','Mail') NOT NULL DEFAULT 'Contact'"; - $xoopsDB->query($sql); + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_uid - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_uid` ( `contact_uid` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_uid` (`contact_uid`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_cid - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_cid` ( `contact_cid` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_cid` (`contact_cid`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_create - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_create` ( `contact_create` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_create` (`contact_create`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_mail - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_mail` ( `contact_mail` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_mail` (`contact_mail`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_phone - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_phone` ( `contact_phone` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_phone` (`contact_phone`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_platform - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_platform` ( `contact_platform` )"; - $xoopsDB->query($sql); + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_platform` (`contact_platform`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; // Add index contact_type - $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_type` ( `contact_type` )"; - $xoopsDB->query($sql); - + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `contact_type` (`contact_type`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `replied` (`contact_cid`, `contact_reply`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; + $sql = "ALTER TABLE `" . $xoopsDB->prefix('contact') . "` ADD INDEX `typed_cid` (`contact_cid`, `contact_type`)"; + $success = $xoopsDB->query($sql); + $retVal = $retVal && $success; + if (false === $retVal) { + $module->setErrors('Could not update dB table (< v1.81)'); + return false; + } // do some file cleanup since directories/files were moved in this version $dirArray = array('css', 'images', 'js'); foreach ($dirArray as $dir) { - rrmdir($GLOBALS['xoops']->path("/$module->dirname/{$dir}")); + rmmdir($dir); } } + if ($version < 182) { //delete the /admin/tools.php file - it was renamed to purge.php in v1.82 $filename = $GLOBALS['xoops']->path("/" . $module->dirname() . "/admin/tools.php"); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact - waiting.php * @@ -23,7 +23,7 @@ */ function b_waiting_contact() { -// $contactDB =& XoopsDatabaseFactory::getDatabaseConnection(); + // $contactDB =& XoopsDatabaseFactory::getDatabaseConnection(); $block = array(); @@ -35,13 +35,13 @@ //check to see if module is active, return if not... if ($contactModule->isactive()) { // setup the contact messages - $contact_handler = & xoops_getModuleHandler('contact', 'contact'); + $contact_handler = & xoops_getModuleHandler('contact', $contactModule->dirname()); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0, '=')); //don't include replies $criteria->add(new Criteria('contact_reply', 0, '=')); // only include messages that haven't had a reply $messageCount = $contact_handler->getCount($criteria); if ($messageCount) { - $block = array('adminlink' => $GLOBALS['xoops']->url("www/modules/contact/admin/contact.php"), + $block = array('adminlink' => $GLOBALS['xoops']->url("www/modules/" . $contactModule->dirname() . "/admin/contact.php"), 'pendingnum' => $messageCount, 'lang_linkname' => _PI_CONTACT_WAITING_REPLY ); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact module @@ -92,7 +92,7 @@ } // Info Processing - $mailFormResults = $contact_handler->infoProcessing($_POST); + $mailFormResults = $contact_handler->infoProcessing('POST'); $mailObj = (object) $mailFormResults; // insert in DB if ($saveinfo = true) { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/blocks.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact - blocks.php * Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html 2015-01-28 19:42:52 UTC (rev 12951) @@ -1,31 +1,37 @@ <div id="help-template" class="outer"> - <h1 class="head">Help: - <a class="ui-corner-all tooltip" href="<{$xoops_url}>/modules/contact/admin/index.php" - title="Back to the administration of Contact"> Contact - <img src="<{xoAdminIcons home.png}>" - alt="Back to the Administration of Contact"/> - </a></h1> + <h1 class="head"> + Help: <a class="ui-corner-all tooltip" + href="<{$xoops_url}>/modules/contact/admin/index.php" + title="Back to the administration of Contact"> Contact <img + src="<{xoAdminIcons home.png}>" + alt="Back to the Administration of Contact" /> + </a> + </h1> - <h4 class="odd">Description</h4><br/> + <h4 class="odd">Description</h4> + <br /> - <p style='margin-bottom: 1em;'>'Contact Us' is a very simple module. It provides a Main Menu link to a - contact form that visitors can use to email the website Administrator or - optionally a department.</p> - <p>You can set the content of the Contact Us form header in 'Preferences'</p> + <p style='margin-bottom: 1em;'>'Contact Us' is a very simple + module. It provides a Main Menu link to a contact form that visitors + can use to email the website Administrator or optionally a department.</p> + <p>You can set the content of the Contact Us form header in + 'Preferences'</p> - <h4 class="odd">Install/uninstall</h4><br/> + <h4 class="odd">Install/uninstall</h4> + <br /> No special measures necessary, follow the standard installation + process extract the /contact folder into the ./modules directory. + Install the module through Admin -> System Module -> Modules. <br /> + <br /> Detailed instructions on installing modules are available in the + <a href="http://goo.gl/adT2i">XOOPS Operations Manual</a><br /> + <br /> - No special measures necessary, follow the standard installation process - extract the /contact folder into the ./modules directory. Install the - module through Admin -> System Module -> Modules. <br/><br/> - Detailed instructions on installing modules are available in the - <a href="http://goo.gl/adT2i">XOOPS Operations Manual</a><br/><br/> + <h4 class="odd">Operating instructions</h4> + <br /> There is nothing really to do on the Admin site, except setting + preferences.<br /> + <br /> + <h4 class="odd">Tutorial</h4> + <br /> You can find a more detailed Tutorial <a + href="http://goo.gl/bz94i">here</a><br /> - <h4 class="odd">Operating instructions</h4><br/> - There is nothing really to do on the Admin site, except setting preferences.<br/><br/> - <h4 class="odd">Tutorial</h4><br/> - - You can find a more detailed Tutorial <a href="http://goo.gl/bz94i">here</a><br/> - </div> \ No newline at end of file Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html 2015-01-28 19:42:52 UTC (rev 12951) @@ -1,22 +1,32 @@ <div id="help-template" class="outer"> - <h1 class="head">Help: - <a class="ui-corner-all tooltip" href="<{$xoops_url}>/modules/contact/admin/index.php" - title="Back to the administration of Contact"> Contact - <img src="<{xoAdminIcons home.png}>" - alt="Back to the Administration of Contact"/> - </a></h1> + <h1 class="head"> + Help: <a class="ui-corner-all tooltip" + href="<{$xoops_url}>/modules/contact/admin/index.php" + title="Back to the administration of Contact"> Contact <img + src="<{xoAdminIcons home.png}>" + alt="Back to the Administration of Contact" /> + </a> + </h1> - <h4 class="odd">Contact Module</h4> - <p style='margin: 1em 0;'>This module includes the following features:</p> - <ul> - <li style='height: 1.3em;'>Automatically emails contact form to requested contact</li> - <li style='height: 1.3em;'>Allows Administrator to reply to message from module control panel</li> - <li style='height: 1.3em;'>Stores Contact submission in database</li> - <li style='height: 1.3em;'>Allows Administrator to select type of information to collect (URL, Company Name, Location, Address, Phone, etc.)</li> - <li style='height: 1.3em;'>Supports contacting departments</li> - <li style='height: 1.3em;'>Form Captcha based on site settings</li> - <li style='height: 1.3em;'>Ability to require anonymous users to enter email twice on form to ensure it was entered correctly</li> - <li style='height: 1.3em;'>Provides log of users who have filled out Contact form</li> - <li style='height: 1.3em;'>Allows Administrator to prune (delete) messages from the database</li> - </ul> + <h4 class="odd">Contact Module</h4> + <p style='margin: 1em 0;'>This module includes the following + features:</p> + <ul> + <li style='height: 1.3em;'>Automatically emails contact form to + requested contact</li> + <li style='height: 1.3em;'>Allows Administrator to reply to + message from module control panel</li> + <li style='height: 1.3em;'>Stores Contact submission in database</li> + <li style='height: 1.3em;'>Allows Administrator to select type of + information to collect (URL, Company Name, Location, Address, Phone, + etc.)</li> + <li style='height: 1.3em;'>Supports contacting departments</li> + <li style='height: 1.3em;'>Form Captcha based on site settings</li> + <li style='height: 1.3em;'>Ability to require anonymous users to + enter email twice on form to ensure it was entered correctly</li> + <li style='height: 1.3em;'>Provides log of users who have filled + out Contact form</li> + <li style='height: 1.3em;'>Allows Administrator to prune (delete) + messages from the database</li> + </ul> </div> Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact - modinfo.php * Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/waiting.php 2015-01-28 19:42:52 UTC (rev 12951) @@ -7,7 +7,7 @@ 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. -*/ + */ /** * Contact - waiting.php * Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/sql/mysql.sql =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/sql/mysql.sql 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/sql/mysql.sql 2015-01-28 19:42:52 UTC (rev 12951) @@ -1,29 +1,31 @@ CREATE TABLE contact ( - contact_id int(10) unsigned NOT NULL auto_increment, - contact_uid int(10) NOT NULL, - contact_cid int(10) NOT NULL, - contact_create int(10) NOT NULL, - contact_subject varchar(255) NOT NULL, - contact_name varchar(255) NOT NULL, - contact_mail varchar(255) NOT NULL, - contact_url varchar(255) NOT NULL, - contact_icq varchar(255) NOT NULL, - contact_company varchar(255) NOT NULL, - contact_location varchar(255) NOT NULL, - contact_department varchar(60) NOT NULL, - contact_ip varchar(20) NOT NULL, - contact_phone varchar(20) NOT NULL, - contact_message text NOT NULL, - contact_address text NOT NULL, - contact_reply tinyint(1) NOT NULL, - contact_platform enum('Android','Ios','Web') NOT NULL DEFAULT 'Web', - contact_type enum('Contact','Phone','Mail') NOT NULL DEFAULT 'Contact', + `contact_id` int(10) unsigned NOT NULL auto_increment, + `contact_uid` int(10) NOT NULL, + `contact_cid` int(10) NOT NULL, + `contact_create` int(10) NOT NULL, + `contact_subject` varchar(255) NOT NULL, + `contact_name` varchar(255) NOT NULL, + `contact_mail` varchar(255) NOT NULL, + `contact_url` varchar(255) NOT NULL, + `contact_icq` varchar(255) NOT NULL, + `contact_company` varchar(255) NOT NULL, + `contact_location` varchar(255) NOT NULL, + `contact_department` varchar(60) NOT NULL, + `contact_ip` varchar(20) NOT NULL, + `contact_phone` varchar(20) NOT NULL, + `contact_message` text NOT NULL, + `contact_address` text NOT NULL, + `contact_reply` tinyint(1) NOT NULL, + `contact_platform` enum('Android','Ios','Web') NOT NULL DEFAULT 'Web', + `contact_type` enum('Contact','Phone','Mail') NOT NULL DEFAULT 'Contact', PRIMARY KEY (contact_id), - KEY (contact_uid), - KEY (contact_cid), - KEY (contact_create), - KEY (contact_mail), - KEY (contact_phone), - KEY (contact_platform), - KEY (contact_type) + KEY (`contact_uid`), + KEY (`contact_cid`), + KEY (`contact_create`), + KEY (`contact_mail`), + KEY (`contact_phone`), + KEY (`contact_platform`), + KEY (`contact_type`), + KEY `replied` (`contact_cid`, `contact_reply`), + KEY `typed_cid` ('contact_cid`, `contact_type`) ) ENGINE=MyISAM; Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/admin/contact_contact.tpl =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/admin/contact_contact.tpl 2015-01-28 19:15:52 UTC (rev 12950) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/admin/contact_contact.tpl 2015-01-28 19:42:52 UTC (rev 12951) @@ -18,7 +18,11 @@ <td class="txtcenter bold"><a class="tooltip" title="<{$contact.contact_subject}>" href="contact.php?op=view&id=<{$contact.contact_id}>"><{$contact.contact_subject}></a></td> <td class="txtcenter"><{$contact.contact_create}></td> <td class="txtcenter"> - <{$contact.contact_name}> ( <{if $contact.contact_uid}><a title="<{$contact.contact_owner}>"href="<{$xoops_url}>/userinfo.php?uid=<{$contact.contact_uid}>"><{$contact.contact_owner}></a><{else}><{$contact.contact_owner}><{/if}> ) +<{ if $contact.contact_uid}> + <a href='<{$xoops_url}>/userinfo.php?uid=<{$contact.contact_uid}>'><{$contact.contact_name}></a> +<{ else}> + <a href='<{$contact.contact_mail}>'><{$contact.contact_name}></a><{/if}><{if !$contact.contact_uid}> (<{$contact.contact_owner}>) +<{ /if}> </td> <td class="txtcenter xo-actions"> <img class="tooltip" onclick="display_dialog(<{$contact.contact_id}>, true, true, 'slide', 'slide', 300, 700);" @@ -243,27 +247,29 @@ <tr class="odd" id="mod_<{$contact.contact_id}>"> <td class="bold"><a class="tooltip" title="<{$smarty.const._AM_CONTACT_VIEW}> : <{$contact.contact_subject}>" href="contact.php?op=view&id=<{$contact.contact_id}>"><{$contact.contact_subject}></a> </td> - <td class="txtcenter width10 bold"><{if $contact.contact_reply}><span class="green bold pad2"><{$smarty.const._AM_CONTACT_REPLY_HAVE}></span><{else}><span - class="red bold pad2"><{$smarty.const._AM_CONTACT_REPLY_HAVENT}></span><{/if}> + <td class="txtcenter width10 bold"> + <{if $contact.contact_reply}><img src="<{xoModuleIcons16 1.png}>" alt="<{$smarty.const._AM_CONTACT_REPLY_HAVE}>" title="<{$smarty.const._AM_CONTACT_REPLY_HAVE}>" /><{else}><img src="<{xoModuleIcons16 0.png}>" alt="<{$smarty.const._AM_CONTACT_REPLY_HAVENT}>" title="<{$smarty.const._AM_CONTACT_REPLY_HAVENT}>" /><{/if}> </td> <td class="txtcenter width10"><{$contact.contact_create}></td> <{if $use_depts}><td class="txtcenter width15 bold"><{$contact.contact_department}></td><{/if}> <td ... [truncated message content] |
From: <zy...@us...> - 2015-01-30 22:30:07
|
Revision: 12957 http://sourceforge.net/p/xoops/svn/12957 Author: zyspec Date: 2015-01-30 22:30:05 +0000 (Fri, 30 Jan 2015) Log Message: ----------- removed unnecessary exit() statement after redirect_header() calls Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-30 20:58:24 UTC (rev 12956) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-30 22:30:05 UTC (rev 12957) @@ -106,7 +106,6 @@ // verfiy we're sending to a valid email if ((!$mailObj->contact_mail || !(checkEmail($mailObj->contact_mail))) && !$GLOBALS['xoopsModuleConfig']['form_dept']) { redirect_header($_SERVER['PHP_SELF'], 3, _MD_CONTACT_MES_NOVALIDEMAIL); - exit(); } // verify valid message body @@ -118,7 +117,6 @@ $contactObj->prepareToInsert($mailObj); if (!$contact_handler->insert($contactObj)) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTSAVED); - exit(); } $contact_handler->contactAddReply($contactObj->getVar('contact_cid')); } else { @@ -168,7 +166,6 @@ case 'delete': if (!$contactId) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); - exit(); } // Prompt message xoops_confirm(array('id' => $contactId, 'op' => 'dodelete'), $_SERVER['PHP_SELF'], _AM_CONTACT_MSG_DELETE); @@ -181,7 +178,6 @@ if ( !$GLOBALS['xoopsSecurity']->check() ) { // failed xoops security check redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); - exit(); } } else { redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); @@ -196,8 +192,6 @@ $msg = (!$contact_handler->deleteAll($criteria)) ? _AM_CONTACT_MSG_DELETEERROR : _AM_CONTACT_MSG_DELETED; } redirect_header($_SERVER['PHP_SELF'], 3, $msg); -// xoops_cp_footer(); - exit(); break; } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-30 20:58:24 UTC (rev 12956) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-30 22:30:05 UTC (rev 12957) @@ -66,7 +66,6 @@ if ( !$GLOBALS['xoopsSecurity']->check() ) { // failed xoops security check redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); - exit(); } } else { xoops_loadLanguage('main', 'contact'); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-30 20:58:24 UTC (rev 12956) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-30 22:30:05 UTC (rev 12957) @@ -58,7 +58,6 @@ if (!$GLOBALS['xoopsSecurity']->check()) { // failed xoops security check redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); - exit(); } } else { xoops_loadLanguage('main', 'contact'); @@ -82,7 +81,6 @@ if (!$GLOBALS['xoopsSecurity']->check()) { // failed xoops security check redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); - exit(); } } else { xoops_loadLanguage('main', 'contact'); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-30 20:58:24 UTC (rev 12956) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-30 22:30:05 UTC (rev 12957) @@ -1,12 +1,13 @@ <u>Version 1.82 Beta 3 from 2015-1-28</u> - Improved module update script to add some error reporting on failure(s) - Fixed bug in subdirectory removal script on update -- added KEY(s) to dB table to improve search performance -- changed ContactContactHandler->infoProcessing() to use XoopsRequest -- sort departments alphabetically when displayed on contact form +- Added KEY(s) to dB table to improve search performance +- Changed ContactContactHandler->infoProcessing() to use XoopsRequest +- Sort departments alphabetically when displayed on contact form - Replaced "Reply" text in admin (./admin/contact.php) with icons - Changed "Submitter" information in admin to be able to email from contact page - Improved ContactContact->contactSendMail() method to improve anti-spam score +- Removed unnecessary exit() statement after redirect_header() calls <u>Version 1.82 Beta 2 from 2014-12-03</u> - Replaced ContactContactHandler->contactCleanVars function with XoopsRequest Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-30 20:58:24 UTC (rev 12956) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-30 22:30:05 UTC (rev 12957) @@ -37,14 +37,12 @@ case 'save': if (empty($_POST['submit']) ) { redirect_header($GLOBALS['xoops']->url('www'), 3, _MD_CONTACT_MES_ERROR); - exit(); } else { // check to make sure this passes form submission security if ( ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) ) { if ( !$GLOBALS['xoopsSecurity']->check() ) { // failed xoops security check redirect_header('index.php', 2, $GLOBALS['xoopsSecurity']->getErrors(true)); - exit(); } } else { redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); @@ -62,8 +60,6 @@ if (!$xoopsCaptcha->verify()) { $err[] = $xoopsCaptcha->getMessage(); redirect_header("index.php", 2, $xoopsCaptcha->getMessage()); - - exit(); } } } @@ -75,7 +71,6 @@ if (empty($contact_mail)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); - exit(); } elseif (!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['form_req_email2']) { $input_mail2 = XoopsRequest::getString('contact_mail2', '', 'POST'); $contact_mail2 = checkEmail($input_mail2); @@ -83,11 +78,9 @@ if (empty($contact_mail2)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL2); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); - exit(); } elseif (($contact_mail != $contact_mail2)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_EMAILMATCHFAILURE); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_EMAILMATCHFAILURE); - exit(); } } @@ -100,7 +93,6 @@ $contactObj->prepareToInsert($mailObj); if (!$contact_handler->insert($contactObj)) { redirect_header('index.php', 3, _MD_CONTACT_MES_NOTSAVE); - exit(); } } @@ -114,7 +106,6 @@ } redirect_header($GLOBALS['xoops']->url('www'), 3, $message); - exit(); } break; |
From: <zy...@us...> - 2015-01-31 15:28:35
|
Revision: 12958 http://sourceforge.net/p/xoops/svn/12958 Author: zyspec Date: 2015-01-31 15:28:27 +0000 (Sat, 31 Jan 2015) Log Message: ----------- * fixed syntax error in ./ajax.php (extra apostrophy) * minor code cleanup for PSRx naming nomenclature Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -22,8 +22,8 @@ * @version $Id$ */ -$path = dirname(dirname(dirname(__DIR__))); -require_once $path . '/mainfile.php'; +$xoopsPath = dirname(dirname(dirname(__DIR__))); +require_once $xoopsPath . '/mainfile.php'; include_once $GLOBALS['xoops']->path('www/include/cp_functions.php'); include_once $GLOBALS['xoops']->path('www/include/cp_header.php'); include_once $GLOBALS['xoops']->path('www/class/pagenav.php'); @@ -31,12 +31,12 @@ xoops_load('XoopsRequest'); -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +$moduleDirname = $GLOBALS['xoopsModule']->getVar('dirname'); // Load language files -xoops_loadLanguage('admin', $thisModuleDir); -xoops_loadLanguage('modinfo', $thisModuleDir); -xoops_loadLanguage('main', $thisModuleDir); +xoops_loadLanguage('admin', $moduleDirname); +xoops_loadLanguage('modinfo', $moduleDirname); +xoops_loadLanguage('main', $moduleDirname); $pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons16')); $pathIcon32 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons32')); @@ -45,5 +45,5 @@ $admin_class = new ModuleAdmin(); // Contact Module specific pieces -include_once $GLOBALS['xoops']->path("/modules/{$thisModuleDir}/include/functions.php"); -$contact_handler =& xoops_getModuleHandler('contact', $thisModuleDir); +include_once $GLOBALS['xoops']->path("/modules/{$moduleDirname}/include/functions.php"); +$contactHandler =& xoops_getModuleHandler('contact', $moduleDirname); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -29,21 +29,22 @@ // Define default value $op = XoopsRequest::getString('op', 'list'); $contactId = XoopsRequest::getInt('id', '0'); -$level = ''; +$level = ''; // Define scripts $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); $xoTheme->addScript($GLOBALS['xoops']->url('www/modules/contact/assets/js/admin.js')); + // Add module stylesheet $xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/contact/assets/css/admin.css')); //add system module stylesheets -$module_handler =& xoops_gethandler('module'); -$systemModule =& $module_handler->getByDirname('system'); -$config_handler =& xoops_gethandler('config'); +$moduleHandler =& xoops_gethandler('module'); +$systemModule =& $moduleHandler->getByDirname('system'); +$configHandler =& xoops_gethandler('config'); if ($systemModule instanceof XoopsModule) { - $moduleConfig =& $config_handler->getConfigsByCat(0, $systemModule->getVar('mid')); + $moduleConfig =& $configHandler->getConfigsByCat(0, $systemModule->getVar('mid')); if (isset($moduleConfig['jquery_theme'])) { $xoTheme->addStylesheet($GLOBALS['xoops']->url("www/modules/system/css/ui/{$moduleConfig['jquery_theme']}/ui.all.css")); } @@ -60,8 +61,8 @@ $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); $pageSettingsObj->start = XoopsRequest::getInt('start', 0); - $contactCount = $contact_handler->contactGetCount('contact_cid'); //count all contacts - $contacts = $contact_handler->getAdminList($pageSettingsObj, 'contact_cid'); + $contactCount = $contactHandler->contactGetCount('contact_cid'); //count all contacts + $contacts = $contactHandler->getAdminList($pageSettingsObj, 'contact_cid'); if ($contactCount > $pageSettingsObj->limit) { $contactPageNavObj = new XoopsPageNav($contactCount, $pageSettingsObj->limit, $pageSettingsObj->start, 'start', 'limit=' . $pageSettingsObj->limit); @@ -79,14 +80,14 @@ case 'reply': if ($contactId > 0) { - $obj = $contact_handler->get($contactId); + $obj = $contactHandler->get($contactId); if (!($obj instanceof contact) || (0 != $obj->getVar('contact_cid'))) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_REPLY_CANT); } $form = $obj->replyForm(); $GLOBALS['xoopsTpl']->assign(array('replyform' => $form->render(), - 'replylist' => $contact_handler->contactGetReply($contactId), + 'replylist' => $contactHandler->contactGetReply($contactId), 'use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, ) ); @@ -97,7 +98,7 @@ break; case 'doreply': - $formInput = $contact_handler->infoProcessing('POST'); + $formInput = $contactHandler->infoProcessing('POST'); $mailObj = (object) $formInput; unset($formInput); $deptEmails = array(); @@ -109,23 +110,23 @@ } // verify valid message body - $mailObj->contact_message = $contact_handler->replyBodyFormat($mailObj, (bool) $mailObj->inc_orig); + $mailObj->contact_message = $contactHandler->replyBodyFormat($mailObj, (bool) $mailObj->inc_orig); if ($mailObj->contact_message) { // successfully retrieved message body so insert into dB if ($saveinfo = true) { - $contactObj = $contact_handler->create(); + $contactObj = $contactHandler->create(); $contactObj->prepareToInsert($mailObj); - if (!$contact_handler->insert($contactObj)) { + if (!$contactHandler->insert($contactObj)) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTSAVED); } - $contact_handler->contactAddReply($contactObj->getVar('contact_cid')); + $contactHandler->contactAddReply($contactObj->getVar('contact_cid')); } else { $message[] = _AM_CONTACT_MSG_NOTSAVED; // did not save message } // send mail can send message if $sendmail = true if ($sendmail = true) { - $message[] = $contact_handler->contactReplyMail($mailObj); + $message[] = $contactHandler->contactReplyMail($mailObj); } elseif ($saveinfo = true) { $message = _MD_CONTACT_MES_SAVEINDB; } else { @@ -143,7 +144,7 @@ break; case 'view': - $obj = $contact_handler->get($contactId); + $obj = $contactHandler->get($contactId); if (!$obj) { redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); @@ -157,7 +158,7 @@ $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, 'contact' => $contact, - 'replylist' => $contact_handler->contactGetReply($contactId)) + 'replylist' => $contactHandler->contactGetReply($contactId)) ); $level = 'view'; @@ -189,7 +190,7 @@ $criteria = new CriteriaCompo (); $criteria->add(new Criteria ('contact_id', $contactId)); //messages $criteria->add(new Criteria ('contact_cid', $contactId), 'OR'); //replies - $msg = (!$contact_handler->deleteAll($criteria)) ? _AM_CONTACT_MSG_DELETEERROR : _AM_CONTACT_MSG_DELETED; + $msg = (!$contactHandler->deleteAll($criteria)) ? _AM_CONTACT_MSG_DELETEERROR : _AM_CONTACT_MSG_DELETED; } redirect_header($_SERVER['PHP_SELF'], 3, $msg); break; Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/index.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -34,16 +34,16 @@ $criteria->add(new Criteria('contact_cid', 0)); $criteria->add(new Criteria('contact_reply', 0)); $criteria->add(new Criteria('contact_type', 'Contact')); -$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_NOREPLIES, $contact_handler->getCount($criteria)); +$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_NOREPLIES, $contactHandler->getCount($criteria)); // Display total number of messages -$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_TOTAL, $contact_handler->contactGetCount('contact_cid')); +$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_TOTAL, $contactHandler->contactGetCount('contact_cid')); // Display total number of replies $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0, '<>')); $criteria->add(new Criteria('contact_reply', 0)); -$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_REPLIES, $contact_handler->getCount($criteria)); +$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_REPLIES, $contactHandler->getCount($criteria)); $GLOBALS['xoopsTpl']->assign('navigation', $admin_class->addNavigation('index.php')); $GLOBALS['xoopsTpl']->assign('renderindex', $admin_class->renderIndex()); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -32,7 +32,7 @@ switch ($op) { case 'form': // log manager - $log_count = $contact_handler->getCount(); + $log_count = $contactHandler->getCount(); if ($log_count) { $form = new XoopsThemeForm(_AM_CONTACT_LOGS_FORM, 'logs', 'log.php', 'post', true); $column = new XoopsFormSelect(_AM_CONTACT_LOGS_COLUMN, 'column', 'contact_mail'); @@ -75,7 +75,7 @@ $valid_column = in_array(trim($column), array('contact_icq', 'contact_mail', 'contact_phone', 'contact_url')); $column = ($valid_column) ? trim($column) : 'contact_mail'; $timestamp = XoopsRequest::getString('timestamp', formatTimestamp(xoops_getUserTimestamp(time()), 's'), 'POST'); - $log = $contact_handler->contactLogs($column, $timestamp); + $log = $contactHandler->contactLogs($column, $timestamp); if (!$log) { $log = array(_AM_CONTACT_LOGS_NOTHING_HERE); } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -24,35 +24,33 @@ // defined("XOOPS_ROOT_PATH") || exit("Restricted access"); -$module_handler = xoops_gethandler('module'); -$module = $module_handler->getByDirname(basename(dirname(__DIR__))); -$pathIcon32 = '../../' . $module->getInfo('icons32'); +$moduleHandler = xoops_gethandler('module'); +$module = $moduleHandler->getByDirname(basename(dirname(__DIR__))); +$pathIcon32 = '../../' . $module->getInfo('icons32'); xoops_loadLanguage('modinfo', $module->dirname()); -$adminmenu = array(); +$adminmenu = array(array('title' => _MI_CONTACT_MENU_HOME, + 'link' => "admin/index.php", + 'desc' => _MI_CONTACT_MENU_HOME_DESC, + 'icon' => "{$pathIcon32}/home.png"), -$i = 1; -$adminmenu[$i]["title"] = _MI_CONTACT_MENU_HOME; -$adminmenu[$i]["link"] = "admin/index.php"; -$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_HOME_DESC; -$adminmenu[$i]["icon"] = "{$pathIcon32}/home.png"; -++$i; -$adminmenu[$i]["title"] = _MI_CONTACT_MENU_CONTACT; -$adminmenu[$i]["link"] = "admin/contact.php"; -$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_CONTACT_DESC; -$adminmenu[$i]["icon"] = "{$pathIcon32}/content.png"; -++$i; -$adminmenu[$i]["title"] = _MI_CONTACT_MENU_LOGS; -$adminmenu[$i]["link"] = "admin/log.php"; -$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_LOGS_DESC; -$adminmenu[$i]["icon"] = "{$pathIcon32}/exec.png"; -++$i; -$adminmenu[$i]["title"] = _MI_CONTACT_MENU_PRUNE; -$adminmenu[$i]["link"] = "admin/prune.php"; -$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_PRUNE_DESC; -$adminmenu[$i]["icon"] = "{$pathIcon32}/prune.png"; -++$i; -$adminmenu[$i]["title"] = _MI_CONTACT_MENU_ABOUT; -$adminmenu[$i]["link"] = "admin/about.php"; -$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_ABOUT_DESC; -$adminmenu[$i]["icon"] = "{$pathIcon32}/about.png"; + array('title' => _MI_CONTACT_MENU_CONTACT, + 'link' => "admin/contact.php", + 'desc' => _MI_CONTACT_MENU_CONTACT_DESC, + 'icon' => "{$pathIcon32}/content.png"), + + array('title' => _MI_CONTACT_MENU_LOGS, + 'link' => "admin/log.php", + 'desc' => _MI_CONTACT_MENU_LOGS_DESC, + 'icon' => "{$pathIcon32}/exec.png"), + + array('title' => _MI_CONTACT_MENU_PRUNE, + 'link' => "admin/prune.php", + 'desc' => _MI_CONTACT_MENU_PRUNE_DESC, + 'icon' => "{$pathIcon32}/prune.png"), + + array('title' => _MI_CONTACT_MENU_ABOUT, + 'link' => "admin/about.php", + 'desc' => _MI_CONTACT_MENU_ABOUT_DESC, + 'icon' => "{$pathIcon32}/about.png") +); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -35,7 +35,7 @@ default: // prune manager // check to see if there are any items in the dB - $contact_count = $contact_handler->getCount(); + $contact_count = $contactHandler->getCount(); if ($contact_count) { $form = new XoopsThemeForm(_AM_CONTACT_PRUNE_PRUNE, 'prune', 'prune.php', 'post', true); $form->addElement(new XoopsFormTextDateSelect(_AM_CONTACT_PRUNE_BEFORE, 'prune_date', 15, xoops_getUserTimestamp(time()))); @@ -90,9 +90,9 @@ $timeRequest = XoopsRequest::getString('prune_date', 0); $timestamp = ($timeRequest) ? strtotime($timeRequest) : xoops_getUserTimestamp(time()); $onlyreply = XoopsRequest::getBool('onlyreply', false, 'POST'); -// $timestamp = $contact_handler->contactCleanVars($_POST, 'prune_date', xoops_getUserTimestamp(time()), 'date'); -// $onlyreply = (bool) $contact_handler->contactCleanVars($_POST, 'onlyreply', 0, 'int'); - $count = (int) $contact_handler->deleteBeforeDate($timestamp, $onlyreply); +// $timestamp = $contactHandler->contactCleanVars($_POST, 'prune_date', xoops_getUserTimestamp(time()), 'date'); +// $onlyreply = (bool) $contactHandler->contactCleanVars($_POST, 'onlyreply', 0, 'int'); + $count = (int) $contactHandler->deleteBeforeDate($timestamp, $onlyreply); redirect_header('prune.php', 2, sprintf(_AM_CONTACT_MSG_PRUNE_DELETED, $count)); xoops_cp_footer(); exit (); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -25,13 +25,13 @@ if (!empty($_POST)) { // Info Processing - $mailFormContents = $contact_handler->infoProcessing('POST''); + $mailFormContents = $contactHandler->infoProcessing('POST'); $mailObj = (object) $mailFormContents; // Save info - $contactObj = $contact_handler->create(); + $contactObj = $contactHandler->create(); $contactObj->prepareToInsert($mailObj); // $contentObj->setVars($contact); - $contact_handler->insert($contactObj); + $contactHandler->insert($contactObj); // send mail can send message - $message = $contact_handler->contactSendMail($mailObj); + $message = $contactHandler->contactSendMail($mailObj); } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -39,38 +39,30 @@ */ function b_contact_stats_show($options) { - $dirname = basename(dirname(__DIR__)); + $moduleDirname = basename(dirname(__DIR__)); $block = array(); - $contact_handler =& xoops_getmodulehandler('contact', $dirname); + $contactHandler =& xoops_getmodulehandler('contact', $moduleDirname); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0)); $criteria->add(new Criteria('contact_type', 'Contact')); $criteria->setGroupby('contact_reply'); - $msgCountArray = $contact_handler->getCounts($criteria); + $msgCountArray = $contactHandler->getCounts($criteria); if ((is_array($msgCountArray) && count($msgCountArray) > 0)) { $block['noreplies'] = (isset($msgCountArray[0])) ? $msgCountArray[0] : 0; $block[ 'replies'] = (isset($msgCountArray[1])) ? $msgCountArray[1] : 0; $block[ 'total'] = $block['noreplies'] + $block['replies']; // if using departments show number of contacts per department - include_once $GLOBALS['xoops']->path( "modules/{$dirname}/include/functions.php"); -// include_once '../include/functions.php'; + include_once $GLOBALS['xoops']->path( "modules/{$moduleDirname}/include/functions.php"); $moduleMgr = contactGetModuleManager(); -/* - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->getByDirname($dirname); - $config_handler =& xoops_gethandler('config'); - $contactConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); - if ($contactConfig['form_dept']) { -*/ if ($moduleMgr->config['form_dept']) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0)); $criteria->add(new Criteria('contact_type', 'Contact')); $criteria->setGroupby('contact_department'); - $depts = $contact_handler->getCounts($criteria); + $depts = $contactHandler->getCounts($criteria); if ((is_array($depts) && count($depts) > 0)) { $block['depts'] = $depts; } Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt 2015-01-31 15:28:27 UTC (rev 12958) @@ -8,6 +8,7 @@ - Changed "Submitter" information in admin to be able to email from contact page - Improved ContactContact->contactSendMail() method to improve anti-spam score - Removed unnecessary exit() statement after redirect_header() calls +- minor code cleanup for PSRx naming nomenclature <u>Version 1.82 Beta 2 from 2014-12-03</u> - Replaced ContactContactHandler->contactCleanVars function with XoopsRequest Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -25,4 +25,4 @@ include $GLOBALS['xoops']->path('www/modules/contact/class/contact.php'); include_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); -$contact_handler =& xoops_getModuleHandler('contact', 'contact'); +$contactHandler =& xoops_getModuleHandler('contact', 'contact'); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -27,9 +27,9 @@ * * Get an array of all department names and emails * - *@param bool $email_as_key true: use email as array key, false: don't + * @param bool $email_as_key true: use email as array key, false: don't * @uses MyTextSanitizer - * @uses xoops_gethandler + * @uses contactGetModuleManager * @uses checkEmail * @return array with 'name' and 'email' keys */ @@ -37,20 +37,10 @@ { $moduleMgr = contactGetModuleManager(); $departments = array(); -/* - //get the configs for this module - $module_handler =& xoops_gethandler('module'); - $config_handler =& xoops_gethandler('config'); - $contactModule =& $module_handler->getByDirname('contact'); - $contactConfig =& $config_handler->getConfigsByCat(0, $contactModule->getVar('mid')); - - if ($contactConfig['form_dept']) { // using departments -*/ if ($moduleMgr->config['form_dept']) { // using departments // show a drop down with the correct departments listed $myts =& MyTextSanitizer::getInstance(); $depts = $moduleMgr->config['contact_dept']; -// $depts = explode('|', $contactConfig['contact_dept']); foreach ($depts as $thisDept) { list($name, $email) = explode(',', $thisDept, 2); //split the name and email if (checkEmail($email)) { @@ -80,15 +70,6 @@ { $moduleMgr = contactGetModuleManager(); $dept_emails = array(); -/* - //get the configs for this module - $module_handler =& xoops_gethandler('module'); - $config_handler =& xoops_gethandler('config'); - $contactModule =& $module_handler->getByDirname('contact'); - $contactConfig =& $config_handler->getConfigsByCat(0, $contactModule->getVar('mid')); - - if ($contactConfig['form_dept']) { // using departments -*/ if ($moduleMgr->config['form_dept']) { // using departments $departments = contactGetDepartments(); $dept_emails = array(); @@ -112,15 +93,6 @@ { $moduleMgr = contactGetModuleManager(); $dept_names = array(); -/* - //get the configs for this module - $module_handler =& xoops_gethandler('module'); - $config_handler =& xoops_gethandler('config'); - $contactModule =& $module_handler->getByDirname('contact'); - $contactConfig =& $config_handler->getConfigsByCat(0, $contactModule->getVar('mid')); - - if ($contactConfig['form_dept']) { // using departments -*/ if ($moduleMgr->config['form_dept']) { $departments = contactGetDepartments(); $dept_names = array(); @@ -135,24 +107,26 @@ * * Get the Module handlers & configs * - * @return array module_handler, config_handler, module, config + * @return array moduleHandler, configHandler, module, config * @see XoopsModule * @see XoopsConfigHandler * @see XoopsModuleHandler + * @uses xoops_gethandler * * @return object moduleMgr {@see stdClass} - * with module_handler, config_handler, module, moduleConfigs properties + * with moduleHandler, configHandler, module, moduleConfigs properties */ function contactGetModuleManager() { static $moduleMgr; if (!isset($moduleMgr)) { + $moduleDirname = basename(dirname(__DIR__)); + $moduleMgr = new stdClass(); - $moduleMgr->module_handler =& xoops_gethandler('module'); - $moduleMgr->config_handler =& xoops_gethandler('config'); - $moduleMgr->module =& $moduleMgr->module_handler->getByDirname('contact'); - $moduleMgr->config =& $moduleMgr->config_handler->getConfigsByCat(0, $moduleMgr->module->getVar('mid')); - + $moduleMgr->moduleHandler =& xoops_gethandler('module'); + $moduleMgr->configHandler =& xoops_gethandler('config'); + $moduleMgr->module =& $moduleMgr->moduleHandler->getByDirname($moduleDirname); + $moduleMgr->config =& $moduleMgr->configHandler->getConfigsByCat(0, $moduleMgr->module->getVar('mid')); } return $moduleMgr; Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -25,21 +25,22 @@ { // $contactDB =& XoopsDatabaseFactory::getDatabaseConnection(); + $moduleDirname = basename(dirname(__DIR__)); + $block = array(); + $moduleHandler =& xoops_gethandler('module'); + $contactModule =& $moduleHandler->getByDirname($moduleDirname); +// $configHandler =& xoops_gethandler('config'); +// $contactModuleConfigs =& $configHandler->getConfigsByCat(0, $contactModule->getVar('mid')); - $module_handler =&xoops_gethandler('module'); - $contactModule =&$module_handler->getByDirname('contact'); - $config_handler =& xoops_gethandler('config'); - $contactModuleConfigs =& $config_handler->getConfigsByCat(0, $contactModule->getVar('mid')); - //check to see if module is active, return if not... if ($contactModule->isactive()) { // setup the contact messages - $contact_handler = & xoops_getModuleHandler('contact', $contactModule->dirname()); + $contactHandler = & xoops_getModuleHandler('contact', $contactModule->dirname()); $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('contact_cid', 0, '=')); //don't include replies + $criteria->add(new Criteria('contact_cid', 0, '=')); //don't include replies $criteria->add(new Criteria('contact_reply', 0, '=')); // only include messages that haven't had a reply - $messageCount = $contact_handler->getCount($criteria); + $messageCount = $contactHandler->getCount($criteria); if ($messageCount) { $block = array('adminlink' => $GLOBALS['xoops']->url("www/modules/" . $contactModule->dirname() . "/admin/contact.php"), 'pendingnum' => $messageCount, Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-30 22:30:05 UTC (rev 12957) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-31 15:28:27 UTC (rev 12958) @@ -30,8 +30,8 @@ $op = XoopsRequest::getCmd('op', 'form', 'POST'); $department = XoopsRequest::getString('contact_department', '', 'GET'); -//$op = $contact_handler->contactCleanVars($_POST, 'op', 'form', 'string'); -//$department = $contact_handler->contactCleanVars($_GET, 'contact_department', '', 'string'); +//$op = $contactHandler->contactCleanVars($_POST, 'op', 'form', 'string'); +//$department = $contactHandler->contactCleanVars($_GET, 'contact_department', '', 'string'); switch ($op) { case 'save': @@ -67,14 +67,14 @@ // check email $input_mail = XoopsRequest::getString('contact_mail', '', 'POST'); $contact_mail = checkEmail($input_mail); -// $contact_mail = $contact_handler->contactCleanVars($_POST, 'contact_mail', '', 'mail'); +// $contact_mail = $contactHandler->contactCleanVars($_POST, 'contact_mail', '', 'mail'); if (empty($contact_mail)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); } elseif (!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['form_req_email2']) { $input_mail2 = XoopsRequest::getString('contact_mail2', '', 'POST'); $contact_mail2 = checkEmail($input_mail2); -// $contact_mail2 = $contact_handler->contactCleanVars($_POST, 'contact_mail2', '', 'mail'); +// $contact_mail2 = $contactHandler->contactCleanVars($_POST, 'contact_mail2', '', 'mail'); if (empty($contact_mail2)) { redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL2); // redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); @@ -85,20 +85,20 @@ } // Info Processing - $mailFormResults = $contact_handler->infoProcessing('POST'); + $mailFormResults = $contactHandler->infoProcessing('POST'); $mailObj = (object) $mailFormResults; // insert in DB if ($saveinfo = true) { - $contactObj = $contact_handler->create(); + $contactObj = $contactHandler->create(); $contactObj->prepareToInsert($mailObj); - if (!$contact_handler->insert($contactObj)) { + if (!$contactHandler->insert($contactObj)) { redirect_header('index.php', 3, _MD_CONTACT_MES_NOTSAVE); } } // send mail can send message if ($sendmail = true) { - $message = $contact_handler->contactSendMail($mailObj); + $message = $contactHandler->contactSendMail($mailObj); } elseif ($saveinfo = true) { $message = _MD_CONTACT_MES_SAVEINDB; } else { @@ -112,7 +112,7 @@ case 'form'; default: - $contactObj = $contact_handler->create(); + $contactObj = $contactHandler->create(); $form = $contactObj->contactForm(); $GLOBALS['xoopsTpl']->assign(array('form' => $form->render(), 'breadcrumb' => '<a href="' . $GLOBALS['xoops']->url('www') . '">' . _YOURHOME . '</a> » ' . $GLOBALS['xoopsModule']->name(), |
From: <zy...@us...> - 2015-01-31 18:47:57
|
Revision: 12959 http://sourceforge.net/p/xoops/svn/12959 Author: zyspec Date: 2015-01-31 18:47:43 +0000 (Sat, 31 Jan 2015) Log Message: ----------- * minor code cleanup * utilize XoopsFilterInput in ContactContact->contactSendMail() * add missing define(s) _MD_CONTACT_MSG_NOVALIDEMAIL2, _MD_CONTACT_MSG_EMAILMATCHFAILURE * removed deprecated methods from Contact class (getInsertId, contactCleanVars) * moved XoopsRequest loading to ./admin/admin_header.php * changed defines from _MD_CONTACT_MES_xxx to _MD_CONTACT_MSG_xxx for consistency Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/main.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -26,7 +26,8 @@ require __DIR__ . '/admin_header.php'; // Display Admin header xoops_cp_header(); -// Define default value + +//Get input $op = XoopsRequest::getString('op', 'list'); $contactId = XoopsRequest::getInt('id', '0'); $level = ''; @@ -66,14 +67,14 @@ if ($contactCount > $pageSettingsObj->limit) { $contactPageNavObj = new XoopsPageNav($contactCount, $pageSettingsObj->limit, $pageSettingsObj->start, 'start', 'limit=' . $pageSettingsObj->limit); - $contact_pagenav = $contactPageNavObj->renderNav(4); + $contactPagenav = $contactPageNavObj->renderNav(4); } else { - $contact_pagenav = ''; + $contactPagenav = ''; } $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, 'contacts' => $contacts, - 'contact_pagenav' => $contact_pagenav) + 'contact_pagenav' => $contactPagenav) ); $level = 'list'; break; @@ -106,7 +107,7 @@ // verfiy we're sending to a valid email if ((!$mailObj->contact_mail || !(checkEmail($mailObj->contact_mail))) && !$GLOBALS['xoopsModuleConfig']['form_dept']) { - redirect_header($_SERVER['PHP_SELF'], 3, _MD_CONTACT_MES_NOVALIDEMAIL); + redirect_header($_SERVER['PHP_SELF'], 3, _MD_CONTACT_MSG_NOVALIDEMAIL); } // verify valid message body @@ -128,9 +129,9 @@ if ($sendmail = true) { $message[] = $contactHandler->contactReplyMail($mailObj); } elseif ($saveinfo = true) { - $message = _MD_CONTACT_MES_SAVEINDB; + $message = _MD_CONTACT_MSG_SAVEINDB; } else { - $message[] = _MD_CONTACT_MES_SENDERROR; + $message[] = _MD_CONTACT_MSG_SENDERROR; } } else { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/log.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -26,7 +26,8 @@ require __DIR__ . '/admin_header.php'; // Display Admin header xoops_cp_header(); -// Define default value + +// Get input $op = XoopsRequest::getCmd('op', 'form'); switch ($op) { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/prune.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -27,7 +27,8 @@ require __DIR__ . '/admin_header.php'; // Display Admin header xoops_cp_header(); -// Define default value + +// Get input $op = XoopsRequest::getCmd('op', 'list'); switch ($op) { @@ -87,11 +88,9 @@ redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); } - $timeRequest = XoopsRequest::getString('prune_date', 0); + $timeRequest = XoopsRequest::getString('prune_date', 0, 'POST'); $timestamp = ($timeRequest) ? strtotime($timeRequest) : xoops_getUserTimestamp(time()); $onlyreply = XoopsRequest::getBool('onlyreply', false, 'POST'); -// $timestamp = $contactHandler->contactCleanVars($_POST, 'prune_date', xoops_getUserTimestamp(time()), 'date'); -// $onlyreply = (bool) $contactHandler->contactCleanVars($_POST, 'onlyreply', 0, 'int'); $count = (int) $contactHandler->deleteBeforeDate($timestamp, $onlyreply); redirect_header('prune.php', 2, sprintf(_AM_CONTACT_MSG_PRUNE_DELETED, $count)); xoops_cp_footer(); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/ajax.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -30,7 +30,6 @@ // Save info $contactObj = $contactHandler->create(); $contactObj->prepareToInsert($mailObj); -// $contentObj->setVars($contact); $contactHandler->insert($contactObj); // send mail can send message $message = $contactHandler->contactSendMail($mailObj); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -240,69 +240,7 @@ } /** - * Get variables passed by $_GET, $_POST, or unknown ($_REQUEST) * - * @deprecated in v1.82 Beta 2 - * @param array $global - * @param string $key array key to clean (e.g. id) - * @param mixed $default key's default value if invalid/no input - * @param string $type type of clean (e.g. int|string|date|array|mail, etc.. - * - * @return mixed sanitized value - */ - public function contactCleanVars(&$global, $key, $default = '', $type = 'int') - { - - switch ($type) { - case 'array': - $ret = (isset($global[$key]) && is_array($global[$key])) ? $global[$key] : $default; - break; - case 'date': - $ret = (isset($global[$key])) ? strtotime($global[$key]) : $default; - break; - case 'string': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_MAGIC_QUOTES) : $default; - break; - case 'mail': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_VALIDATE_EMAIL) : $default; - break; - case 'url': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) : $default; - break; - case 'ip': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_VALIDATE_IP) : $default; - break; - case 'amp': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_FLAG_ENCODE_AMP) : $default; - break; - case 'text': - $ret = (isset($global[$key])) ? htmlentities($global[$key], ENT_QUOTES, 'UTF-8') : $default; - break; - case 'platform': - $ret = (isset($global[$key])) ? $this->contactPlatform($global[$key]) : $this->contactPlatform($default); - break; - case 'type': - $ret = (isset($global[$key])) ? $this->contactType($global[$key]) : $this->contactType($default); - break; - case 'int': - case 'integer': - default: - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default; - break; - case 'float': - case 'double': - // Only use the first floating point value - preg_match('/-?[0-9]+(\.[0-9]+)?/', (string) $source, $matches); - $ret = @ (float) $matches[0]; - break; - - } - - return (false === $ret) ? $default : $ret; - } - - /** - * * Clean all the incoming Vars from Form(s) * @param $global global var array (POST, GET, REQUEST) * @uses {@link XoopsRequest} @@ -373,6 +311,7 @@ public function contactSendMail(stdClass &$mailObj) { include_once $GLOBALS['xoops']->path("modules/contact/include/functions.php"); + xoops_load('XoopsFilterInput'); $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $deptEmailAddresses = contactGetDepartmentEmails($mailObj->contact_department); @@ -382,16 +321,19 @@ } else { $xoopsMailer->setToEmails($GLOBALS['xoopsConfig']['adminmail']); //just send to admin } +/* if (!in_array($GLOBALS['xoopsConfig']['adminmail'], $deptEmailAddresses)) { - $xoopsMailer->multimailer->addBCC($GLOBALS['xoopsConfig']['adminmail'], 'TMC Administrator'); + $xoopsMailer->multimailer->addBCC($GLOBALS['xoopsConfig']['adminmail'], 'Administrator'); } - +*/ xoops_loadLanguage('modinfo', 'contact'); // get the language string(s) $myts =& MyTextSanitizer::getInstance(); // pre-process FromName since it came from input field - $fromName = stripslashes(strip_tags(html_entity_decode($mailObj->contact_name, ENT_QUOTES, 'UTF-8'))); + $fromName = XoopsFilterInput::getString($mailObj->contact_name, 'STRING'); +// $fromName = stripslashes(strip_tags(html_entity_decode($mailObj->contact_name, ENT_QUOTES, 'UTF-8'))); // pre-process Subject since it came from input field - $mailSubject = stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8'))); + $mailSubject = XoopsFilterInput::getString($mailObj->contact_subject, 'STRING'); +// $mailSubject = stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8'))); $xoopsMailer->setFromName(ucwords($fromName)); $xoopsMailer->setFromEmail($mailObj->contact_mail); @@ -427,11 +369,10 @@ */ public function contactReplyMail(stdClass &$mailObj) { - $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $toEmails = $mailObj->contact_mail; - include_once "../include/functions.php"; + include_once $GLOBALS['xoops']->path("modules/contact/include/functions.php"); $deptEmailAddresses = contactGetDepartmentEmails($mailObj->contact_department); //get emails for department (if enabled) if (!empty($deptEmailAddresses)) { //get emails for department (if enabled) $xoopsMailer->setFromEmail($deptEmailAddresses[0]); // set to dept email to first one @@ -449,9 +390,11 @@ } $xoopsMailer->setFromName($fromName); - if (!empty($mailObj->contact_mailfrom)) { // use mail addr from ReplyForm + if (!empty($mailObj->contact_mailfrom)) { + // use mail addr from ReplyForm $xoopsMailer->setFromName($mailObj->contact_mailfrom); - } else { // otherwise use default site admin email + } else { + // otherwise use default site admin email $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); } } @@ -531,7 +474,7 @@ $criteria->setOrder($pgObj->order); $criteria->setStart($pgObj->start); $criteria->setLimit($pgObj->limit); - $contactObjs = $this->getObjects($criteria, false); + $contactObjs = $this->getObjects($criteria, false); $user_timezone = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->timezone() : null; foreach($contactObjs as $thisContact) { $tab = $thisContact->getValues(); @@ -564,38 +507,6 @@ } /** - * Get Insert ID - * - * @deprecated - * @return bool|int false on failure, integer of item Id - */ - public function getInsertId() - { - return $this->db->getInsertId(); - } - - /** - * Contact Prune Count - * @deprecated - * @param int $timestamp all items <= this timestamp - * @param bool $onlyreply true - only include replies, false include everything - * - * @param int count of items to be pruned - */ - public function pruneCount($timestamp=0, $onlyreply=false) - { - $criteria = new CriteriaCompo(); - if (!empty($timestamp)) { - $criteria->add(new Criteria('contact_create', $timestamp, '<=')); - } - if ($onlyreply) { - $criteria->add(new Criteria('contact_reply', 1)); - } - - return $this->getCount($criteria); - } - - /** * Contact Delete Before Date * @param int $timestamp Unix timestamp * @param bool $onlyreply - true only delete replies, false delete everything Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -24,5 +24,6 @@ include dirname(dirname(__DIR__)) . '/mainfile.php'; include $GLOBALS['xoops']->path('www/modules/contact/class/contact.php'); include_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); +xoops_load('XoopsRequest'); $contactHandler =& xoops_getModuleHandler('contact', 'contact'); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions_update.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -40,10 +40,10 @@ * - the routine is intentionally limitted for this * install routine's requirements} */ - $moduleDir = basename(dirname(__DIR__)); + $moduleDirname = basename(dirname(__DIR__)); $dir = preg_replace('/[^a-zA-Z\s\d\_\-\/]/', '', $dir); $dir = trim($dir, " \t\n\r\0\x0B\/"); //trim leading/trailing spaces and '/' - $path = $GLOBALS['xoops']->path("www/modules/{$moduleDir}/{$dir}"); + $path = $GLOBALS['xoops']->path("www/modules/{$moduleDirname}/{$dir}"); $objs = array_diff(scandir($path), array('.','..')); // remove relative dirs foreach ($objs as $obj) { if (is_dir("{$path}/{$obj}")) { Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/index.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -23,20 +23,15 @@ include __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'contact_index.tpl'; -//unset($_SESSION); include $GLOBALS['xoops']->path("/header.php"); -xoops_load('XoopsRequest'); $op = XoopsRequest::getCmd('op', 'form', 'POST'); $department = XoopsRequest::getString('contact_department', '', 'GET'); -//$op = $contactHandler->contactCleanVars($_POST, 'op', 'form', 'string'); -//$department = $contactHandler->contactCleanVars($_GET, 'contact_department', '', 'string'); - switch ($op) { case 'save': if (empty($_POST['submit']) ) { - redirect_header($GLOBALS['xoops']->url('www'), 3, _MD_CONTACT_MES_ERROR); + redirect_header($GLOBALS['xoops']->url('www'), 3, _MD_CONTACT_MSG_ERROR); } else { // check to make sure this passes form submission security if ( ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) ) { @@ -67,20 +62,18 @@ // check email $input_mail = XoopsRequest::getString('contact_mail', '', 'POST'); $contact_mail = checkEmail($input_mail); -// $contact_mail = $contactHandler->contactCleanVars($_POST, 'contact_mail', '', 'mail'); if (empty($contact_mail)) { - redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL); -// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); + redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MSG_NOVALIDEMAIL); +// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MSG_NOVALIDEMAIL); } elseif (!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['form_req_email2']) { $input_mail2 = XoopsRequest::getString('contact_mail2', '', 'POST'); $contact_mail2 = checkEmail($input_mail2); -// $contact_mail2 = $contactHandler->contactCleanVars($_POST, 'contact_mail2', '', 'mail'); if (empty($contact_mail2)) { - redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_NOVALIDEMAIL2); -// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_NOVALIDEMAIL); + redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MSG_NOVALIDEMAIL2); +// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MSG_NOVALIDEMAIL); } elseif (($contact_mail != $contact_mail2)) { - redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MES_EMAILMATCHFAILURE); -// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MES_EMAILMATCHFAILURE); + redirect_header($_SERVER['PHP_SELF'], 2, _MD_CONTACT_MSG_EMAILMATCHFAILURE); +// redirect_header("javascript:history.go(-1)", 2, _MD_CONTACT_MSG_EMAILMATCHFAILURE); } } @@ -92,7 +85,7 @@ $contactObj = $contactHandler->create(); $contactObj->prepareToInsert($mailObj); if (!$contactHandler->insert($contactObj)) { - redirect_header('index.php', 3, _MD_CONTACT_MES_NOTSAVE); + redirect_header('index.php', 3, _MD_CONTACT_MSG_NOTSAVE); } } @@ -100,9 +93,9 @@ if ($sendmail = true) { $message = $contactHandler->contactSendMail($mailObj); } elseif ($saveinfo = true) { - $message = _MD_CONTACT_MES_SAVEINDB; + $message = _MD_CONTACT_MSG_SAVEINDB; } else { - $message = _MD_CONTACT_MES_SENDERROR; + $message = _MD_CONTACT_MSG_SENDERROR; } redirect_header($GLOBALS['xoops']->url('www'), 3, $message); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/admin.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -9,7 +9,7 @@ define('_AM_CONTACT_MAINTAINED_TITLE', "Visit XOOPS Community"); define('_AM_CONTACT_MAINTAINED_TEXT', "XOOPS Community"); // Contact -define('_AM_CONTACT_ID', "Id"); +//define('_AM_CONTACT_ID', "Id"); define('_AM_CONTACT_SUBJECT', "Subject"); define('_AM_CONTACT_DEPARTMENT', "Department"); define('_AM_CONTACT_SUBMITTER', "Submitter"); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/main.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/main.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/main.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -13,10 +13,12 @@ define('_MD_CONTACT_MESSAGE', "Comment"); define('_MD_CONTACT_DEPARTMENT', "Department"); define('_MD_CONTACT_DEFULTDEP', "Contact us"); -define('_MD_CONTACT_MES_SEND', "Thank you for contacting us"); -define('_MD_CONTACT_MES_NOVALIDEMAIL', "Your Email is not Valid"); -define('_MD_CONTACT_MES_NOTSAVE', "Sorry, your Message was not saved in our DB"); -define('_MD_CONTACT_MES_SAVEINDB', "Your Message has been saved in our DB"); -define('_MD_CONTACT_MES_SENDERROR', "Error in sending Message"); -define('_MD_CONTACT_MES_ERROR', "Error"); +define('_MD_CONTACT_MSG_SEND', "Thank you for contacting us"); +define('_MD_CONTACT_MSG_NOVALIDEMAIL', "Your Email is not valid"); +define('_MD_CONTACT_MSG_NOVALIDEMAIL2', "The 2nd Email entered is not valid"); +define('_MD_CONTACT_MSG_EMAILMATCHFAILURE', "Email fields do not match"); +define('_MD_CONTACT_MSG_NOTSAVE', "Sorry, your Message was not saved in our DB"); +define('_MD_CONTACT_MSG_SAVEINDB', "Your Message has been saved in our DB"); +define('_MD_CONTACT_MSG_SENDERROR', "Error in sending Message"); +define('_MD_CONTACT_MSG_ERROR', "Error"); define('_MD_CONTACT_INVALID_SECURITY_TOKEN', "Invalid security token. Please try again."); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -34,8 +34,8 @@ define('_MI_CONTACT_MENU_LOGS_DESC', "Get Logs"); define('_MI_CONTACT_MENU_ABOUT', "About"); define('_MI_CONTACT_MENU_ABOUT_DESC', "About this module"); -define('_MI_CONTACT_MENU_HELP', "Help"); -define('_MI_CONTACT_MENU_HELP_DESC', "Module help"); +//define('_MI_CONTACT_MENU_HELP', "Help"); +//define('_MI_CONTACT_MENU_HELP_DESC', "Module help"); // Module Settings define('_MI_CONTACT_FORM_URL', "Get URL"); define('_MI_CONTACT_FORM_URL_DESC', ""); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php 2015-01-31 15:28:27 UTC (rev 12958) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php 2015-01-31 18:47:43 UTC (rev 12959) @@ -80,7 +80,7 @@ // Blocks 'blocks'=> array(array('file' => "stats.php", 'name' => _MI_CONTACT_BNAME1, - 'description' => '_MI_STATS_BNAME1_DESC', + 'description' => '_MI_CONTACT_BNAME1_DESC', 'show_func' => 'b_contact_stats_show', // 'edit_func' => 'b_contact_stats_edit', 'template' => 'contact_block_stats.tpl', |
From: <zy...@us...> - 2016-07-12 02:54:24
|
Revision: 13213 http://sourceforge.net/p/xoops/svn/13213 Author: zyspec Date: 2016-07-12 02:54:19 +0000 (Tue, 12 Jul 2016) Log Message: ----------- update calls to XOOPS studlyCaps functions, fix index declaration in SQL file, remove trailing slash for HTML void elements Modified Paths: -------------- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/formvalidatedinput.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/ajax.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/docs/changelog.txt XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/header.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/functions.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/include/waiting.plugin.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/help.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/help/module_index.html XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/language/english/modinfo.php XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/sql/mysql.sql XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/templates/admin/contact_contact.tpl XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/xoops_version.php Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_footer.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -24,7 +24,7 @@ echo "<div class='adminfooter'>\n" . " <div class='center'>\n" - . " <a href='" . $GLOBALS['xoopsModule']->getInfo('author_website_url') . "' target='_blank'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' title='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' /></a>\n" + . " <a href='" . $GLOBALS['xoopsModule']->getInfo('author_website_url') . "' target='_blank'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' title='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "'></a>\n" . " </div>\n" . " <div class='center smallsmall italic pad5'>\n" . " " . _AM_CONTACT_MAINTAINED_BY Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/admin_header.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -46,4 +46,4 @@ // Contact Module specific pieces include_once $GLOBALS['xoops']->path("/modules/{$moduleDirname}/include/functions.php"); -$contactHandler =& xoops_getModuleHandler('contact', $moduleDirname); +$contactHandler = xoops_getModuleHandler('contact', $moduleDirname); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/contact.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -1,207 +1,207 @@ -<?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. - */ - -/** - * Contact module - * - * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package contact - * @subpackage admin - * @author Kazumi Ono (aka Onokazu) - * @author Trabis <lus...@gm...> - * @author Hossein Azizabadi (AKA Voltan) - * @version $Id: $ - */ - -// Call header -require __DIR__ . '/admin_header.php'; -// Display Admin header -xoops_cp_header(); - -//Get input -$op = XoopsRequest::getString('op', 'list'); -$contactId = XoopsRequest::getInt('id', '0'); -$level = ''; - -// Define scripts -$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); -$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); -$xoTheme->addScript($GLOBALS['xoops']->url('www/modules/contact/assets/js/admin.js')); - -// Add module stylesheet -$xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/contact/assets/css/admin.css')); - -//add system module stylesheets -$moduleHandler =& xoops_gethandler('module'); -$systemModule =& $moduleHandler->getByDirname('system'); -$configHandler =& xoops_gethandler('config'); -if ($systemModule instanceof XoopsModule) { - $moduleConfig =& $configHandler->getConfigsByCat(0, $systemModule->getVar('mid')); - if (isset($moduleConfig['jquery_theme'])) { - $xoTheme->addStylesheet($GLOBALS['xoops']->url("www/modules/system/css/ui/{$moduleConfig['jquery_theme']}/ui.all.css")); - } -} -$xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/system/css/admin.css')); - -switch ($op) { - case 'list': - default: - $pageSettingsObj = new stdClass(); // create a new stdClass object - $pageSettingsObj->perpage = (int) $GLOBALS['xoopsModuleConfig']['admin_perpage']; - $pageSettingsObj->order = 'DESC'; - $pageSettingsObj->sort = 'contact_id'; - $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); - $pageSettingsObj->start = XoopsRequest::getInt('start', 0); - - $contactCount = $contactHandler->contactGetCount('contact_cid'); //count all contacts - $contacts = $contactHandler->getAdminList($pageSettingsObj, 'contact_cid'); - - if ($contactCount > $pageSettingsObj->limit) { - $contactPageNavObj = new XoopsPageNav($contactCount, $pageSettingsObj->limit, $pageSettingsObj->start, 'start', 'limit=' . $pageSettingsObj->limit); - $contactPagenav = $contactPageNavObj->renderNav(4); - } else { - $contactPagenav = ''; - } - - $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, - 'contacts' => $contacts, - 'contact_pagenav' => $contactPagenav) - ); - $level = 'list'; - break; - - case 'reply': - if ($contactId > 0) { - $obj = $contactHandler->get($contactId); - if (!($obj instanceof contact) || (0 != $obj->getVar('contact_cid'))) { - redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_REPLY_CANT); - } - - $form = $obj->replyForm(); - $GLOBALS['xoopsTpl']->assign(array('replyform' => $form->render(), - 'replylist' => $contactHandler->contactGetReply($contactId), - 'use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, - ) - ); - } else { - redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); - } - $level = 'reply'; - break; - - case 'doreply': - $formInput = $contactHandler->infoProcessing('POST'); - $mailObj = (object) $formInput; - unset($formInput); - $deptEmails = array(); - $message = array(); - - // verfiy we're sending to a valid email - if ((!$mailObj->contact_mail || !(checkEmail($mailObj->contact_mail))) && !$GLOBALS['xoopsModuleConfig']['form_dept']) { - redirect_header($_SERVER['PHP_SELF'], 3, _MD_CONTACT_MSG_NOVALIDEMAIL); - } - - // verify valid message body - $mailObj->contact_message = $contactHandler->replyBodyFormat($mailObj, (bool) $mailObj->inc_orig); - if ($mailObj->contact_message) { - // successfully retrieved message body so insert into dB - if ($saveinfo = true) { - $contactObj = $contactHandler->create(); - $contactObj->prepareToInsert($mailObj); - if (!$contactHandler->insert($contactObj)) { - redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTSAVED); - } - $contactHandler->contactAddReply($contactObj->getVar('contact_cid')); - } else { - $message[] = _AM_CONTACT_MSG_NOTSAVED; // did not save message - } - - // send mail can send message if $sendmail = true - if ($sendmail = true) { - $message[] = $contactHandler->contactReplyMail($mailObj); - } elseif ($saveinfo = true) { - $message = _MD_CONTACT_MSG_SAVEINDB; - } else { - $message[] = _MD_CONTACT_MSG_SENDERROR; - } - - } else { - //failed to set message body - $message[] = _AM_CONTACT_MSG_NOBODY; - } - - redirect_header($_SERVER['PHP_SELF'], 3, implode('<br />', $message)); - - $level = 'doreply'; - break; - - case 'view': - $obj = $contactHandler->get($contactId); - - if (!$obj) { - redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); - exit (); - } - $user_timezone = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->timezone() : null; - - $contact = $obj->getValues(); - $contact['contact_owner'] = XoopsUser::getUnameFromId($contact['contact_uid']); - $contact['contact_create'] = formatTimestamp($contact['contact_create'], 'm', $user_timezone); - - $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, - 'contact' => $contact, - 'replylist' => $contactHandler->contactGetReply($contactId)) - ); - - $level = 'view'; - break; - - case 'delete': - if (!$contactId) { - redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); - } - // Prompt message - xoops_confirm(array('id' => $contactId, 'op' => 'dodelete'), $_SERVER['PHP_SELF'], _AM_CONTACT_MSG_DELETE); - $level = 'delete'; - break; - - case 'dodelete': - // check to make sure this passes form submission security - if ( ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) ) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { - // failed xoops security check - redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); - } - } else { - redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); - } - - if (!$contactId) { - $msg = _AM_CONTACT_MSG_NOTEXIST; - } else { - $criteria = new CriteriaCompo (); - $criteria->add(new Criteria ('contact_id', $contactId)); //messages - $criteria->add(new Criteria ('contact_cid', $contactId), 'OR'); //replies - $msg = (!$contactHandler->deleteAll($criteria)) ? _AM_CONTACT_MSG_DELETEERROR : _AM_CONTACT_MSG_DELETED; - } - redirect_header($_SERVER['PHP_SELF'], 3, $msg); - break; -} - -$GLOBALS['xoopsTpl']->assign(array('navigation' => $admin_class->addNavigation('contact.php'), - 'level' => $level) -); - -// Call template file -$GLOBALS['xoopsTpl']->display($GLOBALS['xoops']->path('www/modules/contact/templates/admin/contact_contact.tpl')); -// Call footer -require __DIR__ . '/admin_footer.php'; +<?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. + */ + +/** + * Contact module + * + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package contact + * @subpackage admin + * @author Kazumi Ono (aka Onokazu) + * @author Trabis <lus...@gm...> + * @author Hossein Azizabadi (AKA Voltan) + * @version $Id: $ + */ + +// Call header +require __DIR__ . '/admin_header.php'; +// Display Admin header +xoops_cp_header(); + +//Get input +$op = XoopsRequest::getString('op', 'list'); +$contactId = XoopsRequest::getInt('id', '0'); +$level = ''; + +// Define scripts +$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); +$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); +$xoTheme->addScript($GLOBALS['xoops']->url('www/modules/contact/assets/js/admin.js')); + +// Add module stylesheet +$xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/contact/assets/css/admin.css')); + +//add system module stylesheets +$moduleHandler = xoops_getHandler('module'); +$systemModule = $moduleHandler->getByDirname('system'); +$configHandler = xoops_getHandler('config'); +if ($systemModule instanceof XoopsModule) { + $moduleConfig = $configHandler->getConfigsByCat(0, $systemModule->getVar('mid')); + if (isset($moduleConfig['jquery_theme'])) { + $xoTheme->addStylesheet($GLOBALS['xoops']->url("www/modules/system/css/ui/{$moduleConfig['jquery_theme']}/ui.all.css")); + } +} +$xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/system/css/admin.css')); + +switch ($op) { + case 'list': + default: + $pageSettingsObj = new stdClass(); // create a new stdClass object + $pageSettingsObj->perpage = (int) $GLOBALS['xoopsModuleConfig']['admin_perpage']; + $pageSettingsObj->order = 'DESC'; + $pageSettingsObj->sort = 'contact_id'; + $pageSettingsObj->limit = XoopsRequest::getInt('limit', $pageSettingsObj->perpage); + $pageSettingsObj->start = XoopsRequest::getInt('start', 0); + + $contactCount = $contactHandler->contactGetCount('contact_cid'); //count all contacts + $contacts = $contactHandler->getAdminList($pageSettingsObj, 'contact_cid'); + + if ($contactCount > $pageSettingsObj->limit) { + $contactPageNavObj = new XoopsPageNav($contactCount, $pageSettingsObj->limit, $pageSettingsObj->start, 'start', 'limit=' . $pageSettingsObj->limit); + $contactPagenav = $contactPageNavObj->renderNav(4); + } else { + $contactPagenav = ''; + } + + $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, + 'contacts' => $contacts, + 'contact_pagenav' => $contactPagenav) + ); + $level = 'list'; + break; + + case 'reply': + if ($contactId > 0) { + $obj = $contactHandler->get($contactId); + if (!($obj instanceof contact) || (0 != $obj->getVar('contact_cid'))) { + redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_REPLY_CANT); + } + + $form = $obj->replyForm(); + $GLOBALS['xoopsTpl']->assign(array('replyform' => $form->render(), + 'replylist' => $contactHandler->contactGetReply($contactId), + 'use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, + ) + ); + } else { + redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); + } + $level = 'reply'; + break; + + case 'doreply': + $formInput = $contactHandler->infoProcessing('POST'); + $mailObj = (object) $formInput; + unset($formInput); + $deptEmails = array(); + $message = array(); + + // verfiy we're sending to a valid email + if ((!$mailObj->contact_mail || !(checkEmail($mailObj->contact_mail))) && !$GLOBALS['xoopsModuleConfig']['form_dept']) { + redirect_header($_SERVER['PHP_SELF'], 3, _MD_CONTACT_MSG_NOVALIDEMAIL); + } + + // verify valid message body + $mailObj->contact_message = $contactHandler->replyBodyFormat($mailObj, (bool) $mailObj->inc_orig); + if ($mailObj->contact_message) { + // successfully retrieved message body so insert into dB + if ($saveinfo = true) { + $contactObj = $contactHandler->create(); + $contactObj->prepareToInsert($mailObj); + if (!$contactHandler->insert($contactObj)) { + redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTSAVED); + } + $contactHandler->contactAddReply($contactObj->getVar('contact_cid')); + } else { + $message[] = _AM_CONTACT_MSG_NOTSAVED; // did not save message + } + + // send mail can send message if $sendmail = true + if ($sendmail = true) { + $message[] = $contactHandler->contactReplyMail($mailObj); + } elseif ($saveinfo = true) { + $message = _MD_CONTACT_MSG_SAVEINDB; + } else { + $message[] = _MD_CONTACT_MSG_SENDERROR; + } + + } else { + //failed to set message body + $message[] = _AM_CONTACT_MSG_NOBODY; + } + + redirect_header($_SERVER['PHP_SELF'], 3, implode('<br>', $message)); + + $level = 'doreply'; + break; + + case 'view': + $obj = $contactHandler->get($contactId); + + if (!$obj) { + redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); + exit (); + } + $user_timezone = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->timezone() : null; + + $contact = $obj->getValues(); + $contact['contact_owner'] = XoopsUser::getUnameFromId($contact['contact_uid']); + $contact['contact_create'] = formatTimestamp($contact['contact_create'], 'm', $user_timezone); + + $GLOBALS['xoopsTpl']->assign(array('use_depts' => $GLOBALS['xoopsModuleConfig']['form_dept'] ? 1 : 0, + 'contact' => $contact, + 'replylist' => $contactHandler->contactGetReply($contactId)) + ); + + $level = 'view'; + break; + + case 'delete': + if (!$contactId) { + redirect_header($_SERVER['PHP_SELF'], 3, _AM_CONTACT_MSG_NOTEXIST); + } + // Prompt message + xoops_confirm(array('id' => $contactId, 'op' => 'dodelete'), $_SERVER['PHP_SELF'], _AM_CONTACT_MSG_DELETE); + $level = 'delete'; + break; + + case 'dodelete': + // check to make sure this passes form submission security + if ( ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) ) { + if ( !$GLOBALS['xoopsSecurity']->check() ) { + // failed xoops security check + redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); + } + } else { + redirect_header('index.php', 3, _MD_CONTACT_INVALID_SECURITY_TOKEN); + } + + if (!$contactId) { + $msg = _AM_CONTACT_MSG_NOTEXIST; + } else { + $criteria = new CriteriaCompo (); + $criteria->add(new Criteria ('contact_id', $contactId)); //messages + $criteria->add(new Criteria ('contact_cid', $contactId), 'OR'); //replies + $msg = (!$contactHandler->deleteAll($criteria)) ? _AM_CONTACT_MSG_DELETEERROR : _AM_CONTACT_MSG_DELETED; + } + redirect_header($_SERVER['PHP_SELF'], 3, $msg); + break; +} + +$GLOBALS['xoopsTpl']->assign(array('navigation' => $admin_class->addNavigation('contact.php'), + 'level' => $level) +); + +// Call template file +$GLOBALS['xoopsTpl']->display($GLOBALS['xoops']->path('www/modules/contact/templates/admin/contact_contact.tpl')); +// Call footer +require __DIR__ . '/admin_footer.php'; Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/admin/menu.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -1,56 +1,56 @@ -<?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. - */ - -/** - * Contact module - * - * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package contact - * @subpackage admin - * @author Kazumi Ono (aka Onokazu) - * @author Trabis <lus...@gm...> - * @author Hossein Azizabadi (AKA Voltan) - * @version $Id$ - */ - -// defined("XOOPS_ROOT_PATH") || exit("Restricted access"); - -$moduleHandler = xoops_gethandler('module'); -$module = $moduleHandler->getByDirname(basename(dirname(__DIR__))); -$pathIcon32 = '../../' . $module->getInfo('icons32'); -xoops_loadLanguage('modinfo', $module->dirname()); - -$adminmenu = array(array('title' => _MI_CONTACT_MENU_HOME, - 'link' => "admin/index.php", - 'desc' => _MI_CONTACT_MENU_HOME_DESC, - 'icon' => "{$pathIcon32}/home.png"), - - array('title' => _MI_CONTACT_MENU_CONTACT, - 'link' => "admin/contact.php", - 'desc' => _MI_CONTACT_MENU_CONTACT_DESC, - 'icon' => "{$pathIcon32}/content.png"), - - array('title' => _MI_CONTACT_MENU_LOGS, - 'link' => "admin/log.php", - 'desc' => _MI_CONTACT_MENU_LOGS_DESC, - 'icon' => "{$pathIcon32}/exec.png"), - - array('title' => _MI_CONTACT_MENU_PRUNE, - 'link' => "admin/prune.php", - 'desc' => _MI_CONTACT_MENU_PRUNE_DESC, - 'icon' => "{$pathIcon32}/prune.png"), - - array('title' => _MI_CONTACT_MENU_ABOUT, - 'link' => "admin/about.php", - 'desc' => _MI_CONTACT_MENU_ABOUT_DESC, - 'icon' => "{$pathIcon32}/about.png") -); +<?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. + */ + +/** + * Contact module + * + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package contact + * @subpackage admin + * @author Kazumi Ono (aka Onokazu) + * @author Trabis <lus...@gm...> + * @author Hossein Azizabadi (AKA Voltan) + * @version $Id$ + */ + +// defined("XOOPS_ROOT_PATH") || exit("Restricted access"); + +$moduleHandler = xoops_getHandler('module'); +$module = $moduleHandler->getByDirname(basename(dirname(__DIR__))); +$pathIcon32 = '../../' . $module->getInfo('icons32'); +xoops_loadLanguage('modinfo', $module->dirname()); + +$adminmenu = array(array('title' => _MI_CONTACT_MENU_HOME, + 'link' => "admin/index.php", + 'desc' => _MI_CONTACT_MENU_HOME_DESC, + 'icon' => "{$pathIcon32}/home.png"), + + array('title' => _MI_CONTACT_MENU_CONTACT, + 'link' => "admin/contact.php", + 'desc' => _MI_CONTACT_MENU_CONTACT_DESC, + 'icon' => "{$pathIcon32}/content.png"), + + array('title' => _MI_CONTACT_MENU_LOGS, + 'link' => "admin/log.php", + 'desc' => _MI_CONTACT_MENU_LOGS_DESC, + 'icon' => "{$pathIcon32}/exec.png"), + + array('title' => _MI_CONTACT_MENU_PRUNE, + 'link' => "admin/prune.php", + 'desc' => _MI_CONTACT_MENU_PRUNE_DESC, + 'icon' => "{$pathIcon32}/prune.png"), + + array('title' => _MI_CONTACT_MENU_ABOUT, + 'link' => "admin/about.php", + 'desc' => _MI_CONTACT_MENU_ABOUT_DESC, + 'icon' => "{$pathIcon32}/about.png") +); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/blocks/stats.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -29,7 +29,7 @@ * * Show Contact Us stats block * - * @uses xoops_getmodulehandler + * @uses xoops_getModuleHandler * @uses CriteriaCompo * @uses ContactContact * @uses ContactContactHandler @@ -43,7 +43,7 @@ $block = array(); - $contactHandler =& xoops_getmodulehandler('contact', $moduleDirname); + $contactHandler = xoops_getModuleHandler('contact', $moduleDirname); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('contact_cid', 0)); $criteria->add(new Criteria('contact_type', 'Contact')); Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php =================================================================== --- XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2016-05-29 22:57:53 UTC (rev 13212) +++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/contact/class/contact.php 2016-07-12 02:54:19 UTC (rev 13213) @@ -1,648 +1,650 @@ -<?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. - */ - -/** - * Contact module - * - * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package contact - * @subpackage class - * @author Kazumi Ono (aka Onokazu) - * @author Trabis <lus...@gm...> - * @author Hossein Azizabadi (AKA Voltan) - * @version $Id: $ - */ - -//defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); -class Contact extends XoopsObject -{ - - public function __construct() - { - $this->XoopsObject(); - $this->initVar("contact_id", XOBJ_DTYPE_INT, null, false, 11); - $this->initVar("contact_uid", XOBJ_DTYPE_INT, null, false, 11); - $this->initVar("contact_cid", XOBJ_DTYPE_INT, null, false, 11); - $this->initVar("contact_name", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_subject", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_mail", XOBJ_DTYPE_EMAIL, null, false); - $this->initVar("contact_url", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_create", XOBJ_DTYPE_INT, null, false); - $this->initVar("contact_icq", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_company", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_location", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_phone", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_department", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_ip", XOBJ_DTYPE_TXTBOX, null, false); - $this->initVar("contact_message", XOBJ_DTYPE_TXTAREA, null, false); - $this->initVar("contact_address", XOBJ_DTYPE_TXTAREA, null, false); - $this->initVar("contact_reply", XOBJ_DTYPE_INT, null, false, 1); - $this->initVar("contact_platform", XOBJ_DTYPE_ENUM, null, false, '', '', array('Android', 'Ios', 'Web')); - $this->initVar("contact_type", XOBJ_DTYPE_ENUM, null, false, '', '', array('Contact', 'Phone', 'Mail')); - - $this->db = $GLOBALS['xoopsDB']; - $this->table = $this->db->prefix('contact'); - } - - public function contactForm() - { - - if ($this->isNew()) { - if (($GLOBALS['xoopsUser'] instanceof XoopsUser) && ($GLOBALS['xoopsUser']->uid())) { - $contact_uid = $GLOBALS['xoopsUser']->getVar('uid'); - $contact_name = $GLOBALS['xoopsUser']->getVar('uname'); - $contact_mail = $GLOBALS['xoopsUser']->getVar('email'); - $contact_mail2 = $GLOBALS['xoopsUser']->getVar('email'); - $contact_url = $GLOBALS['xoopsUser']->getVar('url'); - $contact_icq = $GLOBALS['xoopsUser']->getVar('user_icq'); - $contact_location = $GLOBALS['xoopsUser']->getVar('user_from'); - - } else { - $contact_uid = 0; - $contact_name = ''; - $contact_mail = ''; - $contact_mail2 = ''; - $contact_url = ''; - $contact_icq = ''; - $contact_location = ''; - } - } else { - $contact_uid = $this->getVar('contact_uid'); - $contact_name = $this->getVar('contact_name'); - $contact_mail = $this->getVar('contact_mail'); - $contact_mail2 = $this->getVar('contact_mail'); - $contact_url = $this->getVar('contact_url'); - $contact_icq = $this->getVar('contact_icq'); - $contact_location = $this->getVar('contact_location'); - } - - xoops_load('FormValidatedInput', 'contact'); - $form = new XoopsThemeForm(_MD_CONTACT_FORM, 'save', 'index.php', 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - $form->addElement(new XoopsFormHidden('op', 'save')); - $form->addElement(new XoopsFormHidden('contact_id', $this->getVar('contact_id', 'e'))); - $form->addElement(new XoopsFormHidden('contact_uid', $contact_uid)); - if ($contact_uid > 0) { - // XOOPS user so don't allow entry of name/email (changed in v1.82) - $form->addElement(new XoopsFormHidden('contact_name', $contact_name)); - $form->addElement(new XoopsFormHidden('contact_mail', $contact_mail)); - /** @internal re-enable following code (and disable previous) if you want XoopsUser to edit their name/email */ - /* - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_NAME, 'contact_name', 50, 255, $contact_name), true); - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_MAIL, 'contact_mail', 50, 255, $contact_mail, 'email'), true); - */ - } else { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_NAME, 'contact_name', 50, 255, $contact_name), true); - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_MAIL, 'contact_mail', 50, 255, $contact_mail, 'email'), true); - } - - if (!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['form_req_email2']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_MAIL2, 'contact_mail2', 50, 255, $contact_mail2, 'email'), true); - } - if ($GLOBALS['xoopsModuleConfig']['form_url']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_URL, 'contact_url', 50, 255, $contact_url, 'url'), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_icq']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_ICQ, 'contact_icq', 50, 255, $contact_icq), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_company']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_COMPANY, 'contact_company', 50, 255, $this->getVar('contact_company')), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_location']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_LOCATION, 'contact_location', 50, 255, $contact_location), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_phone']) { - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_PHONE, 'contact_phone', 50, 255, $this->getVar('contact_phone'), 'tel'), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_address']) { - $form->addElement(new XoopsFormTextArea(_MD_CONTACT_ADDRESS, 'contact_address', $this->getVar('contact_address', 'e'), 3, 60), false); - } - if ($GLOBALS['xoopsModuleConfig']['form_dept']) { - // show a drop down with the departments listed - $departmentlist = new XoopsFormSelect(_MD_CONTACT_DEPARTMENT, 'contact_department'); - $departments = $GLOBALS['xoopsModuleConfig']['contact_dept']; - $listOptions = array(); - foreach ($departments as $val) { - $valexplode = explode(',', $val); - $listOptions[$valexplode[0]] = $valexplode[0]; -// $departmentlist->addOption($valexplode[0]); - } - asort($listOptions); - $departmentlist->addOptionArray($listOptions); - $form->addElement($departmentlist); - } else { - $form->addElement(new XoopsFormHidden('contact_department', '')); - } - - $form->addElement(new ContactFormValidatedInput(_MD_CONTACT_SUBJECT, 'contact_subject', 50, 255, $this->getVar('contact_subject')), true); - $form->addElement(new XoopsFormTextArea(_MD_CONTACT_MESSAGE, 'contact_message', $this->getVar('contact_message', 'e'), 5, 60), true); - - // check captcha - if ((!$GLOBALS['xoopsUser'] && $GLOBALS['xoopsModuleConfig']['captchaAnonymous']) - || ($GLOBALS['xoopsUser'] && !$GLOBALS['xoopsUser']->isAdmin() && $GLOBALS['xoopsModuleConfig']['captchaRegistered']) - ) { - xoops_load('XoopsFormCaptcha'); - $form->addElement(new XoopsFormCaptcha('','xoopscaptcha',false), true); - } - - $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - - return $form; - } - - /** - * - * Get the Contact Reply Form Object - * - * @return object {@see XoopsThemeForm} - */ - public function replyForm() - { - xoops_load('FormValidatedInput', 'contact'); - $form = new XoopsThemeForm(_AM_CONTACT_REPLY, 'doreply', 'contact.php', 'post', true); - $form->setExtra('enctype="multipart/form-data"'); - $form->addElement(new XoopsFormHidden('op', 'doreply')); - $form->addElement(new XoopsFormHidden('contact_id', $this->getVar('contact_id', 'e'))); - $form->addElement(new XoopsFormHidden('contact_uid', $this->getVar('contact_uid', 'e'))); - $form->insertBreak(_AM_CONTACT_FROM, "big bolder uppercase"); - - if ($GLOBALS['xoopsModuleConfig']['form_dept']) { - // add dropdown to allow administrator to change "From" department - include_once "../include/functions.php"; - $dept_values = $dept_keys = contactGetDepartmentNames(); - $dept_options = array_combine($dept_keys, $dept_values); - $dept_select = new XoopsFormSelect(_AM_CONTACT_DEPARTMENT, 'contact_department', $this->getVar('contact_department')); - $dept_select->addOptionArray($dept_options); - $form->addElement($dept_select, true); - $bccbox = new XoopsFormCheckBox('', 'send_dept', 0); - $bccbox->addOption(1, _AM_CONTACT_SEND_DEPT); - $form->addElement($bccbox); - } else { - $form->addElement(new XoopsFormHidden('send_dept', 0)); // not necessary, but included for completeness - $form->addElement(new ContactFormValidatedInput(_AM_CONTACT_NAMEFROM, 'contact_namefrom', 50, 255, XoopsUser::getUnameFromId($GLOBALS['xoopsUser']->uid())), true); - $form->addElement(new ContactFormValidatedInput(_AM_CONTACT_MAILFROM, 'contact_mailfrom', 50, 255, $GLOBALS['xoopsConfig']['adminmail'], 'email'), true); - } - - $form->insertBreak(_AM_CONTACT_TO, "big bolder uppercase"); - $form->addElement(new XoopsFormLabel(_AM_CONTACT_NAMETO, $this->getVar('contact_name'))); - $form->addElement(new XoopsFormHidden('contact_name', $this->getVar('contact_name'))); - $form->addElement(new XoopsFormLabel(_AM_CONTACT_MAILTO, $this->getVar('contact_mail'))); - $form->addElement(new XoopsFormHidden('contact_mail', $this->getVar('contact_mail'))); - $form->addElement(new ContactFormValidatedInput(_AM_CONTACT_SUBJECT, 'contact_subject', 50, 255, _RE . " " . $this->getVar('contact_subject')), true); - $orig_message = new XoopsFormTextArea(_AM_CONTACT_MESSAGE_ORIG, 'c_orig_message', $this->getVar('contact_message'), 5, 60); - $orig_message->setExtra("disabled"); - $form->addElement($orig_message); - $form->addElement(new XoopsFormHidden('contact_orig_message', $this->getVar('contact_message'))); //have to include this since c_orig_message is hidden - $form->addElement(new XoopsFormRadioYN(_AM_CONTACT_MESSAGE_INC_ORIG, 'inc_orig', 0), true); - $form->addElement(new XoopsFormTextArea(_AM_CONTACT_MESSAGE, 'contact_message', '', 5, 60), true); - $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - - return $form; - } - - /** - * - * Maps Form/Mail Object to Contact Object - * - * @param stdClass $mailObj - */ - public function prepareToInsert(stdClass &$mailObj) - { - $vars_array = array(); - $mail_array = (array) $mailObj; //cast to an array - unset($mail_array['contact_id']); // remove the id, can't set it directly - $class_array = $this->getValues(); - foreach ($mail_array as $key => $item) { - if (array_key_exists($key, $class_array)) { - $vars_array[$key] = $item; - } - } - if (!empty($vars_array)) { - $this->setVars($vars_array); - } - } -} - -class ContactContactHandler extends XoopsPersistableObjectHandler -{ - public function __construct(&$db) - { - parent::__construct($db, 'contact', 'Contact', 'contact_id', 'contact_mail'); - } - - /** - * - * Clean all the incoming Vars from Form(s) - * @param $global global var array (POST, GET, REQUEST) - * @uses {@link XoopsRequest} - * - * @return array containing clean versions of form variables - */ - public function infoProcessing($global) - { - xoops_load('XoopsRequest'); - - $contact = array(); - if (empty($global)) { // will get from $_REQUEST - $from = null; - } elseif (('POST' == strtoupper($global)) || ('GET' == strtoupper($global))) { - $from = strtoupper($global); // will get specifically from $_GET or $_POST - } else { // don't allow other sources - return $contact; - } - $contact['contact_cid'] = XoopsRequest::getInt('contact_id', '', $from); - $contact['contact_uid'] = XoopsRequest::getInt('contact_uid', '', $from); - $contact['contact_name'] = XoopsRequest::getText('contact_name', '', $from); - $contact['contact_namefrom'] = XoopsRequest::getText('contact_namefrom', '', $from); - /* - $contact['contact_nameto'] = XoopsRequest::getText('contact_nameto', '', $from); - */ - $contact['contact_subject'] = XoopsRequest::getText('contact_subject', '', $from); - $email = XoopsRequest::getText('contact_mailfrom', '', $from); - $contact['contact_mailfrom'] = checkEmail($email); - $email = XoopsRequest::getText('contact_mail', '', $from); - $contact['contact_mail'] = checkEmail($email); - $email = XoopsRequest::getText('contact_mail2', '', $from); - $contact['contact_mail2'] = checkEmail($email); - /* - $email = XoopsRequest::getText('contact_mailto', '', $from); - $contact['contact_mailto'] = checkEmail($email); - */ - $url = XoopsRequest::getText('contact_url', '', $from); - $contact['contact_url'] = (!empty($url)) ? filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) : ''; - $contact['contact_create'] = time(); - $contact['contact_icq'] = XoopsRequest::getText('contact_icq', '', $from); - $contact['contact_company'] = XoopsRequest::getText('contact_company', '', $from); - $contact['contact_location'] = XoopsRequest::getText('contact_location', '', $from); - $contact['contact_phone'] = XoopsRequest::getInt('contact_phone', '', $from); - $contact['contact_department'] = XoopsRequest::getText('contact_department', _MD_CONTACT_DEFULTDEP, $from); - $contact['contact_ip'] = getenv("REMOTE_ADDR"); - $contact['contact_message'] = XoopsRequest::getText('contact_message', '', $from); - $contact['contact_address'] = XoopsRequest::getText('contact_address', '', $from); - $platform = XoopsRequest::getText('contact_platform', '', $from); - $contact['contact_platform'] = $this->contactPlatform($platform); - $type = XoopsRequest::getText('contact_type', '', $from); - $contact['contact_type'] = $this->contactType($type); - $contact['send_dept'] = XoopsRequest::getInt('send_dept' , 0, $from); - $contact['contact_orig_message'] = XoopsRequest::getText('contact_orig_message' , '', $from); - $contact['inc_orig'] = XoopsRequest::getInt('inc_orig', 0, $from); - - return $contact; - } - - /** - * - * Send Mail to Admin or Department(s) if enabled - * @param object $mailObj contains to/from, subject, & message - * - * @uses XoopsMailer - * @uses contactGetDepartmentEmails - * @return string indicates success or error messages - */ - public function contactSendMail(stdClass &$mailObj) - { - include_once $GLOBALS['xoops']->path("modules/contact/include/functions.php"); - xoops_load('XoopsFilterInput'); - $xoopsMailer = xoops_getMailer(); - $xoopsMailer->useMail(); - $deptEmailAddresses = contactGetDepartmentEmails($mailObj->contact_department); - if (!empty($deptEmailAddresses)) { - // using departments and departments exist in list - $xoopsMailer->setToEmails($deptEmailAddresses); - } else { - $xoopsMailer->setToEmails($GLOBALS['xoopsConfig']['adminmail']); //just send to admin - } -/* - if (!in_array($GLOBALS['xoopsConfig']['adminmail'], $deptEmailAddresses)) { - $xoopsMailer->multimailer->addBCC($GLOBALS['xoopsConfig']['adminmail'], 'Administrator'); - } -*/ - xoops_loadLanguage('modinfo', 'contact'); // get the language string(s) - $myts =& MyTextSanitizer::getInstance(); - // pre-process FromName since it came from input field - $fromName = XoopsFilterInput::getString($mailObj->contact_name, 'STRING'); -// $fromName = stripslashes(strip_tags(html_entity_decode($mailObj->contact_name, ENT_QUOTES, 'UTF-8'))); - // pre-process Subject since it came from input field - $mailSubject = XoopsFilterInput::getString($mailObj->contact_subject, 'STRING'); -// $mailSubject = stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8'))); - - $xoopsMailer->setFromName(ucwords($fromName)); - $xoopsMailer->setFromEmail($mailObj->contact_mail); - $thisBody = stripslashes(html_entity_decode($mailObj->contact_message, ENT_QUOTES, 'UTF-8')); -// $thisBody = $xoopsMailer->multimailer->WrapText($thisBody, 80); -// $xoopsMailer->multimailer->set('FromName', ucwords($fromName)); - $xoopsMailer->multimailer->setFrom($mailObj->contact_mail, ucwords($fromName)); - $xoopsMailer->multimailer->set('Subject', $mailSubject); - $xoopsMailer->multimailer->WordWrap = 80; // force wrap of body text at 80 chars for 'bad' clients - $xoopsMailer->multimailer->set('Body', $thisBody); - $xoopsMailer->multimailer->set('AltBody', $thisBody); - $xoopsMailer->setSubject($mailSubject); - $xoopsMailer->setBody($thisBody); - if ($xoopsMailer->send($debug = false)) { - if ($debug) { - $message = $xoopsMailer->getSuccess(); - } else { - $message = $myts->htmlSpecialChars($GLOBALS['xoopsModuleConfig']['contact_thankyou']); - } - } else { - $message = $xoopsMailer->getErrors(); - } - - return $message; - } - - /** - * - * Send Reply mail to individual contact - * @param object $mailObj information to include in email (to, from, name, subject, body) - * - * @return string error or success message to be displayed after email sent - */ - public function contactReplyMail(stdClass &$mailObj) - { - $xoopsMailer = xoops_getMailer(); - $xoopsMailer->useMail(); - $toEmails = $mailObj->contact_mail; - include_once $GLOBALS['xoops']->path("modules/contact/include/functions.php"); - $deptEmailAddresses = contactGetDepartmentEmails($mailObj->contact_department); //get emails for department (if enabled) - if (!empty($deptEmailAddresses)) { //get emails for department (if enabled) - $xoopsMailer->setFromEmail($deptEmailAddresses[0]); // set to dept email to first one - $xoopsMailer->setFromName(stripslashes(strip_tags(html_entity_decode($mailObj->contact_department, ENT_QUOTES, 'UTF-8')))); - if ($mailObj->send_dept) { //send copy of reply to dept - $toEmails = array_merge(array($toEmails), $deptEmailAddresses); - } - } else { // does not use departments or department field does not contain valid email addresses - if (!empty($mailObj->contact_namefrom)) { //take value from ReplyForm, if valid - $fromName = $mailObj->contact_namefrom; - } elseif ($GLOBALS['xoopsConfig']['sitename']) { // or take site name if set - $fromName = html_entity_decode($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES, 'UTF-8'); - } elseif ($GLOBALS['xoopsUser']->uname()) { // or finally use this user's uname - $fromName = $GLOBALS['xoopsUser']->uname(); - } - $xoopsMailer->setFromName($fromName); - - if (!empty($mailObj->contact_mailfrom)) { - // use mail addr from ReplyForm - $xoopsMailer->setFromName($mailObj->contact_mailfrom); - } else { - // otherwise use default site admin email - $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); - } - } - $xoopsMailer->setToEmails($toEmails); - $xoopsMailer->setSubject(stripslashes(strip_tags(html_entity_decode($mailObj->contact_subject, ENT_QUOTES, 'UTF-8')))); - $thisBody = stripslashes(html_entity_decode($mailObj->contact_message, ENT_QUOTES, 'UTF-8')); - $thisBody = $xoopsMailer->multimailer->WrapText($thisBody, 80); - $xoopsMailer->setBody($thisBody); - - if ($xoopsMailer->send()) { - $myts =& MyTextSanitizer::getInstance(); - $message = $myts->htmlSpecialChars(_AM_CONTACT_MSG_REPLY_SENT); - } else { - $message = $xoopsMailer->getErrors(); - } - - return $message; - } - - /** - * - * Set the Reply flag for this contact id - * @param int $contact_id - * - * @return bool success - true or false - */ - public function contactAddReply($contact_id) - { - $obj = $this->get((int) $contact_id); - $obj->setVar('contact_reply', 1); - return $this->insert($obj) ? true : false; - } - - /** - * - * Get the Contact Reply - * @param int $contact_id identifier for contact requested - * - * @return array|false false if nothing found, array with reply info on success - */ - public function contactGetReply($contact_id) - { - $user_timezone = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->timezone() : null; - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('contact_cid', (int) $contact_id)); - $criteria->add(new Criteria('contact_type', 'Contact')); - $criteria->setSort('contact_create'); - $criteria->setOrder('DESC'); - $contactObjs = $this->getObjects($criteria, false); - - $ret = (!empty($contactObjs)) ? array() : false; - foreach ($contactObjs as $thisContact) { - $tab = $thisContact->getValues(); - $tab['contact_owner'] = $GLOBALS['xoopsUser']->getUnameFromId($thisContact->getVar('contact_uid')); - $tab['contact_create'] = formatTimestamp($thisContact->getVar('contact_create'), 'm', $user_timezone); - $ret [] = $tab; - } - return $ret; - } - - /** - * - * Get a list of Admin Contacts - * @param object $pgObj sort, order, start, and limit for list {@see stdClass} - * @param string $column dB index for either contact id or user id - * - * @return array contact Obj as array w/ contact_owner and date_created - */ - public function getAdminList(stdClass $pgObj, $column='contact_cid') - { - $ret = array(); - if (in_array($column, array('contact_cid', 'contact_uid'))) { - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria($column, '0')); - $criteria->add(new Criteria('contact_type', 'Contact')); - $criteria->setSort($pgObj->sort); - $criteria->setOrder($pgObj->order); - $criteria->setStart($pgObj->start); - $criteria->setLimit($pgObj->limit); - $contactObjs = $this->getObjects($criteria, false); - $user_timezone = ($GLOBALS['xoopsUser'] instanceof XoopsUser) ? $GLOBALS['xoopsUser']->timezone() : null; - foreach($contactObjs as $thisContact) { - $tab = $thisContact->getValues(); - $tab['contact_owner'] = XoopsUser::getUnameFromId($thisContact->getVar('contact_uid')); - $tab['contact_create'] = formatTimestamp($thisContact->getVar('contact_create'), 'm', $user_timezone); - $ret [] = $tab; - } - } - - return $ret; - } - - /** - * Get Count by dB column - * @param string $column dB column to count for Contact - * - * @return bool|int false on failure, integer count of column items - */ - public function contactGetCount($column) - { - $count = false; - if (in_array($column, array('contact_uid', 'contact_cid', 'contact_reply'))) { - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria($column, '0')); - $criteria->add(new Criteria('contact_type', 'Contact')); - $count = $this->getCount($criteria); - } - - return $count; - } - - /** - * Contact Delete Before Date - * @param int $timestamp Unix timestamp - * @param bool $onlyreply - true only delete replies, false delete everything - * - * @return bool success - */ - public function deleteBeforeDate($timestamp=0, $onlyreply=false) - { - $criteria = new CriteriaCompo(); - if (!empty($timestamp)) { - $criteria->add(new Criteria('contact_create', (int) $timestamp, '<=')); - } - if ($onlyreply) { - $criteria->add(new Criteria('contact_reply', 1)); - } - - return $this->deleteAll($criteria); - } - - /** - * Contact Platform - * - * @param string $platform (Android,Ios, or Web) case-insensitive - * - * @return string representation of Platform - */ - public function contactPlatform($platform) - { - $platform = (isset($platform)) ? strtolower($platform) : ''; - switch ($platform) { - case 'android': - $ret = 'Android'; - break; - - case 'ios': - $ret = 'Ios'; - break; - - case 'web': - default: - $ret = 'Web'; - break; - } - - return $ret; - } - - /** - * Contact type - * @param string $type contact type - * - * @return string representation of contact type - */ - public function contactType($type) - { - $type = (isset($type)) ? strtolower($type) : ''; - switch ($type) { - case 'mail': - $ret = 'Mail'; - break; - - case 'phone': - $ret = 'Phone'; - break; - - case 'contact': - default: - $ret = 'Contact'; - break; - } - - return $ret; - } - - /** - * Contact logs - * @param string $column dB column to retrieve - * @param null|string $date null: retrieve all, string: get all before this representation of USER date (e.g. 11/21/2014) - * - * @return array of {@link Contact} objects meeting criteria - */ - public function contactLogs($column, $date = null) - { - $ret = array(); - $column = trim(strtolower($column)); - if (in_array($column, array('contact_mail', 'contact_url', 'contact_phone', 'contact_icq'))) { - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('contact_cid', '0')); - $criteria->add(new Criteria('contact_type', 'Contact')); - if (!empty($date)) { - $timestamp = strtotime($date); - $criteria->add(new Criteria('contact_create', (int) $timestamp, '<=')); - } - $criteria->add(new Criteria($column, '', '<>')); - $criteria->setSort('contact_create'); - $criteria->setOrder('DESC'); - $criteria->setGroupby($column); //reduces number of times through loop below - $contactArray = $this->getObjects($criteria, false, false); - foreach ($contactArray as $thisContact) { - if ($thisContact[$column]) { - $thisPhone = $thisContact['contact_phone'] ? " (<a href='tel:{$thisContact['contact_phone']}'>{$thisContact['contact_phone']}</a>)" : ''; - if ($thisContact['contact_uid']) { - $tmp_link = "<a href='" . $GLOBALS['xoops']->url("www/userinfo.php?uid={$thisContact['contact_uid']}") . "'>{$thisContact['contact_name']}</a>"; - } elseif ($thisContact['contact_mail']) { - $tmp_link = "<a href='mailto:{$thisContact['contact_mail']} ({$thisContact['contact_name']})'>{$thisContact['contact_name']}</a>"; - } else { - $tmp_link = $thisContact['contact_name']; - } - $ret[] = $tmp_link . $thisPhone; - } - } - } - - return array_unique($ret); - } - - /** - * - * Format Reply message body - adds original message to reply - * @param object $mailObj must include 'contact_orig_message', ['contact_message'] keys - * @param bool $inc_orig true: include original message body in reply, false: don't - * - * @return string reply message body - */ - public function replyBodyFormat(stdClass &$mailObj, $inc_orig=false) - { - if ($inc_orig) { - //merge original message body with reply body - $body = $mailObj->contact_message - . "\n\n" - . str_repeat("=", 10) . _AM_CONTACT_MESSAGE_ORIG . str_repeat("=", 10) . "\n" - . trim($mailObj->contact_orig_message); - } else { - $body = $mailObj->contact_message; - } - - return $body; - } -} +<?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. + */ + +/** + * Contact module + * + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @package contact + * @subpackage class + * @author Kazumi Ono (aka Onokazu) + * @author Trabis <lus...@gm...> + * @author Hossein Azizabadi (AKA Voltan) + * @version $Id: $ + */ + +//defined("XOOPS_ROOT_PATH") || exit("Restricted access - " . basename($_SERVER['PHP_SELF'], '.php') . PHP_EOL); +class Contact extends Xo... [truncated message content] |