Pastoid

requirements.php

The page you are looking at now is at this URL: http://pastoid.com/al8

This paste was last updated on February 5, 2009 at 9:35 am.

Pasted Coderaw

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="en"/>
	<meta name="robots" content="no index,no follow" />
	<title><?php _e('Habari Requirements Check'); ?></title>
<style type="text/css">
body {
	font-family: Helvetica Neue, Helvetica, Arial, Sans-Serif;
	padding: 0;
	margin: 0;
	}
 
#installer {
	text-align: center;
	min-width: 600px;
	background: #f1f1f1;
	}
 
a {
	color: #999;
	}
 
#wrapper {
	width: 552px;
	margin: 0 auto 50px;
	}
 
#masthead {
	margin: 30px 0;
	}
 
#masthead h1 {
	font-size: 35px;
	line-height: 35px;
	color: #333;
	margin-bottom: 0px;
	text-transform: lowercase;
	}
 
#masthead p {
	font-size: 11px;
	text-transform: lowercase;
	color: #666;
	margin: 0px;
	}
 
.installstep {
	width: 552px;
	background: url(images/install-step.png) scroll repeat-y 0px 47px;
	margin-top: 20px;
	position: relative;
	}
 
.installstep.done {
	background: url(images/install-step_done.png) scroll repeat-y 0px 47px;
	}
 
.installstep h2 {
	color: #333;
	line-height: 30px;
	font-size: 18px;
	background: url(images/install-step_h2.png) scroll no-repeat top left;
	font-weight: normal;
	padding: 10px 22px 0px;
	margin: 0px;
	}
 
.installstep.done h2 {
	background: url(images/install-step_h2_done.png) scroll no-repeat top left;
	}
 
.help-me {
	float: right;
	position: absolute;
	top: 15px;
	right: 20px;
	display: none;
	height: 20px;
	width: 20px;
	text-indent: -3000px;
	background: url(images/install-step_h2_help-me.png) scroll no-repeat top left;
	outline: none;
	}
.ready .help-me {
	display:block;
}
.help-me:hover {
	background: url(images/install-step_h2_help-me_over.png) scroll no-repeat top left;
	}
 
.options, .advanced-options {
	text-align: left;
	font-size: 0.76em;
	padding: 0px 11px 0px 22px;
	}
 
.options {
	background: url(images/options.png) scroll no-repeat 0px 0px;
	}
 
.installstep.done .options {
	background: url(images/options_done.png) scroll no-repeat 0px 0px;
	}
 
.installstep .options, .installstep .advanced-options, .installstep h2 .help-me {
	display: none;
	}
 
.installstep.ready .options, .installstep.ready .advanced-options, .installstep.ready h2 .help-me {
	display: block;
	}
 
.options .inputfield, .advanced-options .inputfield {
	margin-bottom: 5px;
	padding-top: 15px;
	}
 
div.javascript-disabled {
	width: 440px;
	color: #666666;
	padding: 10px 15px;
	margin: 0px 5px 0px 15px;
	border: 1px solid #dedede;
	background: #f1f1f1;
	text-align: center;
	}
 
.inputfield label, .item label {
	color: #666;
	}
 
.inputfield label {
	padding: 3px 20px 0 0;
	display: block;
	width: 122px;
	float: left;
	}
 
.inputfield label strong {
	color: #FF0000;
	}
 
.inputfield select {
	width: 336px;
	}
 
.inputfield input {
	width: 329px;
	padding-left: 2px
	}
 
#sitename {
	font-weight: bold;
	}
 
.inputfield .status {
	position: relative;
	top: 2px;
	width: 34px;
	height: 15px;
	}
 
.valid .status {
	background: url(images/ok.png);
	}
 
.invalid .status {
	background: url(images/fail.png);
	}
 
.inputfield .warning {
	display: none;
	padding: 3px 45px 0px 145px;
	line-height: 120%;
	text-align: left;
	color: #cc0000;
	}
 
.inputfield .help {
 
 
/* display: none; */
	padding: 10px 45px 10px 145px;
	color: #666;
	font-size: 11px;
	line-height: 15px;
	}
 
.inputfield .config {
	width: 507px;
	height: 150px;
	margin: 10px 0px 0px
	}
 
.installstep .bottom {
	height: 10px;
	background: url(images/options_bottom.png) scroll no-repeat left bottom;
	}
 
.installstep.done .bottom {
	height: 15px;
	background: url(images/options_bottom_done.png) scroll no-repeat left bottom;
	}
 
.installstep.ready .bottom {
	height: 15px;
	}
 
