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());
     }
 }
示例#2
0
 public function __construct()
 {
     //
     $this->id = 'komercigateway';
     $this->icon = plugins_url('images/komerci.png', __FILE__);
     $this->has_fields = true;
     $this->method_title = 'Komerci Settings';
     //
     $this->init_form_fields();
     $this->init_settings();
     //
     $this->title = $this->get_option('title');
     $this->description = $this->get_option('description');
     $this->filiacao = $this->get_option('filiacao');
     $this->token = $this->get_option('token');
     $this->method = $this->get_option('method');
     //
     $this->user = $this->get_option('user');
     $this->password = $this->get_option('password');
     //
     $this->test = $this->get_option('test');
     $this->supports = array('default_credit_card_form');
     $this->komerci_cardtypes = $this->get_option('komerci_cardtypes');
     //
     $this->siteurl = $_SERVER['SERVER_NAME'];
     $this->serverip = getHostByName(php_uname('n'));
     //
     $this->komerci_wsdlurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?WSDL';
     $this->komerci_liveurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx';
     $this->komerci_testurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap_teste.asmx';
     $this->komerci_methodurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?op=GetAuthorized';
     if (is_admin()) {
         add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     }
 }
示例#3
0
function process_report_command($command)
{
    $public_ip = getHostByName(php_uname('n'));
    $pid = (string) getmypid();
    print sprintf("REPORT: public_ip: %s, pid: %s\n\r", $public_ip, $pid);
    $command->process(compact('public_ip', 'pid'));
}
示例#4
0
 /**
  * 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));
 }
示例#5
0
 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();
 }
示例#6
0
 public function getLocalIp()
 {
     $CI = & get_instance();
     $ip = $CI->input->ip_address();
     if ($ip == '::1') {
         $ip = getHostByName(getHostName());
     }
     return $ip;
 }
示例#7
0
function ServerDetails()
{
    echo "<div id=\"ServerDetails\">a\n\t\t\t<h3>Server Details</h3><br>";
    echo 'Current PHP version: ' . phpversion() . "<br>";
    echo 'Current Operating System:' . php_uname();
    echo '<br>IP Address of Server: ' . getHostByName($_SERVER['HTTP_HOST']) . "<br>";
    echo $_SERVER['SERVER_SOFTWARE'];
    echo "</div>";
}
示例#8
0
文件: main.php 项目: miguelmeca/wscat
 function index()
 {
     $data['system'] = $_SERVER['HTTP_USER_AGENT'];
     //操作系统与浏览器信息
     $data['server'] = PHP_OS . '&nbsp;&nbsp; PHP v' . PHP_VERSION;
     //php版本等信息
     $data['web'] = $_SERVER['SERVER_SOFTWARE'] . '&nbsp;&nbsp;' . getenv("HTTP_ACCEPT_LANGUAGE");
     //WEB服务器版本
     $data['safe'] = @ini_get('safe_mode') ? 'ON' : 'OFF';
     //安全模式
     $data['mysql'] = mysql_get_server_info();
     //mysql版本
     $data['cfg_var'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : "无";
     //可用最大内存
     $data['cfg_max_size'] = get_cfg_var("post_max_size");
     //POST提交限制
     $data['max_execution_time'] = get_cfg_var("max_execution_time");
     //脚本超出时间
     $data['max_file_size'] = get_cfg_var("upload_max_filesize") ? get_cfg_var("upload_max_filesize") : "不允许上传附件";
     //上传限制
     $data['allow_url_fopen'] = @ini_get('allow_url_fopen') ? "ON" : "OFF";
     //是否允许打开远程文件
     $data['disk_size'] = $this->noya->get_file_size(disk_free_space("."));
     //服务器剩余空间大小
     //计算数据库大小
     $content_datasize = $datasize = $indexsize = 0;
     $query = $this->db->query("SHOW TABLE STATUS");
     //$this->fire_php->fire_start($this->noya->get_last_query());
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $datasize += $row->Data_length;
             $indexsize += $row->Index_length;
             $content_datasize += $row->Data_length + $row->Index_length;
         }
     }
     $data['content_datasize'] = $this->noya->get_file_size($content_datasize);
     //GD库是否支持
     $data['GD'] = function_exists("imageline") == 1 ? $this->noya->temp(function_exists("imageline")) : $this->noya->temp(function_exists("imageline"));
     //SESSION是否支持
     $data['allow_session'] = $this->noya->temp(function_exists("session_start"));
     //网站域名
     $data['host_name'] = $_SERVER['SERVER_NAME'];
     //网站IP
     $data['host_address'] = getHostByName(php_uname('n')) . ':' . $_SERVER['SERVER_PORT'];
     //网站当前时间
     $data['host_data'] = date("Y-m-d  H:i");
     //当前访问者ip
     $data['memeber_ip'] = $_SERVER["SERVER_ADDR"];
     //被屏蔽函数
     $data['disable_funcs'] = get_cfg_var("disable_functions") ? get_cfg_var("disable_functions") : "无";
     $this->load->vars($data);
     $this->load->view('backend/main');
 }
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;
}
示例#10
0
 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]);
     }
 }
示例#11
0
 /**
  * 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);
     }
 }
示例#12
0
 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;
 }
 /**
  * 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();
 }
示例#14
0
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;
}
示例#15
0
 /**
  * Get IP Address
  *
  * @return  string
  */
 public function getIpAddress()
 {
     return getHostByName(getHostName());
 }
