Пример #1
0
 public function testAdapter()
 {
     $tar = false;
     $includePath = explode(PATH_SEPARATOR, get_include_path());
     foreach ($includePath as $path) {
         if (file_exists($path . DIRECTORY_SEPARATOR . 'Archive' . DIRECTORY_SEPARATOR . 'Tar.php')) {
             $tar = true;
         }
     }
     if ($tar) {
         $a = Archive::factory(__DIR__ . '/../tmp/test.tar');
         $this->assertInstanceOf('Pop\\Archive\\Adapter\\Tar', $a->adapter());
         $this->assertInstanceOf('Archive_Tar', $a->archive());
         $files = $a->listFiles();
         $files = $a->listFiles(true);
         $this->assertTrue(is_array($files));
         if (file_exists(__DIR__ . '/../tmp/test.tar')) {
             unlink(__DIR__ . '/../tmp/test.tar');
         }
     }
     if (class_exists('ZipArchive', false)) {
         $a = new Archive('test.zip');
         $this->assertInstanceOf('Pop\\Archive\\Adapter\\Zip', $a->adapter());
         $this->assertInstanceOf('ZipArchive', $a->archive());
     }
 }
Пример #2
0
 public function executeRequest($fileDirectory, $returnFileContents = false)
 {
     $message = "";
     if ($this->mode == "SEND") {
         print $fileDirectory;
         print realpath($fileDirectory);
         print get_include_path();
         $fileContents = file_get_contents($fileDirectory, FILE_USE_INCLUDE_PATH);
         $lastSlash = strrpos($fileDirectory, "/") + 1;
         $filename = substr($fileDirectory, $lastSlash, strlen($fileDirectory) - $lastSlash);
         print "Sending File: " . $filename . "\n";
         $message = "SEND " . $filename . " " . $fileContents;
         $this->manager->sendMessage($message);
         if ($returnFileContents) {
             return $fileContents;
         }
     }
     if ($this->mode == "GET") {
         print "Getting File Located In This Rel. Directory: " . $fileDirectory . "\n";
         $message = "GET " . $fileDirectory;
         $this->manager->sendMessage($message);
         $data = $this->manager->receiveMessage();
         print "Message Received";
         $lastSlash = strrpos($fileDirectory, "/");
         $filename = substr($fileDirectory, $lastSlash, strlen($fileDirectory) - $lastSlash);
         $fp = fopen("./tcpfiler/data/" . $filename, "w") or die("Unable to open file");
         fwrite($fp, $data);
         fclose($fp);
         //file_put_contents("./data/" . $filename, $data);
         if ($returnFileContents) {
             return $data;
         }
     }
 }
Пример #3
0
 public static function bootstrap()
 {
     $aimeos = self::getAimeos();
     $includepaths = $aimeos->getIncludePaths();
     $includepaths[] = get_include_path();
     set_include_path(implode(PATH_SEPARATOR, $includepaths));
 }
Пример #4
0
 public static function update($version, $backupBase)
 {
     if (!is_dir($backupBase)) {
         throw new \Exception("Backup directory {$backupBase} is not found");
     }
     set_include_path($backupBase . PATH_SEPARATOR . $backupBase . '/core/lib' . PATH_SEPARATOR . $backupBase . '/core/config' . PATH_SEPARATOR . $backupBase . '/3rdparty' . PATH_SEPARATOR . $backupBase . '/apps' . PATH_SEPARATOR . get_include_path());
     $tempDir = self::getTempDir();
     Helper::mkdir($tempDir, true);
     $installed = Helper::getDirectories();
     $sources = Helper::getSources($version);
     try {
         $thirdPartyUpdater = new Location_3rdparty($installed[Helper::THIRDPARTY_DIRNAME], $sources[Helper::THIRDPARTY_DIRNAME]);
         $thirdPartyUpdater->update($tempDir . '/' . Helper::THIRDPARTY_DIRNAME);
         self::$processed[] = $thirdPartyUpdater;
         $coreUpdater = new Location_Core($installed[Helper::CORE_DIRNAME], $sources[Helper::CORE_DIRNAME]);
         $coreUpdater->update($tempDir . '/' . Helper::CORE_DIRNAME);
         self::$processed[] = $coreUpdater;
         $appsUpdater = new Location_Apps('', $sources[Helper::APP_DIRNAME]);
         $appsUpdater->update($tempDir . '/' . Helper::APP_DIRNAME);
         self::$processed[] = $appsUpdater;
     } catch (\Exception $e) {
         self::rollBack();
         self::cleanUp();
         throw $e;
     }
     // zip backup
     $zip = new \ZipArchive();
     if ($zip->open($backupBase . ".zip", \ZIPARCHIVE::CREATE) === true) {
         Helper::addDirectoryToZip($zip, $backupBase, $backupBase);
         $zip->close();
         \OCP\Files::rmdirr($backupBase);
     }
     return true;
 }
