Beispiel #1
0
                    } 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);
        $task = 'add_search_word';
        $cms->search_files($site['root_folder_id'], $_POST['search_word_id']);
        $feedback = "<p>" . $cms_search_files_prefix . " '" . $_POST['search_word_name'] . "' " . $cms_search_files_suffix . "</p>";
        break;
}
                }
            }
        }
        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':
        $task = 'file_properties';
        $search_file = true;
        break;
}
//set the page title for the header file
$page_title = $lang_modules['cms'];