示例#16
0
 /**
  * Detect Data for anvilSession Use
  */
 public function detect()
 {
     //        global $phpAnvil;
     if ($this->_detectExecuted) {
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Already Executed - skipping...');
         //            FB::info('Already Executed - skipping...');
         $this->_logVerbose('Already Executed - skipping...');
     } else {
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, "Executing...");
         //            FB::info('Executing...');
         $this->_logVerbose('Executing...');
         $this->thisVisitDTS = date('Y-m-d H:i:s');
         #---- Detect User IP
         if ($this->_isConsole) {
             $this->userIP = getHostByName(SITE_DOMAIN);
         } else {
             $this->userIP = $_SERVER['REMOTE_ADDR'];
         }
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'User IP = ' . $this->userIP);
         $this->_logVerbose('User IP = ' . $this->userIP);
         //            FB::log($this->userIP, '$this->userIP');
         #---- Detect User Agent
         if (isset($_SERVER['HTTP_USER_AGENT'])) {
             $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
             //				$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'User Agent = ' . $this->userAgent);
             $this->_logVerbose('User Agent = ' . $this->userAgent);
             //                FB::log($this->userAgent, '$this->userAgent');
         }
         //            FB::log($this->sessionName, '$this->sessionName');
         //            FB::log($_REQUEST[$this->sessionName], '$_REQUEST[$this->sessionName]');
         #---- Detect Existing Session
         if (isset($_COOKIE[$this->sessionName])) {
             //                FB::log('Detected existing session...');
             $this->_new = false;
             //				$this->id = $_REQUEST[$this->sessionName];
             $this->phpSessionID = $_COOKIE[$this->sessionName];
             #---- Session Cookie Detection
             //				$this->_cookieDetected = isset($_COOKIE[$this->sessionName]);
             $this->_cookieDetected = true;
             $this->id = $_COOKIE[$this->sessionName];
             //				$this->phpSessionID = $_COOKIE[$this->sessionName];
             //				$msg = 'anvilSession Cookie Detected';
             //                $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                FB::info($msg);
             $this->_logVerbose('anvilSession Cookie Detected');
             #---- Test Parameter Detection
             //				if (isset($_GET[$this->testParameterName])) {
             //					$this->_new = true;
             //					$msg = 'Cookie Test Parameter Detected - New Session';
             //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                        FB::info($msg);
             //				}
             #---- Reset Detection
             if ($this->_resetEnabled) {
                 $this->_new = true;
                 //					$msg = 'Reset Detected - New Session';
                 //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
                 //                        FB::warn($msg);
                 $this->_logVerbose('Reset Detected - New Session');
             }
             #---- Check and Load Session
             /*			} else {
                                     #---- Security and Age Detection
                     //				$this->phpSessionID = $_REQUEST[$this->sessionName];
                                     $sql = 'SELECT * FROM ' . $this->sessionsTable;
             
                     //				if ($this->isCookieDetected()) {
                                         $sql .= ' WHERE session_id = ' . $this->id;
                     //				} else {
                     //					$sql .= ' WHERE ascii_session_id = ' . $this->devData->dbString($this->phpSessionID);
                     //				}
             
                                     $objRS = $this->devData->execute($sql);
                                     if ($objRS->read()) {
                                         $this->id = $objRS->data('session_id');
                                         $this->userID = $objRS->data('user_id');
             
                                         $this->new = false;
             
                                         setcookie($this->cookieName, $this->id, $this->sessionLifespan, $this->cookieDomain);
             
                                         $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Session #' . $this->id . ' Loaded for ' . $this->userIP);
                                     }
                                     $objRS->close();
                                 }
                                 $this->save();
                     */
             #---- Cookie Test Detection
             //			} elseif (isset($_COOKIE[$this->testCookieName])) {
             //				$this->_cookieDetected = true;
             //				$msg = 'Test Cookie Detected';
             //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                        FB::info($msg);
             #---- Cookie Test Detection (passed variable and no cookie)
             //			} elseif (isset($_GET[$this->testParameterName])) {
             //				#---- No Cookie Support
             //				ini_set('session.use_trans_sid', '1');
             //				$msg = 'No Cookie Support Detected - Passing ID as a Query String Parameter';
             //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                        FB::warn($msg);
         }
     }
     //		$this->_detectExecuted = true;
 }
