Example #1
10
function system_information()
{
    global $mysqli, $server, $redis_server, $mqtt_server;
    $result = $mysqli->query("select now() as datetime, time_format(timediff(now(),convert_tz(now(),@@session.time_zone,'+00:00')),'%H:%i‌​') AS timezone");
    $db = $result->fetch_array();
    @(list($system, $host, $kernel) = preg_split('/[\\s,]+/', php_uname('a'), 5));
    @exec('ps ax | grep feedwriter.php | grep -v grep', $feedwriterproc);
    $meminfo = false;
    if (@is_readable('/proc/meminfo')) {
        $data = explode("\n", file_get_contents("/proc/meminfo"));
        $meminfo = array();
        foreach ($data as $line) {
            if (strpos($line, ':') !== false) {
                list($key, $val) = explode(":", $line);
                $meminfo[$key] = 1024 * floatval(trim(str_replace(' kB', '', $val)));
            }
        }
    }
    $emoncms_modules = "";
    $emoncmsModulesPath = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/')) . '/Modules';
    // Set the Modules path
    $emoncmsModuleFolders = glob("{$emoncmsModulesPath}/*", GLOB_ONLYDIR);
    // Use glob to get all the folder names only
    foreach ($emoncmsModuleFolders as $emoncmsModuleFolder) {
        // loop through the folders
        if ($emoncms_modules != "") {
            $emoncms_modules .= "   ";
        }
        $emoncms_modules .= str_replace($emoncmsModulesPath . "/", '', $emoncmsModuleFolder);
    }
    return array('date' => date('Y-m-d H:i:s T'), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => function_exists('zend_version') ? zend_version() : 'n/a', 'db_server' => $server, 'db_ip' => gethostbyname($server), 'db_version' => 'MySQL ' . $mysqli->server_info, 'db_stat' => $mysqli->stat(), 'db_date' => $db['datetime'] . " (UTC " . $db['timezone'] . ")", 'redis_server' => $redis_server['host'] . ":" . $redis_server['port'], 'redis_ip' => gethostbyname($redis_server['host']), 'feedwriter' => !empty($feedwriterproc), 'mqtt_server' => $mqtt_server['host'], 'mqtt_ip' => gethostbyname($mqtt_server['host']), 'mqtt_port' => $mqtt_server['port'], 'hostbyaddress' => @gethostbyaddr(gethostbyname($host)), 'http_proto' => $_SERVER['SERVER_PROTOCOL'], 'http_mode' => $_SERVER['GATEWAY_INTERFACE'], 'http_port' => $_SERVER['SERVER_PORT'], 'php_modules' => get_loaded_extensions(), 'mem_info' => $meminfo, 'partitions' => disk_list(), 'emoncms_modules' => $emoncms_modules);
}
 /**
  * This function checks the availability of cURL
  * @access private
  * @return bool
  */
 private static function isCurlInstalled()
 {
     if (in_array('curl', get_loaded_extensions())) {
         return true;
     }
     return false;
 }
