Exemple #1
0
    public static function description($listEdit, $lists, $show, $html, $listType)
    {
        $editor = JFactory::getEditor();
        static $db = null;
        if (!isset($db)) {
            $db = JFactory::getDBO();
        }
        ?>
	<fieldset class="jnewscss">
	<table class="jnewstable" width="100%"  cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_INFO_LIST_PUB;
        $title = _JNEWS_PUBLISHED;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td><?php 
        echo $lists['published'];
        ?>
</td>
		</tr>
	<?php 
        if ($show['hide']) {
            ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_MAILING_VISIBLE;
            $title = _JNEWS_VISIBLE_FRONT;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			<td><?php 
            echo $lists['hidden'];
            ?>
</td>
			</tr>

	<?php 
        } else {
            echo '<input type="hidden" name="hidden" value="' . $listEdit->hidden . '" />';
        }
        ?>
	 		<?php 
        if ($listType == 2) {
            ?>
	 	<tr>
	 		<td width="185%" class="key">
	 			<span class="editlinktip">
	 			<?php 
            $tip = _JNEWS_SUBS_LIST_TIPS;
            $title = _JNEWS_SUBS_LIST2;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
	 			</span>
	 		</td>

			<td width="90%">
			<table width = "50%"><tr><td>
			<?php 
            require_once JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'administrator' . DS . 'components' . DS . JNEWS_OPTION . DS . 'views' . DS . 'mailings.jnews.html.php';
            jNews_MailingsHTML::lists(null, $lists, $show, $listType, $listEdit->id, true);
            ?>
			 </td></tr></table>
			</td>	 	</tr>
			<?php 
        }
        ?>

		</tbody>
	</table>
	</fieldset>
	<fieldset class="jnewscss">
	<legend><?php 
        echo _JNEWS_LIST_T_GENERAL;
        ?>
</legend>
	<table class="jnewstable" width="100%" cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_INFO_LIST_NAME;
        $title = _JNEWS_LIST_NAME;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td>
			<?php 
        $text = str_replace('"', '&quot;', $listEdit->list_name);
        if (function_exists('htmlspecialchars_decode')) {
            $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
        } elseif (function_exists('html_entity_decode')) {
            $text = html_entity_decode($text, ENT_NOQUOTES);
        }
        echo ' <input type="text" name="list_name" class="inputbox requiredd" size="50" maxlength="64" value="' . $text . '" />';
        ?>
			</td>
		</tr>
		<?php 
        if ($GLOBALS[JNEWS . 'listHTMLeditor'] == '1') {
            ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_DESC;
            $title = _JNEWS_LIST_DESC;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
			<?php 
            echo $editor->display('list_desc', $listEdit->list_desc, '100%', '200', '75', '10');
            ?>
			</td>
		</tr>
		<?php 
        } else {
            echo jnews::printM('notice', _JNEWS__LIST_HTML_EDITOR);
        }
        ?>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
        $tip = _JNEWS_ASSIGN_LIS_TEMPLATE_TIPS;
        $title = _JNEWS_ASSIGN_LIS_TEMPLATE;
        echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        ?>
				</span>
			</td>
			<td>
			<?php 
        echo $lists['list_templates'];
        ?>
			</td>
		</tr>
		</tbody>
	</table>
	</fieldset>
<?php 
        if ($show['sender_info']) {
            ?>
	<fieldset class="jnewscss">
	<legend><?php 
            echo _JNEWS_LIST_T_SENDER;
            ?>
</legend>
	<table class="jnewstable" width="100%" cellspacing="1">
		<tbody>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_NAME;
            $title = _JNEWS_SENDER_NAME;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
			<?php 
            //if empty sender name and sender email
            //				$userSender=jNews_Subscribers::getUsers( 'gid', '50',$listEdit->owner );
            //				if(empty($listEdit->sendername)) $listEdit->sendername=$userSender[0]->name;
            //				if(empty($listEdit->senderemail)) $listEdit->senderemail=$userSender[0]->email;
            $text = str_replace('"', '&quot;', $listEdit->sendername);
            if (function_exists('htmlspecialchars_decode')) {
                $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
            } elseif (function_exists('html_entity_decode')) {
                $text = html_entity_decode($text, ENT_NOQUOTES);
            }
            echo ' <input type="text" name="sendername" class="inputbox" size="40" maxlength="64" value="' . $text . '" />';
            ?>

				&nbsp;<img src="components/<?php 
            echo JNEWS_OPTION;
            ?>
/images/16/profile.png" id="popbtn" name="popbtn" onClick="document.getElementById('poplist').style.display = 'inline'; document.getElementById('popbtn').style.display = 'none';" title="<?php 
            echo _JNEWS_SENDER_LIST_INFO;
            ?>
" style="position:absolute;">
				<select id="poplist" name="poplist" style="display:none;position:relative;" onChange="document.getElementById('poplist').style.display = 'none'; document.getElementById('popbtn').style.display = 'inline';">
				<option value="0" onClick="document.adminForm.sendername.value=''; document.adminForm.senderemail.value='';"> </option>
			<?php 
            // 2nd parameter of this public static function should be a preference
            // we need to limit it so that it wouldnt cause any problems when loading a bunch of datas e.g hundreds or thousands of users
            $usersA = jNews_Subscribers::getUsers('gid', '50');
            // create options for list
            if (!empty($usersA)) {
                foreach ($usersA as $user) {
                    $name = $user->name;
                    $email = $user->email;
                    $selected = isset($listEdit->sendername) && $listEdit->sendername == $name && (isset($listEdit->senderemail) && $listEdit->senderemail == $email) ? true : false;
                    ?>
						<option value="<?php 
                    echo $user->name;
                    ?>
" onClick="document.adminForm.sendername.value='<?php 
                    echo $name;
                    ?>
'; document.adminForm.senderemail.value='<?php 
                    echo $email;
                    ?>
';" <?php 
                    if ($selected) {
                        echo 'selected';
                    }
                    ?>
> <?php 
                    echo $user->name . ' (' . $user->email . ')';
                    ?>
 </option>
				<?php 
                }
            }
            ?>
			 	</select>
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_EMAIL;
            $title = _JNEWS_SENDER_EMAIL;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="senderemail" class="inputbox" size="40" maxlength="64" value="<?php 
            echo $listEdit->senderemail;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_BOUNCED;
            $title = _JNEWS_SENDER_BOUNCE;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="bounceadres" class="inputbox" size="40" maxlength="64" value="<?php 
            echo $listEdit->bounceadres;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="185" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_JNEWS_OWNER;
            $title = _JNEWS_OWNER;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<?php 
            echo $listEdit->owner;
            ?>
			</td>
		</tr>
		</tbody>
	</table>
	</fieldset>
	<?php 
        } else {
            echo '<input type="hidden" name="sendername" value="' . $listEdit->sendername . '" />';
            echo '<input type="hidden" name="senderemail" value="' . $listEdit->senderemail . '" />';
            echo '<input type="hidden" name="bounceadres" value="' . $listEdit->bounceadres . '" />';
        }
    }
