예제 #1
0
 function copy()
 {
     if (!$this->isAllowed($this->aclCat, 'manage')) {
         return;
     }
     JRequest::checkToken() || JRequest::checkToken('get') || JSession::checkToken('get') || die('Invalid Token');
     $cids = JRequest::getVar('cid', array(), '', 'array');
     $db = JFactory::getDBO();
     $time = time();
     $my = JFactory::getUser();
     $creatorId = intval($my->id);
     $addSendDate = '';
     if (!empty($this->copySendDate)) {
         $addSendDate = ', `senddate`';
     }
     foreach ($cids as $oneMailid) {
         $query = 'INSERT INTO `#__acymailing_mail` (`subject`, `body`, `altbody`, `published`' . $addSendDate . ', `created`, `fromname`, `fromemail`, `replyname`, `replyemail`, `type`, `visible`, `userid`, `alias`, `attach`, `html`, `tempid`, `key`, `frequency`, `params`,`filter`,`metakey`,`metadesc`)';
         $query .= " SELECT CONCAT('copy_',`subject`), `body`, `altbody`, 0" . $addSendDate . ", '.{$time}.', `fromname`, `fromemail`, `replyname`, `replyemail`, `type`, `visible`, '.{$creatorId}.', `alias`, `attach`, `html`, `tempid`, " . $db->Quote(acymailing_generateKey(8)) . ', `frequency`, `params`,`filter`,`metakey`,`metadesc` FROM `#__acymailing_mail` WHERE `mailid` = ' . (int) $oneMailid;
         $db->setQuery($query);
         $db->query();
         $newMailid = $db->insertid();
         $db->setQuery('INSERT IGNORE INTO `#__acymailing_listmail` (`listid`,`mailid`) SELECT `listid`,' . $newMailid . ' FROM `#__acymailing_listmail` WHERE `mailid` = ' . (int) $oneMailid);
         $db->query();
     }
     return $this->listing();
 }
예제 #2
0
 function save($mail)
 {
     if (isset($mail->alias) or empty($mail->mailid)) {
         if (empty($mail->alias)) {
             $mail->alias = $mail->subject;
         }
         $mail->alias = JFilterOutput::stringURLSafe(trim($mail->alias));
     }
     if (empty($mail->mailid)) {
         if (empty($mail->created)) {
             $mail->created = time();
         }
         if (empty($mail->userid)) {
             $user = JFactory::getUser();
             $mail->userid = $user->id;
         }
         if (empty($mail->key)) {
             $mail->key = acymailing_generateKey(8);
         }
     } else {
         if (!empty($mail->attach)) {
             $oldMailObject = $this->get($mail->mailid);
             if (!empty($oldMailObject)) {
                 $mail->attach = array_merge($oldMailObject->attach, $mail->attach);
             }
         }
     }
     if (!empty($mail->attach) and !is_string($mail->attach)) {
         $mail->attach = serialize($mail->attach);
     }
     if (isset($mail->filter) and !is_string($mail->filter)) {
         $mail->filter = serialize($mail->filter);
     }
     if (!empty($mail->params)) {
         if (!empty($mail->params['lastgenerateddate']) && !is_numeric($mail->params['lastgenerateddate'])) {
             $mail->params['lastgenerateddate'] = acymailing_getTime($mail->params['lastgenerateddate']);
         }
         $mail->params = serialize($mail->params);
     }
     if (!empty($mail->senddate) && !is_numeric($mail->senddate)) {
         $mail->senddate = acymailing_getTime($mail->senddate);
     }
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     if (empty($mail->mailid)) {
         $dispatcher->trigger('onAcyBeforeMailCreate', array(&$mail));
         $status = $this->database->insertObject(acymailing_table('mail'), $mail);
     } else {
         $dispatcher->trigger('onAcyBeforeMailModify', array(&$mail));
         $status = $this->database->updateObject(acymailing_table('mail'), $mail, 'mailid');
     }
     if (!$status) {
         $this->errors[] = substr(strip_tags($this->database->getErrorMsg()), 0, 200) . '...';
     }
     if (!empty($mail->params) and is_string($mail->params)) {
         $mail->params = unserialize($mail->params);
     }
     if (!empty($mail->attach) and is_string($mail->attach)) {
         $mail->attach = unserialize($mail->attach);
     }
     if ($status) {
         return empty($mail->mailid) ? $this->database->insertid() : $mail->mailid;
     }
     return false;
 }