function check_php()
{
    $data = array();
    $data['errors'] = array();
    $data['caninstall'] = true;
    $ver = explode('.', PHP_VERSION);
    $ver_num = $ver[0] . $ver[1] . $ver[2];
    if ($ver_num < 500) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_version', 'message' => 'Votre version de PHP est trop vieille. Installez PHP 5.');
    } elseif ($ver_num < 529) {
        $data['errors'][] = array('level' => 'warning', 'code' => 'php_version', 'message' => 'Vous utilisez PHP ' . PHP_VERSION . ' !<br />Il est conseill&eacute; d\'utiliser au moins la version 5.2.9 de PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_version', 'message' => 'Votre version de PHP (' . PHP_VERSION . ') est support&eacute;e par Iconito.');
    }
    if (ini_get('session.auto_start')) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'session_autostart', 'message' => 'Vous devez d&eacute;sactiver la cr&eacute;ation de session automatique. Pour cela, modifiez la directive "session.auto_start" dans votre php.ini (pour tous vos sites), dans la configuration de votre virtualhost dans la configuration d\'Apache (pour ce site sp&eacute;cifiquement), ou dans le .htaccess d\'Iconito (dans le r&eacute;pertoire "Iconito/www").');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'session_autostart', 'message' => 'La cr&eacute;ation de session automatique est d&eacute;sactiv&eacute;e.');
    }
    $php_extensions = get_loaded_extensions();
    if (!in_array('xml', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_xml', 'message' => 'Vous devez activer l\'extension "xml" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_xml', 'message' => 'L\'extension "xml" est activ&eacute;e.');
    }
    if (!in_array('session', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_session', 'message' => 'Vous devez activer l\'extension "session" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_session', 'message' => 'L\'extension "session" est activ&eacute;e.');
    }
    if (!in_array('mysql', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_mysql', 'message' => 'Vous devez activer l\'extension "mysql" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_mysql', 'message' => 'L\'extension "mysql" est activ&eacute;e.');
    }
    if (!in_array('gd', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_gd', 'message' => 'Vous devez activer l\'extension "gd" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_gd', 'message' => 'L\'extension "gd" est activ&eacute;e.');
        if (!(imagetypes() & IMG_GIF)) {
            $data['caninstall'] = true;
            $data['errors'][] = array('level' => 'warning', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" ne supporte pas l\'&eacute;criture du format GIF. Il est pr&eacute;f&eacute;rable de mettre &agrave; jour cette extension.');
        } else {
            $data['errors'][] = array('level' => 'good', 'code' => 'php_gd_gif', 'message' => 'Votre version de "gd" supporte le format GIF.');
        }
    }
    if (!in_array('zlib', $php_extensions)) {
        $data['caninstall'] = false;
        $data['errors'][] = array('level' => 'error', 'code' => 'php_ext_zlib', 'message' => 'Vous devez activer l\'extension "zlib" dans PHP.');
    } else {
        $data['errors'][] = array('level' => 'good', 'code' => 'php_ext_zlib', 'message' => 'L\'extension "zlib" est activ&eacute;e.');
    }
    return $data;
}
 function form($instance)
 {
     $defaults = $this->get_defaults();
     $instance = wp_parse_args((array) $instance, $defaults);
     $widget_title = $instance['title'];
     $name = $instance['name'];
     $tweets_count = $instance['tweets_cnt'];
     $accessTokenSecret = trim($instance['accessTokenSecret']);
     $replies_excl = $instance['replies_excl'];
     $consumerSecret = trim($instance['consumerSecret']);
     $accessToken = trim($instance['accessToken']);
     $cache_transient = $instance['timeRef'];
     $alter_ago_time = $instance['timeAgo'];
     $twitterIntents = $instance['twitterIntents'];
     //$dataShowCount 		= $instance['dataShowCount'];
     $disp_screen_name = $instance['disp_scr_name'];
     $timeto_store = $instance['store_time'];
     $consumerKey = trim($instance['consumerKey']);
     $intents_text = $instance['twitterIntentsText'];
     $color_intents = $instance['intentColor'];
     $slide_style = $instance['slide_style'];
     $showAvatar = $instance['showAvatar'];
     $border_rad_avatar = $instance['border_rad'];
     $tweet_border = $instance['tweet_border'];
     $tweet_theme = $instance['tweet_theme'];
     if (!in_array('curl', get_loaded_extensions())) {
         echo '<p style="background-color:pink;padding:10px;border:1px solid red;"><strong>cURL is not installed!</strong></p>';
     }
     include 'widget_html.php';
 }
