コード例 #1
0
ファイル: crypto.php プロジェクト: rbianco3/phppickem
 function phpFreaksCrypto($key = 'a843l?nv89rjfd}O(jdnsleken0', $iv = false, $algorithm = 'tripledes', $mode = 'ecb')
 {
     if (extension_loaded('mcrypt') === FALSE) {
         $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
         dl($prefix . 'mcrypt.' . PHP_SHLIB_SUFFIX) or die('The Mcrypt module could not be loaded.');
     }
     if ($mode != 'ecb' && $iv === false) {
         /*
           the iv must remain the same from encryption to decryption and is usually
           passed into the encrypted string in some form, but not always.
         */
         die('In order to use encryption modes other then ecb, you must specify a unique and consistent initialization vector.');
     }
     // set mcrypt mode and cipher
     $this->td = mcrypt_module_open($algorithm, '', $mode, '');
     // Unix has better pseudo random number generator then mcrypt, so if it is available lets use it!
     //$random_seed = strstr(PHP_OS, "WIN") ? MCRYPT_RAND : MCRYPT_DEV_RANDOM;
     $random_seed = MCRYPT_RAND;
     // if initialization vector set in constructor use it else, generate from random seed
     $iv = $iv === false ? mcrypt_create_iv(mcrypt_enc_get_iv_size($this->td), $random_seed) : substr($iv, 0, mcrypt_enc_get_iv_size($this->td));
     // get the expected key size based on mode and cipher
     $expected_key_size = mcrypt_enc_get_key_size($this->td);
     // we dont need to know the real key, we just need to be able to confirm a hashed version
     $key = substr(md5($key), 0, $expected_key_size);
     // initialize mcrypt library with mode/cipher, encryption key, and random initialization vector
     mcrypt_generic_init($this->td, $key, $iv);
 }
コード例 #2
0
ファイル: common.lib.php プロジェクト: racontemoi/mamp
/**
* 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;
    }
}
コード例 #3
0
ファイル: coreFfilelib.php プロジェクト: digideskio/hypervm
 static function load_gd()
 {
     if (!extension_loaded("gd")) {
         dprint("Warning No gd <br> ");
         dl("gd." . PHP_SHLIB_SUFFIX);
     }
 }
コード例 #4
0
ファイル: Snmp.php プロジェクト: bjtenao/tudu-web
 /**
  * construct
  *
  */
 public function __construct(array $options)
 {
     // 加载扩展
     if (!extension_loaded('snmp_plugin')) {
         dl('snmp_plugin.' . PHP_SHLIB_SUFFIX);
     }
     // 检测需要的类
     $classes = array('PHPSnmpEngine', 'SnmpServerInfo', 'PHPSystemDescRequest', 'PHPEnumCPUUtilizationRateRequest', 'PHPEnumNetworkRequest', 'PHPEnumStorageRequest', 'PHPEnumDiskIORequest');
     foreach ($classes as $class) {
         if (!class_exists($class)) {
             throw new Oray_Exception("Class {$class} not exist");
         }
     }
     // 初始化配置
     while (list($name, $value) = each($options)) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     // 设置配置到SnmpServerInfo类
     $ServerInfo = new SnmpServerInfo();
     foreach ($this->_options as $name => $value) {
         $ServerInfo->{$name} = $value;
     }
     // 设置连接超时
     $ServerInfo->connect_server_timeout = 20000;
     // 实例化引擎、连接服务器
     $this->_snmpEngine = new PHPSnmpEngine();
     $this->_snmpEngine->ConnectSnmpServer($ServerInfo);
 }
