public static function is_loggedin() { $username = Session::val('username'); if (isset($username)) { $v = true; } else { $v = false; } return $v; }
/** * @param PageBuilder $pageBuilder * @return ContactsPanel */ function CNewMessagePanel(&$pagebuilder) { $this->Type = Post::val('mtype', 'mes'); $this->To = ''; $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $this->From = $this->_getFromEmail(); $this->_pagebuilder->_top->AddOnResize('ResizeElements(\'all\');'); if ($this->_proc->account->AllowDhtmlEditor) { $editorResize = 'HTMLEditor.Resize(width - 1, height - 2);'; $editorReplace = 'HTMLEditor.Replace();'; } else { $editorResize = ' plainEditor.style.height = (height - 1) + "px"; plainEditor.style.width = (width - 2) + "px"; '; $editorReplace = ''; } $this->inputs = ''; $contacts = null; if (Post::has('contacts') && is_array(Post::val('contacts'))) { $contactsArray = array_keys(Post::val('contacts')); $contacts =& $this->_proc->db->LoadContactsById($contactsArray); } if (Post::has('groupid')) { $group =& $this->_proc->db->SelectGroupById(Post::val('groupid', -1)); $contacts =& $this->_proc->db->SelectAddressGroupContacts(Post::val('groupid', -1)); } if ($contacts) { foreach ($contacts->Instance() as $contact) { if (!$contact->Email) { continue; } $this->To .= $contact->Name ? '"' . $contact->Name . '" <' . $contact->Email . '>, ' : $contact->Email . ','; } $this->To = trim(trim($this->To), ','); } if (Post::has('mailto')) { $this->To = Post::val('mailto', ''); } if (Get::has('to')) { $this->To = (string) trim(Get::val('to', '')); } $message = null; $isHtml = $this->_proc->account->AllowDhtmlEditor; $this->attacmentsHtml = ''; $this->_pagebuilder->AddJSText(' var bcc, bcc_mode, bcc_mode_switcher; var plainCont = null; var plainEditor = null; var HTMLEditor = null; var EditAreaUrl = "edit-area.php"; var prevWidth = 0; var prevHeight = 0; var rowIndex = 0; function ResizeElements(mode) { var width = GetWidth(); if (width < 684) width = 684; width = width - 40; var height = Math.ceil(width/3); if (prevWidth != width && prevHeight != height) { prevWidth = width; prevHeight = height; if (plainCont != null) { plainCont.style.height = height + "px"; plainCont.style.width = width + "px"; ' . $editorResize . ' } } } function WriteEmails(str, field) { var mailInput; if (field == 2) { mailInput = document.getElementById("toCC"); } else if (field == 3) { mailInput = document.getElementById("toBCC"); } else { mailInput = document.getElementById("toemail"); } if (mailInput) { mailInput.value = (mailInput.value == "") ? str : mailInput.value + ", " + str; mailInput.focus(); } } function LoadAttachmentHandler(attachObj) { var attachtable = document.getElementById("attachmentTable"); if (attachObj) { var imageLink = GetFileParams(attachObj.FileName); var tr = attachtable.insertRow(rowIndex++); tr.id = "tr_" + attachObj.TempName; var td = tr.insertCell(0); td.className = "wm_attachment"; var innerHtml = \'<img src="./images/icons/\' + imageLink.image + \'" />\'; innerHtml += \'<input type="hidden" name="attachments[\' + attachObj.TempName + \']" value="\' + attachObj.FileName + \'">\'; innerHtml += HtmlEncode(attachObj.FileName) + \' (\' + GetFriendlySize(attachObj.Size) + \') <a href="#" id="\' + attachObj.TempName + \'" onclick="return DeleteAttach(this.id);">' . JS_LANG_Delete . '</a>\'; td.innerHTML = innerHtml; } } function ChangeBCCMode() { if (bcc_mode == "hide") { bcc_mode = "show"; bcc.className = ""; bcc_mode_switcher.innerHTML = Lang.HideBCC; } else { bcc_mode = "hide"; bcc.className = "wm_hide"; bcc_mode_switcher.innerHTML = Lang.ShowBCC; } ' . $editorReplace . ' return false; } function UpdateIdUid(id, uid) { var idf = document.getElementById("m_id"); var uidf = document.getElementById("m_uid"); if (idf && uidf) { idf.value = id; uidf.value = uid; } } var Rep_m, Err_m; var hiddensaveiframe; var pop3Pr = ' . ($pagebuilder->_proc->account->MailProtocol == MAILPROTOCOL_POP3 ? 'true' : 'false') . '; function DoSaveButton() { if (pop3Pr) { if (!hiddensaveiframe) { hiddensaveiframe = CreateChildWithAttrs(document.body, "iframe", [["name", "hiddensaveiframe"], ["class", "wm_hide"]]); } } var form = document.getElementById("messageForm"); form.action = "' . ACTIONFILE . '?action=save&req=message"; form.target = (pop3Pr) ? "hiddensaveiframe" : ""; if (submitSaveMessage()) { form.submit(); } } function DoSendButton() { var toemail = document.getElementById("toemail"); var ccemail = document.getElementById("toCC"); var bccemail = document.getElementById("toBCC"); var subject = document.getElementById("subject"); var mailIsCorrect = false; if ((toemail && toemail.value.length > 3) || (ccemail && ccemail.value.length > 3) || (bccemail && bccemail.value.length > 3)) { mailIsCorrect = true; } if (mailIsCorrect) { if (subject && subject.value.length < 1 && !confirm(Lang.ConfirmEmptySubject)) { return false; } var form = document.getElementById("messageForm"); form.action = "' . ACTIONFILE . '?action=send&req=message"; form.target = ""; if (submitSaveMessage()) { form.submit(); } } else { alert(Lang.WarningToBlank); } } function DeleteAttach(idline) { var trtable = document.getElementById("tr_" + idline); if (trtable) { trtable.className = "wm_hide"; CleanNode(trtable); } return false; } function ShowPictures() { var showPictureTable = document.getElementById("showpicturestable"); if (HTMLEditor) { var temp = HTMLEditor.GetText().ReplaceStr("wmx_src", "src"); temp = temp.ReplaceStr("wmx_background", "background"); HTMLEditor.SetHtml(temp); if (showPictureTable) { showPictureTable.className = "wm_hide"; } HTMLEditor.Replace(); } } '); $this->_pagebuilder->AddInitText(' bcc_mode = "hide"; bcc = document.getElementById("bcc"); bcc_mode_switcher = document.getElementById("bcc_mode_switcher"); plainEditor = document.getElementById("editor_area"); plainCont = document.getElementById("editor_cont"); Rep_m = new CReport("Rep_m"); Rep_m.Build(); Err_m = new CError("Err_m", "' . ConvertUtils::ClearJavaScriptString($this->_pagebuilder->SkinName(), '"') . '"); Err_m.Build(); '); $m_id = -1; $m_uid = ''; if (Post::has('m_id')) { $mes_id = Post::val('m_id'); $mes_uid = Post::val('m_uid'); $folder_id = Post::val('f_id'); $folder_name = Post::val('f_name'); $folder_name = 'defaultname'; $mes_charset = Post::val('charset', -1); $message = new GetMessageBase($this->_proc->account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); $m_id = (int) $mes_id; $m_uid = $mes_uid; } $this->inputs = '<input type="hidden" id="m_id" name="m_id" value="' . ConvertUtils::AttributeQuote($m_id) . '"><input type="hidden" id="m_uid" name="m_uid" value="' . ConvertUtils::AttributeQuote($m_uid) . '">'; $withSignature = false; switch ($this->_proc->account->SignatureOptions) { case SIGNATURE_OPTION_AddToAll: $withSignature = true; break; case SIGNATURE_OPTION_AddToNewOnly: $withSignature = $this->Type == 'mes'; break; default: case SIGNATURE_OPTION_DontAdd: $withSignature = false; break; } if ($message) { if ($this->Type != 'forward' && $this->Type != 'reply' && $this->Type != 'replytoall') { $withSignature = false; } $this->_pagebuilder->AddInitText('SetPriority(' . $message->msg->GetPriorityStatus() . ');'); switch ($this->Type) { default: $this->To = $message->PrintTo(true); $this->CC = $message->PrintCC(true); $this->BCC = ''; $this->Subject = $message->PrintSubject(true); break; case 'forward': $this->To = ''; $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Fwd . ': ' . $message->PrintSubject(true); break; case 'reply': $replyto = trim($message->PrintReplyTo(true)); $this->To = strlen($replyto) > 0 ? $replyto : $message->PrintFrom(true); $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true); break; case 'replytoall': $emailCollection =& $message->msg->GetAllRecipients(false, true); $temp = ''; if ($emailCollection) { foreach ($emailCollection->Instance() as $value) { $email =& $value; if ($email->Email != $this->_proc->account->Email) { $temp .= $email->Email . ', '; } } } $this->To = trim(trim($temp), ','); $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true); break; } if ($this->_proc->account->AllowDhtmlEditor) { switch ($this->Type) { case 'forward': case 'reply': case 'replytoall': if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $this->isSafety = false; } } else { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true)); } break; default: if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) { if ($message->msg->HasHtmlText()) { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetCensoredHtmlWithImageLinks(true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $this->isSafety = false; } } elseif ($message->msg->HasPlainText()) { $isHtml = false; $this->Body = $message->msg->GetNotCensoredTextBody(true); } } else { if ($message->msg->HasHtmlText()) { $isHtml = true; $this->Body = $message->msg->GetCensoredHtmlWithImageLinks(true); } elseif ($message->msg->HasPlainText()) { $isHtml = false; $this->Body = $message->msg->GetNotCensoredTextBody(true); } } break; } } else { $isHtml = false; switch ($this->Type) { case 'forward': case 'reply': case 'replytoall': $this->Body = $message->msg->GetRelpyAsPlain(true); break; default: $this->Body = $message->msg->GetNotCensoredTextBody(true); break; } } if ($message->HasAttachments() && $this->Type != 'reply' && $this->Type != 'replytoall') { $attachments =& $message->msg->Attachments; if ($attachments != null && $attachments->Count() > 0) { foreach (array_keys($attachments->Instance()) as $key) { $attachment =& $attachments->Get($key); $tempname = $message->msg->IdMsg . '-' . $key . '_' . $attachment->GetTempName(); //$filename = ConvertUtils::ConvertEncoding($attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $message->account->GetUserCharset()); $filename = ConvertUtils::WMHtmlSpecialChars($attachment->GetFilenameFromMime()); $filesize = GetFriendlySize(strlen($attachment->MimePart->GetBinaryBody())); $fs =& new FileSystem(INI_DIR . '/temp', $message->account->Email, $message->account->Id); $attfolder =& new Folder($message->account->Id, -1, Session::val('attachtempdir', md5(session_id()))); $fs->SaveAttach($attachment, $attfolder, $tempname); $this->attacmentsHtml .= ' <tr id="tr_' . ConvertUtils::AttributeQuote($tempname) . '"><td class="wm_attachment"><img src="./images/icons/' . GetAttachImg($filename) . '" /> <input type="hidden" name="attachments[' . ConvertUtils::AttributeQuote($tempname) . ']" value="' . ConvertUtils::AttributeQuote($filename) . '"> ' . $filename . ' (' . $filesize . ') <a href="#" id="' . ConvertUtils::AttributeQuote($tempname) . '" onClick="return DeleteAttach(this.id);">' . JS_LANG_Delete . '</a></td></tr>'; } } } } else { $this->_pagebuilder->AddInitText('SetPriority(3);'); } $signature = ''; if ($withSignature) { if ($this->_proc->account->AllowDhtmlEditor) { $signature = $this->_proc->account->SignatureType == 0 ? nl2br($this->_proc->account->Signature) : $this->_proc->account->Signature; $signature = $isHtml ? $signature : strip_tags(nl2br($signature)); } else { $signature = $this->_proc->account->SignatureType == 0 ? strip_tags($this->_proc->account->Signature) : strip_tags($this->_proc->account->Signature); } } $this->Body = $signature . $this->Body; if ($this->_proc->account->AllowDhtmlEditor) { $this->_pagebuilder->AddJSFile('class.html-editor.js'); $setText = $isHtml ? 'HTMLEditor.SetHtml(mess);' : 'HTMLEditor.SetText(mess);'; $this->_pagebuilder->AddJSText(' function submitSaveMessage() { var hiddenkey = document.getElementById("ishtml"); if (HTMLEditor._htmlMode) { plainEditor.value = HTMLEditor.GetText(); hiddenkey.value = "1"; } else { hiddenkey.value = "0"; } if (bcc_mode == "hide") { document.getElementById("toBCC").value = ""; } return true; } function EditAreaLoadHandler() { HTMLEditor.LoadEditArea(); } function CreateLinkHandler(url) { HTMLEditor.CreateLinkFromWindow(url); } function DesignModeOnHandler(rer) { HTMLEditor.Show(); var mess = "' . ConvertUtils::ReBuildStringToJavaScript($this->Body, '"') . '"; if (mess.length == 0) { mess = "<br />"; } ' . $setText . ' } '); $this->_pagebuilder->AddInitText(' HTMLEditor = new CHtmlEditorField(true); HTMLEditor.SetPlainEditor(plainEditor, document.getElementById("mode_switcher")); HTMLEditor.Show();'); } else { $this->_pagebuilder->AddJSText(' function submitSaveMessage() { var hiddenkey = document.getElementById("ishtml"); hiddenkey.value = "0"; if (bcc_mode == "hide") { document.getElementById("toBCC").value = ""; } return true; } '); } }
/** * @return BaseProcessor */ function BaseProcessor() { if (!Session::has(ACCOUNT_ID)) { $this->SetError(1); } $accountId = Session::val(ACCOUNT_ID); $this->sArray = Session::val(SARRAY, array()); $this->settings =& Settings::CreateInstance(); if (!$this->settings || !$this->settings->isLoad) { $this->SetError(3); } if ($accountId) { if (Get::has(CHANGE_ACCID)) { $oldaccount =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1)); $accountId = Get::val(CHANGE_ACCID); if (!isset($_SESSION['attachtempdir'])) { $_SESSION['attachtempdir'] = md5(session_id()); } $fs =& new FileSystem(INI_DIR . '/temp', $oldaccount->Email, $oldaccount->Id); $attfolder =& new Folder($oldaccount->Id, -1, $_SESSION['attachtempdir']); $fs->DeleteDir($attfolder); unset($fs, $attfolder); $this->sArray[ACCOUNT_ID] = $accountId; $this->account =& Account::LoadFromDb($accountId); if (!$this->account || $this->account->IdUser != $oldaccount->IdUser) { $this->account = null; } else { $_SESSION[ACCOUNT_ID] = $accountId; unset($_SESSION[SARRAY]); $this->sArray = array(); } } else { $this->sArray[ACCOUNT_ID] = $accountId; $this->account =& Account::LoadFromDb($accountId); } if (!$this->account) { $this->SetError(2); } } else { $this->SetError(1); } if (!isset($this->sArray[ACCOUNT_ID]) || $this->sArray[ACCOUNT_ID] != $accountId) { $this->sArray[EDIT_ACCOUNT_ID] = $accountId; } $this->processor =& new MailProcessor($this->account); if (!$this->processor->DbStorage || !$this->processor->DbStorage->Connect()) { $this->SetError(5); } $this->db =& $this->processor->DbStorage; $this->accounts =& $this->GetAccounts(); $skins =& FileSystem::GetSkinsList(); $hasDefSettingsSkin = false; $normalSkin = false; foreach ($skins as $skinName) { if ($skinName == $this->settings->DefaultSkin) { $hasDefSettingsSkin = true; } if ($skinName == $this->account->DefaultSkin) { $normalSkin = true; break; } } if (!$normalSkin) { $this->account->DefaultSkin = $hasDefSettingsSkin ? $this->settings->DefaultSkin : ($this->account->DefaultSkin = $skins[0]); } $_SESSION[ATTACH_DIR] = Session::val(ATTACH_DIR, md5(session_id())); if (isset($this->sArray[SCREEN])) { $screen = Get::val(SCREEN, $this->sArray[SCREEN]); $this->sArray[SCREEN] = $screen; if ($this->account->AllowChangeSettings == false && ($screen == SET_ACCOUNT_PROF || $screen == SET_ACCOUNT_ADDACC)) { $this->sArray[SCREEN] = SCREEN_MAILBOX; } if (!$this->settings->AllowContacts && $screen == SCREEN_CONTACTS) { $this->sArray[SCREEN] = SCREEN_MAILBOX; } } else { $this->sArray[SCREEN] = Get::val(SCREEN, SCREEN_MAILBOX); } if (isset($this->sArray[FOLDER_ID])) { $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, $this->sArray[FOLDER_ID]); } else { $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, -1); } if (Get::has(FOLDER_ID) || Get::has(SCREEN)) { if (isset($this->sArray[SEARCH_ARRAY])) { unset($this->sArray[SEARCH_ARRAY]); } } if (Session::has(GOTOFOLDER)) { $this->sArray[GOTOFOLDER] = Session::val(GOTOFOLDER, ''); unset($_SESSION[GOTOFOLDER]); } if (isset($this->sArray[PAGE])) { $this->sArray[PAGE] = Get::val(PAGE, $this->sArray[PAGE]); } else { $this->sArray[PAGE] = 1; } if (Get::has(S_GETMODE)) { $this->sArray[SEARCH_ARRAY][S_TEXT] = Get::val(S_GETMODE, 'mini') == 'mini' ? Post::val('smallLookFor', '') : Post::val('bigLookFor', ''); if (!empty($this->sArray[SEARCH_ARRAY][S_TEXT])) { $this->sArray[SEARCH_ARRAY][S_FOLDER] = Post::val('qfolder', -2); $this->sArray[SEARCH_ARRAY][S_MODE] = Post::val('qmmode', 'onlyheaders'); $this->sArray[FOLDER_ID] = $this->sArray[SEARCH_ARRAY][S_FOLDER]; $this->sArray[PAGE] = 1; } else { if (Post::val('qfolder', -2) < 1) { $this->sArray[FOLDER_ID] = -1; } unset($this->sArray[SEARCH_ARRAY]); $this->sArray[PAGE] = 1; } } if (Get::has(S_GETMODECONTACT)) { $this->sArray[SEARCH_ARRAY][S_TEXT] = Get::val(S_GETMODECONTACT, 'mini') == 'mini' ? Post::val('smallLookFor', '') : Post::val('bigLookFor', ''); $this->sArray[CONTACT_ID] = Post::val(CONTACT_ID, -1); $this->sArray[CONTACT_PAGE] = 1; } if (isset($this->sArray[SEARCH_ARRAY][S_FOLDER])) { $this->sArray[FOLDER_ID] = $this->sArray[SEARCH_ARRAY][S_FOLDER]; } if (isset($this->sArray[EDIT_ACCOUNT_ID])) { $this->sArray[EDIT_ACCOUNT_ID] = Get::val(EDIT_ACCOUNT_ID, $this->sArray[EDIT_ACCOUNT_ID]); } else { $this->sArray[EDIT_ACCOUNT_ID] = $accountId; } if (Get::has(EDIT_ACCOUNT_ID)) { $this->sArray[SCREEN] = $this->sArray[SCREEN] == SET_ACCOUNT_ADDACC ? SET_ACCOUNT_PROF : $this->sArray[SCREEN]; } $this->sArray[CONTACT_PAGE] = isset($this->sArray[CONTACT_PAGE]) ? Get::val(CONTACT_PAGE, $this->sArray[CONTACT_PAGE]) : Get::val(CONTACT_PAGE, 1); $this->sArray[CONTACT_ORD] = isset($this->sArray[CONTACT_ORD]) ? Get::val(CONTACT_ORD, $this->sArray[CONTACT_ORD]) : Get::val(CONTACT_ORD, 0); if (isset($this->sArray[CONTACT_FLD])) { if (Get::val(CONTACT_FLD, $this->sArray[CONTACT_FLD]) != $this->sArray[CONTACT_FLD]) { $this->sArray[CONTACT_ORD] = 0; } $this->sArray[CONTACT_FLD] = Get::val(CONTACT_FLD, $this->sArray[CONTACT_FLD]); } else { $this->sArray[CONTACT_FLD] = Get::val(CONTACT_FLD, 0); } if (isset($_COOKIE['wm_vert_resizer']) || isset($_COOKIE['wm_horiz_resizer']) || isset($_COOKIE['wm_hide_folders'])) { if (isset($_COOKIE['wm_vert_resizer']) && strlen($_COOKIE['wm_vert_resizer']) > 0) { $this->account->VertResizer = (int) $_COOKIE['wm_vert_resizer']; setcookie('wm_vert_resizer', '0', time() - 24 * 3600); } if (isset($_COOKIE['wm_horiz_resizer']) && strlen($_COOKIE['wm_horiz_resizer']) > 0) { $this->account->HorizResizer = (int) $_COOKIE['wm_horiz_resizer']; setcookie('wm_horiz_resizer', '0', time() - 24 * 3600); } if (isset($_COOKIE['wm_hide_folders']) && strlen($_COOKIE['wm_hide_folders']) > 0) { $this->account->HideFolders = (bool) $_COOKIE['wm_hide_folders']; setcookie('wm_hide_folders', '0', time() - 24 * 3600); } $this->account->Update(); } $this->FillData(); $this->UpdateSession(); }
//clean up first $title = Typo::cleanX($_POST['title']); $content = Typo::cleanX($_POST['content']); if (!isset($_POST['title']) || $_POST['title'] == "") { $alertred[] = TITLE_CANNOT_EMPTY; } if (isset($alertred)) { $data['alertred'] = $alertred; } else { if (!isset($_POST['date']) || $_POST['date'] == "") { # code... $date = date("Y-m-d H:i:s"); } else { $date = $_POST['date']; } $vars = array('title' => $title, 'content' => $content, 'date' => $date, 'type' => 'page', 'author' => Session::val('username'), 'status' => Typo::int($_POST['status'])); //print_r($vars); Posts::insert($vars); $data['alertgreen'][] = PAGE . " {$_POST['title']} " . MSG_PAGE_ADDED; Token::remove($_POST['token']); } break; default: # code... //System::inc('pages_form', $data); break; } Theme::admin('header', $data); System::inc('pages_form', $data); Theme::admin('footer'); break;
$settings =& Settings::CreateInstance(); if (!$settings || !$settings->isLoad) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=3");</script>'); } elseif (!$settings->IncludeLang()) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=6");</script>'); } require_once WM_ROOTPATH . 'class_account.php'; require_once WM_ROOTPATH . 'classic/base_defines.php'; require_once WM_ROOTPATH . 'common/class_log.php'; require_once WM_ROOTPATH . 'classic/class_getmessagebase.php'; $log =& CLog::CreateInstance(); if (!Session::has(ACCOUNT_ID)) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=1");</script>'); } $_SESSION['attachtempdir'] = Session::val('attachtempdir', md5(session_id())); $account =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1)); if (!$account) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=2");</script>'); } $isNull = false; $mes_id = Get::val('msg_id', ''); $mes_uid = Get::val('msg_uid', ''); $folder_id = Get::val('folder_id', ''); $folder_name = Get::val('folder_fname', ''); $mes_charset = Get::val('charset', -1); if ($mes_uid) { $message =& new GetMessageBase($account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); if (!$message->msg) { $isNull = true; } } else {
/** * Database Insertion Function. * This will insert value on the SQL Table during the installation. * * @author Puguh Wijayanto (www.metalgenix.com) * @since 0.0.1 */ public static function insertData() { require_once GX_PATH . '/inc/config/config.php'; $db = new Db(); $url = Session::val('siteurl'); $domain = Session::val('sitedomain'); $sitename = Session::val('sitename'); $slogan = Session::val('siteslogan'); $options = "INSERT INTO `options` (`id`, `name`, `value`) VALUES\n (null, 'sitename', '{$sitename}'),\n (null, 'siteurl', '{$url}'),\n (null, 'sitedomain', '{$domain}'),\n (null, 'siteslogan', '{$slogan}'),\n (null, 'sitedesc', 'Descriptions'),\n (null, 'sitekeywords', 'keywords'),\n (null, 'siteicon', 'favicon.ico'),\n (null, 'siteaddress', ''),\n (null, 'siteemail', ''),\n (null, 'fbacc', ''),\n (null, 'fbpage', ''),\n (null, 'twitter', ''),\n (null, 'linkedin', ''),\n (null, 'gplus', ''),\n (null, 'logo', '/assets/images/genixcms-logo-small.png'),\n (null, 'logourl', ''),\n (null, 'is_logourl', 'off'),\n (null, 'currency', 'USD'),\n (null, 'country_id', 'ID'),\n (null, 'mailtype', '0'),\n (null, 'smtphost', ''),\n (null, 'smtpuser', ''),\n (null, 'smtppass', ''),\n (null, 'smtpport', '25'),\n (null, 'timezone', 'Asia/Jakarta'),\n (null, 'paypalemail', ''),\n (null, 'robots', 'index, follow'),\n (null, 'use_jquery', 'on'),\n (null, 'use_bootstrap', 'on'),\n (null, 'use_fontawesome', 'on'),\n (null, 'use_bsvalidator', 'on'),\n (null, 'jquery_v', '1.11.1'),\n (null, 'bs_v', ''),\n (null, 'fontawesome_v', ''),\n (null, 'use_editor', 'on'),\n (null, 'editor_type', 'summernote'),\n (null, 'editor_v', ''),\n (null, 'menus', '{\"mainmenu\":{\"name\":\"Main Menu\",\"class\":\"\",\"menu\":[]},\"footer\":{\"name\":\"Footer Menu\",\"class\":\"\",\"menu\":[{\"parent\":\"\",\"menuid\":\"footer\",\"type\":\"custom\",\"value\":\"{$url}\"},{\"parent\":\"\",\"menuid\":\"footer\",\"type\":\"cat\",\"value\":\"1\"}]}}'),\n (null, 'post_perpage', '3'),\n (null, 'pagination', 'pager'),\n (null, 'pinger', 'rpc.pingomatic.com\r\nblogsearch.google.com/ping/RPC2\r\nhttp://feedburner.google.com/fb/a/pingSubmit?bloglink=http%3A%2F%2F{{domain}}'),\n (null, 'bsvalidator_v', ''),\n (null, 'ppsandbox', 'off'),\n (null, 'ppuser', ''),\n (null, 'pppass', ''),\n (null, 'ppsign', ''),\n (null, 'tokens', ''),\n (null, 'modules', ''),\n (null, 'themes', 'default'),\n (null, 'system_lang', 'english'),\n (null, 'charset', 'utf-8'),\n (null, 'google_captcha_sitekey', ''),\n (null, 'google_captcha_secret', ''),\n (null, 'google_captcha_lang', 'en'),\n (null, 'google_captcha_enable', 'off')"; $db->query($options); }
<tr> <td>Site URL</td><td><?php echo Session::val('siteurl'); ?> </td> </tr> <tr> <td>Administrator Name</td><td><?php echo Session::val('adminname'); ?> </td> </tr> <tr> <td>Administrator Username</td><td><?php echo Session::val('adminuser'); ?> </td> </tr> <tr> <td>Administrator Password</td><td><?php echo Session::val('adminpass'); ?> </td> </tr> <tr> <td></td><td><input type="submit" name="step3" value="Create Config File" class="btn btn-primary"> <a href="?step=2" class="btn btn-danger">Back Step</a></td> </tr> </table> </div> </form>
/** * @param Account $account * @return WebMailMessage */ function &CreateMessageFromPost(&$account) { $message =& new WebMailMessage(); $GLOBALS[MailDefaultCharset] = $account->GetUserCharset(); $GLOBALS[MailInputCharset] = $account->GetUserCharset(); $GLOBALS[MailOutputCharset] = $account->GetDefaultOutCharset(); $message->Headers->SetHeaderByName(MIMEConst_MimeVersion, '1.0'); $message->Headers->SetHeaderByName(MIMEConst_XMailer, 'MailBee WebMail Pro PHP'); $message->Headers->SetHeaderByName(MIMEConst_XOriginatingIp, isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'); $message->IdMsg = Post::val('m_id', -1); $message->SetPriority(Post::val('priority_input', 3)); $message->DbPriority = Post::val('priority_input', 3); $message->Uid = Post::val('m_uid', ''); $message->Headers->SetHeaderByName(MIMEConst_MessageID, '<' . substr(session_id(), 0, 7) . '.' . md5(time()) . '@' . $_SERVER['SERVER_NAME'] . '>'); $temp = Post::val('from', ''); if ($temp) { $message->SetFromAsString($temp); } $temp = Post::val('toemail', ''); if ($temp) { $message->SetToAsString($temp); } $temp = Post::val('toCC', ''); if ($temp) { $message->SetCcAsString($temp); } $temp = Post::val('toBCC', ''); if ($temp) { $message->SetBccAsString($temp); } $temp = Post::val('subject', ''); if ($temp) { $message->SetSubject($temp); } $message->SetDate(new CDateTime(time())); if (Post::val('ishtml', 0)) { $message->TextBodies->HtmlTextBodyPart = ConvertUtils::BackImagesToHtmlBody(Post::val('message', '')); } else { $message->TextBodies->PlainTextBodyPart = ConvertUtils::BackImagesToHtmlBody(Post::val('message', '')); } $attachments = Post::val('attachments'); if ($attachments && is_array($attachments)) { $fs =& new FileSystem(INI_DIR . '/temp', $account->Email, $account->Id); $attfolder =& new Folder($account->Id, -1, Session::val('attachtempdir')); foreach ($attachments as $key => $value) { if (Session::val('attachtempdir')) { $attachCid = 'attach.php?tn=' . $key; $replaceCid = md5(time() . $value); $mime_type = ConvertUtils::GetContentTypeFromFileName($value); $message->Attachments->AddFromFile($fs->GetFolderFullPath($attfolder) . '/' . $key, $value, $mime_type, false); if (Post::val('ishtml', 0)) { if (strpos($message->TextBodies->HtmlTextBodyPart, $attachCid) !== false) { $attachment =& $message->Attachments->GetLast(); $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentID, '<' . $replaceCid . '>'); $message->TextBodies->HtmlTextBodyPart = str_replace($attachCid, 'cid:' . $replaceCid, $message->TextBodies->HtmlTextBodyPart); $attachname = ConvertUtils::EncodeHeaderString($value, $account->GetUserCharset(), $GLOBALS[MailOutputCharset]); $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentDisposition, MIMEConst_InlineLower . ';' . CRLF . "\t" . MIMEConst_FilenameLower . '="' . $attachname . '"', false); } } } } } return $message; }
$mailsend = Mail::send($vars); if ($mailsend != "") { $alertred[] = $mailsend; } else { $data['alertgreen'][] = REG_ACTIVATE_ACCOUNT; } echo Hooks::run('user_activation_action'); } else { $data['alertred'][] = REG_ACTIVATION_FAILED; } } else { $data['alertred'][] = REG_ACTIVATION_FAILED_CODE; } } Theme::header($data); $loggedin = Session::val('loggedin'); if (isset($loggedin)) { echo "<div class=\"alert alert-info\">" . REG_ALREADY_REGISTERED_ACC . " </div>"; } else { ?> <div class="col-md-4 col-md-offset-4"> <?php if (isset($data['alertgreen'])) { # code... echo "<div class=\"alert alert-success\" >\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\">" . CLOSE . "</span>\n </button>\n "; foreach ($data['alertgreen'] as $alert) { # code... echo "{$alert}\n"; } echo "</div>"; } elseif (isset($data['alertred'])) {
Session::set_session($vars); Theme::install('step2'); break; case '3': $vars = array('adminname' => isset($_POST) ? $_POST['adminname'] : "", 'adminuser' => isset($_POST) ? $_POST['adminuser'] : "", 'adminpass' => isset($_POST) ? $_POST['adminpass'] : ""); Session::set_session($vars); Theme::install('step3'); break; case '4': try { $file = GX_PATH . "/inc/config/config.php"; $config = Install::makeConfig($file); if (System::existConf()) { Install::createTable(); Install::insertData(); $vars = array('user' => array('userid' => Session::val('adminuser'), 'pass' => User::randpass(Session::val('adminpass')), 'email' => 'admin@' . Session::val('sitedomain'), 'group' => '0', 'join_date' => date("Y-m-d H:i:s"), 'status' => '1'), 'detail' => array('userid' => Session::val('adminuser'), 'fname' => Session::val('adminname'))); User::create($vars); echo "Installation Success. Go to <a href=\"gxadmin\">Admin Page</a>."; } else { echo "<h2>Error !! Config File Not Found.</h2>\n Please make sure you had permission to write on the config directory. \n Do ftp to the server and CHMOD 777 the config directory. After \n config file is created, you can chmod it back to 755.\n <br>\n <br>\n After You had set the permission, please refresh this page. \n <br>\n <br>\n or <a href=\"?step=4\" class=\"btn btn-primary\">Click Here</a>"; } } catch (exception $e) { echo $e->getMessage(); } break; default: if (System::existConf()) { # code... echo "Config File Already Exist"; } else { Theme::install('step0');