Example #1
1
 /**
  * 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);
 }
 /**
  * {@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();
 }
Example #3
0
 /**
  * IP of the Host
  *
  * @return void
  */
 protected function ip()
 {
     if (PSI_USE_VHOST === true) {
         if ((($result = getenv('SERVER_ADDR')) || ($result = getenv('LOCAL_ADDR'))) && !strstr($result, '.') && strstr($result, ':')) {
             //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
             $dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
             if (isset($dnsrec[0]['ipv6'])) {
                 //is DNS IPv6 record
                 $this->sys->setIp($dnsrec[0]['ipv6']);
                 //from DNS (avoid IPv6 NAT translation)
             } else {
                 $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result));
                 //from SERVER_ADDR or LOCAL_ADDR
             }
         } else {
             $this->sys->setIp(gethostbyname($this->sys->getHostname()));
             //IPv4 only
         }
     } else {
         if (($result = getenv('SERVER_ADDR')) || ($result = getenv('LOCAL_ADDR'))) {
             $this->sys->setIp(preg_replace('/^::ffff:/i', '', $result));
         } else {
             $this->sys->setIp(gethostbyname($this->sys->getHostname()));
         }
     }
 }
Example #4
0
 /**
  * @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();
 }
Example #5
0
 /**
  * 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');
 }
 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);
     }
 }
Example #7
0
 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;
 }
 /**
  * @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;
 }
Example #9
0
 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 . "')");
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * 
  * 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;
 }
 /**
  * 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;
 }
Example #13
0
 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);
 }
 public function get()
 {
     if (!$this->timeZone) {
         $net = $this->system->getNetPath();
         if ($net) {
             $command = sprintf('%s time zone -S %s', $net, escapeshellarg($this->host));
             $this->timeZone = exec($command);
         } else {
             // fallback to server timezone
             $this->timeZone = date_default_timezone_get();
         }
     }
     return $this->timeZone;
 }
Example #15
0
 /**
  * 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();
 }
 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');
 }
Example #17
0
 /**
  * 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');
 }
Example #18
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #19
0
 public function upimage()
 {
     //System::load_app_class('Uploader','','no');
     //上传图片框中的描述表单名称,
     //$title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
     //$path = htmlspecialchars($_POST['dir'], ENT_QUOTES);
     if (!isset($_POST['pictitle']) && !isset($_FILES['upfile'])) {
         exit;
     }
     $title = $_POST['pictitle'];
     $path = G_UPLOAD . 'shopimg/';
     System::load_sys_class('upload', 'sys', 'no');
     upload::upload_config(array('png', 'jpg', 'jpeg', 'gif'), 500000, 'shopimg');
     upload::go_upload($_FILES['upfile']);
     if (!upload::$ok) {
         $url = '';
         $title = $title;
         $originalName = '';
         $state = upload::$error;
     } else {
         $url = G_UPLOAD_PATH . '/shopimg/' . upload::$filedir . "/" . upload::$filename;
         $title = $title;
         $originalName = '';
         $state = 'SUCCESS';
     }
     echo "{'url':'" . $url . "','title':'" . $title . "','original':'" . $originalName . "','state':'" . $state . "'}";
     //{'url':'upload/20130728/13749880933714.jpg','title':'梨花.jpg','original':'梨花.jpg','state':'SUCCESS'}
 }
Example #20
0
 /**
  * Handles an error.
  *
  * @param integer $errno      Number of the error.
  * @param string  $errstr     Error message.
  * @param string  $errfile    Filename where the error occurred.
  * @param integer $errline    Line of the error.
  * @param string  $errcontext Context of the error.
  *
  * @return boolean
  */
 public function handler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = null)
 {
     $this->setupHandler($errno, $errstr, $errfile, $errline, $errcontext);
     // Notify all loggers
     $this->eventManager->notify($this->event->setArgs(array('trace' => $this->trace, 'type' => $this->type, 'errno' => $this->errno, 'errstr' => $this->errstr, 'errfile' => $this->errfile, 'errline' => $this->errline, 'errcontext' => $this->errcontext)));
     if ($this->isPHPError() && System::isDevelopmentMode() && $this->showPHPErrorHandler()) {
         // allow PHP to return error
         $this->resetHandler();
         return false;
     }
     if (!$this->isDisplayErrorTemplate()) {
         // prevent PHP from handling the event after we return
         $this->resetHandler();
         return true;
     }
     // obey reporing level
     if (abs($this->getType()) > $this->serviceManager['log.display_level']) {
         return false;
     }
     // unless in development mode, exit.
     if (!$this->serviceManager['log.display_template']) {
         return false;
     }
     // if we get this far, display template
     echo ModUtil::func('Errors', 'user', 'system', array('type' => $this->errno, 'message' => $this->errstr, 'file' => $this->errfile, 'line' => $this->errline));
     Zikula_View_Theme::getInstance()->themefooter();
     System::shutDown();
 }
