function _getDraft($id)
 {
     if (!($draft = Draft::lookup($id))) {
         Http::response(205, "Draft not found. Create one first");
     }
     $body = Format::viewableImages($draft->getBody());
     echo JsonDataEncoder::encode(array('body' => $body, 'draft_id' => (int) $id));
 }
Exemple #2
0
if (is_a($template, EmailTemplateGroup)) {
    // New template implementation
    $id = 0;
    $tpl_id = $template->getId();
    $name = $template->getName();
    $group = $template;
    $selected = $_REQUEST['code_name'];
    $action = 'implement';
    $extras = array('code_name' => $selected, 'tpl_id' => $tpl_id);
    $msgtemplates = $template::$all_names;
    $desc = $msgtemplates[$selected];
    // Attempt to lookup the default data if it is defined
    $default = @$template->getMsgTemplate($selected);
    if ($default) {
        $info['subject'] = $default->getSubject();
        $info['body'] = Format::viewableImages($default->getBody());
    }
} else {
    // Template edit
    $id = $template->getId();
    $tpl_id = $template->getTplId();
    $name = $template->getGroup()->getName();
    $desc = $template->getDescription();
    $group = $template->getGroup();
    $selected = $template->getCodeName();
    $action = 'updatetpl';
    $extras = array();
    $msgtemplates = $group::$all_names;
    $info = array_merge(array('subject' => $template->getSubject(), 'body' => $template->getBodyWithImages()), $info);
}
$tpl = $msgtemplates[$selected];
Exemple #3
0
<?php

if (!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) {
    die('Access Denied');
}
$pageTypes = array('landing' => __('Landing page'), 'offline' => __('Offline page'), 'thank-you' => __('Thank you page'), 'other' => __('Other'));
$info = $qs = array();
if ($page && $_REQUEST['a'] != 'add') {
    $title = __('Update Page');
    $action = 'update';
    $submit_text = __('Save Changes');
    $info = $page->getHashtable();
    $info['body'] = Format::viewableImages($page->getBody());
    $info['notes'] = Format::viewableImages($info['notes']);
    $slug = Format::slugify($info['name']);
    $qs += array('id' => $page->getId());
} else {
    $title = __('Add New Page');
    $action = 'add';
    $submit_text = __('Add Page');
    $info['isactive'] = isset($info['isactive']) ? $info['isactive'] : 0;
    $qs += array('a' => $_REQUEST['a']);
}
$info = Format::htmlchars($errors && $_POST ? $_POST : $info);
?>
<form action="pages.php?<?php 
echo Http::build_query($qs);
?>
" method="post" id="save">
 <?php 
csrf_token();
Exemple #4
0
    }
}

//page
$nav->setActiveNav('new');
if ($cfg->isClientLoginRequired()) {
    if (!$thisclient) {
        require_once 'secure.inc.php';
    }
    elseif ($thisclient->isGuest()) {
        require_once 'login.php';
        exit();
    }
}

require(CLIENTINC_DIR.'header.inc.php');
if($ticket
        && (
            (($topic = $ticket->getTopic()) && ($page = $topic->getPage()))
            || ($page = $cfg->getThankYouPage())
        )) {
    // Thank the user and promise speedy resolution!
    echo Format::viewableImages($ticket->replaceVars($page->getBody()));
}
else {
    // require(CLIENTINC_DIR.'xmlSchema.php');
    require(CLIENTINC_DIR.'open.inc.php');
}
require(CLIENTINC_DIR.'footer.inc.php');
?>
Exemple #5
0
    function render($mode = false)
    {
        $config = $this->field->getConfiguration();
        ?>
<div class=""><h3><?php 
        echo Format::htmlchars($this->field->get('label'));
        ?>
</h3><em><?php 
        echo Format::htmlchars($this->field->get('hint'));
        ?>
</em><div><?php 
        echo Format::viewableImages($config['content']);
        ?>
</div>
        </div>
        <?php 
    }
Exemple #6
0
<?php

