From: <vo...@us...> - 2012-09-15 10:46:02
|
Revision: 10175 http://xoops.svn.sourceforge.net/xoops/?rev=10175&view=rev Author: voltan1 Date: 2012-09-15 10:45:56 +0000 (Sat, 15 Sep 2012) Log Message: ----------- Fix send email Modified Paths: -------------- XoopsModules/contact/branches/voltan/v1.8/contact/admin/contact.php XoopsModules/contact/branches/voltan/v1.8/contact/class/contact.php Modified: XoopsModules/contact/branches/voltan/v1.8/contact/admin/contact.php =================================================================== --- XoopsModules/contact/branches/voltan/v1.8/contact/admin/contact.php 2012-09-13 15:51:26 UTC (rev 10174) +++ XoopsModules/contact/branches/voltan/v1.8/contact/admin/contact.php 2012-09-15 10:45:56 UTC (rev 10175) @@ -1,88 +1,88 @@ -<?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 Hossein Azizabadi (AKA Voltan) - * @version $Id$ - */ - -// Call header +<?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 Hossein Azizabadi (AKA Voltan) + * @version $Id$ + */ + +// Call header require dirname(__FILE__) . '/header.php'; -// Display Admin header +// 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'); +// 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->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) +switch ($op) { case 'list': $contact = array(); - $contact['perpage'] = '10'; - $contact['order'] = 'DESC'; + $contact['perpage'] = '10'; + $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; + // 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 = ''; + 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('contacts', $contacts); $xoopsTpl->assign('contact_pagenav', $contact_pagenav); $level = 'list'; break; case 'reply': - if ($contact_id > 0) { + 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); + $xoopsTpl->assign('replylist', $contact_handler->Contact_GetReply($contact_id)); + } else { + redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST); } $level = 'reply'; break; @@ -114,7 +114,7 @@ // send mail can seet message if($sendmail = true) { - $message = $contact_handler->Contact_SendMail($contact); + $message = $contact_handler->Contact_ReplyMail($contact); } else if ($saveinfo = true) { $message = _MD_CONTACT_MES_SAVEINDB; } else { @@ -163,11 +163,11 @@ case 'delete': if ($contact_id > 0) { - // Prompt message + // 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); - } + } else { + redirect_header ( 'contact.php', 3, _AM_CONTACT_MSG_EXIST); + } $level = 'delete'; break; @@ -190,7 +190,7 @@ exit (); } - redirect_header ( 'contact.php', 1, _AM_CONTACT_MSG_DELETED ); + redirect_header ( 'contact.php', 1, _AM_CONTACT_MSG_DELETEDO ); xoops_cp_footer (); exit (); break; @@ -199,8 +199,8 @@ $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 +// 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 Modified: XoopsModules/contact/branches/voltan/v1.8/contact/class/contact.php =================================================================== --- XoopsModules/contact/branches/voltan/v1.8/contact/class/contact.php 2012-09-13 15:51:26 UTC (rev 10174) +++ XoopsModules/contact/branches/voltan/v1.8/contact/class/contact.php 2012-09-15 10:45:56 UTC (rev 10175) @@ -1,33 +1,33 @@ -<?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 Hossein Azizabadi (AKA Voltan) - * @version $Id$ - */ - -if (!defined("XOOPS_ROOT_PATH")) { - die("XOOPS root path not defined"); +<?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 Hossein Azizabadi (AKA Voltan) + * @version $Id$ + */ + +if (!defined("XOOPS_ROOT_PATH")) { + die("XOOPS root path not defined"); } -class contact extends XoopsObject +class contact extends XoopsObject { - function __construct() - { - $this->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); @@ -123,7 +123,7 @@ xoops_load('XoopsFormCaptcha'); $form->addElement(new XoopsFormCaptcha(), true); - $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); + $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; } @@ -141,8 +141,8 @@ $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')); + $form->addElement(new XoopsFormTextArea ( _AM_CONTACT_MESSAGE, 'contact_message', '', 5, 60 ), true ); + $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; } @@ -161,19 +161,19 @@ } } -class ContactContactHandler extends XoopsPersistableObjectHandler -{ - function __construct(&$db) - { - parent::__construct($db, "contact", 'contact', 'contact_id', 'contact_mail'); +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') { - + /** + * 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; @@ -206,7 +206,7 @@ if ($ret === false) { return $default; } - return $ret; + return $ret; } function Contact_InfoProcessing($global) { @@ -232,7 +232,7 @@ } function Contact_SendMail($contact) { - $xoopsMailer =& xoops_getMailer(); + $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($this->Contact_ToEmails($contact['contact_department'])); $xoopsMailer->setFromEmail($contact['contact_mail']); @@ -248,7 +248,7 @@ } function Contact_ReplyMail($contact) { - $xoopsMailer =& xoops_getMailer(); + $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($contact['contact_mailto']); $xoopsMailer->setFromEmail($contact['contact_mail']); @@ -262,18 +262,18 @@ } return $message; } - + function Contact_ToEmails($department = null) { global $xoopsConfig; - $admin_mail = $xoopsConfig['adminmail']; - if($department) { + $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]; + if($department == $vale[0]) $department_mail[] = $vale[1]; } } - return $admin_mail . ','. $department_mail; + return $department_mail; } function Contact_AddReply($contact_id) { @@ -367,5 +367,5 @@ } } - + ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |