当前位置: 首页>>代码示例>>PHP>>正文


PHP ext_isXHR函数代码示例

本文整理汇总了PHP中ext_isXHR函数的典型用法代码示例。如果您正苦于以下问题:PHP ext_isXHR函数的具体用法?PHP ext_isXHR怎么用?PHP ext_isXHR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ext_isXHR函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

            $json = new $classname();
            echo $json->encode($response);
            break;
        case 'get_image':
            require_once _EXT_PATH . "/include/view.php";
            ext_View::sendImage($dir, $item);
        case 'ftp_authentication':
        case 'ssh2_authentication':
        case 'extplorer_authentication':
            $auth_info = explode('_', $action);
            $auth_classname = 'ext_' . $action;
            require_once _EXT_PATH . '/include/authentication/' . $auth_info[0] . '.php';
            $auth_plugin = new $auth_classname();
            $auth_plugin->onShowLoginForm();
            break;
        default:
            require_once _EXT_PATH . "/include/list.php";
            ext_List::execAction($dir);
            //------------------------------------------------------------------------------
    }
    // end switch-statement
}
//------------------------------------------------------------------------------
// Disconnect from ftp server
if (ext_isFTPMode()) {
    $GLOBALS['FTPCONNECTION']->disconnect();
}
// Empty the output buffer if this is a XMLHttpRequest
if (ext_isXHR()) {
    ext_exit();
}
开发者ID:elevenfox,项目名称:VTree,代码行数:31,代码来源:admin.extplorer.php

示例2: login

