Marius Burkard
2016-04-19 b2cee83e8894e89fd3e0793c84fb92a8cf928613
interface/web/tools/tpl_default.php
@@ -28,81 +28,25 @@
*/
/******************************************
* Begin Form configuration
******************************************/
global $app, $conf;
$tform_def_file = "form/tpl_default.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('tools');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
$app->uses('tpl');
class page_action extends tform_actions {
   function onLoad() {
                global $app, $conf, $tform_def_file;
$app->tpl->newTemplate('listpage.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/tpl_default.htm');
                // Loading template classes and initialize template
                if(!is_object($app->tpl)) $app->uses('tpl');
                if(!is_object($app->tform)) $app->uses('tform');
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_tpl_default.lng';
include $lng_file;
                $app->tpl->newTemplate("tabbed_form.tpl.htm");
$app->tpl->setVar($wb);
                // Load table definition from file
                $app->tform->loadFormDef($tform_def_file);
            // Importing ID
                $this->id = $_SESSION['s']['user']['userid'];
      $_POST['id'] = $_SESSION['s']['user']['userid'];
                if(count($_POST) > 1) {
                        $this->dataRecord = $_POST;
                        $this->onSubmit();
                } else {
                        $this->onShow();
                }
        }
   function onBeforeInsert() {
      global $app, $conf;
      if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
         $app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
      }
   }
   function onInsert() {
      die('No inserts allowed.');
   }
   function onBeforeUpdate() {
      global $app, $conf;
      if($conf['demo_mode'] == true && $this->id <= 3) $app->tform->errorMessage .= 'This function is disabled in demo mode.';
      $_SESSION['s']['user']['language'] = $_POST['language'];
      $_SESSION['s']['language'] = $_POST['language'];
                if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
         $app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
      }
   }
}
$page = new page_action;
$page->onLoad();
$app->tpl_defaults();
$app->tpl->pparse();
?>