Пример #5
0
 /**
  * getPath
  *
  * @access      public
  * @param       string      $tplFile    Template file to find
  * @return      string
  * @todo        Add include_path checking as a failsafe
  */
 public static function getPath($tplFile, $module = null, $template = null)
 {
     $sitePath = Framework::$site->getPath();
     $siteTplPath = $sitePath . '/Templates/';
     if (is_null($template)) {
         $template = Framework::$site->template;
     }
     $paths = array();
     $paths[] = $siteTplPath . $template . '/templates';
     if ($template != 'Default') {
         $paths[] = $siteTplPath . '/Default/templates';
     }
     if (!is_null($module)) {
         $paths[] = $sitePath . '/Framework/Module/' . $module . '/Templates/' . $template;
         $paths[] = FRAMEWORK_BASE_PATH . '/Framework/Module/' . $module . '/Templates/' . $template;
         $paths[] = FRAMEWORK_BASE_PATH . '/Framework/Module/' . $module . '/Templates/Default';
         $dirs = explode(PATH_SEPARATOR, get_include_path());
         foreach ($dirs as $dir) {
             $paths[] = $dir . '/Framework/Module/' . $module . '/Templates/' . $template;
         }
     }
     $paths = array_unique($paths);
     foreach ($paths as $path) {
         if (file_exists($path . '/' . $tplFile)) {
             return realpath($path);
         }
     }
 }
Пример #6
0
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInit0b6254f8262d899239feb70fb0c19f97', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInit0b6254f8262d899239feb70fb0c19f97', 'loadClassLoader'));
     $vendorDir = dirname(__DIR__);
     $baseDir = dirname($vendorDir);
     $includePaths = (require __DIR__ . '/include_paths.php');
     array_push($includePaths, get_include_path());
     set_include_path(join(PATH_SEPARATOR, $includePaths));
     $map = (require __DIR__ . '/autoload_namespaces.php');
     foreach ($map as $namespace => $path) {
         $loader->set($namespace, $path);
     }
     $map = (require __DIR__ . '/autoload_psr4.php');
     foreach ($map as $namespace => $path) {
         $loader->setPsr4($namespace, $path);
     }
     $classMap = (require __DIR__ . '/autoload_classmap.php');
     if ($classMap) {
         $loader->addClassMap($classMap);
     }
     $loader->register(true);
     return $loader;
 }
 /**
  * set up test environment
  */
 public function setUp()
 {
     $this->backupIncludePath = get_include_path();
     vfsStream::setup();
     mkdir('vfs://root/a/path', 0777, true);
     set_include_path('vfs://root/a' . PATH_SEPARATOR . $this->backupIncludePath);
 }
 private function setIncludePath()
 {
     if (!$this->doneIncludePath) {
         set_include_path(get_include_path() . PATH_SEPARATOR . plugin_dir_path(__FILE__));
         $this->doneIncludePath = true;
     }
 }
Пример #9
0
 public function testAddIncludePath()
 {
     $fixture = uniqid();
     $this->assertNotContains($fixture, get_include_path());
     Magento_Autoload_IncludePath::addIncludePath(array($fixture), true);
     $this->assertStringEndsWith(PATH_SEPARATOR . $fixture, get_include_path());
 }
