/** * Konstruktor * * *Description* * * @param * * @return header */ public function __construct() { $this->request = array_merge($_GET, $_POST); $this->response = new \Framework\Response(); $this->response->errorReporting(); $this->xml = new \View\XML(\Framework\Utility::getCharset()); $this->entries = new \Model\GetContent(); }
/** * Konstruktor * * *Description* * * @param * * @return void */ public function __construct() { $this->request = array_merge($_GET, $_POST); $this->response = new \Framework\Response(); $this->response->errorReporting(); // Sets the default timezone used by all date/time functions in a script \Framework\Utility::setTimezone(); $this->site = new \View\Install(); $this->install = new \Model\InstallModel(); $this->entries = new \Model\GetContent(); // Neue Session starten $this->session = new \Framework\Session('INSTALL'); }
/** * Sende Header-Information * * *Description* Sende Header Information, Ausgabe aller PHP header() * * @param * * @return array */ private function sendAllHeaders() { $this->response->modifyHeader('status', 200); $this->response->modifyHeader('content-type', 'text/html'); $this->response->sendHeaders(); // Sets the default timezone used by all date/time functions in a script \Framework\Utility::setTimezone(); }
/** * Zeichensatz DB setzen * * *Description* Globalen Zeichensatz verwenden * * @param * * @return string */ private static function setMySQLCharset() { self::$charset = \Framework\Utility::getCharset(1); }
/** * Setzt Variablen für Verwendung im Template * * *Description* * * @param * * @return object */ private function setValues() { // HTML-Gerüst Head, Closing Structure $arr_allowed = array('firstname', 'lastname', 'street', 'postalzip', 'city', 'phone', 'email', 'company', 'opening', 'variable', 'keywords', 'description', 'slogan', 'headline', 'content', 'title', 'indexation', 'panel1', 'panel2', 'panel3', 'pathTemplate', 'searchform', 'charset'); // Lade alle Daten in einen Array $var = array_merge($this->entries->getEntry($this->page), $this->Panel(), $this->entries->getSiteSettings(), array('pathTemplate' => $this->pathTemplate, 'searchform' => $this->getHTMLForms('Search'), 'charset' => \Framework\Utility::getCharset())); foreach ($var as $key => $value) { if (in_array($key, $arr_allowed)) { $name = ucfirst($key); //Handling Content if ($key == 'content') { // Compile Content $this->site->{$name} = !empty($this->searchRequest) ? $this->searchRequest : $this->compileContent($value); } elseif ($key == 'panel1' or $key == 'panel2' or $key == 'panel3') { // Compile Panel $this->site->{$name} = $this->compileContent($value); } else { // Other Values ... $this->site->{$name} = $value; } } } }
/** * Validiere Variablen * * *Description* * * @param array * * @return array */ public function validVarsSetting($request) { $settings = $this->entries->getSiteSettings(); foreach ($this->required_fields['settings'] as $key) { if (!array_key_exists($key, $request)) { $request[$key] = $settings[$key]; } } // HTML Entities kodieren foreach ($request as $key => $value) { if ($key != 'email') { $request[$key] = !empty($request[$key]) ? htmlentities(strip_tags($value), ENT_QUOTES, \Framework\Utility::getCharset()) : ''; } } return $request; }
/** * Set content type * * *Description* * * @param string $type * @return mixed Returns a string value upon success. Returns false upon failure. */ private function setContentType($type) { if (in_array($type, $this->listMimeType)) { return $type . '; charset=' . \Framework\Utility::getCharset(); } else { return FALSE; } }
/** * Inspired by os.networkInterfaces() from node.js. * * @return {array} Returns a brief info of available network interfaces. */ public static function networkInterfaces() { switch (strtoupper(PHP_OS)) { case 'DARWIN': // MAC OS X $res = preg_split('/\\n/', @`ifconfig`); $res = array_filter(array_map('trim', $res)); $result = array(); foreach ($res as $row) { if (preg_match('/^(\\w+\\d+)\\:\\s+(.+)/', $row, $matches)) { $result['__currentInterface'] = $matches[1]; $result[$result['__currentInterface']]['__internal'] = false !== strpos($matches[2], 'LOOPBACK'); } else { if (preg_match('/^inet(6)?\\s+([^\\/\\s]+)(?:%.+)?/', $row, $matches)) { $iface =& $result[$result['__currentInterface']]; @($iface[] = array('address' => $matches[2], 'family' => $matches[1] ? 'IPv6' : 'IPv4', 'internal' => $iface['__internal'])); unset($iface); } } unset($matches); } unset($row, $res); unset($result['__currentInterface']); return array_filter(array_map(compose('array_filter', removes('__internal')), $result)); case 'LINUX': // $ifaces = `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d'`; // $ifaces = preg_split('/\s+/', $ifaces); $res = preg_split('/\\n/', @`ip addr`); $res = array_filter(array_map('trim', $res)); $result = array(); foreach ($res as $row) { if (preg_match('/^\\d+\\:\\s+(\\w+)/', $row, $matches)) { $result['__currentInterface'] = $matches[1]; } else { if (preg_match('/^link\\/(\\w+)/', $row, $matches)) { $result[$result['__currentInterface']]['__internal'] = strtolower($matches[1]) == 'loopback'; } else { if (preg_match('/^inet(6)?\\s+([^\\/]+)(?:\\/\\d+)?.+\\s([\\w\\d]+)(?:\\:\\d+)?$/', $row, $matches)) { @($result[$matches[3]][] = array('address' => $matches[2], 'family' => $matches[1] ? 'IPv6' : 'IPv4', 'internal' => Utility::cascade(@$result[$matches[3]]['__internal'], false))); } } } unset($matches); } unset($row, $res); unset($result['__currentInterface']); return array_filter(array_map(compose('array_filter', removes('__internal')), $result)); case 'WINNT': // Currently not supported. // Currently not supported. default: return false; } }