コード例 #5
0
ファイル: Runtime.class.php プロジェクト: johannes85/core
 /**
  * Loads a dynamic library.
  *
  * @see     php://dl
  * @param   string name
  * @return  bool TRUE if the library was loaded, FALSE if it was already loaded
  * @throws  lang.IllegalAccessException in case library loading is prohibited
  * @throws  lang.ElementNotFoundException in case the library does not exist
  * @throws  lang.RuntimeError in case dl() fails
  */
 public function loadLibrary($name)
 {
     if (extension_loaded($name)) {
         return false;
     }
     // dl() will fatal if any of these are set - prevent this
     if (!(bool) ini_get('enable_dl') || (bool) ini_get('safe_mode')) {
         throw new IllegalAccessException(sprintf('Loading libraries not permitted by system configuration [enable_dl= %s, safe_mode= %s]', ini_get('enable_dl'), ini_get('safe_mode')));
     }
     // Qualify filename
     $path = rtrim(realpath(ini_get('extension_dir')), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $filename = $name . '.' . PHP_SHLIB_SUFFIX;
     // Try php_<name>.<ext>, <name>.<ext>
     if (file_exists($lib = $path . 'php_' . $filename)) {
         // E.g. php_sybase_ct.dll
     } else {
         if (file_exists($lib = $path . $filename)) {
             // E.g. sybase_ct.so
         } else {
             throw new ElementNotFoundException('Cannot find library "' . $name . '" in "' . $path . '"');
         }
     }
     // Found library, try to load it. dl() expects given argument to not contain
     // a path and will fail with "Temporary module name should contain only
     // filename" if it does.
     if (!dl(basename($lib))) {
         throw new RuntimeError('dl() failed for ' . $lib);
     }
     return true;
 }
コード例 #6
0
ファイル: sso.php プロジェクト: nguyennm621992/helppage
 function sso_auth()
 {
     $auth_check = TRUE;
     $non_check_uri = array('remote', 'auth');
     if (isset($_SERVER['PATH_INFO'])) {
         $path_info = $_SERVER['PATH_INFO'];
         foreach ($non_check_uri as $uri) {
             if (strpos($path_info, $uri) === 1) {
                 $auth_check = FALSE;
                 break;
             }
         }
     }
     if (!extension_loaded('haes')) {
         if (phpversion() >= '5.0') {
             @dl('haes.so');
         } else {
             @dl(HOME_PATH . '../approval/lib/haes.so');
         }
     }
     $this->_load_global_config();
     if ($auth_check) {
         $this->_check_auth();
         $this->_load_timezone_config($GLOBALS['_HANBIRO_GW']['ID']);
     }
 }
コード例 #7
0
ファイル: entryPoint.php プロジェクト: HaakonME/porticoestate
 protected function in()
 {
     $path_to_phpgroupware = dirname(__FILE__) . '/../..';
     // need to be adapted if this script is moved somewhere else
     $_GET['domain'] = 'default';
     $GLOBALS['phpgw_info']['flags'] = array('currentapp' => 'login', 'noapi' => True);
     /**
      * Include phpgroupware header
      */
     include $path_to_phpgroupware . '/header.inc.php';
     unset($GLOBALS['phpgw_info']['flags']['noapi']);
     $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
     if ($db_type == 'postgres') {
         $db_type = 'pgsql';
     }
     if (!extension_loaded($db_type) && !dl($db_type . '.so')) {
         echo "Extension '{$db_type}' is not loaded and can't be loaded via dl('{$db_type}.so') !!!\n";
     }
     $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db';
     /**
      * Include API functions
      */
     include PHPGW_API_INC . '/functions.inc.php';
     for ($i = 0; $i < 10; $i++) {
         restore_error_handler();
         //Remove at least 10 levels of custom error handling
     }
     for ($i = 0; $i < 10; $i++) {
         restore_exception_handler();
         //Remove at least 10 levels of custom exception handling
     }
     $this->initializeContext();
 }
コード例 #8
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!class_exists('Event')) {
         dl('event.so');
     }
     $listen = $input->getOption('listen');
     if ($listen === null) {
         $listen = 8080;
     }
     $this->socket = new SocketIO();
     $this->socket->on('addme', function (Event\MessageEvent $messageEvent) {
         return $this->onAddme($messageEvent);
     })->on('msg', function (Event\MessageEvent $messageEvent) {
         return $this->onMsg($messageEvent);
     });
     $this->socket->listen($listen)->onConnect(function () {
     })->onRequest('/brocast', function ($connection, \EventHttpRequest $request) {
         if ($request->getCommand() == \EventHttpRequest::CMD_POST) {
             if (($data = json_decode($request->getInputBuffer()->read(1024), true)) !== NULL) {
                 $response = $this->onBrocast($data);
             } else {
                 $response = new Response('fail', Response::HTTP_NOT_FOUND);
             }
         } else {
             $response = new Response('fail', Response::HTTP_NOT_FOUND);
         }
         $connection->sendResponse($response);
     })->dispatch();
 }