예제 #3
0
 function save($subscriber)
 {
     $app = JFactory::getApplication();
     $config = acymailing_config();
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     if (isset($subscriber->email)) {
         $subscriber->email = strtolower($subscriber->email);
         $userHelper = acymailing_get('helper.user');
         if (!$userHelper->validEmail($subscriber->email, $this->extendedEmailVerif)) {
             echo "<script>alert('" . JText::_('VALID_EMAIL', true) . "'); window.history.go(-1);</script>";
             exit;
         }
     }
     if (empty($subscriber->subid)) {
         $my = JFactory::getUser();
         if ($this->checkVisitor && !$app->isAdmin() && (int) $config->get('allow_visitor', 1) != 1 && (empty($my->id) or strtolower($my->email) != $subscriber->email)) {
             echo "<script> alert('" . JText::_('ONLY_LOGGED', true) . "'); window.history.go(-1);</script>\n";
             exit;
         }
         if (empty($subscriber->email)) {
             return false;
         }
         $subscriber->subid = $this->subid($subscriber->email);
     }
     if (empty($subscriber->subid)) {
         if (empty($subscriber->created)) {
             $subscriber->created = time();
         }
         if (empty($subscriber->ip)) {
             $ipClass = acymailing_get('helper.user');
             $subscriber->ip = $ipClass->getIP();
         }
         $source = JRequest::getCmd('acy_source');
         if (empty($subscriber->source) && !empty($source)) {
             $subscriber->source = $source;
         }
         if (empty($subscriber->name) && $config->get('generate_name', 1)) {
             $subscriber->name = ucwords(trim(str_replace(array('.', '_', ')', ',', '(', '-', 1, 2, 3, 4, 5, 6, 7, 8, 9, 0), ' ', substr($subscriber->email, 0, strpos($subscriber->email, '@')))));
         }
         $subscriber->key = acymailing_generateKey(14);
         $dispatcher->trigger('onAcyBeforeUserCreate', array(&$subscriber));
         $status = $this->database->insertObject(acymailing_table('subscriber'), $subscriber);
     } else {
         if (count((array) $subscriber) > 1) {
             $dispatcher->trigger('onAcyBeforeUserModify', array(&$subscriber));
             $status = $this->database->updateObject(acymailing_table('subscriber'), $subscriber, 'subid');
         } else {
             $status = true;
         }
     }
     if (!$status) {
         return false;
     }
     $subid = empty($subscriber->subid) ? $this->database->insertid() : $subscriber->subid;
     if ($this->triggerFilterBE || !$app->isAdmin()) {
         $filterClass = acymailing_get('class.filter');
         $filterClass->subid = $subid;
         $filterClass->trigger(empty($subscriber->subid) ? 'subcreate' : 'subchange');
     }
     $classGeoloc = acymailing_get('class.geolocation');
     if (empty($subscriber->subid)) {
         $subscriber->subid = $subid;
         if ($this->geolocRight) {
             $this->geolocData = $classGeoloc->saveGeolocation('creation', $subscriber->subid);
         }
         $this->userForNotification = $subscriber;
         $resultsTrigger = $dispatcher->trigger('onAcyUserCreate', array($subscriber));
         $this->recordHistory = true;
         $action = 'created';
     } else {
         if ($this->geolocRight) {
             $this->geolocData = $classGeoloc->saveGeolocation('modify', $subscriber->subid);
         }
         $resultsTrigger = $dispatcher->trigger('onAcyUserModify', array($subscriber));
         $action = 'modified';
     }
     if ($this->recordHistory) {
         $historyClass = acymailing_get('class.acyhistory');
         $historyClass->insert($subscriber->subid, $action);
         $this->recordHistory = false;
     }
     if ($this->forceConf || (!$app->isAdmin() and $this->sendConf)) {
         $this->sendConf($subid);
     }
     return $subid;
 }
