Ejemplo n.º 1
0
if (! $config = check_config($app['config_file'])) {
	$www['page'] = new page();
	$www['body'] = new block();
	$www['page']->block_add('body',$www['body']);
	$www['page']->display();
	exit;

} else {
	app_session_start();
	$_SESSION[APPCONFIG] = $config;
}

if ($uri = get_request('URI','GET'))
	header(sprintf('Location: cmd.php?%s',base64_decode($uri)));

if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
	system_message(array(
		'title'=>_('This is a development version of phpLDAPadmin'),
		'body'=>'This is a development version of phpLDAPadmin! You should <b>NOT</b> use it in a production environment (although we dont think it should do any damage).',
		'type'=>'info','special'=>true));

	if (count($_SESSION[APPCONFIG]->untested()))
		system_message(array(
			'title'=>'Untested configuration paramaters',
			'body'=>sprintf('The following parameters have not been tested. If you have configured these parameters, and they are working as expected, please let the developers know, so that they can be removed from this message.<br/><small>%s</small>',implode(', ',$_SESSION[APPCONFIG]->untested())),
			'type'=>'info','special'=>true));

	$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
	if (count($server->untested()))
		system_message(array(
			'title'=>'Untested server configuration paramaters',
Ejemplo n.º 2
0
# Check for safe mode.
if (@ini_get('safe_mode') && !get_request('cmd', 'GET')) {
    system_message(array('title' => _('PHP Safe Mode'), 'body' => _('You have PHP Safe Mode enabled. This application may work unexpectedly in Safe Mode.'), 'type' => 'info'));
}
# Set our timezone, if it is specified in config.php
if ($_SESSION[APPCONFIG]->getValue('appearance', 'timezone')) {
    date_default_timezone_set($_SESSION[APPCONFIG]->getValue('appearance', 'timezone'));
}
# If we are here, $_SESSION is set - so enabled DEBUGing if it has been configured.
if (($_SESSION[APPCONFIG]->getValue('debug', 'syslog') || $_SESSION[APPCONFIG]->getValue('debug', 'file')) && $_SESSION[APPCONFIG]->getValue('debug', 'level')) {
    define('DEBUG_ENABLED', 1);
} else {
    define('DEBUG_ENABLED', 0);
}
if (DEBUG_ENABLED) {
    debug_log('Application (%s) initialised and starting with (%s).', 1, 0, __FILE__, __LINE__, __METHOD__, app_version(), $_REQUEST);
}
# Set our PHP timelimit.
if ($_SESSION[APPCONFIG]->getValue('session', 'timelimit') && !@ini_get('safe_mode')) {
    set_time_limit($_SESSION[APPCONFIG]->getValue('session', 'timelimit'));
}
# If debug mode is set, increase the time_limit, since we probably need it.
if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->getValue('session', 'timelimit') && !@ini_get('safe_mode')) {
    set_time_limit($_SESSION[APPCONFIG]->getValue('session', 'timelimit') * 5);
}
/**
 * Language configuration. Auto or specified?
 * Shall we attempt to auto-determine the language?
 */
# If we are in safe mode, and LANG is not in the allowed vars, display an error.
if (@ini_get('safe_mode') && !in_array('LANG', explode(',', @ini_get('safe_mode_allowed_env_vars')))) {
Ejemplo n.º 3
0
		<script src="<?php 
echo base_url();
?>
include/js/jasny-bootstrap.min.js?v=<?php 
echo app_version();
?>
"></script>
        <script src="<?php 
echo base_url();
?>
include/js/builder.js?v=<?php 
echo app_version();
?>
"></script>
		<script src="<?php 
echo base_url();
?>
include/js/base.js?v=<?php 
echo app_version();
?>
"></script>
        <script>
            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
            e.src='//www.google-analytics.com/analytics.js';
            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
            ga('create','UA-XXXXX-X','auto');ga('send','pageview');
        </script>
    </body>
</html>
Ejemplo n.º 4
0
 /**
  * Decrypt a block on data.
  *
  * @param String $block         The data to decrypt
  * @param optional String $key  The key to use
  *
  * @return String the decrypted output
  */
 function decryptBlock($block, $key = null)
 {
     if (!is_null($key)) {
         $this->setKey($key);
     }
     $unpack = unpack('N*', $block);
     if (!is_array($unpack)) {
         error(sprintf('BLOWFISH: decryptBock()<br>We expected unpack to produce an array, but instead it produced [%s]. This function was entered with (%s,%s). If you think that this is a bug, then please tell the PLA developers how you got here. You are using PLA [%s,%s]', serialize($unpack), $block, $key, app_version(), phpversion()), 'error', 'index.php');
     }
     list($L, $R) = array_values($unpack);
     $L ^= $this->p[17];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[16];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[15];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[14];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[13];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[12];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[11];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[10];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[9];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[8];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[7];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[6];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[5];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[4];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[3];
     $R ^= ($this->s1[$L >> 24 & 0xff] + $this->s2[$L >> 16 & 0xff] ^ $this->s3[$L >> 8 & 0xff]) + $this->s4[$L & 0xff] ^ $this->p[2];
     $L ^= ($this->s1[$R >> 24 & 0xff] + $this->s2[$R >> 16 & 0xff] ^ $this->s3[$R >> 8 & 0xff]) + $this->s4[$R & 0xff] ^ $this->p[1];
     $decrypted = pack("NN", $R ^ $this->p[0], $L);
     return $decrypted;
 }
Ejemplo n.º 5
0
	<?php 
$this->load->view('admin/layouts/includes/navigation', $data);
?>

	<div class="wrap">
		<div class="container">
			<?php 
echo isset($help_general) ? $help_general : NULL;
?>
			<?php 
echo isset($content) ? $content : NULL;
?>
		</div>
	</div>

</div>

<div class="container footer-text text-muted">
	<hr>
	<small>TrafficTower <?php 
echo app_version(TRUE);
?>
 &copy; <?php 
echo date('Y');
?>
 <a href="http://www.bitman.nl" target="_blank">Bitman.nl</a></small>
</div>

<?php 
$this->load->view('admin/layouts/includes/footer', $data);
Ejemplo n.º 6
0
	<?php 
skin_opengraph_tags();
?>
	<?php 
robots_tag();
?>
	<?php 
$js_blog_id = "";
if (!empty($Blog)) {
    // Set global js var "blog_id"
    $js_blog_id = "\r\n\t\tvar blog_id = '" . $Blog->ID . "';";
}
add_js_headline("// Paths used by JS functions:\n\t\tvar htsrv_url = '" . get_htsrv_url() . "';\n\t\tvar restapi_url = '" . get_restapi_url() . "';" . $js_blog_id);
?>
	<meta name="generator" content="b2evolution <?php 
app_version();
?>
" /> <!-- Please leave this for stats -->
	<?php 
if ($Blog->get_setting('feed_content') != 'none') {
    // auto-discovery urls
    ?>
	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php 
    $Blog->disp('rss2_url', 'raw');
    ?>
" />
	<link rel="alternate" type="application/atom+xml" title="Atom" href="<?php 
    $Blog->disp('atom_url', 'raw');
    ?>
" />
		<?php 
Ejemplo n.º 7
0
/**
 * The only function which should be called by a user
 *
 * @see common.php
 * @see APP_SESSION_ID
 * @return boolean Returns true if the session was started the first time
 */
function app_session_start()
{
    $sysmsg = null;
    # If we have a sysmsg before our session has started, then preserve it.
    if (isset($_SESSION['sysmsg'])) {
        $sysmsg = $_SESSION['sysmsg'];
    }
    /* If session.auto_start is on in the server's PHP configuration (php.ini), then
     * we will have problems loading our schema cache since the session will have started
     * prior to loading the SchemaItem (and descedants) class. Destroy the auto-started
     * session to prevent this problem.
     */
    if (ini_get('session.auto_start') && !array_key_exists(app_session_id_init, $_SESSION)) {
        @session_destroy();
    }
    # Do we already have a session?
    if (@session_id()) {
        return;
    }
    @session_name(APP_SESSION_ID);
    @session_start();
    # Do we have a valid session?
    $is_initialized = is_array($_SESSION) && array_key_exists(app_session_id_init, $_SESSION);
    if (!$is_initialized) {
        if (app_session_id_paranoid) {
            ini_set('session.use_trans_sid', 0);
            @session_destroy();
            @session_id(app_session_get_id());
            @session_start();
            ini_set('session.use_trans_sid', 1);
        }
        $_SESSION[app_session_id_init]['name'] = app_name();
        $_SESSION[app_session_id_init]['version'] = app_version();
        $_SESSION[app_session_id_init]['config'] = filemtime(CONFDIR . 'config.php');
    }
    @header('Cache-control: private');
    // IE 6 Fix
    if (app_session_id_paranoid && !app_session_verify_id()) {
        error('Session inconsistent or session timeout', 'error', 'index.php');
    }
    # Check we have the correct version of the SESSION cache
    if (isset($_SESSION['cache']) || isset($_SESSION[app_session_id_init])) {
        if (!is_array($_SESSION[app_session_id_init])) {
            $_SESSION[app_session_id_init] = array();
        }
        if (!isset($_SESSION[app_session_id_init]['version']) || !isset($_SESSION[app_session_id_init]['config']) || !isset($_SESSION[app_session_id_init]['name']) || $_SESSION[app_session_id_init]['name'] !== app_name() || $_SESSION[app_session_id_init]['version'] !== app_version() || $_SESSION[app_session_id_init]['config'] != filemtime(CONFDIR . 'config.php')) {
            $_SESSION[app_session_id_init]['name'] = app_name();
            $_SESSION[app_session_id_init]['version'] = app_version();
            $_SESSION[app_session_id_init]['config'] = filemtime(CONFDIR . 'config.php');
            unset($_SESSION['cache']);
            unset($_SESSION[APPCONFIG]);
            # Our configuration information has changed, so we'll redirect to index.php to get it reloaded again.
            system_message(array('title' => _('Configuration cache stale.'), 'body' => _('Your configuration has been automatically refreshed.'), 'type' => 'info', 'special' => true));
            $config_file = CONFDIR . 'config.php';
            $config = check_config($config_file);
            if (!$config) {
                debug_dump_backtrace('config is empty?', 1);
            }
        } else {
            # Sanity check, specially when upgrading from a previous release.
            if (isset($_SESSION['cache'])) {
                foreach (array_keys($_SESSION['cache']) as $id) {
                    if (isset($_SESSION['cache'][$id]['tree']['null']) && !is_object($_SESSION['cache'][$id]['tree']['null'])) {
                        unset($_SESSION['cache'][$id]);
                    }
                }
            }
        }
    }
    # If we came via index.php, then set our $config.
    if (!isset($_SESSION[APPCONFIG]) && isset($config)) {
        $_SESSION[APPCONFIG] = $config;
    }
    # Restore our sysmsg's if there were any.
    if ($sysmsg) {
        if (!isset($_SESSION['sysmsg']) || !is_array($_SESSION['sysmsg'])) {
            $_SESSION['sysmsg'] = array();
        }
        $_SESSION['sysmsg'] = array_merge($_SESSION['sysmsg'], $sysmsg);
    }
}
Ejemplo n.º 8
0
 protected function getHeader()
 {
     $server = $this->getServer();
     $type = $this->getType();
     $output = '';
     $output .= sprintf('# %s %s %s%s', $type['description'], _('for'), implode('|', array_keys($this->results)), $this->br);
     $output .= sprintf('# %s: %s (%s)%s', _('Server'), $server->getName(), $server->getValue('server', 'host'), $this->br);
     $output .= sprintf('# %s: %s%s', _('Search Scope'), $this->resultsdata['scope'], $this->br);
     $output .= sprintf('# %s: %s%s', _('Search Filter'), $this->resultsdata['filter'], $this->br);
     $output .= sprintf('# %s: %s%s', _('Total Entries'), $this->items, $this->br);
     $output .= sprintf('#%s', $this->br);
     $output .= sprintf('# Generated by %s (%s) on %s%s', app_name(), get_href('web'), date('F j, Y g:i a'), $this->br);
     $output .= sprintf('# Version: %s%s', app_version(), $this->br);
     $output .= $this->br;
     return $output;
 }
Ejemplo n.º 9
0
/**
 * Custom error handling function.
 * When a PHP error occurs, PHP will call this function rather than printing
 * the typical PHP error string. This provides the application the ability to
 * format an error message so that it looks better.
 * Optionally, it can present a link so that a user can search/submit bugs.
 * This function is not to be called directly. It is exclusively for the use of
 * PHP internally. If this function is called by PHP from within a context
 * where error handling has been disabled (ie, from within a function called
 * with "@" prepended), then this function does nothing.
 *
 * @param int The PHP error number that occurred (ie, E_ERROR, E_WARNING, E_PARSE, etc).
 * @param string The PHP error string provided (ie, "Warning index "foo" is undefined)
 * @param string The file in which the PHP error ocurred.
 * @param int The line number on which the PHP error ocurred
 * @see set_error_handler
 */
function app_error_handler($errno, $errstr, $file, $lineno)
{
    if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
        debug_log('Entered (%%)', 1, 0, __FILE__, __LINE__, __METHOD__, $fargs);
    }
    /**
     * error_reporting will be 0 if the error context occurred
     * within a function call with '@' preprended (ie, @ldap_bind() );
     * So, don't report errors if the caller has specifically
     * disabled them with '@'
     */
    if (ini_get('error_reporting') == 0 || error_reporting() == 0) {
        return;
    }
    $file = basename($file);
    $caller = basename($_SERVER['PHP_SELF']);
    $errtype = '';
    switch ($errno) {
        case E_STRICT:
            $errtype = 'E_STRICT';
            break;
        case E_ERROR:
            $errtype = 'E_ERROR';
            break;
        case E_WARNING:
            $errtype = 'E_WARNING';
            break;
        case E_PARSE:
            $errtype = 'E_PARSE';
            break;
        case E_NOTICE:
            $errtype = 'E_NOTICE';
            break;
        case E_CORE_ERROR:
            $errtype = 'E_CORE_ERROR';
            break;
        case E_CORE_WARNING:
            $errtype = 'E_CORE_WARNING';
            break;
        case E_COMPILE_ERROR:
            $errtype = 'E_COMPILE_ERROR';
            break;
        case E_COMPILE_WARNING:
            $errtype = 'E_COMPILE_WARNING';
            break;
        case E_USER_ERROR:
            $errtype = 'E_USER_ERROR';
            break;
        case E_USER_WARNING:
            $errtype = 'E_USER_WARNING';
            break;
        case E_USER_NOTICE:
            $errtype = 'E_USER_NOTICE';
            break;
        case E_ALL:
            $errtype = 'E_ALL';
            break;
        default:
            $errtype = sprintf('%s: %s', _('Unrecognized error number'), $errno);
    }
    # Take out extra spaces in error strings.
    $errstr = preg_replace('/\\s+/', ' ', $errstr);
    if ($errno == E_NOTICE) {
        $body = '<table class="notice">';
        $body .= sprintf('<tr><td>%s:</td><td><b>%s</b> (<b>%s</b>)</td></tr>', _('Error'), $errstr, $errtype);
        $body .= sprintf('<tr><td>%s:</td><td><b>%s</b> %s <b>%s</b>, %s <b>%s</b></td></tr>', _('File'), $file, _('line'), $lineno, _('caller'), $caller);
        $body .= sprintf('<tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b></td></tr>', app_version(), phpversion(), php_sapi_name());
        $body .= sprintf('<tr><td>Web server:</td><td><b>%s</b></td></tr>', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'SCRIPT');
        if (function_exists('get_href')) {
            $body .= sprintf('<tr><td colspan="2"><a href="%s" onclick="target=\'_blank\';"><center>%s.</center></a></td></tr>', get_href('search_bug', "&summary_keyword=" . rawurlencode($errstr)), _('Please check and see if this bug has been reported'));
        }
        $body .= '</table>';
        system_message(array('title' => _('You found a non-fatal phpLDAPadmin bug!'), 'body' => $body, 'type' => 'error'));
        return;
    }
    # If this is a more serious error, call the error call.
    error(sprintf('%s: %s', $errtype, $errstr), 'error', null, true, true);
}
Ejemplo n.º 10
0
 private function footer_print()
 {
     if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
         debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs);
     }
     printf('<tr class="foot"><td><small>%s</small></td><td colspan=2><div id="ajFOOT">%s</div>%s</td></tr>', isCompress() ? '[C]' : '&nbsp;', app_version(), get_href('logo') ? sprintf('<a href="%s"><img src="%s" border="0" alt="SourceForge.net Logo" /></a>', get_href('sf'), get_href('logo')) : '&nbsp;');
 }