.next-section {
	height: 14px;
	width: 100%;
	margin: 20px 0px 0px 0px;
	background: url(images/next-section.png) scroll no-repeat center bottom;
	}
 
.inputfield.submit p {
	display: none;
	}
 
.submit {
	text-align: center;
	}
 
.submit input {
	width: 40%;
	margin: 0 0 10px;
	}
 
.error {
	padding: .8em;
	margin-bottom: 1em;
	border: 2px solid #ddd;
	background: #FBE3E4;
	border-color: #FBC2C4;
	}
 
.error, .error a {
	color: #D12F19;
	}
 
#footer a {
	font-size: 11px !important;
	text-transform: lowercase;
	color: #999;
	padding: 0 3px;
	}
 
#footer a:hover {
	color: #666;
	}
 
/* item selection */
.items div.item {
	padding:5px 0;
}
 
.items span.checkbox {
	position:absolute;
}
 
.items label {
	position:relative;
	top:3px;
}
 
.items label, .items div.help {
	padding-left:30px;
}
 
.items .controls {
	margin-top:20px;
}
 
.items .controls label {
	color:#888888;
}
 
optgroup {
	font-style: normal;
	color: #aaaaaa;
	font-weight: normal;
	padding-left: 3px;
}
</style>
</head>
 
<body id="installer">
	<div id="wrapper">
		<?php $tab = 1; ?>
		<div id="masthead">
			<h1>Habari</h1>
			<div id="footer">
				<p class="left"><a href="http://wiki.habariproject.org/" title="<?php _e('Read the Habari wiki'); ?>" tabindex="<?php echo $tab++ ?>">Wiki</a> &middot;
					<a href="http://groups.google.com/group/habari-users" title="<?php _e('Ask the community'); ?>" tabindex="<?php echo $tab++ ?>"><?php _e('Mailing List'); ?></a>
				</p>
			</div>
		</div>
 
 
<?php if (! $this->meets_all_requirements()) { ?>
 
	<div id="header">
		<h1><?php _e('Before you install <em>Habari</em>...'); ?></h1>
	</div>
	<?php if (! $local_writable) {?>
		<h2><?php _e('Writable directory needed'); ?>...</h2>
		<?php if ($PHP_OS != 'WIN') {?>
			<p class="instructions">
				<?php _e('Before you can install Habari, you first need to make the install directory writable by php, so that the installation script can write your configuration information properly. The exact process of server and the ownership of the directory.'); ?>
			</p>
			<p>
				<?php _e('If your webserver is part of the group which owns the directory, you\'ll need to add group write permissions to the directory. The procedure for this is as follows:'); ?>
			</p>
			<ol>
				<li>
					<?php _e('Open a terminal window, and then change to the installation directory:'); ?>
					<pre><strong>$&gt;</strong> cd <i>/path/to/habari/</i></pre>
				</li>
				<li>
					<?php _e('Change the <em>mode</em> (permissions) of the current directory:'); ?>
					<pre><strong>$&gt;</strong> chmod g+w .</pre><br />
					<pre><strong>$&gt;</strong> chmod g+x .</pre>
					<p class="note">
						<?php _e('<em>Note</em>: You may need to use <strong>sudo</strong> and enter an administrator password if you do not own the directory.'); ?>
					</p>
				</li>
			</ol>
			<p>
				<?php _e('If the webserver is not part of the group which owns the directory, you will need to <strong>temporarily</strong> grant world write permissions to the directory:'); ?>
			</p>
			<ol>
				<li>
					<pre><strong>$&gt;</strong> chmod o+w .</pre><br />
					<pre><strong>$&gt;</strong> chmod o+x .</pre>
				</li>
			</ol>
			<p>
				<strong><?php _e('Be sure to remove the write permissions on the directory as soon as the installation is completed.'); ?></strong>
			</p>
		<?php } else {?>
			<strong>@todo Windows instructions</strong>
		<?php }?>
	<?php }?>
 
	<?php if (! $php_version_ok) {?>
		<h2><?php _e('PHP Upgrade needed...'); ?></h2>
		<p class="instructions">
			<em>Habari</em> <?php printf(_t('requires PHP 5.2 or newer. Your current PHP version is %s.'), PHP_VERSION); ?>
		</p>
		<strong>@todo Upgrading PHP instructions</strong>
	<?php }?>
 
	<?php if (! empty($missing_extensions)) {
		foreach ($missing_extensions as $ext_name => $ext_url) {
			$missing_ext_html[]= '<a href="' . $ext_url . '">' . $ext_name . '</a>';
		}
		$missing_ext_html = implode( ', ', $missing_ext_html );
	?>
		<h2><?php _e('Missing Extensions'); ?></h2>
		<p class="instructions">
			<em>Habari</em> <?php _e('requires that the following PHP extensions to be installed:'); ?> <?php echo $missing_ext_html; ?>. <?php _e('Please contact your web hosting provider if you do not have access to your server.'); ?>
		</p>
	<?php }?>
 
	<?php if ( ! $pdo_drivers_ok && ! array_key_exists( 'pdo', $missing_extensions )  ) { ?>
		<h2><?php _e('No PDO drivers enabled'); ?></h2>
		<p class="instructions"><em>Habari</em> <?php _e('requires that at least one <a href="http://www.php.net/pdo">PDO driver</a> be installed. Please ask your hosting provider to enable one of the PDO drivers supported by Habari.'); ?></p>
	<?php } ?>
 
<?php } else { ?>
	<div id="header">
	<h1><?php _e('Your system is ready for Habari!'); ?><h1>
	<ul>
		<li><?php _e('Download the '); ?><a href-""><?php _e('latest stable version of Habari'); ?></a></li>
		<li><?php _e('View the '); ?><a href=""><?php _e('installation instructions'); ?></a></li>
		<li><?php _e('Get '); ?><a href=""><?php _e('live help'); ?></a></li>
	</ul>
} ?>
 
