Ejemplo n.º 1
0
     } else {
         if ($_SESSION['type'] == "story") {
             $GLOBALS['__site_hash']['stories'][$partObj->id] = 'NEXT';
         }
     }
 }
 if ($_REQUEST['keep_discussions'] == 'no') {
     $keepDiscussion = FALSE;
 } else {
     $keepDiscussion = TRUE;
 }
 // move the object.
 $partObj->copyObj($parentObj, $removeOrigional, $keepaddedby, $keepDiscussion);
 // If we have moved to a new site, update the site links from the hash.
 $newSiteObj = new site($parentObj->owningSiteObj->name);
 $newSiteObj->fetchSiteAtOnceForeverAndEverAndDontForgetThePermissionsAsWell_Amen();
 if ($_SESSION['type'] == "section") {
     $newPartObj =& $newSiteObj->sections[$partObj->id];
 } else {
     if ($_SESSION['type'] == "page") {
         $newPartObj =& $newSiteObj->sections[$_REQUEST['section']]->pages[$partObj->id];
     } else {
         if ($_SESSION['type'] == "story") {
             $newPartObj =& $newSiteObj->sections[$_REQUEST['section']]->pages[$_REQUEST['page']]->stories[$partObj->id];
         }
     }
 }
 updateSiteLinksFromHash($newSiteObj, $newPartObj);
 $newSiteObj->updateDB(1, 1);
 // delete the origional
 if ($_REQUEST['action'] == "MOVE") {
Ejemplo n.º 2
0
 function copySite($newName, $clearPermissions = 1, $copyDiscussions = FALSE)
 {
     if ($newName == $this->name) {
         return FALSE;
     }
     if ($newName == "" || !$newName) {
         return FALSE;
     }
     $oldName = $this->name;
     $this->fetchSiteAtOnceForeverAndEverAndDontForgetThePermissionsAsWell_Amen();
     // Make a hash array of site, section, and page ids so that
     makeSiteHash($this);
     $newSiteObj = $this;
     $newSiteObj->setSiteName($newName, 1);
     // Since we are specifying TRUE for the 'copy' option, each
     // part should add its new id to the global hash
     $newSiteObj->insertDB(1, 1, 0, $copyDiscussions);
     // Copy all the media
     $query = "\n\t\t\tSELECT\n\t\t\t\tmedia_id\n\t\t\tFROM\n\t\t\t\tmedia\n\t\t\t\t\tINNER JOIN\n\t\t\t\tslot\n\t\t\t\t\tON\n\t\t\t\t\t\tmedia.FK_site = slot.FK_site\n\t\t\tWHERE\n\t\t\t\tslot_name='" . addslashes($oldName) . "'\n\t\t\t\tAND \n\t\t\t\tmedia_type != 'other'\n\t\t";
     $r = db_query($query);
     while ($a = db_fetch_assoc($r)) {
         copy_media($a['media_id'], $newName);
     }
     $newSiteObj = NULL;
     unset($newSiteObj);
     $newSiteObj = new site($newName);
     $newSiteObj->fetchSiteAtOnceForeverAndEverAndDontForgetThePermissionsAsWell_Amen();
     // Remove the permissions if we are clearing them.
     if ($clearPermissions) {
         $editors = $newSiteObj->getEditors();
         foreach ($editors as $editor) {
             $newSiteObj->delEditor($editor);
         }
     }
     // Parse through all the text for links refering to parts of the
     // old site and update them with the new ids.
     updateSiteLinksFromHash($newSiteObj, $newSiteObj);
     $newSiteObj->updateDB(1, 1);
     // Delete any editors that we wanted to delete.
     $newSiteObj->deletePendingEditors();
 }