public function __toString() { $code = "<div id=\"help\">\n"; $code .= parsebbcode($this->_content); $code .= "</div><br /><br />\n"; return $code; }
function showfile() { global $lang; global $conf; global $user; global $site; global $catid; global $file; $site->title($file->name()); $site->addfooter("help.php?on=file", "help", $lang['menu']['help'], $lang['menu']['helpalt']); if ($file->highlight() == $conf['highlight']['binary']) { redirect("file.php?id=" . $file->id() . "&action=download"); } if ($user->entrycan("changeentry", $file->entry())) { $site->addmenu("file.php?id=" . $file->id() . "&cat=" . $catid . "&action=modify", $lang['menu']['file'], $lang['menu']['filealt']); $site->addfooter("file.php?id=" . $file->id() . "&cat=" . $catid . "&action=modify", "configure", $lang['menu']['file'], $lang['menu']['filealt']); $site->addfooter("entry.php?id=" . $file->entry()->id() . "&cat=" . $catid . "&action=files", "files", $lang['menu']['attach'], $lang['menu']['attachalt']); } $entrytpl = new CodeKBTemplate("entry"); $entrytpl->push("icon", icon($file->symbol(), $file->name())); $entrytpl->push("name", $file->name()); $content = $lang['entry']['createdate'] . ": <em>" . $file->created() . "</em> | "; $content .= $lang['entry']['modifydate'] . ": <em>" . ($file->modified() ? $file->modified() : $lang['general']['never']) . "</em>\n<br />\n"; $content .= $lang['file']['download'] . ": "; $content .= url("file.php?id=" . $file->id() . "&action=download", $file->name()); $content .= " ("; $unit = "b"; $size = $file->size(); if ($size > 1024) { $size /= 1024; $unit = "kb"; } if ($size > 1024) { $size /= 1024; $unit = "mb"; } $content .= round($size) . $unit . ") | "; $content .= url("entry.php?id=" . $file->entry()->id() . "&cat=" . $catid, phrasereplace($lang['general']['backto'], "%1%", htmlentities($file->entry()->name())), $file->entry()->name()); $entrytpl->push("subheader", $content); $code = "[code=" . $file->highlight() . "]"; $code .= $file->content(); $code .= "[/code]"; $entrytpl->push("documentation", parsebbcode($code)); $site->addcontent($entrytpl); return true; }
function getpost($post, $bbcode, $smileys, $html) { $procpost = $post; if (!$html) { $procpost = htmlentities($procpost, ENT_QUOTES, 'UTF-8'); } $procpost = nl2br($procpost); if ($smileys) { $procpost = makesmileys($procpost); } if ($bbcode) { $procpost = parsebbcode($procpost); } return $procpost; }
if ($comment['author'] == $_SESSION['uid'] || $users->client->is_admin) { ?> <img class="comment_delete" src="<?php echo $location['images']; ?> /btnmini/delete.png" alt="" /> <?php } ?> </div> </td> </tr> <tr> <td class="content"> <?php echo parsebbcode($comment['content']); ?> </td> </tr> </table> </article> <?php } ?> </section> <section> <h3>Update this ticket</h3> <?php if ($users->client->is_logged) { ?>
function showfile() { global $lang; global $conf; global $user; global $site; global $category; global $file; $site->title($file->name()); $site->addfooter("help.php?on=file", "help", $lang['menu']['help'], $lang['menu']['helpalt']); if ($file->highlight() == $conf['highlight']['binary']) { redirect("file.php?id=" . $file->id() . "&action=download"); } if ($category) { $cat = $category->id(); } if ($user->entrycan("changeentry", $file->entry())) { $site->addmenu("file.php?id=" . $file->id() . "&cat=" . $cat . "&action=modify", $lang['menu']['file'], $lang['menu']['filealt']); $site->addfooter("file.php?id=" . $file->id() . "&cat=" . $cat . "&action=modify", "configure", $lang['menu']['file'], $lang['menu']['filealt']); $site->addfooter("entry.php?id=" . $file->entry()->id() . "&cat=" . $cat . "&action=files", "files", $lang['menu']['attach'], $lang['menu']['attachalt']); } $entrytpl = new CodeKBTemplate("entry"); $entrytpl->push("icon", icon($file->symbol(), $file->name())); $entrytpl->push("name", $file->name()); $content = $lang['file']['download'] . ": "; $content .= url("file.php?id=" . $file->id() . "&action=download", $file->name()); $content .= " ("; $unit = "b"; $size = $file->size(); if ($size > 1024) { $size /= 1024; $unit = "kb"; } if ($size > 1024) { $size /= 1024; $unit = "mb"; } $content .= round($size) . $unit . ")"; $entrytpl->push("subheader", $content); $code = "[code=" . $file->highlight() . "]"; $code .= $file->content(); $code .= "[/code]"; $entrytpl->push("documentation", parsebbcode($code)); $site->addcontent($entrytpl); return true; }
function showinput() { global $lang; global $user; global $site; global $category; global $entry; $site->addfooter("help.php?on=entry#add", "help", $lang['menu']['help'], $lang['menu']['helpalt']); if ($site->action() == "modify") { $change = true; $site->title($lang['entry']['change']); } else { $change = false; $site->title($lang['entry']['add']); } if (!$change && !$user->can("addentry", $category)) { $site->addcontent(notice($lang['entry']['noaddallowed'])); return false; } if ($change && !$user->entrycan("changeentry", $entry)) { $site->addcontent(notice($lang['entry']['nochangeallowed'])); return false; } if ($category) { $cat = $category->id(); } if ($_POST['cancel']) { if ($change) { redirect("entry.php?id=" . $entry->id() . "&cat=" . $cat); } else { redirect("category.php?id=" . $cat); } } $form = new CodeKBForm("entry.php", $change ? "modify" : "new"); $form->addhidden("cat", $cat); if ($change) { $form->addhidden("id", $entry->id()); } $form->addtext("title", $change ? $entry->name() : ""); $form->addlabel("title", $lang['entry']['name']); $form->setrequired("title"); $form->addtext("author", $change ? $entry->author() : ""); $form->addlabel("author", $lang['entry']['author']); $form->addtext("description", $change ? $entry->description() : ""); $form->addlabel("description", $lang['entry']['description']); $db = new CodeKBDatabase(); $db->dosql("SELECT name, symbol " . "FROM symbols " . "WHERE symbol LIKE 'type_%'"); if ($entry) { $symbol = $entry->symbol(); } else { $symbol = false; } while ($val = $db->row()) { $form->addradio("symbol", $val['name'], icon($val['name'], $val['name']), !$change && $val['name'] == "Unkown" || $val['name'] == $symbol, false); } $form->addtextarea("documentation", $change ? $entry->documentation() : ""); $form->addlabel("documentation", $lang['entry']['documentation'] . " (" . url("help.php?on=bbcode", $lang['entry']['bbcode'], null, true) . ")"); $form->addsubmit(); $form->addpreview(); $form->addcancel(); if ($_POST['submit'] || $_POST['preview']) { $fill = $form->fill(); if (!$fill) { $site->addcontent(notice($lang['general']['missing'])); } } if ($_POST['submit'] && $fill) { if ($change) { // Change the entry try { $entry->change($form->value("title"), $form->value("author"), $form->value("symbol"), $form->value("description"), $form->value("documentation")); redirect("entry.php?id=" . $entry->id() . "&cat=" . $cat); } catch (Exception $e) { $site->addcontent(notice($lang['entry']['failedchange'])); } } else { // Add the new entry try { $ret = $category->addentry($form->value("title"), $form->value("author"), $form->value("symbol"), $form->value("description"), $form->value("documentation")); if (is_numeric($ret)) { if ($user->entrycan("changeentry", $ret)) { redirect("entry.php?id=" . $ret . "&cat=" . $category->id() . "&action=change"); } else { redirect("entry.php?id=" . $ret . "&cat=" . $category->id()); } } else { throw new CodeKBException(__METHOD__, "entry", "failedadd"); } } catch (Exception $e) { $site->addcontent(notice($lang['entry']['failedadd'])); } } } $dialog = new CodeKBTemplate("dialog"); if ($change) { $dialog->push("legend", $lang['entry']['change']); } else { $dialog->push("legend", $lang['entry']['add']); } $dialogitem = new CodeKBTemplate("dialogitem"); $content = $form->head(); $content .= $form->get("title") . "<br />\n"; $content .= $form->get("author"); $dialogitem->push("top", $content); $dialogitem->push("content1", $form->get()); $dialogitem->push("tail", $form->tail()); $dialogcode = $dialogitem->__toString(); if ($_POST['preview']) { $dialogitem2 = new CodeKBTemplate("dialogitem"); $dialogitem2->push("head", "<em><strong>" . $lang['general']['preview'] . "</strong></em><br /><br />"); $dialogitem2->push("content1", parsebbcode($form->value("documentation"))); $dialogcode .= $dialogitem2->__toString(); } $dialog->push("content", $dialogcode); $site->addcontent($dialog); return true; }
function showinput() { global $lang; global $conf; global $user; global $site; global $catid; global $category; global $entry; $site->addfooter("help.php?on=entry#add", "help", $lang['menu']['help'], $lang['menu']['helpalt']); if ($site->action() == "modify") { $change = true; $site->title($lang['entry']['change']); } else { $change = false; $site->title($lang['entry']['add']); } if (!$change && !$user->can("addentry", $category)) { $site->addcontent(notice($lang['entry']['noaddallowed'])); return false; } if ($change && !$user->entrycan("changeentry", $entry)) { $site->addcontent(notice($lang['entry']['nochangeallowed'])); return false; } if ($_POST['cancel']) { if ($change) { redirect("entry.php?id=" . $entry->id() . "&cat=" . $catid); } else { redirect("category.php?id=" . $catid); } } $form = new CodeKBForm("entry.php", $change ? "modify" : "new"); $form->addhidden("cat", $catid); if ($change) { $form->addhidden("id", $entry->id()); } $form->addtext("title", $change ? $entry->name() : ""); $form->addlabel("title", $lang['entry']['name']); $form->setrequired("title"); $form->addtext("author", $change ? $entry->author() : ""); $form->addlabel("author", $lang['entry']['author']); $form->addtext("description", $change ? $entry->description() : ""); $form->addlabel("description", $lang['entry']['description']); $db = new CodeKBDatabase(); $db->dosql("SELECT name, symbol " . "FROM symbols " . "WHERE symbol LIKE 'type_%'"); if ($entry) { $symbol = $entry->symbol(); } else { $symbol = false; } while ($val = $db->row()) { $form->addradio("symbol", $val['name'], icon($val['name'], $val['name']), !$change && $val['name'] == "Unkown" || $val['name'] == $symbol, false); } $form->addtextarea("documentation", $change ? $entry->documentation() : ""); $form->addlabel("documentation", $lang['entry']['documentation'] . " (" . url("help.php?on=bbcode", $lang['entry']['bbcode'], null, true) . ")"); $form->addbutton("submit"); $form->addbutton("preview", $lang['general']['preview']); $form->addbutton("cancel"); if ($_POST['submit'] || $_POST['preview']) { $fill = $form->fill(); if (!$fill) { $site->addcontent(notice($lang['general']['missing'])); } } if ($_POST['submit'] && $fill) { if ($change) { // Change the entry try { $entry->change($form->value("title"), $form->value("author"), $form->value("symbol"), $form->value("description"), $form->value("documentation")); redirect("entry.php?id=" . $entry->id() . "&cat=" . $catid); } catch (Exception $e) { $site->addcontent(notice($lang['entry']['failedchange'])); } } else { // Add the new entry try { $ret = $category->addentry($form->value("title"), $form->value("author"), $form->value("symbol"), $form->value("description"), $form->value("documentation")); if (is_numeric($ret)) { if ($user->entrycan("changeentry", $ret)) { redirect("entry.php?id=" . $ret . "&cat=" . $category->id() . "&action=change"); } else { redirect("entry.php?id=" . $ret . "&cat=" . $category->id()); } } else { throw new CodeKBException(__METHOD__, "entry", "failedadd"); } } catch (Exception $e) { $site->addcontent(notice($lang['entry']['failedadd'])); } } } $dialog = new CodeKBTemplate("dialog"); if ($change) { $dialog->push("legend", $lang['entry']['change']); } else { $dialog->push("legend", $lang['entry']['add']); } $dialogitem = new CodeKBTemplate("dialogitem"); $content = $form->head(); $content .= $form->get("title") . "<br />\n"; $content .= $form->get("author"); $dialogitem->push("top", $content); $content = $form->get("description") . "<br /><br />\n"; $content .= $form->get("symbol") . "<br /><br />\n"; if ($conf['general']['javascript']) { $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[b][/b]';\" value=\"{$lang['bbcode']['bold']}\" title=\"{$lang['bbcode']['boldalt']}\" style=\"width: auto; font-weight: bold; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[i][/i]';\" value=\"{$lang['bbcode']['italic']}\" title=\"{$lang['bbcode']['italicalt']}\" style=\"width: auto; font-style: italic; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[u][/u]';\" value=\"{$lang['bbcode']['underline']}\" title=\"{$lang['bbcode']['underlinealt']}\" style=\"width: auto; text-decoration:underline; padding-left:3px; padding-right:3px;\" />\n"; $content .= $lang['bbcode']['size']; $content .= "<select name=\"bbsize\" size=\"1\" onchange=\"this.form.documentation.value=this.form.documentation.value+'[size='+this.form.bbsize.value+'][/size]';\">\n"; $content .= "<option value=\"1\">1</option>\n"; $content .= "<option value=\"2\">2</option>\n"; $content .= "<option value=\"3\">3</option>\n"; $content .= "<option value=\"4\">4</option>\n"; $content .= "<option value=\"5\">5</option>\n"; $content .= "<option value=\"6\">6</option>\n"; $content .= "<option value=\"7\">7</option>\n"; $content .= "</select>\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[center][/center]';\" value=\"{$lang['bbcode']['center']}\" title=\"{$lang['bbcode']['centeralt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[-]';\" value=\"{$lang['bbcode']['indent']}\" title=\"{$lang['bbcode']['indentalt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[--]';\" value=\"{$lang['bbcode']['line']}\" title=\"{$lang['bbcode']['linealt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[list]\\n[*]{$lang['bbcode']['listitem']}\\n[/list]';\" value=\"{$lang['bbcode']['list']}\" title=\"{$lang['bbcode']['listalt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[olist]\\n[*]{$lang['bbcode']['listitem']}\\n[/olist]';\" value=\"{$lang['bbcode']['olist']}\" title=\"{$lang['bbcode']['olistalt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[url][/url]';\" value=\"{$lang['bbcode']['url']}\" title=\"{$lang['bbcode']['urlalt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[anker= ]';\" value=\"{$lang['bbcode']['anker']}\" title=\"{$lang['bbcode']['ankeralt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[img][/img]';\" value=\"{$lang['bbcode']['image']}\" title=\"{$lang['bbcode']['imagealt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= "<input type=\"button\" onclick=\"this.form.documentation.value=this.form.documentation.value+'[pre][/pre]';\" value=\"{$lang['bbcode']['pre']}\" title=\"{$lang['bbcode']['prealt']}\" style=\"width: auto; padding-left:3px; padding-right:3px;\" />\n"; $content .= $lang['bbcode']['code']; $content .= "<select name=\"bbhigh\" size=\"1\" onchange=\"this.form.documentation.value=this.form.documentation.value+'[code='+this.form.bbhigh.value+'][/code]';\">\n"; foreach ($conf['highlight']['languages'] as $val) { $content .= "<option value=\"" . htmlentities($val) . "\">{$val}</option>\n"; } $content .= "</select>\n"; } $content .= $form->get("documentation") . "<br /><br />\n"; $dialogitem->push("content1", $content); $dialogitem->push("tail", $form->tail()); $dialogcode = $dialogitem->__toString(); if ($_POST['preview']) { $dialogitem2 = new CodeKBTemplate("dialogitem"); $dialogitem2->push("head", "<em><strong>" . $lang['general']['preview'] . "</strong></em><br /><br />"); $dialogitem2->push("content1", parsebbcode($form->value("documentation"))); $dialogcode .= $dialogitem2->__toString(); } $dialog->push("content", $dialogcode); $site->addcontent($dialog); return true; }