コード例 #9
0
ファイル: AbstractDaemon.php プロジェクト: bcrazvan/MateCat
 /**
  * Singleton Pattern, Unique Instance of This
  *
  * @param $config_file mixed
  * @param $queueIndex
  *
  * @return static
  */
 public static function getInstance($config_file = null, $queueIndex = null)
 {
     if (PHP_SAPI != 'cli' || isset($_SERVER['HTTP_HOST'])) {
         die("This script can be run only in CLI Mode.\n\n");
     }
     declare (ticks=10);
     set_time_limit(0);
     if (static::$__INSTANCE === null) {
         if (!extension_loaded("pcntl") && (bool) ini_get("enable_dl")) {
             dl("pcntl.so");
         }
         if (!function_exists('pcntl_signal')) {
             $msg = "****** PCNTL EXTENSION NOT LOADED. KILLING THIS PROCESS COULD CAUSE UNPREDICTABLE ERRORS ******";
             static::_TimeStampMsg($msg);
         } else {
             static::_TimeStampMsg(str_pad(" Registering signal handlers ", 60, "*", STR_PAD_BOTH));
             pcntl_signal(SIGTERM, array(get_called_class(), 'sigSwitch'));
             pcntl_signal(SIGINT, array(get_called_class(), 'sigSwitch'));
             pcntl_signal(SIGHUP, array(get_called_class(), 'sigSwitch'));
             $msg = str_pad(" Signal Handler Installed ", 60, "-", STR_PAD_BOTH);
             static::_TimeStampMsg("{$msg}");
         }
         static::$__INSTANCE = new static($config_file, $queueIndex);
     }
     return static::$__INSTANCE;
 }
コード例 #10
0
ファイル: Requirements.php プロジェクト: budkit/budkit-cms
 /**
  * Checks required modules
  * 
  * @param string $name
  * @param array $directive
  * @return boolean 
  */
 public function testModule($name, $directive = array())
 {
     $return = array("title" => $directive['title'], "name" => $name, "current" => "", "test" => false);
     if (is_array($directive)) {
         //If the extension is loaded
         if (!extension_loaded($name)) {
             $return["current"] = t("Not Loaded");
             //If we require this module loaded, then fail
             if ($directive["loaded"]) {
                 $return["test"] = "Failed";
             }
             //If we require this module to be installed
             if ($directive["installed"] && function_exists('dl')) {
                 if (!dl($name)) {
                     $return["test"] = "Failed";
                     $return["current"] = t("Not Installed");
                 }
             }
         } else {
             $return["current"] = _("Loaded");
             if ($directive["loaded"]) {
                 $return["test"] = "Passed";
             }
         }
         //@TODO If we have alternative modules
         if (!$return['test'] && isset($directive['alternate'])) {
             //$altName =
         }
     }
     return $return;
 }
コード例 #11
0
 function __construct($sid, $verificaSID = true)
 {
     if (!function_exists('ms_GetVersion')) {
         if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
             if (!@dl('php_mapscript_48.dll')) {
                 dl('php_mapscript.dll');
             }
         } else {
             dl('php_mapscript.so');
         }
     }
     //include("../../classesphp/carrega_ext.php");
     //verifica��o de seguran�a
     if ($verificaSID == true) {
         $_SESSION = array();
         session_name("i3GeoPHP");
         session_id($sid);
         session_start();
         if (@$_SESSION["fingerprint"]) {
             $f = explode(",", $_SESSION["fingerprint"]);
             if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"], $f)) {
                 exit;
             }
         } else {
             exit;
         }
     }
     if (!isset($_SESSION["map_file"])) {
         exit;
     }
     $this->map_file = $_SESSION["map_file"];
     $this->postgis_mapa = $_SESSION["postgis_mapa"];
     $this->url = $_SESSION["tmpurl"];
     $this->ext = $_SESSION["mapext"];
 }
コード例 #12
0
ファイル: Install.class.php プロジェクト: alachaum/timetrex
 function __construct()
 {
     global $config_vars, $cache;
     require_once Environment::getBasePath() . 'classes' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'InstallSchema.class.php';
     $this->config_vars = $config_vars;
     //Disable caching so we don't exceed maximum memory settings.
     $cache->_onlyMemoryCaching = TRUE;
     ini_set('default_socket_timeout', 5);
     ini_set('allow_url_fopen', 1);
     //As of PHP v5.3 some SAPI's don't support dl(), however it appears that php.ini can still have it enabled.
     //Double check to make sure the dl() function exists prior to calling it.
     if (version_compare(PHP_VERSION, '5.3.0', '<') and function_exists('dl') == TRUE and (bool) ini_get('enable_dl') == TRUE and (bool) ini_get('safe_mode') == FALSE) {
         $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
         if (extension_loaded('mysql') == FALSE) {
             @dl($prefix . 'mysql.' . PHP_SHLIB_SUFFIX);
         }
         if (extension_loaded('mysqli') == FALSE) {
             @dl($prefix . 'mysqli.' . PHP_SHLIB_SUFFIX);
         }
         if (extension_loaded('pgsql') == FALSE) {
             @dl($prefix . 'pgsql.' . PHP_SHLIB_SUFFIX);
         }
     }
     return TRUE;
 }