예제 #4
0
 function replaceSubscriptionTag(&$allresults, $i, &$user, &$email)
 {
     if (empty($user->subid)) {
         return '';
     }
     if (empty($user->key)) {
         $user->key = acymailing_generateKey(14);
         $db = JFactory::getDBO();
         $db->setQuery('UPDATE ' . acymailing_table('subscriber') . ' SET `key`= ' . $db->Quote($user->key) . ' WHERE subid = ' . (int) $user->subid . ' LIMIT 1');
         $db->query();
     }
     $config = acymailing_config();
     $itemId = $config->get('itemid', 0);
     $item = empty($itemId) ? '' : '&Itemid=' . $itemId;
     $lang = empty($email->language) ? '' : '&lang=' . $email->language;
     if ($allresults[1][$i] == 'confirm') {
         //confirm your subscription link
         $itemId = $this->params->get('confirmitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=confirm&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('confirmtemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a target="_blank" href="' . $myLink . '">' . $allresults[2][$i] . '</a>';
     } elseif ($allresults[1][$i] == 'modify') {
         //modify your subscription link
         $itemId = $this->params->get('modifyitemid', 0);
         if (!empty($itemId)) {
             $item = '&Itemid=' . $itemId;
         }
         $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=modify&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('modifytemplate', false));
         if (empty($allresults[2][$i])) {
             return $myLink;
         }
         return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
     }
     //unsubscribe link
     $itemId = $this->params->get('unsubscribeitemid', 0);
     if (!empty($itemId)) {
         $item = '&Itemid=' . $itemId;
     }
     $myLink = acymailing_frontendLink('index.php?subid=' . $user->subid . '&option=com_acymailing&ctrl=user&task=out&mailid=' . $email->mailid . '&key=' . urlencode($user->key) . $item . $lang, (bool) $this->params->get('unsubscribetemplate', false));
     if (!$this->listunsubscribe && $this->params->get('listunsubscribe', 0) && method_exists($email, 'addCustomHeader')) {
         $this->listunsubscribe = true;
         $mailto = $this->params->get('listunsubscribeemail');
         if (empty($mailto)) {
             $mailto = @$email->replyemail;
         }
         if (empty($mailto)) {
             $mailto = $config->get('reply_email');
         }
         $email->addCustomHeader('List-Unsubscribe: <' . $myLink . '>, <mailto:' . $mailto . '?subject=unsubscribe_user_' . $user->subid . '&body=Please%20unsubscribe%20user%20ID%20' . $user->subid . '>');
     }
     if (empty($allresults[2][$i])) {
         return $myLink;
     }
     return '<a style="text-decoration:none;" target="_blank" href="' . $myLink . '"><span class="acymailing_unsub">' . $allresults[2][$i] . '</span></a>';
 }