Example #21
0
function skinList()
{
    G::loadClass('system');
    $skinList = System::getSkingList();
    $wildcard = '';
    if (isset($_REQUEST['activeskin'])) {
        $wildcard = '@';
    }
    $filterList = array();
    if (defined('PARTNER_FLAG')) {
        $filterList = array('00000000000000000000000000000001', '00000000000000000000000000000002');
    }
    foreach ($skinList['skins'] as $key => $value) {
        if (!isset($value['SKIN_ID']) || !in_array($value['SKIN_ID'], $filterList)) {
            if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs' && $value['SKIN_FOLDER_ID'] != 'uxmodern') {
                if ($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']) {
                    $value['SKIN_STATUS'] = $wildcard . G::LoadTranslation('ID_ACTIVE');
                    $value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
                    $value['SKIN_WORKSPACE'] = $wildcard . $value['SKIN_WORKSPACE'];
                    $value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
                    $value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
                    $value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
                    $value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE'];
                } else {
                    $value['SKIN_STATUS'] = G::LoadTranslation('ID_INACTIVE');
                }
                $skinListArray['skins'][] = $value;
            }
        }
    }
    $skinListArray['currentSkin'] = $skinList['currentSkin'];
    echo G::json_encode($skinListArray);
}
/**
 * Smarty function to return first image src from given HTML content.
 *
 * Examples
 *  {getImage htmlcontent=$item.body}
 *  {getImage htmlcontent=$item.body putbaseurl=true}
 *  {getImage htmlcontent=$item.body putbaseurl=true assign='imagesrc'}
 *
 * @return string
 */
function smarty_function_getImage($params, Zikula_View $view)
{
    $result = $params['htmlcontent'];
    if (isset($params['htmlcontent']) && $params['htmlcontent']) {
        if (strpos($params['htmlcontent'], '<img ') === false) {
            // image is not found in content
        } else {
            // get image src
            $posstart = strpos($params['htmlcontent'], ' src="', $posstart) + 6;
            $posend = strpos($params['htmlcontent'], '"', $posstart);
            $result = substr($params['htmlcontent'], $posstart, $posend - $posstart);
            if (isset($params['putbaseurl']) && $params['putbaseurl']) {
                // put base url, if not
                if (substr($result, 0, 7) != 'http://' || substr($result, 0, 8) != 'https://') {
                    $result = System::getBaseUrl() . ltrim($result, DIRECTORY_SEPARATOR);
                }
            }
        }
    }
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $result);
    } else {
        return $result;
    }
}
Example #23
0
 public static function read($pin, $automode = false)
 {
     if ($automode) {
         self::mode($pin, 'in');
     }
     return System::commandSilent(self::GPIO_DEFAULT_PATH . ' read ' . $pin);
 }