コード例 #13
0
ファイル: PartialData.php プロジェクト: stnvh/php-partialzip
 /**
  * Get file contents from temp file
  * @return string
  */
 public function get()
 {
     if (!file_exists($this->tempName)) {
         throw new BadMethodCallException('Called before being fetched with Zip->get(). Don\'t call this directly!');
     }
     switch ($this->method) {
         case 8:
             $_method = 'gzinflate';
             break;
         case 12:
             if (!extension_loaded('bz2')) {
                 @dl(strtolower(substr(PHP_OS, 0, 3)) == 'win' ? 'php_bz2.dll' : 'bz2.so');
             }
             if (extension_loaded('bz2')) {
                 $_method = 'bzdecompress';
                 break;
             } else {
                 throw new RuntimeException('Unable to decompress, failed to load bz2 extension');
             }
         default:
             $_method = false;
     }
     if ($_method) {
         return call_user_func_array($_method, array(file_get_contents($this->tempName) . $this->purge()));
     } else {
         return file_get_contents($this->tempName) . $this->purge();
     }
 }
コード例 #14
0
ファイル: bounce.php プロジェクト: rlee1962/diylegalcenter
 function init()
 {
     if (extension_loaded("imap")) {
         return true;
     }
     $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
     $EXTENSION = $prefix . 'imap.' . PHP_SHLIB_SUFFIX;
     if (function_exists('dl')) {
         $fatalMessage = 'The system tried to load dynamically the ' . $EXTENSION . ' extension';
         $fatalMessage .= '<br/>If you see this message, that means the system could not load this PHP extension';
         $fatalMessage .= '<br/>Please enable the PHP Extension ' . $EXTENSION;
         ob_start();
         echo $fatalMessage;
         dl($EXTENSION);
         $warnings = str_replace($fatalMessage, '', ob_get_clean());
         if (extension_loaded("imap") or function_exists('imap_open')) {
             return true;
         }
     }
     if ($this->report) {
         acymailing::display('The extension "' . $EXTENSION . '" could not be loaded, please change your PHP configuration to enable it', 'error');
         if (!empty($warnings)) {
             acymailing::display($warnings, 'warning');
         }
     }
     return false;
 }
コード例 #15
0
ファイル: GenericTest.php プロジェクト: bjork/php-compat-info
 /**
  * Sets up the shared fixture.
  *
  * @return void
  * @link   http://phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture
  */
 public static function setUpBeforeClass()
 {
     if (self::$ext) {
         $name = strtolower(self::$ext);
         self::$obj = new ExtensionFactory($name);
     }
     if (!self::$obj instanceof ReferenceInterface) {
         self::$obj = null;
         return;
     }
     self::$ext = $extname = self::$obj->getName();
     self::$optionalreleases = array();
     if (!extension_loaded($extname)) {
         // if dynamic extension load is activated
         $loaded = (bool) ini_get('enable_dl');
         if ($loaded) {
             // give a second chance
             $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
             @dl($prefix . $extname . '.' . PHP_SHLIB_SUFFIX);
         }
     }
     if (!extension_loaded($extname)) {
         self::$obj = null;
     } else {
         $releases = array_keys(self::$obj->getReleases());
         $currentVersion = self::$obj->getCurrentVersion();
         // platform dependant
         foreach ($releases as $rel_version) {
             if (version_compare($currentVersion, $rel_version, 'lt')) {
                 array_push(self::$optionalreleases, $rel_version);
             }
         }
     }
 }
コード例 #16
0
ファイル: database.php プロジェクト: hardikk/HNH
 function logon($engine, $dbfile, $username, $password, $host, $name)
 {
     // connect string
     if ($dbfile) {
         // datasource mostly to support sqlite: dbengine://dbfile?mode=xxxx
         $datasource = $engine . ':///' . $dbfile . '?mode=0666';
         $options = array('debug' => 4);
         if (!extension_loaded('sqlite3') && !extension_loaded('SQLITE3')) {
             dl('sqlite3.so');
         }
     } else {
         // datasource in in this style: dbengine://username:password@host/database
         $datasource = $engine . '://' . $username . ':' . $password . '@' . $host . '/' . $name;
         // options
         $options = array('debug' => 2, 'portability' => DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_RTRIM | DB_PORTABILITY_DELETE_COUNT | DB_PORTABILITY_NUMROWS | DB_PORTABILITY_ERRORS | DB_PORTABILITY_NULL_TO_EMPTY);
     }
     // attempt connection
     $dbh = DB::connect($datasource, $options);
     // if connection failed show error
     if (DB::isError($dbh)) {
         $_SESSION['ari_error'] .= $dbh->getMessage() . "<br><br>";
         return;
     }
     return $dbh;
 }