Example #5
0
 public function execute()
 {
     $this->header('Version');
     echo "PHP-", phpversion(), "\n\n";
     $this->header('Constants');
     $constants = get_defined_constants();
     echo "PHP Prefix: ", $constants['PHP_PREFIX'], "\n";
     echo "PHP Binary: ", $constants['PHP_BINARY'], "\n";
     echo "PHP Default Include path: ", $constants['DEFAULT_INCLUDE_PATH'], "\n";
     echo "PHP Include path: ", get_include_path(), "\n";
     echo "\n";
     // DEFAULT_INCLUDE_PATH
     // PEAR_INSTALL_DIR
     // PEAR_EXTENSION_DIR
     // ZEND_THREAD_SAFE
     // zend_version
     $this->header('General Info');
     phpinfo(INFO_GENERAL);
     echo "\n";
     $this->header('Extensions');
     $extensions = get_loaded_extensions();
     $this->logger->info(join(', ', $extensions));
     echo "\n";
     $this->header('Database Extensions');
     foreach (array_filter($extensions, function ($n) {
         return in_array($n, array('PDO', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite', 'pgsql', 'mysqli', 'mysql', 'oci8', 'sqlite3', 'mysqlnd'));
     }) as $extName) {
         $this->logger->info($extName, 1);
     }
 }
Example #6
0
 /**
  * Get image orientation from exif
  */
 public static function get_orientation_degrees($filename)
 {
     if (in_array("exif", get_loaded_extensions())) {
         $raw_exif = @exif_read_data($filename);
         switch ($raw_exif['Orientation']) {
             case 1:
             case 2:
                 $degrees = 0;
                 break;
             case 3:
             case 4:
                 $degrees = 180;
                 break;
             case 5:
             case 6:
                 $degrees = -90;
                 break;
             case 7:
             case 8:
                 $degrees = 90;
                 break;
             default:
                 $degrees = 0;
         }
     } else {
         $degrees = 0;
     }
     return $degrees;
 }
 /**
  * Gets the singleton SoapClient which is used to connect to the TransIP Api.
  *
  * @param  mixed       $parameters  Parameters.
  * @return SoapClient               The SoapClient object to which we can connect to the TransIP API
  */
 public static function _getSoapClient($parameters = array())
 {
     $endpoint = Transip_ApiSettings::$endpoint;
     if (self::$_soapClient === null) {
         $extensions = get_loaded_extensions();
         $errors = array();
         if (!class_exists('SoapClient') || !in_array('soap', $extensions)) {
             $errors[] = 'The PHP SOAP extension doesn\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';
         }
         if (!in_array('openssl', $extensions)) {
             $errors[] = 'The PHP OpenSSL extension doesn\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';
         }
         if (!empty($errors)) {
             die('<p>' . implode("</p>\n<p>", $errors) . '</p>');
         }
         $classMap = array('DomainCheckResult' => 'Transip_DomainCheckResult', 'Domain' => 'Transip_Domain', 'Nameserver' => 'Transip_Nameserver', 'WhoisContact' => 'Transip_WhoisContact', 'DnsEntry' => 'Transip_DnsEntry', 'DomainBranding' => 'Transip_DomainBranding', 'Tld' => 'Transip_Tld', 'DomainAction' => 'Transip_DomainAction');
         $options = array('classmap' => $classMap, 'encoding' => 'utf-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'trace' => false);
         $wsdlUri = "https://{$endpoint}/wsdl/?service=" . self::SERVICE;
         try {
             self::$_soapClient = new SoapClient($wsdlUri, $options);
         } catch (SoapFault $sf) {
             throw new Exception("Unable to connect to endpoint '{$endpoint}'");
         }
         self::$_soapClient->__setCookie('login', Transip_ApiSettings::$login);
         self::$_soapClient->__setCookie('mode', Transip_ApiSettings::$mode);
     }
     $timestamp = time();
     $nonce = uniqid('', true);
     self::$_soapClient->__setCookie('timestamp', $timestamp);
     self::$_soapClient->__setCookie('nonce', $nonce);
     self::$_soapClient->__setCookie('clientVersion', self::API_VERSION);
     self::$_soapClient->__setCookie('signature', self::_urlencode(self::_sign(array_merge($parameters, array('__service' => self::SERVICE, '__hostname' => $endpoint, '__timestamp' => $timestamp, '__nonce' => $nonce)))));
     return self::$_soapClient;
 }
 function __construct()
 {
     $this->values = array();
     //php core
     $this->values['php_version'] = phpversion();
     $this->values['php_sapi_name'] = php_sapi_name();
     if (substr($this->values['php_sapi_name'], 0, 3) == 'cgi') {
         $this->values['cgi-php'] = 1;
     } else {
         $this->values['cgi-php'] = 0;
     }
     $this->values['extensions'] = implode(', ', get_loaded_extensions());
     $this->_set_ini('safe_mode');
     $this->_set_ini('open_basedir');
     //server
     $ns = array('HTTP_HOST', 'SERVER_NAME', 'SCRIPT_FILENAME', 'SCRIPT_NAME', 'REQUEST_URI', 'PHP_SELF');
     foreach ($ns as $n) {
         $this->_set_server_ini($n);
     }
     $this->values['__FILE__'] = __FILE__;
     //session
     $ns = array('session.name', 'session.save_path', 'session.cookie_domain', 'session.cookie_path', 'session.save_path');
     foreach ($ns as $n) {
         $this->_set_ini($n);
     }
     //mbstring
     foreach (array('mbstring.encoding_translation', 'mbstring.internal_encoding') as $n) {
         $this->_set_ini($n);
     }
     //misc
     $ns = array('allow_url_fopen', 'magic_quotes_gpc', 'upload_max_filesize', 'memory_limit');
     foreach ($ns as $n) {
         $this->_set_ini($n);
     }
 }
 /**
  *  This static function returns php informations
  *
  *  @returns    an array with php info
  */
 function php()
 {
     // Get the general PHP info
     ob_start();
     phpinfo(INFO_GENERAL);
     $phpInfo .= ob_get_contents();
     ob_end_clean();
     // Get the right part
     $phpInfo = substr($phpInfo, strpos($phpInfo, '<tr>'));
     $phpInfo = substr($phpInfo, 0, strpos($phpInfo, '</table>'));
     // Strip unneeded things
     $phpInfo = str_replace('<tr><td class="e">', '', $phpInfo);
     $phpInfo = str_replace(' </td></tr>', '', $phpInfo);
     $phpInfo = trim($phpInfo);
     // Get the settings
     $settings = array();
     foreach (explode("\n", $phpInfo) as $line) {
         $line = explode(' </td><td class="v">', $line);
         if (isset($line[1])) {
             $settings[strtolower(str_replace(' ', '_', $line[0]))] = $line[1];
         } else {
             $settings[strtolower(str_replace(' ', '_', $line[0]))] = '';
         }
     }
     // export other values
     $settings['version'] = phpversion();
     $settings['modules'] = implode(get_loaded_extensions(), ', ');
     $settings['os'] = PHP_OS;
     $settings['includePath'] = $GLOBALS['YD_INCLUDE_PATH'];
     return $settings;
 }
Example #10
0
function readURL($url, $headers = false)
{
    if (array_search('curl', get_loaded_extensions()) !== false) {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_HEADER, $headers);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $html_data = curl_exec($curl);
        curl_close($curl);
    } elseif (ini_get('allow_url_fopen') == 1) {
        $html_data = @file_get_contents($url);
    } else {
        // Thanks to Aki Uusitalo
        $url_array = parse_url($url);
        $fp = fsockopen($url_array['host'], 80, $errno, $errstr, 5);
        if (!$fp) {
            return false;
        } else {
            $out = "GET " . $url_array['path'] . "?" . $url_array['query'] . " HTTP/1.0\r\n";
            $out .= "Host: " . $url_array['host'] . " \r\n";
            $out .= "Connection: Close\r\n\r\n";
            fwrite($fp, $out);
            $html_data = '';
            // Read the raw data from the socket in 1kb chunks
            // Hopefully, it's just HTML.
            while (!feof($fp)) {
                $html_data .= fgets($fp, 1024);
            }
            fclose($fp);
        }
    }
    //if ($headers == true)
    //    $html_data = stripHeaders($html_data);
    return $html_data;
}
 public static function update()
 {
     $file_id = (int) $_REQUEST['file_id'];
     $file = MediaFile::find_by_id($file_id);
     if (isset($_REQUEST['slug'])) {
         self::simulate_temporary_episode_slug($_REQUEST['slug']);
     }
     $info = $file->determine_file_size();
     $file->save();
     $result = array();
     $result['file_url'] = $file->get_file_url();
     $result['file_id'] = $file_id;
     $result['reachable'] = podlove_is_resolved_and_reachable_http_status($info['http_code']);
     $result['file_size'] = $file->size;
     if (!$result['reachable']) {
         $info['certinfo'] = print_r($info['certinfo'], true);
         $info['php_open_basedir'] = ini_get('open_basedir');
         $info['php_safe_mode'] = ini_get('safe_mode');
         $info['php_curl'] = in_array('curl', get_loaded_extensions());
         $info['curl_exec'] = function_exists('curl_exec');
         $errorLog = "--- # Can't reach {$file->get_file_url()}\n";
         $errorLog .= "--- # Please include this output when you report a bug\n";
         foreach ($info as $key => $value) {
             $errorLog .= "{$key}: {$value}\n";
         }
         \Podlove\Log::get()->addError($errorLog);
     }
     Ajax::respond_with_json($result);
 }
Example #12
0
 public function index($name = '')
 {
     $this->document->setTitle('Step 1');
     $data = array();
     //PHP Version
     $currentPhpVersion = phpversion();
     $this->compareVersion($currentPhpVersion);
     $data['currentPhpVersion'] = $currentPhpVersion;
     if (isset($this->error['phpVersionError'])) {
         $data['phpVersionError'] = $this->error['phpVersionError'];
     } else {
         $data['phpVersionError'] = '';
     }
     //PHP Extensions
     $loadedExtensions = get_loaded_extensions();
     foreach ($loadedExtensions as $key => $ext) {
         $loadedExtensions[$key] = strtolower($ext);
     }
     $data['extensions'] = $this->checkExtensions($loadedExtensions);
     if (!$this->error) {
         $data['href'] = $this->url->link('step2');
     } else {
         $data['href'] = '';
     }
     $data['requiredPhpversion'] = $this->requiered['phpVersion'];
     $data['header'] = $this->load->controller('gemeinsam/header');
     $data['footer'] = $this->load->controller('gemeinsam/footer');
     $data['navigation'] = $this->load->controller('gemeinsam/navigation');
     $output = $this->load->view('default/template/step1/index', $data);
     $this->response->setOutput($output);
 }
Example #13
0
 /**
  * Construct method. Start the object NimbleApi. Start the Object Authorization too.
  *
  * @param array $settings. (must contain at least clientId and clientSecret vars)
  * @throws Exception. (Return exception if not exist clientId or clientSecret)
  */
 public function __construct(array $settings)
 {
     if ($this->use_curl && !in_array('curl', get_loaded_extensions())) {
         throw new Exception('You need to install cURL, see: http://curl.haxx.se/docs/install.html');
     }
     if (empty($settings['clientId']) || empty($settings['clientSecret'])) {
         throw new Exception('secretKey or clientId cannot be null or empty!');
     }
     if (empty($settings['mode'])) {
         throw new Exception('mode cannot be null or empty!');
     }
     try {
         if ($settings['mode'] == 'real') {
             $this->uri = ConfigSDK::NIMBLE_API_BASE_URL;
         } else {
             $this->uri = ConfigSDK::NIMBLE_API_BASE_URL_DEMO;
         }
         $this->authorization = new authorization();
         $this->authorization->setClientId($settings['clientId']);
         $this->authorization->setClientSecret($settings['clientSecret']);
         if (!$this->authorization->IsAccessParams()) {
             $this->authorization->getAuthorization($this);
         }
     } catch (Exception $e) {
         throw new Exception('Failed to instantiate Authorization: ' . $e);
     }
 }
 public function test()
 {
     print_r(get_loaded_extensions());
     //phpinfo();
     return;
     $result = \App\Models\NestedSets::withDepth()->having('depth', '=', 1)->get();
     return $result;
     $parent = \App\Models\NestedSets::find(1);
     \App\Models\NestedSets::create(['name' => 'Парфюмерия'], $parent);
     return;
     $node = new \App\Models\NestedSets();
     $node->name = 'hello NS';
     $node->save();
     return '';
     $catalog = \App\Helpers\CitynatureHelper::getCatalogArrayFromCsvFile(base_path('storage/app/price1.csv'));
     foreach ($catalog as $item_level_1) {
         foreach ($item_level_1['items'] as $item_level_2) {
             //
             foreach ($item_level_2['items'] as $item_level_3) {
                 //
                 foreach ($item_level_3['items'] as $item_level_4) {
                     //
                     foreach ($item_level_4 as $product) {
                         //
                     }
                 }
             }
         }
     }
     return view('test.page');
 }
Example #15
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     $lang = JFactory::getLanguage();
     $lang->load('lib_syw.sys', JPATH_SITE);
     $version = new JVersion();
     $jversion = explode('.', $version->getShortVersion());
     $extensions = get_loaded_extensions();
     $html = '';
     if (!in_array('intl', $extensions)) {
         if (intval($jversion[0]) > 2) {
             // Joomla! 3+
             $html .= '<div class="alert alert-error">';
         } else {
             $html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #EED3D7; background-color: #F2DEDE; color: #B94A48;">';
         }
         $html .= '<span>';
         $html .= JText::_('LIB_SYW_INTLTEST_NOTLOADED');
         $html .= '</span>';
         $html .= '</div>';
         return $html;
     } else {
         if (intval($jversion[0]) > 2) {
             // Joomla! 3+
             $html .= '<div class="alert alert-success">';
         } else {
             $html .= '<div style="clear: both; margin: 5px 0; padding: 8px 35px 8px 14px; border-radius: 4px; border: 1px solid #D6E9C6; background-color: #DFF0D8; color: #468847;">';
         }
         $html .= '<span>';
         $html .= JText::_('LIB_SYW_INTLTEST_LOADED');
         $html .= '</span>';
         $html .= '</div>';
     }
     return $html;
 }
 /**
  * Retrieve list of currently installed extensions
  *
  * @return array
  */
 public function getCurrent()
 {
     if (!$this->current) {
         $this->current = array_map('strtolower', get_loaded_extensions());
     }
     return $this->current;
 }
 /**
  * makes a request to the amfphp server
  * @param string $serviceName
  * @param string $methodName
  * @param string $parameters
  * @return mixed array or object, json decoded
  */
 function call($serviceName, $methodName, $parameters = array())
 {
     if (!in_array('curl', get_loaded_extensions())) {
         $error = 'curl php extension unavailable. Can not make call. This does not mean yœu can not use amfPHP, however it does mean that most of the functionality in the Back Office will not work. This must be changed by your Hosting provider.';
         echo $error;
         throw new Exception($error);
     }
     $jsonEncodedParams = json_encode($parameters);
     $requestString = "{\"serviceName\":\"{$serviceName}\", \"methodName\":\"{$methodName}\", \"parameters\":{$jsonEncodedParams}}";
     //echo $requestString;
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $this->amfphpEntryPointUrl);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $requestString);
     curl_setopt($curl, CURLOPT_HEADER, true);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HEADER, false);
     $response = curl_exec($curl);
     if ($response == 'null') {
         return null;
     }
     $decoded = json_decode($response);
     if ($decoded == null) {
         throw new Exception("could not decode response : {$response}");
     }
     return $decoded;
 }
