コード例 #1
0
 public function index()
 {
     $obj = ser($this->_get('param'), 1);
     $p = isset($obj->p) ? intval($obj->p) : 1;
     $this->assign('obj', $obj);
     $this->display();
 }
コード例 #2
0
 public function personsave()
 {
     if (IS_POST) {
         if ($this->_post("per_id") == '') {
             if ($this->Cusperson->create()) {
                 $biry = $this->_post("biryear") == '' ? '0000' : $this->_post("biryear");
                 $this->Cusperson->birthday = $biry . '-' . $this->_post("birday");
                 if ($this->Cusperson->add()) {
                     $this->success("新增成功!", U("Dcusperson/personadd", 'param=' . json_encode(ser($this->_post('param'), 1)) . '&menuid=' . $this->_post('menuid') . '&id=' . $this->_post('id') . '&t=' . $this->_post('t')));
                 } else {
                     $this->error("新增失败!");
                 }
             } else {
                 $this->error($this->Cusperson->getError());
             }
         } else {
             if ($this->Cusperson->create()) {
                 $biry = $this->_post("biryear") == '' ? '0000' : $this->_post("biryear");
                 $this->Cusperson->birthday = $biry . '-' . $this->_post("birday");
                 if ($this->Cusperson->save() !== false) {
                     $this->success("更新成功!", U("Dcusperson/personadd", 'param=' . json_encode(ser($this->_post('param'), 1)) . '&menuid=' . $this->_post('menuid') . '&id=' . $this->_post('id') . '&t=' . $this->_post('t')));
                 } else {
                     $this->error("更新失败!");
                 }
             } else {
                 $this->error($this->Cusperson->getError());
             }
         }
     }
 }
コード例 #3
0
 public function personsave()
 {
     if (IS_POST) {
         if ($this->_post("per_id") == '') {
             if ($this->Cusperson->create()) {
                 $this->Cusperson->opr_name = AppframeAction::$Cache['User']['username'];
                 $this->Cusperson->opr_time = date('Y-m-d H:i:s');
                 if ($this->Cusperson->add()) {
                     $this->success("新增成功!", U("Dwtfzhmsg/personadd", 'param=' . json_encode(ser($this->_post('param'), 1)) . '&menuid=' . $this->_post('menuid') . '&id=' . $this->_post('id') . '&t=' . $this->_post('t')));
                 } else {
                     $this->error("新增失败!");
                 }
             } else {
                 $this->error($this->Cusperson->getError());
             }
         } else {
             if ($this->Cusperson->create()) {
                 $this->Cusperson->opr_name = AppframeAction::$Cache['User']['username'];
                 $this->Cusperson->opr_time = date('Y-m-d H:i:s');
                 if ($this->Cusperson->save() !== false) {
                     $this->success("更新成功!", U("Dwtfzhmsg/personadd", 'param=' . json_encode(ser($this->_post('param'), 1)) . '&menuid=' . $this->_post('menuid') . '&id=' . $this->_post('id') . '&t=' . $this->_post('t')));
                 } else {
                     $this->error("更新失败!");
                 }
             } else {
                 $this->error($this->Cusperson->getError());
             }
         }
     }
 }
コード例 #4
0
ファイル: CSRF.php プロジェクト: LobbyOS/server
 /**
  * Check if CSRF token matches
  */
 public static function check($echo = true)
 {
     if (self::$token === Request::get("csrfToken")) {
         return true;
     } else {
         if ($echo) {
             echo ser("Error", "CSRF Token doesn't match. Try again.");
         }
         return false;
     }
 }
コード例 #5
0
ファイル: Helpers.php プロジェクト: saviobosco/lobby
 /**
  * CSRF token check
  */
 public static function csrf($type = false)
 {
     if ($type == "s") {
         // Output as string
         return urlencode($_COOKIE['csrf_token']);
     } elseif ($type == "g") {
         // Output as a GET parameter
         return "&csrf_token=" . urlencode($_COOKIE['csrf_token']);
     } elseif ($type !== false) {
         // Output as an input field
         echo "<input type='hidden' name='csrf_token' value='{$_COOKIE['csrf_token']}' />";
     } else {
         // Check CSRF validity
         if ($_COOKIE['csrf_token'] == self::input('csrf_token')) {
             return true;
         } else {
             ser("Error", "CSRF Token doesn't match. Try again.");
             return false;
         }
     }
 }
コード例 #6
0
ファイル: new-app.php プロジェクト: LobbyOS/server
<?php

$this->setTitle("New App");
?>
<div class="contents">
  <h1>Add App</h1>
  <?php 