예제 #5
0
 public function sendOne($mailid, $receiverid)
 {
     $this->clearAll();
     if (!isset($this->defaultMail[$mailid])) {
         $this->loadedToSend = true;
         if (!$this->load($mailid)) {
             $this->reportMessage = 'Can not load the e-mail : ' . htmlspecialchars($mailid, ENT_COMPAT, 'UTF-8');
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             $this->errorNumber = 2;
             return false;
         }
     }
     if (!isset($this->forceVersion) and $this->checkPublished and empty($this->defaultMail[$mailid]->published)) {
         $this->reportMessage = JText::sprintf('SEND_ERROR_PUBLISHED', htmlspecialchars($mailid, ENT_COMPAT, 'UTF-8'));
         $this->errorNumber = 3;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
         return false;
     }
     if (!is_object($receiverid)) {
         $receiver = $this->subscriberClass->get($receiverid);
         if (empty($receiver->subid) and is_string($receiverid) and $this->autoAddUser) {
             if ($this->userHelper->validEmail($receiverid)) {
                 $newUser = new stdClass();
                 $newUser->email = $receiverid;
                 $this->subscriberClass->checkVisitor = false;
                 $this->subscriberClass->sendConf = false;
                 $subid = $this->subscriberClass->save($newUser);
                 $receiver = $this->subscriberClass->get($subid);
             }
         }
     } else {
         $receiver = $receiverid;
     }
     if (empty($receiver->email)) {
         $this->reportMessage = JText::sprintf('SEND_ERROR_USER', '<b><i>' . (isset($receiver->subid) ? $receiver->subid : htmlspecialchars($receiverid, ENT_COMPAT, 'UTF-8')) . '</i></b>');
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
         $this->errorNumber = 4;
         return false;
     }
     $this->MessageID = "<" . preg_replace("|[^a-z0-9+_]|i", '', base64_encode(rand(0, 9999999)) . "AC" . $receiver->subid . "Y" . $this->defaultMail[$mailid]->mailid . "BA" . base64_encode(time() . rand(0, 99999))) . "@" . $this->ServerHostname() . ">";
     if (strpos($this->Host, 'mailjet') !== false && !empty($this->defaultMail[$mailid]->alias)) {
         $this->addCustomHeader('X-Mailjet-Campaign: ' . $this->defaultMail[$mailid]->alias);
     }
     if (!isset($this->forceVersion)) {
         if ($this->checkConfirmField and empty($receiver->confirmed) and $this->config->get('require_confirmation', 0) and strpos($this->defaultMail[$mailid]->alias, 'confirm') === false) {
             $this->reportMessage = JText::sprintf('SEND_ERROR_CONFIRMED', '<b><i>' . htmlspecialchars($receiver->email, ENT_COMPAT, 'UTF-8') . '</i></b>');
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             $this->errorNumber = 5;
             return false;
         }
         if ($this->checkEnabled and empty($receiver->enabled) and strpos($this->defaultMail[$mailid]->alias, 'enable') === false) {
             $this->reportMessage = JText::sprintf('SEND_ERROR_APPROVED', '<b><i>' . htmlspecialchars($receiver->email, ENT_COMPAT, 'UTF-8') . '</i></b>');
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             $this->errorNumber = 6;
             return false;
         }
     }
     if ($this->checkAccept and empty($receiver->accept)) {
         $this->reportMessage = JText::sprintf('SEND_ERROR_ACCEPT', '<b><i>' . htmlspecialchars($receiver->email, ENT_COMPAT, 'UTF-8') . '</i></b>');
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
         $this->errorNumber = 7;
         return false;
     }
     $addedName = $this->config->get('add_names', true) ? $this->cleanText($receiver->name) : '';
     $this->AddAddress($this->cleanText($receiver->email), $addedName);
     if (!isset($this->forceVersion)) {
         $this->IsHTML($receiver->html && $this->defaultMail[$mailid]->html);
     } else {
         $this->IsHTML((bool) $this->forceVersion);
     }
     $this->Subject = $this->defaultMail[$mailid]->subject;
     if ($this->sendHTML) {
         $this->Body = $this->defaultMail[$mailid]->body;
         if ($this->config->get('multiple_part', false)) {
             $this->AltBody = $this->defaultMail[$mailid]->altbody;
         }
     } else {
         $this->Body = $this->defaultMail[$mailid]->altbody;
     }
     $this->setFrom($this->defaultMail[$mailid]->fromemail, $this->defaultMail[$mailid]->fromname);
     $this->_addReplyTo($this->defaultMail[$mailid]->replyemail, $this->defaultMail[$mailid]->replyname);
     if (!empty($this->defaultMail[$mailid]->attachments)) {
         if ($this->config->get('embed_files')) {
             foreach ($this->defaultMail[$mailid]->attachments as $attachment) {
                 $this->AddAttachment($attachment->filename);
             }
         } else {
             $attachStringHTML = '<br /><fieldset><legend>' . JText::_('ATTACHMENTS') . '</legend><table>';
             $attachStringText = "\n" . "\n" . '------- ' . JText::_('ATTACHMENTS') . ' -------';
             foreach ($this->defaultMail[$mailid]->attachments as $attachment) {
                 $attachStringHTML .= '<tr><td><a href="' . $attachment->url . '" target="_blank">' . $attachment->name . '</a></td></tr>';
                 $attachStringText .= "\n" . '-- ' . $attachment->name . ' ( ' . $attachment->url . ' )';
             }
             $attachStringHTML .= '</table></fieldset>';
             if ($this->sendHTML) {
                 $this->Body .= $attachStringHTML;
                 if (!empty($this->AltBody)) {
                     $this->AltBody .= "\n" . $attachStringText;
                 }
             } else {
                 $this->Body .= $attachStringText;
             }
         }
     }
     if (!empty($this->parameters)) {
         $this->generateAllParams();
         $keysparams = array_keys($this->parameters);
         $this->Subject = str_replace($keysparams, $this->parameters, $this->Subject);
         $this->Body = str_replace($keysparams, $this->parameters, $this->Body);
         if (!empty($this->AltBody)) {
             $this->AltBody = str_replace($keysparams, $this->parameters, $this->AltBody);
         }
         if (!empty($this->From)) {
             str_replace($keysparams, $this->parameters, $this->From);
         }
         if (!empty($this->FromName)) {
             str_replace($keysparams, $this->parameters, $this->FromName);
         }
         if (!empty($this->ReplyTo)) {
             foreach ($this->ReplyTo as $i => $replyto) {
                 foreach ($replyto as $a => $oneval) {
                     $this->ReplyTo[$i][$a] = str_replace($keysparams, $this->parameters, $this->ReplyTo[$i][$a]);
                 }
             }
         }
     }
     if (!empty($this->introtext)) {
         $this->Body = $this->introtext . $this->Body;
         $this->AltBody = $this->textVersion($this->introtext) . $this->AltBody;
     }
     $this->body =& $this->Body;
     $this->altbody =& $this->AltBody;
     $this->subject =& $this->Subject;
     $this->from =& $this->From;
     $this->fromName =& $this->FromName;
     $this->replyto =& $this->ReplyTo;
     $this->replyname = $this->defaultMail[$mailid]->replyname;
     $this->replyemail = $this->defaultMail[$mailid]->replyemail;
     $this->mailid = $this->defaultMail[$mailid]->mailid;
     $this->key = $this->defaultMail[$mailid]->key;
     $this->alias = $this->defaultMail[$mailid]->alias;
     $this->type = $this->defaultMail[$mailid]->type;
     $this->tempid = $this->defaultMail[$mailid]->tempid;
     $this->sentby = $this->defaultMail[$mailid]->sentby;
     $this->userid = $this->defaultMail[$mailid]->userid;
     $this->filter = $this->defaultMail[$mailid]->filter;
     $this->template = @$this->defaultMail[$mailid]->template;
     $this->language = @$this->defaultMail[$mailid]->language;
     if (empty($receiver->key) && !empty($receiver->subid)) {
         $receiver->key = acymailing_generateKey(14);
         $db = JFactory::getDBO();
         $db->setQuery('UPDATE ' . acymailing_table('subscriber') . ' SET `key`= ' . $db->Quote($receiver->key) . ' WHERE subid = ' . (int) $receiver->subid . ' LIMIT 1');
         $db->query();
     }
     $this->dispatcher->trigger('acymailing_replaceusertags', array(&$this, &$receiver, true));
     if ($this->sendHTML) {
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->textVersion($this->AltBody, false);
         }
     } else {
         $this->Body = $this->textVersion($this->Body, false);
     }
     $status = $this->send();
     if ($this->trackEmail) {
         $helperQueue = acymailing_get('helper.queue');
         $statsAdd = array();
         $statsAdd[$this->mailid][$status][$this->sendHTML][] = $receiver->subid;
         $helperQueue->statsAdd($statsAdd);
         $this->trackEmail = false;
     }
     return $status;
 }
