Example #1
1
 function __construct($header)
 {
     //TODO use https when loggin in
     // use ssh for login
     //		$host = "https://" . OLIV_SSH_HOST . "/" . OLIV_BASE . "index.php";
     $host = "http://" . system::OLIV_SSH_HOST() . "/" . system::OLIV_BASE() . "index.php";
     // load login content xml
     $this->content = OLIVModule::load_content($header);
     // select template for logged of not logged
     if (status::OLIV_USER()) {
         $header->param->template = "logged";
         $this->content->username = OLIVUser::getName(status::OLIV_USER());
         if (status::OLIV_SU()) {
             $this->content->su = status::OLIV_SU();
         } else {
             $this->content->user_groups = OLIVUser::getGroupName(status::OLIV_USER());
         }
     } else {
         // check if wrong login
         if (argv::action() == "login") {
             $header->param->template = "incorrect";
         }
     }
     // load correct template
     $this->template = OLIVModule::load_template($header);
 }
Example #2
0
 public function getSearch()
 {
     $content = new simpleXmlElement("<search></search>");
     if (argv::action() == "search") {
         OLIVPlugin::call($content, "search");
         status::set("search_result", $content);
     }
 }
Example #3
0
 public function __construct($header)
 {
     //TODO load toolbox system js and user js
     OLIVModule::load_javascript($header, "default");
     OLIVModule::load_javascript($header);
     $contentName = argv::toolbox();
     $this->content = OLIVModule::load_content($header, $contentName);
     // load template if content is loaded
     if ($this->content) {
         $this->template = OLIVModule::load_template($header);
     }
 }
Example #4
0
 public function init($session)
 {
     // ------------------------------------------------------------------------------
     // set session
     if ($session) {
         system::set('OLIV_SESSION', $session . "/");
     } else {
         die("***FATAL ERROR: init.php - no session defined");
     }
     // core path for multisession defined
     if (!system::OLIV_CORE_PATH()) {
         die("Core path not defined");
     }
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // load basic system methods
     OLIVCore::loadScript("library/init.php");
     if (!system::OLIVENV()) {
         die("Environment not set");
     }
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // ------------------------------------------------------------------------------
     // load system language
     if (!system::OLIVTEXT()) {
         die("INIT: OLIVTEXT not found");
     }
     OLIVText::load(system::OLIV_LANGUAGE_PATH(), system::OLIV_CORE_TEXT());
     // ------------------------------------------------------------------------------
     // initialice main components
     // ------------------------------------------------------------------------------
     // connect to database
     // $this->daba = new OLIVDatabase($this->coreXml->_("core.database"));
     // initialise router
     $this->route = new OLIVRoute();
     // initialise html
     $this->html = new OLIVHtml();
     // load module metadata
     $this->module = new OLIVModule();
     // load plugin metadata
     $this->plugin = new OLIVPlugin();
     // load site template
     $this->template = new OLIVTemplate(system::OLIV_TEMPLATE_PATH() . system::OLIV_TEMPLATE() . "/", system::OLIV_TEMPLATE());
     // initialise page
     $this->page = new OLIVPage();
     // initialise preprocessor
     $this->processor = new OLIVProcessor();
     // initialise renderer
     $this->render = new OLIVRender();
     // ------------------------------------------------------------------------------
     // set core status
     // ------------------------------------------------------------------------------
     // extract command and value
     if (status::val()) {
         // extract cmd and param
         $cmdArray = explode("/", cut_slash(status::val()));
         // TODO define commands in system section ???
         // search for command and retranslate
         if (count($cmdArray)) {
             $cmd = OLIVText::getId($cmdArray[0]);
             status::set('command', $cmd);
             // save command
         }
         // if command found, extract command from val
         if (count($cmdArray) > 1 and $cmd) {
             array_shift($cmdArray);
             // remove command from val
             status::set('val', implode("/", $cmdArray));
             // save val
         }
     }
     // ------------------------------------------------------------------------------
     // initialize clipboard
     // get content from clipboard parameter
     if ($clipboard = argv::clipboard()) {
         OLIVClipboard::_($clipboard);
     }
     // get clipboard from cut/copy command
     $command = status::command();
     if ($command) {
         OLIVClipboard::$command(status::val());
     }
 }
