function __construct() { global $page, $config, $gpLayouts, $langmessage; $page->head_js[] = '/include/js/theme_content.js'; $page->head_js[] = '/include/js/dragdrop.js'; $page->css_admin[] = '/include/css/theme_content.less'; common::LoadComponents('resizable'); parent::__construct(); $this->GetPossible(); $cmd = common::GetCommand(); //layout requests if (strpos($page->requested, '/')) { $parts = explode('/', $page->requested); $layout_part = $parts[1]; if (gp_remote_themes && strtolower($layout_part) == 'remote') { $this->RemoteBrowse(); return; } if (strtolower($layout_part) == 'available') { $this->ShowAvailable(); return; } if (isset($gpLayouts[$layout_part])) { $this->layout_request = true; $this->EditLayout($layout_part, $cmd); return; } } //set current layout $this->curr_layout = $config['gpLayout']; if (isset($_REQUEST['layout'])) { $this->curr_layout = $_REQUEST['layout']; } if (!array_key_exists($this->curr_layout, $gpLayouts)) { message($langmessage['OOPS'] . ' (Invalid Layout)'); $cmd = ''; } $this->SetLayoutArray(); switch ($cmd) { //remote themes case 'remote_install': $this->RemoteInstall(); return; case 'remote_install_confirmed': $installer = $this->RemoteInstallConfirmed('theme'); $this->GetPossible(); $this->UpdateLayouts($installer); break; case 'deletetheme': $this->DeleteTheme(); $this->GetPossible(); break; //adminlayout //adminlayout case 'adminlayout': $this->AdminLayout(); return; //theme ratings //theme ratings case 'Update Review': case 'Send Review': case 'rate': $this->admin_addon_rating('theme', 'Admin_Theme_Content'); if ($this->ShowRatingText) { return; } break; //new layouts //new layouts case 'preview': case 'preview_iframe': case 'newlayout': case 'addlayout': if ($this->NewLayout($cmd)) { return; } break; case 'updatetheme': $this->UpdateTheme($_REQUEST['source']); break; //copy //copy case 'copy': $this->CopyLayoutPrompt(); return; case 'copylayout': $this->CopyLayout(); break; //editing layouts without a layout id as part of slug //editing layouts without a layout id as part of slug case 'editlayout': //linked from install page without a layout id //linked from install page without a layout id case 'details': $this->EditLayout($this->curr_layout, $cmd); return; //layout options //layout options case 'deletelayout': $this->DeleteLayoutConfirmed(); break; //links //links case 'editlinks': case 'editcustom': $this->SelectLinks(); return; case 'savelinks': $this->SaveLinks(); break; //text //text case 'edittext': $this->EditText(); return; case 'savetext': $this->SaveText(); break; case 'saveaddontext': $this->SaveAddonText(); break; case 'addontext': $this->AddonText(); return; } if ($this->LayoutCommands($cmd)) { return; } $this->ShowLayouts(); }
function CopyAddonDir($fromDir, $toDir) { $dh = @opendir($fromDir); if (!$dh) { return false; } if (!gpFiles::CheckDir($toDir)) { message('Copy failed: ' . $fromDir . ' to ' . $toDir . ' (1)'); return false; } while (($file = readdir($dh)) !== false) { if (strpos($file, '.') === 0) { continue; } $fullFrom = $fromDir . '/' . $file; $fullTo = $toDir . '/' . $file; //directories if (is_dir($fullFrom)) { if (!admin_addon_install::CopyAddonDir($fullFrom, $fullTo)) { closedir($dh); return false; } continue; } //files //If the destination file already exists, it will be overwritten. if (!copy($fullFrom, $fullTo)) { message('Copy failed: ' . $fullFrom . ' to ' . $fullTo . ' (2)'); closedir($dh); return false; } } closedir($dh); return true; }
function __construct() { global $langmessage, $page; parent::__construct(); $this->InitRating(); $this->GetData(); $page->head_js[] = '/include/js/auto_width.js'; $this->avail_addons = $this->GetAvailAddons(); $cmd = common::GetCommand(); switch ($cmd) { case 'LocalInstall': $this->LocalInstall(); break; case 'remote_install': $this->RemoteInstall(); return; case 'remote_install_confirmed': $this->RemoteInstallConfirmed(); break; case 'Update Review': case 'Send Review': case 'rate': $this->admin_addon_rating('plugin', 'Admin_Addons'); if ($this->ShowRatingText) { return; } break; case 'enable': case 'disable': $this->GadgetVisibility($cmd); return; case 'uninstall': $this->Uninstall(); return; case 'confirm_uninstall': $this->Confirm_Uninstall(); break; case 'history': $this->History(); return; } //single addon if (strpos($page->requested, '/')) { $request_parts = explode('/', $page->requested); switch (strtolower($request_parts[1])) { case 'remote': if (gp_remote_plugins) { $this->RemoteBrowse(); } return; case 'available': $this->ShowAvailable(); return; default: $this->ShowAddon($request_parts[1]); return; } } $this->Select(); $this->CleanAddonFolder(); }
function ChangeInstallConfirmed(&$addonName) { global $dataDir, $langmessage; $installFolder = $dataDir . '/data/_addoncode/' . $addonName; $fromFolder = $dataDir . '/addons/' . $addonName; if (!file_exists($installFolder)) { message($langmessage['OOPS']); return; } if (!file_exists($fromFolder)) { message($langmessage['OOPS']); return; } if (is_link($installFolder)) { unlink($installFolder); if (!admin_addon_install::CopyAddonDir($fromFolder, $installFolder)) { message($langmessage['OOPS']); return; } } else { gpFiles::RmAll($installFolder); if (!symlink($fromFolder, $installFolder)) { message($langmessage['OOPS']); return; } } message('Install Type Changed'); }
function __construct() { global $langmessage, $config, $page; //header links $this->header_paths = array('Admin_Addons' => $langmessage['Manage Plugins']); if (gp_remote_plugins) { $this->header_paths['Admin_Addons/Remote'] = $langmessage['Find Plugins']; } $page->head_js[] = '/include/js/auto_width.js'; parent::__construct(); $this->InitRating(); if (!isset($config['admin_links'])) { $config['admin_links'] = array(); } if (!isset($config['gadgets'])) { $config['gadgets'] = array(); } $this->GetData(); $cmd = common::GetCommand(); $request_parts = array(); if (strpos($page->requested, '/')) { $request_parts = explode('/', $page->requested); } if ($request_parts) { switch (strtolower($request_parts[1])) { case 'remote': if (gp_remote_plugins) { $this->RemoteBrowse(); } return; default: $this->ShowAddon($request_parts[1]); return; } } switch ($cmd) { case 'local_install': $this->LocalInstall(); break; case 'remote_install': $this->RemoteInstall(); return; case 'remote_install_confirmed': $this->RemoteInstallConfirmed(); break; case 'Update Review': case 'Send Review': case 'rate': $this->admin_addon_rating('plugin', 'Admin_Addons'); if ($this->ShowRatingText) { return; } break; case 'enable': case 'disable': $this->GadgetVisibility($cmd); return; case 'uninstall': $this->Uninstall(); return; case 'confirm_uninstall': $this->Confirm_Uninstall(); break; case 'history': $this->History(); return; } $this->Select(); $this->CleanAddonFolder(); }