Example #1
0
/**
 * Show Error Messages
 */
function ser($title = null, $description = "")
{
    $html = "";
    if ($title === null) {
        Response::showError();
    } else {
        $html .= "<div class='message'>";
        $html .= "<div style='color:red;' class='title'>{$title}</div>";
        if ($description != "") {
            $html .= "<div style='color:red;'>{$description}</div>";
        }
        $html .= "</div>";
    }
    return $html;
}
Example #2
0
 /**
  * Add message to log files 
  */
 public static function log($msg = null, $file = "lobby.log")
 {
     /**
      * If $msg is an array, it means the errors are SERIOUS
      * Array(
      *   0 => "Type of Error",
      *   1 => "Message"
      * )
      */
     if (is_array($msg)) {
         $type = $msg[0];
         $logMSG = ucfirst($type) . " Error - " . $msg[1];
     } else {
         if (self::$debug === false) {
             return false;
         }
     }
     if ($msg != null) {
         $logMSG = !is_string($msg) ? serialize($msg) : $msg;
     }
     /**
      * Write to Log File
      */
     if ($msg != null) {
         $logFile = "/contents/extra/logs/{$file}";
         /**
          * Format the log message 
          */
         $logMSG = "[" . date("Y-m-d H:i:s") . "] {$logMSG}";
         \Lobby\FS::write($logFile, $logMSG, "a");
     }
     /**
      * If error is Fatal, Lobby can't work
      * So register error in class
      */
     if (isset($type) && $type === "fatal") {
         Response::showError(ucfirst($msg[0]) . " Error", $msg[1]);
     }
 }
Example #3
0
<?php

/**
 *
 * index.php file for LobbyOS
 *
 * A localhost/Web OS For Web Apps: http://lobby.subinsb.com
 *
 * @category   lobby
 * @package    lobby
 * @author     The LobbyOS developer community
 * @license    Apache License
 * @version    0.2.1
 */
require_once __DIR__ . "/load.php";
use Lobby\Router;
/**
 * Dispatch the Routes
 */
Router::dispatch();
if (!Router::$routeActive) {
    if (\Response::hasContent()) {
        \Response::send();
    } else {
        if (Router::pathExists()) {
            return false;
        } else {
            \Response::showError();
        }
    }
}
Example #4
0
use Lobby\FS;
use Lobby\Need;
$appID = Request::get("app");
$action = Request::get("action");
/**
* Whether the app info should be shown
*/
$showAppInfo = true;
/**
* Whether this is a request to show a message
*/
$show = Request::get("show") !== null;
if ($appID != null) {
    $App = new Apps($appID);
    if (!$App->exists) {
        Response::showError("Error", "I checked all over, but the app does not exist");
    }
    $appIDEscaped = htmlspecialchars($appID);
}
if (!$show && $action !== null && CSRF::check()) {
    if ($action === "disable") {
        if ($App->disableApp()) {
            Response::redirect("/admin/apps.php?app={$appID}&action=disable&show=1" . CSRF::getParam());
        } else {
            Response::redirect("/admin/apps.php?app={$appID}&action=disable-fail&show=1" . CSRF::getParam());
        }
    } else {
        if ($action === "enable") {
            if ($App->enableApp()) {
                Response::redirect("/admin/apps.php?app={$appID}&action=enable&show=1" . CSRF::getParam());
            } else {