|
From: <be...@us...> - 2012-12-23 00:59:23
|
Revision: 10494
http://sourceforge.net/p/xoops/svn/10494
Author: beckmi
Date: 2012-12-23 00:59:19 +0000 (Sun, 23 Dec 2012)
Log Message:
-----------
Updating to 1.80 Final (rewritten by Voltan to add DB)
Modified Paths:
--------------
XoopsModules/contact/trunk/contact/admin/about.php
XoopsModules/contact/trunk/contact/admin/index.php
XoopsModules/contact/trunk/contact/admin/menu.php
XoopsModules/contact/trunk/contact/docs/changelog.txt
XoopsModules/contact/trunk/contact/docs/lang_diff.txt
XoopsModules/contact/trunk/contact/header.php
XoopsModules/contact/trunk/contact/index.php
XoopsModules/contact/trunk/contact/language/english/admin.php
XoopsModules/contact/trunk/contact/language/english/index.html
XoopsModules/contact/trunk/contact/language/english/main.php
XoopsModules/contact/trunk/contact/language/english/modinfo.php
XoopsModules/contact/trunk/contact/xoops_version.php
Added Paths:
-----------
XoopsModules/contact/trunk/contact/admin/contact.php
XoopsModules/contact/trunk/contact/admin/footer.php
XoopsModules/contact/trunk/contact/admin/header.php
XoopsModules/contact/trunk/contact/admin/tools.php
XoopsModules/contact/trunk/contact/ajax.php
XoopsModules/contact/trunk/contact/class/contact.php
XoopsModules/contact/trunk/contact/css/
XoopsModules/contact/trunk/contact/css/admin.css
XoopsModules/contact/trunk/contact/css/index.html
XoopsModules/contact/trunk/contact/docs/ajax.html
XoopsModules/contact/trunk/contact/images/icons/
XoopsModules/contact/trunk/contact/images/icons/view.png
XoopsModules/contact/trunk/contact/include/
XoopsModules/contact/trunk/contact/include/functions.php
XoopsModules/contact/trunk/contact/include/functions_update.php
XoopsModules/contact/trunk/contact/include/index.html
XoopsModules/contact/trunk/contact/js/
XoopsModules/contact/trunk/contact/js/admin.js
XoopsModules/contact/trunk/contact/js/index.html
XoopsModules/contact/trunk/contact/readme.html
XoopsModules/contact/trunk/contact/sql/
XoopsModules/contact/trunk/contact/sql/index.html
XoopsModules/contact/trunk/contact/sql/mysql.sql
XoopsModules/contact/trunk/contact/templates/admin/
XoopsModules/contact/trunk/contact/templates/admin/contact_about.html
XoopsModules/contact/trunk/contact/templates/admin/contact_contact.html
XoopsModules/contact/trunk/contact/templates/admin/contact_index.html
XoopsModules/contact/trunk/contact/templates/admin/contact_tools.html
XoopsModules/contact/trunk/contact/templates/admin/index.html
XoopsModules/contact/trunk/contact/templates/contact_index.html
Removed Paths:
-------------
XoopsModules/contact/trunk/contact/admin/admin_footer.php
XoopsModules/contact/trunk/contact/admin/admin_header.php
XoopsModules/contact/trunk/contact/class/contactclass.php
XoopsModules/contact/trunk/contact/docs/readme.html
XoopsModules/contact/trunk/contact/getgfx.php
XoopsModules/contact/trunk/contact/images/code_bg.jpg
XoopsModules/contact/trunk/contact/images/no-spam.jpg
XoopsModules/contact/trunk/contact/language/french/
XoopsModules/contact/trunk/contact/templates/contact_contactusform.html
Modified: XoopsModules/contact/trunk/contact/admin/about.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/about.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/admin/about.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,28 +1,35 @@
-<?php
-/**
- * Contact module
- *
- * You may not change or alter any portion of this comment or credits
- * of supporting developers from this source code or any supporting source code
- * which is considered copyrighted (c) material of the original comment or credit authors.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @copyright The XOOPS Project (http://www.xoops.org)
- * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/)
- * @package Contact
- * @since 2.5.0
- * @author Mage, Mamba
- * @version $Id $
- **/
-
-include_once dirname(__FILE__) . '/admin_header.php';
-
-xoops_cp_header();
-
-$aboutAdmin = new ModuleAdmin();
-echo $aboutAdmin->addNavigation('about.php');
-echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false);
-
-include 'admin_footer.php';
\ No newline at end of file
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+// Call header
+require dirname(__FILE__) . '/header.php';
+// Display Admin header
+xoops_cp_header();
+
+$xoopsTpl->assign('navigation', $admin_class->addNavigation('about.php'));
+$xoopsTpl->assign('renderabout', $admin_class->renderabout('6KJ7RW5DR3VTJ', false));
+
+// Call template file
+$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/contact/templates/admin/contact_about.html');
+// Call footer
+require dirname(__FILE__) . '/footer.php';
+?>
\ No newline at end of file
Deleted: XoopsModules/contact/trunk/contact/admin/admin_footer.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/admin_footer.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/admin/admin_footer.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Contact module
- *
- * You may not change or alter any portion of this comment or credits
- * of supporting developers from this source code or any supporting source code
- * which is considered copyrighted (c) material of the original comment or credit authors.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package Contact
- * @since 2.5.0
- * @author Mamba (www.xoops.org)
- * @version $Id $
-**/
-
-echo "<div class='adminfooter'>\n"
- ." <div style='text-align: center;'>\n"
- ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
- ." </div>\n"
- ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
- ."</div>";
-
-xoops_cp_footer();
\ No newline at end of file
Deleted: XoopsModules/contact/trunk/contact/admin/admin_header.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/admin_header.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/admin/admin_header.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,50 +0,0 @@
-<?php
-// $Id: admin_header.php 8478 2011-12-13 09:12:46Z beckmi $
-// ------------------------------------------------------------------------ //
-// XOOPS - PHP Content Management System //
-// Copyright (c) 2000 XOOPS.org //
-// <http://www.xoops.org/> //
-// ------------------------------------------------------------------------ //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// You may not change or alter any portion of this comment or credits //
-// of supporting developers from this source code or any supporting //
-// source code which is considered copyrighted (c) material of the //
-// original comment or credit authors. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
-
-$path = dirname(dirname(dirname(dirname(__FILE__))));
-include_once $path . '/mainfile.php';
-include_once $path . '/include/cp_functions.php';
-require_once $path . '/include/cp_header.php';
-
-global $xoopsModule;
-
-$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');
-
-// Load language files
-xoops_loadLanguage('admin', $thisModuleDir);
-xoops_loadLanguage('modinfo', $thisModuleDir);
-xoops_loadLanguage('main', $thisModuleDir);
-
-$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
-$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
-$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
-
-if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){
- include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
- }else{
- redirect_header("../../../admin.php", 5, _AM_CONTACT_MODULEADMIN_MISSING, false);
- }
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/admin/contact.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/contact.php (rev 0)
+++ XoopsModules/contact/trunk/contact/admin/contact.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -0,0 +1,208 @@
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+// Call header
+require dirname(__FILE__) . '/header.php';
+// Display Admin header
+xoops_cp_header();
+// Define default value
+$op = $contact_handler->Contact_CleanVars($_REQUEST, 'op', 'list', 'string');
+$contact_id = $contact_handler->Contact_CleanVars($_REQUEST, 'id', '0', 'int');
+
+// Define scripts
+$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
+$xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
+$xoTheme->addScript(XOOPS_URL . '/modules/contact/js/admin.js');
+// Add module stylesheet
+$xoTheme->addStylesheet(XOOPS_URL . '/modules/contact/css/admin.css');
+$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css');
+$xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css');
+
+switch ($op)
+{
+ case 'list':
+ $contact = array();
+ $contact['perpage'] = xoops_getModuleOption('admin_perpage','contact');
+ $contact['order'] = 'DESC';
+ $contact['sort'] = 'contact_id';
+
+ // get limited information
+ if (isset($_REQUEST['limit'])) {
+ $contact['limit'] = $contact_handler->Contact_CleanVars($_REQUEST, 'limit', 0, 'int');
+ } else {
+ $contact['limit'] = $contact['perpage'];
+ }
+
+ // get start information
+ if (isset($_REQUEST['start'])) {
+ $contact['start'] = $contact_handler->Contact_CleanVars($_REQUEST, 'start', 0, 'int');
+ } else {
+ $contact['start'] = 0;
+ }
+
+ $contact_numrows = $contact_handler->Contact_GetCount('contact_cid');
+ $contacts = $contact_handler->Contact_GetAdminList($contact , 'contact_cid');
+
+ if ($contact_numrows > $contact['limit']) {
+ $contact_pagenav = new XoopsPageNav($contact_numrows, $contact['limit'], $contact['start'], 'start', 'limit=' . $contact['limit']);
+ $contact_pagenav = $contact_pagenav->renderNav(4);
+ } else {
+ $contact_pagenav = '';
+ }
+
+ $xoopsTpl->assign('contacts', $contacts);
+ $xoopsTpl->assign('contact_pagenav', $contact_pagenav);
+ $level = 'list';
+ break;
+
+ case 'reply':
+ if ($contact_id > 0) {
+ $obj = $contact_handler->get($contact_id);
+ if($obj->getVar('contact_cid') != 0) {
+ redirect_header ( 'contact.php', 3, _AM_CONTACT_CANTREPLY);
+ }
+ $form = $obj->Contact_ReplyForm();
+ $xoopsTpl->assign('replyform', $form->render());
+ $xoopsTpl->assign('replylist', $contact_handler->Contact_GetReply($contact_id));
+ } else {
+ redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST);
+ }
+ $level = 'reply';
+ break;
+
+ case 'doreply':
+
+ // check email
+ if ( !$contact_handler->Contact_CleanVars($_POST, 'contact_mailto', '', 'mail') ) {
+ redirect_header ( "contact.php", 3, _MD_CONTACT_MES_NOVALIDEMAIL );
+ exit();
+ }
+
+ // Info Processing
+ $contact = $contact_handler->Contact_InfoProcessing($_POST);
+
+ // insert in DB
+ if($saveinfo = true) {
+ $obj = $contact_handler->create();
+ $obj->setVars ( $contact );
+
+ if(!$contact_handler->insert ( $obj )) {
+ redirect_header ( "contact.php", 3, '4' );
+ exit();
+ }
+
+ $contact_handler->Contact_AddReply( $contact['contact_cid'] );
+
+ }
+
+ // send mail can seet message
+ if($sendmail = true) {
+ $message = $contact_handler->Contact_ReplyMail($contact);
+ } else if ($saveinfo = true) {
+ $message = _MD_CONTACT_MES_SAVEINDB;
+ } else {
+ $message = _MD_CONTACT_MES_SENDERROR;
+ }
+
+ redirect_header ( "contact.php", 3, $message );
+
+ $level = 'doreply';
+ break;
+
+ case 'view':
+
+ $obj = $contact_handler->get ( $contact_id );
+
+ if(!$obj) {
+ redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST);
+ exit ();
+ }
+
+ $contact = array ();
+ $contact = $obj->toArray ();
+ $contact['contact_id'] = $obj->getVar('contact_id');
+ $contact['contact_uid'] = $obj->getVar('contact_uid');
+ $contact['contact_name'] = $obj->getVar('contact_name');
+ $contact['contact_owner'] = XoopsUser::getUnameFromId ( $obj->getVar('contact_uid') );
+ $contact['contact_subject'] = $obj->getVar('contact_subject');
+ $contact['contact_mail'] = $obj->getVar('contact_mail');
+ $contact['contact_url'] = $obj->getVar('contact_url');
+ $contact['contact_create'] = formatTimestamp ( $obj->getVar('contact_create'), _MEDIUMDATESTRING );
+ $contact['contact_icq'] = $obj->getVar('contact_icq');
+ $contact['contact_company'] = $obj->getVar('contact_company');
+ $contact['contact_location'] = $obj->getVar('contact_location');
+ $contact['contact_phone'] = $obj->getVar('contact_phone');
+ $contact['contact_department'] = $obj->getVar('contact_department');
+ $contact['contact_ip'] = $obj->getVar('contact_ip');
+ $contact['contact_message'] = $obj->getVar('contact_message');
+ $contact['contact_address'] = $obj->getVar('contact_address');
+
+ $xoopsTpl->assign('contact', $contact);
+ $xoopsTpl->assign('replylist', $contact_handler->Contact_GetReply($contact_id));
+
+ $level = 'view';
+ break;
+
+ case 'delete':
+
+ if ($contact_id > 0) {
+ // Prompt message
+ xoops_confirm(array("id" => $contact_id), 'contact.php?op=dodelete', _AM_CONTACT_MSG_DELETE);
+ } else {
+ redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST);
+ }
+
+ $level = 'delete';
+ break;
+
+ case 'dodelete':
+
+ if (!$contact_id > 0) {
+ redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST);
+ xoops_cp_footer ();
+ exit ();
+ }
+
+ $criteria = new CriteriaCompo ();
+ $criteria->add ( new Criteria ( 'contact_id', $contact_id ) );
+ $criteria->add ( new Criteria ( 'contact_cid', $contact_id ), 'OR' );
+
+ if (! $contact_handler->deleteAll($criteria)) {
+ redirect_header ( 'contact.php', 1, _AM_CONTACT_MSG_DELETEERROR );
+ xoops_cp_footer ();
+ exit ();
+ }
+
+ redirect_header ( 'contact.php', 1, _AM_CONTACT_MSG_DELETED );
+ xoops_cp_footer ();
+ exit ();
+ break;
+}
+
+$xoopsTpl->assign('navigation', $admin_class->addNavigation('contact.php'));
+$xoopsTpl->assign('level', $level);
+
+// Call template file
+$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/contact/templates/admin/contact_contact.html');
+// Call footer
+require dirname(__FILE__) . '/footer.php';
+?>
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/admin/footer.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/footer.php (rev 0)
+++ XoopsModules/contact/trunk/contact/admin/footer.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -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 module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+xoops_cp_footer();
+?>
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/admin/header.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/header.php (rev 0)
+++ XoopsModules/contact/trunk/contact/admin/header.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -0,0 +1,53 @@
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+$path = dirname(dirname(dirname(dirname(__FILE__))));
+
+include_once $path . '/mainfile.php';
+include_once XOOPS_ROOT_PATH . '/include/cp_functions.php';
+include_once XOOPS_ROOT_PATH . '/include/cp_header.php';
+include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+global $xoopsModule;
+
+$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');
+
+// Load language files
+xoops_loadLanguage('admin', $thisModuleDir);
+xoops_loadLanguage('modinfo', $thisModuleDir);
+xoops_loadLanguage('main', $thisModuleDir);
+
+$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
+$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
+$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
+
+// Contact Handler
+$contact_handler = & xoops_getModuleHandler ( 'contact', 'contact' );
+
+// Locad admin menu class
+if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){
+ include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
+}else{
+ redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false);
+}
+
+$admin_class = new ModuleAdmin();
\ No newline at end of file
Modified: XoopsModules/contact/trunk/contact/admin/index.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/index.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/admin/index.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,38 +1,38 @@
-<?php
-// $Id: index.php 8478 2011-12-13 09:12:46Z beckmi $
-// ------------------------------------------------------------------------ //
-// XOOPS - PHP Content Management System //
-// Copyright (c) 2000 XOOPS.org //
-// <http://www.xoops.org/> //
-// ------------------------------------------------------------------------ //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// You may not change or alter any portion of this comment or credits //
-// of supporting developers from this source code or any supporting //
-// source code which is considered copyrighted (c) material of the //
-// original comment or credit authors. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
-
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php';
-include_once dirname(__FILE__) . '/admin_header.php';
-
-xoops_cp_header();
-
- $indexAdmin = new ModuleAdmin();
-
- echo $indexAdmin->addNavigation('index.php');
- echo $indexAdmin->renderIndex();
-
-include "admin_footer.php";
\ No newline at end of file
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+// Call header
+require dirname(__FILE__) . '/header.php';
+// Display Admin header
+xoops_cp_header();
+
+// Display Admin menu class
+$admin_class->addInfoBox(_AM_CONTACT_INDEX_ADMENU1);
+$admin_class->addInfoBoxLine(_AM_CONTACT_INDEX_ADMENU1, _AM_CONTACT_INDEX_TOTAL, $contact_handler->Contact_GetCount('contact_cid'));
+$xoopsTpl->assign('navigation', $admin_class->addNavigation('index.php'));
+$xoopsTpl->assign('renderindex', $admin_class->renderIndex());
+
+// Call template file
+$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/contact/templates/admin/contact_index.html');
+// Call footer
+require dirname(__FILE__) . '/footer.php';
+?>
\ No newline at end of file
Modified: XoopsModules/contact/trunk/contact/admin/menu.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/menu.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/admin/menu.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,29 +1,25 @@
<?php
-// ------------------------------------------------------------------------ //
-// XOOPS - PHP Content Management System //
-// Copyright (c) 2000 XOOPS.org //
-// <http://www.xoops.org/> //
-// ------------------------------------------------------------------------- //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// You may not change or alter any portion of this comment or credits //
-// of supporting developers from this source code or any supporting //
-// source code which is considered copyrighted (c) material of the //
-// original comment or credit authors. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
+/*
+ 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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined");
$dirname = basename(dirname(dirname(__FILE__)));
@@ -36,13 +32,24 @@
$adminmenu = array();
$i = 1;
-$adminmenu[$i]["title"] = _MI_CONTACT_MENU_00;
+$adminmenu[$i]["title"] = _MI_CONTACT_MENU_HOME;
$adminmenu[$i]["link"] = "admin/index.php";
-$adminmenu[$i]["desc"] = _MI_CONTACT_ADMIN_HOME_DESC;
+$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_HOME_DESC;
$adminmenu[$i]["icon"] = $pathIcon32.'/home.png';
$i++;
-$adminmenu[$i]["title"] = _MI_CONTACT_ADMIN_ABOUT;
+$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_TOOLS;
+$adminmenu[$i]["link"] = "admin/tools.php";
+$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_TOOLS_DESC;
+$adminmenu[$i]["icon"] = $pathIcon32.'/exec.png';
+$i++;
+$adminmenu[$i]["title"] = _MI_CONTACT_MENU_ABOUT;
$adminmenu[$i]["link"] = "admin/about.php";
-$adminmenu[$i]["desc"] = _MI_CONTACT_ADMIN_ABOUT_DESC;
+$adminmenu[$i]["desc"] = _MI_CONTACT_MENU_ABOUT_DESC;
$adminmenu[$i]["icon"] = $pathIcon32.'/about.png';
+?>
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/admin/tools.php
===================================================================
--- XoopsModules/contact/trunk/contact/admin/tools.php (rev 0)
+++ XoopsModules/contact/trunk/contact/admin/tools.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -0,0 +1,61 @@
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+// Call header
+require dirname(__FILE__) . '/header.php';
+// Display Admin header
+xoops_cp_header();
+// Define default value
+$op = $contact_handler->Contact_CleanVars($_REQUEST, 'op', 'list', 'string');
+
+switch ($op)
+{
+ case 'list':
+ // prune manager
+ $form = new XoopsThemeForm(_AM_CONTACT_TOOLS_PRUNE, 'tools', 'tools.php', 'post');
+ $form->addElement(new XoopsFormTextDateSelect(_AM_CONTACT_TOOLS_PRUNE_BEFORE, 'prune_date', 15, time()));
+ $onlyreply = new xoopsFormCheckBox('', 'onlyreply');
+ $onlyreply->addOption(1, _AM_CONTACT_TOOLS_PRUNE_REPLYONLY);
+ $form->addElement($onlyreply, false);
+ $form->addElement(new XoopsFormHidden('op', 'prune'));
+ $form->addElement(new XoopsFormButton('', 'post', _SUBMIT, 'submit'));
+ $xoopsTpl->assign('prune', $form->render());
+ break;
+
+ case 'prune':
+ $timestamp = $contact_handler->Contact_CleanVars( $_REQUEST, 'prune_date', '', 'int' );
+ $onlyreply = $contact_handler->Contact_CleanVars( $_REQUEST, 'onlyreply', 0, 'int' );
+ $timestamp = strtotime($timestamp);
+ $count = $contact_handler->Contact_PruneCount($timestamp,$onlyreply);
+ $contact_handler->Contact_DeleteBeforeDate($timestamp,$onlyreply);
+ redirect_header ( 'tools.php', 1, sprintf(_AM_CONTACT_MSG_PRUNE_DELETED,$count) );
+ xoops_cp_footer ();
+ exit ();
+ break;
+}
+
+$xoopsTpl->assign('navigation', $admin_class->addNavigation('tools.php'));
+// Call template file
+$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/contact/templates/admin/contact_tools.html');
+// Call footer
+require dirname(__FILE__) . '/footer.php';
+?>
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/ajax.php
===================================================================
--- XoopsModules/contact/trunk/contact/ajax.php (rev 0)
+++ XoopsModules/contact/trunk/contact/ajax.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -0,0 +1,36 @@
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+include 'header.php';
+
+if(!empty($_POST)) {
+ // Info Processing
+ $contact = $contact_handler->Contact_InfoProcessing($_POST);
+ // Save info
+ $obj = $contact_handler->create();
+ $obj->setVars($contact);
+ $contact_handler->insert($obj);
+ // send mail can seet message
+ $message = $contact_handler->Contact_SendMail($contact);
+}
+
+?>
\ No newline at end of file
Added: XoopsModules/contact/trunk/contact/class/contact.php
===================================================================
--- XoopsModules/contact/trunk/contact/class/contact.php (rev 0)
+++ XoopsModules/contact/trunk/contact/class/contact.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -0,0 +1,394 @@
+<?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 The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license http://www.fsf.org/copyleft/gpl.html GNU public license
+ * @author Kazumi Ono (aka Onokazu)
+ * @author Trabis <lus...@gm...>
+ * @author Hossein Azizabadi (AKA Voltan)
+ * @version $Id$
+ */
+
+if (!defined("XOOPS_ROOT_PATH")) {
+ die("XOOPS root path not defined");
+}
+
+class contact extends XoopsObject
+{
+
+ 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->db = $GLOBALS ['xoopsDB'];
+ $this->table = $this->db->prefix('contact');
+ }
+
+ function Contact_ContactForm($department)
+ {
+
+ global $xoopsConfig, $xoopsOption, $xoopsUser;
+
+ if ($this->isNew()) {
+ if (!empty($xoopsUser)) {
+ $contact_uid = $xoopsUser->getVar('uid');
+ $contact_name = $xoopsUser->getVar('uname');
+ $contact_mail = $xoopsUser->getVar('email');
+ $contact_url = $xoopsUser->getVar('url');
+ $contact_icq = $xoopsUser->getVar('user_icq');
+ $contact_location = $xoopsUser->getVar('user_from');
+
+ } else {
+ $contact_uid = 0;
+ $contact_name = '';
+ $contact_mail = '';
+ $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_url = $this->getVar('contact_url');
+ $contact_icq = $this->getVar('contact_icq');
+ $contact_location = $this->getVar('contact_location');
+ }
+
+ $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));
+ $form->addElement(new XoopsFormText (_MD_CONTACT_NAME, 'contact_name', 50, 255, $contact_name), true);
+ $form->addElement(new XoopsFormText (_MD_CONTACT_MAIL, 'contact_mail', 50, 255, $contact_mail), true);
+
+ if (xoops_getModuleOption('form_url', 'contact')) {
+ $form->addElement(new XoopsFormText (_MD_CONTACT_URL, 'contact_url', 50, 255, $contact_url), false);
+ }
+ if (xoops_getModuleOption('form_icq', 'contact')) {
+ $form->addElement(new XoopsFormText (_MD_CONTACT_ICQ, 'contact_icq', 50, 255, $contact_icq), false);
+ }
+ if (xoops_getModuleOption('form_company', 'contact')) {
+ $form->addElement(new XoopsFormText (_MD_CONTACT_COMPANY, 'contact_company', 50, 255, $this->getVar('contact_company')), false);
+ }
+ if (xoops_getModuleOption('form_location', 'contact')) {
+ $form->addElement(new XoopsFormText (_MD_CONTACT_LOCATION, 'contact_location', 50, 255, $contact_location), false);
+ }
+ if (xoops_getModuleOption('form_phone', 'contact')) {
+ $form->addElement(new XoopsFormText (_MD_CONTACT_PHONE, 'contact_phone', 50, 255, $this->getVar('contact_phone')), false);
+ }
+ if (xoops_getModuleOption('form_address', 'contact')) {
+ $form->addElement(new XoopsFormTextArea (_MD_CONTACT_ADDRESS, 'contact_address', $this->getVar('contact_address', 'e'), 3, 60), false);
+ }
+ if (xoops_getModuleOption('form_dept', 'contact')) {
+ // show a drop down with the correct departments listed
+ $departmentlist = new XoopsFormSelect(_MD_CONTACT_DEPARTMENT, 'contact_department');
+ $departments = xoops_getModuleOption('contact_dept', 'contact');
+ foreach ($departments as $val) {
+ $valexplode = explode(',', $val);
+ $departmentlist->addOption($valexplode[0]);
+ }
+ $form->addElement($departmentlist);
+ }
+
+ $form->addElement(new XoopsFormText (_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);
+
+ xoops_load('XoopsFormCaptcha');
+ $form->addElement(new XoopsFormCaptcha(), true);
+
+ $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
+ return $form;
+ }
+
+ function Contact_ReplyForm()
+ {
+ global $xoopsConfig;
+ $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->addElement(new XoopsFormLabel(_AM_CONTACT_FROM, '', ''));
+ $form->addElement(new XoopsFormText (_AM_CONTACT_NAMEFROM, 'contact_name', 50, 255, XoopsUser::getUnameFromId($this->getVar('contact_uid'))), true);
+ $form->addElement(new XoopsFormText (_AM_CONTACT_MAILFROM, 'contact_mail', 50, 255, $xoopsConfig['adminmail']), true);
+ $form->addElement(new XoopsFormLabel(_AM_CONTACT_TO, '', ''));
+ $form->addElement(new XoopsFormText (_AM_CONTACT_NAMETO, 'contact_nameto', 50, 255, $this->getVar('contact_name')), true);
+ $form->addElement(new XoopsFormText (_AM_CONTACT_MAILTO, 'contact_mailto', 50, 255, $this->getVar('contact_mail')), true);
+ $form->addElement(
+ new XoopsFormText (_AM_CONTACT_SUBJECT, 'contact_subject', 50, 255,
+ _RE . $this->getVar('contact_subject')), true
+ );
+ $form->addElement(new XoopsFormTextArea (_AM_CONTACT_MESSAGE, 'contact_message', '', 5, 60), true);
+ $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
+ return $form;
+ }
+
+ /**
+ * Returns an array representation of the object
+ *
+ * @return array
+ **/
+ function toArray()
+ {
+ $ret = array();
+ $vars = $this->getVars();
+ foreach (array_keys($vars) as $i) {
+ $ret [$i] = $this->getVar($i);
+ }
+ return $ret;
+ }
+}
+
+class ContactContactHandler extends XoopsPersistableObjectHandler
+{
+ function __construct(&$db)
+ {
+ parent::__construct($db, "contact", 'contact', 'contact_id', 'contact_mail');
+ }
+
+ /**
+ * Get variables passed by GET or POST method
+ *
+ */
+ function Contact_CleanVars(&$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 'int':
+ default:
+ $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default;
+ break;
+ }
+ if ($ret === false) {
+ return $default;
+ }
+ return $ret;
+ }
+
+ function Contact_InfoProcessing($global)
+ {
+ $contact = array();
+ $contact['contact_cid'] = $this->Contact_CleanVars($_POST, 'contact_id', '', 'int');
+ $contact['contact_uid'] = $this->Contact_CleanVars($_POST, 'contact_uid', '', 'int');
+ $contact['contact_name'] = $this->Contact_CleanVars($_POST, 'contact_name', '', 'string');
+ $contact['contact_nameto'] = $this->Contact_CleanVars($_POST, 'contact_nameto', '', 'string');
+ $contact['contact_subject'] = $this->Contact_CleanVars($_POST, 'contact_subject', '', 'string');
+ $contact['contact_mail'] = $this->Contact_CleanVars($_POST, 'contact_mail', '', 'mail');
+ $contact['contact_mailto'] = $this->Contact_CleanVars($_POST, 'contact_mailto', '', 'mail');
+ $contact['contact_url'] = $this->Contact_CleanVars($_POST, 'contact_url', '', 'url');
+ $contact['contact_create'] = time();
+ $contact['contact_icq'] = $this->Contact_CleanVars($_POST, 'contact_icq', '', 'string');
+ $contact['contact_company'] = $this->Contact_CleanVars($_POST, 'contact_company', '', 'string');
+ $contact['contact_location'] = $this->Contact_CleanVars($_POST, 'contact_location', '', 'text');
+ $contact['contact_phone'] = $this->Contact_CleanVars($_POST, 'contact_phone', '', 'int');
+ $contact['contact_department'] = $this->Contact_CleanVars($_POST, 'contact_department', _MD_CONTACT_DEFULTDEP, 'string');
+ $contact['contact_ip'] = getenv("REMOTE_ADDR");
+ $contact['contact_message'] = $this->Contact_CleanVars($_POST, 'contact_message', '', 'text');
+ $contact['contact_address'] = $this->Contact_CleanVars($_POST, 'contact_address', '', 'text');
+ return $contact;
+ }
+
+ function Contact_SendMail($contact)
+ {
+ $xoopsMailer = xoops_getMailer();
+ $xoopsMailer->useMail();
+ $xoopsMailer->setToEmails($this->Contact_ToEmails($contact['contact_department']));
+ $xoopsMailer->setFromEmail($contact['contact_mail']);
+ $xoopsMailer->setFromName($contact['contact_name']);
+ $xoopsMailer->setSubject($contact['contact_subject']);
+ $xoopsMailer->setBody($contact['contact_message']);
+ if ($xoopsMailer->send()) {
+ $message = _MD_CONTACT_MES_SEND;
+ } else {
+ $message = $xoopsMailer->getErrors();
+ }
+ return $message;
+ }
+
+ function Contact_ReplyMail($contact)
+ {
+ $xoopsMailer = xoops_getMailer();
+ $xoopsMailer->useMail();
+ $xoopsMailer->setToEmails($contact['contact_mailto']);
+ $xoopsMailer->setFromEmail($contact['contact_mail']);
+ $xoopsMailer->setFromName($contact['contact_name']);
+ $xoopsMailer->setSubject($contact['contact_subject']);
+ $xoopsMailer->setBody($contact['contact_message']);
+ if ($xoopsMailer->send()) {
+ $message = _MD_CONTACT_MES_SEND;
+ } else {
+ $message = $xoopsMailer->getErrors();
+ }
+ return $message;
+ }
+
+ function Contact_ToEmails($department = null)
+ {
+ global $xoopsConfig;
+ $department_mail[] = $xoopsConfig['adminmail'];
+ if (!empty($department)) {
+ $departments = xoops_getModuleOption('contact_dept', 'contact');
+ foreach ($departments as $vals) {
+ $vale = explode(',', $vals);
+ if ($department == $vale[0]) {
+ $department_mail[] = $vale[1];
+ }
+ }
+ }
+ return $department_mail;
+ }
+
+ function Contact_AddReply($contact_id)
+ {
+ $obj = $this->get($contact_id);
+ $obj->setVar('contact_reply', 1);
+ if (!$this->insert($obj)) {
+ return false;
+ }
+ return true;
+ }
+
+ function Contact_GetReply($contact_id)
+ {
+
+ $criteria = new CriteriaCompo ();
+ $criteria->add(new Criteria ('contact_cid', $contact_id));
+ $contacts = $this->getObjects($criteria, false);
+ if ($contacts) {
+ $ret = array();
+ foreach ($contacts as $root) {
+ $tab = array();
+ $tab = $root->toArray();
+ $tab['contact_owner'] = XoopsUser::getUnameFromId($root->getVar('contact_uid'));
+ $tab['contact_create'] = formatTimestamp($root->getVar('contact_create'), _MEDIUMDATESTRING);
+ $ret [] = $tab;
+ }
+ return $ret;
+ } else {
+ return false;
+ }
+ }
+
+ function Contact_GetAdminList($contact, $id)
+ {
+ $ret = array();
+ $criteria = new CriteriaCompo ();
+ $criteria->add(new Criteria ($id, '0'));
+ $criteria->setSort($contact['sort']);
+ $criteria->setOrder($contact['order']);
+ $criteria->setStart($contact['start']);
+ $criteria->setLimit($contact['limit']);
+ $contacts = $this->getObjects($criteria, false);
+ if ($contacts) {
+ foreach ($contacts as $root) {
+ $tab = array();
+ $tab = $root->toArray();
+ $tab['contact_owner'] = XoopsUser::getUnameFromId($root->getVar('contact_uid'));
+ $tab['contact_create'] = formatTimestamp($root->getVar('contact_create'), _MEDIUMDATESTRING);
+ $ret [] = $tab;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Get file Count
+ */
+ function Contact_GetCount($id)
+ {
+ $criteria = new CriteriaCompo ();
+ $criteria->add(new Criteria ($id, '0'));
+ return $this->getCount($criteria);
+ }
+
+ /**
+ * Get Insert ID
+ */
+ function getInsertId()
+ {
+ return $this->db->getInsertId();
+ }
+
+ /**
+ * Contact Prune Count
+ */
+ function Contact_PruneCount($timestamp, $onlyreply)
+ {
+ $criteria = new CriteriaCompo ();
+ $criteria->add(new Criteria ('contact_create', $timestamp, '<='));
+ if ($onlyreply) {
+ $criteria->add(new Criteria ('contact_reply', 1));
+ }
+ return $this->getCount($criteria);
+ }
+
+ /**
+ * Contact Delete Before Date
+ */
+ function Contact_DeleteBeforeDate($timestamp, $onlyreply)
+ {
+ $criteria = new CriteriaCompo ();
+ $criteria->add(new Criteria ('contact_create', $timestamp, '<='));
+ if ($onlyreply) {
+ $criteria->add(new Criteria ('contact_reply', 1));
+ }
+ $this->deleteAll($criteria);
+ }
+
+}
+
+?>
\ No newline at end of file
Deleted: XoopsModules/contact/trunk/contact/class/contactclass.php
===================================================================
--- XoopsModules/contact/trunk/contact/class/contactclass.php 2012-12-23 00:54:40 UTC (rev 10493)
+++ XoopsModules/contact/trunk/contact/class/contactclass.php 2012-12-23 00:59:19 UTC (rev 10494)
@@ -1,406 +0,0 @@
-<?php
-// ------------------------------------------------------------------------ //
-// XOOPS - PHP Content Management System //
-// Copyright (c) 2000 XOOPS.org //
-// <http://www.xoops.org/> //
-// ------------------------------------------------------------------------- //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// You may not change or alter any portion of this comment or credits //
-// of supporting developers from this source code or any supporting //
-// source code which is considered copyrighted (c) material of the //
-// original comment or credit authors. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
-include_once "header.php";
-
-// defines are used to set the errorLevel
-define("_CT_ERROR_NONE", 0 ); // 00000000
-define("_CT_ERROR_BADSECVAL", 1 ); // 00000001
-define("_CT_ERROR_BADEMAIL", 2 ); // 00000010
-
-class ContactClass
-{
- var $config_handler;
- var $xoopsUser;
- var $xoopsConfig;
- var $xoopsContactConfig;
- var $username;
- var $useremail;
- var $userURL;
- var $userICQ;
- var $userAddress;
- var $userCompany;
- var $userLocation;
- var $userSendConfirm;
- var $userComments;
- var $departments; // this is an array!!!!
- var $selectedDept; // a single department name
- var $errorLevel; // this is set if there is a problem with the contact us page, used for redisplay info
- var $deepchecktld;
- var $userMoreInfo; // this is an array!!!
- var $moreInfo; // this is an array!!!
-
- function ContactClass( $config_handler, $xoopsUser, $xoopsConfig )
- {
- $this->xoopsUser = $xoopsUser;
- $this->xoopsConfig = $xoopsConfig;
-
- $this->config_handler = $config_handler;
-
- $module_handler =& xoops_gethandler('module');
- $xoopsContactModule =& $module_handler->getByDirname('contact');
- $this->xoopsContactConfig =& $this->config_handler->getConfigsByCat(0, $xoopsContactModule->getVar('mid'));
-
- $this->username = !empty($xoopsUser) ? $xoopsUser->getVar("uname", "E") : "";
- $this->useremail = !empty($xoopsUser) ? $xoopsUser->getVar("email", "E") : "";
- $this->userURL = !empty($xoopsUser) ? $xoopsUser->getVar("url", "E") : "";
- $this->userICQ = !empty($xoopsUser) ? $xoopsUser->getVar("user_icq", "E") : "";
- $this->userLocation = !empty($xoopsUser) ? $xoopsUser->getVar("user_from", "E") : "";
-
- $this->departments = $this->xoopsContactConfig['contact_dept'];
- if ( ( !is_array( $this->departments ) || count( $this->departments ) == 0 ) || // there is no data, or contact_showdept
- $this->xoopsContactConfig['contact_showdept'] == '0') // is turned off...set departments to default
- {
- $this->departments = array(0 => $this->xoopsConfig['sitename'].",".$this->xoopsConfig['adminmail'] );
- }
-
- $this->selectedDept = $xoopsConfig['sitename'];
- $this->userAddress = "";
- $this->userCompany = "";
- $this->userSendConfirm = '0'; // uncheck box to begin with
- $this->userComments = "";
- $this->errorLevel = _CT_ERROR_NONE; // no errors to begin with!!!
- $this->deepchecktld = $this->xoopsContactConfig['contact_validatedomain'];
- $this->userMoreInfo = array();
- $this->moreInfo = $this->xoopsContactConfig['contact_moreinfo'];
- }
-
- function getContactHead()
- {
- return $this->xoopsContactConfig['contact_head'];
- }
-
- function getContactIntro()
- {
- return $this->xoopsContactConfig['contact_intro'];
- }
-
- function getContactIntroHead()
- {
- return $this->xoopsContactConfig['contact_intro_head'];
- }
-
- function getContactThankYou()
- {
- return $this->xoopsContactConfig['contact_thankyou'];
- }
-
- function getRedirectTimeout()
- {
- return intval( $this->xoopsContactConfig['contact_redirecttimeout'] );
- }
-
- function getUserName()
- {
- return $this->username;
- }
-
- function setUserName( $name )
- {
- $this->username = $name;
- }
-
- function getUserEmail()
- {
- return $this->useremail;
- }
-
- function setUserEmail( $email )
- {
- $this->useremail = $email;
- }
-
- function isValidEmail()
- {
- $retval = false;
- // this validates the structure of the email
- if ( preg_match("/^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i", $this->useremail ) )
- {
- $retval = true;
- }
- return $retval;
- }
-
-
- function getEmailtld()
- {
- $retval = "";
- if ( preg_match("/^[a-zA-Z0-9_\.]+@([a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+)$/i", $this->useremail, $regs ) )
- {
- $retval = $regs[1];
- }
-
- return $retval;
- }
-
- function collectAddress()
- {
- $retval = false;
- if ( $this->xoopsContactConfig['contact_address'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function getAddress()
- {
- return $this->userAddress;
- }
-
- function setAddress( $addr )
- {
- $this->userAddress = $addr;
- }
-
- function collectURL()
- {
- $retval = false;
- if( $this->xoopsContactConfig['contact_url'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function getURL()
- {
- return $this->userURL;
- }
-
- function setURL( $url )
- {
- $this->userURL = $url;
- }
-
- function collectICQ()
- {
- $retval = false;
- if( $this->xoopsContactConfig['contact_icq'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function getICQ()
- {
- return $this->userICQ;
- }
-
- function setICQ( $icq )
- {
- $this->userICQ = $icq;
- }
-
- function collectCompany()
- {
- $retval = false;
- if( $this->xoopsContactConfig['contact_company'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function getCompany()
- {
- return $this->userCompany;
- }
-
- function setCompany( $comp )
- {
- $this->userCompany = $comp;
- }
-
- function collectLocation()
- {
- $retval = false;
- if( $this->xoopsContactConfig['contact_loc'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function getLocation()
- {
- return $this->userLocation;
- }
-
- function setLocation( $loc )
- {
- $this->userLocation = $loc;
- }
-
- function sendConfirm()
- {
- $retval = false;
- if( $this->xoopsContactConfig['contact_allowsendconfirm'] == '1' )
- {
- $retval = true;
- }
- return $retval;
- }
-
- function setSendConfirm( $set )
- {
- $this->userSendConfirm = $set;
- }
-
- function getSendConfirm()
- {
- return $this->userSendConfirm;
- }
-
- function getUserComments()
- {
- return $this->userComments...
[truncated message content] |