コード例 #1
0
ファイル: VersionTest.php プロジェクト: travisj/zf
 /**
  * Tests that version_compare() and its "proxy"
  * Zend_Version::compareVersion() work as expected.
  */
 public function testVersionCompare()
 {
     $expect = -1;
     // unit test breaks if ZF version > 1.x
     for ($i = 0; $i <= 1; $i++) {
         for ($j = 0; $j < 12; $j++) {
             for ($k = 0; $k < 20; $k++) {
                 foreach (array('dev', 'pr', 'PR', 'alpha', 'a1', 'a2', 'beta', 'b1', 'b2', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl1', 'PL1') as $rel) {
                     $ver = "{$i}.{$j}.{$k}{$rel}";
                     $normalizedVersion = strtolower(Zend_Version::VERSION);
                     if (strtolower($ver) === $normalizedVersion || strtolower("{$i}.{$j}.{$k}-{$rel}") === $normalizedVersion || strtolower("{$i}.{$j}.{$k}.{$rel}") === $normalizedVersion || strtolower("{$i}.{$j}.{$k} {$rel}") === $normalizedVersion) {
                         if ($expect == -1) {
                             $expect = 1;
                         }
                     } else {
                         $this->assertSame(Zend_Version::compareVersion($ver), $expect, "For version '{$ver}' and Zend_Version::VERSION = '" . Zend_Version::VERSION . "': result=" . Zend_Version::compareVersion($ver) . ', but expected ' . $expect);
                     }
                 }
             }
         }
     }
     if ($expect === -1) {
         $this->fail('Unable to recognize Zend_Version::VERSION (' . Zend_Version::VERSION . '); last version compared: ' . $ver);
     }
 }
コード例 #2
0
ファイル: Table.php プロジェクト: html/PI
 public function __call($function, $args)
 {
     $re = '/(' . join('|', array_keys(array_map('preg_quote', $this->_queryTypes))) . ')(.+?)(?:By(.+))*$/';
     if (preg_match($re, $function, $matches)) {
         $queryType = $matches[1];
         if (isset($this->_queryTypes[$queryType])) {
             $temp = str_split($matches[2]);
             $temp[0] = strtolower($temp[0]);
             $method_names = array('_' . $queryType . $matches[2] . 'Query', '_' . join($temp) . 'Query');
             $queryMethod = $this->_queryTypes[$queryType];
             if (isset($matches[3])) {
                 array_unshift($method_names, '_' . $queryType . $matches[2] . 'ByQuery');
                 if (Zend_Version::compareVersion('1.7.9') < 0) {
                     $filter = new Zend_Filter_Word_CamelCaseToUnderscore();
                     $field = strtolower($filter->filter($matches[3]));
                 } else {
                     $field = strtolower(Zend_Filter::filterStatic($matches[3], 'Word_CamelCaseToUnderscore'));
                 }
                 array_unshift($args, $field);
             }
             foreach ($method_names as $method) {
                 if (method_exists($this, $method)) {
                     $sql = call_user_func_array(array($this, $method), $args);
                     return $this->{$queryMethod}($sql);
                     break;
                 }
             }
             die("Cannot find proper query method for function <b>" . $function . "</b> of class " . get_class($this));
         }
     }
     de('Table.php: ', $function, $args);
     return parent::__call($function, $args);
 }
コード例 #3
0
ファイル: PhpZend.php プロジェクト: JerryCR/php-2
 /**
  * Performs the test.
  *
  * @return \Jyxo\Beholder\Result
  */
 public function run()
 {
     // Zend Framework availability
     if (!class_exists('\\Zend_Version')) {
         return new \Jyxo\Beholder\Result(\Jyxo\Beholder\Result::FAILURE, 'Zend framework missing');
     }
     $result = \Jyxo\Beholder\Result::SUCCESS;
     // Version comparison if requested
     if (!empty($this->version)) {
         $comparison = \Zend_Version::compareVersion($this->version);
         switch ($this->comparison) {
             case '<':
                 $result = $comparison > 0 ? \Jyxo\Beholder\Result::SUCCESS : \Jyxo\Beholder\Result::FAILURE;
                 break;
             case '<=':
                 $result = $comparison >= 0 ? \Jyxo\Beholder\Result::SUCCESS : \Jyxo\Beholder\Result::FAILURE;
                 break;
             case '>=':
                 $result = $comparison <= 0 ? \Jyxo\Beholder\Result::SUCCESS : \Jyxo\Beholder\Result::FAILURE;
                 break;
             case '>':
                 $result = $comparison < 0 ? \Jyxo\Beholder\Result::SUCCESS : \Jyxo\Beholder\Result::FAILURE;
                 break;
             default:
                 $this->comparison = '=';
                 $result = $comparison === 0 ? \Jyxo\Beholder\Result::SUCCESS : \Jyxo\Beholder\Result::FAILURE;
                 break;
         }
         return new \Jyxo\Beholder\Result($result, sprintf('Version %s, expected %s %s', \Zend_Version::VERSION, $this->comparison, $this->version));
     }
     // OK
     return new \Jyxo\Beholder\Result($result, sprintf('Version %s', \Zend_Version::VERSION));
 }
コード例 #4
0
    /**
     * Tests that version_compare() and its "proxy"
     * Zend_Version::compareVersion() work as expected.
     */
    public function testVersionCompare()
    {
        $expect = -1;
        // unit test breaks if ZF version > 1.x
        for ($i=0; $i <= 1; $i++) {
            for ($j=0; $j < 10; $j++) {
                for ($k=0; $k < 20; $k++) {
                    foreach (array('dev', 'alpha', 'beta', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl') as $rel) {
                        $ver = "$i.$j.$k$rel";
                        if ($ver === Zend_Version::VERSION
                            || "$i.$j.$k-$rel" === Zend_Version::VERSION
                            || "$i.$j.$k.$rel" === Zend_Version::VERSION
                            || "$i.$j.$k $rel" === Zend_Version::VERSION) {

                            if ($expect != -1) {
                                $this->fail("Unexpected double match for Zend_Version::VERSION ("
                                    . Zend_Version::VERSION . ")");
                            }
                            else {
                                $expect = 1;
                            }
                        } else {
                            $this->assertSame(Zend_Version::compareVersion($ver), $expect,
                                "For version '$ver' and Zend_Version::VERSION = '"
                                . Zend_Version::VERSION . "': result=" . (Zend_Version::compareVersion($ver))
                                . ', but expected ' . $expect);
                        }
                    }
                }
            }
        }
        if ($expect === -1) {
            $this->fail('Unable to recognize Zend_Version::VERSION ('. Zend_Version::VERSION . ')');
        }
    }
コード例 #5
0
 /**
  * @group ZF-10363
  */
 public function testFetchLatestVersion()
 {
     $actual = Zend_Version::getLatest();
     if ('not available' === $actual) {
         $this->markTestIncomplete('http://framework.zend.com/ may be down');
     }
     $this->assertRegExp('/^[1-2](\\.[0-9]+){2}/', $actual);
 }
コード例 #6
0
 /**
  * (non-PHPdoc)
  * @see ObjectStorage_Http_Adapter_Interface::setFileHandler()
  */
 public function setFileHandler($handler)
 {
     $requiredVersion = '1.10';
     if (Zend_Version::compareVersion($requiredVersion) >= 1) {
         throw new ObjectStorage_Exception('Zend HTTP clien\'s data streaming upload requires Zend framework version ' . $requiredVersion . ' or greater.');
     }
     $this->client->setRawData($handler);
 }
コード例 #7
0
ファイル: Version.php プロジェクト: rlecellier/basezf
 /**
  * Compare the specified Zend Framework version string $version
  */
 public static function checkZendVersion($version = null)
 {
     // check required version of Zend Framwork
     if (!is_null($version) && Zend_Version::compareVersion($version) > 0) {
         throw new BaseZF_Exception(sprintf('Please upgrade to a newer version of Zend Framework (%s require by Application)', $version));
     }
     // check basezf required version of Zend Framwork
     if (Zend_Version::compareVersion(self::ZF_VERSION) > 0) {
         throw new BaseZF_Exception(sprintf('Please upgrade to a newer version of Zend Framework (%s require by BaseZF Framework)', $version));
     }
 }
コード例 #8
0
ファイル: util.php プロジェクト: openbizx/openbizx-cubix
function getSystemStatus()
{
    $status[0]['item'] = STR_OPERATION_SYSTEM;
    $status[0]['value'] = PHP_OS;
    $status[0]['status'] = 'OK';
    $status[1]['item'] = STR_PHP_VERSION;
    $status[1]['value'] = PHP_VERSION;
    $status[1]['status'] = version_compare(PHP_VERSION, "5.1.4") >= 0 ? 'OK' : STR_PHP_VERSION_FAIL;
    $status[2]['item'] = STR_OPENBIZ_PATH;
    $status[2]['value'] = OPENBIZ_PATH;
    $status[2]['status'] = "OK";
    if (!file_exists(OPENBIZ_PATH)) {
        $status[2]['status'] = STR_OPENBIZ_PATH_FAIL;
    }
    $status[3]['item'] = STR_ZEND_PATH;
    $status[3]['value'] = defined('ZEND_FRWK_HOME') ? ZEND_FRWK_HOME : 'Undefined';
    if (defined('ZEND_FRWK_HOME') && !file_exists(ZEND_FRWK_HOME)) {
        $status[3]['status'] = STR_ZEND_PATH_FAIL;
    } else {
        if (defined('ZEND_FRWK_HOME') && file_exists(ZEND_FRWK_HOME)) {
            require_once 'Zend/Version.php';
            $status[3]['status'] = Zend_Version::compareVersion('1.0.0') < 0 ? 'OK - Version 1.0.0 or later is recommended' : 'FAIL';
        } else {
            $status[3]['status'] = 'FAIL';
        }
    }
    /*if ($status[3]['status'] == 'OK')  {
    		require_once 'Zend/Version.php';
    		$status[4]['item'] = 'Zend Framework';
    		$status[4]['value'] = Zend_Version::VERSION;
    		$status[4]['status'] = Zend_Version::compareVersion('1.0.0') < 0 ? 'OK - Version 1.0.0 or later is recommended' : 'FAIL';
    	}*/
    $status[5]['item'] = STR_PDO_EXTENSION;
    $pdos = array();
    if (extension_loaded('pdo')) {
        $pdos[] = "pdo";
    }
    if (extension_loaded('pdo_mysql')) {
        $pdos[] = "pdo_mysql";
    }
    if (extension_loaded('pdo_mssql')) {
        $pdos[] = "pdo_mssql";
    }
    if (extension_loaded('pdo_oci')) {
        $pdos[] = "pdo_oci";
    }
    if (extension_loaded('pdo_pgsql')) {
        $pdos[] = "pdo_pgsql";
    }
    $status[5]['value'] = implode(", ", $pdos);
    $status[5]['status'] = $pdos[0] == 'pdo' && $pdos[1] == 'pdo_mysql' ? 'OK' : STR_PDO_EXTENSION_FAIL;
    //$status[5]['status'] = ($pdos[0]=='pdo') ? 'OK' : STR_PDO_EXTENSION_FAIL;
    return $status;
}
コード例 #9
0
ファイル: Version.php プロジェクト: bcsgarcia/LojaTeste
 /**
  * Fetches the version of the latest stable release
  *
  * @link http://framework.zend.com/download/latest
  * @return string
  */
 public static function getLatest()
 {
     if (null === self::$_latestVersion) {
         self::$_latestVersion = 'not available';
         $handle = fopen('http://framework.zend.com/api/zf-version', 'r');
         if (false !== $handle) {
             self::$_latestVersion = stream_get_contents($handle);
             fclose($handle);
         }
     }
     return self::$_latestVersion;
 }
コード例 #10
0
ファイル: VersionTest.php プロジェクト: jsnshrmn/Suma
 /**
  * @group ZF-10363
  */
 public function testFetchLatestVersion()
 {
     if (!defined('TESTS_ZEND_VERSION_ONLINE_ENABLED') || !constant('TESTS_ZEND_VERSION_ONLINE_ENABLED')) {
         $this->markTestSkipped('Testing fetchLatersVersion only works when TESTS_ZEND_VERSION_ONLINE_ENABLED is set.');
         return;
     }
     $actual = Zend_Version::getLatest();
     if ('not available' === $actual) {
         $this->markTestIncomplete('http://framework.zend.com/ may be down');
     }
     $this->assertRegExp('/^[1-2](\\.[0-9]+){2}/', $actual);
 }
コード例 #11
0
ファイル: Installer.php プロジェクト: rswilli2/Mobile-Website
 public function checkZendFramework()
 {
     if (!is_dir('../inc/Zend')) {
         return 'Zend Framework library not found in /inc/Zend';
     }
     require_once '../inc/Zend/Version.php';
     $versionCompare = Zend_Version::compareVersion(self::ZF_REQUIREMENT);
     if ($versionCompare == 1) {
         return 'Zend Framework library you are using is older than the recommended version of ' . self::ZF_REQUIREMENT;
     } elseif ($versionCompare == -1) {
         return 'Zend Framework library you are using is newer than the recommended version of ' . self::ZF_REQUIREMENT;
     }
     return true;
 }
コード例 #12
0
ファイル: Logging.php プロジェクト: nidzix/Airtime
 public static function getLogger()
 {
     if (!isset(self::$_logger)) {
         $writer = new Zend_Log_Writer_Stream(self::$_path);
         if (Zend_Version::compareVersion("1.11") > 0) {
             //Running Zend version 1.10 or lower. Need to instantiate our
             //own Zend Log class with backported code from 1.11.
             require_once __DIR__ . "/AirtimeLog.php";
             self::$_logger = new Airtime_Zend_Log($writer);
         } else {
             self::$_logger = new Zend_Log($writer);
         }
         self::$_logger->registerErrorHandler();
     }
     return self::$_logger;
 }
コード例 #13
0
ファイル: Fpc.php プロジェクト: AndreKlang/Lesti_Fpc
 public function __construct()
 {
     /*
      * If the version of Zend Framework is older than 1.12, fallback to the
      * legacy cache settings.
      * See http://framework.zend.com/issues/browse/ZF-12047
      */
     if (Zend_Version::compareVersion('1.12.0') > 0) {
         $this->_defaultBackendOptions = $this->_legacyDefaultBackendOptions;
     }
     $node = Mage::getConfig()->getNode('global/fpc');
     $options = array();
     if ($node) {
         $options = $node->asArray();
     }
     parent::__construct($options);
 }
コード例 #14
0
ファイル: callbacks.php プロジェクト: br00k/tnc-web
    function zend_check($params = array())
    {
        //echo "asdfas"; var_dump($params);
        if (isset($params['location'])) {
            if (!@(include_once $params['location'] . '/Zend/Version.php')) {
                $this->error = 'Zend Framework not found in ' . $params['location'];
                return false;
            }
            if (Zend_Version::compareVersion($params['version']) == '1') {
                $this->error = 'Zend Framework found, but version ' . Zend_Version::VERSION . ' is too old.<br />
					Need at least version ' . $params['version'] . '.';
                return false;
            }
        }
        // Version equal or greater than what we want, good!
        return true;
    }
コード例 #15
0
ファイル: index.php プロジェクト: jorgenils/zend-framework
function bootstrap()
{
    require 'Zend/Version.php';
    if (Zend_Version::compareVersion('0.9.0') > 0) {
        echo "Please upgrade to a newer version of ZF for this demo.\n";
    }
    // STAGE 1. Prepare the front (primary) controller.
    require 'Zend/Controller/Front.php';
    $frontController = Zend_Controller_Front::getInstance();
    // manages the overall workflow
    $cwd = realpath(dirname(__FILE__));
    $frontController->setControllerDirectory($cwd);
    // Initialize views
    require 'Zend/View.php';
    // create a view object to hold our presentation model (i.e. data for template)
    $view = new Zend_View();
    // defaults to same location as controller (bug: default not working)
    $view->setScriptPath($cwd);
    $frontController->setParam('view', $view);
    // STAGE 2. Find the right action and execute it.
    $frontController->returnResponse(true);
    // return the response (do not echo it)
    // Dispatch calculated actions of the selected controllers
    $response = $frontController->dispatch();
    // similar to "running" the configured MVC "program"
    // STAGES 3 to 5 occur in IndexController.php
    //   STAGE 3: Choose, create, and optionally update models using business logic.
    //   STAGE 4: Apply business logic to create a presentation model for the view.
    //   STAGE 5: Choose view template and submit presentation model to view template for rendering.
    // STAGE 6 occurs in indexIndex.phtml
    //   STAGE 6: Render results in response to request.
    // STAGE 7. Render results in response to request.
    $response->renderExceptions(true);
    // show any excpetions in the visible output (i.e. debug mode)
    $response->sendResponse();
    // send final results to browser, including headers
}
コード例 #16
0
ファイル: util.php プロジェクト: que273/siremis
function getSystemStatus()
{
    $status[0]['item'] = 'Operation System';
    $status[0]['value'] = PHP_OS;
    $status[0]['status'] = 'OK';
    $status[1]['item'] = 'PHP version';
    $status[1]['value'] = PHP_VERSION;
    //$ver_num = intval(str_replace('.', '', PHP_VERSION));
    $status[1]['status'] = version_compare(PHP_VERSION, "5.1.4") >= 0 ? 'OK' : 'FAIL - Zend Framework required PHP5.1.4 or later';
    $status[2]['item'] = 'Openbiz Path';
    $status[2]['value'] = OPENBIZ_HOME;
    $status[2]['status'] = "OK";
    if (!file_exists(OPENBIZ_HOME)) {
        $status[2]['status'] = "FAIL - OPENBIZ_HOME doesn't point to Openbiz installed path";
    }
    $status[3]['item'] = 'Zend Framework Path';
    $status[3]['value'] = defined('ZEND_FRWK_HOME') ? ZEND_FRWK_HOME : 'Undefined';
    if (defined('ZEND_FRWK_HOME') && !file_exists(ZEND_FRWK_HOME)) {
        $status[3]['status'] = "FAIL - ZEND_FRWK_HOME doesn't point to Zend Framework installed path. Please modify ZEND_FRWK_HOME in " . OPENBIZ_HOME . "/bin/sysheader.inc";
    } else {
        if (defined('ZEND_FRWK_HOME') && file_exists(ZEND_FRWK_HOME)) {
            $status[3]['status'] = 'OK';
        } else {
            $status[3]['status'] = 'FAIL';
        }
    }
    if ($status[3]['status'] == 'OK') {
        require_once 'Zend/Version.php';
        $status[4]['item'] = 'Zend Framework';
        $status[4]['value'] = Zend_Version::VERSION;
        $status[4]['status'] = Zend_Version::compareVersion('1.0.0') < 0 ? 'OK - Version 1.0.0 or later is recommended' : 'FAIL';
    }
    $status[5]['item'] = 'PDO extensions';
    $pdos = array();
    if (extension_loaded('pdo')) {
        $pdos[] = "pdo";
    }
    if (extension_loaded('pdo_mysql')) {
        $pdos[] = "pdo_mysql";
    }
    if (extension_loaded('pdo_mssql')) {
        $pdos[] = "pdo_mssql";
    }
    if (extension_loaded('pdo_oci')) {
        $pdos[] = "pdo_oci";
    }
    if (extension_loaded('pdo_pgsql')) {
        $pdos[] = "pdo_pgsql";
    }
    $status[5]['value'] = implode(", ", $pdos);
    $status[5]['status'] = $pdos[0] == 'pdo' ? 'OK' : 'FAIL - PDO extensions are required.';
    $status[6]['item'] = 'HTTP Server';
    $status[6]['value'] = 'Rewrite Engine - unknown';
    $status[6]['status'] = 'OK';
    if (function_exists('apache_get_modules')) {
        $modules = apache_get_modules();
        if (in_array('mod_rewrite', $modules)) {
            $status[6]['value'] = 'Rewrite Engine - server module';
        }
    } else {
        if (getenv('HTTP_MOD_REWRITE') == 'On') {
            $status[6]['value'] = 'Rewrite Engine';
        }
    }
    return $status;
}
コード例 #17
0
	function indexAction()
	{
		$request = new RivetyCore_Request($this->getRequest());
		$basepath = Zend_Registry::get('basepath');
		$this->view->timezones = RivetyCore_Common::getTimeZonesArray();

		if ($this->getRequest()->isPost())
		{
			$errors = array();

			/*
			 * TODO: Check that smarty dirs are writeable, etc. dir is writable, etc. dir is NOT writeable after install, libraries exist,
			 * log level is set to something
			 */

			if (!file_exists($basepath . "/.htaccess"))
			{
				$errors[] = $this->_T("Missing .htaccess file in %s. Be sure to copy %s/template.htaccess and remove the word template from the filename.", array($basepath, $basepath));
			}

			$zf_version_class   = $request->zf_path . "/Zend/Version.php";
			$smarty_class_file  = $request->smarty_path . "/Smarty.class.php";
			$asido_class_file   = $request->asido_path . "/class.asido.php";
			$etc_dir            = $basepath . "/etc";
			$config_filename    = $etc_dir . "/config.ini";
			$tmp_path           = $request->tmp_path;
			$smarty_compile_dir = $tmp_path . "/view_compiles";
			$smarty_cache_dir   = $tmp_path . "/cache";
			$image_cache_dir    = $tmp_path . "/image_cache";
			$upload_path        = $basepath . "/uploads";
			$log_path           = $request->log_path;
			$module_cfg         = parse_ini_file($basepath . "/core/default/module.ini", true);

			if (!file_exists($zf_version_class))
			{
				$errors[] = $this->_T("Can't find Zend Framework in %s", $request->zf_path);
			}
			else
			{
				require_once($zf_version_class);
				if (Zend_Version::compareVersion($module_cfg['lib_versions']['zf']) > 0)
				{
					$errors[] = $this->_T("Rivety requires Zend Framework %s or higher. The supplied version is %s.", array($module_cfg['lib_versions']['zf'], Zend_Version::VERSION));
				}
			}
			if (!file_exists($smarty_class_file))
			{
				$errors[] = $this->_T("Can't find Smarty in %s", $request->RivetyCore_smarty_path);
			}
			else
			{
				$smarty_class_lines = explode("\n",file_get_contents($smarty_class_file));
				$strVersion = "* @version";
				foreach ($smarty_class_lines as $line)
				{
					if (strpos($line,$strVersion) !== false)
					{
						$found_smarty_version = trim(substr($line,strpos($line,$strVersion) + strlen($strVersion)));
						break;
					}
				}
				if (version_compare($module_cfg['lib_versions']['smarty'],$found_smarty_version) > 0)
				{
					$errors[] = $this->_T("Rivety requires Smarty Template Engine %s or higher. The supplied version is %s.", array($module_cfg['lib_versions']['smarty'], $found_smarty_version));
				}
			}
			if (!file_exists($asido_class_file))
			{
				$errors[] = $this->_T("Can't find Asido in %s.", $request->RivetyCore_asido_path);
			}
			else
			{
				require_once($asido_class_file);
				$asido = new Asido();
				if (version_compare($module_cfg['lib_versions']['asido'], $asido->version()) > 0)
				{
					$errors[] = $this->_T("Rivety requires Asido %s or higher. The supplied version is %s.", array($module_cfg['lib_versions']['asido'], $asido->version()));
				}
			}
			$dir_array = array($etc_dir,
				$tmp_path,
				$upload_path,
				$log_path
				);
			foreach ($dir_array as $dir)
			{
				if (!is_writable($dir))
				{
					$errors[] = $this->_T("Web server can't write to %s.", $dir);
				}
			}
			if ($request->admin_username == null)
			{
				$errors[] = $this->_T("Admin username cannot be blank.");
			}

			if ($request->admin_email == null)
			{
				$errors[] = $this->_T("Admin email cannot be blank.");
			}

			$cfg_array = array(
				"database" => array(
					"adapter" => "PDO_MYSQL",
					"params" => array(
						"host"     => $request->db_host,
						"dbname"   => $request->db_name,
						"username" => $request->db_user,
						"password" => $request->db_pass,
						"port"     => $request->db_port,
					)
				)
			);

			if (!is_null($request->db_sock))
			{
				$cfg_array['database']['params']['unix_socket'] = $request->db_sock;  // this is often something like /var/run/mysqld/mysqld.sock
			}

			$dbconfig = new Zend_Config($cfg_array);

			$db = Zend_Db::factory($dbconfig->database);

			try
			{
				if (count($errors) == 0)
				{
					$tables = $db->listTables();
					if (count($tables) > 0)
					{
						$errors[] = $this->_T("The specified database is not empty.");
					}
					// get the table creation script
					$ddl_file = $basepath . "/core/default/sql/" . $dbconfig->database->adapter . "/install.sql";
					if (file_exists($ddl_file)) {
						$queries = explode(";",file_get_contents($ddl_file));
						$db->beginTransaction();
						try
						{
							foreach ($queries as $query)
							{
								if (trim($query) != "")
								{
									$query = str_replace("@@@@ADMIN_USERNAME@@@@", $request->admin_username, $query);
									$query = str_replace("@@@@ADMIN_EMAIL@@@@", $request->admin_email, $query);
									$query = str_replace("@@@@CREATED_ON@@@@@", date("Y-m-d H:i:s"), $query);
									$db->query($query);
								}
							}
							$db->commit();
						}
						catch (Exception $e)
						{
							$db->rollBack();
							$errors[] = $e->getMessage();
						}
					}
					else
					{
						$errors[] = $this->_T("Database creation script not found.");
					}
				}
			}
			catch (Exception $e)
			{
				$errors[] = $e->getMessage();
			}

			if (count($errors) == 0)
			{
				// everything worked out okay, attempt to write the config file

				$config = array(
					"db.rivety.adapter"         => "PDO_MYSQL", // This should really be configurable, but it isn't yet.
					"db.rivety.config.host"     => $request->db_host,
					"db.rivety.config.dbname"   => $request->db_name,
					"db.rivety.config.username" => $request->db_user,
					"db.rivety.config.password" => $request->db_pass,
					"db.rivety.config.port"     => $request->db_port,
					"db.rivety.config.default"  => "true",
				);
				if (!is_null($request->db_sock))
				{
					$config['db.rivety.config.unix_socket'] = $request->db_sock;
				}
				$config_file .= RivetyCore_ConfigFile::makeSection("databases", "Database Settings", "This is the default database.", $config);

				$RivetyCore_config = array(
					"timezone"        => $request->RivetyCore_timezone,
					"launched"        => "1",
					"prelaunch_url"   => "http://google.com",
					"allowed_ips"     => "127.0.0.1",
					"zf_path"         => $request->zf_path,
					"smarty_path"     => $request->smarty_path,
					"asido_path"      => $request->asido_path,
					"image_cache_dir" => $image_cache_dir,
					"log_filename"    => $log_path."/RivetyCore_log",
					"log_level"       => "6",
					"addtl_includes"  => "",
				);

				$config_file .= RivetyCore_ConfigFile::makeSection("application", "Application Settings", "These are the application specific settings.", $RivetyCore_config);

				// create directories if needed
				if (!file_exists($smarty_compile_dir))
				{
					mkdir($smarty_compile_dir, 0777, true);
				}

				if (!file_exists($smarty_cache_dir))
				{
					mkdir($smarty_cache_dir, 0777, true);
				}

				if (!file_exists($image_cache_dir))
				{
					mkdir($image_cache_dir, 0777, true);
				}

				$smarty_config = array(
					"config.compile_dir" => $smarty_compile_dir,
					"config.cache_dir"   => $smarty_cache_dir,
				);

				$config_file .= RivetyCore_ConfigFile::makeSection("smarty", "Smarty Settings", "These are the settings for the Smarty template engine.", $smarty_config);

				if (file_put_contents($config_filename, $config_file) === false)
				{
					$this->view->config_file = $config_file;
					$this->view->config_filename = $config_filename;
					$this->view->success = "Database installed, but could not write config file. Please create the file \"" . $config_filename . "\" and paste this following into it:";
				}
				else
				{
					$this->_redirect("/default/install/secondstage/username/" . $request->admin_username);
				}
			}
			else
			{
				$this->view->errors          = $errors;
				$this->view->db_host         = $request->db_host;
				$this->view->db_name         = $request->db_name;
				$this->view->db_user         = $request->db_user;
				$this->view->db_pass         = $request->db_pass;
				$this->view->db_port         = $request->db_port;
				$this->view->db_sock         = $request->db_sock;
				$this->view->admin_username  = $request->admin_username;
				$this->view->admin_email     = $request->admin_email;
				$this->view->timezone        = $request->timezone;
				$this->view->zf_path         = $request->zf_path;
				$this->view->smarty_path     = $request->smarty_path;
				$this->view->asido_path      = $request->asido_path;
				$this->view->tmp_path        = $request->tmp_path;
				$this->view->log_path        = $request->log_path;
			}
		}
		else
		{
			$this->view->db_host         = "localhost";
			$this->view->db_name         = "rivety";
			$this->view->db_user         = "******";
			$this->view->db_pass         = "";
			$this->view->db_port         = "3306";
			$this->view->db_sock         = "";
			$this->view->admin_username  = "******";
			$this->view->timezone        = "America/Los_Angeles";
			$this->view->zf_path         = $basepath . "/lib/ZendFramework/library";
			$this->view->smarty_path     = $basepath . "/lib/Smarty/libs";
			$this->view->asido_path      = $basepath . "/lib/Asido";
			$this->view->tmp_path        = $basepath . "/tmp";
			$this->view->log_path        = $basepath . "/logs";
		}
		$this->view->admin_theme_url = "/core/default/views/admin";
		$this->view->admin_theme_global_path = $basepath . "/core/default/views/admin/tpl_common";
	}
コード例 #18
0
ファイル: Zend.php プロジェクト: jorgenils/zend-framework
 /**
  * Compare the specified ZF $version with the current Zend::VERSION of the ZF.
  *
  * @param  string  $version  A version identifier for the ZF (e.g. "0.7.1")
  * @return boolean    -1 if the $version is older, 0 if they are the same, and +1 if $version is newer
  *
  * @deprecated Since 0.9.0 -- Use Zend_Version::compareVersion() instead.
  */
 public static function compareVersion($version)
 {
     trigger_error(__CLASS__ . "::" . __FUNCTION__ . " deprecated since 0.9.0, use Zend_Version::compareVersion() instead");
     require_once 'Zend/Version.php';
     return Zend_Version::compareVersion($version);
 }
コード例 #19
0
    $result = TEST_FAIL;
    $failed = true;
}
printLine($counter, 'Checking HTTPS stream wrapper', $result);
$counter++;
// -----------------------------------------------------------------------------
if (true === method_exists('Zend_Debug', 'dump')) {
    $result = TEST_PASS;
} else {
    $result = TEST_FAIL;
    $failed = true;
}
printLine($counter, 'Checking Zend Framework path', $result);
$counter++;
// -----------------------------------------------------------------------------
if (1 === Zend_Version::compareVersion(PHP_VERSION, MIN_PHP_VERSION)) {
    $result = TEST_PASS;
} else {
    $result = TEST_FAIL;
    $failed = true;
}
printLine($counter, sprintf('Checking Zend Framework version (%s)', Zend_Version::VERSION), $result);
$counter++;
// -----------------------------------------------------------------------------
if (extension_loaded('soap')) {
    $result = TEST_PASS;
} else {
    $result = TEST_FAIL;
    $failed = true;
}
printLine($counter, 'Checking SOAP extension', $result);
コード例 #20
0
ファイル: Controller.php プロジェクト: shadobladez/erp2
 public function init()
 {
     $table = '';
     $class = '';
     $min_level = 0;
     $per_page = 0;
     if (is_request('event_id')) {
         set_new_event(get_request('event_id'));
     }
     $this->table = MODEL . $table;
     $this->class = $class;
     $this->min_level = $min_level;
     $this->per_page = $per_page;
     $this->db = Zend_Registry::get('db');
     $this->messenger = $this->_helper->_flashMessenger;
     //   any session must be after flashMessenger
     if (Zend_Version::compareVersion('1.10.1')) {
         date_default_timezone_set(get_control_value('System Keys', 'Time Zone'));
     } else {
         set_session('language', Zend_Registry::get('language'));
     }
     putenv('TZ=' . get_control_value('System Keys', 'Time Zone'));
     $this->db->query('SET time_zone=' . preg_replace('/([+-]\\d{2})(\\d{2})/', '\'\\1:\\2\'', date('O')));
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $contr = $request->getControllerName();
     $action = $request->getActionName();
     set_session('table', $table);
     set_session('class', $class);
     set_session('contr', $contr);
     set_session('action', $action);
     logger($contr);
     //   set control_company from url's request
     if (is_request('control_company')) {
         set_session('control_company', get_request('control_company'));
     }
     //   set control_company from url's subdomain
     /*
          if( !is_session( 'control_company' )) {
               $http_host = $_SERVER[ 'HTTP_HOST' ];
               $names = explode( '.', $http_host );
               $model = MODEL . 'Companies';
               $Companies = new $model();
               $company_id = $Companies->getIdByName( $names[ 0 ]);
               if( !$company_id )
                    $company_id = COMPANY_ID;
               set_session( 'control_company', $company_id );
          }
     */
     if (!is_logged() and is_request('user_key') and $action != 'confirm') {
         self::check_user_key();
     }
     if ($contr != 'homelx' and $contr != 'index' and $contr != 'uploads' and $contr != 'user') {
         //        memorize return_login ( entry point of the system )
         #          if( ! is_session( 'return_login' ))
         #               set_session( 'return_login', get_session( 'contr' ) . '/' . get_session( 'action' ));
         if ($contr == 'orderstt2' and $action == 'show' and is_request('id')) {
             set_session('return_login', $contr . '/' . $action . '?id=' . get_request('id'));
         }
         if ($contr == 'transvn' and $action == 'response' and is_request('id')) {
             set_session('return_login', $contr . '/' . $action . '?id=' . get_request('id') . '&updated_at=' . get_request('updated_at'));
         }
         if ($contr == 'feesvn' and $action == 'show' and is_request('id')) {
             set_session('return_login', $contr . '/' . $action . '?id=' . get_request('id'));
         }
         //        required login
         if (!is_logged()) {
             $this->_redirect('user/login');
         }
         //        check user_level against minimum access level of each program
         if (!is_permitted($this->min_level)) {
             $model = MODEL . 'Users';
             $Users = new $model();
             $Users->setLogout();
             unset_session('return_login');
             //   clean up previous return to avoid login looping
             $this->_redirect('user/login');
         }
     }
     if (is_request('search')) {
         $search = get_request('search');
         set_claxx('search', $search);
         //   save [search] for returned page
         set_claxx('page', '1');
         //   always starts from page 1
     }
     if (is_request('s_tags')) {
         $s_tags = get_request('s_tags');
         set_claxx('s_tags', $s_tags);
         //   save [s_tags] for returned page
         set_claxx('page', '1');
         //   always starts from page 1
     }
 }
コード例 #21
0
ファイル: bootstrap.php プロジェクト: junichiro/zf-starter
<?php

/**
 * My new Zend Framework project
 *
 * @author
 * @version
 */
set_include_path('.' . PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . '../application/default/models/' . PATH_SEPARATOR . '../application/api/models/' . PATH_SEPARATOR . '../application/api/services/' . PATH_SEPARATOR . get_include_path());
require_once 'Initializer.php';
require_once 'Zend/Version.php';
// Set up autoload.
if (Zend_Version::compareVersion('1.8.0') <= 0) {
    require_once 'Zend/Loader/Autoloader.php';
    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->setFallbackAutoloader(true);
} else {
    require_once 'Zend/Loader.php';
    Zend_Loader::registerAutoload();
}
// Prepare the front controller.
$frontController = Zend_Controller_Front::getInstance();
// Change to 'production' parameter under production environemtn
$frontController->registerPlugin(new Initializer('development'));
// Dispatch the request using the front controller.
$frontController->dispatch();
コード例 #22
0
ファイル: install.php プロジェクト: julien51/core
            return 'Installation';
        } else {
            throw new Exception('Your configuration has errors, please see below.');
        }
    } catch (Exception $e) {
        Check::bad($e->getMessage());
        Check::restart();
    }
}
?>
	<h2>Requirements Check</h2>