Example #5
0
// login state
//   define USER for session
if (array_key_exists('user', $_SESSION)) {
    $user = $_SESSION['user'];
} else {
    $user = $_SESSION['user'] = "";
}
// change user login state
switch (argv::action()) {
    case 'login':
        if (OLIVUser::checkPassword(argv::login(), argv::password())) {
            $user = argv::login();
            // remove login parameters
            argv::remove('action');
            argv::remove('login');
            argv::remove('password');
        }
        break;
    case 'logout':
        $user = "";
        break;
    default:
        break;
}
// set user status
$_SESSION['user'] = $user;
status::set('OLIV_USER', $_SESSION['user']);
// set superuser state
if (OLIVUser::superUser(status::OLIV_USER())) {
    status::set('OLIV_SU', TRUE);
} else {
Example #6
0
 private static function render($content)
 {
     // edit mode if edit mode and permission
     if (argv::toolbox() == "article_edit") {
         $nodes = $content->XPath("//*[@textsource]");
         //echoall($nodes);
         for ($i = 0; $i < count($nodes); $i++) {
             // if source, make edit possible
             $tag = $nodes[$i]->getName();
             $text = (string) $nodes[$i];
             $source = (string) $nodes[$i]->attributes()->textsource;
             //TODO include javaScript content menu
             // include editor call <a>
             $nodes[$i][0] = "";
             $nodes[$i] = $nodes[$i][0]->addChild("a", $text);
             $nodes[$i]["title"] = "call editor for '{$source}'";
         }
     }
     return $content;
 }
Example #7
0
 private function calculate()
 {
     $mand = 0;
     if (argv::string_abort()) {
         argv::remove("spring_L");
         argv::remove("spring_b");
         argv::remove("spring_t");
         argv::remove("spring_n");
         argv::remove("spring_n1");
         argv::remove("spring_F");
         argv::remove("spring_s");
         argv::remove("spring_type");
     }
     $L = argv::spring_L();
     $b = argv::spring_b();
     $t = argv::spring_t();
     $n = argv::spring_n();
     $n1 = argv::spring_n1();
     $F = argv::spring_F();
     $s = argv::spring_s();
     $type = argv::spring_type();
     $F = $F / 2;
     $L = $L / 2;
     $E = 200000;
     // set mandatory fields
     $this->content->leaf_length_class = "mand";
     $this->content->leaf_width_class = "mand";
     $this->content->leaf_thickness_class = "mand";
     $this->content->leaf_count_class = "mand";
     // calculation started
     if (argv::spring_calc()) {
         $this->content->action = "calculate";
         // check mandatory fields
         if (!$L) {
             $this->content->leaf_length_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$b) {
             $this->content->leaf_width_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$t) {
             $this->content->leaf_thickness_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$n) {
             $this->content->leaf_count_class = "mand_missing";
         } else {
             $mand++;
         }
     }
     // calculate leaf lenghs
     if ($L and $n) {
         $Lxg = 0;
         // add additional leafs
         if ($n1) {
             $Lxg = $n1 * $L;
         }
         for ($x = 0; $x < $n; $x++) {
             $Lx = 2 * $L * (1 - $x / $n);
             $Lxg += $Lx;
             $this->content->addChild("leaf_length_list", $Lx);
         }
         $this->content->addChild("leaf_length_overall", $Lxg);
     }
     // set result values
     $this->content->result = "---";
     $this->content->spring_result_class = "spring_result_error";
     // set result type
     if ($F) {
         $this->content->result_value = "s";
         $this->content->result_unit = "mm";
         $this->text("result_name", "bending");
         $this->content->spring_result_class = "spring_result";
     }
     if ($s) {
         $this->content->result_value = "F";
         $this->content->result_unit = "N";
         $this->text("result_name", "force");
         $this->content->spring_result_class = "spring_result";
     }
     // abbort if not mandatory
     if ($mand < 4) {
         return FALSE;
     }
     // PSI
     $psi = 3 / (2 + ($n1 + $type) / $n);
     //------------------------------------------------------------------------------
     // calculate bending
     if ($F) {
         // s denominator
         $_s = $E * $n * $b * pow($t, 3);
         // if s not NULL -> calculate
         if ($_s) {
             $s = $psi * 4 * $F * pow($L, 3) / $_s;
         }
         $this->content->result = number_format($s, 3);
     } elseif ($s) {
         // F denominator
         $_F = 4 * pow($L, 3) * $psi;
         // if F not NULL -> calculate
         if ($_F) {
             $F = $s * $E * $n * $b * pow($t, 3) / $_F;
         }
         $this->content->result = number_format($F, 3);
     }
     // sigma
     $this->content->spring_sigma = number_format(6 * $F * $L / ($n * $b * pow($t, 2)));
     //		echoall($this->content);
 }
Example #8
0
 private function activities($header, $article)
 {
     // create index file
     switch (argv::action()) {
         case "create_index":
             $articleName = (string) $header->param->content;
             $index = new OLIVIndex();
             $textNodes = $article->XPath("//text");
             foreach ($textNodes as $text) {
                 $index->insertText((string) $text, "article:{$articleName}", (string) $text['lang']);
             }
             break;
         case "delete_index":
             argv::remove("action");
             break;
     }
 }