Overview

Namespaces

  • Alpha
    • Controller
      • Front
    • Exception
    • Model
      • Type
    • Task
    • Util
      • Backup
      • Cache
      • Code
        • Highlight
        • Metric
      • Config
      • Convertor
      • Email
      • Extension
      • Feed
      • File
      • Graph
      • Helper
      • Http
        • Filter
        • Session
      • Image
      • Logging
      • Search
      • Security
    • View
      • Renderer
        • Html
        • Json
      • Widget

Classes

  • ActiveRecordController
  • ArticleController
  • AttachmentController
  • CacheController
  • Controller
  • DEnumController
  • ExcelController
  • FeedController
  • GenSecureQueryStringController
  • ImageController
  • IndexController
  • InstallController
  • ListActiveRecordsController
  • LogController
  • LoginController
  • LogoutController
  • MetricController
  • PhpinfoController
  • RecordSelectorController
  • SearchController
  • SequenceController
  • TagController

Interfaces

  • ControllerInterface
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Alpha\Controller;
  4: 
  5: use Alpha\Util\Logging\Logger;
  6: use Alpha\Util\Config\ConfigProvider;
  7: use Alpha\Util\Http\Request;
  8: use Alpha\Util\Http\Response;
  9: use Alpha\Util\Http\Session\SessionProviderFactory;
 10: use Alpha\View\View;
 11: use Alpha\Controller\Front\FrontController;
 12: 
 13: /**
 14:  * Login controller that adds the current user object to the session.
 15:  *
 16:  * @since 2.0.3
 17:  *
 18:  * @author John Collins <dev@alphaframework.org>
 19:  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
 20:  * @copyright Copyright (c) 2016, John Collins (founder of Alpha Framework).
 21:  * All rights reserved.
 22:  *
 23:  * <pre>
 24:  * Redistribution and use in source and binary forms, with or
 25:  * without modification, are permitted provided that the
 26:  * following conditions are met:
 27:  *
 28:  * * Redistributions of source code must retain the above
 29:  *   copyright notice, this list of conditions and the
 30:  *   following disclaimer.
 31:  * * Redistributions in binary form must reproduce the above
 32:  *   copyright notice, this list of conditions and the
 33:  *   following disclaimer in the documentation and/or other
 34:  *   materials provided with the distribution.
 35:  * * Neither the name of the Alpha Framework nor the names
 36:  *   of its contributors may be used to endorse or promote
 37:  *   products derived from this software without specific
 38:  *   prior written permission.
 39:  *
 40:  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 41:  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 42:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 43:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 44:  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 45:  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 46:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 47:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 48:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 49:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 50:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 51:  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 52:  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 53:  * </pre>
 54:  */
 55: class PhpinfoController extends Controller implements ControllerInterface
 56: {
 57:     /**
 58:      * Trace logger.
 59:      *
 60:      * @var Alpha\Util\Logging\Logger
 61:      *
 62:      * @since 2.0.3
 63:      */
 64:     private static $logger = null;
 65: 
 66:     /**
 67:      * constructor to set up the object.
 68:      *
 69:      * @since 2.0.3
 70:      */
 71:     public function __construct()
 72:     {
 73:         self::$logger = new Logger('PhpinfoController');
 74:         self::$logger->debug('>>__construct()');
 75: 
 76:         $config = ConfigProvider::getInstance();
 77: 
 78:         // ensure that the super class constructor is called, indicating the rights group
 79:         parent::__construct('Admin');
 80: 
 81:         // set up the title and meta details
 82:         $this->setTitle('Information about the PHP installation');
 83: 
 84:         self::$logger->debug('<<__construct');
 85:     }
 86: 
 87:     /**
 88:      * Handle GET requests.
 89:      *
 90:      * @param Alpha\Util\Http\Request $request
 91:      *
 92:      * @return Alpha\Util\Http\Response
 93:      *
 94:      * @since 2.0.3
 95:      */
 96:     public function doGET($request)
 97:     {
 98:         self::$logger->debug('>>doGET($request=['.var_export($request, true).'])');
 99: 
100:         if ($request->getParam('displayphpinfo') != null) {
101: 
102:             ob_start();
103:             phpinfo();
104:             $body = ob_get_contents();
105: 
106:         } else {
107: 
108:             $body = View::displayPageHead($this);
109: 
110:             $url = FrontController::generateSecureURL('act=Alpha\Controller\PhpinfoController&displayphpinfo=true');
111: 
112:             $body .= '<iframe src="'.$url.'" style="border:none; overflow-x: scroll; overflow-y: scroll; width:100%; height:100vh;"></iframe>';
113: 
114:             $body .= View::displayPageFoot($this);
115: 
116:         }
117: 
118:         self::$logger->debug('<<doGET');
119: 
120:         return new Response(200, $body, array('Content-Type' => 'text/html', 'X-Frame-Options' => 'SAMEORIGIN'));
121:     }
122: }
Alpha Framework 2.0.4 API Documentation API documentation generated by ApiGen 2.8.0