Example #24
0
 function PlayGame()
 {
     // Validation to make sure one of the RadioButtons was Selected
     if ($this->DifficultyGroup->SelectedValue != null) {
         /*Clearing the Controls removes from the screen everything that
         		has been added to this Panel so far*/
         $this->Controls->Clear();
         /* Sets the number of chances based on the selected difficulty. 
         			It will be 10, 5, or 3 because those were the three Values of the 
         			Items passed into the difficulty RadioButtons when they were 
         			instantiated.*/
         $this->Chances = $this->DifficultyGroup->SelectedValue;
         //Create more necessary Controls
         $makeGuess = new Label('Please Make a Guess:', 15, 60, 200);
         $this->ChancesLeftLabel = new Label("You have made {$this->BadGuesses} bad guesses out of a maximum of {$this->Chances}.", 15, 178, 350);
         $giveUp = new Link(null, 'Give up', 15, 250, 60);
         $giveUp->Click = new ServerEvent($this, 'EndGame', 'You Lose!');
         $guess = new Label('Guess:', $this->ChancesLeftLabel->Left, $this->ChancesLeftLabel->Bottom + 20, 60);
         //Add these new Controls
         $this->Controls->AddRange($makeGuess, $this->ChancesLeftLabel, $giveUp, $guess);
         // Create Labels for all the letters from A to Z
         $this->CreateLetters();
         // Get a random word that the user will try to guess
         $this->GetWord();
         // Automatically call VannaWhite to open all the spaces of the word
         $this->VannaWhite('-');
     } else {
         System::Alert('You must choose a difficulty level before playing.');
     }
 }