コード例 #17
0
 function translation($warnings = False)
 {
     for ($i = 1; $i <= 9; $i++) {
         $this->placeholders[] = '%' . $i;
     }
     $this->db = is_object($GLOBALS['phpgw']->db) ? $GLOBALS['phpgw']->db : $GLOBALS['phpgw_setup']->db;
     if (!isset($GLOBALS['phpgw_setup'])) {
         $this->system_charset = @$GLOBALS['phpgw_info']['server']['system_charset'];
     } else {
         $this->db->query("SELECT config_value FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='system_charset'", __LINE__, __FILE__);
         if ($this->db->next_record()) {
             $this->system_charset = $this->db->f(0);
         }
     }
     // load multi-byte-string-extension if needed, and set its internal encodeing to your system_charset
     if ($this->system_charset && substr($this->system_charset, 0, 9) != 'iso-8859-1') {
         if ($this->mbstring = extension_loaded('mbstring') || @dl(PHP_SHLIB_PREFIX . 'mbstring.' . PHP_SHLIB_SUFFIX)) {
             ini_set('mbstring.internal_encoding', $this->system_charset);
             if (ini_get('mbstring.func_overload') < 7) {
                 if ($warnings) {
                     echo "<p>Warning: Please set <b>mbstring.func_overload = 7</b> in your php.ini for useing <b>{$this->system_charset}</b> as your charset !!!</p>\n";
                 }
             }
         } else {
             if ($warnings) {
                 echo "<p>Warning: Please get and/or enable the <b>mbstring extension</b> in your php.ini for useing <b>{$this->system_charset}</b> as your charset, we are defaulting to <b>iconv</b> for now !!!</p>\n";
             }
         }
     }
 }
コード例 #18
0
ファイル: phpchartdir.class.php プロジェクト: tmlsoft/main
function cdLoadDLL($ext)
{
    global $cdDebug;
    if ($cdDebug || error_reporting() != 0) {
        echo '<br><b>Trying to load "' . $ext . '" from the PHP extension directory ' . listExtDir() . '.</b><br>';
    }
    @cdSetHint(ini_get("extension_dir"));
    if (dl($ext)) {
        return true;
    }
    $ver = explode('.', phpversion());
    $ver = $ver[0] * 10000 + $ver[1] * 100 + $ver[2];
    if (!$cdDebug && $ver >= 50205) {
        return false;
    }
    $scriptPath = dirname(__FILE__);
    $tryPath = getRelExtPath($scriptPath);
    if (!$tryPath) {
        return false;
    }
    if ($cdDebug || error_reporting() != 0) {
        echo '<br><b>Trying to load "' . $ext . '" from ' . listRelExtDir($scriptPath) . '.</b><br>';
    }
    @cdSetHint($scriptPath);
    return dl($tryPath . "/{$ext}");
}
コード例 #19
0
ファイル: converter.inc.php プロジェクト: kidexx/sitebar
 function getEngine()
 {
     static $engine = -1;
     if ($engine != -1) {
         return $engine;
     }
     if (!$this->useEngine) {
         $engine = SB_CHARSET_IGNORE;
         return $engine;
     }
     if (!function_exists('iconv') && !extension_loaded('iconv')) {
         $this->useHandler(false);
         @dl('iconv');
         $this->useHandler();
     }
     if (function_exists('iconv')) {
         $engine = SB_CHARSET_ICONV;
     } elseif (function_exists('libiconv')) {
         $engine = SB_CHARSET_LIBICONV;
     } else {
         if (!function_exists('recode_string') && !extension_loaded('recode')) {
             $this->useHandler(false);
             @dl('recode');
             $this->useHandler();
         }
         if (function_exists('recode_string')) {
             $engine = SB_CHARSET_RECODE;
         } else {
             $engine = SB_CHARSET_IGNORE;
         }
     }
     return $engine;
 }
コード例 #20
0
 /**
  * Register the specified binding into the container
  * 
  * @param  string $binding
  * @return void
  */
 public function register($binding)
 {
     if (!extension_loaded('wxwidgets')) {
         if (!@dl('wxwidgets.' . PHP_SHLIB_SUFFIX)) {
             echo 'wxWidgets extension not installed or dynamically loaded extensions are not enabled' . PHP_EOL;
             exit(1);
         }
     }
     switch ($binding) {
         case 'view.viewparser':
             $this->registerViewParser();
             break;
         case 'wx':
             $this->registerWx();
             break;
         case 'launcher':
             $this->registerLauncher();
             break;
         case 'giml.collection':
             $this->registerGimlCollection();
             break;
         default:
             $this->registerGimlCollection();
             $this->registerViewParser();
             $this->registerWx();
             $this->registerLauncher();
             break;
     }
 }