예제 #6
0
 function addPref()
 {
     $conf = JFactory::getConfig();
     $this->level = ucfirst($this->level);
     $allPref = array();
     $allPref['level'] = $this->level;
     $allPref['version'] = $this->version;
     $allPref['smtp_port'] = '';
     if (ACYMAILING_J30) {
         $allPref['from_name'] = $conf->get('fromname');
         $allPref['from_email'] = $conf->get('mailfrom');
         $allPref['bounce_email'] = $conf->get('mailfrom');
         $allPref['mailer_method'] = $conf->get('mailer');
         $allPref['sendmail_path'] = $conf->get('sendmail');
         $smtpinfos = explode(':', $conf->get('smtphost'));
         $allPref['smtp_port'] = $conf->get('smtpport');
         $allPref['smtp_secured'] = $conf->get('smtpsecure');
         $allPref['smtp_auth'] = $conf->get('smtpauth');
         $allPref['smtp_username'] = $conf->get('smtpuser');
         $allPref['smtp_password'] = $conf->get('smtppass');
     } else {
         $allPref['from_name'] = $conf->getValue('config.fromname');
         $allPref['from_email'] = $conf->getValue('config.mailfrom');
         $allPref['bounce_email'] = $conf->getValue('config.mailfrom');
         $allPref['mailer_method'] = $conf->getValue('config.mailer');
         $allPref['sendmail_path'] = $conf->getValue('config.sendmail');
         $smtpinfos = explode(':', $conf->getValue('config.smtphost'));
         $allPref['smtp_secured'] = $conf->getValue('config.smtpsecure');
         $allPref['smtp_auth'] = $conf->getValue('config.smtpauth');
         $allPref['smtp_username'] = $conf->getValue('config.smtpuser');
         $allPref['smtp_password'] = $conf->getValue('config.smtppass');
     }
     $allPref['reply_name'] = $allPref['from_name'];
     $allPref['reply_email'] = $allPref['from_email'];
     $allPref['cron_sendto'] = $allPref['from_email'];
     $allPref['add_names'] = '1';
     $allPref['encoding_format'] = '8bit';
     $allPref['charset'] = 'UTF-8';
     $allPref['word_wrapping'] = '150';
     $allPref['hostname'] = '';
     $allPref['embed_images'] = '0';
     $allPref['embed_files'] = '1';
     $allPref['editor'] = 'acyeditor';
     $allPref['multiple_part'] = '1';
     $allPref['smtp_host'] = $smtpinfos[0];
     if (isset($smtpinfos[1])) {
         $allPref['smtp_port'] = $smtpinfos[1];
     }
     if (!in_array($allPref['smtp_secured'], array('tls', 'ssl'))) {
         $allPref['smtp_secured'] = '';
     }
     $allPref['queue_nbmail'] = '40';
     $allPref['queue_nbmail_auto'] = '70';
     $allPref['queue_type'] = 'auto';
     $allPref['queue_try'] = '3';
     $allPref['queue_pause'] = '120';
     $allPref['allow_visitor'] = '1';
     $allPref['require_confirmation'] = '0';
     $allPref['priority_newsletter'] = '3';
     $allPref['allowedfiles'] = 'zip,doc,docx,pdf,xls,txt,gzip,rar,jpg,jpeg,gif,xlsx,pps,csv,bmp,ico,odg,odp,ods,odt,png,ppt,swf,xcf,mp3,wma';
     $allPref['uploadfolder'] = 'media/com_acymailing/upload';
     $allPref['confirm_redirect'] = '';
     $allPref['subscription_message'] = '1';
     $allPref['notification_unsuball'] = '';
     $allPref['cron_next'] = '1251990901';
     $allPref['confirmation_message'] = '1';
     $allPref['welcome_message'] = '1';
     $allPref['unsub_message'] = '1';
     $allPref['cron_last'] = '0';
     $allPref['cron_fromip'] = '';
     $allPref['cron_report'] = '';
     $allPref['cron_frequency'] = '900';
     $allPref['cron_sendreport'] = '2';
     $allPref['cron_fullreport'] = '1';
     $allPref['cron_savereport'] = '2';
     $allPref['cron_savepath'] = 'media/com_acymailing/logs/report' . rand(0, 999999999) . '.log';
     $allPref['notification_created'] = '';
     $allPref['notification_accept'] = '';
     $allPref['notification_refuse'] = '';
     $allPref['forward'] = '0';
     $descriptions = array('Joomla!® Newsletter Extension', 'Joomla!® Mailing Extension', 'Joomla!® Newsletter System', 'Joomla!® E-mail Marketing', 'Joomla!® Marketing Campaign');
     $allPref['description_starter'] = $descriptions[rand(0, 4)];
     $allPref['description_essential'] = $descriptions[rand(0, 4)];
     $allPref['description_business'] = $descriptions[rand(0, 4)];
     $allPref['description_enterprise'] = $descriptions[rand(0, 4)];
     $allPref['priority_followup'] = '2';
     $allPref['unsub_redirect'] = '';
     $allPref['use_sef'] = '0';
     $allPref['itemid'] = '0';
     $allPref['css_module'] = 'default';
     $allPref['css_frontend'] = 'default';
     $allPref['css_backend'] = '';
     $allPref['bootstrap_frontend'] = 0;
     $allPref['unsub_reasons'] = serialize(array('UNSUB_SURVEY_FREQUENT', 'UNSUB_SURVEY_RELEVANT'));
     $allPref['security_key'] = acymailing_generateKey(30);
     $app = JFactory::getApplication();
     $allPref['installcomplete'] = '0';
     $allPref['Starter'] = '0';
     $allPref['Essential'] = '1';
     $allPref['Business'] = '2';
     $allPref['Enterprise'] = '3';
     $query = "INSERT IGNORE INTO `#__acymailing_config` (`namekey`,`value`) VALUES ";
     foreach ($allPref as $namekey => $value) {
         $query .= '(' . $this->db->Quote($namekey) . ',' . $this->db->Quote($value) . '),';
     }
     $query = rtrim($query, ',');
     $this->db->setQuery($query);
     try {
         $res = $this->db->query();
     } catch (Exception $e) {
         $res = null;
     }
     if ($res === null) {
         acymailing_display(isset($e) ? $e->getMessage() : substr(strip_tags($this->db->getErrorMsg()), 0, 200) . '...', 'error');
         return false;
     }
     return true;
 }