Example #18
0
 public function testEnabled()
 {
     $php = $this->php;
     /* Is PHP Session support enabled? */
     $sessionsSupported = in_array('session', get_loaded_extensions());
     $this->assertEqual($sessionsSupported, $php::enabled());
 }
Example #19
0
 /**
  * Compat
  * Check to make sure we reach minimum requirements for this plugin to work propery.
  * @since 0.1
  * @version 1.2.1
  */
 public function compat()
 {
     global $wpdb;
     $message = array();
     // WordPress check
     $wp_version = $GLOBALS['wp_version'];
     if (version_compare($wp_version, '3.8', '<') && !defined('MYCRED_FOR_OLDER_WP')) {
         $message[] = __('myCRED requires WordPress 3.8 or higher. Version detected:', 'mycred') . ' ' . $wp_version;
     }
     // PHP check
     $php_version = phpversion();
     if (version_compare($php_version, '5.2.4', '<')) {
         $message[] = __('myCRED requires PHP 5.2.4 or higher. Version detected: ', 'mycred') . ' ' . $php_version;
     }
     // SQL check
     $sql_version = $wpdb->db_version();
     if (version_compare($sql_version, '5.0', '<')) {
         $message[] = __('myCRED requires SQL 5.0 or higher. Version detected: ', 'mycred') . ' ' . $sql_version;
     }
     // mcrypt library check (if missing, this will cause a fatal error)
     $extensions = get_loaded_extensions();
     if (!in_array('mcrypt', $extensions) && !defined('MYCRED_DISABLE_PROTECTION')) {
         $message[] = __('The mcrypt PHP library must be enabled in order to use this plugin! Please check your PHP configuration or contact your host and ask them to enable it for you!', 'mycred');
     }
     // Not empty $message means there are issues
     if (!empty($message)) {
         $error_message = implode("\n", $message);
         die(__('Sorry but your WordPress installation does not reach the minimum requirements for running myCRED. The following errors were given:', 'mycred') . "\n" . $error_message);
     }
 }
 /**
  * Gets the singleton SoapClient which is used to connect to the TransIP Api.
  *
  * @param array  $classMap
  * @param  mixed $parameters Parameters.
  * @throws \Exception
  * @return \SoapClient               The SoapClient object to which we can connect to the TransIP API
  */
 protected function soapClient(array $classMap, $parameters = array())
 {
     $endpoint = $this->client->getEndpoint();
     if ($this->soapClient === null) {
         $extensions = get_loaded_extensions();
         $errors = array();
         if (!class_exists('SoapClient') || !in_array('soap', $extensions)) {
             $errors[] = 'The PHP SOAP extension doesn\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';
         }
         if (!in_array('openssl', $extensions)) {
             $errors[] = 'The PHP OpenSSL extension doesn\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';
         }
         if (!empty($errors)) {
             die('<p>' . implode("</p>\n<p>", $errors) . '</p>');
         }
         $options = array('classmap' => $classMap, 'encoding' => 'utf-8', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'trace' => false);
         $wsdlUri = "https://{$endpoint}/wsdl/?service=" . $this->service;
         try {
             $this->soapClient = new \SoapClient($wsdlUri, $options);
         } catch (\SoapFault $sf) {
             throw new \Exception("Unable to connect to endpoint '{$endpoint}'");
         }
         $this->soapClient->__setCookie('login', $this->client->getLogin());
         $this->soapClient->__setCookie('mode', $this->client->getMode());
     }
     $timestamp = time();
     $nonce = uniqid('', true);
     $this->soapClient->__setCookie('timestamp', $timestamp);
     $this->soapClient->__setCookie('nonce', $nonce);
     $this->soapClient->__setCookie('clientVersion', $this->apiVersion);
     $this->soapClient->__setCookie('signature', $this->_urlencode($this->_sign(array_merge($parameters, array('__service' => $this->service, '__hostname' => $endpoint, '__timestamp' => $timestamp, '__nonce' => $nonce)))));
     return $this->soapClient;
 }