Пример #10
0
 /**
  * set up the core ,trip some events, etcetera.
  */
 function core()
 {
     $this->events = new events();
     //where will we be including from?...
     ini_set('include_path', ROOT . PATH_SEPARATOR . get_include_path());
     $GLOBALS['core'] =& $this;
     //make sure everyone else can use this core
     //load first-order php configs. these are expected to only have define()s
     $this->loadFiles('config', 'php');
     //core libs assume nothing. they may be required for core classes, so load them first.
     $this->loadFiles('libs' . DIRECTORY_SEPARATOR . 'core', 'php');
     $this->loadCoreClasses();
     $this->loadFiles('libs', 'php');
     //load the regular libs
     /**
      * @global array $GLOBALS['config'] config container. accessed via  cf()_
      * @see cf() 
      */
     $GLOBALS['config'] = array();
     $this->yaml = new YAML();
     $this->loadFiles('config', 'yaml');
     $this->discoverTemplates();
     //any classes with events I need to be aware of?
     $this->loadClassesWithEvents();
     $this->event('configLoaded');
     $this->loadPlugins();
     $this->event('sessionStart');
     //now that all classes are loaded, we can start the session
     session_start();
     $this->event('initializeGlobalClasses');
     $this->event('dependenciesLoaded');
     $this->event('route');
     $this->event('theEnd');
 }
Пример #11
0
 /**
  * Constructs a new pear style resolver instance.
  */
 public function __construct()
 {
     $paths = explode(PATH_SEPARATOR, get_include_path());
     foreach ($paths as $path) {
         $this->_paths[] = realpath($path);
     }
 }
Пример #12
0
 function __construct()
 {
     //$dir = getcwd();
     //$path = $dir."/PEAR";
     $path = dirname(__FILE__) . "/PEAR";
     set_include_path(get_include_path() . PATH_SEPARATOR . $path);
     $inc_path = get_include_path();
     chdir(dirname(__FILE__));
     date_default_timezone_set("Asia/Tokyo");
     require_once "setting.php";
     $this->_screen_name = $screen_name;
     $this->_consumer_key = $consumer_key;
     $this->_consumer_secret = $consumer_secret;
     $this->_access_token = $access_token;
     $this->_access_token_secret = $access_token_secret;
     $this->_replyLoopLimit = $replyLoopLimit;
     $this->_footer = $footer;
     $this->_dataSeparator = $dataSeparator;
     $this->_logDataFile = "log.dat";
     $this->_log = json_decode(file_get_contents($this->_logDataFile), true);
     $this->_latestReply = $this->_log["latest_reply"];
     $this->_latestReplyTimeline = $this->_log["latest_reply_tl"];
     require_once "HTTP/OAuth/Consumer.php";
     $this->OAuth_Consumer_build();
     $this->printHeader();
 }
 /**
  * Get the possible include paths
  * @return array
  */
 protected function _includePaths()
 {
     $split = strstr(PHP_OS, 'win') ? ';' : ':';
     $paths = array_flip(array_merge(explode($split, get_include_path()), array(CAKE)));
     unset($paths['.']);
     return array_flip($paths);
 }
Пример #14
0
 public function execute()
 {
     global $IP;
     # Make sure we have --configuration or PHPUnit might complain
     if (!in_array('--configuration', $_SERVER['argv'])) {
         //Hack to eliminate the need to use the Makefile (which sucks ATM)
         array_splice($_SERVER['argv'], 1, 0, array('--configuration', $IP . '/tests/phpunit/suite.xml'));
     }
     # --with-phpunitdir let us override the default PHPUnit version
     if ($phpunitDir = $this->getOption('with-phpunitdir')) {
         # Sanity checks
         if (!is_dir($phpunitDir)) {
             $this->error("--with-phpunitdir should be set to an existing directory", 1);
         }
         if (!is_readable($phpunitDir . "/PHPUnit/Runner/Version.php")) {
             $this->error("No usable PHPUnit installation in {$phpunitDir}.\nAborting.\n", 1);
         }
         # Now prepends provided PHPUnit directory
         $this->output("Will attempt loading PHPUnit from `{$phpunitDir}`\n");
         set_include_path($phpunitDir . PATH_SEPARATOR . get_include_path());
         # Cleanup $args array so the option and its value do not
         # pollute PHPUnit
         $key = array_search('--with-phpunitdir', $_SERVER['argv']);
         unset($_SERVER['argv'][$key]);
         // the option
         unset($_SERVER['argv'][$key + 1]);
         // its value
         $_SERVER['argv'] = array_values($_SERVER['argv']);
     }
 }