예제 #7
0
 function _checkData(&$user)
 {
     if (empty($user->created)) {
         $user->created = time();
     } elseif (!is_numeric($user->created)) {
         $user->created = strtotime($user->created);
     }
     if (!isset($user->accept) || strlen($user->accept) == 0) {
         $user->accept = 1;
     }
     if (!isset($user->enabled) || strlen($user->enabled) == 0) {
         $user->enabled = 1;
     }
     if (!isset($user->html) || strlen($user->html) == 0) {
         $user->html = 1;
     }
     if (empty($user->source)) {
         $user->source = 'import';
     }
     if (!empty($user->confirmed_date) && !is_numeric($user->confirmed_date)) {
         $user->confirmed_date = strtotime($user->confirmed_date);
     }
     if (!empty($user->lastclick_date) && !is_numeric($user->lastclick_date)) {
         $user->lastclick_date = strtotime($user->lastclick_date);
     }
     if (!empty($user->lastopen_date) && !is_numeric($user->lastopen_date)) {
         $user->lastopen_date = strtotime($user->lastopen_date);
     }
     if (!empty($user->lastsent_date) && !is_numeric($user->lastsent_date)) {
         $user->lastsent_date = strtotime($user->lastsent_date);
     }
     if (empty($user->name) and $this->generatename) {
         $user->name = ucwords(trim(str_replace(array('.', '_', '-', 1, 2, 3, 4, 5, 6, 7, 8, 9, 0), ' ', substr($user->email, 0, strpos($user->email, '@')))));
     }
     if (!isset($user->confirmed) || strlen($user->confirmed) == 0 and $this->forceconfirm) {
         $user->confirmed = 1;
     }
     if (empty($user->key)) {
         $user->key = acymailing_generateKey(14);
     }
 }
