public function testItCanGetJobProgressionFromApiInRealLife() { // Check for and set required server variables if (!isset($_SERVER['PARTNER_ID'])) { $this->markTestSkipped('PARTNER_ID is not available'); } if (!isset($_SERVER['PARTNER_KEY'])) { $this->markTestSkipped('PARTNER_KEY is not available'); } $_SERVER['REMOTE_ADDR'] = getHostByName(getHostName()); $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'; // Instantiate the connection $config = new Config($_SERVER['PARTNER_ID'], $_SERVER['PARTNER_KEY']); $connection = new Connection($config); $action = new JobProgression(); $action->addparam('jobTitle', 'developer'); // Get the response from the API $response = $connection->call($action); // Assert proper classes/results are returned $this->assertEquals('Glassdoor\\ResponseObject\\JobProgressionResponse', get_class($response)); foreach ($response->getJobProgressions() as $progression) { $this->assertEquals('Glassdoor\\ResponseObject\\JobProgression', get_class($progression)); $this->assertNotNull($progression->getJobTitle()); } }
public function testCurlTransport() { $mail = new Mail(); $mail->setTo('*****@*****.**'); $headers = $mail->getHeaders(); $headers->set('To', '*****@*****.**'); $headers->set('X-Foo', 23); $headers->set('X-Bar', 42); $headers->set('X-Foo-Bar', 1337); if (getEnv('TRAVIS')) { $from = new MailAddress(); $from->setMailbox(getEnv('USER')); $from->setHostName(getHostName()); $headers->set('From', $from); $headers->set('Subject', sprintf('%s #%s (%s)', getEnv('TRAVIS_REPO_SLUG'), getEnv('TRAVIS_JOB_NUMBER'), __METHOD__)); $headers->set('Content-Type', 'text/plain'); $mail->push(sprintf("Repository: %s\nJob: %s\nCommit: %s\nCommit-Range: %s\nPHP-Version: %s\n", getEnv('TRAVIS_REPO_SLUG'), getEnv('TRAVIS_JOB_NUMBER'), getEnv('TRAVIS_COMMIT'), getEnv('TRAVIS_COMMIT_RANGE'), getEnv('TRAVIS_PHP_VERSION'))); } else { $headers->set('From', '*****@*****.**'); $mail->push("Hello World"); } $credentials = getEnv('MAILTRAP_SMTP_CREDENTIALS'); if (!$credentials) { $this->markTestSkipped('Credentials for Mailtrap not found!'); } $credentials = explode(':', $credentials, 2); $transport = new CurlTransport('mailtrap.io', 2525); $transport->setCredentials($credentials[0], $credentials[1]); $transport->sendMail($mail); # $this->markTestIncomplete('Check sent mail via Mailtrap is not implemented'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->delete(); $thisIP = getHostByName(getHostName()); $testuser = User::create(array('username' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin'), 'created_ip' => $thisIP, 'last_ip' => $thisIP, 'created_by_user_id' => 1)); DB::table('user_permissions')->delete(); UserPermission::create(array('user_id' => $testuser->id, 'solder_full' => true)); }
function getConfigFilename() { $variablesScriptPath = $this->installPath . '/variables.php'; if (!file_exists($variablesScriptPath)) { return null; } require_once $variablesScriptPath; return $this->installPath . '/var/' . getHostName() . '.conf.php'; }
protected function userLastVisit($user_id) { $model = User::findOrFail($user_id); date_default_timezone_set("Asia/Dacca"); $date = date('Y-m-d H:i:s', time()); $model->last_visit = $date; $model->ip_address = getHostByName(getHostName()); $model->save(); }
public function getLocalIp() { $CI = & get_instance(); $ip = $CI->input->ip_address(); if ($ip == '::1') { $ip = getHostByName(getHostName()); } return $ip; }
public static function getLocalIp() { if (empty($_SERVER['SERVER_ADDR']) == false) { return $_SERVER['SERVER_ADDR']; } else { if (self::isCLI() == true) { return getHostName(); } else { return null; } } }
function setRating($objId, $rating, $remoteData = array()) { global $db, $page, $user; // checks if (!is_numeric($rating) || $rating < $this->minValue || $rating > $this->maxValue) { addError("invalid or empty rating"); return; } if (!empty($remoteData)) { // this rating comes from another node... // TODO } elseif ($page->loggedIn()) { // local rating from registered user $this->find($objId, $user->id); $this->set('rate', $rating); $this->set('host', getHostName()); $this->set('entered', $this->db->getTimestampTz()); if ($this->exists()) { // change existing rating $this->update(); } else { // new rating $this->set('prog_id', $objId); $this->set('user_id', $user->id); $this->set('user_node_id', 0); $this->create(); } } else { // anonymous rating // TODO: if there was a rating request from the same host within x minutes, then reject $key = $page->getAuthKey(); if ($key) { $this->findAnon($objId, $key); $this->set('rate', $rating); $this->set('host', getHostName()); $this->set('entered', $this->db->getTimestampTz()); if ($this->exists()) { // change existing rating $this->update(); } else { // new rating $this->set('prog_id', $objId); $this->set('auth_key', $key); $this->create(); } } else { addError($page->getlocalized("cannot_rate_no_authkey")); // or $this->set('problem', 'no_auth_key'); return; } } $this->updateInstant($objId); }
function hocwp_get_pc_ip() { $result = ''; if (function_exists('getHostByName')) { if (version_compare(PHP_VERSION, '5.3', '<') && function_exists('php_uname')) { $result = getHostByName(php_uname('n')); } elseif (function_exists('getHostName')) { $result = getHostByName(getHostName()); } } return $result; }
public function DVRUI_HDHRjson() { $storageURL = "??"; $myip = getHostByName(getHostName()); $hdhr_data = getJsonFromUrl($this->myhdhrurl); for ($i = 0; $i < count($hdhr_data); $i++) { $hdhr = $hdhr_data[$i]; $hdhr_base = $hdhr[$this->hdhrkey_baseURL]; $hdhr_ip = $hdhr[$this->hdhrkey_localIP]; if (!array_key_exists($this->hdhrkey_discoverURL, $hdhr)) { // Skip this HDHR - it doesn't support the newer HTTP interface // for DVR continue; } $hdhr_info = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]); if (array_key_exists($this->hdhrkey_storageURL, $hdhr)) { // this is a record engine! // Need to confirm it's a valid one - After restart of // engine it updates my.hdhomerun.com but sometimes the // old engine config is left behind. $rEngine = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]); if (strcmp($rEngine[$this->hdhrkey_storageID], $hdhr[$this->hdhrkey_storageID]) != 0) { //skip, this is not a valid engine continue; } //get the IP address of record engine. $hdhr_ip = $hdhr[$this->hdhrkey_localIP]; // Split IP and port if (preg_match('/^(\\d[\\d.]+):(\\d+)\\b/', $hdhr_ip, $matches)) { $ip = $matches[1]; $port = $matches[2]; // if IP of record engine matches the IP of this server // return storageURL if ($ip == $myip) { $this->storageURL = $hdhr[$this->hdhrkey_storageURL]; continue; } } } // ELSE we have a tuner $tuners = 'unknown'; if (array_key_exists($this->hdhrkey_tuners, $hdhr_info)) { $tuners = $hdhr_info[$this->hdhrkey_tuners]; } $legacy = 'No'; if (array_key_exists($this->hdhrkey_legacy, $hdhr_info)) { $legacy = $hdhr_info[$this->hdhrkey_legacy]; } $hdhr_lineup = getJsonFromUrl($hdhr_info[$this->hdhrkey_lineupURL]); $this->hdhrlist[] = array($this->hdhrkey_devID => $hdhr[$this->hdhrkey_devID], $this->hdhrkey_modelNum => $hdhr_info[$this->hdhrkey_modelNum], $this->hdhrlist_key_channelcount => count($hdhr_lineup), $this->hdhrkey_baseURL => $hdhr_base, $this->hdhrkey_lineupURL => $hdhr_info[$this->hdhrkey_lineupURL], $this->hdhrkey_modelName => $hdhr_info[$this->hdhrkey_modelName], $this->hdhrkey_auth => $hdhr_info[$this->hdhrkey_auth], $this->hdhrkey_fwVer => $hdhr_info[$this->hdhrkey_fwVer], $this->hdhrkey_tuners => $tuners, $this->hdhrkey_legacy => $legacy, $this->hdhrkey_fwName => $hdhr_info[$this->hdhrkey_fwName]); } }
/** * Integration test with actual API call to the provider. */ public function testItCanGetJobsFromApi() { if (!getenv('PARTNER_ID')) { $this->markTestSkipped('PARTNER_ID not set. Real API call will not be made.'); } $keyword = 'engineering'; $query = new JujuQuery(['k' => $keyword, 'partnerid' => getenv('PARTNER_ID'), 'ipaddress' => getHostByName(getHostName())]); $client = new JujuProvider($query); $results = $client->getJobs(); $this->assertInstanceOf('JobApis\\Jobs\\Client\\Collection', $results); foreach ($results as $job) { $this->assertEquals($keyword, $job->query); } }
/** this creates a log entry */ function logger($name, $msg = '', $type = 'default') { if ($type == 'default') { $type = $debug_type; } if (is_array($msg)) { ob_start(); //var_dump($msg); print_r($msg); $msg = "\n" . ob_get_contents(); ob_end_clean(); } error_log(getHostName() . ": {$name}: {$msg}", 0); if ($type == 'now' && headers_sent()) { echo "<small><pre> Debug: {$name}: {$msg} </pre></small><br>\n"; } }
public function connect() { $hostname = "localhost"; $username = "******"; $password = "******"; $_dbsname = "kepe3788_db"; if (getHostByName(getHostName()) != '127.0.1.1') { $hostname = "103.247.8.138"; $username = "******"; $password = "******"; $_dbsname = "kepe3788_db"; } $this->conn = new mysqli($hostname, $username, $password, $_dbsname); if ($this->conn->connect_error) { die("Connection failed: " . $this->conn->connect_error); } return $this->conn; }
/** this creates a log entry if $debug is true*/ function debug($name, $msg = '', $type = 'default') { global $debug, $debug_type; if ($debug) { // the $debug_type is set in config.inc.php if ($type == 'default') { $type = $debug_type; } if (is_array($msg)) { ob_start(); var_dump($msg); $msg = "\n" . ob_get_contents(); ob_end_clean(); } error_log(getHostName() . ": {$name}: {$msg}", 0); if ($type == 'now' && headers_sent()) { echo "<small><pre> Debug: {$name}: {$msg} </pre></small><br>\n"; } } }
/** * Make changes to the database. * * @return void */ public function up() { Schema::create('users', function ($table) { $table->increments('id'); $table->string('username'); $table->string('email'); $table->string('password'); $table->string('created_ip'); $table->string('last_ip')->nullable(); $table->timestamps(); }); /** * Create Default User **/ $user = new User(); $user->username = '******'; $user->email = '*****@*****.**'; $user->password = Hash::make('admin'); $user->created_ip = getHostByName(getHostName()); $user->save(); }
function getIP() { $ip = $_SERVER['SERVER_ADDR']; if (PHP_OS == 'WINNT') { $ip = getHostByName(getHostName()); } if (PHP_OS == 'Linux') { $command = "/sbin/ifconfig"; exec($command, $output); // var_dump($output); $pattern = '/inet addr:?([^ ]+)/'; $ip = array(); foreach ($output as $key => $subject) { $result = preg_match_all($pattern, $subject, $subpattern); if ($result == 1) { if ($subpattern[1][0] != "127.0.0.1") { $ip = $subpattern[1][0]; } } } } return $ip; }
/** * Test running migration. * * @test */ public function testSameIPIsLocal() { // Initialize the connection variables we'll need $this->port = Config::get('lxmpd::port'); $this->password = Config::get('lxmpd::password'); $hostname = getHostName(); $ip = getHostByName($hostname); // Test that determine is local returns true for the ip of the server $connection = new MPDConnection($ip, $this->port, $this->password); $connection->establish(); // Determine if the connection is local $connection->determineIfLocal(); // Check if the connection was marked as local $result = $connection->local; // Check if the result is true $this->assertEquals(true, $result); }
/** * * Iegūst klienta IP adresi * * @return string Klienta IP adrese */ private function getIpAddress() { return getHostByName(getHostName()); }
/** * Generates the index page and style guide */ protected function generateMainPages() { // make sure $this->mfs & $this->mv are refreshed $this->loadMustacheFileSystemLoaderInstance(); $this->loadMustacheVanillaInstance(); // get the source pattern paths $patternPathDests = array(); foreach ($this->patternPaths as $patternType => $patterns) { $patternPathDests[$patternType] = array(); foreach ($patterns as $pattern => $patternInfo) { if ($patternInfo["render"]) { $patternPathDests[$patternType][$pattern] = $patternInfo["patternDestPath"]; } } } // render out the main pages and move them to public $this->navItems['autoreloadnav'] = $this->autoReloadNav; $this->navItems['autoreloadport'] = $this->autoReloadPort; $this->navItems['pagefollownav'] = $this->pageFollowNav; $this->navItems['pagefollowport'] = $this->pageFollowPort; $this->navItems['patternpaths'] = json_encode($patternPathDests); $this->navItems['viewallpaths'] = json_encode($this->viewAllPaths); $this->navItems['mqs'] = $this->gatherMQs(); $this->navItems['qrcodegeneratoron'] = $this->qrCodeGeneratorOn; $this->navItems['ipaddress'] = getHostByName(getHostName()); $this->navItems['xiphostname'] = $this->xipHostname; $this->navItems['ishminimum'] = $this->ishMinimum; $this->navItems['ishmaximum'] = $this->ishMaximum; $this->navItems['ishControlsHide'] = $this->ishControlsHide; // grab the partials into a data object for the style guide $sd = array("partials" => array()); foreach ($this->patternPartials as $patternSubtypes) { foreach ($patternSubtypes as $patterns) { $sd["partials"][] = $patterns; } } // render the "view all" pages $this->generateViewAllPages(); // add cacheBuster info $this->navItems['cacheBuster'] = $this->cacheBuster; $sd['cacheBuster'] = $this->cacheBuster; // render the index page $r = $this->mfs->render('index', $this->navItems); file_put_contents($this->pd . "/index.html", $r); // render the style guide $sd = array_replace_recursive($this->d, $sd); $styleGuideHead = $this->mv->render($this->mainPageHead, $sd); $styleGuideFoot = $this->mv->render($this->mainPageFoot, $sd); $styleGuidePage = $styleGuideHead . $this->mfs->render('viewall', $sd) . $styleGuideFoot; if (!file_exists($this->pd . "/styleguide/html/styleguide.html")) { print "ERROR: the main style guide wasn't written out. make sure public/styleguide exists. can copy core/styleguide\n"; } else { file_put_contents($this->pd . "/styleguide/html/styleguide.html", $styleGuidePage); } }
function logRequest() { global $config, $startTime, $totalTime, $PHP_SELF; $host = getHostName(); error_log("{$host}: {$totalTime} ms, " . myGetenv("REQUEST_URI"), 0); if ($config['debug']) { error_log("--------------------------------------------------------------------", 0); } }
function login($name, $password) { global $user, $page; $storage =& sotf_User::getStorageObject(); $fields['password'] = sotf_Utils::magicQuotes($password); $fields['username'] = sotf_Utils::magicQuotes($name); $id = $storage->userDbLogin($fields); if (!$id) { error_log("Login failed for {$name} from " . getHostName(), 0); return $page->getlocalized("invalid_login"); } else { $user = new sotf_User($id); debug("Login successful", $user->name . ' = ' . $user->id); $_SESSION['currentUserId'] = $user->id; } }
/** * Get IP Address * * @return string */ public function getIpAddress() { return getHostByName(getHostName()); }
<?php //echo getHostName(); //$pusherIP='52.90.77.67'; if (auto_logout("user_time")) { session_unset(); session_destroy(); session_start(); $_SESSION["user_time"] = time(); } $pusherIP = '172.24.18.10'; $pusherIP = '192.168.0.106'; $pusherIP = getHostByName(getHostName()); //$pusherIP='52.90.77.67'; $servername = "localhost"; $username = "******"; $password = "******"; $dbname = "MyHoot"; //mysqladmin -u root -p'MyHoot' password myhoot // Create connection $conn = new mysqli($servername, $username, $password, $dbname); $conn->set_charset("utf8mb4"); $conn->query("SET collation_connection = utf8mb4_unicode_ci"); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } include "controller/siteFunctions.php"; // An array of $_POST keys that are acceptable if (isset($whitelist)) { foreach ($whitelist as $key) {
function startStreaming() { global $config, $page, $db; if ($config['httpStreaming']) { $this->makeLocalPlaylist(); $this->url = $config['tmpUrl'] . '/pl_' . $this->getTmpId() . '.m3u'; return; } // check if the stream has started already (Win+IE+Media player) $urls = $db->getCol("SELECT url FROM sotf_streams WHERE host='" . getHostName() . "' AND started < CURRENT_TIMESTAMP AND started > CURRENT_TIMESTAMP - interval '15 seconds'"); if (count($urls) == 1) { debug("found url for Win Explorer", $urls[0]); $this->url = $urls[0]; // found stream so we can return return; } $this->stopMyStream(); if ($config['tamburineURL']) { // streaming with tamburine + XML-RPC // playlist reset($this->audioFiles); while (list(, $audioFile) = each($this->audioFiles)) { $songs[] = $audioFile['path']; } $rpc = new rpc_Utils(); //$rpc->debug = true; $response = $rpc->callTamburine('setpls', $songs); if (is_null($response)) { raiseError("no reply from tamburine server"); } else { $this->url = $response[2]; $this->streamId = $response[1]; } if (!$this->url) { raiseError("Could not find mount point for stream!"); } } elseif ($config['tamburineCMD']) { // streaming with tbrcmd if (!$this->localPlaylist) { $this->makeLocalPlaylist(); } $cmd = $config['tamburineCMD'] . " setpls " . $this->localPlaylist . " 2>&1"; exec($cmd, $output, $retval); debug("cmd", $cmd); //debug("output", $output); //debug("retval", $retval); $lines = array_values(preg_grep('/Fatal Error:/', $output)); if (count($lines) > 0) { raiseError(join(", ", $lines)); // TODO: restart tamburine (??) } //$lines = preg_grep('/Stream\[(\d+)\]\s+spawned on (\S+)/', $output); foreach ($output as $line) { if (preg_match('/Stream\\[(\\d+)\\]\\s+spawned on (\\S+)/', $line, $mm)) { $this->streamId = $mm[1]; $this->url = $mm[2]; break; } } if (!$this->url) { raiseError("Could not find mount point for stream!"); } } else { // command-line streaming if (!$this->localPlaylist) { $this->makeLocalPlaylist(); } $this->url = 'http://' . $config['iceServer'] . ':' . $config['icePort'] . '/' . $this->getMountPoint() . "\n"; //$url = preg_replace('/^.*\/repository/', 'http://sotf2.dsd.sztaki.hu/node/repository', $filepath); // TODO: calculate bitrate from all files... $bitrate = $this->audioFiles[0]['bitrate']; if (!$bitrate) { $bitrate = 24; } $this->cmdStart($this->localPlaylist, $this->getMountPoint(), $bitrate); //$this->cmdStart2($bitrate); } if ($this->url) { $streamData = array('pid' => $this->streamId, 'url' => $this->url, 'started' => $db->getTimestamp(), 'length' => round($this->totalLength), 'will_end_at' => $db->getTimestamp(time() + round($this->totalLength)), 'host' => getHostName()); debug("streamData", $streamData); $_SESSION['stream'] = $streamData; $obj = new sotf_Object('sotf_streams'); $obj->setAll($streamData); $obj->create(); // TODO wait until stream really starts sleep(3); } }
function createLocalStatInfo($obj, $fileId, $type) { global $db; if ($type != 'listens' && $type != 'downloads' && $type != 'visits') { raiseError("addStat: type should be 'listens' or 'downloads' or 'visits'"); } $data = array('prog_id' => $obj->id, 'station_id' => $obj->get('station_id'), 'date' => time(), 'ip' => getHostName(), 'type' => $type, 'file' => $fileId); return $data; }
public static function myIP() { return getHostByName(getHostName()); }
public static function checkConf($_mode = 'external') { if ($_mode == 'internal') { if (trim(config::byKey('internalComplement')) == '/') { config::save('internalComplement', ''); } if (!filter_var(config::byKey('internalAddr'), FILTER_VALIDATE_IP)) { $internalAddr = str_replace(array('http://', 'https://'), '', config::byKey('internalAddr')); $pos = strpos($internalAddr, '/'); if ($pos !== false) { $internalAddr = substr($internalAddr, 0, $pos); } if ($internalAddr != config::byKey('internalAddr') && !netMatch('127.0.*.*', $internalAddr)) { config::save('internalAddr', $internalAddr); } } else { $internalIp = getHostByName(getHostName()); if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) { $internalIp = self::getInterfaceIp('eth0'); } if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) { $internalIp = self::getInterfaceIp('bond0'); } if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) { $internalIp = self::getInterfaceIp('wlan0'); } if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) { $internalIp = explode(' ', shell_exec('hostname -I')); $internalIp = $internalIp[0]; } if ($internalIp != '' && filter_var($internalIp, FILTER_VALIDATE_IP) && !netMatch('127.0.*.*', $internalIp)) { config::save('internalAddr', $internalIp); } } if (config::byKey('internalProtocol') == '') { config::save('internalProtocol', 'http://'); } if (config::byKey('internalPort') == '') { config::save('internalPort', 80); } if (config::byKey('internalProtocol') == 'https://' && config::byKey('internalPort') == 80) { config::save('internalPort', 443); } if (config::byKey('internalProtocol') == 'http://' && config::byKey('internalPort') == 443) { config::save('internalPort', 80); } } if ($_mode == 'external') { if ($_mode == 'external' && trim(config::byKey('externalComplement')) == '/') { config::save('externalComplement', ''); } if (!filter_var(config::byKey('externalAddr'), FILTER_VALIDATE_IP)) { $externalAddr = str_replace(array('http://', 'https://'), '', config::byKey('externalAddr')); $pos = strpos($externalAddr, '/'); if ($pos !== false) { $externalAddr = substr($externalAddr, 0, $pos); } if ($externalAddr != config::byKey('externalAddr')) { config::save('externalAddr', $externalAddr); } } } if (file_exists('/etc/nginx/sites-available/default')) { $data = file_get_contents('/etc/nginx/sites-available/default'); if (strpos($data, 'root /usr/share/nginx/www;') !== false) { if ($_mode == 'internal') { config::save('internalComplement', '/jeedom'); } if ($_mode == 'external') { config::save('externalComplement', '/jeedom'); } } else { if ($_mode == 'internal') { config::save('internalComplement', ''); } if ($_mode == 'external') { config::save('externalComplement', ''); } } } }
$userdb->setFetchmode(DB_FETCHMODE_ASSOC); } // persistent server variables $sotfVars = new sotf_Vars($db, 'sotf_vars'); $config['debug'] = $sotfVars->get('debug', 1); $userdb->debug = $sotfVars->get('debug_sql', 1); $db->debug = $sotfVars->get('debug_sql', 1); // start session if (!headers_sent()) { session_start(); } if ($config['debug']) { error_log("", 0); //error_log("-------------------------------------------------------------------", 0); error_log("REQUEST_URI: " . myGetenv("REQUEST_URI"), 0); error_log("REMOTE_HOST: " . getHostName(), 0); error_log("USER_AGENT: " . myGetenv('HTTP_USER_AGENT'), 0); error_log("REFERER: " . myGetenv('HTTP_REFERER'), 0); error_log("HTTP_HOST: " . myGetenv('HTTP_HOST'), 0); error_log("SERVER_NAME: " . myGetenv('SERVER_NAME'), 0); error_log("HTTP_ACCEPT_LANGUAGE: " . myGetenv('HTTP_ACCEPT_LANGUAGE'), 0); foreach ($_GET as $key => $value) { debug("GET: {$key}", $value); } foreach ($_POST as $key => $value) { debug("POST: {$key}", $value); } foreach ($_COOKIE as $key => $value) { debug("COOKIE: {$key}", $value); } if (count($_SESSION) > 0) {
} } $reply_to = sotf_Utils::getParameter('reply_to'); $smarty->assign('reply_to', $reply_to); $smarty->assign('reply_title', $comments[$reply_to]['title']); $smarty->assign('email', $_SESSION['email']); } if ($settings["rating"] and ($user->loggedIn() or $settings["a_rating"])) { $value = (int) sotf_Utils::getParameter('rating'); if (sotf_Utils::getParameter('rate_it') and $value != 0) { $rating->setRating($id, $value); $r = $rating->getRating($id); $r['prog_id'] = $id; $r['user_name'] = $user->getName(); $r['user_email'] = $user->getEmail(); $r['host'] = getHostName(); $r['authkey'] = $page->getAuthKey(); $portal->addEvent("rating", $r); $page->redirect($_SERVER["PHP_SELF"] . "?id=" . $id); //redirect page, prevent resend of data } } $smarty->assign('comments', $comments); $result = $portal->getProgrammes(array($id)); $result = $result[0]; if ($result === NULL) { $page->redirect($_SERVER["PHP_SELF"]); } //if programme does not exsists go back to the page TODO: maybe an error page that programme not found $fields = $portal->getAllFieldnames(); $prgprop = $portal->getPrgProperties($id);
function checkAdminAccess() { global $config; $host = getHostName(); debug('admin check', $config['adminDomain']); if (!preg_match('/' . $config['adminDomain'] . '/i', $host)) { raiseError("no access", "to admin page: " . myGetenv("REQUEST_URI")); } else { debug("admin access OK for", $host); } }