示例#1
0
                 $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);
                 }
             }
         }
     }
     break;
 case 'delete_search_word':
     $cms->delete_search_word($_REQUEST['search_word_id']);
     break;
 case 'search_files':
     $site = $cms->get_site($site_id);
         if (!$cms->update_folder($folder_id, $name, $disabled, $_POST['priority'], $disable_multipage)) {
             $feedback = '<p class="Error">' . $strSaveError . '</p>';
         } else {
             if ($_POST['close'] == 'true') {
                 header('Location: ' . $return_to);
                 exit;
             }
         }
     }
     break;
 case 'save_search_words':
     $cms2 = new cms();
     $selected_search_words = isset($_POST['selected_search_words']) ? $_POST['selected_search_words'] : array();
     $cms->get_search_words($site_id);
     while ($cms->next_record()) {
         $attached = $cms2->file_is_attached($_POST['file_id'], $cms->f('id'));
         $selected = in_array($cms->f('id'), $selected_search_words);
         if ($selected && !$attached) {
             $cms2->attach_file($_POST['file_id'], $cms->f('id'));
         }
         if ($attached && !$selected) {
             $cms2->detach_file($_POST['file_id'], $cms->f('id'));
         }
     }
     $task = 'file_properties';
     if ($_POST['close'] == 'true') {
         header('Location: ' . $return_to);
         exit;
     }
     break;
 case 'search_file':