Пример #15
0
 /**
  * @static
  * @param  $filename
  * @return bool
  */
 public static function isIncludeable($filename)
 {
     if (array_key_exists($filename, self::$isIncludeableCache)) {
         return self::$isIncludeableCache[$filename];
     }
     $isIncludeAble = false;
     // use stream_resolve_include_path if PHP is >= 5.3.2 because the performance is better
     if (function_exists("stream_resolve_include_path")) {
         if ($include = stream_resolve_include_path($filename)) {
             if (@is_readable($include)) {
                 $isIncludeAble = true;
             }
         }
     } else {
         // this is the fallback for PHP < 5.3.2
         $include_paths = explode(PATH_SEPARATOR, get_include_path());
         foreach ($include_paths as $path) {
             $include = $path . DIRECTORY_SEPARATOR . $filename;
             if (@is_file($include) && @is_readable($include)) {
                 $isIncludeAble = true;
                 break;
             }
         }
     }
     // add to store
     self::$isIncludeableCache[$filename] = $isIncludeAble;
     return $isIncludeAble;
 }
Пример #16
0
 /**
  * Construct a request handler for candidate instrument data
  * @param string  $method     The HTTP method to be handled
  * @param string  $CandID     The CandID this API call is for
  * @param string  $Visit      The Visit this API call is for
  * @param string  $Instrument The instrument this API call is for
  * @param boolean $bDDE       If true, handle DDE instrument instead of
  *                            normal instrument data
  * @param boolean $bFlags     If true, include instrument flag data in
  *                            serialization
  */
 public function __construct($method, $CandID, $Visit, $Instrument, $bDDE, $bFlags)
 {
     if (empty($this->AllowedMethods)) {
         $this->AllowedMethods = ['GET', 'PUT', 'PATCH', 'OPTIONS'];
     }
     $this->AutoHandleRequestDelegation = false;
     $this->bDDE = $bDDE;
     $this->bFlags = $bFlags;
     parent::__construct($method, $CandID, $Visit);
     // instruments may need access to project libraries
     set_include_path(get_include_path() . ":" . __DIR__ . "/../../../../project/libraries");
     include_once "NDB_BVL_Instrument.class.inc";
     $CommentID = $this->DB->pselectOne("SELECT CommentID FROM flag f\n                LEFT JOIN session s ON (s.ID=f.SessionID AND s.Visit_label=:VL)\n                LEFT JOIN candidate c USING (CandID)\n            WHERE Test_name=:TN AND s.CandID=:CID AND\n                  s.Active='Y' AND c.Active='Y' AND f.CommentID NOT LIKE 'DDE%'", array('VL' => $this->VisitLabel, 'TN' => $Instrument, 'CID' => $this->CandID));
     if (empty($CommentID)) {
         $this->header("HTTP/1.1 404 Not Found");
         $this->error("Invalid instrument for candidate");
         $this->safeExit(0);
     }
     if ($this->bDDE) {
         $CommentID = 'DDE_' . $CommentID;
     }
     try {
         $this->Instrument = \NDB_BVL_Instrument::factory($Instrument, $CommentID, null, true);
     } catch (Exception $e) {
         $this->header("HTTP/1.1 404 Not Found");
         $this->error("Invalid instrument");
         $this->safeExit(0);
     }
     $this->handleRequest();
 }