$app_info = array("id" => \Request::get("app_id"), "name" => \Request::get("app_name"), "git_url" => \Request::get("app_download"), "requires" => \Request::get("app_requires"), "short_description" => \Request::get("app_short_description"), "description" => \Request::get("app_description"), "category" => \Request::get("app_category"), "sub_category" => \Request::get("app_sub_category"), "version" => \Request::get("app_version"), "page" => \Request::get("app_page"), "author_id" => \Request::get("author_id"));
if (isset($_POST['app_id']) && array_search(null, $app_info) === false && CSRF::check()) {
    $apps_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps` WHERE `id` = ?");
    $apps_sql->execute(array($app_info['id']));
    if ($apps_sql->fetchColumn() != 0) {
        ser("App Exists", "Hmmm... Looks like the App ID you submitted already exists either on App Center Or in the App Queue. " . \Lobby::l("/apps/{$app_info['id']}", "See Existing App"));
    } else {
        $app_info["logo"] = isset($_POST["app_logo"]) ? "1" : "0";
        $lobby_web = isset($_POST['app_lobby_web']) ? 1 : 0;
        $sql = \Lobby\DB::getDBH()->prepare("INSERT INTO `apps` (`id`, `name`, `version`, `logo`, `requires`, `git_url`, `description`, `short_description`, `category`, `sub_category`, `app_page`, `author`, `lobby_web`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW());");
        $sql->execute(array($app_info['id'], $app_info['name'], $app_info['version'], $app_info['logo'], $app_info['requires'], $app_info['git_url'], $app_info['description'], $app_info['short_description'], $app_info['category'], $app_info['sub_category'], $app_info['page'], $app_info['author_id'], $lobby_web));
        require_once __DIR__ . "/../../inc/LobbyGit.php";
        $LG = new LobbyGit($app_info["id"], $app_info["git_url"]);
        $LG->register();
        sss("App Added", "App was added to the repository");
    }
}
?>
  <form action="<?php 
echo \Lobby::u();
?>
" method="POST">
    <label>
      <span>App ID</span>
コード例 #7
0
ファイル: change-password.php プロジェクト: LobbyOS/server
$this->setTitle("Change Password");
?>
<div class="contents">
  <h2>Change Password</h2>
  <?php 
if (isset($_POST['change_password'])) {
    $curPass = $_POST['current_password'];
    $newPass = $_POST['new_password'];
    $retypePass = $_POST['retype_password'];
    if ($curPass != null && $newPass != null && $retypePass != null) {
        if (!\Fr\LS::login("admin", $curPass, false, false)) {
            echo ser("Login Failed", "Couldn't login to your account to change password.");
        } else {
            if ($newPass !== $retypePass) {
                echo ser("Passwords Doesn't match"), "The passwords you entered didn't match. Try again.</p></p>";
            } else {
                $changePass = \Fr\LS::changePassword($newPass);
                if ($changePass === true) {
                    echo sss("Password Changed Successfully", "Your password was updated.");
                }
            }
        }
    } else {
        echo "<p><h2>Password Fields was blank</h2><p>Form fields were left blank</p></p>";
    }
}
?>
  <form action="<?php 
echo \Lobby::u();
?>
コード例 #8
0
ファイル: Router.php プロジェクト: saviobosco/lobby
 public static function statusRoutes()
 {
     /**
      * The default 404 page
      */
     self::$router->onHttpError(function ($code, $router) {
         if ($code == 404) {
             ser();
         }
     });
 }
コード例 #9
0
ファイル: Install.php プロジェクト: saviobosco/lobby
 /**
  * Make the config.php file
  */
 public static function makeConfigFile()
 {
     $lobbyID = self::randStr(10) . self::randStr(15) . self::randStr(20);
     // Lobby Global ID
     $lobbySID = hash("sha512", self::randStr(15) . self::randStr(30));
     // Lobby Secure ID
     $configFileLoc = L_DIR . "/config.php";
     $cfg = self::$database;
     /* Make the configuration file */
     $config_sample = \Lobby\FS::get("/includes/lib/core/Inc/config-sample.php");
     $config_file = $config_sample;
     $config_file = preg_replace("/host'(.*?)'(.*?)'/", "host'\$1'{$cfg['host']}'", $config_file);
     $config_file = preg_replace("/port'(.*?)'(.*?)'/", "port'\$1'{$cfg['port']}'", $config_file);
     $config_file = preg_replace("/username'(.*?)''/", "username'\$1'{$cfg['username']}'", $config_file);
     $config_file = preg_replace("/password'(.*?)''/", "password'\$1'{$cfg['password']}'", $config_file);
     $config_file = preg_replace("/dbname'(.*?)''/", "dbname'\$1'{$cfg['dbname']}'", $config_file);
     $config_file = preg_replace("/lobbyID'(.*?)''/", "lobbyID'\$1'{$lobbyID}'", $config_file);
     $config_file = preg_replace("/secureID'(.*?)''/", "secureID'\$1'{$lobbySID}'", $config_file);
     $config_file = preg_replace("/prefix'(.*?)'(.*?)'/", "prefix'\$1'{$cfg['prefix']}'", $config_file);
     /**
      * Create the config.php file
      */
     if (\Lobby\FS::write($configFileLoc, $config_file) === false) {
         ser("Failed Creating Config File", "Something happened while creating the file. Perhaps it was something that you did ?");
     } else {
         chmod(L_DIR . "/config.php", 0550);
     }
 }
コード例 #10
0
ファイル: me.php プロジェクト: LobbyOS/server
 if (isset($_POST['app_name'])) {
     $app_info_required = array("id" => $app_edit ? $path[3] : \Request::get("app_id"), "name" => \Request::get("app_name"), "git_url" => \Request::get("app_src"), "description" => \Request::get("app_description"), "category" => \Request::get("app_category"), "sub_category" => \Request::get("app_sub_category"), "app_page" => \Request::get("app_page"));
     $app_info = array_merge($app_info, $app_info_required);
     $app_info["lobby_web"] = isset($_POST["app_lobby_web"]) ? "1" : "0";
     $app_info["logo"] = isset($_POST["app_logo"]) ? "1" : "0";
 }
 if (isset($_POST['app_name']) && CSRF::check() && array_search(null, $app_info_required) === false) {
     $apps_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps` WHERE `id` = ?");
     $apps_sql->execute(array($app_info['id']));
     $queue_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps_queue` WHERE `id` = ?");
     $queue_sql->execute(array($app_info['id']));
     if ($app_edit != true && ($queue_sql->fetchColumn() != 0 || $apps_sql->fetchColumn() != 0)) {
         ser("App Exists", "Hmmm... Looks like the App ID you submitted already exists either on App Center Or in the App Queue. " . \Lobby::l("/apps/{$app_info['id']}", "See Existing App"));
     } else {
         if ($app_edit != true && preg_match("/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i", $app_info['git_url']) == 0) {
             ser("Invalid URL", "The app's source code URL you provided was invalid.");
         } else {
             if ($app_edit != true) {
                 $sql = \Lobby\DB::getDBH()->prepare("INSERT INTO `apps_queue` (`id`, `name`, `src`, `description`, `category`, `sub_category`, `app_page`, `author`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW());");
                 $sql->execute(array($app_info['id'], $app_info['name'], $app_info['git_url'], $app_info['description'], $app_info['category'], $app_info['sub_category'], $app_info['app_page'], \Fr\LS2::$user));
                 $admin_access_token = \Fr\LS2::getUser("username", 1);
                 require_once $this->dir . "/src/inc/open.auth.php";
                 $Opth = new OpenAuth("EAtGbLfgxiCJxhwWfsLsyxA0p8Zj4oUyOd4POaVc", "80d23edfa535caf4cc44b91e16c55c0f09e3bed927fecff96b092df0f517f410");
                 $Opth->action("email", array("subject" => "Lobby App Review", "body" => "Dude, a person requested to review her/his app ({$app_info['id']}). Please go and check it. http://lobby.subinsb.com"), $admin_access_token);
                 sss("App Submitted", "Your app was added to the review queue. You will be notified by email about your app's review status.");
             } else {
                 $sql = \Lobby\DB::getDBH()->prepare("UPDATE `apps` SET `name` = ?, `logo` = ?, `description` = ?, `category` = ?, `sub_category` = ?, `app_page` = ?, `lobby_web` = ?, `updated` = NOW() WHERE `id` = ? AND `author` = ?");
                 $sql->execute(array($app_info['name'], $app_info['logo'], $app_info['description'], $app_info['category'], $app_info['sub_category'], $app_info['app_page'], $app_info['lobby_web'], $app_info['id'], \Fr\LS2::$user));
                 sss("Updated", "Your app was successfully updated.");
             }
         }
コード例 #11
0
ファイル: personadd.php プロジェクト: BGCX262/ztoa-svn-to-git
                        <tr>

                            <th class="w10 aright">状态{:C("separator");}</th>
                            <td class="w90">{$sel:sts}</td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <?php 
if ($menurole['a_m'] == 'Y') {
    ?>
<button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">确定</button><?php 
}
?>
                                <input type="button" class="btn btn_submit mr10 J_ajax_submit_btn" value="返回联系人列表" onclick="backcuslist();">
                                <!--<input type="button" class="btn btn_submit mr10 J_ajax_submit_btn" value="返回客户资料列表" onclick="window.location.href='<?php 
echo U($menuinfo['model'] . '/index', 'parentid=0&menuid=' . $menuinfo[id] . '&param=' . ser($param) . '&t=a');
?>
'">-->
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="btn_wrap">
            <div class="btn_wrap_pd">

            </div>
        </div>
コード例 #12
0
ファイル: pop.php プロジェクト: philum/cms
function alert_user($user)
{
    list($qmail, $pss) = ser("mail,pass", $_SESSION['qdu'] . ' WHERE name="' . $user . '"');
    $subj = "{$qb} - tentative de login";
    $txt = 'rappel de vos identifiants:
login: '******', passw: ' . $pss . '
--
' . host();
    $adminmail = $_SESSION['qbin']['adminmail'];
    $tet = "From: {$adminmail} \n";
    mail($qmail, $subj, $txt, $tet);
    return lj('small', "valid_loged", "password sent to user {$user} {$qmail}");
}
コード例 #13
0
ファイル: boot.php プロジェクト: philum/cms
function alternate_design($node_clr)
{
    $_SESSION['switch'] = 1;
    $_SESSION['tab'] = '';
    define_mods($node_clr);
    $qbinb = ser("rstr,config", $_SESSION['qdu'] . ' WHERE name="' . $node_clr . '"');
    $prmb = explode('#', $qbinb["config"]);
    $_SESSION['prmb'] = prmb_defaults($prmb);
    $_SESSION['node_clr'] = $node_clr;
    $_SESSION['rstr'] = strsplit($qbinb['rstr']);
}
コード例 #14
0
ファイル: new-master.php プロジェクト: saviobosco/lobby
if (isset($_POST['keyring_id']) && isset($_POST['keyring_name']) && isset($_POST['keyring_password']) && isset($_POST['keyring_retyped_password'])) {
    $id = strtolower($_POST['keyring_id']);
    $name = $_POST['keyring_name'];
    $pass = $_POST['keyring_password'];
    $desc = $_POST['keyring_description'];
    if (!ctype_alpha($id)) {
        ser("Invalid ID", "Keyring ID should onlt contain alphabets");
    } elseif (strlen($pass) < 6) {
        ser("Invalid Password", "A password should have minimum characters of 6. Your's doesn't even have 6 characters.");
    } elseif ($pass != $_POST['keyring_retyped_password']) {
        ser("Passwords Mismatch", "The passwords you entered didn't match. Please try again.");
    } else {
        if ($this->MasterAdd($id, $name, $desc, $pass)) {
            sss("Created KeyRing", "Your keyring was successfulyl created.");
        } else {
            ser("KeyRing Exists", "The keyring with the ID you gave already exists");
        }
    }
}
?>
  <form method='POST' action='<?php 
echo APP_URL;
?>
/new-master'>
    <label>
      <span>ID</span>
      <input type='text' name='keyring_id' placeholder='A unique KeyRing ID. Lowercase ALPHABETS Only' />
    </label>
    <label>
      <span>Name</span>
      <input type='text' name='keyring_name' placeholder='KeyRing Name. Whitespaces allowed' />
コード例 #15
0
ファイル: index.php プロジェクト: anandubajith/lobby
<?php

require_once __DIR__ . "/load.php";
$GLOBALS['workspaceHTML'] = "";
/**
 * Dispatch the Routes
 */
\Lobby\Router::dispatch();
if (!isset($GLOBALS['route_active'])) {
    if ($GLOBALS['workspaceHTML'] != "" || is_array($GLOBALS['workspaceHTML'])) {
        require_once L_DIR . "/includes/lib/core/Inc/page.php";
    } else {
        ser();
    }
}
コード例 #16
0
ファイル: modules.php プロジェクト: LobbyOS/server
$app_modules = \Lobby\Modules::get("app");
echo "<h3>Custom Modules</h3>";
echo "Manually installed modules are 'custom modules'";
if (count($custom_modules) == 0) {
    echo ser("No Custom Modules", "No custom modules are enabled or installed", false);
} else {
    echo "<ul>";
    foreach ($custom_modules as $module) {
        echo "<li data-loc='{$module['location']}'>{$module['id']}</li>";
    }
    echo "</ul><p>To disable a <b>custom module</b>, create a 'disabled.txt' file in the module directory</p>";
}
echo "<h3>App Modules</h3>";
echo "<p>The modules loaded by Apps</p>";
if (count($app_modules) == 0) {
    echo ser("No App Modules", "No app's modules are enabled or installed", false);
} else {
    echo "<ul>";
    foreach ($app_modules as $module) {
        echo "<li data-loc='{$module['location']}'>{$module['id']}</li>";
    }
    echo "</ul>";
}
echo "<h3>Core Modules</h3>";
echo "<p>These modules can't be removed and is part of the Lobby Core.</p>";
echo "<ul>";
foreach ($core_modules as $module) {
    echo "<li data-loc='{$module['location']}'>{$module['id']}</li>";
}
echo "</ul>";
?>
コード例 #17
0
ファイル: install.php プロジェクト: saviobosco/lobby
                \Lobby\Install::makeConfigFile();
                /**
                 * Create Tables
                 */
                if (\Lobby\Install::makeDatabase($prefix)) {
                    sss("Success", "Database Tables and configuration file was successfully created.");
                    /**
                     * Enable app lEdit
                     */
                    \Lobby::$installed = true;
                    \Lobby\DB::init();
                    $App = new \Lobby\Apps("ledit");
                    $App->enableApp();
                    echo '<cl/><a href="?step=3" class="button">Proceed</a>';
                } else {
                    ser("Unable To Create Database Tables", "Are there any tables with the same name ? Or Does the user have the permissions to create tables ?<cl/>The <b>config.php</b> file is created. To try again, remove the <b>config.php</b> file and click the button. <cl/>" . \Lobby::l("/admin/install.php?step=2", "Try Again", "class='button'"));
                }
            }
        } else {
            ?>
              <h2 style="margin-top: -20px;">Database Configuration</h2>
              <form action="<?php 
            \Lobby::u();
            ?>
" method="POST">
                 <table>
                  <tbody>
                    <tr>
                      <td>Database Host</td>
                      <td>
                        <input type="text" name="dbhost" value="localhost">
コード例 #18
0
function update_groups($table, $ID, $flag = null)
{
    ///echo $ID;
    $tables = array('_formulize_entry_owner_groups' => 'groupid/owner_id/16', '_formulize_group_filters' => 'groupid/filterid/18', '_formulize_groupscope_settings' => 'groupid/groupscope_id/21', '_2formulize_groupscope_settings' => 'view_groupid/groupscope_id/22', '_group_lists' => 'gl_groups/gl_id/24', '_formulize_notification_conditions' => 'not_cons_groupid/not_cons_id/30', '_formulize_saved_views' => 'sv_pubgroups/sv_id/34', '_formulize' => 'ele_display/ele_id/11', '_2formulize' => 'ele_disabled/ele_id/12', '_group_permission' => 'gperm_groupid/gperm_id/57');
    $f;
    //echo $tables[$table];
    switch ($flag) {
        case null:
            $fields = explode('/', $tables[$table]);
            break;
        case 1:
            $tb = "_formulize_groupscope_settings";
            $fields = explode('/', $tables[$tb]);
            break;
        case 2:
            $tb = "_2formulize_groupscope_settings";
            $fields = explode('/', $tables[$tb]);
            break;
        case 3:
            $tb = "_formulize";
            $fields = explode('/', $tables[$tb]);
            break;
        case 4:
            $tb = "_2formulize";
            $fields = explode('/', $tables[$tb]);
            break;
    }
    $table1 = Prefix . $table;
    //	echo $table;
    $conn = new Connection();
    $Query = $conn->connect()->prepare("SELECT " . $fields[0] . " from " . $table1 . " where " . $fields[1] . " =:id");
    $Query->bindValue(":id", $ID);
    $Query->execute();
    $result = $Query->fetch(\PDO::FETCH_ASSOC);
    if (strstr($result[$fields[0]], ',')) {
        //echo "Here in F 1";
        $f = 1;
    }
    $result = explode(',', $result[$fields[0]]);
    foreach ($result as $k => $d) {
        if (formIdMap(2, "Group_Map_Auto", $d) != null) {
            //To Update The Create New Group
            $grpID_N = formIdMap(2, "Group_Map_Auto", $d);
            if (empty($f)) {
                Post_Process($ID, $grpID_N, null, 2, $fields[2]);
            } else {
                $result[$k] = $grpID_N;
                ///print_r($result);
            }
        }
        if (formIdMap(2, "Group_Map", $d) != null) {
            //To Update the Map Group
            $grpID_N = formIdMap(2, "Group_Map", $d);
            if (empty($f)) {
                Post_Process($ID, $grpID_N, null, 2, $fields[2]);
            } else {
                $result[$k] = $grpID_N;
            }
        }
        if (formIdMap(2, "Group_Ignore", $d) != null) {
            if (empty($f)) {
                //To Remove the Group that's flagged as Ignore by replacing it with ID 999
                Post_Process($ID, 999, null, 2, $fields[2]);
            } else {
                $result[$k] = 999;
            }
        }
    }
    if (!empty($f)) {
        $final = implode(',', $result);
        Post_Process($ID, $final, null, 2, $fields[2]);
    }
    if ($table == '_formulize_group_filters') {
        $a = array();
        array_push($a, $ID);
        //Because the Function Expects an Array of IDS
        ser($a, 2, 2);
    }
}
コード例 #19
0
ファイル: App.php プロジェクト: LobbyOS/server
 public function download($file_name, $file_path = "")
 {
     if (file_exists($file_path)) {
         header("Content-Disposition: attachment; filename=\"{$file_name}\"");
         header("Pragma: public");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         /**
          * Resumable download
          */
         header("Accept-Ranges: bytes");
         $filesize = filesize($file_path);
         $offset = 0;
         $length = $filesize;
         if (isset($_SERVER['HTTP_RANGE'])) {
             // if the HTTP_RANGE header is set we're dealing with partial content
             $partialContent = true;
             // find the requested range
             // this might be too simplistic, apparently the client can request
             // multiple ranges, which can become pretty complex, so ignore it for now
             preg_match('/bytes=(\\d+)-(\\d+)?/', $_SERVER['HTTP_RANGE'], $matches);
             $offset = intval($matches[1]);
             $length = intval($matches[2]) - $offset;
         } else {
             $partialContent = false;
         }
         set_time_limit(0);
         $file = fopen($file_path, 'r');
         // seek to the requested offset, this is 0 if it's not a partial content request
         fseek($file, $offset);
         $data = fread($file, $length);
         fclose($file);
         if ($partialContent) {
             // output the right headers for partial content
             header('HTTP/1.1 206 Partial Content');
             header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize);
         }
         header('Content-Length: ' . $filesize);
         header('Content-Type: ' . filetype($file_path));
         print $data;
     } else {
         ser("<h2>File Doesn't Exist</h2>", "The file you requested to download isn't available on the server.");
     }
 }
コード例 #20
0
ファイル: comment.php プロジェクト: sukanyamandal/open
<?php

require_once "{$docRoot}/inc/render.php";
$LS->init();
if ($_P) {
    $id = $_POST['id'];
    $msg = $_POST['cmt'];
    if (!preg_match("/[^\\s]/", $msg)) {
        ser("Comment Can't be blank", "", "json");
    }
    if (!is_numeric($id)) {
        ser("Invalid Request", "", "json");
    }
    $sql = $OP->dbh->prepare("SELECT `uid` FROM `posts` WHERE `id`=?");
    $sql->execute(array($id));
    $owner = $sql->fetchColumn();
    if ($sql->rowCount() != 0) {
        $OP->format($msg, true);
        /* Just For @mention notifications */
        $sql = $OP->dbh->prepare("INSERT INTO `comments` (`uid`, `pid`, `comment`, `time`) VALUES(:uid, :id, :msg, NOW());\n\t\t\tUPDATE `posts` SET `comments` = `comments` + 1 WHERE `id`=:id");
        $sql->execute(array(":uid" => curUser, ":id" => $id, ":msg" => $msg));
        $OP->mentionNotify($id, "comment");
        $OP->notify("comment", $msg, $id, $owner, curUser);
        /* We should notify the owner of post */
        /* Show all comments or not */
        if ($_POST['clod'] == 'mom') {
            $_POST['all'] = 1;
        }
        $html = $OP->rendFilt(Render::comment($id));
        ?>
$("#<?php 
コード例 #21
0
ファイル: Router.php プロジェクト: LobbyOS/server
 public static function statusRoutes()
 {
     /**
      * The default 404 page
      */
     self::$router->onHttpError(function ($code, $router) {
         if ($code === 404) {
             if (self::pathExists()) {
                 $router->response()->code(200);
             } else {
                 echo ser();
             }
         }
     });
 }
コード例 #22
0
ファイル: Install.php プロジェクト: LobbyOS/server
 /**
  * Make the config.php file
  */
 public static function makeConfigFile($db_type = "mysql")
 {
     $lobbyID = \Helper::randStr(10) . \Helper::randStr(15) . \Helper::randStr(20);
     // Lobby Global ID
     $lobbySID = hash("sha512", \Helper::randStr(15) . \Helper::randStr(30));
     // Lobby Secure ID
     $configFileLoc = L_DIR . "/config.php";
     $cfg = self::$database;
     /**
      * Make the configuration file
      */
     $config_sample = FS::get("/includes/lib/lobby/inc/config-sample.php");
     $config_file = $config_sample;
     if ($db_type === "mysql") {
         $config_file = preg_replace("/host'(.*?)'(.*?)'/", "host'\$1'{$cfg['host']}'", $config_file);
         $config_file = preg_replace("/port'(.*?)'(.*?)'/", "port'\$1'{$cfg['port']}'", $config_file);
         $config_file = preg_replace("/username'(.*?)''/", "username'\$1'{$cfg['username']}'", $config_file);
         $config_file = preg_replace("/password'(.*?)''/", "password'\$1'{$cfg['password']}'", $config_file);
         $config_file = preg_replace("/dbname'(.*?)''/", "dbname'\$1'{$cfg['dbname']}'", $config_file);
         $config_file = preg_replace("/prefix'(.*?)'(.*?)'/", "prefix'\$1'{$cfg['prefix']}'", $config_file);
     } else {
         $config_file = preg_replace("/type'(.*?)'(.*?)'/", "type'\$1'sqlite'", $config_file);
         $config_file = preg_replace("/port'(.*?)'(.*?)',/", "path'\$1'{$cfg['path']}',", $config_file);
         $config_file = preg_replace("/[[:blank:]]+(.*?)'host'(.*?)'(.*?)',\n/", "", $config_file);
         $config_file = preg_replace("/[[:blank:]]+(.*?)'username'(.*?)'',\n/", "", $config_file);
         $config_file = preg_replace("/[[:blank:]]+(.*?)'password'(.*?)'',\n/", "", $config_file);
         $config_file = preg_replace("/[[:blank:]]+(.*?)'dbname'(.*?)'',\n/", "", $config_file);
         $config_file = preg_replace("/prefix'(.*?)'(.*?)'/", "prefix'\$1'{$cfg['prefix']}'", $config_file);
     }
     $config_file = preg_replace("/lobbyID'(.*?)''/", "lobbyID'\$1'{$lobbyID}'", $config_file);
     $config_file = preg_replace("/secureID'(.*?)''/", "secureID'\$1'{$lobbySID}'", $config_file);
     /**
      * Create the config.php file
      */
     if (FS::write($configFileLoc, $config_file) === false) {
         echo ser("Failed Creating Config File", "Something happened while creating the file. Perhaps it was something that you did ?");
     } else {
         chmod(L_DIR . "/config.php", 0550);
     }
 }
コード例 #23
0
ファイル: apps.php プロジェクト: saviobosco/lobby
        <?php 
            exit;
        } else {
            if ($action == "enable") {
                if ($App->enableApp()) {
                    sss("Enabled", "App has been enabled.");
                } else {
                    ser("Error", "The App couldn't be enabled. Try again.", false);
                }
            }
        }
    }
}
$Apps = \Lobby\Apps::getApps();
if (count($Apps) == 0) {
    ser("No Enabled Apps", "Lobby didn't find any apps that has been enabled", false);
}
if (count($Apps) != 0) {
    ?>
          <table style="width: 100%;margin-top:5px">
            <thead>
              <tr>
                <td>Name</td>
                <td>Version</td>
                <td>Description</td>
                <td>Actions</td>
              </tr>
            </thead>
            <tbody>
              <?php 
    foreach ($Apps as $app => $null) {
コード例 #24
0
ファイル: new_col.php プロジェクト: saviobosco/lobby
<?php

$this->load();
if (isset($_POST['column'])) {
    foreach ($_POST['column'] as $column) {
        if ($column['length'] == "") {
            $sql = $this->dbh->prepare("ALTER TABLE `" . $this->table . "` ADD {$column['name']} {$column['type']}");
        } else {
            $sql = $this->dbh->prepare("ALTER TABLE `" . $this->table . "` ADD {$column['name']} {$column['type']}({$column['length']})");
        }
        if ($sql->execute()) {
            sss("Column Added", "The column <b>{{$column['name']}}</b> was successfully added");
        } else {
            $this->log($sql->errorInfo());
            ser("Failed", "Some error caused the column to be not created");
        }
    }
}
$field = str_replace(array("\r", "\n"), "", "<tr>\n  <td><input type='text' name='column[0][name]' id='column_name' /></td>\n  <td>\n    <select name='column[0][type]' class='column_type'>\n      <option title='A 4-byte integer, signed range is -2,147,483,648 to 2,147,483,647, unsigned range is 0 to 4,294,967,295' value='INT'>INT</option><option title='A variable-length (0-65,535) string, the effective maximum length is subject to the maximum row size' value='VARCHAR'>VARCHAR</option><option title='A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored with a two-byte prefix indicating the length of the value in bytes' value='TEXT'>TEXT</option><option title='A date, supported range is 1000-01-01 to 9999-12-31' value='DATE'>DATE</option><optgroup label='Numeric'><option title='A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255' value='TINYINT'>TINYINT</option><option title='A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to 65,535' value='SMALLINT'>SMALLINT</option><option title='A 3-byte integer, signed range is -8,388,608 to 8,388,607, unsigned range is 0 to 16,777,215' value='MEDIUMINT'>MEDIUMINT</option><option title='A 4-byte integer, signed range is -2,147,483,648 to 2,147,483,647, unsigned range is 0 to 4,294,967,295' value='INT'>INT</option><option title='An 8-byte integer, signed range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, unsigned range is 0 to 18,446,744,073,709,551,615' value='BIGINT'>BIGINT</option><option disabled='disabled' value='-'>-</option><option title='A fixed-point number (M, D) - the maximum number of digits (M) is 65 (default 10), the maximum number of decimals (D) is 30 (default 0)' value='DECIMAL'>DECIMAL</option><option title='A small floating-point number, allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38' value='FLOAT'>FLOAT</option><option title='A double-precision floating-point number, allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308' value='DOUBLE'>DOUBLE</option><option title='Synonym for DOUBLE (exception: in REAL_AS_FLOAT SQL mode it is a synonym for FLOAT)' value='REAL'>REAL</option><option disabled='disabled' value='-'>-</option><option title='A bit-field type (M), storing M of bits per value (default is 1, maximum is 64)' value='BIT'>BIT</option><option title='A synonym for TINYINT(1), a value of zero is considered false, nonzero values are considered true' value='BOOLEAN'>BOOLEAN</option><option title='An alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE' value='SERIAL'>SERIAL</option></optgroup><optgroup label='Date and time'><option title='A date, supported range is 1000-01-01 to 9999-12-31' value='DATE'>DATE</option><option title='A date and time combination, supported range is 1000-01-01 00:00:00 to 9999-12-31 23:59:59' value='DATETIME'>DATETIME</option><option title='A timestamp, range is 1970-01-01 00:00:01 UTC to 2038-01-09 03:14:07 UTC, stored as the number of seconds since the epoch (1970-01-01 00:00:00 UTC)' value='TIMESTAMP'>TIMESTAMP</option><option title='A time, range is -838:59:59 to 838:59:59' value='TIME'>TIME</option><option title='A year in four-digit (4, default) or two-digit (2) format, the allowable values are 70 (1970) to 69 (2069) or 1901 to 2155 and 0000' value='YEAR'>YEAR</option></optgroup><optgroup label='String'><option title='A fixed-length (0-255, default 1) string that is always right-padded with spaces to the specified length when stored' value='CHAR'>CHAR</option><option title='A variable-length (0-65,535) string, the effective maximum length is subject to the maximum row size' value='VARCHAR'>VARCHAR</option><option disabled='disabled' value='-'>-</option><option title='A TEXT column with a maximum length of 255 (2^8 - 1) characters, stored with a one-byte prefix indicating the length of the value in bytes' value='TINYTEXT'>TINYTEXT</option><option title='A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored with a two-byte prefix indicating the length of the value in bytes' value='TEXT'>TEXT</option><option title='A TEXT column with a maximum length of 16,777,215 (2^24 - 1) characters, stored with a three-byte prefix indicating the length of the value in bytes' value='MEDIUMTEXT'>MEDIUMTEXT</option><option title='A TEXT column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) characters, stored with a four-byte prefix indicating the length of the value in bytes' value='LONGTEXT'>LONGTEXT</option><option disabled='disabled' value='-'>-</option><option title='Similar to the CHAR type, but stores binary byte strings rather than non-binary character strings' value='BINARY'>BINARY</option><option title='Similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings' value='VARBINARY'>VARBINARY</option><option disabled='disabled' value='-'>-</option><option title='A BLOB column with a maximum length of 255 (2^8 - 1) bytes, stored with a one-byte prefix indicating the length of the value' value='TINYBLOB'>TINYBLOB</option><option title='A BLOB column with a maximum length of 16,777,215 (2^24 - 1) bytes, stored with a three-byte prefix indicating the length of the value' value='MEDIUMBLOB'>MEDIUMBLOB</option><option title='A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, stored with a two-byte prefix indicating the length of the value' value='BLOB'>BLOB</option><option title='A BLOB column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) bytes, stored with a four-byte prefix indicating the length of the value' value='LONGBLOB'>LONGBLOB</option><option disabled='disabled' value='-'>-</option><option title='An enumeration, chosen from the list of up to 65,535 values or the special '' error value' value='ENUM'>ENUM</option><option title='A single value chosen from a set of up to 64 members' value='SET'>SET</option></optgroup><optgroup label='Spatial'><option title='A type that can store a geometry of any type' value='GEOMETRY'>GEOMETRY</option><option title='A point in 2-dimensional space' value='POINT'>POINT</option><option title='A curve with linear interpolation between points' value='LINESTRING'>LINESTRING</option><option title='A polygon' value='POLYGON'>POLYGON</option><option title='A collection of points' value='MULTIPOINT'>MULTIPOINT</option><option title='A collection of curves with linear interpolation between points' value='MULTILINESTRING'>MULTILINESTRING</option><option title='A collection of polygons' value='MULTIPOLYGON'>MULTIPOLYGON</option><option title='A collection of geometry objects of any type' value='GEOMETRYCOLLECTION'>GEOMETRYCOLLECTION</option></optgroup>\n    </select>\n  </td>\n  <td><input type='number' name='column[0][length]' id='column_length' placeholder='Leave empty for using default length' /></td>\n</tr>");
?>
<form id="newColumn">
  <table><thead>
    <th>Name</th>
    <th>Type</th>
    <th>Length</th>
  </thead><tbody>
    <?php 
echo $field;
?>
  </tbody></table>
  <button>Add Column(s)</button>
コード例 #25
0
ファイル: Update.php プロジェクト: LobbyOS/server
 /**
  * Update the App with the given ID
  */
 public static function app($id)
 {
     if ($id == "") {
         echo ser("Error", "No App Mentioned to update.");
     }
     self::log("Installing Latest Version of App {$id}");
     $url = Server::download("app", $id);
     $zipFile = L_DIR . "/contents/update/{$id}.zip";
     self::zipFile($url, $zipFile);
     // Un Zip the file
     if (class_exists("ZipArchive")) {
         $zip = new \ZipArchive();
         if ($zip->open($zipFile) != "true") {
             self::log("Unable to open Downloaded App ({$id}) File : {$zipFile}");
             echo ser("Error", "Unable to open Downloaded App File.");
         } else {
             /**
              * Extract App
              */
             $appDir = APPS_DIR . "/{$id}";
             if (!file_exists($appDir)) {
                 mkdir($appDir);
             }
             $zip->extractTo($appDir);
             $zip->close();
             FS::remove($zipFile);
             self::log("Installed App {$id}");
             return true;
         }
     } else {
         throw new \Exception("Unable to Install App, because <a href='" . L_SERVER . "/docs/quick#section-requirements' target='_blank'>PHP Zip Extension</a> is not installed");
     }
 }
コード例 #26
0
ファイル: login.php プロジェクト: LobbyOS/server
            <input clear type="password" name="password" id="password" />
            <?php 
if (isset($_POST['username'])) {
    echo "<script>\$('#password').focus()</script>";
}
?>
          </label>
          <label clear>
            <input type="checkbox" name="remember_me" checked="checked" />
            <span>Remember Me</span>
          </label>
          <button class="btn" clear>Log In</button>
        </form>
        <?php 
if (isset($error)) {
    echo ser($error[0], $error[1], false);
}
?>
        <div>
          &copy; <a target="_blank" href="http://lobby.subinsb.com">Lobby</a> <?php 
echo date("Y");
?>
        </div>
        <style>
          form input{
            max-width: 500px;
          }
        </style>
      </div>
    </div>
  </body>
コード例 #27
0
ファイル: install-app.php プロジェクト: saviobosco/lobby
        <?php 
if (H::input("id") == null) {
    ser("Error", "No App is mentioned. Install Apps from <a href='lobby-store.php'>Lobby Store</a>");
}
if (H::input("action") == "enable" && H::csrf()) {
    $App = new \Lobby\Apps($_GET['id']);
    if (!$App->exists) {
        ser("Error", "App is not installed");
    }
    $App->enableApp();
    sss("Enabled", "The App <b>{$_GET['id']}</b> is enabled. The author says thanks.<a href='" . $App->info['URL'] . "' class='button green'>Open App</a>");
}
if (H::input("action") == "remove" && H::csrf()) {
    $App = new \Lobby\Apps($_GET['id']);
    if (!$App->exists) {
        ser("Error", "App is not installed");
    }
    $App->removeApp();
    sss("Removed", "The App <b>{$_GET['id']}</b> was successfully removed.");
}
$id = H::input("id");
if ($id != null && H::input("action") == null && H::csrf()) {
    ?>
          <h1>Install App</h1>
          <iframe src="<?php 
    echo L_URL . "/admin/download.php?type=app&id={$id}" . H::csrf("g");
    ?>
" style="border: 0;width: 100%;height: 200px;"></iframe>
        <?php 
}
?>
コード例 #28
0
ファイル: apps.php プロジェクト: LobbyOS/server
        <script>
          lobby.load(function(){
            $(".workspace #app-tabs .tabs").tabs();
          });
        </script>
        <div id="description">
          <p><?php 
        echo $Parsedown->text($appInfo['description']);
        ?>
</p>
        </div>
        <div id="screenshots">
          <?php 
        $screenshots = array_filter(explode("\n", $appInfo['screenshots']));
        if (empty($screenshots)) {
            ser("No Screenshots", "This app has no screenshots");
        } else {
            echo '<ul class="rslides">';
            foreach ($screenshots as $screenshot) {
                if ($screenshot != "") {
                    echo "<li><a href='{$screenshot}' target='_blank'><img src='{$screenshot}' /></a></li>";
                }
            }
            echo "</ul>";
            ?>
            <script src="<?php 
            echo $this->srcURL;
            ?>
/src/js/responsiveslides.min.js"></script>
            <script>
              $(function() {
コード例 #29
0
ファイル: lobby-store.php プロジェクト: LobbyOS/server
    echo Lobby::l("/admin/lobby-store.php", "New", "class='btn " . ($section === null ? "green" : "") . "'");
    echo Lobby::l("/admin/lobby-store.php?section=popular", "Popular", "class='btn " . ($section === "popular" ? "green" : "") . "'");
    ?>
          </div>
          <?php 
    if ($q !== null) {
        $params = array("q" => $_GET['q']);
    } else {
        $params = array("get" => "popular");
    }
    if ($p !== null) {
        $params["p"] = $p;
    }
    $server_response = \Lobby\Server::store($params);
    if ($server_response == false) {
        echo ser("Nothing Found", "Nothing was found that matches your criteria. Sorry...");
    } else {
        echo "<div class='apps row'>";
        foreach ($server_response['apps'] as $app) {
            $appImage = $app['image'] != "" ? $app['image'] : L_URL . "/includes/lib/lobby/image/blank.png";
            $url = \Lobby::u("/admin/lobby-store.php?app={$app['id']}");
            ?>
                <div class="app card col s12 m6 l6">
                  <div class="app-inner row">
                    <div class="lpane col s4 m5 l4">
                      <a href="<?php 
            echo $url;
            ?>
">
                        <img src="<?php 
            echo $appImage;
コード例 #30
0
ファイル: dashboard.php プロジェクト: LobbyOS/server
<?php

/**
 * Get installed apps and make the tiles on dashboard
 */
$apps = \Lobby\Apps::getEnabledApps();
if (count($apps) == 0) {
    echo ser("No Apps", "You haven't enabled or installed any apps. <br/>Get great Apps from " . \Lobby::l("/admin/lobby-store.php", "Lobby Store"));
} else {
    $dashboard_items = array("apps" => array());
    foreach ($apps as $app => $null) {
        $App = new \Lobby\Apps($app);
        $data = $App->info;
        $dashboard_items["apps"][$app] = $data;
    }
    \Lobby\UI\Themes::loadDashboard($dashboard_items);
}