Example #21
0
/**
* check if SQLite extension is loaded, and if not load it.
*/
function CheckExtension($extName)
{
    $SQL_SERVER_OS = strtoupper(substr(PHP_OS, 0, 3));
    if ($SQL_SERVER_OS == 'WIN') {
        $preffix = 'php_';
        $suffix = '.dll';
    } elseif ($SQL_SERVER_OS == 'NET') {
        $preffix = 'php_';
        $suffix = '.nlm';
    } elseif ($SQL_SERVER_OS == 'LIN' || $SQL_SERVER_OS == 'DAR') {
        $preffix = '';
        $suffix = '.so';
    }
    $extensions = get_loaded_extensions();
    foreach ($extensions as $key => $ext) {
        $extensions[$key] = strtolower($ext);
    }
    if (!extension_loaded($extName) && !in_array($extName, get_loaded_extensions())) {
        if (DEBUG) {
            $oldLevel = error_reporting();
            error_reporting(E_ERROR);
            $extensionLoaded = dl($preffix . $extName . $suffix);
            error_reporting($oldLevel);
        } else {
            $extensionLoaded = @dl($preffix . $extName . $suffix);
        }
        if ($extensionLoaded) {
            return true;
        } else {
            return false;
        }
    } else {
        return true;
    }
}
Example #22
0
/**
 * RD Station - Integrações
 * addLeadConversionToRdstationCrm()
 * Envio de dados para a API de leads do RD Station
 *
 * Parâmetros:
 *     ($rdstation_token) - token da sua conta RD Station ( encontrado em https://www.rdstation.com.br/docs/api )
 *     ($identifier) - identificador da página ou evento ( por exemplo, 'pagina-contato' )
 *     ($data_array) - um Array com campos do formulário ( por exemplo, array('email' => '*****@*****.**', 'nome' =>'Fulano') )
 */