function login()
{
    global $auth, $authentication_type;
    if (!is_object($auth)) {
        return false;
    }
    if (!empty($GLOBALS['__POST']['username']) || !empty($_SESSION['credentials_' . $authentication_type])) {
        if (!empty($GLOBALS['__POST']['username'])) {
            $username = $GLOBALS['__POST']['username'];
            $password = $GLOBALS['__POST']['password'];
        } else {
            $username = $_SESSION['credentials_' . $authentication_type]['username'];
            $password = $_SESSION['credentials_' . $authentication_type]['password'];
        }
        $res = $auth->onAuthenticate(array('username' => $username, 'password' => $password));
        if (!PEAR::isError($res) && $res !== false) {
            if (@$GLOBALS['__POST']['action'] == 'login' && ext_isXHR()) {
                session_write_close();
                ext_Result::sendResult('login', true, ext_Lang::msg('actlogin_success'));
            }
            return true;
        } else {
            if ($authentication_type == 'extplorer') {
                // Second attempt to authenticate, since we've switched password hashing algorithm
                // now we fall back to md5 hashing.
                $password = md5((string) $GLOBALS['__POST']['password']);
                $res = $auth->onAuthenticate(array('username' => $username, 'password' => $password));
                if (!PEAR::isError($res) && $res !== false) {
                    if (@$GLOBALS['__POST']['action'] == 'login' && ext_isXHR()) {
                        session_write_close();
                        ext_Result::sendResult('login', true, ext_Lang::msg('actlogin_success'));
                    }
                    return true;
                }
            }
            if (ext_isXHR()) {
                $errmsg = PEAR::isError($res) ? $res->getMessage() : ext_Lang::msg('actlogin_failure');
                ext_Result::sendResult('login', false, $errmsg);
            }
            return false;
        }
    }
    if (ext_isXHR() && $GLOBALS['action'] != 'login') {
        echo '<script type="text/javascript>document.location="' . _EXT_URL . '/index.php";</script>';
        exit;
    }
    session_write_close();
    session_id(get_session_id());
    session_start();
    // Ask for Login
    $GLOBALS['mainframe']->setPageTitle(ext_Lang::msg('actlogin'));
    $GLOBALS['mainframe']->addcustomheadtag('
		<script type="text/javascript" src="scripts/extjs3/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="scripts/extjs3/ext-all.js"></script>
		<script type="text/javascript" src="' . $GLOBALS['script_name'] . '?option=com_extplorer&amp;action=include_javascript&amp;file=functions.js"></script>
		<link rel="stylesheet" href="' . _EXT_URL . '/scripts/extjs3/resources/css/ext-all.css" />
		<link rel="stylesheet" href="scripts/extjs3/resources/css/xtheme-blue.css" />');
    ?>
		<div style="width: 400px;" id="formContainer">
			<div id="ext_logo" style="text-align:center;">
			<a href="http://extplorer.net" target="_blank">
				<img src="<?php 
    echo _EXT_URL;
    ?>
/images/eXtplorer-horizontal2.png" align="middle" alt="eXtplorer Logo" style="border:none;" />
			</a>
			</div>
			<noscript>
				<div style="width:400px;text-align:center;">
					<h1>eXtplorer Login</h1>
					<p style="color:red;">Oh, Javascript is disabled!</p>
					<p>Find out <a target="_blank" href="https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=12654">how you can enable Javascript in your browser.</a>
					</p>
				</div>
			</noscript>
			<div id="adminForm"></div>
			
	</div>
	<script type="text/javascript">
Ext.onReady( function() {
	var simple = new Ext.FormPanel(<?php 
    $auth->onShowLoginForm();
    ?>
);
	
	Ext.get( 'formContainer').center();
	Ext.get( 'formContainer').setTop(100);
	simple.getForm().findField('username').focus();
	Ext.EventManager.onWindowResize( function() { Ext.get( 'formContainer').center();Ext.get( 'formContainer').setTop(100); } );
});
</script><?php 
    define('_LOGIN_REQUIRED', 1);
}
开发者ID:chajianku,项目名称:admin_eXtplorer,代码行数:93,代码来源:login.php

示例3: onShowLoginForm

    function onShowLoginForm($User, $Pass)
    {
        ?>
	{
		xtype: "form",
		<?php 
        if (!ext_isXHR()) {
            ?>
renderTo: "adminForm", <?php 
        }
        ?>
		title: "<?php 
        echo ext_Lang::msg('actlogin');
        ?>
",
		id: "simpleform",
		labelWidth: 125, // label settings here cascade unless overridden
		url: "<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
		frame: true,
		keys: {
		    key: Ext.EventObject.ENTER,
		    fn  : function(){
				if (simple.getForm().isValid()) {
					Ext.get( "statusBar").update( "Please wait..." );
					Ext.getCmp("simpleform").getForm().submit({
						reset: false,
						success: function(form, action) { location.reload() },
						failure: function(form, action) {
							if( !action.result ) return;
							Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
', action.result.error, function() {
							this.findField( 'password').setValue('');
							this.findField( 'password').focus();
							}, form );
							Ext.get( 'statusBar').update( action.result.error );
						},
						scope: Ext.getCmp("simpleform").getForm(),
						params: {
							option: "com_extplorer", 
							action: "login",
							type : "extplorer"
						}
					});
    	        } else {
        	        return false;
            	}
            }
		},
		items: [{
            xtype:"textfield",
			fieldLabel: "<?php 
        echo ext_Lang::msg('miscusername', true);
        ?>
",
			name: "username",
                        value: "<?php 
        echo $User;
        ?>
",
			width:175,
			allowBlank:false
		},{
			xtype:"textfield",
			fieldLabel: "<?php 
        echo ext_Lang::msg('miscpassword', true);
        ?>
",
			name: "password",
                        value: "<?php 
        echo $Pass;
        ?>
",
			inputType: "password",
			width:175,
			allowBlank:false
		}, new Ext.form.ComboBox({
			
			fieldLabel: "<?php 
        echo ext_Lang::msg('misclang', true);
        ?>
",
			store: new Ext.data.SimpleStore({
		fields: ['language', 'langname'],
		data :	[
		<?php 
        $langs = get_languages();
        $i = 0;
        $c = count($langs);
        foreach ($langs as $language => $name) {
            echo "['{$language}', '{$name}' ]";
            if (++$i < $c) {
                echo ',';
            }
        }
        ?>
//.........这里部分代码省略.........
开发者ID:jramsey08,项目名称:Coldwebs-V2.0,代码行数:101,代码来源:extplorer.php

示例4: sendResult

 static function sendResult($action, $success, $msg, $extra = array())
 {
     // show error-message
     if (ext_isXHR()) {
         $success = (bool) $success;
         if ($success && ext_Result::count_errors() > 0) {
             $success = false;
             foreach (@$_SESSION['ext_error'] as $type) {
                 if (is_array($type)) {
                     foreach ($type as $error) {
                         $msg .= '<br />' . $error;
                     }
                 }
             }
         }
         $result = array('action' => $action, 'message' => str_replace("'", "\\'", $msg), 'error' => str_replace("'", "\\'", $msg), 'success' => $success);
         foreach ($extra as $key => $value) {
             $result[$key] = $value;
         }
         $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON';
         $json = new $classname();
         $jresult = $json->encode($result);
         if (strtolower(extGetParam($_POST, 'requestType')) == 'xmlhttprequest') {
             header("Content-type: text/html");
         }
         print $jresult;
         ext_exit();
     }
     $messagetxt = '';
     if ($extra != NULL) {
         $msg .= " - " . $extra;
     }
     if ($msg != '') {
         ext_Result::add_error($msg);
     }
     if (ext_Result::count_messages() < 1 && ext_Result::count_errors() < 1) {
         return;
     }
     if (ext_Result::count_messages() > 0) {
         $messagetxt .= '<h3>' . $GLOBALS["error_msg"]["message"] . ':</h3>';
         foreach ($_SESSION['ext_message'] as $msgtype) {
             foreach ($msgtype as $message) {
                 $messagetxt .= $message . '<br/>';
             }
             $messagetxt .= '<br /><hr /><br />';
         }
         ext_Result::empty_messages();
         if (!empty($_REQUEST['extra'])) {
             $messagetxt .= ' - ' . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
         }
     }
     if (!empty($_SESSION['ext_error'])) {
         $messagetxt .= '<h3>' . $GLOBALS["error_msg"]["error"] . ':</h3>';
         foreach ($_SESSION['ext_error'] as $errortype) {
             foreach ($errortype as $error) {
                 $messagetxt .= $error . '<br/>';
             }
             $messagetxt .= '<br /><hr /><br />';
         }
         ext_Result::empty_errors();
     }
     if (!empty($_REQUEST['extra'])) {
         $messagetxt .= " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
     }
     extHTML::loadExtJS();
     show_header();
     defined('EXPLORER_NOEXEC') or define('EXPLORER_NOEXEC', 1);
     echo ext_scriptTag('', 'Ext.Msg.alert(\'Status\', \'' . $messagetxt . '\')');
     //}
     $GLOBALS['action'] = 'show_error';
 }
开发者ID:kostya1017,项目名称:our,代码行数:71,代码来源:result.class.php

示例5: onShowLoginForm

    function onShowLoginForm()
    {
        ?>
	{
		xtype: "form",
		<?php 
        if (!ext_isXHR()) {
            ?>
renderTo: "adminForm", <?php 
        }
        ?>
		id: "simpleform",
		labelWidth: 125,
		url:"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
		dialogtitle: "<?php 
        echo ext_Lang::msg('ftp_header');
        ?>
",
		title: "<?php 
        echo ext_Lang::msg('ftp_login_lbl');
        ?>
",
		frame: true,
		keys: {
		    key: Ext.EventObject.ENTER,
		    fn : function(){
				if (Ext.getCmp("simpleform").getForm().isValid()) {
					Ext.get( 'statusBar').update( '<?php 
        echo ext_Lang::msg('ftp_login_check', true);
        ?>
' );
					Ext.getCmp("simpleform").getForm().submit({
						reset: false,
						success: function(form, action) { location.reload() },
						failure: function(form, action) {
							if( !action.result ) return;
							Ext.Msg.alert('<?php 
        echo ext_Lang::err('error', true);
        ?>
', action.result.error);
							Ext.get( 'statusBar').update( action.result.error );
						},
						scope: Ext.getCmp("simpleform").getForm(),
						params: {
							option: "com_extplorer", 
							action: "login",
							type: "ftp",
							file_mode: "ftp"
						}
					});
    	        } else {
        	        return false;
            	}
            }
		},
		items: [{
			xtype: "textfield",
			fieldLabel: "<?php 
        echo ext_Lang::msg('ftp_login_name', true);
        ?>
",
			name: "username",
			width:175,
			allowBlank:false
		},{
			xtype: "textfield",
			fieldLabel: "<?php 
        echo ext_Lang::msg('ftp_login_pass', true);
        ?>
",
			name: "password",
			inputType: "password",
			width:175,
			allowBlank:false
		},{
			xtype: "combo",
			fieldLabel: "<?php 
        echo ext_Lang::msg('ftp_hostname_port', true);
        ?>
",
			hiddenName: "ftp_host",
			triggerAction: "all",
			value: "<?php 
        echo extGetParam($_SESSION, 'ftp_host');
        ?>
",
			store: ["<?php 
        echo implode('","', $GLOBALS['ext_conf']['remote_hosts_allowed']);
        ?>
"],
			width:175,
			editable: false,
			forceSelection: true,
			allowBlank:false
		},
		{
			xtype: "displayfield",
//.........这里部分代码省略.........
开发者ID:chajianku,项目名称:admin_eXtplorer,代码行数:101,代码来源:ftp.php

示例6: sendResult

 function sendResult($action, $success, $msg, $extra = array())
 {
     // show error-message
     if (ext_isXHR()) {
         $success = (bool) $success;
         if ($success && ext_Result::count_errors() > 0) {
             $success = false;
             foreach (@$_SESSION['ext_error'] as $type) {
                 if (is_array($type)) {
                     foreach ($type as $error) {
                         $msg .= '<br >' . $error;
                     }
                 }
             }
         }
         $result = array('action' => $action, 'message' => str_replace("'", "\\'", $msg), 'error' => str_replace("'", "\\'", $msg), 'success' => $success);
         foreach ($extra as $key => $value) {
             $result[$key] = $value;
         }
         $json = new ext_Json();
         $jresult = $json->encode($result);
         print $jresult;
         ext_exit();
     }
     if ($extra != NULL) {
         $msg .= " - " . $extra;
     }
     ext_Result::add_error($msg);
     if (empty($_GET['error'])) {
         session_write_close();
         extRedirect(make_link("show_error", $GLOBALS["dir"], null, null, null, null, '&error=1&extra=' . urlencode($extra)));
     } else {
         show_header($GLOBALS["error_msg"]["error"]);
         echo '<div class="quote">';
         echo '<a href="#errors">' . ext_Result::count_errors() . ' ' . $GLOBALS["error_msg"]["error"] . '</a>, ';
         echo '<a href="#messages">' . ext_Result::count_messages() . ' ' . $GLOBALS["error_msg"]["message"] . '</a><br />';
         echo "</div>\n";
         if (!empty($_SESSION['ext_message'])) {
             echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">[ " . $GLOBALS["error_msg"]["back"] . " ]</a>";
             echo "<div class=\"ext_message\"><a name=\"messages\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["message"] . ":</strong>" . "</h3>\n";
             foreach ($_SESSION['ext_message'] as $msgtype) {
                 foreach ($msgtype as $message) {
                     echo $message . "\n<br/>";
                 }
                 echo '<br /><hr /><br />';
             }
             ext_Result::empty_messages();
             if (!empty($_REQUEST['extra'])) {
                 echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
             }
             echo "</div>\n";
         }
         if (!empty($_SESSION['ext_error'])) {
             echo "<div class=\"ext_error\"><a name=\"errors\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["error"] . ":</strong>" . "</h3>\n";
             foreach ($_SESSION['ext_error'] as $errortype) {
                 foreach ($errortype as $error) {
                     echo $error . "\n<br/>";
                 }
                 echo '<br /><hr /><br />';
             }
             ext_Result::empty_errors();
         }
         echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">" . $GLOBALS["error_msg"]["back"] . "</a>";
         if (!empty($_REQUEST['extra'])) {
             echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES);
         }
         echo "</div>\n";
         defined('EXPLORER_NOEXEC') or define('EXPLORER_NOEXEC', 1);
     }
 }
开发者ID:shamblett,项目名称:janitor,代码行数:70,代码来源:result.class.php


注:本文中的ext_isXHR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。