Пример #17
0
function wpcb_update()
{
    $wp_version_required = "3.0";
    global $wp_version;
    $plugin = plugin_basename(__FILE__);
    $plugin_data = get_plugin_data(__FILE__, false);
    if (version_compare($wp_version, $wp_version_required, "<")) {
        if (is_plugin_active($plugin)) {
            deactivate_plugins($plugin);
            wp_die("'" . $plugin_data['Name'] . "' requires WordPress " . $wp_version_required . " or higher, and has been deactivated! Please upgrade WordPress and try again.<br /><br />Back to <a href='" . admin_url() . "'>WordPress admin</a>.");
        }
    }
    // Check if it is a plugin update :
    $wpcb_dev = get_option('wpcb_dev');
    if (version_compare($wpcb_dev['version'], $plugin_data['Version'], "<")) {
        wpcb_activate();
        // So that the 2 files atos.merchant.php  are copied again
    }
    // if the ZF plugin is successfully loaded this constant is set to true
    if (defined('WP_ZEND_FRAMEWORK') && constant('WP_ZEND_FRAMEWORK')) {
        return true;
    }
    // you can also check if ZF is available on the system
    $paths = explode(PATH_SEPARATOR, get_include_path());
    foreach ($paths as $path) {
        if (file_exists("{$path}/Zend/Loader.php")) {
            define('WP_ZEND_FRAMEWORK', true);
            return true;
        }
    }
    // nothing found, you may advice the user to install the ZF plugin
    define('WP_ZEND_FRAMEWORK', false);
}
Пример #18
0
 /**
  * Bootstrap code for Horde PEAR packages.
  *
  * @param string $dir           Base directory of tests.
  * @param boolean $no_autoload  Don't run default Horde_Test autoload
  *                              tasks.
  */
 public static function bootstrap($dir, $no_autoload = false)
 {
     if (self::$_runonce) {
         return;
     }
     if (!$no_autoload) {
         // Catch strict standards
         error_reporting(E_ALL | E_STRICT);
         // Set up autoload
         $base = $dir;
         while ($base != '/' && basename($base) != 'Horde') {
             $base = dirname($base);
         }
         $base = dirname($base);
         if ($base) {
             set_include_path($base . PATH_SEPARATOR . $base . '/../lib' . PATH_SEPARATOR . get_include_path());
         }
         require_once 'Horde/Test/Autoload.php';
         Horde_Test_Autoload::init();
     }
     if (file_exists($dir . '/Autoload.php')) {
         require_once $dir . '/Autoload.php';
     }
     self::$_runonce = true;
 }
Пример #19
0
 /**
  * Autoloads symfony
  * Note: This is not compatible with ->bootstrap()
  * Code adopted from command/sfSymfonyCommandApplication.class.php
  */
 public function autoload()
 {
     if ($this->autoload) {
         return;
     }
     $this->autoload = 'simple';
     require_once $this->sf_lib_dir . '/util/sfCore.class.php';
     require_once $this->sf_lib_dir . '/config/sfConfig.class.php';
     require_once $this->sf_lib_dir . '/util/sfSimpleAutoload.class.php';
     require_once $this->sf_lib_dir . '/util/sfToolkit.class.php';
     require_once $this->sf_lib_dir . '/util/sfFinder.class.php';
     sfConfig::add(array('sf_symfony_lib_dir' => $this->sf_lib_dir, 'sf_symfony_data_dir' => $this->sf_lib_dir));
     // directory layout
     sfCore::initDirectoryLayout($this->sf_lib_dir);
     // include path
     set_include_path(sfConfig::get('sf_lib_dir') . PATH_SEPARATOR . sfConfig::get('sf_app_lib_dir') . PATH_SEPARATOR . sfConfig::get('sf_model_dir') . PATH_SEPARATOR . get_include_path());
     $cache = sfToolkit::getTmpDir() . DIRECTORY_SEPARATOR . sprintf('limeade_autoload_%s.data', md5(__FILE__));
     $autoloader = sfSimpleAutoload::getInstance($cache);
     $autoloader->register();
     $finder = sfFinder::type('file')->ignore_version_control()->prune('test')->prune('vendor')->name('*.php');
     $autoloader->addFiles($finder->in(sfConfig::get('sf_symfony_lib_dir')));
     $autoloader->addFiles($finder->in($this->project_root));
     $autoloader->addDirectory(sfConfig::get('sf_root_dir') . '/plugins');
     return $this;
 }
