| 1 | <?php |
|---|
| 2 | // $Id: join.php,v 1.5 2005/09/04 20:46:12 onokazu Exp $ |
|---|
| 3 | // ------------------------------------------------------------------------ // |
|---|
| 4 | // XOOPS - PHP Content Management System // |
|---|
| 5 | // Copyright (c) 2000 XOOPS.org // |
|---|
| 6 | // <http://www.xoops.org/> // |
|---|
| 7 | // ------------------------------------------------------------------------ // |
|---|
| 8 | // This program is free software; you can redistribute it and/or modify // |
|---|
| 9 | // it under the terms of the GNU General Public License as published by // |
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
|---|
| 11 | // (at your option) any later version. // |
|---|
| 12 | // // |
|---|
| 13 | // You may not change or alter any portion of this comment or credits // |
|---|
| 14 | // of supporting developers from this source code or any supporting // |
|---|
| 15 | // source code which is considered copyrighted (c) material of the // |
|---|
| 16 | // original comment or credit authors. // |
|---|
| 17 | // // |
|---|
| 18 | // This program is distributed in the hope that it will be useful, // |
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|---|
| 21 | // GNU General Public License for more details. // |
|---|
| 22 | // // |
|---|
| 23 | // You should have received a copy of the GNU General Public License // |
|---|
| 24 | // along with this program; if not, write to the Free Software // |
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|---|
| 26 | // ------------------------------------------------------------------------- // |
|---|
| 27 | // Author: Raul Recio (AKA UNFOR) // |
|---|
| 28 | // Project: The XOOPS Project // |
|---|
| 29 | // ------------------------------------------------------------------------- // |
|---|
| 30 | |
|---|
| 31 | include "header.php"; |
|---|
| 32 | $xoopsOption['template_main'] = 'xoopspartners_join.html'; |
|---|
| 33 | include XOOPS_ROOT_PATH."/header.php"; |
|---|
| 34 | $myts =& MyTextSanitizer::getInstance(); |
|---|
| 35 | if ( $xoopsUser ){ |
|---|
| 36 | if ( !empty($_POST['op']) && $_POST['op'] == "sendMail" ) { |
|---|
| 37 | include XOOPS_ROOT_PATH."/class/xoopsmailer.php"; |
|---|
| 38 | if ( empty($_POST['title']) or empty($_POST['url']) or empty($_POST['description']) or $_POST['url'] == "http://" ) { |
|---|
| 39 | $xoopsTpl->assign(array( |
|---|
| 40 | "content4join" => _MD_ERROR1, |
|---|
| 41 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 42 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 43 | )); |
|---|
| 44 | $xoopsContentsTpl = 'partnerjoin.html'; |
|---|
| 45 | include_once XOOPS_ROOT_PATH.'/footer.php'; |
|---|
| 46 | exit(); |
|---|
| 47 | } |
|---|
| 48 | $url = formatURL($myts->makeTboxData4Show($_POST['url'])); |
|---|
| 49 | $image = formatURL($myts->makeTboxData4Show($_POST['image'])); |
|---|
| 50 | $title = $myts->makeTboxData4Show($_POST['title']); |
|---|
| 51 | $description = $myts->makeTboxData4Show($_POST['description']); |
|---|
| 52 | $imageInfo = @getimagesize($image); |
|---|
| 53 | $imageWidth = $imageInfo[0]; |
|---|
| 54 | $imageHeight = $imageInfo[1]; |
|---|
| 55 | $type = $imageInfo[2]; |
|---|
| 56 | if ($type == 0) { |
|---|
| 57 | $xoopsTpl->assign(array( |
|---|
| 58 | "content4join" => _MD_ERROR3, |
|---|
| 59 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 60 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 61 | )); |
|---|
| 62 | $xoopsContentsTpl = 'partnerjoin.html'; |
|---|
| 63 | include_once XOOPS_ROOT_PATH.'/footer.php'; |
|---|
| 64 | exit(); |
|---|
| 65 | } |
|---|
| 66 | if ( $imageWidth >= 110 or $imageHeight >=50 ) { |
|---|
| 67 | $xoopsTpl->assign(array( |
|---|
| 68 | "content4join" => _MD_ERROR2, |
|---|
| 69 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 70 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 71 | )); |
|---|
| 72 | $xoopsContentsTpl = 'partnerjoin.html'; |
|---|
| 73 | include_once XOOPS_ROOT_PATH.'/footer.php'; |
|---|
| 74 | exit(); |
|---|
| 75 | } |
|---|
| 76 | if( $image == "http://" ) { |
|---|
| 77 | $image = ""; |
|---|
| 78 | } |
|---|
| 79 | $xoopsMailer =& getMailer(); |
|---|
| 80 | $xoopsMailer->useMail(); |
|---|
| 81 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/xoopspartners/language/'.$xoopsConfig['language'].'/'); |
|---|
| 82 | $xoopsMailer->setTemplate("join.tpl"); |
|---|
| 83 | $xoopsMailer->assign("SITENAME", $xoopsConfig['sitename']); |
|---|
| 84 | $xoopsMailer->assign("SITEURL", XOOPS_URL."/"); |
|---|
| 85 | $xoopsMailer->assign("IP", $_SERVER['REMOTE_ADDR']); |
|---|
| 86 | $xoopsMailer->assign("URL", $url); |
|---|
| 87 | $xoopsMailer->assign("IMAGE", $image); |
|---|
| 88 | $xoopsMailer->assign("TITLE", $title); |
|---|
| 89 | $xoopsMailer->assign("DESCRIPTION", $description); |
|---|
| 90 | $xoopsMailer->assign("USER", $xoopsUser->getVar("uname")); |
|---|
| 91 | $xoopsMailer->setToEmails($xoopsConfig['adminmail']); |
|---|
| 92 | $xoopsMailer->setFromEmail($xoopsUser->getVar("email")); |
|---|
| 93 | $xoopsMailer->setFromName($xoopsUser->getVar("uname")); |
|---|
| 94 | $xoopsMailer->setSubject(sprintf(_MD_NEWPARTNER,$xoopsConfig['sitename'])); |
|---|
| 95 | if ( !$xoopsMailer->send() ) { |
|---|
| 96 | $xoopsTpl->assign(array( |
|---|
| 97 | "content4join" => "<br />".$xoopsMailer->getErrors()._MD_GOBACK, |
|---|
| 98 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 99 | "lang_join" => _MD_JOIN, |
|---|
| 100 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 101 | )); |
|---|
| 102 | } else { |
|---|
| 103 | $xoopsTpl->assign(array( |
|---|
| 104 | "content4join" => "<br />"._MD_SENDMAIL, |
|---|
| 105 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 106 | "lang_join" => _MD_JOIN, |
|---|
| 107 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 108 | )); |
|---|
| 109 | } |
|---|
| 110 | $xoopsContentsTpl = 'partnerjoin.html'; |
|---|
| 111 | } else { |
|---|
| 112 | include XOOPS_ROOT_PATH."/class/xoopsformloader.php"; |
|---|
| 113 | $form = new XoopsThemeForm("", "joinform", "join.php"); |
|---|
| 114 | $titlePartern = new XoopsFormText(_MD_TITLE, "title", 30, 50); |
|---|
| 115 | $imagePartern = new XoopsFormText(_MD_IMAGE, "image", 30, 150, "http://"); |
|---|
| 116 | $urlPartern = new XoopsFormText(_MD_URL, "url", 30, 150, "http://"); |
|---|
| 117 | $descriptionPartern = new XoopsFormTextArea(_MD_DESCRIPTION, "description","", 7, 50); |
|---|
| 118 | $op_hidden = new XoopsFormHidden("op", "sendMail"); |
|---|
| 119 | $submit_button = new XoopsFormButton("", "dbsubmit", _MD_SEND, "submit"); |
|---|
| 120 | $form->addElement($titlePartern); |
|---|
| 121 | $form->addElement($imagePartern); |
|---|
| 122 | $form->addElement($urlPartern); |
|---|
| 123 | $form->addElement($descriptionPartern); |
|---|
| 124 | $form->addElement($op_hidden); |
|---|
| 125 | $form->addElement($submit_button); |
|---|
| 126 | $form->setRequired($titlePartern); |
|---|
| 127 | $form->setRequired($urlPartern); |
|---|
| 128 | $form->setRequired($descriptionPartern); |
|---|
| 129 | $content = $form->render(); |
|---|
| 130 | $xoopsTpl->assign(array( |
|---|
| 131 | "content4join" => $content, |
|---|
| 132 | "lang_main_partner" => _MD_PARTNERS, |
|---|
| 133 | "lang_join" => _MD_JOIN, |
|---|
| 134 | "sitename" => htmlspecialchars($xoopsConfig['sitename']) |
|---|
| 135 | )); |
|---|
| 136 | } |
|---|
| 137 | } else { // else -- if ( $xoopsUser ) |
|---|
| 138 | redirect_header("index.php",2,_NOPERM); |
|---|
| 139 | } |
|---|
| 140 | include_once XOOPS_ROOT_PATH.'/footer.php'; |
|---|
| 141 | ?> |
|---|