function addLeadConversionToRdstationCrm($rdstation_token, $identifier, $data_array)
{
    $api_url = "http://www.rdstation.com.br/api/1.2/conversions";
    try {
        if (empty($data_array["token_rdstation"]) && !empty($rdstation_token)) {
            $data_array["token_rdstation"] = $rdstation_token;
        }
        if (empty($data_array["identificador"]) && !empty($identifier)) {
            $data_array["identificador"] = $identifier;
        }
        if (empty($data_array["c_utmz"])) {
            $data_array["c_utmz"] = $_COOKIE["__utmz"];
        }
        unset($data_array["password"], $data_array["password_confirmation"], $data_array["senha"], $data_array["confirme_senha"], $data_array["captcha"], $data_array["_wpcf7"], $data_array["_wpcf7_version"], $data_array["_wpcf7_unit_tag"], $data_array["_wpnonce"], $data_array["_wpcf7_is_ajax_call"]);
        if (!empty($data_array["token_rdstation"]) && !(empty($data_array["email"]) && empty($data_array["email_lead"]))) {
            $data_query = http_build_query($data_array);
            if (in_array('curl', get_loaded_extensions())) {
                $ch = curl_init($api_url);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $data_query);
                // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                curl_exec($ch);
                curl_close($ch);
            } else {
                $params = array('http' => array('method' => 'POST', 'content' => $data_query, 'ignore_errors' => true));
                $ctx = stream_context_create($params);
                $fp = @fopen($api_url, 'rb', false, $ctx);
            }
        }
    } catch (Exception $e) {
    }
}
Example #23
0
function getGuruCurrentVersionData()
{
    $component = "com_guru";
    $version = "";
    $data = 'www.ijoomla.com/ijoomla_latest_version.txt';
    $extensions = get_loaded_extensions();
    $text = "";
    if (in_array("curl", $extensions)) {
        $ch = @curl_init($data);
        @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        @curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        $version = @curl_exec($ch);
        if (isset($version) && trim($version) != "") {
            $pattern = "/3.0_" . $component . "=(.*);/msU";
            preg_match($pattern, $version, $result);
            if (is_array($result) && count($result) > 0) {
                $version = trim($result["1"]);
            }
            return $version;
        }
    } else {
        $text = file_get_contents('www.ijoomla.com/ijoomla_latest_version.txt');
        return $text;
    }
}
Example #24
0
 public function getUrl()
 {
     // Check for installed CURL library
     $installedLibraries = get_loaded_extensions();
     if (!in_array('curl', $installedLibraries)) {
         $this->setError(JText::_("ITP_ERROR_CURL_MISSING"));
         return null;
     }
     switch ($this->service) {
         case "jmp":
             $this->getBitlyURL("j.mp");
             break;
         case "bitlycom":
             $this->getBitlyURL("bitly.com");
             break;
         case "tinycc":
             $this->getTinyURL();
             break;
         case "google":
             $this->getGoogleURL();
             break;
         default:
             // bit.ly
             $this->getBitlyURL("bit.ly");
             break;
     }
     return $this->shortUrl;
 }