</div><!-- end wrapper -->
</body>
</html>
 
 
<?php 
class Requirements {
 
private function meets_all_requirements()
	{
		// Required extensions, this list will augment with time
		// Even if they are enabled by default, it seems some install turn them off
		// We use the URL in the Installer template to link to the installation page
		$required_extensions = array(
			'pdo' => 'http://php.net/pdo',
			'hash' => 'http://php.net/hash',
			'iconv' => 'http://php.net/iconv',
			'tokenizer' => 'http://php.net/tokenizer',
			'simplexml' => 'http://php.net/simplexml',
			'mbstring' => 'http://php.net/mbstring',
			'json' => 'http://php.net/json'
			);
		$requirements_met = true;
 
		/* Check versions of PHP */
		$php_version_ok = version_compare(phpversion(), MIN_PHP_VERSION, '>=');
		$this->theme->assign('php_version_ok', $php_version_ok);
		$this->theme->assign('PHP_OS', PHP_OS);;
		$this->theme->assign('PHP_VERSION',  phpversion());
		if (! $php_version_ok) {
			$requirements_met = false;
		}
		/* Check for required extensions */
		$missing_extensions = array();
		foreach ($required_extensions as $ext_name => $ext_url) {
			if (!extension_loaded($ext_name)) {
				$missing_extensions[$ext_name] = $ext_url;
				$requirements_met = false;
			}
		}
		$this->theme->assign('missing_extensions',  $missing_extensions);
 
		if ( extension_loaded('pdo') ) {
			/* Check for PDO drivers */
			$pdo_drivers = PDO::getAvailableDrivers();
			if ( ! empty( $pdo_drivers ) ) {
				$pdo_drivers = array_combine( $pdo_drivers, $pdo_drivers );
				// Include only those drivers that we include database support for
				$pdo_schemas = array_map( 'basename', Utils::glob( HABARI_PATH . '/system/schema/*' ) );
				$pdo_schemas = array_combine( $pdo_schemas, $pdo_schemas );
 
				$pdo_drivers = array_intersect_key(
					$pdo_drivers,
					$pdo_schemas
				);
				$pdo_missing_drivers = array_diff(
					$pdo_schemas,
					$pdo_drivers
				);
			}
 
			$pdo_drivers_ok = count( $pdo_drivers );
			$this->theme->assign( 'pdo_drivers_ok', $pdo_drivers_ok );
			$this->theme->assign( 'pdo_drivers', $pdo_drivers );
			$this->theme->assign( 'pdo_missing_drivers', $pdo_missing_drivers );
			if ( ! $pdo_drivers_ok ) {
				$requirements_met = false;
			}
		}
		else {
			$this->theme->assign( 'pdo_drivers_ok', false );
			$this->theme->assign( 'pdo_drivers', array() );
			$requirements_met = false;
		}
 
		/**
		 * $local_writable is used in the template, but never set in Habari
		 * Won't remove the template code since it looks like it should be there
		 *
		 * This will only meet the requirement so there's no "undefined variable" exception
		 */
		$this->theme->assign( 'local_writable', true );
 
		return $requirements_met;
	}
}
?>

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
www.mibbit.com 9
www.google.com 1
search.live.com 1
mibbit.com 1
Is this paste spam?
<Hide