if (!defined('OSTSCPINC') || !$thisstaff || !$thisstaff->canManageFAQ()) {
    die('Access Denied');
}
$info = $qs = array();
if ($faq) {
    $title = __('Update FAQ') . ': ' . $faq->getQuestion();
    $action = 'update';
    $submit_text = __('Save Changes');
    $info = $faq->getHashtable();
    $info['id'] = $faq->getId();
    $info['topics'] = $faq->getHelpTopicsIds();
    $info['answer'] = Format::viewableImages($faq->getAnswer());
    $info['notes'] = Format::viewableImages($faq->getNotes());
    $qs += array('id' => $faq->getId());
} else {
    $title = __('Add New FAQ');
    $action = 'create';
    $submit_text = __('Add FAQ');
    if ($category) {
        $qs += array('cid' => $category->getId());
        $info['category_id'] = $category->getId();
    }
}
//TODO: Add attachment support.
$info = Format::htmlchars($errors && $_POST ? $_POST : $info);
$qstr = Http::build_query($qs);
?>
<form action="faq.php?<?php 
echo $qstr;
Exemple #7
0
 function getBodyWithImages()
 {
     return Format::viewableImages($this->getBody(), ROOT_PATH . 'image.php');
 }
Exemple #8
0
 function getBodyWithImages()
 {
     return Format::viewableImages($this->getBody());
 }
 function getResponseWithImages()
 {
     return Format::viewableImages($this->getResponse());
 }
Exemple #10
0
<?php

