예제 #1
0
파일: newfolder.php 프로젝트: mgs2/kw-forum
     phorum_db_update_forum(array('forum_id' => $cur_folder_id, 'forum_path' => $built_paths[$cur_folder_id]));
 }
 // check for changes which require a forum-path update
 $setforumpath = false;
 if (defined("PHORUM_EDIT_FOLDER")) {
     if ($oldfolder['name'] != $_POST['name'] || $oldfolder['parent_id'] != $_POST['parent_id'] || $setvroot) {
         $setforumpath = true;
     }
     // add the folder
 }
 // other db-operations done, now doing the work for vroots
 if ($res) {
     $cur_folder_tmp = phorum_db_get_forums($cur_folder_id);
     $cur_folder = array_shift($cur_folder_tmp);
     if ($setforumpath) {
         $setforum_children = phorum_admin_get_descending($cur_folder_id);
         $built_paths = phorum_admin_build_path_array();
         phorum_db_update_forum(array('forum_id' => $cur_folder_id, 'forum_path' => $built_paths[$cur_folder_id]));
         if (is_array($setforum_children) && count($setforum_children)) {
             foreach ($setforum_children as $child_forum_id => $child) {
                 phorum_db_update_forum(array('forum_id' => $child['forum_id'], 'forum_path' => $built_paths[$child_forum_id]));
             }
         }
     }
     if (!$setvroot && ($oldfolder['vroot'] && $oldfolder['vroot'] == $cur_folder_id || $oldfolder['parent_id'] != $cur_folder['parent_id'])) {
         // get the parent_id and set its vroot (if its a folder)
         // to the desc folders/forums
         if ($cur_folder['parent_id'] > 0) {
             // is it a real folder?
             $parent_folder = phorum_db_get_forums($cur_folder['parent_id']);
             // then set the vroot to the vroot of the parent-folder (be it 0 or a real vroot)
예제 #2
0
    function phorum_admin_set_vroot($folder,$vroot=-1,$old_vroot=0) {
        // which vroot
        if($vroot == -1) {
            $vroot=$folder;
        }

        // get the desc forums/folders
        $descending=phorum_admin_get_descending($folder);
        $valid=array();

        // collecting vroots
        $vroots=array();
        foreach($descending as $id => $data) {
            if($data['folder_flag'] == 1 && $data['vroot'] != 0 && $data['forum_id'] == $data['vroot']) {
                $vroots[$data['vroot']]=true;
            }
        }

        // getting forums which are not in a vroot or not in *this* vroot
        foreach($descending as $id => $data) {
            if($data['vroot'] == $old_vroot || !isset($vroots[$data['vroot']])) {
                $valid[$id]=$data;
            }
        }

        // $valid = forums/folders which are not in another vroot
        $set_ids=array_keys($valid);
        $set_ids[]=$folder;

        $new_forum_data=array('forum_id'=>$set_ids,'vroot'=>$vroot);
        $returnval=phorum_db_update_forum($new_forum_data);

        return $returnval;
    }