{ $tpl = ''; switch ($el) { case 'inputbox': $tpl = '<div class="form-field"><input type="text" name="${param}" value="${value}" ${attr}${required} /><span class="small">${desc}</span></div>'; break; case 'delimer': $tpl = '<h1>${desc}</h1>'; break; } return $tpl; } function setButtons($arr = array()) { echo '<div class="buttons"><input type="button" value="Apply" /> <input type="button" value="Cancel" /></div>'; } } if ($mode == "install") { echo "INSTALL"; # $res=cbsd_cmd('env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd task owner=cbsdweb autoflush=2 mode=new env NOCOLOR=1 /usr/local/bin/cbsd imghelper module=$hlper jname=$jname inter=0'); $res = cbsd_cmd("env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd task owner=cbsdweb mode=new env NOCOLOR=1 /usr/local/bin/cbsd imghelper module={$helper} jname={$jname} inter=0"); exit(0); } $jail_form = $workdir . "/jails-system/" . $jname . "/helpers/" . $helper . ".sqlite"; if (file_exists($jail_form)) { $form = new Forms($helper); $form->generate(); //$form->setButtons(array('apply','cancel')); } else { echo "Module not installed for {$jname}. Please <a href='/img_helper_cfg.php?jname={$jname}&mode=install&helper={$helper}'>install module</a>"; }
function getHelper() { $arr = array(); $jail_form = $this->workdir . "/jails-system/jail" . $this->jailId . "/helpers/" . $this->helper . ".sqlite"; if (file_exists($jail_form)) { $jname = 'jail' . $this->jailId; $form = new Forms($jname, $this->helper); $res = $form->generate(); $arr = array('error' => false, 'form' => $res['html'], 'defaults' => $res['defaults']); } else { $arr = array('error' => true, 'errorMsg' => '<p>' . get_translate('Module') . ' <strong>' . $this->helper . '</strong> ' . get_translate('are not installed') . '.</p><p>' . get_translate('You need to') . ' <span class="install helper-' . $this->helper . '">' . get_translate('install the module') . '</span>.</p>'); } return $arr; }