Пример #1
0
 function M($type, $message)
 {
     if (class_exists('acajoom')) {
         return acajoom::printM($type, $message);
     } else {
         switch ($type) {
             case 'no':
                 $colored_message = '<img  hspace="15" align="absmiddle" alt="no" src="' . $GLOBALS['mosConfig_live_site'] . '/administrator/components/com_acajoom/images/button_cancel.gif"><span style=" font-size: larger; color: rgb(255, 0, 0); font-weight: bold;">' . $message . '</span>';
                 break;
             case 'green':
                 $colored_message = '<span style="font-weight: bold; color:#07C500;">' . $message . '</span>';
                 break;
             case 'red':
                 $colored_message = '<span style="font-weight: bold; color:#FF0000;">' . $message . '</span>';
                 break;
             default:
                 $colored_message = '';
                 break;
         }
         return $colored_message . "\n\r";
     }
 }
Пример #2
0
function installBots15()
{
    $database =& JFactory::getDBO();
    $error = '';
    $return = '<b>' . _ACA_INSTALL_BOT . '</b> : ';
    if (!is_dir(ACA_JPATH_ROOT . '/plugins/acajoom')) {
        if (!@mkdir(ACA_JPATH_ROOT . '/plugins/acajoom', 0755)) {
            $return .= '<br /> Error adding bot directory.';
        } else {
            @chmod(ACA_JPATH_ROOT . '/plugins/acajoom', 0755);
        }
    }
    $bot_files = array('acajoombot.php', 'acajoombot.xml', 'index.html');
    foreach ($bot_files as $bot_file) {
        if (is_file(ACA_JPATH_ROOT . '/plugins/acajoom/' . $bot_file)) {
            @unlink(WPATH_ADMIN . 'bots15/' . $bot_file);
        } else {
            if (!@rename(WPATH_ADMIN . 'bots15/' . $bot_file, ACA_JPATH_ROOT . '/plugins/acajoom/' . $bot_file)) {
                $error .= '<br />Error copying bot file ' . $bot_file . ' to bot directory.';
            }
        }
    }
    @chmod(ACA_JPATH_ROOT . '/plugins/acajoom', 0755);
    if (!@rmdir(WPATH_ADMIN . 'bots15/')) {
        $error .= '<br /> Error deleting the temporary bot directory.';
    }
    ### Acajoom bot
    $bot_infos = array('Acajoom Content Bot', 'acajoombot');
    foreach ($bot_infos as $bot_info) {
        $query = "SELECT `id` FROM `#__plugins` WHERE `element` = 'acajoombot'";
        $database->setQuery($query);
        $database->query();
        $errorDB = $database->getErrorMsg();
        if (!empty($errorDB)) {
            $error .= '<br /> Error getting bot information from bot table for "' . $bot_info[0] . '". Database error: <br />' . $errorDB . '<br />';
        } else {
            $id = $database->loadResult();
            if (!$id) {
                JLoader::register('JTablePlugin', JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'table' . DS . 'plugin.php');
                $row = new JTablePlugin($database);
                $row->name = $bot_infos[0];
                $row->ordering = 0;
                $row->folder = 'acajoom';
                $row->iscore = 0;
                $row->access = 0;
                $row->client_id = 0;
                $row->element = $bot_infos[1];
                $row->published = 1;
                if (!$row->store()) {
                    $error .= '<br />Error adding bot information to bot table for "' . $bot_info[0] . '".';
                }
            }
        }
    }
    if (empty($error)) {
        $return .= acajoom::printM('green', _ACA_INSTALL_SUCCESS) . '<br />';
    } else {
        $return .= $error . acajoom::printM('red', _ACA_INSTALL_ERROR) . '<br />';
    }
    return $return;
}
Пример #3
0
 function updateFile($file, $addFile, $version = '')
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     if (ini_get('allow_url_fopen') == false) {
         if (in_array('curl', get_loaded_extensions())) {
             $globalFile = $this->getFileCurl($this->path . $file, $version);
         } else {
             $erro->W(__LINE__, '8013', _ACA_WARNG_REMOTE_FILE);
             $message = acajoom::printM('warning', _ACA_WARNG_REMOTE_FILE);
             return false;
         }
     } else {
         $globalFile = file_get_contents($GLOBALS[ACA . 'update_url'] . preg_replace('/\\.php$/', '.inc', $this->path . $file));
     }
     if (empty($globalFile)) {
         $erro->W(__LINE__, '8014', _ACA_ERROR_FETCH);
         $message = acajoom::printM('warning', _ACA_ERROR_FETCH);
         return false;
     } else {
         $status = false;
         if (file_exists($GLOBALS['mosConfig_absolute_path'] . DS . $file)) {
             if (@copy($GLOBALS['mosConfig_absolute_path'] . DS . $file, WPATH_ADMIN . 'backup/' . acajoom::version(true) . DS . $file)) {
                 $status = file_put_contents($GLOBALS['mosConfig_absolute_path'] . DS . $file, $globalFile);
             } else {
                 echo acajoom::printM('red', _ACA_BACKUP_FAILED) . '<br />';
             }
         } else {
             if ($addFile) {
                 $status = file_put_contents($GLOBALS['mosConfig_absolute_path'] . DS . $file, $globalFile);
             }
         }
         return $status;
     }
 }
