本文整理汇总了PHP中System类的典型用法代码示例。如果您正苦于以下问题:PHP System类的具体用法?PHP System怎么用?PHP System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* {@inheritdoc}
*/
public function handle(\Input $input)
{
$this->handleRunOnce();
// PATCH
if ($input->post('FORM_SUBMIT') == 'database-update') {
$count = 0;
$sql = deserialize($input->post('sql'));
if (is_array($sql)) {
foreach ($sql as $key) {
if (isset($_SESSION['sql_commands'][$key])) {
$this->Database->query(str_replace('DEFAULT CHARSET=utf8;', 'DEFAULT CHARSET=utf8 COLLATE ' . $GLOBALS['TL_CONFIG']['dbCollation'] . ';', $_SESSION['sql_commands'][$key]));
$count++;
}
}
}
$_SESSION['sql_commands'] = array();
Messages::addConfirmation(sprintf($GLOBALS['TL_LANG']['composer_client']['databaseUpdated'], $count));
$this->reload();
}
/** @var \Contao\Database\Installer $installer */
$installer = \System::importStatic('Database\\Installer');
$form = $installer->generateSqlForm();
if (empty($form)) {
Messages::addInfo($GLOBALS['TL_LANG']['composer_client']['databaseUptodate']);
$this->redirect('contao/main.php?do=composer');
}
$form = preg_replace('#(<label for="sql_\\d+")>(CREATE TABLE)#', '$1 class="create_table">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` ADD)#', '$1 class="alter_add">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` DROP)#', '$1 class="alter_drop">$2', $form);
$form = preg_replace('#(<label for="sql_\\d+")>(DROP TABLE)#', '$1 class="drop_table">$2', $form);
$template = new \BackendTemplate('be_composer_client_update');
$template->composer = $this->composer;
$template->form = $form;
return $template->parse();
}
示例2: executeImpact
/**
* @see AbstractFleetEventHandler::executeImpact()
*/
public function executeImpact()
{
// check colonies
$sql = "SELECT COUNT(*) AS count\r\n\t\t\t\tFROM ugml_planets\r\n\t\t\t\tWHERE planetKind = 1\r\n\t\t\t\t\tAND id_owner = " . $this->ownerID;
$count = WCF::getDB()->getFirstRow($sql);
// get existing planet
$system = new System($this->galaxy, $this->system);
$planetObj = $system->getPlanet($this->planet);
// restricted by planet limit
if ($count['count'] >= self::MAX_PLANETS) {
$this->message = 'planetLimit';
return;
}
// planet exists
if ($planetObj !== null) {
$this->message = 'exists';
return;
}
// create planet
--$this->fleet[self::COLONY_SHIP];
$name = WCF::getLanguage()->get('wot.planet.colony');
$planet = PlanetEditor::create($this->galaxy, $this->system, $this->planet, $name, $this->ownerID, self::DEFAULT_METAL, self::DEFAULT_CRYSTAL, self::DEFAULT_DEUTERIUM, 1, time(), self::DEFAULT_FIELDS, null);
$planet->getEditor()->changeResources($this->metal, $this->crystal, $this->deuterium);
$planet->getEditor()->changeLevel($this->fleet);
$this->getEditor()->delete();
}
示例3: OLE_PPS_Root
/**
* Constructor
*
* @access public
* @param integer $time_1st A timestamp
* @param integer $time_2nd A timestamp
*/
function OLE_PPS_Root($time_1st, $time_2nd, $raChild)
{
$_ole = new OLE();
$_sys = new System();
$this->_tmp_dir = $_sys->tmpdir();
$this->OLE_PPS(null, $_ole->Asc2Ucs('Root Entry'), OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
}
示例4: actionIndex
/**
* List users and their permissions
*/
public function actionIndex($p)
{
$this->bag->tabs = $this->user->inRooms();
$system = new System();
$this->bag->users = $system->userPermissions();
$this->renderAction('listing');
}
示例5: updateplanAction
public function updateplanAction()
{
global $mySession;
$db = new Db();
$planId = $this->getRequest()->getParam('planId');
$this->view->planId = $planId;
$planData = $db->runQuery("select * from " . SUBSCRIPTIONS . " where plan_id='" . $planId . "'");
$this->view->planImage = $planData[0]['plan_image'];
$this->view->pageHeading = "Edit Subscription Plan";
if ($this->getRequest()->isPost()) {
$request = $this->getRequest();
$myform = new Form_Subscription($planId);
if ($myform->isValid($request->getPost())) {
$dataForm = $myform->getValues();
$myObj = new System();
$Result = $myObj->UpdatePlan($dataForm, $planId);
if ($Result == 1) {
$mySession->errorMsg = "Subscription plan updated successfully.";
$this->_redirect('subscription/index');
} else {
$mySession->errorMsg = "Subscription plan name you entered is already exists.";
$this->view->myform = $myform;
$this->render('editplan');
}
} else {
$this->view->myform = $myform;
$this->render('editplan');
}
} else {
$this->_redirect('subscription/editplan/planId/' . $planId);
}
}
示例6: edittemplateAction
public function edittemplateAction()
{
global $mySession;
$db = new Db();
$templateId = $this->getRequest()->getParam('templateId');
$this->view->templateId = $templateId;
$templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='" . $templateId . "'");
$myform = new Form_Mailtemplate($templateId);
$this->view->myform = $myform;
$this->view->pageHeading = "Edit - " . $templateData[0]['template_title'];
if ($this->getRequest()->isPost()) {
$request = $this->getRequest();
$myform = new Form_Mailtemplate($templateId);
if ($myform->isValid($request->getPost())) {
$dataForm = $myform->getValues();
$myObj = new System();
$Result = $myObj->UpdateTemplate($dataForm, $templateId);
if (isset($_REQUEST['save_or_send']) && $_REQUEST['save_or_send'] == '2') {
$mySession->sucessMsg = "Newsletter successfully saved and sent to all subscribed members.";
} else {
$mySession->sucessMsg = "Email Template updated successfully.";
}
$this->_redirect('system/emailtemplates');
}
}
$this->view->myform = $myform;
}
示例7: readParametersSpec
/**
* @see FleetStartDirectFireAction::readParametersSpec()
*/
public function readParametersSpec()
{
$system = new System($this->galaxy, $this->system);
$planet = $system->getPlanet($this->planet, 2);
$resources = $planet->metal + $planet->crystal;
$recyclers = min(ceil($resources / 20000), Spec::getSpecObj(self::RECYCLER)->level);
$this->spec[self::RECYCLER] = $recyclers;
}
示例8: run
public function run()
{
if (!($this->from_flavor == 'ce' && $this->toFlavor('pro'))) {
return;
}
$system = new System();
$system->system_key = $this->config['unique_key'];
$system->user_id = '1';
$system->last_connect_date = TimeDate::getInstance()->nowDb();
$system_id = $system->retrieveNextKey(false, true);
$this->db->query("INSERT INTO config (category, name, value) VALUES ( 'system', 'system_id', '" . $system_id . "')");
}
示例9: getUserByEmail
/**
* Get User by usrGmail
*
* @param string $usr_gmail Unique id of User
*
* return uid
*
*/
public function getUserByEmail($usr_gmail)
{
//getting the user data
require_once PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php";
$oUsers = new \Users();
$response['user'] = $oUsers->loadByUserEmailInArray($usr_gmail);
//getting the skin
require_once PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php";
$sysConf = new \System();
$responseSysConfig = $sysConf->getSystemConfiguration(PATH_CONFIG . 'env.ini');
$response['enviroment'] = $responseSysConfig['default_skin'];
return $response;
}
示例10: getValue
/**
*
* Enter description here ...
* @return multitype:System
*/
public static function getValue()
{
$dbh = $GLOBALS['dbh'];
$results = array();
$sql = "\n\t\t\tSELECT \n\t\t\t\t*\n\t\t\tFROM \n\t\t\t\tsystem\n\t\t";
foreach ($dbh->query($sql) as $r) {
$row = new System();
$row->set_var($r['var']);
$row->set_val($r['val']);
$results[] = $row;
}
return $results;
}
示例11: getTargetPlanet
/**
* Returns the planet object of the target planet.
*
* @return Planet
*/
protected function getTargetPlanet()
{
if ($this->planetObj === null) {
$system = new System($this->galaxy, $this->system);
$this->planetObj = $system->getPlanet($this->planet, $this->planetType);
$this->fleetQueue->storePlanet($this->planetObj);
$this->fleetQueue->galaxy = $this->galaxy;
$this->fleetQueue->system = $this->system;
$this->fleetQueue->planet = $this->planet;
$this->fleetQueue->planetType = $this->planetType;
}
return $this->planetObj;
}
示例12: formAddNovaCategoria
public function formAddNovaCategoria()
{
$sys = new System();
$params = $sys->getParam();
//VERIFICA SE VEIO ALGUM CÓDIGO DE ERRO OU DE SUCESSO POR PARÂMETRO NA URL
$erro = array_key_exists('erro', $params) ? $params['erro'] : 0;
$sucesso = array_key_exists('sucesso', $params) ? $params['sucesso'] : 0;
$categorias = new categoriaModel();
$categorias->buscaCategoriasOrderBy($categorias, 'datacad', 'desc');
$categorias = $categorias->retornaDados('assoc');
$dados = array('titulo' => NOMESITE, 'tela' => 'produtos/formAddNovaCategoria', 'erro' => $erro, 'sucesso' => $sucesso, 'categorias' => $categorias);
$this->view('camadasadmin', $dados);
}
示例13: run
/**
* Generate the module
*
* @return string
*/
public function run()
{
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_maintenance_mode');
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceMode'];
$objTemplate->isActive = $this->isActive();
try {
$driver = \System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
$isLocked = $driver->isExists();
} catch (\Exception $e) {
return '';
}
// Toggle the maintenance mode
if (\Input::post('FORM_SUBMIT') == 'tl_maintenance_mode') {
if ($isLocked) {
$driver->unlock();
} else {
$driver->lock();
}
$this->reload();
}
if ($isLocked) {
$objTemplate->class = 'tl_confirm';
$objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'];
$objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceDisable'];
} else {
$objTemplate->class = 'tl_info';
$objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceDisabled'];
$objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceEnable'];
}
return $objTemplate->parse();
}
示例14: invokeHandler
protected function invokeHandler()
{
$specific = array();
$size = getimagesize($this->file->getAbsPath());
if ($size !== false) {
$specific['imagesize'] = $size[0] . ' x ' . $size[1] . ' px';
} else {
$specific['imagesize'] = System::getLanguage()->_('Unknown');
}
if (extension_loaded('imagick') && class_exists('Imagick')) {
try {
$i = new Imagick($this->file->getAbsPath());
$specific['format'] = $i->getimageformat();
} catch (Exception $e) {
Log::handleException($e, false);
if ($this->file->ext == "svg") {
Log::sysLog('ImageHandler', '"librsvg" is not installed. Without it Imagick could not handle .svg files!');
}
}
} else {
$specific['format'] = System::getLanguage()->_('Unknown');
}
$this->smarty->assign('specific', $specific);
$this->smarty->display('handler/image.tpl');
}
示例15: __construct
/**
* Initialize the controller
*
* 1. Import the user
* 2. Call the parent constructor
* 3. Authenticate the user
* 4. Load the language files
* DO NOT CHANGE THIS ORDER!
*/
public function __construct()
{
$this->import('BackendUser', 'User');
parent::__construct();
$this->User->authenticate();
\System::loadLanguageFile('default');
}