Пример #20
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);
     }
 }
Пример #21
0
 function init()
 {
     //mantisgraph_autoload();
     spl_autoload_register(array('MantisGraphPlugin', 'autoload'));
     $t_path = config_get_global('plugin_path') . plugin_get_current() . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR;
     set_include_path(get_include_path() . PATH_SEPARATOR . $t_path);
 }
Пример #22
0
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInitc1979ea69b1d8f4059205f2b1ddf2ab9', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInitc1979ea69b1d8f4059205f2b1ddf2ab9', 'loadClassLoader'));
     $includePaths = (require __DIR__ . '/include_paths.php');
     array_push($includePaths, get_include_path());
     set_include_path(join(PATH_SEPARATOR, $includePaths));
     $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
     if ($useStaticLoader) {
         require_once __DIR__ . '/autoload_static.php';
         call_user_func(\Composer\Autoload\ComposerStaticInitc1979ea69b1d8f4059205f2b1ddf2ab9::getInitializer($loader));
     } else {
         $map = (require __DIR__ . '/autoload_namespaces.php');
         foreach ($map as $namespace => $path) {
             $loader->set($namespace, $path);
         }
         $map = (require __DIR__ . '/autoload_psr4.php');
         foreach ($map as $namespace => $path) {
             $loader->setPsr4($namespace, $path);
         }
         $classMap = (require __DIR__ . '/autoload_classmap.php');
         if ($classMap) {
             $loader->addClassMap($classMap);
         }
     }
     $loader->register(true);
     return $loader;
 }
Пример #23
0
 /**
  */
 public function __construct()
 {
     $paths = array_map('realpath', array_diff(array_unique(explode(PATH_SEPARATOR, get_include_path())), array('.')));
     foreach (array_reverse($paths) as $path) {
         $this->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Default($path));
     }
 }
Пример #24
0
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInit1eb5cffb2cab52b785cc53528b1e13a2', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInit1eb5cffb2cab52b785cc53528b1e13a2', 'loadClassLoader'));
     $includePaths = (require __DIR__ . '/include_paths.php');
     array_push($includePaths, get_include_path());
     set_include_path(join(PATH_SEPARATOR, $includePaths));
     $map = (require __DIR__ . '/autoload_namespaces.php');
     foreach ($map as $namespace => $path) {
         $loader->set($namespace, $path);
     }
     $map = (require __DIR__ . '/autoload_psr4.php');
     foreach ($map as $namespace => $path) {
         $loader->setPsr4($namespace, $path);
     }
     $classMap = (require __DIR__ . '/autoload_classmap.php');
     if ($classMap) {
         $loader->addClassMap($classMap);
     }
     $loader->register(true);
     return $loader;
 }
Пример #25
0
 /**
  * Convert the array of paths into a string with path separators. The i
  * action parameter is used to determine how to deal with the original 
  * include path. should we append, prepend, or replace it
  * 
  * @param   mixed   $paths
  * @param   string  $action     how to deal with the original path
  * @return  NULL    
  */
 public function setPath($paths, $action = 'replace')
 {
     /* a single path was passed in */
     if (is_string($paths) && !empty($paths)) {
         $pathString = $paths;
     } else {
         if (is_array($paths) && !empty($paths)) {
             $pathString = implode(PATH_SEPARATOR, $paths);
         } else {
             return FALSE;
         }
     }
     /*
      * The default action is to replace the include path. If
      * action is given with either append or prepend the 
      * paths will be concatenated accordingly
      */
     $includePath = get_include_path();
     if ('append' === $action) {
         $pathString = $includePath . PATH_SEPARATOR . $pathString;
     } else {
         if ('prepend' === $action) {
             $pathString .= PATH_SEPARATOR . $includePath;
         }
     }
     return set_include_path($pathString);
 }
