} elseif (file_exists(THEME . 'images/bullet2.gif')) { $bullet = '<img src="' . THEME_ABS . 'images/bullet2.gif" alt="" class="icon" />'; } return $bullet; } } } if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] != '') { if (!USER && !$pref['anon_post']) { // disallow post } else { $nick = trim(preg_replace("#\\[.*\\]#si", "", $tp->toDB($_POST['nick']))); $cmessage = $_POST['cmessage']; $cmessage = preg_replace("#\\[.*?\\](.*?)\\[/.*?\\]#s", "\\1", $cmessage); $fp = new floodprotect(); if ($fp->flood("chatbox", "cb_datestamp")) { if (strlen(trim($cmessage)) < 1000 && trim($cmessage) != "") { $cmessage = $tp->toDB($cmessage); if ($sql->select("chatbox", "*", "cb_message='{$cmessage}' AND cb_datestamp+84600>" . time())) { $emessage = CHATBOX_L17; } else { $datestamp = time(); $ip = e107::getIPHandler()->getIP(FALSE); if (USER) { $nick = USERID . "." . USERNAME; $sql->db_Update("user", "user_chats=user_chats+1, user_lastpost='" . time() . "' WHERE user_id='" . USERID . "' "); } else { if (!$nick) { $nick = "0.Anonymous"; } else { if ($sql->select("user", "*", "user_name='{$nick}' ")) {
} require_once "class2.php"; include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_' . e_PAGE); require_once HEADERF; if (!isset($pref['subnews_class'])) { $pref['subnews_class'] = e_UC_MEMBER; } if (!check_class($pref['subnews_class'])) { $ns->tablerender(LAN_UI_403_TITLE_ERROR, LAN_UI_403_BODY_ERROR); require_once FOOTERF; exit; } if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item']) { $ip = e107::getIPHandler()->getIP(FALSE); $fp = new floodprotect(); if ($fp->flood("submitnews", "submitnews_datestamp") == FALSE) { header("location:" . e_BASE . "index.php"); exit; } $submitnews_user = USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name'])); $submitnews_email = USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email']))); $submitnews_title = $tp->toDB($_POST['submitnews_title']); $submitnews_item = $tp->toDB($_POST['submitnews_item']); $submitnews_item = str_replace("src="e107_images", "src="" . SITEURL . "e107_images", $submitnews_item); $submitnews_file = ""; $submitnews_error = FALSE; if (!$submitnews_user || !$submitnews_email) { $message = SUBNEWSLAN_7; $submitnews_error = TRUE; } // ==== Process File Upload ====
if (deftrue('BOOTSTRAP')) { e107::getMessage()->addError(implode('<br />', $temp)); } else { message_handler('P_ALERT', implode('<br />', $extraErrors)); // Workaround for image-code errors. } } // ========== End of verification.. ============== // If no errors, we can enter the new member in the DB // At this point we have two data arrays: // $allData['data'] - the 'core' user data // $eufVals['data'] - any extended user fields if (!$error) { $error_message = ''; $fp = new floodprotect(); if ($fp->flood("user", "user_join") == FALSE) { header("location:" . e_BASE . "index.php"); exit; } if ($_POST['email'] && $sql->select("user", "*", "user_email='" . $_POST['email'] . "' AND user_ban='" . USER_BANNED . "'")) { exit; } $u_key = e_user_model::randomKey(); // Key for signup completion $allData['data']['user_sess'] = $u_key; // Validation key $userMethods->userClassUpdate($allData['data'], 'usersup'); if ($pref['user_reg_veri']) { $allData['data']['user_ban'] = USER_REGISTERED_NOT_VALIDATED; } else { $allData['data']['user_ban'] = USER_VALIDATED;
/** * Insert a new thread or a reply/quoted reply. */ function insertPost() { $postInfo = array(); $threadInfo = array(); $threadOptions = array(); $fp = new floodprotect(); if (isset($_POST['newthread']) && trim($_POST['subject']) == '' || trim($_POST['post']) == '') { message_handler('ALERT', 5); } else { if ($fp->flood('forum_thread', 'thread_datestamp') == false && !ADMIN) { echo "<script type='text/javascript'>document.location.href='" . e_BASE . "index.php'</script>\n"; exit; } $hasPoll = $this->action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != ''; if (USER) { $postInfo['post_user'] = USERID; $threadInfo['thread_lastuser'] = USERID; $threadInfo['thread_user'] = USERID; $threadInfo['thread_lastuser_anon'] = ''; } else { $postInfo['post_user_anon'] = $_POST['anonname']; $threadInfo['thread_lastuser_anon'] = $_POST['anonname']; $threadInfo['thread_user_anon'] = $_POST['anonname']; } $time = time(); $postInfo['post_entry'] = $_POST['post']; $postInfo['post_forum'] = $this->data['forum_id']; $postInfo['post_datestamp'] = $time; $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE); $threadInfo['thread_lastpost'] = $time; if (isset($_POST['no_emote'])) { $postInfo['post_options'] = serialize(array('no_emote' => 1)); } //If we've successfully uploaded something, we'll have to edit the post_entry and post_attachments $newValues = array(); if ($uploadResult = $this->processAttachments()) { foreach ($uploadResult as $ur) { //$postInfo['post_entry'] .= $ur['txt']; // $_tmp = $ur['type'].'*'.$ur['file']; // if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; } // if($ur['fname']) { $_tmp .= '*'.$ur['fname']; } $type = $ur['type']; $newValues[$type][] = $ur['file']; // $attachments[] = $_tmp; } // $postInfo['_FIELD_TYPES']['post_attachments'] = 'array'; $postInfo['post_attachments'] = e107::serialize($newValues); //FIXME XXX - broken encoding when saved to DB. } // var_dump($uploadResult); switch ($this->action) { // Reply only. Add the post, update thread record with latest post info. // Update forum with latest post info case 'rp': $postInfo['post_thread'] = $this->id; $newPostId = $this->forumObj->postAdd($postInfo); break; // New thread started. Add the thread info (with lastest post info), add the post. // Update forum with latest post info // New thread started. Add the thread info (with lastest post info), add the post. // Update forum with latest post info case 'nt': $threadInfo['thread_sticky'] = MODERATOR ? (int) $_POST['threadtype'] : 0; $threadInfo['thread_name'] = $_POST['subject']; $threadInfo['thread_forum_id'] = $this->id; $threadInfo['thread_active'] = 1; $threadInfo['thread_datestamp'] = $time; if ($hasPoll) { $threadOptions['poll'] = '1'; } if (is_array($threadOptions) && count($threadOptions)) { $threadInfo['thread_options'] = serialize($threadOptions); } else { $threadInfo['thread_options'] = ''; } if ($postResult = $this->forumObj->threadAdd($threadInfo, $postInfo)) { $newPostId = $postResult['postid']; $newThreadId = $postResult['threadid']; $this->data['thread_id'] = $newThreadId; // $this->data['thread_sef'] = $postResult['threadsef']; $this->data['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'], 'dashl'); if ($_POST['email_notify']) { $this->forumObj->track('add', USERID, $newThreadId); } } break; } e107::getMessage()->addDebug(print_a($postInfo, true)); // e107::getMessage()->addDebug(print_a($this,true)); if ($postResult === -1 || $newPostId === -1) { require_once HEADERF; $message = LAN_FORUM_3006 . "<br ><a class='btn btn-default' href='" . $_SERVER['HTTP_REFERER'] . "'>Return</a>"; $text = e107::getMessage()->addError($message)->render(); e107::getRender()->tablerender(LAN_PLUGIN_FORUM_NAME, $text); // change to forum-title pref. require_once FOOTERF; exit; } $threadId = $this->action == 'nt' ? $newThreadId : $this->id; //If a poll was submitted, let's add it to the poll db if ($this->action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != '') { require_once e_PLUGIN . 'poll/poll_class.php'; $_POST['iid'] = $threadId; $poll = new poll(); $poll->submit_poll(2); } e107::getCache()->clear('newforumposts'); // $postInfo = $this->forumObj->postGet($newPostId, 'post'); // $forumInfo = $this->forumObj->forumGet($postInfo['post_forum']); // $threadLink = e107::getUrl()->create('forum/thread/last', $postInfo); // $forumLink = e107::getUrl()->create('forum/forum/view', $forumInfo); $threadLink = e107::url('forum', 'topic', $this->data, 'full') . "&last=1"; $forumLink = e107::url('forum', 'forum', $this->data); if ($this->forumObj->prefs->get('redirect')) { $this->redirect($threadLink); // header('location:'.e107::getUrl()->create('forum/thread/last', $postInfo, array('encode' => false, 'full' => true))); exit; } else { require_once HEADERF; $template = $this->getTemplate('posted'); $SHORTCODES = array('THREADLINK' => $threadLink, 'FORUMLINK' => $forumLink); $txt = isset($_POST['newthread']) ? $template['thread'] : $template['reply']; $txt = e107::getParser()->parseTemplate($txt, true, $SHORTCODES); e107::getRender()->tablerender('Forums', e107::getMessage()->render() . $txt); require_once FOOTERF; exit; } } }
} else { if ($action == 'quote') { $action = 'reply'; $eaction = false; } } } if (isset($_POST['newthread']) || isset($_POST['reply'])) { $postInfo = array(); $threadInfo = array(); $postOptions = array(); $threadOptions = array(); if (isset($_POST['newthread']) && trim($_POST['subject']) == '' || trim($_POST['post']) == '') { message_handler('ALERT', 5); } else { if ($fp->flood('forum_thread', 'thread_datestamp') == false && !ADMIN) { echo "<script type='text/javascript'>document.location.href='" . e_BASE . "index.php'</script>\n"; exit; } $hasPoll = $action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != ''; $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE); if (USER) { $postInfo['post_user'] = USERID; $threadInfo['thread_lastuser'] = USERID; $threadInfo['thread_user'] = USERID; $threadInfo['thread_lastuser_anon'] = ''; } else { $postInfo['post_user_anon'] = $_POST['anonname']; $threadInfo['thread_lastuser_anon'] = $_POST['anonname']; $threadInfo['thread_user_anon'] = $_POST['anonname']; }