本文整理汇总了PHP中iMSCP_Registry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP iMSCP_Registry::get方法的具体用法?PHP iMSCP_Registry::get怎么用?PHP iMSCP_Registry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iMSCP_Registry
的用法示例。
在下文中一共展示了iMSCP_Registry::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: __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();
}
示例3: admin_generateForm
/**
* Generate form.
*
* @param iMSCP_pTemplate $tpl Template engine
*/
function admin_generateForm($tpl)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$selected = $cfg->HTML_SELECTED;
$customMenu = array('menu_id' => '', 'menu_name' => '', 'menu_link' => '', 'menu_target' => '_self', 'menu_level' => 'a', 'menu_order' => '');
if (empty($_POST) && isset($_GET['edit_id'])) {
$query = "SELECT * FROM `custom_menus` WHERE `menu_id` = ?";
$stmt = exec_query($query, (int) $_GET['edit_id']);
if (!$stmt->rowCount()) {
set_page_message(tr("The menu you are trying to edit doesn't exist."), 'error');
redirectTo('custom_menus.php');
}
$customMenu = $stmt->fetchRow();
} elseif (!empty($_POST)) {
$customMenu = $_POST;
}
if (isset($_REQUEST['edit_id'])) {
$tpl->assign(array('TR_DYNAMIC_TITLE' => tr('Edit custom menu'), 'TR_UPDATE' => tr('Update'), 'EDIT_ID' => tohtml($_REQUEST['edit_id']), 'ADD_MENU' => ''));
} else {
$tpl->assign(array('TR_DYNAMIC_TITLE' => tr('Add custom menu'), 'TR_ADD' => tr('Add'), 'EDIT_MENU' => ''));
}
foreach (array('_blank', '_parent', '_self', '_top') as $target) {
$tpl->assign(array('TR_TARGET' => tr('%s page', str_replace('_', '', $target)), 'TARGET_VALUE' => $target, 'SELECTED_TARGET' => $customMenu['menu_target'] == $target ? $selected : ''));
$tpl->parse('MENU_TARGET_BLOCK', '.menu_target_block');
}
foreach (array('A' => tr('Administrator level'), 'R' => tr('Reseller level'), 'C' => tr('Customer level'), 'AR' => tr('Administrator and Reseller levels'), 'AC' => tr('Administrator and customer levels'), 'RC' => tr('Reseller and customer levels'), 'ARC' => tr('All levels')) as $level => $trLevel) {
$tpl->assign(array('TR_LEVEL' => $trLevel, 'LEVEL_VALUE' => $level, 'SELECTED_LEVEL' => $customMenu['menu_level'] == $level ? $selected : ''));
$tpl->parse('MENU_LEVEL_BLOCK', '.menu_level_block');
}
$tpl->assign(array('MENU_NAME' => tohtml($customMenu['menu_name']), 'MENU_LINK' => tohtml($customMenu['menu_link']), 'MENU_ORDER' => $customMenu['menu_order']));
}
示例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', '');
}
示例5: selectedGraphic
/**
* Generate graph list
*
* @param TemplateEngine $tpl
* @param string $graphName Graphic name
* @param string $showWhen Period to show
*/
function selectedGraphic($tpl, $graphName, $showWhen)
{
$cfg = Registry::get('config');
/** @var PluginManager $pluginManager */
$pluginManager = Registry::get('pluginManager');
$graphDirectory = $pluginManager->pluginGetDirectory() . '/Monitorix/themes/default/assets/images/graphs';
$monitorixGraphics = array();
if ($dirHandle = @opendir($graphDirectory)) {
while (($file = @readdir($dirHandle)) !== false) {
if (!is_dir($file) && preg_match("/^{$graphName}\\d+[a-y]?[z]\\.\\d{$showWhen}\\.png/", $file)) {
array_push($monitorixGraphics, $file);
}
}
closedir($dirHandle);
if (count($monitorixGraphics) > 0) {
sort($monitorixGraphics);
foreach ($monitorixGraphics as $graphValue) {
$tpl->assign('MONITORIXGRAPH', pathinfo($graphValue, PATHINFO_FILENAME) . '.png');
$tpl->parse('MONITORIX_GRAPH_ITEM', '.monitorix_graph_item');
}
$tpl->assign('MONITORIXGRAPH_ERROR', '');
} else {
$tpl->assign(array('MONITORIXGRAPH_SELECTED' => '', 'MONITORIXGRAPHIC_ERROR' => tr("No graph for your selection is available")));
}
} else {
$tpl->assign(array('MONITORIXGRAPH_SELECTED' => '', 'MONITORIXGRAPHIC_ERROR' => tr("An error occured while opening the directory: %s", $graphDirectory)));
}
$htmlSelected = $cfg['HTML_SELECTED'];
$tpl->assign(array('M_HOUR_SELECTED' => $showWhen == 'hour' ? $htmlSelected : '', 'M_DAY_SELECTED' => $showWhen == 'day' ? $htmlSelected : '', 'M_WEEK_SELECTED' => $showWhen == 'week' ? $htmlSelected : '', 'M_MONTH_SELECTED' => $showWhen == 'month' ? $htmlSelected : '', 'M_YEAR_SELECTED' => $showWhen == 'year' ? $htmlSelected : '', 'MONITORIXGRAPH_NOT_SELECTED' => ''));
}
示例6: 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 : ''));
}
示例7: 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')));
}
示例8: 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);
}
}
示例9: 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;
}
}
示例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'));
}
}
}
示例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);
}
示例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)));
}
示例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);
}
示例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;
}
示例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');
}