示例#17
0
 /**
  * 获取网站服务器相关信息.
  *
  * @return array
  *
  * @author freephp
  */
 private function _getServerInfos()
 {
     return ['os_version' => php_uname(), 'server_php_version' => $_SERVER['SERVER_SOFTWARE'], 'domain' => $_SERVER['HTTP_HOST'], 'server_port' => $_SERVER['SERVER_PORT'], 'database' => 'MySQL', 'server_ip' => getHostByName($_SERVER['SERVER_NAME'])];
 }
示例#18
0
 /**
  * Detects production mode by IP address.
  * @return bool
  */
 public static function detectProductionMode()
 {
     $addrs = array();
     if (PHP_SAPI === 'cli') {
         $addrs[] = getHostByName(php_uname('n'));
     } else {
         if (!isset($_SERVER['SERVER_ADDR']) && !isset($_SERVER['LOCAL_ADDR'])) {
             return TRUE;
         }
         if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             // proxy server detected
             $addrs = preg_split('#,\\s*#', $_SERVER['HTTP_X_FORWARDED_FOR']);
         }
         if (isset($_SERVER['REMOTE_ADDR'])) {
             $addrs[] = $_SERVER['REMOTE_ADDR'];
         }
         $addrs[] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
     }
     foreach ($addrs as $addr) {
         $oct = explode('.', $addr);
         // 10.0.0.0/8   Private network
         // 127.0.0.0/8  Loopback
         // 169.254.0.0/16 & ::1  Link-Local
         // 172.16.0.0/12  Private network
         // 192.168.0.0/16  Private network
         if ($addr !== '::1' && (count($oct) !== 4 || $oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31) && ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168'))) {
             return TRUE;
         }
     }
     return FALSE;
 }
示例#19
0
 public static function myIP()
 {
     return getHostByName(getHostName());
 }
示例#20
0
 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', '');
             }
         }
     }
 }