コード例 #21
0
ファイル: helper.php プロジェクト: stretchyboy/sqlite
 /**
  * constructor
  */
 function helper_plugin_sqlite()
 {
     if (!$this->extension) {
         if (!extension_loaded('pdo_sqlite')) {
             $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
             if (function_exists('dl')) {
                 @dl($prefix . 'pdo_sqlite.' . PHP_SHLIB_SUFFIX);
             }
         }
         if (class_exists('pdo')) {
             $this->extension = DOKU_EXT_PDO;
         }
     }
     if (!$this->extension) {
         if (!extension_loaded('sqlite')) {
             $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
             if (function_exists('dl')) {
                 @dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
             }
         }
         if (function_exists('sqlite_open')) {
             $this->extension = DOKU_EXT_SQLITE;
         }
     }
     if (!$this->extension) {
         msg('SQLite & PDO SQLite support missing in this PHP install - plugin will not work', -1);
     }
 }
コード例 #22
0
ファイル: micka_lib_xml.php プロジェクト: riskatlas/micka
/**
 * Metainformation catalogue
 * --------------------------------------------------
 *
 * Lib_XML for MicKa
 *
 * @link       http://www.bnhelp.cz
 * @package    Micka
 * @category   Metadata
 * @version    20121206
 *
 */
function applyTemplate($xmlSource, $xsltemplate)
{
    $rs = FALSE;
    if (File_Exists(CSW_XSL . '/' . $xsltemplate)) {
        if (!extension_loaded("xsl")) {
            if (substr(PHP_OS, 0, 3) == "WIN") {
                dl("php_xsl.dll");
            } else {
                dl("php_xsl.so");
            }
        }
        $xp = new XsltProcessor();
        $xml = new DomDocument();
        $xsl = new DomDocument();
        $xml->loadXML($xmlSource);
        $xsl->load(CSW_XSL . '/' . $xsltemplate);
        $xp->importStyleSheet($xsl);
        //$xp->setParameter("","lang",$lang);
        $xp->setParameter("", "user", $_SESSION['u']);
        $rs = $xp->transformToXml($xml);
    }
    if ($rs === FALSE) {
        setMickaLog('applyTemplate === FALSE', 'ERROR', 'micka_lib_xml.php');
    }
    return $rs;
}
コード例 #23
0
ファイル: DatabaseMssql.php プロジェクト: rocLv/conference
 /** Open an MSSQL database and return a resource handle to it
  *  NOTE: only $dbName is used, the other parameters are irrelevant for MSSQL databases
  */
 function open($server, $user, $password, $dbName)
 {
     wfProfileIn(__METHOD__);
     # Test for missing mysql.so
     # First try to load it
     if (!@extension_loaded('mssql')) {
         @dl('mssql.so');
     }
     # Fail now
     # Otherwise we get a suppressed fatal error, which is very hard to track down
     if (!function_exists('mssql_connect')) {
         throw new DBConnectionError($this, "MSSQL functions missing, have you compiled PHP with the --with-mssql option?\n");
     }
     $this->close();
     $this->mServer = $server;
     $this->mUser = $user;
     $this->mPassword = $password;
     $this->mDBname = $dbName;
     wfProfileIn("dbconnect-{$server}");
     # Try to connect up to three times
     # The kernel's default SYN retransmission period is far too slow for us,
     # so we use a short timeout plus a manual retry.
     $this->mConn = false;
     $max = 3;
     for ($i = 0; $i < $max && !$this->mConn; $i++) {
         if ($i > 1) {
             usleep(1000);
         }
         if ($this->mFlags & DBO_PERSISTENT) {
             @($this->mConn = mssql_pconnect($server, $user, $password));
         } else {
             # Create a new connection...
             @($this->mConn = mssql_connect($server, $user, $password, true));
         }
     }
     wfProfileOut("dbconnect-{$server}");
     if ($dbName != '') {
         if ($this->mConn !== false) {
             $success = @mssql_select_db($dbName, $this->mConn);
             if (!$success) {
                 $error = "Error selecting database {$dbName} on server {$this->mServer} " . "from client host " . wfHostname() . "\n";
                 wfLogDBError(" Error selecting database {$dbName} on server {$this->mServer} \n");
                 wfDebug($error);
             }
         } else {
             wfDebug("DB connection error\n");
             wfDebug("Server: {$server}, User: {$user}, Password: "******"...\n");
             $success = false;
         }
     } else {
         # Delay USE query
         $success = (bool) $this->mConn;
     }
     if (!$success) {
         $this->reportConnectionError();
     }
     $this->mOpened = $success;
     wfProfileOut(__METHOD__);
     return $success;
 }