예제 #8
0
파일: security.php 프로젝트: utopszkij/lmp
			<tr>
				<td colspan="2">
					<table class="admintable" cellspacing="1">
						<tr>
							<td class="key">
								<?php echo acymailing_tooltip(JText::_('CAPTCHA_CHARS_DESC'), JText::_('CAPTCHA_CHARS'), '', JText::_('CAPTCHA_CHARS')); ?>
							</td>
							<td>
								<input class="inputbox" type="text" name="config[captcha_chars]" style="width:450px" value="<?php echo $this->escape($this->config->get('captcha_chars','abcdefghijkmnpqrstwxyz23456798ABCDEFGHJKLMNPRSTUVWXYZ')); ?>" />
							</td>
						</tr>
						<tr>
							<td class="key">
								<?php $secKey = $this->config->get('security_key');
								if(empty($secKey)){
									$secKey = acymailing_generateKey(30);
								}
								echo acymailing_tooltip(JText::sprintf('SECURITY_KEY_DESC','index.php?option=com_acymailing&ctrl=sub&task=optin&seckey='.$secKey), JText::_('SECURITY_KEY'), '', JText::_('SECURITY_KEY')); ?>
							</td>
							<td>
								<input class="inputbox" type="text" name="config[security_key]" style="width:300px" value="<?php echo $this->escape($secKey); ?>" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td width="50%">
					<fieldset class="adminform">
						<legend><?php echo JText::_('MODULE_VIEW'); ?></legend>
						<table class="admintable" cellspacing="1">