Пример #4
0
     break;
 case 'subscribe':
     $userid = intval(mosGetParam($_REQUEST, 'userid', 0));
     if ($userid > 0) {
         global $database;
         $query = 'SELECT * FROM `#__users` WHERE `id` = \'' . $userid . '\'';
         $database->setQuery($query);
         $database->loadObject($user);
         if (!empty($user)) {
             $name = $user->name;
             $email = $user->email;
         } else {
             break;
         }
     } elseif (!subscribers::validEmail($email)) {
         echo '<br />' . acajoom::printM('red', _ACA_EMAIL_INVALID);
         echo "<script>alert('" . addslashes(_ACA_EMAIL_INVALID) . "'); window.history.go(-1);</script>\n";
         break;
     }
     if ($userid > 0) {
         $message = frontEnd::newSubscriber($name, $email, true);
     } else {
         $message = frontEnd::newSubscriber($name, $email);
     }
     if ($GLOBALS[ACA . 'addEmailRedLink']) {
         if (preg_match('?', $redirectlink)) {
             $redirectlink .= '&email=' . $email;
         } else {
             $redirectlink .= '?email=' . $email;
         }
     }
Пример #5
0
 function mailingEdit($subscriberId, $mailingId, $listId, $listType, $action)
 {
     global $my, $Itemid;
     if (ACA_CMSTYPE) {
         // joomla 15
         $issue_nb = JRequest::getVar('issue_nb', '0');
         $my =& JFactory::getUser();
     } else {
         //joomla 1x
         $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 0));
         global $my;
     }
     //endif
     $accessGrant = false;
     $new = 0;
     if (class_exists('pro')) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if ($listId > 0) {
             $list = lists::getOneList($listId);
             $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
             $acc_level = $list->acc_level;
         } else {
             return false;
         }
         if (acajoom::checkPermissions('hello', 0, $acc_level)) {
             $accessGrant = true;
         }
     } else {
         if ($subscriberId != 0 and ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator')) {
             $accessGrant = true;
         }
     }
     if ($accessGrant) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if (empty($mailing)) {
             if ($mailingId > 0) {
                 $mailing = xmailing::getOneMailing('', $mailingId, $issue_nb, $new);
             } else {
                 if ($listId > 0) {
                     $list = lists::getOneList($listId);
                     $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
                 } else {
                     return false;
                 }
             }
         }
         $mainLink = '.php?option=com_acajoom&act=savemailing';
         compa::completeLink($mainLink, false);
         $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" >' . "\n\r";
         $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
         $show = lisType::showType($mailing->list_type, 'editmailing');
         frontHTML::formStart(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $mailing->html, 'edit_mailing');
         mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
         $go[] = acajoom::makeObj('act', $action);
         frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $go);
     } else {
         echo acajoom::printM('red', _NOT_AUTH);
     }
     return true;
 }
Пример #6
0
 function _upgrade()
 {
     $config['news1'] = false;
     $config['news2'] = false;
     $config['news3'] = false;
     $exist = acajoom::checkExisting();
     if (!empty($exist['news1'])) {
         $config['news1'] = true;
     }
     if (!empty($exist['news2'])) {
         $config['news2'] = true;
     }
     if (!empty($exist['news3'])) {
         $config['news3'] = true;
     }
     $mess = '';
     if ($config['news1'] or $config['news2'] or $config['news3']) {
         $mess = acajoom::printM('blue', _ACA_UPGRADE_MESS) . '<br />';
     }
     if ($config['news1']) {
         $mess .= '<a href="index2.php?option=com_acajoom&act=update&task=new1">';
         $mess .= acajoom::printM('ok', _ACA_UPGRADE_FROM . 'Anjel');
         $mess .= '</a><br />';
     }
     if ($config['news2']) {
         $mess .= '<a href="index2.php?option=com_acajoom&act=update&task=new2">';
         $mess .= acajoom::printM('ok', _ACA_UPGRADE_FROM . 'Letterman');
         $mess .= '</a><br />';
     }
     if ($config['news3']) {
         $mess .= '<a href="index2.php?option=com_acajoom&act=update&task=new3">';
         $mess .= acajoom::printM('ok', _ACA_UPGRADE_FROM . 'YaNC');
         $mess .= '</a><br />';
     }
     echo $mess;
 }
