コード例 #1
0
             unlink($_FILES['content_file']['tmp_name']);
         } else {
             $_POST['content'] = smart_addslashes($_POST['content']);
         }
         $content = get_html_body($_POST['content']);
         $template_item_id = isset($_POST['template_item_id']) ? $_POST['template_item_id'] : 0;
         if ($template_item_id > 0) {
             if ($template_item = $cms->get_template_by_name($template_id, $name) && $template_item['id'] != $template_item_id) {
                 $feedback = '<p class="Error">' . $fbNameExists . '</p>';
             } else {
                 if (!$cms->update_template_item($template_item_id, $name, $_POST['content'])) {
                     $feedback = '<p class="Error">' . $strSaveError . '</p>';
                 }
             }
         } else {
             if ($cms->get_template_item_by_name($template_id, $name)) {
                 $feedback = '<p class="Error">' . $fbNameExists . '</p>';
             } else {
                 if (!($template_item_id = $cms->add_template_item($template_id, $name, $_POST['content']))) {
                     $feedback = '<p class="Error">' . $strSaveError . '</p>';
                 }
             }
         }
         if ($cms->get_template_items($template_id) == 1) {
             $cms->set_main_template_item($template_id, $template_item_id);
         }
         if ($_POST['close'] == 'true') {
             $task = '';
         }
     }
 }