Example #25
0
 /**
  * Generate the content element
  */
 protected function compile()
 {
     $rows = deserialize($this->tableitems);
     $this->Template->id = 'table_' . $this->id;
     $this->Template->summary = specialchars($this->summary);
     $this->Template->useHeader = $this->thead ? true : false;
     $this->Template->useFooter = $this->tfoot ? true : false;
     $this->Template->useLeftTh = $this->tleft ? true : false;
     $this->Template->sortable = $this->sortable ? true : false;
     $arrHeader = array();
     $arrBody = array();
     $arrFooter = array();
     // Table header
     if ($this->thead) {
         foreach ($rows[0] as $i => $v) {
             // Set table sort cookie
             if ($this->sortable && $i == $this->sortIndex) {
                 $co = 'TS_TABLE_' . $this->id;
                 $so = $this->sortOrder == 'descending' ? 'desc' : 'asc';
                 if (\Input::cookie($co) == '') {
                     \System::setCookie($co, $i . '|' . $so, 0);
                 }
             }
             // Add cell
             $arrHeader[] = array('class' => 'head_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[0]) - 1 ? ' col_last' : '') . ($i == 0 && $this->tleft ? ' unsortable' : ''), 'content' => $v != '' ? nl2br_html5($v) : '&nbsp;');
         }
         array_shift($rows);
     }
     $this->Template->header = $arrHeader;
     $limit = $this->tfoot ? count($rows) - 1 : count($rows);
     // Table body
     for ($j = 0; $j < $limit; $j++) {
         $class_tr = '';
         if ($j == 0) {
             $class_tr .= ' row_first';
         }
         if ($j == $limit - 1) {
             $class_tr .= ' row_last';
         }
         $class_eo = $j % 2 == 0 ? ' odd' : ' even';
         foreach ($rows[$j] as $i => $v) {
             $class_td = '';
             if ($i == 0) {
                 $class_td .= ' col_first';
             }
             if ($i == count($rows[$j]) - 1) {
                 $class_td .= ' col_last';
             }
             $arrBody['row_' . $j . $class_tr . $class_eo][] = array('class' => 'col_' . $i . $class_td, 'content' => $v != '' ? nl2br_html5($v) : '&nbsp;');
         }
     }
     $this->Template->body = $arrBody;
     // Table footer
     if ($this->tfoot) {
         foreach ($rows[count($rows) - 1] as $i => $v) {
             $arrFooter[] = array('class' => 'foot_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[count($rows) - 1]) - 1 ? ' col_last' : ''), 'content' => $v != '' ? nl2br_html5($v) : '&nbsp;');
         }
     }
     $this->Template->footer = $arrFooter;
 }
 public function executePostActionsHook($strAction, \DataContainer $dc)
 {
     if ($strAction !== static::$uploadAction) {
         return false;
     }
     // Check whether the field is allowed for regular users
     if (!isset($GLOBALS['TL_DCA'][$dc->table]['fields'][\Input::post('field')]) || $GLOBALS['TL_DCA'][$dc->table]['fields'][\Input::post('field')]['exclude'] && !\BackendUser::getInstance()->hasAccess($dc->table . '::' . \Input::post('field'), 'alexf')) {
         \System::log('Field "' . \Input::post('field') . '" is not an allowed selector field (possible SQL injection attempt)', __METHOD__, TL_ERROR);
         $objResponse = new ResponseError();
         $objResponse->setMessage('Bad Request');
         $objResponse->output();
     }
     $this->name = \Input::post('field');
     $this->id = \Input::post('field');
     $this->field = \Input::post('field');
     if ($dc->activeRecord === null) {
         $dc->activeRecord = General::getModelInstance($dc->table, $dc->id);
     }
     // add dca attributes
     $this->addAttributes(\Widget::getAttributesFromDca($GLOBALS['TL_DCA'][$dc->table]['fields'][$this->name], $this->name));
     $objResponse = $this->upload();
     /** @var Response */
     if ($objResponse instanceof Response) {
         $objResponse->output();
     }
 }
Example #27
0
 /**
  * Displays a particular model.
  */
 public function actionView($id)
 {
     $this->layout = '//layouts/templates/admin';
     $model = System::loadModel('User', $id);
     $this->seo(Yii::t('admin', 'View user') . ' ' . $model->username);
     $this->render('view', array('model' => $model));
 }
    /**
     * Generate a list for the dcaWizard displaying the languages
     * @param   \Database_Result
     * @param   string
     * @return  string
     */
    public function generateWizardList($objRecords, $strId, $widget)
    {
        $strReturn = '
<table class="tl_listing showColumns">
<thead>
    <td class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['tl_nc_language']['language'][0] . '</td>
    <td class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['tl_nc_language']['fallback'][0] . '</td>
    <td class="tl_folder_tlist"></td>
</thead>
<tbody>';
        $arrLanguages = \System::getLanguages();
        while ($objRecords->next()) {
            $row = $objRecords->row();
            $strReturn .= '
<tr>
    <td class="tl_file_list">' . $arrLanguages[$objRecords->language] . '</td>
    <td class="tl_file_list">' . ($objRecords->fallback ? '&#10004;' : '') . '</td>
    <td class="tl_file_list">' . $widget->generateRowOperation('edit', $row) . '</td>
</tr>
';
        }
        $strReturn .= '
</tbody>
</table>';
        return $strReturn;
    }
/**
 * Zikula_View function to create  manual link.
 *
 * This function creates a manual link from some parameters.
 *
 * Available parameters:
 *   - manual:    name of manual file, manual.html if not set
 *   - chapter:   an anchor in the manual file to jump to
 *   - newwindow: opens the manual in a new window using javascript
 *   - width:     width of the window if newwindow is set, default 600
 *   - height:    height of the window if newwindow is set, default 400
 *   - title:     name of the new window if newwindow is set, default is modulename
 *   - class:     class for use in the <a> tag
 *   - assign:    if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {manuallink newwindow=1 width=400 height=300 title=rtfm }
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string|void
 */
function smarty_function_manuallink($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
    $userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $stdlang = System::getVar('language_i18n');
    $title = isset($params['title']) ? $params['title'] : 'Manual';
    $manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
    $chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
    $class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
    $width = isset($params['width']) ? $params['width'] : 600;
    $height = isset($params['height']) ? $params['height'] : 400;
    $modname = ModUtil::getName();
    $possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
    foreach ($possibleplaces as $possibleplace) {
        if (file_exists($possibleplace)) {
            $url = $possibleplace . $chapter;
            break;
        }
    }
    if (isset($params['newwindow'])) {
        $link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    } else {
        $link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    }
    if (isset($params['assign'])) {
        $ret = array('url' => $url, 'link' => $link);
        $view->assign($params['assign'], $ret);
        return;
    } else {
        return $link;
    }
}
Example #30
0
 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_login');
     // Show a cookie warning
     if (Input::get('referer', true) != '' && empty($_COOKIE)) {
         $this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
     $this->Template->theme = Backend::getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->languages = System::getLanguages(true);
     $this->Template->title = specialchars($strHeadline);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $this->Template->headline = $strHeadline;
     $this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $this->Template->curUsername = Input::post('username') ?: '';
     $this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $this->Template->frontendFile = Environment::get('base');
     $this->Template->disableCron = Config::get('disableCron');
     $this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $this->Template->output();
 }