• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP iMSCP_Registry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中iMSCP_Registry的典型用法代码示例。如果您正苦于以下问题:PHP iMSCP_Registry类的具体用法?PHP iMSCP_Registry怎么用?PHP iMSCP_Registry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了iMSCP_Registry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getInstance

 /**
  * Get an iMSCP_Registry instance
  *
  * Returns an {@link iMSCP_Registry} instance, only creating it if it doesn't
  * already exist.
  *
  * @return iMSCP_Registry
  */
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:svenjantzen,项目名称:imscp,代码行数:15,代码来源:Registry.php


示例2: client_generatePage

/**
 * Generate page
 *
 * @param $tpl iMSCP_pTemplate
 * @return void
 */
function client_generatePage($tpl)
{
    if (isset($_GET['id'])) {
        $domainAliasId = clean_input($_GET['id']);
        if (!($domainAliasData = _client_getAliasData($domainAliasId))) {
            showBadRequestErrorPage();
        }
        if (empty($_POST)) {
            if ($domainAliasData['forward_url'] != 'no') {
                $urlForwarding = true;
                $uri = iMSCP_Uri_Redirect::fromString($domainAliasData['forward_url']);
                $forwardUrlScheme = $uri->getScheme();
                $forwardUrl = substr($uri->getUri(), strlen($forwardUrlScheme) + 3);
            } else {
                $urlForwarding = false;
                $forwardUrlScheme = 'http://';
                $forwardUrl = '';
            }
        } else {
            $urlForwarding = isset($_POST['url_forwarding']) && $_POST['url_forwarding'] == 'yes' ? true : false;
            $forwardUrlScheme = isset($_POST['forward_url_scheme']) ? $_POST['forward_url_scheme'] : 'http://';
            $forwardUrl = isset($_POST['forward_url']) ? $_POST['forward_url'] : '';
        }
        /** @var iMSCP_Config_Handler_File $cfg */
        $cfg = iMSCP_Registry::get('config');
        $checked = $cfg->HTML_CHECKED;
        $selected = $cfg->HTML_SELECTED;
        $tpl->assign(array('DOMAIN_ALIAS_ID' => $domainAliasId, 'DOMAIN_ALIAS_NAME' => tohtml($domainAliasData['alias_name_utf8']), 'FORWARD_URL_YES' => $urlForwarding ? $checked : '', 'FORWARD_URL_NO' => $urlForwarding ? '' : $checked, 'HTTP_YES' => $forwardUrlScheme == 'http://' ? $selected : '', 'HTTPS_YES' => $forwardUrlScheme == 'https://' ? $selected : '', 'FTP_YES' => $forwardUrlScheme == 'ftp://' ? $selected : '', 'FORWARD_URL' => tohtml(decode_idna($forwardUrl))));
    } else {
        showBadRequestErrorPage();
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:38,代码来源:alias_edit.php


示例3: __constructor

 /**
  * Constructor
  *
  * @param iMSCP_Api_Module_Server_Models_server
  */
 public function __constructor(iMSCP_Api_Module_Server_Models_server $server)
 {
     $this->_em = iMSCP_Registry::get('em');
     $services = $server->getServices();
     $adapter = 'iMSCP_Api_Modules_Ftp_Backend_Adapter_' . $services['ftp']['server'];
     $this->_adapter = new $adapter();
 }
开发者ID:nuxwin,项目名称:skeleton,代码行数:12,代码来源:Backend.php


示例4: admin_generatePage

/**
 * Generate page
 *
 * @param  iMSCP_pTemplate $tpl
 * @return void
 */
function admin_generatePage($tpl)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    if (!isset($cfg['CHECK_FOR_UPDATES']) || !$cfg['CHECK_FOR_UPDATES']) {
        set_page_message(tr('i-MSCP version update checking is disabled'), 'static_warning');
    } else {
        /** @var iMSCP_Update_Version $updateVersion */
        $updateVersion = iMSCP_Update_Version::getInstance();
        if ($updateVersion->isAvailableUpdate()) {
            if ($updateInfo = $updateVersion->getUpdateInfo()) {
                $date = new DateTime($updateInfo['published_at']);
                $tpl->assign(array('TR_UPDATE_INFO' => tr('Update info'), 'TR_RELEASE_VERSION' => tr('Release version'), 'RELEASE_VERSION' => tohtml($updateInfo['tag_name']), 'TR_RELEASE_DATE' => tr('Release date'), 'RELEASE_DATE' => tohtml($date->format($cfg['DATE_FORMAT'])), 'TR_RELEASE_DESCRIPTION' => tr('Release description'), 'RELEASE_DESCRIPTION' => tohtml($updateInfo['body']), 'TR_DOWNLOAD_LINKS' => tr('Download links'), 'TR_DOWNLOAD_ZIP' => tr('Download ZIP'), 'TR_DOWNLOAD_TAR' => tr('Download TAR'), 'TARBALL_URL' => tohtml($updateInfo['tarball_url']), 'ZIPBALL_URL' => tohtml($updateInfo['zipball_url'])));
                return;
            } else {
                set_page_message($updateVersion->getError(), 'error');
            }
        } elseif ($updateVersion->getError()) {
            set_page_message($updateVersion, 'error');
        } else {
            set_page_message(tr('No update available'), 'static_info');
        }
    }
    $tpl->assign('UPDATE_INFO', '');
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:31,代码来源:imscp_updates.php


示例5: gen_reseller_personal_data

/**
 * @param iMSCP_pTemplate $tpl
 * @param $user_id
 */
function gen_reseller_personal_data($tpl, $user_id)
{
    $cfg = iMSCP_Registry::get('config');
    $query = "\n\t\tSELECT\n\t\t\t`fname`,\n\t\t\t`lname`,\n\t\t\t`gender`,\n\t\t\t`firm`,\n\t\t\t`zip`,\n\t\t\t`city`,\n\t\t\t`state`,\n\t\t\t`country`,\n\t\t\t`street1`,\n\t\t\t`street2`,\n\t\t\t`email`,\n\t\t\t`phone`,\n\t\t\t`fax`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_id` = ?\n\t";
    $rs = exec_query($query, $user_id);
    $tpl->assign(array('FIRST_NAME' => $rs->fields['fname'] == null ? '' : tohtml($rs->fields['fname']), 'LAST_NAME' => $rs->fields['lname'] == null ? '' : tohtml($rs->fields['lname']), 'FIRM' => $rs->fields['firm'] == null ? '' : tohtml($rs->fields['firm']), 'ZIP' => $rs->fields['zip'] == null ? '' : tohtml($rs->fields['zip']), 'CITY' => $rs->fields['city'] == null ? '' : tohtml($rs->fields['city']), 'STATE' => $rs->fields['state'] == null ? '' : tohtml($rs->fields['state']), 'COUNTRY' => $rs->fields['country'] == null ? '' : tohtml($rs->fields['country']), 'STREET_1' => $rs->fields['street1'] == null ? '' : tohtml($rs->fields['street1']), 'STREET_2' => $rs->fields['street2'] == null ? '' : tohtml($rs->fields['street2']), 'EMAIL' => $rs->fields['email'] == null ? '' : tohtml($rs->fields['email']), 'PHONE' => $rs->fields['phone'] == null ? '' : tohtml($rs->fields['phone']), 'FAX' => $rs->fields['fax'] == null ? '' : tohtml($rs->fields['fax']), 'VL_MALE' => $rs->fields['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $rs->fields['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $rs->fields['gender'] == 'U' || empty($rs->fields['gender']) ? $cfg->HTML_SELECTED : ''));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:11,代码来源:personal_change.php


示例6: reseller_generatePage

/**
 * Generates page.
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 */
function reseller_generatePage($tpl)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    $query = "SELECT domain_created from admin where admin_id = ?";
    $stmt = exec_query($query, (int) $_SESSION['user_id']);
    $tpl->assign(array('TR_ACCOUNT_SUMMARY' => tr('Account summary'), 'TR_USERNAME' => tr('Username'), 'USERNAME' => tohtml($_SESSION['user_logged']), 'TR_ACCOUNT_TYPE' => tr('Account type'), 'ACCOUNT_TYPE' => $_SESSION['user_type'], 'TR_REGISTRATION_DATE' => tr('Registration date'), 'REGISTRATION_DATE' => $stmt->fields['domain_created'] != 0 ? date($cfg->DATE_FORMAT, $stmt->fields['domain_created']) : tr('Unknown')));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:13,代码来源:profile.php


示例7: disable

 /**
  * Plugin deactivation
  *
  * @throws iMSCP_Plugin_Exception
  * @param iMSCP_Plugin_Manager $pluginManager
  * @return void
  */
 public function disable(iMSCP_Plugin_Manager $pluginManager)
 {
     try {
         iMSCP_Registry::get('dbConfig')->del('PORT_POLICYD_WEIGHT');
     } catch (iMSCP_Exception $e) {
         throw new iMSCP_Plugin_Exception($e->getMessage(), $e->getCode(), $e);
     }
 }
开发者ID:reneschuster,项目名称:plugins,代码行数:15,代码来源:PolicydWeight.php


示例8: overrideHttpPorts

 /**
  * Override HTTP ports which are defined by i-MSCP in case of proxy usage
  *
  * @return void
  */
 public function overrideHttpPorts()
 {
     if ($this->getConfigParam('type', 'unknown') == 'proxy') {
         $config = iMSCP_Registry::get('config');
         $config['BASE_SERVER_VHOST_HTTP_PORT'] = 80;
         $config['BASE_SERVER_VHOST_HTTPS_PORT'] = 443;
     }
 }
开发者ID:svenjantzen,项目名称:plugins,代码行数:13,代码来源:PanelRedirect.php


示例9: __construct

 /**
  * Constructor
  *
  * @param string $message
  * @param int $code
  * @param Exception $previous OPTIONAL Previous exception
  * @return iMSCP_Exception_Production
  */
 public function __construct($message = '', $code = 0, $previous = null)
 {
     if (function_exists('tr') && iMSCP_Registry::isRegistered('Pdo')) {
         $message = tr('An unexpected error occurred. Please contact your administrator.');
     } else {
         $message = 'An unexpected error occurred. Please contact your administrator.';
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:svenjantzen,项目名称:imscp,代码行数:17,代码来源:Production.php


示例10: setupNavigation

 /**
  * Inject Mailgraph links into the navigation object
  *
  * @return void
  */
 protected function setupNavigation()
 {
     if (iMSCP_Registry::isRegistered('navigation')) {
         /** @var Zend_Navigation $navigation */
         $navigation = iMSCP_Registry::get('navigation');
         if ($page = $navigation->findOneBy('uri', '/admin/server_statistic.php')) {
             $page->addPage(array('label' => tr('Mailgraph'), 'uri' => '/admin/mailgraph.php', 'title_class' => 'stats'));
         }
     }
 }
开发者ID:nciftci,项目名称:plugins,代码行数:15,代码来源:Mailgraph.php


示例11: _client_pmaSetLanguage

/**
 * Set PhpMyAdmin language according language set in panel
 *
 * Note: If panel language doesn't match any language available for PMA, language
 * is set to English (en).
 *
 * @access private
 * @param string $location PMA URI location
 * @return string PMA URI location
 */
function _client_pmaSetLanguage($location)
{
    /** @var Zend_Translate_Adapter $translator */
    $translator = iMSCP_Registry::get('translator')->getAdapter();
    $uriComponents = parse_url($location);
    parse_str($uriComponents['query'], $queryParts);
    $queryParts['lang'] = substr($translator->getLocale(), 0, 2);
    $uriComponents['query'] = http_build_query($queryParts);
    return http_build_url($location, $uriComponents);
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:20,代码来源:pma_auth.php


示例12: admin_generatePage

/**
 * Generates page.
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param int $trafficLimit Monthly traffic limit
 * @param int $trafficWarning Traffic warning
 * @return void
 */
function admin_generatePage($tpl, $trafficLimit, $trafficWarning)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    if (empty($_POST)) {
        $trafficLimit = $cfg->SERVER_TRAFFIC_LIMIT;
        $trafficWarning = $cfg->SERVER_TRAFFIC_WARN;
    }
    $tpl->assign(array('MAX_TRAFFIC' => tohtml($trafficLimit), 'TRAFFIC_WARNING' => tohtml($trafficWarning)));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:18,代码来源:settings_server_traffic.php


示例13: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $values = iMSCP_Registry::get('dbConfig')->toArray();
     // Gets list of services port names
     $services = array_filter(array_keys($values), function ($name) {
         return strlen($name) > 5 && substr($name, 0, 5) == 'PORT_';
     });
     foreach ($services as $name) {
         $this->services[$name] = explode(';', $values[$name]);
     }
     ksort($this->services);
 }
开发者ID:svenjantzen,项目名称:imscp,代码行数:15,代码来源:Services.php


示例14: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     /** @var iMSCP_Plugin_Manager $pluginManager */
     $pluginManager = iMSCP_Registry::get('pluginManager');
     $version = iMSCP_Registry::get('config')->Version;
     $pluginInfo = $pluginManager->pluginGetInfo('DebugBar');
     $panel = "<h4>i-MSCP DebugBar v{$pluginInfo['version']}</h4>" . '<p>©2010-2015 <a href="http://www.i-mscp.net">i-MSCP Team</a><br />' . 'Author: <a href="mailto:' . $pluginInfo['email'] . '">' . $pluginInfo['author'] . '</a><br />' . 'Includes images from the <a href="http://www.famfamfam.com/lab/icons/silk/">Silk Icon set</a> by Mark James</p>';
     $panel .= '<h4>i-MSCP ' . $version . ' / PHP ' . phpversion() . ' with extensions:</h4>';
     $extensions = get_loaded_extensions();
     natcasesort($extensions);
     $panel .= "<pre>\t" . implode(PHP_EOL . "\t", $extensions) . '</pre>';
     return $panel;
 }
开发者ID:nciftci,项目名称:plugins,代码行数:18,代码来源:Version.php


示例15: reseller_checkData

/**
 * Check input data
 *
 * @return void
 */
function reseller_checkData()
{
    $cfg = iMSCP_Registry::get('config');
    if (!isset($_POST['dmn_name']) || $_POST['dmn_name'] === '') {
        set_page_message(tr('Domain name cannot be empty.'), 'error');
        return;
    }
    $dmnName = clean_input($_POST['dmn_name']);
    global $dmnNameValidationErrMsg;
    if (!isValidDomainName($dmnName)) {
        set_page_message($dmnNameValidationErrMsg, 'error');
        return;
    }
    // www is considered as an alias of the domain
    while (strpos($dmnName, 'www.') !== false) {
        $dmnName = substr($dmnName, 4);
    }
    $asciiDmnName = encode_idna($dmnName);
    if (imscp_domain_exists($asciiDmnName, $_SESSION['user_id']) || $asciiDmnName == $cfg['BASE_SERVER_VHOST']) {
        set_page_message(tr('Domain %s is unavailable.', "<strong>{$dmnName}</strong>"), 'error');
        return;
    }
    if ((!isset($_POST['datepicker']) || $_POST['datepicker'] === '') && !isset($_POST['never_expire'])) {
        set_page_message(tr('Domain expiration date must be filled.'), 'error');
        return;
    }
    $dmnExpire = isset($_POST['datepicker']) ? @strtotime(clean_input($_POST['datepicker'])) : 0;
    if ($dmnExpire === false) {
        set_page_message('Invalid expiration date.', 'error');
        return;
    }
    $hpId = isset($_POST['dmn_tpl']) ? clean_input($_POST['dmn_tpl']) : 0;
    $customizeHp = $hpId > 0 && isset($_POST['chtpl']) ? $_POST['chtpl'] : '_no_';
    if ($hpId == 0 || $customizeHp == '_yes_') {
        $_SESSION['dmn_name'] = $asciiDmnName;
        $_SESSION['dmn_expire'] = $dmnExpire;
        $_SESSION['dmn_tpl'] = $hpId;
        $_SESSION['chtpl'] = '_yes_';
        $_SESSION['step_one'] = '_yes_';
        redirectTo('user_add2.php');
    }
    if (reseller_limits_check($_SESSION['user_id'], $hpId)) {
        $_SESSION['dmn_name'] = $asciiDmnName;
        $_SESSION['dmn_expire'] = $dmnExpire;
        $_SESSION['dmn_tpl'] = $hpId;
        $_SESSION['chtpl'] = $customizeHp;
        $_SESSION['step_one'] = '_yes_';
        redirectTo('user_add3.php');
    }
    set_page_message(tr('Hosting plan limits exceed reseller limits.'), 'error');
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:56,代码来源:user_add1.php


示例16: admin_generateLanguagesList

/**
 * Generate page
 *
 * @param iMSCP_pTemplate $tpl Template engine
 * @return void
 */
function admin_generateLanguagesList($tpl)
{
    $cfg = iMSCP_Registry::get('config');
    $defaultLanguage = $cfg['USER_INITIAL_LANG'];
    $availableLanguages = i18n_getAvailableLanguages();
    if (!empty($availableLanguages)) {
        foreach ($availableLanguages as $languageDefinition) {
            $tpl->assign(array('LANGUAGE_NAME' => tohtml($languageDefinition['language']), 'NUMBER_TRANSLATED_STRINGS' => tohtml(tr('%d strings translated', $languageDefinition['translatedStrings'])), 'LANGUAGE_REVISION' => tohtml($languageDefinition['revision']), 'LOCALE_CHECKED' => $languageDefinition['locale'] == $defaultLanguage ? 'checked' : '', 'LOCALE' => tohtml($languageDefinition['locale'], 'htmlAttr')));
            $tpl->parse('LANGUAGE_BLOCK', '.language_block');
        }
    } else {
        $tpl->assign('LANGUAGES_BLOCK', '');
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:20,代码来源:multilanguage.php


示例17: add_user

/**
 * @param  $tpl iMSCP_pTemplate
 * @return void
 */
function add_user($tpl)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    if (isset($_POST['uaction']) && $_POST['uaction'] === 'add_user') {
        iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeAddUser);
        if (check_user_data()) {
            $upass = cryptPasswordWithSalt(clean_input($_POST['password']));
            $user_id = $_SESSION['user_id'];
            $username = clean_input($_POST['username']);
            $fname = clean_input($_POST['fname']);
            $lname = clean_input($_POST['lname']);
            $gender = clean_input($_POST['gender']);
            $firm = clean_input($_POST['firm']);
            $zip = clean_input($_POST['zip']);
            $city = clean_input($_POST['city']);
            $state = clean_input($_POST['state']);
            $country = clean_input($_POST['country']);
            $email = clean_input($_POST['email']);
            $phone = clean_input($_POST['phone']);
            $fax = clean_input($_POST['fax']);
            $street1 = clean_input($_POST['street1']);
            $street2 = clean_input($_POST['street2']);
            if (get_gender_by_code($gender, true) === null) {
                $gender = '';
            }
            $query = "\n\t\t\t\tINSERT INTO `admin` (\n\t\t\t\t\t`admin_name`, `admin_pass`, `admin_type`, `domain_created`, `created_by`, `fname`, `lname`, `firm`,\n\t\t\t\t\t`zip`, `city`, `state`, `country`, `email`, `phone`, `fax`, `street1`, `street2`, `gender`\n\t\t\t\t) VALUES (\n\t\t\t\t\t?, ?, 'admin', unix_timestamp(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?\n\t\t\t\t)\n\t\t\t";
            exec_query($query, array($username, $upass, $user_id, $fname, $lname, $firm, $zip, $city, $state, $country, $email, $phone, $fax, $street1, $street2, $gender));
            /** @var $db iMSCP_Database */
            $db = iMSCP_Registry::get('db');
            $new_admin_id = $db->insertId();
            $user_logged = $_SESSION['user_logged'];
            write_log("{$user_logged}: add admin: {$username}", E_USER_WARNING);
            $user_def_lang = $cfg->USER_INITIAL_LANG;
            $user_theme_color = $cfg->USER_INITIAL_THEME;
            $query = "\n\t\t\t\tREPLACE INTO `user_gui_props` (\n\t\t\t\t\t`user_id`, `lang`, `layout`\n\t\t\t\t) VALUES (\n\t\t\t\t\t?, ?, ?\n\t\t\t\t)\n\t\t\t";
            exec_query($query, array($new_admin_id, $user_def_lang, $user_theme_color));
            iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAfterAddUser);
            send_add_user_auto_msg($user_id, clean_input($_POST['username']), clean_input($_POST['password']), clean_input($_POST['email']), clean_input($_POST['fname']), clean_input($_POST['lname']), tr('Administrator'));
            //$_SESSION['user_added'] = 1;
            set_page_message(tr('Admin account successfully created.'), 'success');
            redirectTo('manage_users.php');
        } else {
            // check user data
            $tpl->assign(array('EMAIL' => clean_input($_POST['email'], true), 'USERNAME' => clean_input($_POST['username'], true), 'FIRST_NAME' => clean_input($_POST['fname'], true), 'LAST_NAME' => clean_input($_POST['lname'], true), 'FIRM' => clean_input($_POST['firm'], true), 'ZIP' => clean_input($_POST['zip'], true), 'CITY' => clean_input($_POST['city'], true), 'STATE' => clean_input($_POST['state'], true), 'COUNTRY' => clean_input($_POST['country'], true), 'STREET_1' => clean_input($_POST['street1'], true), 'STREET_2' => clean_input($_POST['street2'], true), 'PHONE' => clean_input($_POST['phone'], true), 'FAX' => clean_input($_POST['fax'], true), 'VL_MALE' => $_POST['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $_POST['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $_POST['gender'] == 'U' || empty($_POST['gender']) ? $cfg->HTML_SELECTED : ''));
        }
    } else {
        $tpl->assign(array('EMAIL' => '', 'USERNAME' => '', 'FIRST_NAME' => '', 'LAST_NAME' => '', 'FIRM' => '', 'ZIP' => '', 'CITY' => '', 'STATE' => '', 'COUNTRY' => '', 'STREET_1' => '', 'STREET_2' => '', 'PHONE' => '', 'FAX' => '', 'VL_MALE' => '', 'VL_FEMALE' => '', 'VL_UNKNOWN' => $cfg->HTML_SELECTED));
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:54,代码来源:admin_add.php


示例18: onAfterAddDomainAlias

 /**
  * onAfterAddDomainAlias listener
  *
  * @throws iMSCP_Exception
  * @throws iMSCP_Exception_Database
  * @param iMSCP_Events_Event $event
  * @throws Exception
  */
 public function onAfterAddDomainAlias(iMSCP_Events_Event $event)
 {
     $userIdentity = iMSCP_Authentication::getInstance()->getIdentity();
     if ($userIdentity->admin_type == 'user') {
         $disallowedDomains = (array) $this->getConfigParam('ignored_domains', array());
         $domainAliasNameAscii = $event->getParam('domainAliasName');
         # Only domain aliases which are not listed in the ignored_domains list are auto-approved
         if (!in_array(decode_idna($domainAliasNameAscii), $disallowedDomains)) {
             $username = decode_idna($userIdentity->admin_name);
             $approvalRule = $this->getConfigParam('approval_rule', true);
             $userAccounts = (array) $this->getConfigParam('user_accounts', array());
             if ($approvalRule) {
                 # Only domain aliases added by user accounts which are listed in the user_accounts list are
                 # auto-approved
                 if (!in_array($username, $userAccounts)) {
                     $username = false;
                 }
             } elseif (in_array($username, $userAccounts)) {
                 # Only domain aliases added by user accounts which are not listed in the user_accounts list are
                 # auto-approved
                 $username = false;
             }
             if ($username !== false) {
                 $db = iMSCP_Database::getInstance();
                 try {
                     $db->beginTransaction();
                     $domainAliasId = $event->getParam('domainAliasId');
                     exec_query('UPDATE domain_aliasses SET alias_status = ? WHERE alias_id = ?', array('toadd', $domainAliasId));
                     if (iMSCP_Registry::get('config')->CREATE_DEFAULT_EMAIL_ADDRESSES) {
                         if ($userIdentity->email) {
                             client_mail_add_default_accounts(get_user_domain_id($userIdentity->admin_id), $userIdentity->email, $domainAliasNameAscii, 'alias', $domainAliasId);
                         }
                     }
                     $db->commit();
                     send_request();
                     $domainAliasName = decode_idna($domainAliasNameAscii);
                     $username = decode_idna($username);
                     write_log(sprintf('DomainAutoApproval: The %s domain alias has been auto-approved', $domainAliasName), E_USER_NOTICE);
                     write_log(sprintf('DomainAutoApproval: %s scheduled addition of domain alias: %s', $username, $domainAliasName), E_USER_NOTICE);
                     set_page_message(tr('Domain alias successfully scheduled for addition.'), 'success');
                     redirectTo('domains_manage.php');
                 } catch (iMSCP_Exception $e) {
                     $db->rollBack();
                     throw $e;
                 }
             }
         }
     }
 }
开发者ID:nciftci,项目名称:plugins,代码行数:57,代码来源:DomainAutoApproval.php


示例19: generatePage

/**
 * Generate statistics for the given period
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @return void
 */
function generatePage($tpl)
{
    $domainId = get_user_domain_id($_SESSION['user_id']);
    if (isset($_POST['month']) && isset($_POST['year'])) {
        $year = intval($_POST['year']);
        $month = intval($_POST['month']);
    } else {
        if (isset($_GET['month']) && isset($_GET['year'])) {
            $month = intval($_GET['month']);
            $year = intval($_GET['year']);
        } else {
            $month = date('m');
            $year = date('Y');
        }
    }
    $stmt = exec_query('SELECT dtraff_time FROM domain_traffic WHERE domain_id = ? ORDER BY dtraff_time ASC LIMIT 1', $domainId);
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
        $numberYears = date('y') - date('y', $row['dtraff_time']);
        $numberYears = $numberYears ? $numberYears + 1 : 1;
    } else {
        $numberYears = 1;
    }
    generateMonthsAndYearsHtmlList($tpl, $month, $year, $numberYears);
    $stmt = exec_query('SELECT domain_id FROM domain_traffic WHERE domain_id = ? AND dtraff_time >= ? AND dtraff_time <= ? LIMIT 1', array($domainId, getFirstDayOfMonth($month, $year), getLastDayOfMonth($month, $year)));
    if ($stmt->rowCount()) {
        $requestedPeriod = getLastDayOfMonth($month, $year);
        $toDay = $requestedPeriod < time() ? date('j', $requestedPeriod) : date('j');
        $all = array_fill(0, 8, 0);
        $dateFormat = iMSCP_Registry::get('config')->DATE_FORMAT;
        for ($fromDay = 1; $fromDay <= $toDay; $fromDay++) {
            $beginTime = mktime(0, 0, 0, $month, $fromDay, $year);
            $endTime = mktime(23, 59, 59, $month, $fromDay, $year);
            list($webTraffic, $ftpTraffic, $smtpTraffic, $popTraffic) = _getUserTraffic($domainId, $beginTime, $endTime);
            $tpl->assign(array('DATE' => tohtml(date($dateFormat, strtotime($year . '-' . $month . '-' . $fromDay))), 'WEB_TRAFF' => tohtml(bytesHuman($webTraffic)), 'FTP_TRAFF' => tohtml(bytesHuman($ftpTraffic)), 'SMTP_TRAFF' => tohtml(bytesHuman($smtpTraffic)), 'POP_TRAFF' => tohtml(bytesHuman($popTraffic)), 'SUM_TRAFF' => tohtml(bytesHuman($webTraffic + $ftpTraffic + $smtpTraffic + $popTraffic))));
            $all[0] += $webTraffic;
            $all[1] += $ftpTraffic;
            $all[2] += $smtpTraffic;
            $all[3] += $popTraffic;
            $tpl->parse('TRAFFIC_TABLE_ITEM', '.traffic_table_item');
        }
        $tpl->assign(array('WEB_ALL' => tohtml(bytesHuman($all[0])), 'FTP_ALL' => tohtml(bytesHuman($all[1])), 'SMTP_ALL' => tohtml(bytesHuman($all[2])), 'POP_ALL' => tohtml(bytesHuman($all[3])), 'SUM_ALL' => tohtml(bytesHuman(array_sum($all)))));
    } else {
        set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
        $tpl->assign('STATISTICS_BLOCK', '');
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:53,代码来源:traffic_statistics.php


示例20: _client_generateItem

/**
 * Generate an external mail server item
 *
 * @access private
 * @param iMSCP_pTemplate $tpl Template instance
 * @param string $externalMail Status of external mail for the domain
 * @param int $domainId Domain id
 * @param string $domainName Domain name
 * @param string $status Item status
 * @param string $type Domain type (normal for domain or alias for domain alias)
 * @return void
 */
function _client_generateItem($tpl, $externalMail, $domainId, $domainName, $status, $type)
{
    /** @var $cfg iMSCP_Config_Handler_File */
    $cfg = iMSCP_Registry::get('config');
    $idnDomainName = decode_idna($domainName);
    $statusOk = 'ok';
    $queryParam = urlencode("{$domainId};{$type}");
    $htmlDisabled = $cfg['HTML_DISABLED'];
    if ($externalMail == 'off') {
        $tpl->assign(array('DOMAIN' => $idnDomainName, 'STATUS' => $status == $statusOk ? tr('Deactivated') : translate_dmn_status($status), 'DISABLED' => $htmlDisabled, 'ITEM_TYPE' => $type, 'ITEM_ID' => $domainId, 'ACTIVATE_URL' => $status == $statusOk ? "mail_external_add.php?item={$queryParam}" : '#', 'TR_ACTIVATE' => $status == $statusOk ? tr('Activate') : tr('N/A'), 'EDIT_LINK' => '', 'DEACTIVATE_LINK' => ''));
        $tpl->parse('ACTIVATE_LINK', 'activate_link');
    } elseif (in_array($externalMail, array('domain', 'wildcard', 'filter'))) {
        $tpl->assign(array('DOMAIN' => $idnDomainName, 'STATUS' => $status == $statusOk ? tr('Activated') : translate_dmn_status($status), 'DISABLED' => $status == $statusOk ? '' : $htmlDisabled, 'ITEM_TYPE' => $type, 'ITEM_ID' => $domainId, 'ACTIVATE_LINK' => '', 'TR_EDIT' => $status == $statusOk ? tr('Edit') : tr('N/A'), 'EDIT_URL' => $status == $statusOk ? "mail_external_edit.php?item={$queryParam}" : '#', 'TR_DEACTIVATE' => $status == $statusOk ? tr('Deactivate') : tr('N/A'), 'DEACTIVATE_URL' => $status == $statusOk ? "mail_external_delete.php?item={$queryParam}" : '#'));
        $tpl->parse('EDIT_LINK', 'edit_link');
        $tpl->parse('DEACTIVATE_LINK', 'deactivate_link');
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:29,代码来源:mail_external.php



注:本文中的iMSCP_Registry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP iMSCP_pTemplate类代码示例发布时间:2022-05-23
下一篇:
PHP iMSCP_Events_Aggregator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap