コード例 #1
0
 public function updateAction()
 {
     Settings::load();
     $languages = Config::get()->languages->list;
     $start_pages = array();
     foreach ($languages as $language_id => $language) {
         $start_page = 0;
         if (isset($_POST['start-page-' . $language_id])) {
             $start_page = $this->sanitizeInteger($_POST['start-page-' . $language_id]);
         }
         $start_pages[$language_id] = $start_page;
     }
     Settings::set('startPages', $start_pages);
     $error_pages = array();
     foreach ($languages as $language_id => $language) {
         $error_page = 0;
         if (isset($_POST['error-page-' . $language_id])) {
             $error_page = $this->sanitizeInteger($_POST['error-page-' . $language_id]);
         }
         $error_pages[$language_id] = $error_page;
     }
     Settings::set('errorPages', $error_pages);
     $use_cache = $this->sanitizeBoolean(Request::postParam('use-cache', false));
     Settings::set('useCache', $use_cache);
     $cache_lifetime = $this->sanitizeInteger(Request::postParam('cache-lifetime', 0));
     Settings::set('cacheLifetime', $cache_lifetime);
     Settings::save();
     $this->success();
 }
コード例 #2
0
 public function updateAction()
 {
     $id = Auth::getUserId();
     $screenname = Request::postParam('screenname', '');
     $login = Request::postParam('login', '');
     $password = Request::postParam('password', '');
     $preferred_language = Request::postParam('preferred-language');
     if (trim($screenname) == '' || trim($login) == '') {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $user = $this->users->getById($id);
     if ($user === false) {
         $this->error(self::RESULT_ERROR_DOES_NOT_EXIST);
         return;
     }
     $res = array('action' => 'update', 'loginAlreadyExists' => true, 'accountUpdated' => false);
     if (!$this->users->loginExists($login, $id)) {
         $res['loginAlreadyExists'] = false;
         $properties = array('screenname' => trim($screenname), 'login' => trim($login), 'preferred-language' => $preferred_language);
         if (trim($password) != '') {
             $properties['password'] = trim($password);
         }
         $updated = $this->users->update($id, $properties);
         if ($updated !== false) {
             $res['accountUpdated'] = true;
         }
     }
     $this->success($res);
 }
コード例 #3
0
 public function getlinkAction()
 {
     // Parameter auslesen
     $link_to_page_id = Request::postParam('linkToPageId');
     $link_to_language_id = Request::postParam('linkToLanguageId');
     $link_to_anchor_name = Request::postParam('linkToAnchorName');
     // Parameter überprüfen
     if (!is_numeric($link_to_page_id) || $link_to_language_id == '') {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $pages = new Pages();
     // Die absolute URL auslesen
     $absolute_url = $pages->getPageUrl($link_to_page_id, $link_to_language_id);
     // eine zum Stammverzeichnis des CMS relative URL daraus machen
     $base_url = Config::get()->baseUrl;
     $relative_url = UTF8String::substr($absolute_url, UTF8String::strlen($base_url), UTF8String::strlen($absolute_url));
     if ($link_to_anchor_name != '') {
         if ($relative_url != '') {
             $relative_url = rtrim($relative_url, '/') . '/';
         }
         $relative_url .= '#' . $link_to_anchor_name;
     }
     // Zurückgeben
     $this->success($relative_url);
 }
コード例 #4
0
 public function updateAction()
 {
     $id = Request::postParam('pageId');
     $jsonData = Request::postParam('jsonData');
     $preview = $this->sanitizeBoolean(Request::postParam('preview'));
     $preview_language_id = Request::postParam('previewLanguageId');
     // �berpr�fen, ob die Lebenswichtigen Parameter gesetzt sind
     if ($id === null || $jsonData === null || $preview === null || $preview_language_id === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     // �berpr�fen, ob die Seite �berhaupt (noch) existiert
     $properties = $this->pages->getProperties($id);
     if ($properties === false) {
         $this->error(self::RESULT_ERROR_DOES_NOT_EXIST);
         return;
     }
     // Nutzerrechte �berpr�fen
     if (!$this->helpers->canAccessPage($id, Acl::ACTION_EDIT)) {
         $this->error(self::RESULT_ERROR_NOT_AUHTORIZED);
         return;
     }
     // Daten der gew�nschten Seite speichern
     if ($this->pages->setData($id, $jsonData) === false) {
         $this->error();
         return;
     }
     // �nderungs-Datum setzen
     $properties = array('last-change-date' => time(), 'last-change-user-id' => Auth::getUserId(), 'last-change-user-name' => Auth::getScreenName());
     $this->pages->setProperties($id, $properties);
     $properties = $this->pages->getProperties($id);
     // Wenn das die Seite mit den globalen Elementen ist,
     // muss sie sofort ver�ffentlich werden und der Cache muss geleert werden,
     // da die �nderungen potenziell die Ausgabe aller Seiten betreffen k�nnte
     if ($properties['template-id'] == Pages::GLOBAL_ELEMENTS) {
         $this->pages->publish($id);
         PageCache::invalidateAll();
     }
     // R�ckgabe
     $res = array('preview' => $preview);
     // Wenn Vorschau-Modus, dann Frontend-URL zur Vorschau-Version der gespeicherten Seite zur�ckgeben
     if ($preview) {
         $res['previewUrl'] = $this->pages->getPageUrl($id, $preview_language_id, $properties) . '?pixelmanager-preview=true';
     }
     // Yo.
     $this->success($res);
 }
コード例 #5
0
 public function getallrowsAction()
 {
     $data_table_class_name = Request::postParam('dataTableClassName');
     $language_id = Request::postParam('languageId');
     if ($data_table_class_name === null || $language_id === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $result = array();
     if (class_exists($data_table_class_name, true)) {
         $data_table = new $data_table_class_name();
         if ($data_table instanceof DataTableInterface) {
             $rows = $data_table->getAllRowsForAssignmentList($language_id);
             if ($rows !== false) {
                 if (is_array($rows)) {
                     $result[] = $rows;
                 }
             }
         }
     }
     $this->success($result);
 }
コード例 #6
0
ファイル: set-timezone.php プロジェクト: LobbyOS/server
<?php

$offset = Request::postParam("offset");
if ($offset !== null) {
    $timeZone = \Lobby\Time::getTimezone($offset);
    if (@date_default_timezone_set($timeZone)) {
        \Lobby\DB::saveOption("lobby_timezone", $timeZone);
    }
}
コード例 #7
0
ファイル: ajax.php プロジェクト: LobbyOS/server
<?php

require "../../../../load.php";
$file = \Request::postParam('cx74e9c6a45', '');
$appID = \Request::postParam('s7c8csw91', '');
if ($file != "" && CSRF::check()) {
    if ($appID !== "") {
        $App = new \Lobby\Apps($appID);
        if ($App->exists && $App->enabled) {
            $AppClass = $App->run();
            $html = $AppClass->page("/ajax/{$file}");
            if ($html === "auto") {
                $html = $AppClass->inc("/src/ajax/{$file}");
            }
            echo $html;
        }
    } else {
        if (\Lobby\FS::exists($file)) {
            require_once \Lobby\FS::loc($file);
        } else {
            echo "fileNotFound";
        }
    }
}
コード例 #8
0
 public function deleterowsAction()
 {
     $json_id_list = Request::postParam('idList');
     if ($json_id_list === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $id_list = json_decode($json_id_list, true);
     if (is_array($id_list)) {
         if (count($id_list) > 0) {
             foreach ($id_list as $id) {
                 $res = $this->getDataTable()->deleteRow($id);
                 if ($res === false) {
                     $this->error(self::RESULT_ERROR_UNKOWN);
                     return;
                 }
             }
         }
     }
     $crud_message_array = $this->getDataTable()->getCrudMessageArray();
     $this->success(array('message' => $crud_message_array['message'], 'messageType' => $crud_message_array['type']));
 }
コード例 #9
0
 function deleteAction()
 {
     $users = Request::postParam('users');
     if ($users === null || !is_array($users)) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     if (count($users) > 0) {
         foreach ($users as $user_id => $value) {
             if ($value == '1') {
                 if (is_numeric($user_id)) {
                     // Verhindern, dass der eingeloggte Administrator sich selber l�scht
                     if ($user_id == Auth::getUserId()) {
                         $this->error(self::RESULT_ERROR_NOT_AUHTORIZED);
                         return;
                     }
                     $this->users->delete($user_id);
                 }
             }
         }
     }
     $this->success();
 }
コード例 #10
0
 public function publishAction()
 {
     // Parameter auslesen
     $elements = Request::postParam('elements');
     $recursive = $this->sanitizeBoolean(Request::postParam('recursive', '0'));
     // Parameter �berpr�fen
     if (!is_array($elements) || $recursive === null) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     // Wenn $elements leer ist, nichts tun
     if (count($elements) == 0) {
         $this->success();
         return;
     }
     // �berpr�fen, ob die zu ver�ffentlichenden Elemente existieren
     $elements_exist = true;
     foreach ($elements as $key => $value) {
         if (is_numeric($value)) {
             $elements[$key] = $this->pages->getProperties($value);
             if ($elements[$key] === false) {
                 $elements_exist = false;
                 break;
             }
         } else {
             $elements_exist = false;
             break;
         }
     }
     // Wenn eines der zu ver�ffentlichenden Elemente jetzt schon nicht mehr existiert, abbrechen
     if (!$elements_exist) {
         $this->error(self::RESULT_ERROR_DOES_NOT_EXIST);
         return;
     }
     // Nutzerrechte �berpr�fen
     if (!$this->helpers->canAccessAllElements($elements, Acl::ACTION_PUBLISH, $recursive)) {
         $this->error(self::RESULT_ERROR_NOT_AUHTORIZED);
         return;
     }
     // OnPageTreeBeginBatchPublishPage ausl�sen
     $parameters = array();
     $data = null;
     Plugins::call(Plugins::PAGETREE_BEGIN_BATCH_PUBLISH_PAGE, $parameters, $data);
     // Ver�ffentlichen
     foreach ($elements as $element) {
         if ($this->publishElements(array($element), $recursive) === false) {
             $this->error();
             return;
         }
     }
     // OnPageTreeEndBatchPublishPage ausl�sen
     $parameters = array();
     $data = null;
     Plugins::call(Plugins::PAGETREE_END_BATCH_PUBLISH_PAGE, $parameters, $data);
     // Cache l�schen (da �nderung am Seitenbaum, die Navigation erscheint i.d.R. auf allen Seiten)
     PageCache::invalidateAll();
     $this->success();
 }
コード例 #11
0
ファイル: index.php プロジェクト: LobbyOS/server
<div class="contents">
  <h1>Indi</h1>
  <p>Make a standalone Lobby app.</p>
  <h2>Config</h2>
  <?php 
$appID = Request::postParam("appID");
if ($appID !== null && CSRF::check()) {
    if ($appID === "") {
        $this->removeData("appID");
    } else {
        $this->saveData("appID", $appID);
    }
    echo sss("Saved", "Settings has been saved.");
}
$appID = $this->getData("appID");
?>
  <form action="<?php 
echo Lobby::u("/admin/app/indi");
?>
" method="POST">
    <label>
      <span>App ID</span>
      <select name="appID">
        <option value="">Choose App:</option>
        <?php 
foreach (Lobby\Apps::getEnabledApps() as $app) {
    echo "<option value='{$app}' " . ($appID === $app ? "selected='selected'" : "") . ">{$app}</option>";
}
?>
      </select>
    </label>
コード例 #12
0
ファイル: saveData.php プロジェクト: LobbyOS/server
<?php

require "../../../../load.php";
$app = Request::postParam('appID');
$key = Request::postParam('key');
$val = Request::postParam('value');
if ($app !== null && $key !== null && $val !== null && CSRF::check()) {
    $App = new Lobby\Apps($app);
    if (!$App->exists) {
        die("bad");
    }
    var_dump($key);
    if (!$App->getInstance()->saveData($key, $val)) {
        die("bad");
    }
} else {
    echo "fieldsMissing";
}
コード例 #13
0
 public function checkoriginalimageAction()
 {
     $original_image = Request::postParam('originalImage');
     if (!is_array($original_image)) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     $result = array('originalImageStillExists' => false, 'originalImageHasStillSameDimensions' => false);
     $absolute_path_to_source = APPLICATION_ROOT . 'user-data/images/' . $original_image['relativeUrl'];
     if (is_file($absolute_path_to_source)) {
         $result['originalImageStillExists'] = true;
         $image = WideImage::load($absolute_path_to_source);
         if ($original_image['width'] == $image->getWidth() && $original_image['height'] == $image->getHeight()) {
             $result['originalImageHasStillSameDimensions'] = true;
         }
     }
     $this->success($result);
 }
コード例 #14
0
 function deleteAction()
 {
     $user_groups = Request::postParam('usergroups');
     if ($user_groups === null || !is_array($user_groups)) {
         $this->error(self::RESULT_ERROR_BAD_REQUEST);
         return;
     }
     if (count($user_groups) > 0) {
         foreach ($user_groups as $user_group_id => $value) {
             if ($value == '1') {
                 if (is_numeric($user_group_id)) {
                     $this->userGroups->delete($user_group_id);
                 }
             }
         }
     }
     $this->success();
 }
コード例 #15
0
if ($page === "new" || $page === "settings") {
    $this->addScript("site-settings.js");
    $editing = $siteID !== null;
    if (!$editing) {
        $siteInfo = array("name" => null, "src" => null, "out" => null, "minHTML" => true, "minPHP" => true, "noComments" => true, "minCSS" => true, "minJS" => true, "minInline" => true, "skipMinFiles" => true);
    }
    if (Request::isPOST()) {
        $siteInfo = array("name" => Request::postParam("siteName"), "src" => Request::postParam("siteSRC"), "out" => Request::postParam("siteOut"), "minHTML" => (int) (Request::postParam("minHTML") !== null), "minPHP" => (int) (Request::postParam("minPHP") !== null), "noComments" => (int) (Request::postParam("noComments") !== null), "minCSS" => (int) (Request::postParam("minCSS") !== null), "minJS" => (int) (Request::postParam("minJS") !== null), "minInline" => (int) (Request::postParam("minInline") !== null), "skipMinFiles" => (int) (Request::postParam("skipMinFiles") !== null));
        if ($siteInfo["name"] == null || $siteInfo["src"] == null || $siteInfo["out"] == null) {
            echo ser("Fields Missing", "Please fill up the entire form.");
        } else {
            /**
             * Add fields that are optional
             */
            $siteInfo["beforeCMD"] = Request::postParam("beforeCMD");
            $siteInfo["afterCMD"] = Request::postParam("afterCMD");
            $id = $siteID === null ? strtolower(preg_replace('/[^\\da-z]/i', '', $siteInfo["name"])) : $siteID;
            $this->data->saveArray("site-{$id}", $siteInfo);
            $this->data->saveArray("sites", array($id => $siteInfo["name"]));
            if ($siteInfo["skipMinFiles"] === 1) {
                $this->data->saveArray("{$siteID}-skip-assets", $this->findMinFiles($siteInfo["src"]));
            }
            echo sss("Site Saved", "Your site was saved. <a href='" . $this->u("/site/{$id}/compress?now") . "'>Compress it now!</a>");
        }
    } else {
        if (!$editing) {
            $siteInfo["beforeCMD"] = null;
            $siteInfo["afterCMD"] = null;
        }
    }
    ?>
コード例 #16
0
ファイル: install-app.php プロジェクト: LobbyOS/server
<?php

use Fr\Process;
$appID = \Request::postParam("id");
if (!CSRF::check()) {
    echo json_encode(array("statusID" => "error", "status" => "CSRF Token didn't match"));
} else {
    if ($appID === null) {
        echo json_encode(array("statusID" => "error", "status" => "Invalid App ID"));
    } else {
        /**
         * A queue of App downloads
         */
        $appInstallQueue = Lobby\DB::getJSONOption("lobby_app_downloads");
        /**
         * If the $appID is in the queue, then give the download status of it
         * If the updated value is less than 20 seconds ago, then restart the download
         */
        if (isset($appInstallQueue[$appID]) && $appInstallQueue[$appID]["updated"] > strtotime("-20 seconds")) {
            echo json_encode(array("statusID" => $appInstallQueue[$appID]["statusID"], "status" => $appInstallQueue[$appID]["status"]));
        } else {
            $appInfo = \Lobby\Server::store(array("get" => "app", "id" => $appID));
            /**
             * App doesn't exist on Lobby Store
             */
            if ($appInfo === "false") {
                echo json_encode(array("status" => "error", "error" => "App Doesn't Exist"));
            } else {
                $appName = $appInfo["name"];
                $Process = new Process(Process::getPHPExecutable(), array("arguments" => array(L_DIR . "/admin/ajax/install-app-bg.php", \Lobby::getLID(), base64_encode(serialize($_SERVER)), $appID)));
                /**
コード例 #17
0
<?php

$siteID = Request::postParam("siteID");
$siteInfo = $this->getSiteInfo($siteID);
if ($siteInfo) {
    $this->removeData("log");
    $Process = new Fr\Process(Fr\Process::getPHPExecutable(), array("arguments" => array(0 => L_DIR . '/lobby.php', 1 => "app", "--a" => "site-compressor", "--i" => "src/ar/compress-bg.php", "--data" => "siteID={$siteID}")));
    $that = $this;
    $command = $Process->start(function () use($that) {
        echo "started";
    });
    $this->log("Command executed for compression : {$command}");
}
コード例 #18
0
ファイル: install.php プロジェクト: LobbyOS/server
 if ($install_step === "3" && CSRF::check()) {
     $db_type = Request::get("db_type");
     /**
      * We call it again, so that the user had already went through the First Step
      */
     if (\Lobby\Install::step1() === false) {
         // The stuff mentioned in step 1 hasn't been done
     } else {
         if (isset($_POST['submit'])) {
             if ($db_type === "mysql") {
                 $dbhost = \Request::postParam('dbhost', "");
                 $dbport = \Request::postParam('dbport', "");
                 $dbname = \Request::postParam('dbname', "");
                 $username = \Request::postParam('dbusername', "");
                 $password = \Request::postParam('dbpassword', "");
                 $prefix = \Request::postParam('prefix', "");
                 if ($dbhost === "" || $dbport === "" || $dbname === "" || $username === "") {
                     echo ser("Empty Fields", "Buddy, you left out some details.<cl/>" . \Lobby::l("/admin/install.php?step=3&db_type=mysql" . CSRF::getParam(), "Try Again", "class='btn orange'"));
                 } else {
                     /**
                      * We give the database config to the Install Class
                      */
                     \Lobby\Install::dbConfig(array("host" => $dbhost, "port" => $dbport, "dbname" => $dbname, "username" => $username, "password" => $password, "prefix" => $prefix));
                     /**
                      * First, check if prefix is valid
                      * Check if connection to database can be established using the credentials given by the user
                      */
                     if ($prefix == "" || preg_match("/[^0-9,a-z,A-Z,\$,_]+/i", $prefix) != 0 || strlen($prefix) > 50) {
                         echo ser("Error", "The Prefix should only contain alphabets, digits (0-9), dollar or underscore and shouldn't exceed 50 characters.<cl/>" . \Lobby::l("/admin/install.php?step=3&db_type=mysql" . CSRF::getParam(), "Try Again", "class='btn orange'"));
                     } else {
                         if (\Lobby\Install::checkDatabaseConnection() !== false) {
コード例 #19
0
ファイル: filepicker.php プロジェクト: LobbyOS/server
                $folder = $_POST['folder'] ? $_POST['folder'] : 'New Folder';
                $fp->new_folder($dir, $folder);
                break;
            */
        /*
          case 'new':
            $dir = $_POST['dir'] ? $_POST['dir'] : '/';
            $folder = $_POST['folder'] ? $_POST['folder'] : 'New Folder';
            $fp->new_folder($dir, $folder);
            break;
        */
        default:
            $filter = \Request::get('filter');
            $filters = '';
            $filters = $fp->get_filters($filter);
            $dir = makeOSPath(\Request::postParam("dir", "/"));
            $dir_b64 = base64_encode($dir);
            ob_start();
            ?>
      <div class="Lobby-FS-filepicker-picker-nav">
        <table cellspacing="0" cellpadding="0"><tr>
          <td class="label"><label><?php 
            _e('Folder');
            ?>
</label></td>
          <td>
            <input type="text" id="target_dir_path" value="<?php 
            echo $dir_b64;
            ?>
" />
            <input type="hidden" id="target_dir" value="Lw==" />
コード例 #20
0
ファイル: update.php プロジェクト: LobbyOS/server
            echo ser("Lobby Directory Not Writable", "The Lobby directory (" . L_DIR . ") is not writable. Make the folder writable to update Lobby.");
        }
        ?>
            <p>
              Looks like everything is ok. Hope you backed up Lobby installation & Database.
              <div clear></div>
              You can update now.
            </p>
          <?php 
        echo \Lobby::l("/admin/update.php?step=2" . CSRF::getParam(), "Start Update", "clear class='btn green'");
    } elseif ($step == 2) {
        $version = Lobby\DB::getOption("lobby_latest_version");
        echo '<iframe src="' . L_URL . "/admin/download.php?type=lobby" . CSRF::getParam() . '" style="border: 0;width: 100%;height: 200px;"></iframe>';
    }
}
$shouldUpdate = Request::postParam("updateApp");
if ($action === "updateApps" && is_array($shouldUpdate) && CSRF::check()) {
    foreach ($shouldUpdate as $appID) {
        echo '<iframe src="' . L_URL . "/admin/download.php?type=app&app={$appID}&isUpdate=1" . CSRF::getParam() . '" style="border: 0;width: 100%;height: 200px;"></iframe>';
    }
}
if ($step === null) {
    echo "<h2>Apps</h2>";
}
$appUpdates = Update::getApps();
if ($step === null && empty($appUpdates)) {
    echo "<p>All apps are up to date.</p>";
} else {
    if ($step === null && isset($appUpdates) && count($appUpdates)) {
        ?>
          <p>New versions of apps are available. Choose which apps to update from the following :</p>