if (!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) {
    die('Access Denied');
}
$info = $qs = array();
if ($staff && $_REQUEST['a'] != 'add') {
    //Editing Department.
    $title = __('Update Agent');
    $action = 'update';
    $submit_text = __('Save Changes');
    $passwd_text = __('To reset the password enter a new one below');
    $info = $staff->getInfo();
    $info['id'] = $staff->getId();
    $info['teams'] = $staff->getTeams();
    $info['signature'] = Format::viewableImages($info['signature']);
    $qs += array('id' => $staff->getId());
} else {
    $title = __('Add New Agent');
    $action = 'create';
    $submit_text = __('Add Agent');
    $passwd_text = __('Temporary password required only for "Local" authentication');
    //Some defaults for new staff.
    $info['change_passwd'] = 1;
    $info['welcome_email'] = 1;
    $info['isactive'] = 1;
    $info['isvisible'] = 1;
    $info['isadmin'] = 0;
    $info['timezone_id'] = $cfg->getDefaultTimezoneId();
    $info['daylight_saving'] = $cfg->observeDaylightSaving();
    $qs += array('a' => 'add');
Exemple #11
0
 function getSignature($type, $id = null)
 {
     global $thisstaff;
     if (!$thisstaff) {
         Http::response(403, 'Login Required');
     }
     switch ($type) {
         case 'none':
             break;
         case 'mine':
             echo Format::viewableImages($thisstaff->getSignature());
             break;
         case 'dept':
             if (!($dept = Dept::lookup($id))) {
                 Http::response(404, 'No such department');
             }
             echo Format::viewableImages($dept->getSignature());
             break;
         default:
             Http::response(400, 'Unknown signature type');
             break;
     }
 }
<h3><?php echo __('Manage Content'); ?> &mdash; <?php echo Format::htmlchars($content->getName()); ?></h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<?php if ($errors['err']) { ?>
<div class="error-banner">
    <?php echo $errors['err']; ?>
</div>
<?php } ?>
<form method="post" action="#content/<?php echo $info['id']; ?>">
    <div class="error"><?php echo $errors['name']; ?></div>
    <input type="text" style="width: 100%; font-size: 14pt" name="name" value="<?php
        echo Format::htmlchars($info['name']); ?>" />
    <div style="margin-top: 5px">
    <div class="error"><?php echo $errors['body']; ?></div>
    <textarea class="richtext no-bar" name="body"><?php
    echo Format::viewableImages($info['body']);
?></textarea>
    </div>
    <div id="msg_info" style="margin-top:7px"><?php
echo $content->getNotes(); ?></div>
    <hr/>
    <p class="full-width">
        <span class="buttons pull-left">
            <input type="reset" value="<?php echo __('Reset'); ?>">
            <input type="button" name="cancel" class="<?php
                echo $user ? 'cancel' : 'close'; ?>" value="<?php echo __('Cancel'); ?>">
        </span>
        <span class="buttons pull-right">
            <input type="submit" value="<?php echo __('Save Changes'); ?>">
        </span>
     </p>
 function cannedResponse($tid, $cid, $format = 'text')
 {
     global $thisstaff, $cfg;
     if (!($ticket = Ticket::lookup($tid)) || !$ticket->checkStaffAccess($thisstaff)) {
         Http::response(404, 'Unknown ticket ID');
     }
     if ($cid && !is_numeric($cid)) {
         if (!($response = $ticket->getThread()->getVar($cid))) {
             Http::response(422, 'Unknown ticket variable');
         }
         // Ticket thread variables are assumed to be quotes
         $response = "<br/><blockquote>{$response->asVar()}</blockquote><br/>";
         //  Return text if html thread is not enabled
         if (!$cfg->isHtmlThreadEnabled()) {
             $response = Format::html2text($response, 90);
         } else {
             $response = Format::viewableImages($response);
         }
         // XXX: assuming json format for now.
         return Format::json_encode(array('response' => $response));
     }
     if (!$cfg->isHtmlThreadEnabled()) {
         $format .= '.plain';
     }
     $varReplacer = function (&$var) use($ticket) {
         return $ticket->replaceVars($var);
     };
     include_once INCLUDE_DIR . 'class.canned.php';
     if (!$cid || !($canned = Canned::lookup($cid)) || !$canned->isEnabled()) {
         Http::response(404, 'No such premade reply');
     }
     return $canned->getFormattedResponse($format, $varReplacer);
 }
Exemple #14
0
 function getAnswerWithImages()
 {
     return Format::viewableImages($this->ht['answer']);
 }
<?php
if(!defined('OSTSCPINC') || !$thisstaff || !$thisstaff->canManageFAQ()) die('Access Denied');
$info=array();
$qstr='';
if($category && $_REQUEST['a']!='add'){
    $title=__('Update Category').': '.$category->getName();
    $action='update';
    $submit_text=__('Save Changes');
    $info=$category->getHashtable();
    $info['id']=$category->getId();
    $info['notes'] = Format::viewableImages($category->getNotes());
    $qstr.='&id='.$category->getId();
}else {
    $title=__('Add New Category');
    $action='create';
    $submit_text=__('Add');
    $qstr.='&a='.$_REQUEST['a'];
}
$info=Format::htmlchars(($errors && $_POST)?$_POST:$info);

?>
<form action="categories.php?<?php echo $qstr; ?>" method="post" id="save">
 <?php csrf_token(); ?>
 <input type="hidden" name="do" value="<?php echo $action; ?>">
 <input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
 <input type="hidden" name="id" value="<?php echo $info['id']; ?>">
 <h2><?php echo __('FAQ Category');?></h2>
 <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
    <thead>
        <tr>
            <th colspan="2">
 function getAnswerWithImages()
 {
     return Format::viewableImages($this->ht['answer'], ROOT_PATH . 'image.php');
 }
echo Format::htmlchars($content->getName());
?>
</h3>
<a class="close" href=""><i class="icon-remove-circle"></i></a>
<hr/>
<form method="post" action="#content/<?php 
echo $content->getId();
?>
">
    <input type="text" style="width: 100%; font-size: 14pt" name="name" value="<?php 
echo Format::htmlchars($content->getName());
?>
" />
    <div style="margin-top: 5px">
    <textarea class="richtext no-bar" name="body"><?php 
echo Format::viewableImages($content->getBody());
?>
</textarea>
    </div>
    <div id="msg_info" style="margin-top:7px"><?php 
echo $content->getNotes();
?>
</div>
    <hr/>
    <p class="full-width">
        <span class="buttons pull-left">
            <input type="reset" value="<?php 
echo __('Reset');
?>
">
            <input type="button" name="cancel" class="<?php 
            }
            break;
        case 'mine':
            $signature = $thisstaff->getSignature();
            break;
    }
    ?>
                    <input type="hidden" name="draft_id" value=""/>
                    <textarea name="response" id="response" cols="50"
                        data-draft-namespace="ticket.response"
                        data-signature-field="signature" data-dept-id="<?php 
    echo $dept->getId();
    ?>
"
                        data-signature="<?php 
    echo Format::htmlchars(Format::viewableImages($signature));
    ?>
"
                        placeholder="<?php 
    echo __('Start writing your response here. Use canned responses from the drop-down above');
    ?>
"
                        data-draft-object-id="<?php 
    echo $ticket->getId();
    ?>
"
                        rows="9" wrap="soft"
                        class="richtext ifhtml draft draft-delete"><?php 
    echo $info['response'];
    ?>
</textarea>
                <?php 
        echo Format::htmlchars($field->getLocal('label'));
        ?>
            <?php 
        if ($field->isRequiredForUsers()) {
            ?>
            <font class="error">*</font>
            <?php 
        }
        ?>
			</label>
			</span><?php 
        if ($field->get('hint')) {
            ?>
                    <em style="color:gray;display:inline-block"><?php 
            echo Format::viewableImages($field->getLocal('hint'));
            ?>
</em>
                <?php 
        }
        ?>
            <?php 
    }
    $field->render(array('client' => true));
    ?>
</label><?php 
    foreach ($field->errors() as $e) {
        ?>
                <div class="error"><?php 
        echo $e;
        ?>