Пример #7
0
    function create()
    {
        global $my, $mainframe;
        $Itemid = $GLOBALS[ACA . 'itemidAca'];
        if (!empty($Itemid)) {
            $item = '&Itemid=' . $Itemid;
        } else {
            $item = '';
        }
        $hidden = '';
        $htmlOK = false;
        $h = '';
        if (!empty($this->lists)) {
            if ($my->id > 0) {
                $loggedin = true;
                $subscriber = subscribers::getSubscriberInfoFromUserId($my->id);
            } else {
                $loggedin = false;
            }
            if (!$loggedin and $GLOBALS[ACA . 'allow_unregistered'] and $this->num == 1) {
                $h .= '
				<script language="javascript" type="text/javascript">
					function submitacajoommod(formname) {
						var form = eval(\'document.\'+formname);' . 'var place = form.email.value.indexOf("@",1);' . 'var point = form.email.value.indexOf(".",place+1);';
                if ($this->shownamefield) {
                    $h .= '
						if (form.name.value == "" || form.name.value == "' . addslashes(_ACA_NAME) . '") {
							alert( "' . addslashes(_ACA_REGWARN_NAME) . '" );' . 'return false;
						} else
				';
                }
                $h .= ' if (form.email.value == "" || form.email.value == "' . addslashes(_ACA_EMAIL) . '") {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false;
						} else {' . 'if ((place > -1)&&(form.email.value.length >2)&&(point > 1)){' . 'form.submit();' . 'return true;
							} ' . 'else {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false;' . '}' . '}' . '}' . '</script>';
            }
            mosCommonHTML::loadOverlib();
            $h .= '<link rel="stylesheet" href="' . $GLOBALS['mosConfig_live_site'] . '/components/com_acajoom/css/acajoom.css" type="text/css" >';
            $linkForm = 'index.php?option=com_acajoom';
            if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) {
                $h .= '<form action="' . sefRelToAbs($linkForm) . '" method="post" name="modacajoomForm' . $this->num . '">
			<div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">';
            } else {
                $h .= '<form action="' . $linkForm . '" method="post" name="modacajoomForm' . $this->num . '">
			<div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">';
            }
            if (!empty($this->introtext)) {
                $text = '<span class="pretext' . $this->moduleclass_sfx . '">' . $this->introtext . '</span>';
                $h .= acajoom::printLine($this->linear, $text);
            }
            $i = 0;
            $accessLevel = 0;
            if ($loggedin) {
                $queues = queue::getSubscriberLists($subscriber->id);
            } else {
                $queues = '';
            }
            if ($this->showListName) {
                foreach ($this->lists as $list) {
                    $i++;
                    $subscribed = 0;
                    $accessLevel = 0;
                    if ($loggedin) {
                        if (!empty($queues)) {
                            foreach ($queues as $queue) {
                                if ($list->id == $queue->list_id) {
                                    $subscribed = 1;
                                    $accessLevel = $queue->acc_level;
                                }
                            }
                        }
                    }
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                    $checked = 0;
                    if ($loggedin) {
                        $checked = $subscribed;
                    } else {
                        if ($this->defaultchecked) {
                            $checked = 1;
                        }
                        $subscriber->blacklist = 0;
                    }
                    if ($checked != 0) {
                        $checkedPrint = ' checked="checked" ';
                    } else {
                        $checkedPrint = '';
                    }
                    if ($list->hidden == 1) {
                        if ($subscriber->blacklist == 0) {
                            $text = "\n" . '<input id="wz_3' . $i . '" type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" ' . $checkedPrint . ' />';
                        } else {
                            $text = "\n" . '<input type="checkbox" class="inputbox" value="1" name="subscribedfake[' . $i . ']" ' . $checkedPrint . '  />';
                            $text .= "\n" . '<input type="hidden" value="0" name="subscribed[' . $i . ']"  />';
                        }
                        $text .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                        $link = ($list->list_type == '1' or $list->list_type == '7') && $GLOBALS[ACA . 'show_archive'] ? 'index.php?option=com_acajoom' . $item . '&act=mailing&task=archive&listid=' . $list->id . '&listype=' . $list->list_type : '#';
                        $text .= "\n" . '<span class="aca_list_name"';
                        if ($link == "#") {
                            $text .= " onClick='return false;' ";
                        }
                        $text .= '>' . compa::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1) . '</span>';
                        $h .= acajoom::printLine($this->linear, $text);
                        $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />' . "\n\r";
                    } else {
                        if (!$loggedin) {
                            $h .= '<input type="hidden"  value="' . $checked . '" name="subscribed[' . $i . ']" />';
                            $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                        }
                    }
                }
            } else {
                foreach ($this->lists as $list) {
                    $i++;
                    $subscribed = 0;
                    $accessLevel = 0;
                    if ($loggedin) {
                        if (!empty($queues)) {
                            foreach ($queues as $queue) {
                                if ($list->id == $queue->list_id) {
                                    $subscribed = 1;
                                    $accessLevel = $queue->acc_level;
                                }
                            }
                        }
                    }
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                    $checked = 0;
                    if ($loggedin) {
                        $checked = $subscribed;
                    } else {
                        if ($this->defaultchecked) {
                            $checked = 1;
                        }
                    }
                    $h .= '<input type="hidden"  value="' . $checked . '" name="subscribed[' . $i . ']" />';
                    $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />';
                    $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />';
                    if ($list->html == 1) {
                        $htmlOK = true;
                    }
                }
            }
            if (!$loggedin) {
                if ($GLOBALS[ACA . 'allow_unregistered']) {
                    if ($this->shownamefield) {
                        $text = '<input id="wz_11" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_NAME) . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_NAME) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_NAME) . '\') this.value=\'\' ; " />';
                        $h .= acajoom::printLine($this->linear, $text);
                    } else {
                        $text = '<input id="wz_11" type="hidden" value="" name="name" />';
                    }
                    $text = '<input id="wz_12" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_EMAIL) . '" class="inputbox" name="email" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_EMAIL) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_EMAIL) . '\') this.value=\'\' ; " />';
                    $h .= acajoom::printLine($this->linear, $text);
                } else {
                    $h .= acajoom::printLine($this->linear, acajoom::printM('green', _ACA_REGISTER_REQUIRED));
                    $text = _NO_ACCOUNT . " ";
                    if (isset($GLOBALS[ACA . 'cb_integration']) && $GLOBALS[ACA . 'cb_integration']) {
                        $linkme = 'index.php?option=com_comprofiler&amp;task=registers';
                    } else {
                        $linkme = 'index.php?option=com_registration&amp;task=register';
                    }
                    if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) {
                        $text .= '<a href="' . sefRelToAbs($linkme) . '">';
                    } else {
                        $text .= '<a href="' . $linkme . '">';
                    }
                    $text .= _CREATE_ACCOUNT . "</a>";
                    $h .= acajoom::printLine($this->linear, $text);
                    $htmlOK = false;
                }
            }
            if ($htmlOK) {
                if ($loggedin and !empty($subscriber)) {
                    $checked = $subscriber->receive_html;
                } else {
                    $checked = $this->receivehtmldefault;
                }
                if ($this->showreceivehtml) {
                    if ($checked != 0) {
                        $checkedPrint = ' checked="checked" ';
                    } else {
                        $checkedPrint = '';
                    }
                    $text = '<input id="wz_2" type="checkbox" class="inputbox" value="1" name="receive_html" ' . $checkedPrint . ' />';
                    $text .= ' ' . _ACA_RECEIVE_HTML;
                    $h .= acajoom::printLine($this->linear, $text);
                } else {
                    $hidden .= '<input id="wz_2" type="hidden" value="' . $checked . '" name="receive_html" />' . "\n";
                }
            } else {
                $hidden .= '<input id="wz_2" type="hidden" value="0" name="receive_html" />' . "\n";
            }
            if (!empty($this->posttext)) {
                $text = '<span class="postext' . $this->moduleclass_sfx . '">' . $this->posttext . '</span>';
                $h .= acajoom::printLine($this->linear, $text);
            }
            if (!$loggedin) {
                if ($GLOBALS[ACA . 'allow_unregistered']) {
                    if (isset($this->imgUnregistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    } else {
                        $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="subscribe" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                } else {
                    $h .= '</div>';
                }
            } else {
                if (isset($this->notifType) and $subscribed) {
                    if (isset($this->imgUnregistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    } else {
                        $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="subscribe" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                } else {
                    if (isset($this->imgRegistered)) {
                        $text = '<input id="aca_22" type="image" src="' . $this->imgRegistered . '" value="' . $this->buttonRegistered . '" alt="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '">';
                    } else {
                        $text = '<input id="aca_22"  type="submit" value="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '" class="button" />';
                    }
                    $h .= acajoom::printLine($this->linear, $text);
                    $h .= '
					</div>
						<input type="hidden" name="act" value="updatesubscription" />
						<input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" />
						<input type="hidden" name="listname" value="' . $this->showListName . '" />
					';
                }
            }
            $h .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
            $h .= $hidden . '</form>';
        } else {
            $h .= acajoom::printM('blue', _ACA_LIST_NOT_AVAIL);
        }
        $this->_content = $h;
        return $h;
    }
Пример #8
0
 function insert_subs_to_mailing($list_id, $mailing_id, $send_date, $acc_level)
 {
     if (ACA_CMSTYPE) {
         $database =& JFactory::getDBO();
     } else {
         global $database;
     }
     //endif
     $query = 'INSERT IGNORE INTO `#__acajoom_queue` (`type`, `subscriber_id`, `list_id`, `mailing_id`, `issue_nb`, `send_date`, `acc_level`, `published`) ';
     $query .= 'SELECT `q`.`type`, `q`.`subscriber_id`, `q`.`list_id`, ' . intval($mailing_id) . ', 0, \'' . $send_date . '\', ' . $acc_level . ', 2 ';
     $query .= 'FROM `#__acajoom_queue` `q`, `#__acajoom_subscribers` `s` ';
     $query .= 'WHERE `q`.`list_id` = ' . intval($list_id) . ' ';
     $query .= 'AND `q`.`subscriber_id` = `s`.`id` AND `s`.`blacklist` = 0 AND `s`.`confirmed` = 1 ';
     $database->setQuery($query);
     $database->query();
     $database->setQuery('SELECT COUNT(*) FROM `#__acajoom_queue` WHERE `mailing_id` = ' . intval($mailing_id));
     $number = $database->loadResult();
     $gmtTime = strtotime($send_date);
     $gmtDate = date('Y-m-d H:i:s', $gmtTime - ACA_TIME_OFFSET * 60 * 60);
     echo acajoom::printM('blue', $number . ' e-mails are in the queue for the mailing ID' . intval($mailing_id) . ' and will be sent at ' . $send_date . ' (' . $gmtDate . ' GMT )');
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     $erro->err = $database->getErrorMsg();
     return $erro->E(__LINE__, '8534', $database);
 }
Пример #9
0
 function upgrade_News3()
 {
     global $my, $database;
     $xf = new xonfig();
     $newLists = array();
     $idImportedList = array();
     $i = 0;
     $database->setQuery("SELECT * FROM #__newsletter_letters");
     $newsletters = $database->loadObjectList();
     $error = $database->getErrorMsg();
     if (!empty($error)) {
         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>';
         return false;
     } else {
         foreach ($newsletters as $newsletter) {
             $list->list_name = $newsletter->list_name;
             $list->list_desc = $newsletter->list_desc;
             $list->sendername = $newsletter->sendername;
             $list->senderemail = $newsletter->senderemail;
             $list->bounceadres = $newsletter->bounceadres;
             $list->layout = $newsletter->layout;
             $list->template = 0;
             $list->subscribemessage = $newsletter->subscribemessage;
             $list->unsubscribemessage = $newsletter->unsubscribemessage;
             $list->html = $newsletter->html;
             $list->hidden = !$newsletter->hidden;
             $list->unsubscribesend = 1;
             $list->list_type = '1';
             $list->auto_add = 0;
             $list->user_choose = 0;
             $list->cat_id = 0;
             $list->delay_min = 0;
             $list->delay_max = 0;
             $list->follow_up = 0;
             $list->owner = $my->id;
             $list->auto_add = 0;
             $list->acc_level = $newsletter->aid;
             $list->acc_id = 29;
             $list->published = 1;
             $list->createdate = acajoom::getNow();
             $list->footer = 1;
             $list->notify_id = 0;
             $list->notification = 0;
             $query = 'INSERT INTO `#__acajoom_lists` (`list_name`) VALUES (\'' . $list->list_name . '\'  )';
             $database->setQuery($query);
             $database->query();
             $error = $database->getErrorMsg();
             if (!empty($error)) {
                 echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use?    The list name has to be different for each list! <br /><br />';
             } else {
                 $query = 'SELECT * FROM `#__acajoom_lists` WHERE `list_name`= \'' . $list->list_name . '\'';
                 $database->setQuery($query);
                 $database->loadObject($mynewlist);
                 $error = $database->getErrorMsg();
                 $xf->plus('totallist0', 1);
                 $xf->plus('act_totallist0', 1);
                 $xf->plus('totallist1', 1);
                 $xf->plus('act_totallist1', 1);
                 if (!empty($error)) {
                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>';
                     return false;
                 } else {
                     $idImportedList[$newsletter->id] = $mynewlist->id;
                     $newLists[$i] = $mynewlist->id;
                     $i++;
                     $list->id = $mynewlist->id;
                     $error = lists::updateListData($list);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>';
                     } else {
                         echo '<br /><b>' . @constant($GLOBALS[ACA . 'listnames1']) . ': </b>' . $list->list_name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $database->setQuery("SELECT * FROM #__newsletter_mailing WHERE `list_id`=" . $newsletter->id);
                         $mailingsImports = $database->loadObjectList();
                         $error = $database->getErrorMsg();
                         if (!empty($error)) {
                             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>';
                             return false;
                         } else {
                             $issue_nb = 1;
                             foreach ($mailingsImports as $mailingsImport) {
                                 $mailings->list_id = $mynewlist->id;
                                 $mailings->list_type = '1';
                                 $mailings->send_date = $mailingsImport->send_date;
                                 $mailings->subject = $mailingsImport->subject;
                                 $mailings->htmlcontent = $mailingsImport->htmlcontent;
                                 $mailings->textonly = $mailingsImport->textonly;
                                 $mailings->attachments = $mailingsImport->attachments;
                                 $mailings->images = $mailingsImport->images;
                                 $mailings->published = $mailingsImport->published;
                                 $mailings->visible = $mailingsImport->visible;
                                 $mailings->html = $mynewlist->html;
                                 $mailings->fromname = $list->sendername;
                                 $mailings->fromemail = $list->senderemail;
                                 $mailings->frombounce = $list->bounceadres;
                                 $mailings->author_id = $my->id;
                                 $mailings->delay = 0;
                                 $mailings->issue_nb = $issue_nb;
                                 $mailings->acc_level = 25;
                                 $mailings->createdate = $list->createdate;
                                 $issue_nb++;
                                 $error = xmailing::insertMailingData($mailings);
                                 if (!$error) {
                                     echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>';
                                 } else {
                                     echo '<br /><b>' . _ACA_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $database->setQuery("SELECT * FROM #__newsletter_subscribers");
         $subscribers = $database->loadObjectList();
         $error = $database->getErrorMsg();
         if (!empty($error)) {
             echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>';
             return false;
         } else {
             foreach ($subscribers as $subscriber) {
                 $newSubs = true;
                 $acajoomsubscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', '');
                 foreach ($acajoomsubscribers as $acajoomsubscriber) {
                     if ($subscriber->subscriber_email == $acajoomsubscriber->email) {
                         $newSubs = false;
                         $subId[0] = $acajoomsubscriber->id;
                     }
                 }
                 if ($newSubs) {
                     $newSubscriber->user_id = $subscriber->userid;
                     $newSubscriber->name = $subscriber->subscriber_name;
                     $newSubscriber->email = $subscriber->subscriber_email;
                     $newSubscriber->receive_html = $subscriber->receive_html;
                     $newSubscriber->confirmed = $subscriber->confirmed;
                     $newSubscriber->subscribe_date = $subscriber->subscribe_date;
                     $newSubscriber->blacklist = 0;
                     $newSubscriber->timezone = '00:00:00';
                     $newSubscriber->language_iso = 'eng';
                     $newSubscriber->params = '';
                     $error = subscribers::insertSubscriber($newSubscriber, $subscriberId);
                     if (!empty($error)) {
                         if ($subscriberId < 1) {
                             echo ' Error inserting subscriber:' . $newSubscriber->name;
                         }
                         $error = '';
                         $subId[0] = $subscriberId;
                     } else {
                         echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS);
                         $d['email'] = $subscriber->email;
                         $erro->ck = subscribers::getSubscriberIdFromEmail($d);
                         $erro->Eck(__LINE__, '8304');
                         $subId[0] = $d['subscriberId'];
                     }
                 } else {
                     echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . acajoom::printM('red', _ACA_IMPORT_EXIST);
                 }
                 $j = 0;
                 $queue = queue::suscriptionExist($subId[0], $idImportedList[$subscriber->list_id]);
                 if (empty($queue)) {
                     $error = queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29);
                     if (!$error) {
                         echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>';
                     }
                 }
             }
         }
     }
     return true;
 }
Пример #10
0
 function updateOneSuscription($subscriberId)
 {
     global $acl, $database;
     $queue = '';
     $queue->user_id = $subscriberId;
     $listId = mosGetParam($_REQUEST, 'listid', 0);
     if (!empty($listId)) {
         $accessName = '';
         $userid = intval(mosGetParam($_REQUEST, 'userid', 0));
         $query = "SELECT usertype " . "\n FROM #__users" . "\n WHERE id = " . (int) $userid;
         $database->setQuery($query);
         $accessName = $database->loadResult();
         //$accessName = strtolower(mosGetParam($_REQUEST, 'access', 'Public Frontend'));
         $groupId = $acl->get_group_id($accessName, 'ARO');
         if (empty($groupId)) {
             $groupId = 29;
         }
         $idslists = explode(",", $listId);
         foreach ($idslists as $i => $listId) {
             $listId = intval($listId);
             if ($listId <= 0) {
                 break;
             }
             $list = lists::getOneList($listId);
             if (empty($list)) {
                 echo acajoom::printM('red', 'List not defined');
                 return false;
             }
             $ex_groups = $acl->get_group_children($list->acc_id, 'ARO', 'RECURSE');
             $ex_groups[] = $list->acc_id;
             $gidAdmin = $acl->get_group_id('Public Backend', 'ARO');
             if (!in_array($gidAdmin, $ex_groups)) {
                 $ex_groups2 = $acl->get_group_children($gidAdmin, 'ARO', 'RECURSE');
                 $ex_groups2[] = $gidAdmin;
                 $ex_groups = array_merge($ex_groups, $ex_groups2);
             }
             if (!in_array($groupId, $ex_groups)) {
                 echo acajoom::printM('red', ACA_NO_LIST_PERM);
                 return false;
             }
             $queue->sub_list_id[$i] = $listId;
             $queue->subscribed[$i] = 1;
             $queue->acc_level[$i] = $list->acc_id;
         }
     } else {
         $queue->sub_list_id = mosGetParam($_REQUEST, 'sub_list_id', '');
         $queue->subscribed = mosGetParam($_REQUEST, 'subscribed', 0);
         if ($queue->subscribed == 0) {
             /*$queue->subscribed = $queue->sub_list_id;
             		for($i=1;$i<=count($queue->sub_list_id);$i++){
             			$queue->subscribed[$i] = 0;
             		}*/
             $queue->subscribed = array();
             if (!empty($queue->sub_list_id)) {
                 foreach ($queue->sub_list_id as $key => $value) {
                     $queue->subscribed[$key] = 0;
                 }
             }
         }
         $queue->acc_level = intval(mosGetParam($_REQUEST, 'acc_level', 29));
         if (!empty($queue->sub_list_id)) {
             foreach ($queue->sub_list_id as $key => $value) {
                 if (empty($queue->subscribed[$key]) or $queue->subscribed[$key] != 1) {
                     $queue->subscribed[$key] = 0;
                 }
             }
         }
         /*for($i=1;$i<=count($queue->sub_list_id);$i++){
         			if($queue->subscribed[$i] != 1){
         				$queue->subscribed[$i] = 0;
         			}
         		}*/
     }
     if (!empty($queue->subscribed) and $subscriberId > 0) {
         return queue::updateSuscription($queue);
     }
     return true;
 }
Пример #11
0
 function import($listId)
 {
     $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__);
     @set_time_limit(0);
     $queue = '';
     $queue->sub_list_id = mosGetParam($_REQUEST, 'sub_list_id', '');
     $queue->subscribed = mosGetParam($_REQUEST, 'subscribed', '');
     $queue->acc_level = mosGetParam($_REQUEST, 'acc_level', 29);
     $path = $GLOBALS['mosConfig_absolute_path'] . $GLOBALS[ACA . 'upload_url'];
     $filename = $_FILES['importfile']['name'];
     if (is_writable($path)) {
         if (!@move_uploaded_file($_FILES['importfile']['tmp_name'], $path . $filename)) {
             echo _ACA_ERROR_MOVING_UPLOAD;
         }
         $import = file_get_contents($path . $filename);
         $import = str_replace(array("\r", "\r\n"), "\n", $import);
         $array = explode("\n", $import);
         if (sizeof($array) > 0) {
             foreach ($array as $row) {
                 $row = trim($row);
                 if (empty($row)) {
                     continue;
                 }
                 $values = explode(',', $row);
                 if (count($values) != 4) {
                     echo '<br />' . acajoom::printM('red', $row . ' : Acajoom needs 4 arguments for each user');
                     continue;
                 }
                 $values[0] = trim($values[0]);
                 $values[1] = trim($values[1]);
                 if (isset($values[1])) {
                     $valid = subscribers::validEmail($values[1]);
                     if (!$valid) {
                         echo '<br />' . acajoom::printM('red', $values[1] . ': ' . _ACA_EMAIL_INVALID);
                         continue;
                     } else {
                         $subscriber = null;
                         $subscriber->name = addslashes($values[0]);
                         $subscriber->email = $values[1];
                         $subscriber->receive_html = empty($values[2]) ? '0' : '1';
                         $subscriber->confirmed = empty($values[3]) ? '0' : '1';
                         $subscriber->subscribe_date = acajoom::getNow();
                         $subscriber->language_iso = 'eng';
                         $subscriber->timezone = '00:00:00';
                         $subscriber->blacklist = '0';
                         $subscriber->params = '';
                         $d['email'] = $subscriber->email;
                         $erro->ck = subscribers::getSubscriberIdFromEmail($d);
                         $erro->Eck(__LINE__, '8679');
                         $subscriberId = $d['subscriberId'];
                         if ($subscriberId < 1) {
                             $erro->ck = subscribers::insertSubscriber($subscriber, $subscriberId);
                             $erro->Eck(__LINE__, '8650');
                         }
                         if (!$erro->ck) {
                             echo '<br />' . acajoom::printM('red', $values[0] . ': ' . _ACA_SUBCRIBER_EXIT);
                         } else {
                             if (!empty($queue->subscribed) and $subscriberId > 0) {
                                 $queue->user_id = $subscriberId;
                                 $erro->ck = queue::updateSuscription($queue);
                                 $erro->Eck(__LINE__, '8651');
                                 if ($GLOBALS[ACA . 'require_confirmation'] == '1' and $values[3] == '0') {
                                     $listIds = array();
                                     $size = sizeof($queue->sub_list_id);
                                     for ($index = 0; $index < $size; $index++) {
                                         if (isset($queue->subscribed[$index])) {
                                             if ($queue->subscribed[$index] > 0) {
                                                 $listIds[] = $queue->sub_list_id[$index];
                                             }
                                         }
                                     }
                                     $erro->ck = acajoom_mail::processConfirmationEmail($subscriberId, $listIds);
                                     $erro->Eck(__LINE__, '8652');
                                 }
                                 if ($erro->ck) {
                                     echo '<br />' . acajoom::printM('green', $values[0] . ': ' . _ACA_IMPORT_SUCCESS);
                                 } else {
                                     echo '<br />' . acajoom::printM('blue', $values[0] . ': ' . _ACA_PB_QUEUE);
                                 }
                             }
                         }
                     }
                 }
             }
             return true;
         }
         $erro->ck = unlink($path . $filename);
         $erro->Eck(__LINE__, '8655');
         if (!$erro->ck) {
             echo _ACA_DELETION_OFFILE . ' ' . $path . $filename . ' ' . _ACA_MANUALLY_DELETE . '.</p>';
         }
     } else {
         echo _ACA_CANNOT_WRITE_DIR . ' ' . $path . '</p>';
         return false;
     }
 }
Пример #12
0
 function moveTo($dir_dest, $overwrite = true)
 {
     if (!$this->isValid()) {
         return acajoom::printM('error', $this->upload['error']);
     }
     if (!$this->_evalValidExtensions()) {
         return acajoom::printM('error', _ACA_NOT_ALLOWED_EXTENSION);
     }
     $err_code = $this->_chk_dir_dest($dir_dest);
     if ($err_code !== false) {
         return acajoom::printM('error', $err_code);
     }
     if (!$this->mode_name_selected) {
         $this->setName('safe');
     }
     $name_dest = $dir_dest . DIRECTORY_SEPARATOR . $this->upload['name'];
     if (@is_file($name_dest)) {
         if ($overwrite !== true) {
             return acajoom::printM('error', _ACA_FILE_EXISTS);
         } elseif (!is_writable($name_dest)) {
             return acajoom::printM('error', _ACA_CANNOT_OVERWRITE);
         }
     }
     if (!@move_uploaded_file($this->upload['tmp_name'], $name_dest)) {
         return acajoom::printM('error', _ACA_E_FAIL_MOVE);
     }
     @chmod($name_dest, $this->_chmod);
     return $this->getProp('name');
 }
Пример #13
0
 function P()
 {
     $this->setResult();
     if ($GLOBALS[ACA . 'send_error'] == '1') {
         echo $this->report();
         $this->email();
     }
     if (!$this->warning) {
         if (class_exists('acajoom')) {
             if ($GLOBALS[ACA . 'report_error'] == '1' and $GLOBALS['mosConfig_debug'] == '1') {
                 $this->mess .= acajoom::printM('error', _ACA_ERR_NB . $this->errNb);
             } else {
                 $this->mess .= acajoom::printM('red', _ACA_ERROR);
             }
         } else {
             if ($GLOBALS[ACA . 'report_error'] == '1' and $GLOBALS['mosConfig_debug'] == '1') {
                 $this->mess .= _ACA_ERR_NB . $this->errNb;
             } else {
                 $this->mess .= _ACA_ERROR;
             }
         }
         if ($this->showErr) {
             $this->mess = '';
         }
         if ($GLOBALS[ACA . 'admin_debug'] == 1) {
         }
         $this->err = '';
         $this->ck = true;
     } else {
         $this->warning = false;
     }
 }
Пример #14
0
function installBots15()
{
    global $database;
    $error = '';
    $return = '<b>' . _ACA_INSTALL_BOT . '</b> : ';
    if (!@mkdir($GLOBALS['mosConfig_absolute_path'] . '/plugins/acajoom')) {
        $return .= '<br /> Error adding bot directory.';
    }
    $bot_files = array('acajoombot.php', 'acajoombot.xml', 'index.html');
    foreach ($bot_files as $bot_file) {
        if (is_file($GLOBALS['mosConfig_absolute_path'] . '/plugins/acajoom/' . $bot_file)) {
            @unlink(WPATH_ADMIN . 'bots15/' . $bot_file);
        } else {
            if (!@rename(WPATH_ADMIN . 'bots15/' . $bot_file, $GLOBALS['mosConfig_absolute_path'] . '/plugins/acajoom/' . $bot_file)) {
                $error .= '<br />Error copying bot file ' . $bot_file . ' to bot directory.';
            }
        }
    }
    @chmod($GLOBALS['mosConfig_absolute_path'] . '/plugins/acajoom', 0755);
    if (!@rmdir(WPATH_ADMIN . 'bots15/')) {
        $error .= '<br /> Error deleting the temporary bot directory.';
    }
    ### Acajoom bot
    $bot_infos = array('Acajoom Content Bot', 'acajoombot');
    foreach ($bot_infos as $bot_info) {
        $query = "SELECT `id` FROM `#__plugins` WHERE `element` = 'acajoombot'";
        $database->setQuery($query);
        $database->query();
        $error .= $database->getErrorMsg();
        if (!empty($error)) {
            $error .= '<br /> Error getting bot information from bot table for "' . $bot_info[0] . '". Database error: <br />' . $error . '<br />';
        } else {
            $id = $database->loadResult();
            if (!$id) {
                $row = new mosMambot($database);
                $row->name = $bot_infos[0];
                $row->ordering = 0;
                $row->folder = 'acajoom';
                $row->iscore = 0;
                $row->access = 0;
                $row->client_id = 0;
                $row->element = $bot_infos[1];
                $row->published = 1;
                if (!$row->store()) {
                    $error .= '<br />Error adding bot information to bot table for "' . $bot_info[0] . '".';
                }
            }
        }
    }
    if (empty($error)) {
        $return .= acajoom::printM('green', _ACA_INSTALL_SUCCESS) . '<br />';
    } else {
        $return .= $error . acajoom::printM('red', _ACA_INSTALL_ERROR) . '<br />';
    }
    return $return;
}