예제 #1
0
     $search_word = $cms->get_search_word_by_name($site_id, $search_word_name);
     if ($search_word && $search_word['id'] != $search_word_id) {
         $feedback = '<p class="Error">' . $fbNameExists . '</p>';
         $task = 'add_search_word';
     } else {
         $cms->update_search_word($search_word_id, $search_word_name);
     }
 } else {
     if ($cms->get_search_word_by_name($site_id, $search_word_name)) {
         $feedback = '<p class="Error">' . $fbNameExists . '</p>';
         $task = 'add_search_word';
     } else {
         if (!($search_word_id = $cms->add_search_word($site_id, $search_word_name))) {
             $feedback = '<p class="Error">' . $strSaveError . '</p>';
         } else {
             $cms->search_files($site['root_folder_id'], $search_word_id);
             $feedback = "<p>" . $cms_search_files_prefix . " '" . $search_word_name . "' " . $cms_search_files_suffix . "</p>";
         }
     }
 }
 if ($search_word_id > 0 && isset($_POST['files'])) {
     $selected_files = isset($_POST['selected_files']) ? $_POST['selected_files'] : array();
     while ($file_id = array_shift($_POST['files'])) {
         $selected = in_array($file_id, $selected_files);
         $attached = $cms->file_is_attached($file_id, $search_word_id);
         if ($selected && !$attached) {
             $cms->attach_file($file_id, $search_word_id);
         }
         if ($attached && !$selected) {
             $cms->detach_file($file_id, $search_word_id);
         }