Пример #1
0
 public function loginAction()
 {
     setLayout("login");
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $sess = new Zend_Session_Namespace("auth");
     if (!isset($sess->loginSuccessRedirectUrl)) {
         if (($pos = strpos($referer, $_SERVER['REQUEST_URI'])) !== FALSE && $pos + strlen($_SERVER['REQUEST_URI']) != strlen($referer)) {
             $sess->loginSuccessRedirectUrl = $referer;
         } else {
             $sess->loginSuccessRedirectUrl = BASE_URL;
         }
     }
     $this->loginForm = new Zend_Form();
     $this->loginForm->setAction($_SERVER['REQUEST_URI'])->setMethod('post')->setAttrib("id", "loginForm");
     $username = $this->loginForm->createElement('text', 'username')->setLabel('Username:'******'StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->addValidator('notEmpty')->setRequired(true);
     $password = $this->loginForm->createElement('password', 'password')->setLabel('Password:'******'StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities');
     $submit = $this->loginForm->createElement('submit', 'submit')->setLabel("Login");
     $this->loginForm->addElement($username)->addElement($password)->addElement($submit)->addElement($submit);
     // </createForm>
     if ($this->getRequest()->isPost()) {
         $this->login();
         return;
     } else {
         if (Zend_Auth::getInstance()->hasIdentity()) {
             $this->_redirect("");
         }
     }
     $this->view->form = $this->loginForm;
 }
Пример #2
0
define('APPLICATION_DIRECTORY', dirname(__FILE__));
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . APPLICATION_DIRECTORY);
require "Joobsbox/Application/Development.php";
require "config/config.php";
require "config/router.php";
require "config/viewRenderer.php";
Zend_Controller_Front::getInstance()->setControllerDirectory(APPLICATION_DIRECTORY . '/Joobsbox/Controllers');
Zend_Registry::set("PluginLoader", new Joobsbox_Plugin_Loader());
Zend_Registry::set("EventHelper", new Joobsbox_Helpers_Event());
Zend_Registry::set("FilterHelper", new Joobsbox_Helpers_Filter());
Zend_Registry::set("TranslationHelper", new Joobsbox_Helpers_TranslationHash());
Zend_Registry::get("TranslationHelper")->regenerateHash();
require "Joobsbox/Application/ErrorHandler.php";
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_DIRECTORY . '/Joobsbox/Helpers', 'Joobsbox_Helpers');
if (!isset($testing)) {
    $front = Zend_Controller_Front::getInstance();
    $front->setBaseUrl(BASE_URL)->setParam('disableOutputBuffering', true)->registerPlugin(new Joobsbox_Plugin_Controller());
    configureTheme();
    if (isset($joobsbox_render_var)) {
        setLayout('integration');
        if (isset($joobsbox_integration_text)) {
            $viewRenderer->view->integrationText = $joobsbox_integration_text;
        }
        $front->returnResponse(true);
    }
    Zend_Registry::get("EventHelper")->fireEvent("joobsbox_init");
    $response = $front->dispatch();
    if (isset($joobsbox_render_var)) {
        $joobsbox_render_var = $response->getBody();
    }
}
Пример #3
0
function processRequests($db)
{
    if (array_key_exists('window', $_REQUEST)) {
        // All windows related commands must start with window=.
        $windownumber = $_REQUEST['window'];
        if ($windownumber != 'vncwin') {
            // This is the normal case.
            // Special handling is needed when called with window=vncwin, see below.
            $window = $windownumber - 1;
            // TODO: $win_id und $windowname können vermutlich zusammengefasst werden.
            $win_id = $db->getWindowIDBySection($windownumber);
            $windowlist = windowList();
            if (count($windowlist) == 0) {
                trace("no window found for command");
                $windowname = false;
                $windowhex = 0;
            } else {
                // TODO: improve test whether window exists.
                $windowname = $windowlist[$window];
                $windowhex = hexdec($windowname);
            }
        }
        if ($windowname && array_key_exists('key', $_REQUEST)) {
            $key = $_REQUEST['key'];
            trace("key '{$key}' in window '{$windownumber}'");
            wmShow($windowname);
            // activateControls($windowhex);
            // displayCommand("xdotool windowfocus $windowhex key $key");
            // trying mousemove and click for better vnc control
            displayCommand("xdotool mousemove --window {$windowhex} 100 100 " . "key {$key}");
        }
        if ($windowname && array_key_exists('keydown', $_REQUEST)) {
            // TODO: keydown is currently mapped to key because we had problems
            // with sticking keys (no keyup seen). This should be fixed by a
            // better event handling.
            $key = $_REQUEST['keydown'];
            trace("keydown '{$key}' in window '{$windownumber}'");
            wmShow($windowname);
            // activateControls($windowhex);
            // displayCommand("xdotool windowfocus $windowhex key $key");
            // trying mousemove and click for better vnc control
            displayCommand("xdotool mousemove --window {$windowhex} 100 100 " . "key {$key}");
            //~ displayCommand("xdotool windowfocus $windowhex keydown $key");
        }
        if ($windowname && array_key_exists('keyup', $_REQUEST)) {
            // TODO: keyup is currently ignored, see comment above.
            $key = $_REQUEST['keyup'];
            trace("keyup '{$key}' in window '{$windownumber}'");
            // activateControls($windowhex);
            //~ wmShow($windowname);
            //~ displayCommand("xdotool windowfocus $windowhex keyup $key");
        }
        if (array_key_exists('delete', $_REQUEST)) {
            $delete = str_replace(" ", "\\ ", addslashes($_REQUEST['delete']));
            trace("delete={$delete}, close window {$windownumber}");
            if (file_exists($delete)) {
                trace("+++ DELETE FILE FROM WEBINTERFACE +++");
                unlink($delete);
            } elseif ($delete == "VNC") {
                trace("+++ DELETE VNC Client FROM DAEMON +++");
                // call via daemon: ?window=vncwin&delete=VNC&vncid=123
                trace("vnc delete in control");
                $win_id = $_REQUEST['vncid'];
                // = hexWindow in database, but not on screen
                trace("VNC cia Daemon ... id={$win_id}");
            } elseif (strstr($delete, "http")) {
                trace("+++ DELETE Browserwindow +++");
            } elseif (preg_match('/(^\\w{3,}@\\w{1,})/', $delete)) {
                trace("+++ DELETE VNC Client FROM WEBINTERFACE +++");
                // call via webinterface
                $win_id = $db->querySingle("SELECT win_id FROM window WHERE file='{$delete}' AND handler='vnc'");
                trace("DELETE VNC Window with ID={$win_id} FROM Database ::\n                SELECT win_id FROM window WHERE file='{$delete}' AND handler='vnc'");
            } else {
                trace("Unhandled delete for '{$delete}'");
            }
            wmClose($win_id);
            $db->deleteWindow($win_id);
        }
        if (array_key_exists('closeOrphans', $_REQUEST)) {
            // win_ids in db
            $windows_in_db = $db->getWindows();
            $db_ids = array();
            if (count($windows_in_db) > 0) {
                foreach ($windows_in_db as $win) {
                    array_push($db_ids, $win['win_id']);
                }
            }
            // win_ids on screen
            $screen_ids = windowListOnScreen();
            // orphaned windows
            $orphan_ids = array_diff($screen_ids, $db_ids);
            if (count($orphan_ids) > 0) {
                // close windows on screen not existing in database
                foreach ($orphan_ids as $id) {
                    wmClose($id);
                }
            }
        }
        if (array_key_exists('toggle', $_REQUEST)) {
            // Change window state from visible to invisible and vice versa.
            $state = $db->getState_Window($win_id);
            trace("toggle window {$windownumber}, id={$win_id}, state={$state}");
            if ($state == "active") {
                wmHide($win_id);
                $db->setState_Window($win_id, "inactive");
            } else {
                wmShow($win_id);
                $db->setState_Window($win_id, "active");
            }
        }
    } elseif (array_key_exists('layout', $_REQUEST)) {
        setLayout($_REQUEST['layout']);
    } elseif (array_key_exists('logout', $_REQUEST)) {
        doLogout($_REQUEST['logout']);
    } elseif (array_key_exists('newVncWindow', $_REQUEST)) {
        // TODO: Better write new code for VNC window.
        addNewWindow($db, unserialize(urldecode($_REQUEST['newVncWindow'])));
    } elseif (array_key_exists('newWindow', $_REQUEST)) {
        createNewWindow($db, unserialize(urldecode($_REQUEST['newWindow'])));
    }
    if (array_key_exists('switchWindows', $_REQUEST)) {
        $before = $_REQUEST['before'];
        $after = $_REQUEST['after'];
        trace("switching {$before} and {$after}");
        // exchange section
        $win_id1 = $db->getWindowIDBySection($before);
        $win_id2 = $db->getWindowIDBySection($after);
        $db->updateWindow($win_id1, 'section', $after);
        $db->updateWindow($win_id2, 'section', $before);
        trace("++updating database {$win_id1} section={$after}");
        trace("++updating database {$win_id2} section={$before}");
        // Update display (no layout change).
        setLayout(null);
    }
    if (array_key_exists('openURL', $_REQUEST)) {
        $openURL = $_REQUEST['openURL'];
        trace("openURL {$openURL}");
        $dt = new DateTime();
        $date = $dt->format('Y-m-d H:i:s');
        $window = array("id" => "", "win_id" => "", "section" => "", "state" => "", "file" => $openURL, "handler" => "/usr/bin/nohup /usr/bin/dwb", "userid" => "", "date" => $date);
        createNewWindow($db, $window);
    }
    // TODO: chef if query redundant?
    if (array_key_exists('closeAll', $_REQUEST)) {
        $close = $_REQUEST['closeAll'];
        trace("close all windows {$close}");
        closeAll();
    }
}
Пример #4
0
        $sWINWeek = $aWINPVE[0];
        $sWIN .= '<span class="icoPVE pve' . $sWINPVE . '"></span>';
        $sWIN .= '<span class="weekPVE weekPVE' . $sWINWeek . '"></span>';
        if ($aValue['winQuizz'] == 0) {
            $sWIN .= '<span class="icoQuizz quizz0 weekQuizz0"></span>';
        }
        $iWIN = 1;
    }
    if ($iWIN == 1) {
        $sWIN = '<span class="icoSlot">' . $sWIN . '</span>';
    }
    // FOLLOW ( NOM EN GRAS ET ICONE)
    if ($aValue['follower'] == "1") {
        $sICONE .= '<span class="follower"></span>';
        $sName = "<strong>" . $aValue['name'] . "</strong>";
    } else {
        $sName = $aValue['name'];
    }
    // WIN QUIZZ & PVE
    $sICONE .= $sWIN;
    // ISONLINE (COULEUR PSEUDO)
    if ($aValue['isOnline'] > intval(microtime(true)) - 60) {
        $sName = '<span class="online">' . $sName . '</span>';
    } else {
        $sName = '<span class="offline">' . $sName . '</span>';
    }
    $sHTML .= '<li><nobr>' . $sICONE . '' . $sName . '<span class="level">' . $aValue['level'] . '</span></nobr></li>';
}
$sHTML = '<p id="nicklistTitre">' . $sTITRE . '</p><ul id="laliste">' . $sHTML . '</ul>';
setLayout($sHTML);