Пример #26
0
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInit46390df264f3e25339b844dea17d85e4', 'loadClassLoader'));
     $includePaths = (require __DIR__ . '/include_paths.php');
     array_push($includePaths, get_include_path());
     set_include_path(join(PATH_SEPARATOR, $includePaths));
     $map = (require __DIR__ . '/autoload_namespaces.php');
     foreach ($map as $namespace => $path) {
         $loader->set($namespace, $path);
     }
     $map = (require __DIR__ . '/autoload_psr4.php');
     foreach ($map as $namespace => $path) {
         $loader->setPsr4($namespace, $path);
     }
     $classMap = (require __DIR__ . '/autoload_classmap.php');
     if ($classMap) {
         $loader->addClassMap($classMap);
     }
     $loader->register(true);
     $includeFiles = (require __DIR__ . '/autoload_files.php');
     foreach ($includeFiles as $file) {
         composerRequire46390df264f3e25339b844dea17d85e4($file);
     }
     return $loader;
 }
Пример #27
0
 public function __construct(&$manager)
 {
     $this->_manager = $manager;
     set_include_path(Zend_Registry::get('config')->login->module->wp->wpPath . PATH_SEPARATOR . get_include_path());
     global $wpdb;
     @(require_once 'wp-config.php');
 }
 public static function getLoader()
 {
     if (null !== self::$loader) {
         return self::$loader;
     }
     spl_autoload_register(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader'), true, true);
     self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     spl_autoload_unregister(array('ComposerAutoloaderInit0ff06a20d13931ad3d71bf10770c91f3', 'loadClassLoader'));
     $vendorDir = dirname(__DIR__);
     $baseDir = dirname($vendorDir);
     $includePaths = (require __DIR__ . '/include_paths.php');
     array_push($includePaths, get_include_path());
     set_include_path(join(PATH_SEPARATOR, $includePaths));
     $map = (require __DIR__ . '/autoload_namespaces.php');
     foreach ($map as $namespace => $path) {
         $loader->set($namespace, $path);
     }
     $map = (require __DIR__ . '/autoload_psr4.php');
     foreach ($map as $namespace => $path) {
         $loader->setPsr4($namespace, $path);
     }
     $classMap = (require __DIR__ . '/autoload_classmap.php');
     if ($classMap) {
         $loader->addClassMap($classMap);
     }
     $loader->register(true);
     $includeFiles = (require __DIR__ . '/autoload_files.php');
     foreach ($includeFiles as $file) {
         composerRequire0ff06a20d13931ad3d71bf10770c91f3($file);
     }
     return $loader;
 }
 function insertarExcel($array)
 {
     $uploadOk = 1;
     $time = time();
     $fecha = date("Y-m-d", $time);
     $target_dir = "../documents/";
     $target_file = $target_dir . basename($_FILES["archivoExcel"]["name"]);
     move_uploaded_file($array["archivoExcel"]["tmp_name"], $target_file);
     set_include_path(get_include_path() . PATH_SEPARATOR . '../complements/PHPExcel-1.8/Classes/');
     $inputFileType = 'Excel2007';
     include 'PHPExcel/IOFactory.php';
     $inputFileName = $target_file;
     $objReader = PHPExcel_IOFactory::createReader($inputFileType);
     $objReader->setReadDataOnly(true);
     $objPHPExcel = $objReader->load($inputFileName);
     $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
     require_once "../db/conexiones.php";
     $consulta = new Conexion();
     foreach ($sheetData as $datos) {
         $nombreSinAcentos = sanear_string($datos['B']);
         $nombre = strtoupper(trim($nombreSinAcentos));
         $datosEmpleado = $consulta->Conectar("postgres", "SELECT * FROM userinfo WHERE UPPER(name)='" . $nombre . "'");
         if ($datosEmpleado) {
             $sqlInsert = $this->invoco->Conectar("postgres", "INSERT INTO horario_personal (user_id, banda_id, fecha) VALUES (" . $datosEmpleado[0]['userid'] . "," . $datos['C'] . ", '" . $fecha . "')");
         }
     }
     return "Se insertaron los datos Exitosamente!";
 }
Пример #30
-1
 public static function initConfig()
 {
     //Include Path
     set_include_path(get_include_path() . PATH_SEPARATOR . Constants::liteFrameDir . PATH_SEPARATOR . Constants::appDir);
     //AutoLoad
     require_once '../autoload.php';
 }