示例#21
0
<?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) {
示例#22
0
 private function shortIt($url, $md5)
 {
     if (!self::API_SHORT) {
         return $url;
     }
     parent::RedBeanConnect('short');
     if ($fetch = @R::findOne('short_url', '`title` = ?', [$md5])) {
         return self::API_SHORT . $fetch->keyword;
     }
     $timestamp = date('Y-m-d H:i:s');
     do {
         $uniq = '';
         $base = strtolower(hash('sha256', uniqid()));
         while (strlen($uniq) < 8) {
             $uniq .= substr($base, (int) -(strlen($base) / (1 + strlen($uniq))), 1);
         }
     } while (@R::findOne('short_url', '`keyword` = ?', [$uniq]));
     $sql = 'INSERT INTO `short`.`short_url` ';
     $sql .= "(`keyword`, `url`, `title`, `timestamp`, `ip`, `clicks`) ";
     $sql .= "VALUES ('{$uniq}', '{$url}', '{$md5}', '{$timestamp}', '";
     $sql .= getHostByName(getHostName()) . "', '0')";
     R::exec($sql);
     R::close();
     return 'http://exsubs.anidb.pl/short/' . $uniq;
 }
 /**
  * Load macros for replace in default configuration
  *
  * @param int $pollerId The poller id
  */
 private function loadMacros($pollerId)
 {
     $config = Di::getDefault()->get('config');
     /* Load contant values */
     $this->baseConfig['broker_central_ip'] = getHostByName(getHostName());
     /* Load user value */
     $this->baseConfig = array_merge($this->baseConfig, BrokerRepository::loadValues($pollerId));
     /* Load paths */
     $paths = BrokerRepository::getPathsFromPollerId($pollerId);
     $pathsValue = array_values($paths);
     $pathsKeys = array_map(function ($name) {
         switch ($name) {
             case 'directory_modules':
                 $str = 'modules_directory';
                 break;
             case 'directory_config':
                 $str = 'etc_directory';
                 break;
             case 'directory_logs':
                 $str = 'logs_directory';
                 break;
             case 'directory_data':
                 $str = 'data_directory';
                 break;
             default:
                 $str = '';
                 break;
         }
         return 'global_broker_' . $str;
     }, array_keys($paths));
     $paths = array_combine($pathsKeys, $pathsValue);
     $this->baseConfig = array_merge($this->baseConfig, $paths);
     $this->baseConfig['poller_id'] = $this->pollerId;
     /* Information for database */
     $dbInformation = CentreonDb::parseDsn($config->get('db_centreon', 'dsn'), $config->get('db_centreon', 'username'), $config->get('db_centreon', 'password'));
     $dbKeys = array_map(function ($name) {
         return 'global_' . $name;
     }, array_keys($dbInformation));
     $dbInformation = array_combine($dbKeys, array_values($dbInformation));
     $this->baseConfig = array_merge($dbInformation, $this->baseConfig);
     /* Load general poller information */
     $pollerInformation = Poller::get($pollerId);
     $this->baseConfig['poller_name'] = $pollerInformation['name'];
     /* Load configuration information from Centren Engine */
     $eventObj = new GenericEvent(array('poller_id' => $pollerId));
     Di::getDefault()->get('events')->emit('centreon-broker.poller.configuration', array($eventObj));
     $this->baseConfig = array_merge($eventObj->getOutput(), $this->baseConfig);
     /* get global value in database */
     $globalOptions = BrokerRepository::getGlobalValues();
     $this->baseConfig = array_merge($globalOptions, $this->baseConfig);
     /* Add % in begin and end of keys */
     $keys = array_keys($this->baseConfig);
     $values = array_values($this->baseConfig);
     $keys = array_map(function ($key) {
         return '%' . $key . '%';
     }, $keys);
     $this->baseConfig = array_combine($keys, $values);
 }
示例#24
0
文件: key.php 项目: visio/SRC
    if ($_POST['removeClient'] != "") {
        //>> Delete ip
        for ($i = 0; $i < count($keys); $i++) {
            if ($ips[$i] == $_POST['removeClient']) {
                unset($keys[$i]);
                unset($ips[$i]);
                unset($names[$i]);
                $keysDeleted = true;
            }
        }
        $keys = array_values($keys);
        $ips = array_values($ips);
        $names = array_values($names);
        //<< deleting -- END
    } else {
        $url = "http://" . getHostByName(getHostName()) . ":" . $_POST['serverPort'] . $_POST['serverPath'] . "/client.php?key=" . end($keys);
    }
}
if ($clientsLoad && $keysDeleted) {
    //>> Save file with all new entries
    $cfh = fopen($clientFile, 'w');
    for ($i = 0; $i < count($keys); $i++) {
        fwrite($cfh, $keys[$i] . "," . $ips[$i] . "," . $names[$i] . ",\n");
    }
    fclose($cfh);
    //<< saving -- END
} elseif ($clientsLoad && $newKey != "") {
    //>> Only add one entry to file
    $cfh = fopen($clientFile, 'a');
    fwrite($cfh, $newKey . ",0.0.0.0,NEW,\n");
    fclose($cfh);
示例#25
0
文件: config.php 项目: jikoyster/ims
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/*
|--------------------------------------------------------------------------
| ExpressionEngine Config Items
|--------------------------------------------------------------------------
|
| The following items are for use with ExpressionEngine.  The rest of
| the config items are for use with CodeIgniter, some of which are not
| observed by ExpressionEngine, e.g. 'permitted_uri_chars'
|
*/
//$config['require_ip_for_login'] = "******";
$server_ip = getHostByName(php_uname('n'));
$server_ip = $server_ip ? $server_ip : "127.0.0.1";
$config['site_url'] = "http://" . $server_ip . "/ims/";
$config['theme_folder_url'] = "http://" . $server_ip . "/ims/themes/";
$config['app_version'] = '2.10.1';
$config['license_contact'] = '';
$config['license_number'] = 'CORE LICENSE';
$config['debug'] = '1';
$config['cp_url'] = 'http://' . $server_ip . '/ims/admin.php';
$config['doc_url'] = 'http://ellislab.com/expressionengine/user-guide/';
$config['is_system_on'] = 'y';
$config['allow_extensions'] = 'y';
$config['cache_driver'] = 'file';
$config['cookie_prefix'] = '';
$config['cookie_httponly'] = 'y';
$config['index_page'] = '';
示例#26
0
 /**
  * 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);
     }
 }
示例#27
0
 /**
  * 
  * Iegūst klienta IP adresi
  * 
  * @return string Klienta IP adrese
  */
 private function getIpAddress()
 {
     return getHostByName(getHostName());
 }
 function import_meetup_events($atts)
 {
     $fetched = 0;
     $found = 0;
     $created = 0;
     $updated = 0;
     $content = '';
     //$content .= '<p>Remote host: ' . $_SERVER["REMOTE_ADDR"] . '</p>';
     $host = $_SERVER["REMOTE_ADDR"];
     $local_ip = getHostByName(getHostName());
     if (!current_user_can('manage_options') && $local_ip != $host) {
         $content .= '<div class="bimbler-alert-box error"><span>Error: </span>You must be an admin user to view this page.</div>';
         error_log('import_meetup_events called by non-admin or not from localhost.');
         return $content;
     }
     $a = shortcode_atts(array('api_key' => 7, 'group_id' => 0, 'create_if_not_found' => 'N', 'update_meta_if_found' => 'N', 'test' => 'Y'), $atts);
     if (!isset($a)) {
         error_log('import_meetup_events called with no parameters set.');
         $content .= '<div class="bimbler-alert-box error"><span>Error: </span>No parameters specified.</div>';
         return $content;
     }
     //error_log ('Post vars: ' . json_encode ($_POST));
     if (isset($_POST['bimbler-run-job'])) {
         error_log('Run job clicked.');
         $a['test'] = 'N';
     }
     // Work around the UTC bug...
     date_default_timezone_set('Australia/Brisbane');
     $date_from = date('Y-m-d', strtotime($a['ahead'] . ' days'));
     $date_to = date('Y-m-d', strtotime($a['ahead'] + 1 . ' days'));
     $content .= '<h5>Input Parameters</h5>';
     $content .= 'Group ID: ' . $a['group_id'] . '<br>';
     $content .= 'API Key: ' . $a['api_key'] . '<br>';
     $content .= 'Test mode: ' . $a['test'] . '<br>';
     $content .= 'Create new: ' . $a['create_if_not_found'] . '<br>';
     $content .= 'Update meta: ' . $a['update_meta_if_found'] . '<br><br>';
     $output = '';
     // What does this app do today?
     $create_if_not_found = false;
     $update_meta_if_found = false;
     if ('Y' == $a['create_if_not_found']) {
         $create_if_not_found = true;
     }
     if ('Y' == $a['update_meta_if_found']) {
         $update_meta_if_found = true;
     }
     $test_mode = false;
     if ('Y' == $a['test']) {
         $test_mode = true;
     }
     $import = $this->fetch_meetup_events($a['group_id'], $a['api_key']);
     // Who are are running as?
     $this_user_id = $this->get_current_user_id();
     //$content .= 'Running as user ID: ' . $this_user_id . '<br><br>';
     $content .= '<h4>Output:</h4>';
     $content .= $import->output;
     $content .= '<br>';
     $fetched = count($import->events);
     $content .= 'Fetched ' . $fetched . ' events.<br>';
     if ($fetched > 0) {
         $i = 1;
         foreach ($import->events as $event) {
             // Create new member, containing parsed date.
             $event->event_date = date('Y-m-d H:i:s', $this->get_event_date($event));
             $content .= $i++ . ': ' . $event->id . ' -> ' . $event->name . ' on ' . $event->event_date;
             // $content .= '<br>';
             // See if this event already exists.
             $get_posts = tribe_get_events(array('eventDisplay' => 'custom', 'posts_per_page' => 1, 'post_status' => array('publish', 'draft'), 'meta_query' => array(array('key' => '_EventStartDate', 'value' => $event->event_date, 'compare' => '=', 'type' => 'datetime')), 'tax_query' => array(array('taxonomy' => TribeEvents::TAXONOMY, 'field' => 'slug', 'terms' => 'mingle'))));
             $content .= '&nbsp;--';
             //error_log (json_encode ($get_posts));
             // Got the same event (or at least, *a* Mingle starting at the same time).
             if (!empty($get_posts)) {
                 $found++;
                 $this_event = $get_posts[0];
                 //$content .= '<pre>' . json_encode ($this_event, true) . '</pre>';
                 // $content .= ' Found: ' . $this_event->post_title . ' on ' . tribe_get_start_date($this_event->ID, false, 'Y-m-d H:i:s') . '.';
                 $content .= ' Found: post ID <a href="' . get_permalink($this_event->ID) . '" target="_external">' . $this_event->ID . '</a>.<br>';
                 // We're updating existing events - backfill data.
                 if ($update_meta_if_found) {
                     // Event found, but not with a Meetup ID.
                     if (!get_post_meta($this_event->ID, 'bimbler_meetup_id', true)) {
                         if (!$test_mode) {
                             // Update with Meetup ID if it's not already set
                             update_post_meta($this_event->ID, 'bimbler_meetup_id', $event->id);
                             $content .= '<font color="orange">&nbsp;-- Updated Meetup ID.</font> ';
                         } else {
                             $content .= '<font color="orange">&nbsp;-- Test mode - Meetup ID not updated. </font>';
                         }
                         $updated++;
                     } else {
                         $content .= '<font color="green">&nbsp;-- Existing event with Meetup ID set - no action to take.</font>';
                         // See if we need to update date / time.
                         // Can't do this, as the query loop is searching by date / time.
                         /*								$curr_start_date = tribe_get_start_date($event->ID, false, 'Y-m-d H:i:s');
                         								$curr_end_date = tribe_get_end_date($event->ID, false, 'Y-m-d H:i:s');
                         								
                         								if ($curr_start_date != $event->event_date) {
                         									$content .= ' Meetup start time not same as here (' . $curr_start_date . ' -> ' . $event->event_date);  
                         								} */
                     }
                 } else {
                     $content .= '<font color="green">&nbsp;-- Not running in "Update Meetup ID if found" mode - no action taken.</font>';
                 }
             } else {
                 // No mingler event found at that time on that day.
                 if ($create_if_not_found) {
                     //$content .= '<pre>' . print_r ($event, true) . '</pre>';
                     //$new_event = new stdClass();
                     $new_event = array();
                     $new_event['EventStartDate'] = date('Y-m-d', strtotime($event->event_date));
                     $new_event['EventStartHour'] = date('h', strtotime($event->event_date));
                     $new_event['EventStartMinute'] = date('i', strtotime($event->event_date));
                     if (isset($event->duration)) {
                         //$content .= ' Adding ' . $event->duration / 1000 . ' seconds ';
                         $new_event['EventEndDate'] = date('Y-m-d', strtotime($event->event_date . ' + ' . $event->duration / 1000 . ' seconds'));
                         $new_event['EventEndHour'] = date('h', strtotime($event->event_date . ' + ' . $event->duration / 1000 . ' seconds'));
                         $new_event['EventEndMinute'] = date('i', strtotime($event->event_date . ' + ' . $event->duration / 1000 . ' seconds'));
                     } else {
                         // Add an abitrary 2 hours to the start time to get the end time.
                         $new_event['EventEndDate'] = date('Y-m-d', strtotime($event->event_date . ' + 2 hours'));
                         $new_event['EventEndHour'] = date('h', strtotime($event->event_date . ' + 2 hours'));
                         $new_event['EventEndMinute'] = date('i', strtotime($event->event_date . ' + 2 hours'));
                     }
                     $content .= '<br><font color="red">&nbsp;-- Creating new event.</font>';
                     //$content .= '<pre>' . print_r ($new_event, true) . '</pre>';
                     $new_event['post_status'] = 'draft';
                     $new_event['author'] = $this_user_id;
                     $new_event['post_title'] = $event->name;
                     $new_event['post_content'] = $event->description;
                     // XXXXX REMOVE SECOND TERM WHEN FINISHED TESTING XXXX
                     //if (!$test_mode && ($created < 1)) {
                     if (!$test_mode) {
                         $new_event_id = TribeEventsAPI::createEvent($new_event);
                         // Copy the taxonomies.
                         $taxonomies = get_object_taxonomies('tribe_events');
                         foreach ($taxonomies as $tax) {
                             $terms = wp_get_object_terms($event_id, $tax);
                             $term = array();
                             foreach ($terms as $t) {
                                 $term[] = $t->slug;
                             }
                             wp_set_object_terms($new_event_id, $term, $tax);
                         }
                         // Update with Meetup ID.
                         update_post_meta($new_event_id, 'bimbler_meetup_id', $event->id);
                         $tribe_ecp = TribeEvents::instance();
                         // Set this to a Mingle.
                         $term_info = get_term_by('slug', 'mingle', $tribe_ecp->get_event_taxonomy());
                         wp_set_object_terms($new_event_id, $term_info->term_id, $term_info->taxonomy);
                         $content .= ' New event ID: <a href="' . get_permalink($new_event_id) . '" target="_external">' . $new_event_id . '</a>';
                     } else {
                         $content .= '<font color="orange">&nbsp;-- Test mode - Event not created. </font>';
                     }
                     $created++;
                 } else {
                     // End create_if_not_found.
                     $content .= '<font color="green"><br>&nbsp;-- Not running in "Create if not found" mode - no action taken.</font>';
                 }
             }
             $content .= '<br>';
         }
     }
     $summary = 'import_meetup_events: fetched: ' . $fetched . ', found: ' . $found . ', created: ' . $created . ', updated: ' . $updated . '.';
     $content .= '<br>' . $summary;
     error_log($summary);
     return $content;
 }
示例#29
0
 /**
  * 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);
 }
示例#30
0
    $text = "Task ID not Set - unable to run script";
    echo $text . "\n";
    $log->Fatal("Error: " . $text . " (File: " . $_SERVER['PHP_SELF'] . ")");
    die;
}
// Get/Set Task ID - as sent from cronjob when this script is called and is stored in DB.nodes table also
$tid = $_GET['id'];
// get task details from DB
$taskResult = $db->q("SELECT * FROM tasks WHERE id = {$tid} AND status = '1'");
$taskRow = mysql_fetch_assoc($taskResult);
$command = $taskRow['catCommand'];
$taskname = $taskRow['taskname'];
// create connection report file
$reportFilename = 'compareReport' . $date . '.html';
$reportDirectory = 'compareReports';
$serverIp = getHostByName(getHostName());
// get server IP address for CLI scripts
$report = new report($config_reports_basedir, $reportFilename, $reportDirectory, $serverIp);
$report->createFile();
$title = "rConfig Report - " . $taskname;
$report->header($title, $title, basename($_SERVER['PHP_SELF']), $tid, $startTime);
$reportFail = '<font color="red">Fail</font>';
$reportPass = '******';
// Get active nodes for a given task ID
// Query to retireve row for given ID (tidxxxxxx is stored in nodes and is generated when task is created)
$getNodesSql = "SELECT id, deviceName, deviceIpAddr, deviceUsername, devicePassword, deviceEnableMode, deviceEnablePassword, nodeCatId, deviceAccessMethodId, connPort FROM nodes WHERE taskId" . $tid . " = 1 AND status = 1";
if ($result = $db->q($getNodesSql)) {
    // push rows to $devices array
    $devices = array();
    while ($row = mysql_fetch_assoc($result)) {
        array_push($devices, $row);