Example #25
0
/**
 * Check if the cURL extension is installed
 * @return boolean
 */
function _is_curl_installed()
{
    if (in_array('curl', get_loaded_extensions())) {
        return true;
    }
    return false;
}
 public function request($path, $query_array = array(), $options = array())
 {
     $parse_url = parse_url($path);
     $request_url = '';
     if (!isset($parse_url['scheme']) || empty($parse_url['scheme'])) {
         $request_url .= API_DOMAIN;
     }
     $request_url .= $path;
     if ($query_array !== false) {
         $query_array = isset($options['authentication']) && $options['authentication'] == false ? $query_array : LoginRadius::authentication($query_array);
         if (strpos($request_url, "?") === false) {
             $request_url .= "?";
         } else {
             $request_url .= "&";
         }
         $request_url .= LoginRadius::queryBuild($query_array);
     }
     if (in_array('curl', get_loaded_extensions())) {
         $response = $this->curlApiMethod($request_url, $options);
     } elseif (ini_get('allow_url_fopen')) {
         $response = $this->fsockopenApiMethod($request_url, $options);
     } else {
         throw new LoginRadiusException('cURL or FSOCKOPEN is not enabled, enable cURL or FSOCKOPEN to get response from LoginRadius API.');
     }
     if (!empty($response)) {
         $result = json_decode($response);
         if (isset($result->errorCode) && !empty($result->errorCode)) {
             throw new LoginRadiusException($result->message, $result);
         }
     }
     return $response;
 }
