예제 #1
0
 public static function template_handle_save($template_id, $data)
 {
     // check if we're savniga company id and that this user has access to this company, and permissions to edit templates.
     $company_id = isset($_REQUEST['company_id']) ? (int) $_REQUEST['company_id'] : false;
     if ($company_id) {
         $company = self::get_company($company_id);
         if ($company) {
             $existing_template = module_template::get_template($template_id);
             if ($existing_template && $existing_template['template_id'] == $template_id) {
                 // we're saving a template for this particular company.
                 // if it's an empty template content then we remove this company template so it reverts to the system default.
                 if (isset($data['content']) && !strlen(trim($data['content']))) {
                     delete_from_db('company_template', array('company_id', 'template_id'), array($company_id, $template_id));
                     set_message('Company template successfully reset to default');
                     redirect_browser(module_template::link_open($template_id));
                 } else {
                     $sql = 'REPLACE INTO `' . _DB_PREFIX . "company_template` SET company_id = " . (int) $company_id . ", `template_id` = " . (int) $template_id . ", `description` = '" . mysql_real_escape_string(isset($data['description']) ? $data['description'] : '') . "', `content` = '" . mysql_real_escape_string(isset($data['content']) ? $data['content'] : '') . "', `wysiwyg` = '" . mysql_real_escape_string(isset($data['wysiwyg']) ? $data['wysiwyg'] : '') . "'";
                     query($sql);
                     set_message('Unique company template successfully updated');
                     redirect_browser(module_template::link_open($template_id) . '&company_id=' . $company_id);
                 }
             }
         }
     }
 }
예제 #2
0
/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!module_config::can_i('view', 'Settings') || !module_template::can_i('edit', 'Templates')) {
    redirect_browser(_BASE_HREF);
}
$template_id = $_REQUEST['template_id'];
$template = array();
if ((int) $template_id && $template_id != 'new') {
    $template = module_template::get_template($template_id);
}
if (!$template) {
    $template_id = 'new';
    $template = array('template_id' => 'new', 'template_key' => '', 'description' => '', 'content' => '', 'name' => '', 'default_text' => '', 'wysiwyg' => 1);
    module_security::sanatise_data('template', $template);
}
?>

<form action="<?php 
echo module_template::link_open(false);
?>
" method="post" id="template_form">

      <?php 
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
예제 #3
0
	<tr class="title">
		<th><?php 
echo _l('Template Name');
?>
</th>
		<th><?php 
echo _l('Template Description');
?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
$c = 0;
foreach ($templates as $template) {
    $template = module_template::get_template($template['template_id']);
    ?>

        <tr class="<?php 
    echo $c++ % 2 ? "odd" : "even";
    ?>
">
            <td class="row_action">
	            <?php 
    echo module_template::link_open($template['template_id'], true);
    ?>

            </td>
			<td>
				<?php 
    echo htmlspecialchars($template['description']);