Exemple #2
0
    public static function senderinfo($mailingEdit, $lists, $show)
    {
        ?>
	<?php 
        if ($show['sender_info']) {
            ?>

	<table class="jnewstable" cellspacing="1">
		<tbody>
		<tr>
			<td width="150px" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_NAME;
            $title = _JNEWS_SENDER_NAME;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
			<?php 
            //				$userSender=jNews_Subscribers::getUsers( 'gid', '50',$mailingEdit->author_id ); //if empty sender name and sender email
            //				if(empty($mailingEdit->fromname)) $mailingEdit->fromname=$userSender[0]->name;
            //				if(empty($mailingEdit->fromemail)) $mailingEdit->fromemail=$userSender[0]->email;
            $text = str_replace('"', '&quot;', $mailingEdit->fromname);
            if (function_exists('htmlspecialchars_decode')) {
                $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
            } elseif (function_exists('html_entity_decode')) {
                $text = html_entity_decode($text, ENT_NOQUOTES);
            }
            echo '<input type="text" name="fromname" class="inputbox" size="20" maxlength="64" value="' . $text . '" />';
            ?>
				<?php 
            // clickable image for sender list
            ?>
				&nbsp;<img src="components/<?php 
            echo JNEWS_OPTION;
            ?>
/images/16/profile.png" id="popbtn" name="popbtn" onClick="document.getElementById('poplist').style.display = 'inline'; document.getElementById('popbtn').style.display = 'none';" title="<?php 
            echo _JNEWS_SENDER_LIST_INFO;
            ?>
" style="position:absolute;">

				<?php 
            //Select tag with script
            ?>
				<select id="poplist" name="poplist" style="display:none;position:absolute;" onChange="document.getElementById('poplist').style.display = 'none'; document.getElementById('popbtn').style.display = 'inline';">

				<?php 
            //create a default sender value for NONE/NULL
            ?>
				<option value="1" onClick="document.adminForm.fromname.value=''; document.adminForm.fromemail.value='';"> </option>
			<?php 
            // 2nd parameter of this public static function should be a preference
            // we need to limit it so that it wouldnt cause any problems when loading a bunch of datas e.g hundreds or thousands of users
            $usersA = jNews_Subscribers::getUsers('gid', '50');
            // create options for list
            if (!empty($usersA)) {
                foreach ($usersA as $user) {
                    $name = $user->name;
                    $email = $user->email;
                    $selected = isset($mailingEdit->fromname) && $mailingEdit->fromname == $name && (isset($mailingEdit->fromemail) && $mailingEdit->fromemail == $email) ? true : false;
                    ?>
						<option value="<?php 
                    echo $user->name;
                    ?>
" onClick="document.adminForm.fromname.value='<?php 
                    echo $name;
                    ?>
'; document.adminForm.fromemail.value='<?php 
                    echo $email;
                    ?>
';" <?php 
                    if ($selected) {
                        echo 'selected';
                    }
                    ?>
> <?php 
                    echo $user->name . ' (' . $user->email . ')';
                    ?>
 </option>
				<?php 
                }
            }
            ?>
			 	</select>
			</td>
		</tr>
		<tr>
			<td width="150px" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_EMAIL;
            $title = _JNEWS_SENDER_EMAIL;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="fromemail" class="inputbox" size="20" maxlength="64" value="<?php 
            echo $mailingEdit->fromemail;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="150px" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_SENDER_BOUNCED;
            $title = _JNEWS_SENDER_BOUNCE;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<input type="text" name="frombounce" class="inputbox" size="20" maxlength="64" value="<?php 
            echo $mailingEdit->frombounce;
            ?>
" />
			</td>
		</tr>
		<tr>
			<td width="150px" class="key">
				<span class="editlinktip">
				<?php 
            $tip = _JNEWS_INFO_LIST_JNEWS_OWNER;
            $title = _JNEWS_OWNER;
            echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span>
			</td>
			<td>
				<?php 
            echo $mailingEdit->author_id;
            ?>
			</td>
		</tr>
		</tbody>
	</table>
	<?php 
        }
    }
