/** * Handle the renaming of galleries for \gp\admin\Menu\Tools.php * * @static * */ public static function RenamedGallery($old_title, $new_title) { $galleries = self::GetData(); if (!isset($galleries[$old_title])) { return; } if (\gp\tool\Files::ArrayInsert($old_title, $new_title, $galleries[$old_title], $galleries, 0, 1)) { self::SaveIndex($galleries); } }
public function NewDrag() { global $langmessage, $gp_index, $gp_titles; $this->page->ajaxReplace = array(); //get the title of the gallery that was moved $dragging = $_POST['title']; if (!isset($this->galleries[$dragging])) { message($langmessage['OOPS'] . ' (Title not in gallery list)'); return false; } $index = $gp_index[$dragging]; $info = $this->galleries[$dragging]; unset($this->galleries[$dragging]); //set visibility if (isset($_POST['active'])) { $info['visibility'] = 'show'; unset($gp_titles[$index]['vis']); } else { $info['visibility'] = 'hide'; } //place before the element represented by $_POST['next'] if it's set if (isset($_POST['next'])) { $next = $_POST['next']; if (!isset($this->galleries[$next])) { message($langmessage['OOPS'] . ' (Next not found)'); return false; } if (!\gp\tool\Files::ArrayInsert($next, $dragging, $info, $this->galleries)) { message($langmessage['OOPS'] . ' (Insert Failed)'); return false; } //place at the end } else { $this->galleries[$dragging] = $info; } //save it if (!self::SaveIndex($this->galleries)) { message($langmessage['OOPS'] . ' (Not Saved)'); return false; } if (!\gp\admin\Tools::SavePagesPHP(true)) { return false; } }
/** * Copy a layout * */ public function CopyLayout() { global $gpLayouts, $langmessage; $copy_id = $this->ReqLayout(); if ($copy_id === false) { return; } if (empty($_POST['label'])) { message($langmessage['OOPS'] . '(Empty Label)'); return; } $newLayout = $gpLayouts[$copy_id]; $newLayout['color'] = self::GetRandColor(); $newLayout['label'] = htmlspecialchars($_POST['label']); //get new unique layout id do { $layout_id = rand(1000, 9999); } while (isset($gpLayouts[$layout_id])); $gpLayouts[$layout_id] = $newLayout; if (!\gp\tool\Files::ArrayInsert($copy_id, $layout_id, $newLayout, $gpLayouts, 1)) { message($langmessage['OOPS'] . '(Not Inserted)'); return; } //copy any css $css = $this->layoutCSS($copy_id); if (!$this->SaveCustom($layout_id, $css)) { return false; } $this->SaveLayouts(); }