Example #27
0
 /**
  * Create Exif class
  *
  * @param string $file 
  * @author Thibaud Rohmer
  */
 public function __construct($file = null)
 {
     /// No file given
     if (!isset($file)) {
         return;
     }
     /// File isn't an image
     if (is_array($file) || !File::Type($file) || File::Type($file) != "Image") {
         return;
     }
     /// No right to view
     if (!Judge::view($file)) {
         return;
     }
     /// No exif extension installed
     if (!in_array("exif", get_loaded_extensions())) {
         $infos[''] = "Exif extension is not installed on the server";
         return;
     }
     /// Create wanted table
     $this->init_wanted();
     /// Read exif
     $raw_exif = @exif_read_data($file);
     /// Parse exif
     foreach ($this->wanted as $name => $data) {
         foreach ($data as $d) {
             if (isset($raw_exif[$d])) {
                 $this->exif[$name] = $this->parse_exif($d, $raw_exif);
             }
         }
     }
     $this->filename = basename($file);
 }
Example #28
0
function __aws_sdk_ua_callback()
{
    $ua_append = '';
    $extensions = get_loaded_extensions();
    $sorted_extensions = array();
    if ($extensions) {
        foreach ($extensions as $extension) {
            if ($extension === 'curl' && function_exists('curl_version')) {
                $curl_version = curl_version();
                $sorted_extensions[strtolower($extension)] = $curl_version['version'];
            } elseif ($extension === 'pcre' && defined('PCRE_VERSION')) {
                $pcre_version = explode(' ', PCRE_VERSION);
                $sorted_extensions[strtolower($extension)] = $pcre_version[0];
            } elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT')) {
                $openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
                $sorted_extensions[strtolower($extension)] = $openssl_version[1];
            } else {
                $sorted_extensions[strtolower($extension)] = phpversion($extension);
            }
        }
    }
    foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext) {
        if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext]) {
            $ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
        } elseif (isset($sorted_extensions[$ua_ext])) {
            $ua_append .= ' ' . $ua_ext . '/0';
        }
    }
    return $ua_append;
}
Example #29
0
function nxs_cURLTest($url, $msg, $testText)
{
    if (!in_array('curl', get_loaded_extensions())) {
        echo "There is a problem with cURL. It is not installed. You need to contact your server admin or hosting provider.";
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    $response = curl_exec($ch);
    $errmsg = curl_error($ch);
    $cInfo = curl_getinfo($ch);
    curl_close($ch);
    echo "Testing ... " . $url . " - " . $cInfo['url'] . "<br />";
    if (stripos($response, $testText) !== false) {
        echo "...." . $msg . " - OK<br />";
    } else {
        echo "....<b style='color:red;'>" . $msg . " - Problem</b><br /><pre>";
        print_r($errmsg);
        print_r($cInfo);
        print_r(htmlentities($response));
        echo "There is a problem with cURL. You need to contact your server admin or hosting provider.";
    }
}
Example #30
-3
 /**
  * index function.
  * 
  * @access public
  * @return void
  */
 public function index()
 {
     $this->output->enable_profiler(false);
     if (!$this->auth->loggedin()) {
         redirect('user/login');
     }
     $data['title'] = $this->system_model->get('app_name');
     $html = row(columns(heading(ucfirst(lang('about')) . ' ' . $this->system_model->get('app_name'), 1), 12));
     $uptime_array = explode(" ", exec("cat /proc/uptime"));
     $seconds = round($uptime_array[0], 0);
     $minutes = $seconds / 60;
     $hours = $minutes / 60;
     $days = floor($hours / 24);
     $hours = sprintf('%02d', floor($hours - $days * 24));
     $minutes = sprintf('%02d', floor($minutes - $days * 24 * 60 - $hours * 60));
     if ($days == 0) {
         $uptime = $hours . ":" . $minutes;
     } elseif ($days == 1) {
         $uptime = $days . " " . lang('day') . ", " . $hours . ":" . $minutes;
     } else {
         $uptime = $days . " " . lang('days') . ", " . $hours . ":" . $minutes;
     }
     $infolist = ul(array(heading('Applikation', 5) . ul(array(strong('Klubb-' . lang('version') . ': ') . KLUBB_VERSION, strong('CodeIgniter-' . lang('version') . ': ') . CI_VERSION, strong(ucfirst(lang('database')) . ': ') . $this->db->platform() . ', ' . lang('version') . ': ' . $this->db->version(), strong(ucfirst(lang('environment') . ': ')) . lang(ENVIRONMENT))), heading('Server', 5) . ul(array(strong('Namn: ') . php_uname('n'), strong('System: ') . php_uname('s') . ' ' . php_uname('r') . ' ' . php_uname('v') . ' ' . php_uname('m'), strong('Upptid: ') . $uptime, strong('PHP-version: ') . phpversion(), strong('PHP-moduler: ') . implode(', ', get_loaded_extensions())))), array('class' => 'no-bullet'));
     $html .= row(columns($infolist));
     $data['breadcrumbs'] = array(array('data' => anchor('/', $this->system_model->get('app_name')), 'mode' => 'unavailable'), array('data' => anchor('about', ucfirst(lang('about') . ' ' . $data['title'])), 'mode' => 'current'));
     $data['html'] = $html;
     $this->system_model->view('template', $data);
 }