Esempio n. 1
0
 public function extensionManager($params)
 {
     // Check login
     if (!Core::hasAdminAccess()) {
         return Core::getLoginView($_SERVER['REDIRECT_URL']);
     }
     // View
     $view = new View();
     $view->setSource(Config::get('core.dir.views') . '/core/extension-manager.tpl.php');
     $extName = isset($params[0]) ? $params[0] : NULL;
     $method = isset($params[1]) ? $params[1] : NULL;
     // Get all available extensions
     $extensions = Extension::getAvailableList();
     if (!is_null($extName)) {
         $extensions = isset($extensions[$extName]) ? array($extName => $extensions[$extName]) : array();
     }
     $view->extensions = $extensions;
     // Perform action
     if (!is_null($method)) {
         // no-cache header
         header("Cache-Control: no-cache, must-revalidate");
         header("Expires: Mon, 01 Jan 1977 00:00:00 GMT");
         header("Content-Type: text/xml");
         $result = '<' . '?xml version="1.0"?' . ">\n";
         // Call the defined method, if it exists
         $ext = Extension::getExtensionByName($extName);
         if (method_exists($ext, $method)) {
             if ($returnValue = $ext->{$method}()) {
                 $result .= '<result code="0"><message><![CDATA[Success]]></message>';
                 $result .= '<returnValue><![CDATA[' . json_encode($returnValue) . ']]></returnValue>';
                 $result .= '</result>';
             } else {
                 $entries = SystemLog::getAll();
                 foreach ($entries as &$entry) {
                     $entry = array('typeString' => $entry->getTypeString(), 'message' => $entry->getMessage());
                 }
                 $result .= '<result code="1"><message><![CDATA[Call to ' . get_class($ext) . '::' . $method . '() failed.]]></message>';
                 $result .= '<returnValue><![CDATA[' . json_encode($entries) . ']]></returnValue>';
                 $result .= '</result>';
             }
         } else {
             $result .= '<result code="2"><message><![CDATA[Method ' . get_class($ext) . '::' . $method . '() does not exist.]]></message>';
             $result .= '<returnValue><![CDATA[]]></returnValue>';
             $result .= '</result>';
         }
         // Print result
         print $result;
         Core::shutdown();
     }
     // Result
     return $this->wrapper($view);
 }
Esempio n. 2
0
<?php

/*
# $Id: SystemLog.tpl 155 2007-09-17 10:48:30Z james $
*/
use Buan\SystemLog;
$systemLog = SystemLog::getAll();
if (count($systemLog) > 0) {
    echo '<ul>';
    foreach ($systemLog as $entry) {
        echo '<li>' . strtoupper($entry->getTypeString()) . ': ' . htmlspecialchars($entry->getMessage()) . '</li>';
    }
    echo '</ul>';
}