Exemple #3
0
 /**
  * This function is used to override the send function in Joomla
  */
 public static function getMailer($mailing, $html = 0)
 {
     $fromname = empty($mailing->fromname) ? trim($GLOBALS[JNEWS . 'sendmail_name']) : trim($mailing->fromname);
     $fromemail = empty($mailing->fromemail) ? trim($GLOBALS[JNEWS . 'sendmail_email']) : trim($mailing->fromemail);
     $frombounce = empty($mailing->frombounce) ? trim($GLOBALS[JNEWS . 'sendmail_from']) : trim($mailing->frombounce);
     if (empty($fromemail)) {
         $my = JFactory::getUser();
         $userSender = jNews_Subscribers::getUsers('gid', '50', $my->id);
         $fromemail = $userSender[0]->email;
         if (empty($fromemail)) {
             jnews::printM('no', 'The sender email needs to be specified in the configuration.');
             return false;
         }
     }
     if (empty($frombounce)) {
         $frombounce = $fromemail;
     }
     $attachments = $mailing->attachments;
     $images = $mailing->images;
     $conf = JFactory::getConfig();
     $frombounceName = $fromname ? $fromname : $conf->get('config.fromname');
     if (empty($fromemail)) {
         $fromemail = trim($conf->get('config.mailfrom'));
     }
     if (empty($fromname)) {
         $fromname = trim($conf->get('config.fromname'));
     }
     jimport('joomla.mail.mail');
     $phpmailerPath = JPATH_LIBRARIES . DS . 'phpmailer' . DS;
     $mail = new JMail();
     $mail->PluginDir = $phpmailerPath;
     $mail->SetLanguage('en', $phpmailerPath . 'language' . DS);
     $mail->WordWrap = 150;
     //      	$mail->addCustomHeader("X-Mailer: ".JNEWS_JPATH_LIVE);
     //      	$mail->addCustomHeader("X-MessageID: $mailing->id");
     if ($GLOBALS[JNEWS . 'mail_format'] == '1') {
         $mail->Encoding = 'base64';
     }
     if ($GLOBALS[JNEWS . 'minisendmail']) {
         $frombounceName = '';
     }
     if (!empty($frombounce)) {
         if (version_compare(JVERSION, '3.0.0', '<')) {
             $mail->addReplyTo(array($frombounce, $frombounceName));
         } else {
             $mail->addReplyTo(array($frombounce));
         }
         JRequest::setVar('bounceBackEmail', $frombounce);
     }
     $mail->From = trim($fromemail);
     if ($GLOBALS[JNEWS . 'minisendmail']) {
         $mail->FromName = '';
     } else {
         $mail->FromName = $fromname;
     }
     $mail->Sender = trim($GLOBALS[JNEWS . 'sendmail_from']);
     if (empty($mail->Sender)) {
         $mail->Sender = '';
     }
     switch ($GLOBALS[JNEWS . 'emailmethod']) {
         case 'mail':
             $mail->IsMail();
             break;
         case 'sendmail':
             $mail->IsSendmail();
             $mail->Sendmail = $GLOBALS[JNEWS . 'sendmail_path'] ? $GLOBALS[JNEWS . 'sendmail_path'] : $conf->get('config.sendmail');
             break;
         case 'smtp':
             $mail->IsSMTP();
             $mail->Host = $GLOBALS[JNEWS . 'smtp_host'] ? $GLOBALS[JNEWS . 'smtp_host'] : $conf->get('config.smtphost');
             $mail->Port = $GLOBALS[JNEWS . 'smtp_port'] ? $GLOBALS[JNEWS . 'smtp_port'] : $conf->get('config.smtpport');
             $mail->SMTPSecure = $GLOBALS[JNEWS . 'smtp_secure'] ? $GLOBALS[JNEWS . 'smtp_secure'] : '';
             if ((bool) $GLOBALS[JNEWS . 'smtp_auth_required']) {
                 $mail->SMTPAuth = $GLOBALS[JNEWS . 'smtp_auth_required'];
                 $mail->Password = $GLOBALS[JNEWS . 'smtp_password'];
                 $mail->Username = $GLOBALS[JNEWS . 'smtp_username'];
             }
             break;
         default:
             $mail->Mailer = $conf->get('config.mailer');
             break;
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             if (basename($attachment) !== 'index.html') {
                 $mail->AddAttachment(JNEWS_JPATH_ROOT_NO_ADMIN . $GLOBALS[JNEWS . 'upload_url'] . DS . basename($attachment));
             }
         }
     }
     switch (substr(strtoupper(PHP_OS), 0, 3)) {
         case "WIN":
             $mail->LE = "\r\n";
             break;
         case "MAC":
         case "DAR":
             $mail->LE = "\r";
         default:
             break;
     }
     return $mail;
 }