<?php 
Check::PHP("5.0");
Check::SettingValue("magic_quotes_gpc", false);
if (Check::CanInclude('Zend/Version.php', 'Zend Framework')) {
    if (Zend_Version::compareVersion('1.0.0') > 0) {
        warn('Zend Version 1.0.0 or newer is recommended');
    }
}
Check::FunctionExists('mcrypt_module_open', 'mcrypt');
Check::FunctionExists('curl_init', 'cURL');
Check::ExtensionExists('PDO', 'PDO');
Check::PathWritable('protected/temp/');
Check::PathWritable('protected/upload/');
Check::PathWritable('protected/logs/');
Check::PathWritable('protected/install/database/');
Check::PathWritable('protected/config/', true);
if (Check::no_errors()) {
    $form = new Form($form_errors, $form_values);
    ?>
	<h2>Configuration</h2>
コード例 #23
0
ファイル: index.php プロジェクト: jorgenils/zend-framework
 public static function testEnvironment()
 {
     if (version_compare('5.1.4', PHP_VERSION) > 0) {
         echo "Please upgrade to a newer version of PHP (5.1.4+) for this demo.\n";
         return false;
     }
     require_once 'Zend/Version.php';
     if (Zend_Version::compareVersion('0.9.2beta') > 0) {
         echo "Please upgrade to a newer version of ZF for this demo.\n";
         return false;
     }
     $extensions = get_loaded_extensions();
     $expected = array('PDO' => null, 'pdo_mysql' => null, 'ctype' => null, 'SPL' => null, 'pcre' => null, 'session' => null);
     sort($extensions);
     ZFDemo_Log::log("PHP extensions loaded = \n    " . implode("\n    ", $extensions));
     foreach (array_keys($expected) as $ext) {
         if (extension_loaded($ext)) {
             unset($expected[$ext]);
         }
     }
     foreach ($expected as $ext) {
         ZFDemo_Log::log("The '{$ext}' extension is required, but not currently loaded by PHP.");
     }
     if (count($expected)) {
         return false;
     }
     return true;
 }
コード例 #24
0
 public static function CheckZendFramework()
 {
     return class_exists('Zend_Application') && Zend_Version::compareVersion('1.11.5') <= 0 ? 'Yes' : 'No';
 }
コード例 #25
0
ファイル: GetAvatar.php プロジェクト: nidzix/Newscoop
<?php

/**
 * In the begining this was build for
 *         extending and getting the protected method from Gravatar _getAvatarUrl
 * But it can be used like a proxy helper to get the avatar link from different sources
 *
 */
if (Zend_Version::compareVersion('1.11.0') === 1) {
    class Zend_View_Helper_Gravatar extends Zend_View_Helper_HtmlElement
    {
        /**
         * URL to gravatar service
         */
        const GRAVATAR_URL = 'http://www.gravatar.com/avatar';
        /**
         * Secure URL to gravatar service
         */
        const GRAVATAR_URL_SECURE = 'https://secure.gravatar.com/avatar';
        /**
         * Gravatar rating
         */
        const RATING_G = 'g';
        const RATING_PG = 'pg';
        const RATING_R = 'r';
        const RATING_X = 'x';
        /**
         * Default gravatar image value constants
         */
        const DEFAULT_404 = '404';
        const DEFAULT_MM = 'mm';