function e_linkwords() { global $pref, $admin_log; /* constructor */ // Do an auto-update on the variable used to hook parsers - so we should only be called once e107::lan('linkwords', e_LANGUAGE); // e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php" $hooks = explode(",", $pref['tohtml_hook']); if (($key = array_search('linkwords', $hooks)) !== FALSE) { unset($hooks[$key]); } if (count($hooks) == 0) { unset($pref['tohtml_hook']); } else { $pref['tohtml_hook'] = implode(',', $hooks); } if (!isset($pref['e_tohtml_list'])) { $pref['e_tohtml_list'] = array(); } if (!in_array('linkwords', $pref['e_tohtml_list'])) { $pref['e_tohtml_list'][] = 'linkwords'; } save_prefs(); e107::getLog()->add('LINKWD_05', LWLAN_58 . '[!br!]' . $pref['tohtml_hook'], ''); // Log that the update was done return; }
function pingit($vals) { global $admin_log; require e_PLUGIN . "gsitemap/weblog_pinger.php"; $pinger = new Weblog_Pinger(); // $pinger->ping_ping_o_matic("Ekzemplo", "http://www.ekzemplo.com/"); $xml_rpc_server = "blogsearch.google.com"; $xml_rpc_port = 80; $xml_rpc_path = "/ping/RPC2"; $xml_rpc_method = "weblogUpdates.extendedPing"; $weblog_name = SITENAME; $weblog_url = $_SERVER['HTTP_HOST'] . e_HTTP; $changes_url = $_SERVER['HTTP_HOST'] . e_HTTP . "news.php?extend." . $vals['news_id']; $cat_or_rss = $_SERVER['HTTP_HOST'] . e_PLUGIN_ABS . "rss_menu/rss.php?1.2"; $extended = TRUE; $pinger->ping($xml_rpc_server, $xml_rpc_port, $xml_rpc_path, $xml_rpc_method, $weblog_name, $weblog_url, $changes_url, $cat_or_rss, $extended); $log = strip_tags($vals['news_title'] . "\n" . $changes_url . "\n" . $cat_or_rss . "\n" . $pinger->smessage); e107::getLog()->add("Gsitemap Google-ping", $log, 4); }
$admin_log->logArrayAll('NEWSFD_02', $feed); $mes->addSuccess(LAN_UPDATED); } else { $mes->addInfo(LAN_NO_CHANGE . ': ' . $sql->mySQLerror); } } e107::getCache()->clear(NEWSFEED_LIST_CACHE_TAG); // This should actually clear all the newsfeed data in one go } else { $mes->addError(LAN_REQUIRED_BLANK); } } $ns->tablerender($caption, $mes->render() . $text); if ($action == "delete") { $sql->db_Delete('newsfeed', 'newsfeed_id=' . $id); e107::getLog()->add('NEWSFD_03', 'ID: ' . $id, E_LOG_INFORMATIVE, ''); $mes->addSuccess(LAN_DELETED); } $ns->tablerender($caption, $mes->render() . $text); if ($headline_total = $sql->db_Select("newsfeed")) { $nfArray = $sql->rows(); $text = "\n\t<table class='table table-striped'>\n\t<colgroup>\n\t\t<col style='width: 5%; text-align: center;' />\n\t\t<col style='width: 40%;' />\n\t\t<col style='width: 10%; text-align: center;' />\n\t\t<col style='width: 25%; text-align: center;' />\n\t\t<col style='width: 10%; text-align: center;' />\n\t</colgroup>\n\t<thead>\n\t<tr>\n\t\t<th>" . LAN_ID . "</th>\n\t\t<th>" . LAN_NAME . "</th>\n\t\t<th>" . NFLAN_26 . "</th>\n\t\t<th>" . NFLAN_12 . "</th>\n\t\t<th class='center options'>" . LAN_OPTIONS . "</th>\n\t</tr>\n\t</thead>\n"; $active = array(NFLAN_13, NFLAN_14, NFLAN_20, NFLAN_21); foreach ($nfArray as $newsfeed) { extract($newsfeed); // FIXME $text .= "\n\t\t<tr>\n\t\t\t<td>{$newsfeed_id}</td>\n\t\t\t<td><a href='{$newsfeed_url}' rel='external'>{$newsfeed_name}</a></td>\n\t\t\t<td>" . ($newsfeed_updateint ? $newsfeed_updateint : "3600") . "</td>\n\t\t\t<td>" . $active[$newsfeed_active] . "</td>\n\t\t\t<td>\n\t\t\t\t<a class='btn btn-default btn-large' href='" . e_SELF . "?edit." . $newsfeed_id . "'>" . ADMIN_EDIT_ICON . "</a>\n\t <a class='btn btn-default btn-large action delete' href='" . e_SELF . "?delete." . $newsfeed_id . "' rel='no-confirm' title='" . LAN_CONFDELETE . "'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t</td>\n\t\t</tr>"; } $text .= "</table>"; } else { $mes->addInfo(NFLAN_41);
foreach ($uploaded as $k => $inf) { if ($inf['error'] == 0) { $uploadList[] = $_POST['upload_dir'][$key] . $uploaded[0]['name']; } else { // Most likely errors trapped earlier. //$message .= $spacer.FMLAN_10.' '.$inf['error'].' ('.$inf['message'].'): '.$inf['rawname']; // FIXME $mes->addError($inf['error'] . ' (' . $inf['message'] . '): ' . $inf['rawname']); } $spacer = '<br />'; } } } } } if (count($uploadList)) { e107::getLog()->add('FILEMAN_03', implode('[!br!]', $uploadList), E_LOG_INFORMATIVE, ''); } } $ns->tablerender($caption, $mes->render() . $text); /* if ($message) { $ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>"); } */ if (strpos(e_QUERY, ".") && !is_dir(realpath(e_BASE . $path))) { echo "\n\t<div>\n\t\t<iframe style='width:99%' src='" . e_BASE . e_QUERY . "' height='300' scrolling='yes'>asdas</iframe>\n\t</div>\n\t"; if (!strpos(e_QUERY, "/")) { $path = ""; } else { $path = substr($path, 0, strrpos(substr($path, 0, -1), "/")) . "/";
/** * Resize an image. * @param $src * @param $dest * @param string $opts * @return bool */ function resizeImage($src = '', $dest = '', $opts = null) { $pref = e107::getPref(); $tp = e107::getParser(); if (empty($src)) { return false; } if (is_string($opts)) { parse_str($opts, $opts); } $quality = vartrue($pref['thumbnail_quality'], 65); $src = $tp->replaceConstants($src); $dest = $tp->replaceConstants($dest); $maxWidth = varset($opts['w'], 800); $maxHeight = varset($opts['h'], 800); $destDir = dirname($dest); $destFile = basename($dest); $destFilePath = $destDir . "/" . varset($opts['prefix'], $maxWidth . 'x' . $maxHeight) . '_' . $destFile; if (file_exists($destFilePath)) { return $destFilePath; } @(require e_HANDLER . 'phpthumb/ThumbLib.inc.php'); try { $thumb = PhpThumbFactory::create($src); $thumb->setOptions(array('correctPermissions' => true, 'resizeUp' => false, 'jpegQuality' => $quality)); $thumb->resize($maxWidth, $maxHeight); $thumb->save($destFilePath); return $destFilePath; } catch (Exception $e) { $error = array('thumbnailer' => $e->getMessage(), 'src' => $src, 'dest' => $dest, 'savePath' => $destFilePath, 'backtrace' => 'e_media::resizeImage'); e107::getMessage()->addDebug(print_a($error, true)); e107::getLog()->add("RESIZE ERROR", $error, E_LOG_INFORMATIVE, 'RESIZE'); return false; } }
// can be removed? $mes->addSuccess($_POST['language'] . ' ' . $value . ' ' . LAN_DELETED); } else { $msg = $tp->lanVars(LANG_LAN_02, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addWarning($msg); } } else { // leave table. LANG_LAN_104 $msg = $tp->lanVars(LANG_LAN_104, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addInfo($msg); } } } e107::getLog()->add('LANG_03', $message, E_LOG_INFORMATIVE, ''); $sql->db_ResetTableList(); } /* if(isset($message) && $message) { $ns->tablerender(LAN_OK, $message); } */ unset($text); if (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing']) { multilang_prefs(); } if (varset($action) == 'db') { multilang_db(); }
function update_70x_to_706($type = '') { global $sql, $ns, $pref, $e107info, $admin_log, $emessage; $just_check = $type == 'do' ? FALSE : TRUE; if (!$sql->db_Field("plugin", 5)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD `plugin_addons` TEXT NOT NULL ;"); catch_error($sql); } //rename plugin_rss field if ($sql->db_Field("plugin", 5) == "plugin_rss") { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;"); catch_error($sql); } if ($sql->db_Field("dblog", 5) == "dblog_query") { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_query` `dblog_title` VARCHAR( 255 ) NOT NULL DEFAULT '';"); catch_error($sql); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "dblog` CHANGE `dblog_remarks` `dblog_remarks` TEXT NOT NULL;"); catch_error($sql); } if (!$sql->db_Field("plugin", "plugin_path", "UNIQUE")) { if ($just_check) { return update_needed(); } if (!$sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "plugin` ADD UNIQUE (`plugin_path`);")) { $mesg = LAN_UPDATE_12 . " : <a href='" . e_ADMIN . "db.php?plugin'>" . ADLAN_145 . "</a>."; //$ns -> tablerender(LAN_ERROR,$mes); $emessage->add($mesg, E_MESSAGE_ERROR); catch_error($sql); } } if (!$sql->db_Field("online", 6)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE " . MPREFIX . "online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'"); catch_error($sql); } if ($sql->db_Query("SHOW INDEX FROM " . MPREFIX . "tmp")) { $row = $sql->db_Fetch(); if (!in_array('tmp_ip', $row)) { if ($just_check) { return update_needed(); } $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "tmp` ADD INDEX `tmp_ip` (`tmp_ip`);"); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "upload` ADD INDEX `upload_active` (`upload_active`);"); $sql->db_Select_gen("ALTER TABLE `" . MPREFIX . "generic` ADD INDEX `gen_type` (`gen_type`);"); } } if (!$just_check) { // update new fields require_once e_HANDLER . "plugin_class.php"; $ep = new e107plugin(); $ep->update_plugins_table('update'); $ep->save_addon_prefs('update'); } if (!isset($pref['displayname_maxlength'])) { if ($just_check) { return update_needed(); } $pref['displayname_maxlength'] = 15; save_prefs(); } // If we get to here, in checking mode no updates are required. In update mode, all done. if ($just_check) { return TRUE; } e107::getLog()->add('UPDATE_02', LAN_UPDATE_14 . $e107info['e107_version'], E_LOG_INFORMATIVE, ''); // Log result of actual update return $just_check; // TRUE if no updates needed, FALSE if updates needed and completed }
function field_deactivate() { global $ue, $ns, $tp, $sql, $admin_log; $ret = ""; foreach (array_keys($_POST['deactivate']) as $f) { if ($ue->user_extended_remove($f, $f)) { $ret .= EXTLAN_68 . " {$f} " . EXTLAN_72 . "<br />"; if (is_readable(e_CORE . "sql/extended_" . $f . ".php")) { $ret .= mysql_query("DROP TABLE " . MPREFIX . "user_extended_" . $f) ? LAN_DELETED . " user_extended_" . $f . "<br />" : LAN_DELETED_FAILED . " user_extended_" . $f . "<br />"; } } else { $ret .= EXTLAN_70 . " {$f} " . EXTLAN_73 . "<br />"; } } e107::getLog()->add('EUF_12', implode(', ', $_POST['deactivate']), E_LOG_INFORMATIVE, ''); return $ret; }
function avatarPageDeleteChecked() { $sql = e107::getDb(); $mes = e107::getMessage(); if (!empty($_POST['multiaction'])) { $tmp = array(); $tmp1 = array(); $message = array(); foreach ($_POST['multiaction'] as $todel) { list($usr, $path) = explode('#', $todel); // $path = basename($path); $path = str_replace("../", "", $path); // clean the path. $mes->addDebug('usr: '******' path: ' . $path); $image_type = 2; if (strpos($path, '-upload-') === 0) { $image_type = 1; $path = substr($path, strlen('-upload-')); } //delete it from server $deletePath = e_AVATAR . $path; if (@unlink($deletePath)) { $mes->addDebug('Deleted: ' . $deletePath); $message[] = basename($path); //admin log & sysmessage } else { $mes->addError('Unable to delete: ' . $deletePath); // Do not translate, temporary during beta stage. } //It's owned by an user if (!empty($usr)) { switch ($image_type) { case 1: //avatar $tmp[] = intval($usr); break; case 2: //photo $tmp1[] = intval($usr); break; } } } //Reset all deleted user avatars with one query if (!empty($tmp)) { $sql->update("user", "user_image='' WHERE user_id IN (" . implode(',', $tmp) . ")"); $mes->addDebug("user_image='' WHERE user_id IN (" . implode(',', $tmp) . ")"); } //Reset all deleted user photos with one query if (!empty($tmp1)) { $sql->update("user", "user_sess='' WHERE user_id IN (" . implode(',', $tmp1) . ")"); $mes->addDebug("user_sess='' WHERE user_id IN (" . implode(',', $tmp1) . ")"); } unset($tmp, $tmp1); //Format system message if (!empty($message)) { e107::getLog()->add('IMALAN_01', implode('[!br!]', $message), E_LOG_INFORMATIVE, ''); $mes->addSuccess(implode(', ', $message) . ' ' . IMALAN_28); } } }
private function dbPageEditProcess() { $tabs = $this->getTables(); $sql = e107::getDb(); $tp = e107::getParser(); $mes = e107::getMessage(); $message = ''; // ----------------- delete tables --------------------------------------------- if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0')) { $lang = strtolower($_POST['lang_choices']); foreach ($tabs as $del_table) { if ($sql->isTable($del_table, $lang)) { // echo $del_table." exists<br />"; $qry = "DROP TABLE " . MPREFIX . "lan_" . $lang . "_" . $del_table; if (mysql_query($qry)) { $msg = $tp->lanVars(LANG_LAN_100, $_POST['lang_choices'] . ' ' . $del_table); $message .= $msg . '[!br!]'; $mes->addSuccess($msg); } else { $msg = $tp->lanVars(LANG_LAN_101, $_POST['lang_choices'] . ' ' . $del_table); $message .= $msg . '[!br!]'; $mes->addWarning($msg); } } } e107::getLog()->add('LANG_02', $message . '[!br!]', E_LOG_INFORMATIVE, ''); $sql->db_ResetTableList(); } // ----------create tables ----------------------------------------------------- if (isset($_POST['create_tables']) && $_POST['language']) { $table_to_copy = array(); $lang_to_create = array(); foreach ($tabs as $value) { $lang = strtolower($_POST['language']); if (isset($_POST[$value])) { $copdata = $_POST['copydata_' . $value] ? 1 : 0; if ($sql->db_CopyTable($value, "lan_" . $lang . "_" . $value, $_POST['drop'], $copdata)) { $msg = $tp->lanVars(LANG_LAN_103, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; // Used in admin log. $mes->addSuccess($msg); } else { if (!$_POST['drop']) { $msg = $tp->lanVars(LANG_LAN_00, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addWarning($msg); } else { $msg = $tp->lanVars(LANG_LAN_01, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addWarning($msg); } } } elseif ($sql->isTable($value, $_POST['language'])) { if ($_POST['remove']) { // Remove table. if (mysql_query("DROP TABLE " . MPREFIX . "lan_" . $lang . "_" . $value)) { $message .= $_POST['language'] . ' ' . $value . ' ' . LAN_DELETED . '[!br!]'; // can be removed? $mes->addSuccess($_POST['language'] . ' ' . $value . ' ' . LAN_DELETED); } else { $msg = $tp->lanVars(LANG_LAN_02, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addWarning($msg); } } else { // leave table. LANG_LAN_104 $msg = $tp->lanVars(LANG_LAN_104, $_POST['language'] . ' ' . $value); $message .= $msg . '[!br!]'; $mes->addInfo($msg); } } } e107::getLog()->add('LANG_03', $message, E_LOG_INFORMATIVE, ''); $sql->db_ResetTableList(); } }
closedir($handle); if (isset($_POST['update_theme'])) { $tmp = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, 6) == 'theme_') { $tmp[] = $value; } } $newThemes = implode(',', $tmp); $themeeditclass = intval($_POST['themeeditclass']); if ($newThemes != $pref['allowed_themes'] || $themeeditclass != $pref['allow_theme_select']) { $pref['allowed_themes'] = $newThemes; $pref['allow_theme_select'] = $themeeditclass; save_prefs(); $woffle = LAN_UMENU_THEME_8 . $pref['allowed_themes'] . '[!br!]' . LAN_UMENU_THEME_9 . $pref['allow_theme_select']; e107::getLog()->add('UTHEME_01', $woffle, E_LOG_INFORMATIVE, ''); } } if (isset($pref['allowed_themes'])) { $allThemes = FALSE; $themeList = explode(',', $pref['allowed_themes']); } $themeeditclass = varset($pref['allow_theme_select'], e_UC_NOBODY); $text = "\n\t<form method='post' action='" . e_SELF . "' id='menu_conf_form'>\n\t<fieldset id='core-user_menu-usertheme'>\n\t<legend class='e-hideme'>" . LAN_UMENU_THEME_6 . "</legend>\n\t<table class='table adminlist'>\n\t\t<colgroup span='2'>\n\t\t<col style='width: 50%' />\n\t\t<col style='width: 50%' />\n\t</colgroup>\n <thead>\n\t<tr>\n\t\t<th colspan='2'>" . LAN_UMENU_THEME_4 . "</th>\n\t</tr>\n\t</thead>\n\t\t<tbody>"; foreach ($themeOptions as $th) { $ch = in_array($th, $themeList) ? " checked='checked'" : ''; $text .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$th}</td>\n\t\t\t\t\t<td><input class='tbox' type='checkbox' name='theme_{$th}' value='{$th}' {$ch} /></td>\n\t\t\t\t</tr>"; } $text .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_UMENU_THEME_7 . "</td>\n\t\t\t\t\t<td>" . $e_userclass->uc_dropdown("themeeditclass", $themeeditclass, "main,member,admin,classes,matchclass,nobody") . "</td>\n\t\t\t\t</tr>"; $text .= "\n \t</tbody>\n\t</table>\n\t<div class='buttons-bar center'>\n\t\t" . $frm->admin_button('update_theme', LAN_UPDATE, 'update') . "\n\t</div>\n\t</fieldset>\n\t</form>\n\t"; $mes = e107::getMessage();
private function processActivationLink() { global $userMethods; $sql = e107::getDb(); $tp = e107::getParser(); $ns = e107::getRender(); $log = e107::getLog(); $pref = e107::pref('core'); $qs = explode('.', e_QUERY); if ($qs[0] == 'activate' && (count($qs) == 3 || count($qs) == 4) && $qs[2]) { // FIXME TODO use generic multilanguage selection => e107::coreLan(); // return the message in the correct language. if (isset($qs[3]) && strlen($qs[3]) == 2) { require_once e_HANDLER . 'language_class.php'; $slng = new language(); $the_language = $slng->convert($qs[3]); if (is_readable(e_LANGUAGEDIR . $the_language . '/lan_' . e_PAGE)) { include e_LANGUAGEDIR . $the_language . '/lan_' . e_PAGE; } else { include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_' . e_PAGE); } } else { include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_' . e_PAGE); } e107::getCache()->clear("online_menu_totals"); if ($sql->select("user", "*", "user_sess='" . $tp->toDB($qs[2], true) . "' ")) { if ($row = $sql->fetch()) { $dbData = array(); $dbData['WHERE'] = " user_sess='" . $tp->toDB($qs[2], true) . "' "; $dbData['data'] = array('user_ban' => '0', 'user_sess' => ''); // Set initial classes, and any which the user can opt to join if ($init_class = $userMethods->userClassUpdate($row, 'userfull')) { //print_a($init_class); exit; $dbData['data']['user_class'] = $init_class; } $userMethods->addNonDefaulted($dbData); validatorClass::addFieldTypes($userMethods->userVettingInfo, $dbData); $newID = $sql->update('user', $dbData); if ($newID === false) { $log->e_log_event(10, debug_backtrace(), 'USER', 'Verification Fail', print_r($row, true), false, LOG_TO_ROLLING); $ns->tablerender(LAN_SIGNUP_75, LAN_SIGNUP_101); return false; } // Log to user audit log if enabled $log->user_audit(USER_AUDIT_EMAILACK, $row); e107::getEvent()->trigger('userveri', $row); // Legacy event e107::getEvent()->trigger('user_signup_activated', $row); e107::getEvent()->trigger('userfull', $row); // 'New' event if (varset($pref['autologinpostsignup'])) { require_once e_HANDLER . 'login.php'; $usr = new userlogin(); $usr->login($row['user_loginname'], md5($row['user_name'] . $row['user_password'] . $row['user_join']), 'signup', ''); } $text = "<div class='alert alert-success'>" . LAN_SIGNUP_74 . " <a href='index.php'>" . LAN_SIGNUP_22 . "</a> " . LAN_SIGNUP_23 . "<br />" . LAN_SIGNUP_24 . " " . SITENAME . "</div>"; $ns->tablerender(LAN_SIGNUP_75, $text); } } else { // Invalid activation code $log->e_log_event(10, debug_backtrace(), 'USER', 'Invalid Verification URL', print_r($qs, true), false, LOG_TO_ROLLING); echo e107::getMessage()->addError("Invalid URL")->render(); // header("location: ".e_BASE."index.php"); return false; } } }
header("location:" . e_BASE . "index.php"); exit; } require_once e_ADMIN . "auth.php"; if (isset($_POST['moderate'])) { $temp = array(); if (is_array($_POST['trackback_delete'])) { while (list($key, $cid) = each($_POST['trackback_delete'])) { $cid = intval($cid); if ($cid > 0) { $sql->db_Delete("trackback", "trackback_id=" . $cid); $temp[] = $cid; } } if (count($temp)) { e107::getLog()->add('TRACK_02', implode(', ', $temp), E_LOG_INFORMATIVE, ''); } } $ns->tablerender("", "<div style='text-align:center'><b>" . TRACKBACK_L15 . "</b></div>"); $e107cache->clear("news.php"); } $text = "<div style='text-align:center'>\n<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n<table style='" . ADMIN_WIDTH . "' class='fborder'>"; if (e_QUERY == 'all') { $res = $sql->db_Select("trackback", "*"); } else { $res = $sql->db_Select("trackback", "*", "trackback_pid=" . intval(e_QUERY)); } if (!$res) { $text .= "<tr><td class='forumheader3' style='text-align:center'>" . TRACKBACK_L12 . ".</td></tr></table></form></div>"; } else { $tbArray = $sql->db_getList();
function rempagego() { global $sql, $admin_log; $sql->db_Select("logstats", "*", "log_id='pageTotal' "); $row = $sql->db_Fetch(); $pageTotal = unserialize($row['log_data']); $logfile = e_LOG . "logp_" . date("z.Y", time()) . ".php"; // $logfile = e_PLUGIN."log/logs/logp_".date("z.Y", time()).".php"; if (is_readable($logfile)) { require $logfile; } foreach ($_POST['remcb'] as $page) { unset($pageInfo[$page]); unset($pageTotal[$page]); } $pagetotal = serialize($pageTotal); if (!$sql->db_Update("logstats", "log_data='{$pagetotal}' WHERE log_id='pageTotal' ")) { $sql->db_Insert("logstats", "0, 'pageTotal', '{$pagetotal}' "); } e107::getLog()->add('STAT_03', ADSTAT_L80 . "[!br!]" . implode("[!br!]", $_POST['remcb']), ''); $varStart = chr(36); $quote = chr(34); $data = chr(60) . "?php\n" . chr(47) . "* e107 website system: Log file: " . date("z:Y", time()) . " *" . chr(47) . "\n\n" . $varStart . "ipAddresses = " . $quote . $ipAddresses . $quote . ";\n" . $varStart . "siteTotal = " . $quote . $siteTotal . $quote . ";\n" . $varStart . "siteUnique = " . $quote . $siteUnique . $quote . ";\n"; $loop = FALSE; $data .= $varStart . "pageInfo = array(\n"; foreach ($pageInfo as $info) { $page = preg_replace("/(\\?.*)|(\\_.*)|(\\.php)|(\\s)|(\\')|(\")|(eself)|( )/", "", basename($info['url'])); $page = str_replace("\\", "", $page); $info['url'] = preg_replace("/(\\s)|(\\')|(\")|(eself)|( )/", "", $info['url']); $info['url'] = str_replace("\\", "", $info['url']); $page = trim($page); if ($page && !strstr($page, "cache") && !strstr($page, "file:")) { if ($loop) { $data .= ",\n"; } $data .= $quote . $page . $quote . " => array('url' => '" . $info['url'] . "', 'ttl' => " . $info['ttl'] . ", 'unq' => " . $info['unq'] . ")"; $loop = 1; } } $data .= "\n);\n\n?" . chr(62); if ($handle = fopen($logfile, 'w')) { fwrite($handle, $data); } fclose($handle); }
$userData['data'] = array(); if ($_POST['a_password'] != '' && $_POST['a_password2'] != '' && $_POST['a_password'] == $_POST['a_password2']) { $userData['data']['user_password'] = $sql->escape($userMethods->HashPassword($_POST['a_password'], $currentUser['user_loginname']), FALSE); unset($_POST['a_password']); unset($_POST['a_password2']); if (vartrue($pref['allowEmailLogin'])) { $user_prefs = e107::getArrayStorage()->unserialize($currentUser['user_prefs']); $user_prefs['email_password'] = $userMethods->HashPassword($new_pass, $email); $userData['data']['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs); } $userData['data']['user_pwchange'] = time(); $userData['WHERE'] = 'user_id=' . USERID; validatorClass::addFieldTypes($userMethods->userVettingInfo, $userData, $userMethods->otherFieldTypes); $check = $sql->update('user', $userData); if ($check) { e107::getLog()->add('ADMINPW_01', '', E_LOG_INFORMATIVE, ''); $userMethods->makeUserCookie(array('user_id' => USERID, 'user_password' => $userData['data']['user_password']), FALSE); // Can't handle autologin ATM $mes->addSuccess(UDALAN_3 . " " . ADMINNAME); e107::getEvent()->trigger('adpword'); //@deprecated $eventData = array('user_id' => USERID, 'user_pwchange' => $userData['data']['user_pwchange']); e107::getEvent()->trigger('admin_password_update', $eventData); $ns->tablerender(UDALAN_2, $mes->render()); } else { $mes->addError(UDALAN_1 . ' ' . LAN_UPDATED_FAILED); $ns->tablerender(LAN_UPDATED_FAILED, $mes->render()); } } else { $mes->addError(UDALAN_1 . ' ' . LAN_UPDATED_FAILED); $ns->tablerender(LAN_UPDATED_FAILED, $mes->render());
function downloadLog($aText, &$dlInfo, &$mirrorInfo = NULL) { global $admin_log; $logString = DOWLAN_9; foreach ($dlInfo as $k => $v) { $logString .= '[!br!]' . $k . '=>' . $v; } if ($mirrorInfo != NULL) { foreach ($mirrorInfo as $k => $v) { $logString .= '[!br!]' . $k . '=>' . $v; } } e107::getLog()->add($aText, $logString, E_LOG_INFORMATIVE, ''); }
function banners_adminlog($msg_num = '00', $woffle = '') { global $admin_log; $pref = e107::getPref(); // if (!varset($pref['admin_log_log']['admin_banners'],0)) return; e107::getLog()->add('BANNER_' . $msg_num, $woffle, E_LOG_INFORMATIVE, ''); }
break; case 'midMoveToSend': $notify = isset($_POST['mail_notify_complete']) ? 3 : 2; $first = 0; $last = 0; // Set defaults for earliest and latest send times. // TODO: Save these fields if (isset($_POST['mail_earliest_time'])) { $first = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, FALSE); } if (isset($_POST['mail_latest_time'])) { $last = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, TRUE); } if ($mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last)) { $mes->addSuccess(LAN_MAILOUT_185); e107::getLog()->add('MAIL_06', 'ID: ' . $mailId, E_LOG_INFORMATIVE, ''); } else { $errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_188); } break; } if (isset($_POST['email_sendnow'])) { // sendImmediately($mailId); } // --------------------- Display errors and results ------------------------ if (is_array($errors) && count($errors) > 0) { foreach ($errors as $e) { $mes->addError($e); } unset($errors); }
// ***** Next line creates a record which presumably should be there anyway, so could generate an error if no test first $sql->db_Select_gen("INSERT INTO #user_extended (user_extended_id, user_hidden_fields) values ('" . $inp . "', '')"); //print_a('New extended fields added: '.$inp.'<br />'); } if (false === $sql->db_Update('user_extended', $changedEUFData)) { $message .= '<br />Error updating EUF'; } } // Now see if we need to log anything. First check the options and class membership // (Normally we would leave logging decision to the log class. But this one's a bit more complicated) $user_logging_opts = e107::getConfig()->get('user_audit_opts'); $do_log = array(); $log_action = ''; if ($_uid) { // Its an admin changing someone elses data - make an admin log entry here e107::getLog()->add('USET_01', "UID: {$udata['user_id']}. UName: {$udata['user_name']}", E_LOG_INFORMATIVE); // Check against the class of the target user, not the admin! if (!check_class(varset($pref['user_audit_class'], ''), $udata['user_class'])) { $user_logging_opts = array(); } } else { if (!check_class(varset($pref['user_audit_class'], ''))) { $user_logging_opts = array(); } } $triggerData = array(); if (count($changedUserData)) { $triggerData = $changedUserData; // Create record for changed user data trigger $triggerData['user_id'] = $udata['user_id']; $triggerData['_CHANGED_BY_UID'] = USERID;
while ($buff = fread($in, 4096)) { fwrite($out, $buff); } } else { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); } fclose($in); fclose($out); } else { die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); } } // Check if file has been uploaded if (!$chunks || $chunk == $chunks - 1) { // Strip the temp .part suffix off rename("{$filePath}.part", $filePath); } // rename($targetDir.$fileName,e_MEDIA."images/2012-05/",$fileName); if ($_GET['for'] != '') { $result = e107::getMedia()->importFile($fileName, $_GET['for']); } $log = $_GET; $log['filepath'] = $filePath; $log['filename'] = $fileName; $log['status'] = $result ? 'ok' : 'failed'; $type = $result ? E_LOG_INFORMATIVE : E_LOG_WARNING; e107::getLog()->add('Media Upload', print_r($log, true), $type, MEDIA_01); $array = array("jsonrpc" => "2.0", "result" => $result, "id" => "id"); echo json_encode($array); // Return JSON-RPC response // die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
function submit_poll($mode = 1) { global $admin_log; $tp = e107::getParser(); $sql = e107::getDb(); $poll_title = $tp->toDB($_POST['poll_title']); $poll_comment = $tp->toDB($_POST['poll_comment']); $multipleChoice = intval($_POST['multipleChoice']); $showResults = intval($_POST['showResults']); $pollUserclass = intval($_POST['pollUserclass']); $storageMethod = intval($_POST['storageMethod']); $active_start = !$_POST['startmonth'] || !$_POST['startday'] || !$_POST['startyear'] ? 0 : mktime(0, 0, 0, $_POST['startmonth'], $_POST['startday'], $_POST['startyear']); $active_end = !$_POST['endmonth'] || !$_POST['endday'] || !$_POST['endyear'] ? 0 : mktime(0, 0, 0, $_POST['endmonth'], $_POST['endday'], $_POST['endyear']); $poll_options = ''; $_POST['poll_option'] = array_filter($_POST['poll_option'], 'poll::clean_poll_array'); foreach ($_POST['poll_option'] as $key => $value) { $poll_options .= $tp->toDB($value) . chr(1); } if (POLLACTION == 'edit' || vartrue($_POST['poll_id'])) { $sql->update("polls", "poll_title='{$poll_title}', \n\t\t\t \t\t\t\t poll_options='{$poll_options}', \n\t\t\t\t\t\t\t poll_comment='{$poll_comment}', \n\t\t\t\t\t\t\t poll_type={$mode},\n\t\t\t\t\t\t\t poll_allow_multiple={$multipleChoice}, \n\t\t\t\t\t\t\t poll_result_type={$showResults}, \n\t\t\t\t\t\t\t poll_vote_userclass={$pollUserclass}, \n\t\t\t\t\t\t\t poll_storage_method={$storageMethod}\n\t\t\t\t\t\t\t WHERE poll_id=" . intval(POLLID)); /* update poll results - bugtracker #1124 .... */ $sql->select("polls", "poll_votes", "poll_id='" . intval(POLLID) . "' "); $foo = $sql->fetch(); $voteA = explode(chr(1), $foo['poll_votes']); $opt = count($poll_option) - count($voteA); if ($opt) { for ($a = 0; $a <= $opt; $a++) { $foo['poll_votes'] .= '0' . chr(1); } $sql->update("polls", "poll_votes='" . $foo['poll_votes'] . "' WHERE poll_id='" . intval(POLLID) . "' "); } e107::getLog()->add('POLL_02', 'ID: ' . POLLID . ' - ' . $poll_title, ''); //$message = POLLAN_45; } else { $votes = ''; for ($a = 1; $a <= count($_POST['poll_option']); $a++) { $votes .= '0' . chr(1); } if ($mode == 1) { /* deactivate other polls */ if ($sql->select("polls", "*", "poll_type=1 AND poll_vote_userclass!=255")) { $deacArray = $sql->db_getList(); foreach ($deacArray as $deacpoll) { $sql->update("polls", "poll_end_datestamp='" . time() . "', poll_vote_userclass='255' WHERE poll_id=" . $deacpoll['poll_id']); } } $ret = $sql->insert("polls", "'0', " . time() . ", " . intval($active_start) . ", " . intval($active_end) . ", " . ADMINID . ", '{$poll_title}', '{$poll_options}', '{$votes}', '', '1', '" . $tp->toDB($poll_comment) . "', '" . intval($multipleChoice) . "', '" . intval($showResults) . "', '" . intval($pollUserclass) . "', '" . intval($storageMethod) . "'"); e107::getLog()->add('POLL_03', 'ID: ' . $ret . ' - ' . $poll_title, ''); // Intentionally only log admin-entered polls } else { $sql->insert("polls", "'0', " . intval($_POST['iid']) . ", '0', '0', " . USERID . ", '{$poll_title}', '{$poll_options}', '{$votes}', '', '2', '0', '" . intval($multipleChoice) . "', '0', '0', '" . intval($storageMethod) . "'"); } } return $message; }
$emote->emoteConf($subpack); break; } if (strstr($key, "XMLPack_")) { $subpack = str_replace("XMLPack_", "", $key); $emote->emoteXML($subpack); break; } if (strstr($key, "defPack_")) { $pref['emotepack'] = str_replace("defPack_", "", $key); if (save_prefs()) { $mes->addSuccess(LAN_UPDATED); } else { $mes->addInfo(LAN_NO_CHANGE); } e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, ''); break; } if (strstr($key, "scanPack_")) { $one_pack = str_replace("scanPack_", "", $key); break; } } $ns->tablerender($caption, $mes->render() . $text); $check = TRUE; //$check = $emote -> installCheck(); $check = $emote->installCheck($one_pack); if ($check !== FALSE) { $emote->listPacks(); } class emotec
function pluginRefresh() { global $plug; $plug = e107::getSingleton('e107plugin')->getinfo($this->id); $_path = e_PLUGIN . $plug['plugin_path'] . '/'; if (file_exists($_path . 'plugin.xml')) { // $text .= $plugin->install_plugin_xml($this->id, 'refresh'); e107::getSingleton('e107plugin')->refresh($plug['plugin_path']); e107::getLog()->add('PLUGMAN_04', $this->id . ':' . $plug['plugin_path'], E_LOG_INFORMATIVE, ''); } }
if ($pref['maintainance_flag'] != $temp) { $pref['maintainance_flag'] = $temp; $changed = TRUE; } $temp = $tp->toDB($_POST['maintainance_text']); if ($pref['maintainance_text'] != $temp) { $pref['maintainance_text'] = $temp; $changed = TRUE; } $temp = intval($_POST['main_admin_only']); if (getperms('0') && $pref['main_admin_only'] != $temp) { $pref['main_admin_only'] = $temp; $changed = TRUE; } if ($changed) { e107::getLog()->add($pref['maintainance_flag'] == 0 ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, ''); save_prefs(); $mes->addSuccess(UGFLAN_1); } else { $mes->addInfo(LAN_NO_CHANGE); } if (!e_AJAX_REQUEST) { header("location:" . e_SELF); exit; } } require_once "auth.php"; $text = "\n\t<form method='post' action='" . e_SELF . "' id='core-ugflag-form'>\n\t\t<fieldset id='core-ugflag'>\n\t\t\t<legend class='e-hideme'>" . UGFLAN_4 . "</legend>\n\t\t\t<table class='table adminform'>\n\t\t\t\t<colgroup>\n\t\t\t\t\t<col class='col-label' />\n\t\t\t\t\t<col class='col-control' />\n\t\t\t\t</colgroup>\n\t\t\t\t<tbody>"; $elements = array(e_UC_PUBLIC => LAN_DISABLED, e_UC_MEMBER => ADLAN_110, e_UC_ADMIN => UGFLAN_8, e_UC_MAINADMIN => UGFLAN_9); $text .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . UGFLAN_2 . ": </td>\n\t\t\t\t\t\t<td>" . $frm->radio('maintainance_flag', $elements, $pref['maintainance_flag'], TRUE) . "</td>\n\t\t\t\t\t</tr>"; //TODO multilanguage pref
/** * Update user (admin) permissions. * NOTE: exit if $uid is not an integer or is 0. * * @param integer $uid * @param array $permArray eg. array('A', 'K', '1'); * @return void */ function updatePerms($uid, $permArray) { global $admin_log; $sql = e107::getDb(); $tp = e107::getParser(); $modID = intval($uid); $mes = e107::getMessage(); if ($modID == 0) { $mes->addError("Malfunction at line " . __LINE__ . " of user_handler.php"); return; } $sysuser = e107::getSystemUser($modID, false); $row = $sysuser->getData(); $a_name = $row['user_name']; $perm = ""; foreach ($permArray as $value) { $value = $tp->toDB($value); if ($value == "0") { if (!getperms('0')) { $value = ""; break; } $perm = "0"; break; } if ($value) { $perm .= $value . "."; } } //$sql->db_Update("user", "user_perms='{$perm}' WHERE user_id='{$modID}' ") if (!$sysuser->isAdmin()) { $sysuser->set('user_admin', 1)->save(); $lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164); e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE); } e107::getMessage()->addAuto($sysuser->set('user_perms', $perm)->save(), 'update', sprintf(LAN_UPDATED, $tp->toDB($_POST['ad_name'])), false, false); $logMsg = str_replace(array('--ID--', '--NAME--'), array($modID, $a_name), ADMSLAN_72) . $perm; e107::getLog()->add('ADMIN_01', $logMsg, E_LOG_INFORMATIVE, ''); }
if (preg_match("#Binary (.*?)/#", $row['upload_file'], $match)) { $sql->db_Delete("rbinary", "binary_id='" . $tp->toDB($match[1]) . "'"); } else { if ($row['upload_file'] && file_exists(e_UPLOAD . $row['upload_file'])) { unlink(e_UPLOAD . $row['upload_file']); } } if (preg_match("#Binary (.*?)/#", $row['upload_ss'], $match)) { $sql->db_Delete("rbinary", "binary_id='" . $tp->toDB($match[1]) . "'"); } else { if ($row['upload_ss'] && file_exists(e_FILE . "public/" . $row['upload_ss'])) { unlink(e_UPLOAD . $row['upload_ss']); } } $message = $sql->db_Delete("upload", "upload_id='" . intval($id) . "'") ? UPLLAN_1 : LAN_DELETED_FAILED; e107::getLog()->add('UPLOAD_01', $row['upload_file'], E_LOG_INFORMATIVE, ''); } if ($action == "dlm") { header("location: " . e_ADMIN . "download.php?dlm." . $id); exit; } if ($action == "news") { header("location: " . e_ADMIN . "newspost.php?create.upload." . $id); exit; } if ($action == "dl") { $id = str_replace("%20", " ", $id); if (preg_match("/Binary\\s(.*?)\\/.*/", $id, $result)) { $bid = $result[1]; $result = @mysql_query("SELECT * FROM " . MPREFIX . "rbinary WHERE binary_id='{$bid}' "); $binary_data = @mysql_result($result, 0, "binary_data");
if (!$_POST['count_num'][$idLim] && !$_POST['count_days'][$idLim] && !$_POST['bw_num'][$idLim] && !$_POST['bw_days'][$idLim]) { //All entries empty - Remove record if ($sql->db_Delete('generic', "gen_id = {$idLim}")) { $message .= $idLim . " - " . DOWLAN_119 . "<br/>"; e107::getLog()->add('DOWNL_11', 'ID: ' . $idLim, E_LOG_INFORMATIVE, ''); } else { $message .= $idLim . " - " . DOWLAN_120 . "<br/>"; } } else { $vals = array(); foreach (array('bw_num', 'bw_days', 'count_num', 'count_days') as $k => $lName) { $vals[$targetFields[$k + 1]] = intval($_POST[$lName][$idLim]); } $valString = implode(',', $vals); $sql->db_UpdateArray('generic', $vals, " WHERE gen_id = {$idLim}"); e107::getLog()->add('DOWNL_10', $idLim . ', ' . $valString, E_LOG_INFORMATIVE, ''); $message .= $idLim . " - " . DOWLAN_121 . "<br/>"; unset($vals); } } } new plugin_download_admin(); require_once e_ADMIN . "auth.php"; //download/includes/admin.php is auto-loaded. e107::getAdminUI()->runPage(); require_once e_ADMIN . "footer.php"; exit; /* if ($action == "mirror")
if (!isset($loginPrefs['new_news'])) { $loginPrefs['new_news'] = '0'; } if (!isset($loginPrefs['new_comments'])) { $loginPrefs['new_comments'] = '0'; } if (!isset($loginPrefs['new_members'])) { $loginPrefs['new_members'] = '0'; } $menuPref->reset(); foreach ($loginPrefs as $k => $v) { $menuPref->setPref('login_menu/' . $k, $v); } //$menuPref->setPref('login_menu', $loginPrefs); $menuPref->save(false, true, false); e107::getLog()->add('MISC_03', '', E_LOG_INFORMATIVE, ''); //$ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>'); $mes->addSuccess(LAN_SAVED); $ns->tablerender("", $mes->render() . $text); } if (!isset($loginPrefs['new_news'])) { // Assume no prefs defined $loginPrefs['new_news'] = '0'; $loginPrefs['new_comments'] = '0'; $loginPrefs['new_members'] = '0'; } $text = "\n\t<form method='post' action='" . e_SELF . "'>\n\t<table class='table adminform'>\n\t<colgroup span='2'>\n\t\t<col class='col-label' />\n\t\t<col class='col-control' />\n\t</colgroup>\n\t\n " . $loginClass->render_config_links() . "\n "; /* <tr> <td colspan="2">'.LAN_LOGINMENU_42.'</td> </tr>
function dboptions() { global $tp, $pref; $admin_log = e107::getLog(); $temp = array(); $temp['rss_othernews'] = $_POST['rss_othernews']; $temp['rss_summarydiz'] = $_POST['rss_summarydiz']; $temp['rss_shownewsimage'] = $_POST['rss_shownewsimage']; if ($admin_log->logArrayDiffs($temp, $pref, 'RSS_06')) { save_prefs(); // Only save if changes return LAN_SAVED; } else { return RSS_LAN_ADMIN_28; } }
/** * Send an email notification following an event. * * The email is sent via a common interface, which will send immediately for small numbers of recipients, and queue for larger. * * @param string $id - identifies event actions * @param string $subject - subject for email * @param string $message - email message body * @return void * * @todo handle 'everyone except' clauses (email address filter done) * @todo set up pref to not notify originator of event which caused notify (see $blockOriginator) */ function send($id, $subject, $message, $media = array()) { $tp = e107::getParser(); $sql = e107::getDb(); $subject = $tp->toEmail($subject); $message = $tp->replaceConstants($message, "full"); // $message = $tp->toEmail($message); $emailFilter = ''; $notifyTarget = $this->notify_prefs['event'][$id]['class']; if ($notifyTarget == '-email') { $emailFilter = $this->notify_prefs['event'][$id]['email']; } $blockOriginator = FALSE; // TODO: set this using a pref $recipients = array(); if ($notifyTarget == 'email') { if (!$blockOriginator || $this->notify_prefs['event'][$id]['email'] != USEREMAIL) { $recipients[] = array('mail_recipient_email' => $this->notify_prefs['event'][$id]['email'], 'mail_target_info' => array('SUBJECT' => $subject, 'DATE_SHORT' => $tp->toDate(time(), 'short'), 'DATE_LONG' => $tp->toDate(time(), 'long'))); } } elseif (is_numeric($notifyTarget)) { switch ($notifyTarget) { case e_UC_MAINADMIN: $qry = "`user_admin` = 1 AND `user_perms` = '0' AND `user_ban` = 0"; break; case e_UC_ADMIN: $qry = "`user_admin` = 1 AND `user_ban` = 0"; break; case e_UC_MEMBER: $qry = "`user_ban` = 0"; break; default: $qry = "user_ban = 0 AND user_class REGEXP '(^|,)(" . $notifyTarget . ")(,|\$)'"; break; } $qry = 'SELECT user_id,user_name,user_email,user_join,user_lastvisit FROM `#user` WHERE ' . $qry; if ($blockOriginator) { $qry .= ' AND `user_id` != ' . USERID; } if (false !== ($count = $sql->gen($qry))) { // Now add email addresses to the list while ($row = $sql->fetch(MYSQL_ASSOC)) { if ($row['user_email'] != $emailFilter) { $unsubscribe = array('date' => $row['user_join'], 'email' => $row['user_email'], 'id' => $row['user_id'], 'plugin' => 'user', 'userclass' => $notifyTarget); $urlQuery = http_build_query($unsubscribe, null, '&'); $exclude = array(e_UC_MEMBER, e_UC_ADMIN, e_UC_MAINADMIN); // no unsubscribing from these classes. $unsubUrl = SITEURL . "unsubscribe.php?id=" . base64_encode($urlQuery); $unsubMessage = "This message was sent to " . $row['user_email'] . ". If you don't want to receive these emails in the future, please <a href='" . $unsubUrl . "'>unsubscribe</a>."; $recipients[] = array('mail_recipient_id' => $row['user_id'], 'mail_recipient_name' => $row['user_name'], 'mail_recipient_email' => $row['user_email'], 'mail_target_info' => array('USERID' => $row['user_id'], 'DISPLAYNAME' => $row['user_name'], 'SUBJECT' => $subject, 'USERNAME' => $row['user_name'], 'USERLASTVISIT' => $row['user_lastvisit'], 'UNSUBSCRIBE' => !in_array($notifyTarget, $exclude) ? $unsubUrl : '', 'UNSUBSCRIBE_MESSAGE' => !in_array($notifyTarget, $exclude) ? $unsubMessage : '', 'USERCLASS' => $notifyTarget, 'DATE_SHORT' => $tp->toDate(time(), 'short'), 'DATE_LONG' => $tp->toDate(time(), 'long'))); } } } } if (E107_DEBUG_LEVEL > 0) { $data = array('id' => $id, 'subject' => $subject, 'recipients' => $recipients, 'prefs' => $this->notify_prefs['event'][$id], 'message' => $message); e107::getMessage()->addDebug("<b>Mailing is simulated only while in DEBUG mode.</b>"); e107::getMessage()->addDebug(print_a($data, true)); e107::getLog()->add('Notify Debug', $data, E_LOG_INFORMATIVE, "NOTIFY_DBG"); return; } $siteadminemail = e107::getPref('siteadminemail'); $siteadmin = e107::getPref('siteadmin'); if (count($recipients)) { require_once e_HANDLER . 'mail_manager_class.php'; $mailer = new e107MailManager(); // Create the mail body $mailData = array('mail_total_count' => count($recipients), 'mail_content_status' => MAIL_STATUS_TEMP, 'mail_create_app' => 'core', 'mail_title' => 'NOTIFY', 'mail_subject' => $subject, 'mail_sender_email' => e107::getPref('replyto_email', $siteadminemail), 'mail_sender_name' => e107::getPref('replyto_name', $siteadmin), 'mail_notify_complete' => 0, 'mail_body' => $message, 'template' => 'notify', 'mail_send_style' => 'notify'); if (!empty($media) && is_array($media)) { foreach ($media as $k => $v) { $mailData['mail_media'][$k] = array('path' => $v); } } $result = $mailer->sendEmails('notify', $mailData, $recipients); e107::getLog()->e_log_event(10, -1, 'NOTIFY', $subject, $message, FALSE, LOG_TO_ROLLING); } else { $data = array('qry' => $qry, 'error' => 'No recipients'); e107::getLog()->add('Notify Debug', $data, E_LOG_WARNING_, "NOTIFY_DBG"); } }