コード例 #24
0
 /**
  * @return void
  * @param int $length string length
  * @param int $size font size
  * @param String $type image type
  * @desc generate the main image
  */
 function CaptchaNumbers($length = '', $size = '', $type = '')
 {
     /*
      * make sure that the gd extension is loaded (for graphics)
      */
     if (!extension_loaded('gd')) {
         if (strtoupper(substr(PHP_OS, 3)) == "WIN") {
             dl('php_gd2.dll');
         } else {
             dl('gd.so');
         }
     }
     //putenv('GDFONTPATH=' . realpath('.'));
     if ($length != '') {
         $this->length = $length;
     }
     if ($size != '') {
         $this->size = $size;
     }
     if ($type != '') {
         $this->type = $type;
     }
     $this->width = $this->length * $this->size + $this->grid;
     $this->height = $this->size + 2 * $this->grid;
     $this->generateString();
 }
コード例 #25
0
ファイル: trustcommerce.php プロジェクト: billyprice1/whmcs
function trustcommerce_refund($params)
{
    if (!extension_loaded("tclink")) {
        $extfname = "tclink.so";
        if (!dl($extfname)) {
            $msg = "Please check to make sure the module TCLink is properly built";
            return array("status" => "error", "rawdata" => array("error" => $msg));
        }
    }
    $tc_params = array("action" => "credit");
    $tc_params['custid'] = $params['username'];
    $tc_params['password'] = $params['password'];
    $tc_params['demo'] = $params['testmode'] ? "y" : "n";
    $tc_params['transid'] = $params['transid'];
    $tc_params['amount'] = $params['amount'] * 100;
    $tc_result = tclink_send($tc_params);
    if ($tc_result['status'] == "approved" || $tc_result['status'] == "accepted") {
        $result = array("status" => "success", "transid" => $tc_result['transid'], "rawdata" => $tc_result);
    } else {
        if ($tc_result['status'] == "decline" || $tc_result['status'] == "rejected") {
            $result = array("status" => "declined", "rawdata" => $tc_result);
        } else {
            if ($tc_result['status'] == "baddata") {
                $result = array("status" => "baddata", "rawdata" => $tc_result);
            } else {
                $result = array("status" => "error", "rawdata" => $tc_result);
            }
        }
    }
    return $result;
}
コード例 #26
0
ファイル: PesiAPI.php プロジェクト: eliagbayani/maps_test
 private function save_data_to_text()
 {
     if (!extension_loaded('soap')) {
         dl("php_soap.dll");
     }
     $i = 0;
     if (!($f = Functions::file_open($this->TEMP_FILE_PATH . "/processed.txt", "a"))) {
         return;
     }
     foreach (new FileIterator($this->TEMP_FILE_PATH . "taxa.txt") as $line_number => $line) {
         $line = explode("\t", $line);
         $guid = $line[0];
         if ($result = self::access_pesi_service_with_retry($guid, 1)) {
             if (self::is_array_empty($result, 1)) {
                 echo "\n investigate guid no record: [{$guid}]\n";
                 continue;
             }
             $info = self::get_parent_taxon($result);
             $parent_taxa = $info["taxon"];
             $parent_rank = $info["rank"];
             if ($i % 100 == 0) {
                 echo "\n SOAP response: {$i}. {$result->scientificname} -- {$result->GUID} -- {$parent_taxa}";
             }
             $line = self::clean_str($result->GUID) . "\t" . self::clean_str($result->scientificname) . "\t" . self::clean_str($result->authority) . "\t" . self::clean_str($result->rank) . "\t" . self::clean_str($parent_taxa) . "\t" . self::clean_str($parent_rank) . "\t" . self::clean_str($result->citation) . "\n";
             fwrite($f, $line);
             $i++;
         } else {
             echo "\n investigate guid no record: [{$guid}]\n";
             continue;
         }
         // if($i >= 20) break; // debug - to limit during development
     }
     fclose($f);
     echo "\n\n total: {$i} \n\n";
 }
