/** * @param CAdminPanel $oAdminPanel * @return ap_Simple_Screen */ public function __construct(CAdminPanel &$oAdminPanel, $sGlobalTemplateName, $aData = array()) { parent::__construct($oAdminPanel, CAdminPanel::RootPath() . 'core/templates/' . $sGlobalTemplateName); foreach ($aData as $sKey => $sText) { $this->Data->SetValue($sKey, $sText); } }
/** * @param CAdminPanel $oAdminPanel * @return ap_Standard_Screen */ public function __construct(CAdminPanel &$oAdminPanel) { parent::__construct($oAdminPanel, CAdminPanel::RootPath() . 'core/templates/standard.php'); $this->CssAddFile('static/styles/screens/standard.css'); $this->aMenu = array(); $this->sMode = ''; $this->aMenuDefMode = ''; }
/** * @param string $errorDesc */ function _setError($errorDesc) { $this->_error = $this->_error ? $this->_error : $errorDesc; CAdminPanel::Log('XM ERROR < ' . trim($this->_error)); }
/** * @param string $sJsFile */ public function JsAddFile($sJsFile) { $this->oAdminPanel->JsAddFile($this->WebModulePath() . '/js/' . $sJsFile); }
/** * This functiuon is to open the connection to the server * * @return bool */ function open_connection() { if (!$this->_checkState_0('DISCONNECTED')) { return false; } if (empty($this->host) || empty($this->port)) { $this->error = 'Error : Either HOST or PORT is undifined!'; return false; } $host = $this->host; $isSsl = strlen($host) > 6 && strtolower(substr($host, 0, 6)) == 'ssl://'; if (function_exists('openssl_open') && ($isSsl || $this->port == 993)) { if (!$isSsl) { $host = 'ssl://' . $host; } } else { if ($isSsl) { $host = substr($host, 6); } } $errno = $errstr = null; CAdminPanel::Log('IMAP4 > Start connect to ' . $host . ':' . $this->port); $this->connection = @fsockopen($host, $this->port, $errno, $errstr, 10); if (!$this->connection) { $this->error = 'Could not make a connection to server , Error : ' . $errstr . ' (' . $errno . ')'; return false; } /* set socket timeout * it is valid for all other functions! */ @socket_set_timeout($this->connection, 20); /* socket_set_blocking($this->connection, true); */ $this->get_line(); $this->state = 'AUTHORIZATION'; // $this->InitCapa(); return true; }
<?php /* * Copyright 2004-2015, AfterLogic Corp. * Licensed under AGPLv3 license or AfterLogic license * if commercial version of the product was purchased. * See the LICENSE file for a full license statement. */ include 'core/cadminpanel.php'; $oAdminPanel = new CAdminPanel(__FILE__); $oAdminPanel->Run()->End();
function WmInterface(&$_screen, &$_settings, $_host = '') { $_screen->data->SetValue('intMailsPerPage', $_settings->MailsPerPage); $_screen->data->SetValue('intRightMessagePane', $_settings->ViewMode & WM_NEW_VIEW_MODE_CENTRAL_LIST_PANE); $_screen->data->SetValue('intAlwaysShowPictures', $_settings->ViewMode & WM_NEW_VIEW_MODE_SHOW_PICTURES); $_skins =& $this->GetSkinsList(); $_skinsString = ''; foreach ($_skins as $_skin) { $_selected = $_skin == $_settings->DefaultSkin ? ' selected="selected"' : ''; $_skinsString .= '<option value="' . ap_Utils::AttributeQuote($_skin) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_skin) . '</option>' . AP_CRLF; } $_screen->data->SetValue('txtDefaultSkin', $_skinsString); $_screen->data->SetValue('intAllowUsersChangeSkin', $_settings->AllowUsersChangeSkin); $_langs =& $this->GetLangsList(); $_langsString = ''; foreach ($_langs as $_lang) { $_selected = $_lang == $_settings->DefaultLanguage ? ' selected="selected"' : ''; $_langsString .= '<option value="' . ap_Utils::AttributeQuote($_lang) . '"' . $_selected . '>' . ap_Utils::EncodeSpecialXmlChars($_lang) . '</option>' . AP_CRLF; } $_screen->data->SetValue('txtDefaultLanguage', $_langsString); $_screen->data->SetValue('intAllowUsersChangeLanguage', $_settings->AllowUsersChangeLanguage); $_screen->data->SetValue('intShowTextLabels', $_settings->ShowTextLabels); $_screen->data->SetValue('intAllowAjaxVersion', $_settings->AllowAjax); $_screen->data->SetValue('intAllowDHTMLEditor', $_settings->AllowDhtmlEditor); $_screen->data->SetValue('intAllowContacts', $_settings->AllowContacts); $_screen->data->SetValue('intAllowCalendar', $_settings->AllowCalendar); $_screen->data->SetValue('classAllowCalendar', CAdminPanel::UseDb() ? '' : 'wm_hide'); $_screen->data->SetValue('classAllowCalendar', CAdminPanel::UseDb() ? '' : 'wm_hide'); $_screen->data->SetValue('SaveInSentAlwaysIntValue', WM_SAVE_IN_SENT_ALWAYS); $_screen->data->SetValue('SaveInSentOnIntValue', WM_SAVE_IN_SENT_DEFAULT_ON); $_screen->data->SetValue('SaveInSentOffIntValue', WM_SAVE_IN_SENT_DEFAULT_OFF); $_screen->data->SetValue('SaveInSentAlways', WM_SAVE_IN_SENT_ALWAYS === $_settings->SaveInSent); $_screen->data->SetValue('SaveInSentOn', WM_SAVE_IN_SENT_DEFAULT_ON === $_settings->SaveInSent); $_screen->data->SetValue('SaveInSentOff', WM_SAVE_IN_SENT_DEFAULT_OFF === $_settings->SaveInSent); }
/** * @static * @param string $_str */ function Log($_str) { static $_isFirst = true; static $_use = null; if ($_use === null) { $_use = isset($GLOBALS[AP_USELOG]); if (!$_use) { $_use = isset($_SESSION[AP_SESS_ENABLE]['log']); } } if ($_use) { $_date = @date('H:i:s'); $_path = CAdminPanel::AdminDataFolder(); if (false === $_path) { return; } if ($_isFirst) { $_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $_isFirst = false; $_post = isset($_POST) && count($_POST) > 0 ? ' [POST(' . count($_POST) . ')]' : ''; @error_log("\r\n" . '[' . $_date . '] ---[start]---> ' . $_uri . $_post . AP_CRLF, 3, $_path . '/logs/' . AP_LOG_FILE); if (strlen($_post) > 0) { @error_log('[' . $_date . '] POST > [' . implode(', ', array_keys($_POST)) . "]\r\n", 3, $_path . '/logs/' . AP_LOG_FILE); } } $_str = str_replace(AP_CRLF, "\r\n\t", $_str); @error_log('[' . $_date . '] ' . $_str . AP_CRLF, 3, $_path . '/logs/' . AP_LOG_FILE); } }
/** * @param WebMail_Settings $settings * @return webmail_MSSQL_DbStorage */ function common_MSSQL_DbStorage(&$settings) { $this->_settings =& $settings; include_once WM_DB_LIBS_PATH . '/commandcreator.php'; $this->_commandCreator = new MSSQL_CommonCommandCreator(AP_DB_QUOTE_ESCAPE, array('[', ']'), $this->_settings->DbPrefix); if ($settings->UseCustomConnectionString || $settings->UseDsn) { include_once CAdminPanel::RootPath() . '/core/db/class_dbodbc.php'; if ($settings->UseCustomConnectionString) { $this->_connector = new DbOdbc($settings->DbCustomConnectionString, $settings->DbType, $settings->DbLogin, $settings->DbPassword); } else { $this->_connector = new DbOdbc('DSN=' . $settings->DbDsn . ';', $settings->DbType, $settings->DbLogin, $settings->DbPassword); } } else { include_once CAdminPanel::RootPath() . '/core/db/class_dbmssql.php'; $this->_connector = new DbMSSql($settings->DbHost, $settings->DbLogin, $settings->DbPassword, $settings->DbName); } }
function setGlobalErrorAndWriteLog() { if (strlen($this->error) > 0) { CAdminPanel::Log('POP3 Error: ' . trim($this->error)); } }
/** * @param string $sJsFile */ public function JsAddVar($sName, $sValue) { $this->oAdminPanel->JsAddVar($sName, $sValue); }
function _setSqlError($errorDesc = '') { if ($errorDesc) { $this->ErrorDesc = $errorDesc; $this->ErrorCode = 0; } elseif ($this->_conectionHandle) { $this->ErrorDesc = @odbc_errormsg($this->_conectionHandle); $this->ErrorCode = @odbc_error($this->_conectionHandle); } else { $this->ErrorDesc = @odbc_errormsg(); $this->ErrorCode = @odbc_error(); } if (strlen($this->ErrorDesc) > 0) { CAdminPanel::Log('DB ERROR < ' . trim($this->ErrorDesc)); } }
function _initCommonData(&$_screen) { $_ap =& $_screen->GetAp(); switch ($_ap->Tab()) { case 'common': /* auth */ if (isset($this->_settings['user'], $this->_settings['password'])) { $_screen->data->SetValue('UserName', $this->_settings['user']); if (strlen($this->_settings['password']) > 0) { $_screen->data->SetValue('txtPassword1', AP_DUMMYPASSWORD); $_screen->data->SetValue('txtPassword2', AP_DUMMYPASSWORD); } } $_screen->data->SetValue('hideClass', 'wm_hide'); /* enable */ if ($_ap->IsEnable()) { $_path = $_ap->GetCfg('adminpanel_data_path'); if ($_path !== false && @is_dir($_path)) { $_fileName = $_path . '/logs/' . AP_LOG_FILE; $_size = 0; $_isExist = false; if (@file_exists($_fileName)) { $_isExist = true; $_size = filesize($_fileName); } $_screen->data->SetValue('classLogButtons', $_size > 0 ? 'wm_button' : 'wm_hide'); $_size = ap_Utils::GetFriendlySize($_size); $_temp = @substr(sprintf('%o', fileperms($_path)), -4); $_path .= ' (' . $_temp . ')'; $_screen->data->SetValue('txtDataFolder', $_path); $_screen->data->SetValue('txtLogFile', $_fileName); $_fileName .= $_isExist ? ' (' . $_size . ')' : ' (doesn\'t exist)'; $_screen->data->SetValue('txtLogFileInfo', $_fileName); } } break; case 'main': if ($_ap->PType() && isset($this->_settings[AP_TEST_P])) { if ($_ap->AuthType() === AP_SESS_AUTH_TYPE_SUPER_ADMIN_ONLYREAD || $_ap->AuthType() === AP_SESS_AUTH_TYPE_NONE) { $_screen->data->SetValue('txtLicenseKey', CM_DEMO_LKEY); } else { $_screen->data->SetValue('txtLicenseKey', $this->_settings[AP_TEST_P]); } if (!$_ap->Qret()) { if (strlen($this->_settings[AP_TEST_P]) == 0) { $_screen->data->SetValue('txtLicenseKey', ''); $_screen->data->SetValue('txtLicenseKeyText', ap_Utils::TakePhrase('CM_ENTER_VALID_KEY_HERE')); } else { $_screen->data->SetValue('txtHideGetTrialClass', 'class="wm_hide"'); $_screen->data->SetValue('txtLicenseKeyText', ap_Utils::TakePhrase('CM_ENTER_VALID_KEY')); } $_screen->data->SetValue('txtGetTrialId', CAdminPanel::BType() ? 44 : 22); } else { $_screen->data->SetValue('txtHideGetTrialClass', 'class="wm_hide"'); } } break; } }
function InitBySelf() { if ('wm' == $this->Index && !CAdminPanel::UseDb() && count($this->Tabs[0]) > 0) { $this->Tabs = array($this->Tabs[0]); } if (!CAdminPanel::PType()) { $newTabs = array(); foreach ($this->Tabs as $TabItem) { if (isset($TabItem[2]) && in_array($TabItem[2], $this->HTabs)) { continue; } $newTabs[] = $TabItem; } $this->Tabs = $newTabs; } }
<?php GoodOrBadButton($_allGood); ?> </td> </tr> <tr><td colspan="2"><br /><br /></td></tr> </table> </form> </td> </tr> </table> </div> </div> </body> </html> <?php /* -- step 2 */ } else { if (isset($_SESSION[AP_SESS_GOODORBAD]) && $_SESSION[AP_SESS_GOODORBAD]) { /* step 3 */ $AdminPanel = new CAdminPanel(__FILE__); $AdminPanel->Write(); /* -- step 3 */ } else { @session_destroy(); @header('Location: install.php'); exit; } } } }
<?php /* * AfterLogic Admin Panel by AfterLogic Corp. <*****@*****.**> * * Copyright (C) 2002-2010 AfterLogic Corp. (www.afterlogic.com) * Distributed under the terms of the license described in LICENSE.txt * */ include_once CAdminPanel::RootPath() . '/core/db/commandcreator.php'; /** * @abstract */ class main_CommonCommandCreator extends baseMain_CommandCreator { /** * @param int $type * @param array $columnEscape * @param string $prefix * @return main_CommonCommandCreator */ function main_CommonCommandCreator($type, $columnEscape = array('', ''), $prefix = '') { baseMain_CommandCreator::baseMain_CommandCreator($type, $columnEscape, $prefix); } /** * @return string */ function GetDomainArray() { return sprintf('SELECT id_domain, name FROM %sawm_domains', $this->_prefix);
/** * @param string $fileName * @return bool */ function SaveToFile($fileName) { $fstat = ''; $fp = @fopen($fileName, 'wb'); if ($fp) { $result = @fwrite($fp, $this->ToString(true)) !== false; $result &= @fclose($fp); return $result; } else { $fstat = @substr(sprintf('%o', fileperms($fileName)), -4); if (!$fstat) { $fstat = 'error'; } CAdminPanel::Log('FILE > ' . $fileName . ' (' . $fstat . ') permission denied'); } return false; }
function _setSqlError() { if ($this->_conectionHandle) { $this->ErrorDesc = @mysql_error($this->_conectionHandle); $this->ErrorCode = @mysql_errno($this->_conectionHandle); } else { $this->ErrorDesc = @mysql_error(); $this->ErrorCode = @mysql_errno(); } if (strlen($this->ErrorDesc) > 0) { CAdminPanel::Log('DB ERROR < ' . trim($this->ErrorDesc)); } }
/** * Returns a textual description of the error code (non-functional for SAXY Lite) * @param int The error code * @return string The error message */ function xml_error_string($code) { CAdminPanel::Log('XML : ' . $code); }
/** * @retun void */ public function ToString() { if (0 < count($this->aSwitchers) || 0 < count($this->aTopSwitchers)) { include CAdminPanel::RootPath() . '/core/templates/table-main.php'; } }
/** * @return void */ public function WriteTabs() { $this->oAdminPanel->WriteTabs(); }
function WriteCard() { if (($this->_mode == 'new' || $this->_mode == 'edit') && count($this->_main->_switchers) > 0) { include CAdminPanel::RootPath() . '/templates/screen-tables-card.php'; } }
function _setSqlError($errmess = '') { $this->ErrorCode = 0; $this->ErrorDesc = $errmess ? $errmess : @mssql_get_last_message(); if (strlen($this->ErrorDesc) > 0) { CAdminPanel::Log('DB ERROR < ' . trim($this->ErrorDesc)); } }