コード例 #27
0
ファイル: GD.php プロジェクト: Abuamany/concerto-platform
 /**
  * Get GD version
  * 
  * @return string|false
  */
 public static function getGDVer()
 {
     if (self::$_gdVer != null) {
         return self::$_gdVer;
     }
     $res = false;
     if (!extension_loaded('gd')) {
         if (dl('gd.so')) {
             $res = true;
         }
     } else {
         $res = true;
     }
     if ($res) {
         if (function_exists('gd_info')) {
             $gdInfo = gd_info();
             preg_match('/\\d/', $gdInfo['GD Version'], $match);
             self::$_gdVer = $match[0];
             if (self::$_gdVer >= 2) {
                 $res = self::$_gdVer;
             }
         } else {
             $res = false;
         }
     }
     return $res;
 }
コード例 #28
0
ファイル: defines.lib.php プロジェクト: quartemer/xoopserver
function PMA_dl($module)
{
    if (!isset($GLOBALS['PMA_dl_allowed'])) {
        if (!@ini_get('safe_mode') && @ini_get('enable_dl') && @function_exists('dl')) {
            ob_start();
            phpinfo(INFO_GENERAL);
            /* Only general info */
            $a = strip_tags(ob_get_contents());
            ob_end_clean();
            /* Get GD version string from phpinfo output */
            if (preg_match('@Thread Safety[[:space:]]*enabled@', $a)) {
                if (preg_match('@Server API[[:space:]]*\\(CGI\\|CLI\\)@', $a)) {
                    $GLOBALS['PMA_dl_allowed'] = TRUE;
                } else {
                    $GLOBALS['PMA_dl_allowed'] = FALSE;
                }
            } else {
                $GLOBALS['PMA_dl_allowed'] = TRUE;
            }
        } else {
            $GLOBALS['PMA_dl_allowed'] = FALSE;
        }
    }
    if (PMA_IS_WINDOWS) {
        $suffix = '.dll';
    } else {
        $suffix = '.so';
    }
    if ($GLOBALS['PMA_dl_allowed']) {
        return @dl($module . $suffix);
    } else {
        return FALSE;
    }
}
コード例 #29
0
ファイル: class.db.php プロジェクト: ngpestelos/tweetnest
 protected function connect()
 {
     switch ($this->type) {
         case "mysql":
             // Check for MySQLi
             $this->mysqli = extension_loaded("mysqli");
             if (!$this->mysqli) {
                 $prefix = PHP_SHLIB_SUFFIX === "dll" ? "php_" : "";
                 if (@dl($prefix . "mysqli." . PHP_SHLIB_SUFFIX)) {
                     $this->mysqli = extension_loaded("mysqli");
                 }
             }
             try {
                 $this->on = true;
                 $this->res = $this->mysqli ? new mysqli($this->config['hostname'], $this->config['username'], $this->config['password'], $this->config['database']) : mysql_connect($this->config['hostname'], $this->config['username'], $this->config['password']);
                 if (!$this->mysqli) {
                     mysql_select_db($this->config['database'], $this->res);
                 }
                 $this->conn = true;
                 if ($this->mysqli && $this->res->connect_error) {
                     $this->conn = false;
                     throw new Exception("Could not connect to the DB: " . $this->res->connect_error);
                 } else {
                     if (!$this->res) {
                         $this->conn = false;
                         throw new Exception("Could not connect to the DB: " . mysql_error($this->res));
                     }
                 }
             } catch (Exception $e) {
                 throw new Exception("Could not connect to the DB: " . $e->getMessage());
             }
             break;
     }
 }
コード例 #30
0
ファイル: GeoIP.php プロジェクト: nileshgr/utilities
 public function __construct(array $db, $IPMethod = 0)
 {
     $this->setMethod($IPMethod);
     $checkKeys = array('user', 'name', 'pass');
     foreach ($checkKeys as $k) {
         if (!isset($db["{$k}"])) {
             throw new Exception('Key: ' . $k . ' is not defined');
         }
         $this->_db["{$k}"] = $db["{$k}"];
     }
     $this->_db['constr'] = isset($db['socket']) ? ':' . $db['socket'] : $db['host'];
     if (empty($this->_db['constr'])) {
         throw new Exception('Host & Socket both were not defined');
     }
     if (!extension_loaded('mysql') and !(ini_get('enable_dl') == "1" and (dl('mysql.so') or dl('mysql.dll')))) {
         die("Please load mysql\n");
     }
     if (!($con = mysql_connect($this->_db['constr'], $this->_db['user'], $this->_db['pass']))) {
         throw new Exception('Could not connect to MySQL Server: ' . mysql_error($con));
     }
     if (!mysql_select_db($this->_db['name'], $con)) {
         throw new Exception('Could not select database: ' . mysql_error($con));
     }
     $this->_db['con'] = $con;
     return $this;
 }