function SaveConfig() { global $config, $langmessage; $possible = $this->variables; foreach ($possible as $key => $curr_possible) { if ($curr_possible == 'boolean') { if (isset($_POST[$key]) && $_POST[$key] == 'true') { $config[$key] = true; } else { $config[$key] = false; } } elseif ($curr_possible == 'integer') { if (isset($_POST[$key]) && is_numeric($_POST[$key])) { $config[$key] = $_POST[$key]; } } elseif (isset($_POST[$key])) { $config[$key] = $_POST[$key]; } } $config['history_limit'] = min($config['history_limit'], gp_backup_limit); if (!admin_tools::SaveConfig()) { message($langmessage['OOPS']); return false; } if (isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') { message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']); } else { message($langmessage['SAVED']); } }
function GenerateOutput() { global $langmessage, $page; common::ShowingGallery(); echo '<h2>'; echo gpOutput::ReturnText('galleries'); echo '</h2>'; includeFile('admin/admin_tools.php'); $wrap = admin_tools::CanEdit($page->gp_index); if ($wrap) { echo gpOutput::EditAreaLink($edit_index, 'Admin_Galleries', $langmessage['edit']); echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">'; // class="edit_area" added by javascript } $image_text = gpOutput::ReturnText('image'); $images_text = gpOutput::ReturnText('images'); $list = ''; $shown = 0; foreach ($this->galleries as $title => $info) { //page is hidden if (!$this->GalleryVisible($title, $info)) { continue; } $count = ''; if (is_array($info)) { $icon = $info['icon']; if ($info['count'] == 1) { $count = $info['count'] . ' ' . gpOutput::ReturnText('image'); } elseif ($info['count'] > 1) { $count = $info['count'] . ' ' . gpOutput::ReturnText('images'); } } else { $icon = $info; } if (empty($icon)) { continue; } $icon = rawurldecode($icon); //prevent double encoding if (strpos($icon, '/thumbnails/') === false) { $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg'); } else { $thumbPath = common::GetDir('/data/_uploaded' . $icon); } $label = common::GetLabel($title); $title_attr = ' title="' . common::GetBrowserTitle($title) . '"'; $label_img = ' <img src="' . $thumbPath . '" alt=""/>'; $list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>'; } if (!empty($list)) { echo '<ul class="gp_gallery gp_galleries">'; echo $list; echo '</ul>'; } if ($wrap) { echo '</div>'; } $this->PostSave(); }
/** * Show files in the cache * */ function ShowFiles() { global $page, $langmessage; $page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js'; $page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});'; if (!$this->all_files) { return; } echo '<p>'; echo common::Link('Admin_Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?')); echo '</p>'; echo '<table class="bordered tablesorter full_width">'; echo '<thead>'; echo '<tr><th>'; echo $langmessage['file_name']; echo '</th><th>'; echo $langmessage['File Size']; echo '</th><th>'; echo 'Touched'; echo '</th><th>'; echo $langmessage['options']; echo '</th></tr>'; echo '</thead>'; $total_size = 0; echo '<tbody>'; foreach ($this->all_files as $file) { $full = $this->cache_dir . '/' . $file; echo '<tr><td>'; echo '<a href="?cmd=ViewFile&file=' . rawurlencode($file) . '">'; echo $file; echo '</a>'; echo '</td><td>'; $size = filesize($full); echo '<span style="display:none">' . $size . '</span>'; echo admin_tools::FormatBytes($size); $total_size += $size; echo '</td><td>'; $elapsed = admin_tools::Elapsed(time() - filemtime($full)); echo sprintf($langmessage['_ago'], $elapsed); echo '</td><td>'; echo common::Link('Admin_Cache', $langmessage['delete'], 'cmd=DeleteFile&file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm'])); echo '</tr>'; } echo '</tbody>'; //totals echo '<tfoot>'; echo '<tr><td>'; echo number_format(count($this->all_files)) . ' Files'; echo '</td><td>'; echo admin_tools::FormatBytes($total_size); echo '</td><td>'; echo '</tr>'; echo '</table>'; }
function RunScript() { global $gp_index, $langmessage, $page; $scriptinfo = special_display::GetScriptInfo($this->requested); if ($scriptinfo === false) { switch ($this->requested) { case 'Special_ExtraJS': $this->ExtraJS(); //dies } $this->Error_404($this->title); return; } $this->gp_index = $gp_index[$this->requested]; $this->label = common::GetLabel($this->requested); $this->TitleInfo = $scriptinfo; $menu_permissions = false; if (common::LoggedIn()) { $menu_permissions = admin_tools::HasPermission('Admin_Menu'); if ($menu_permissions) { $page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" '); $page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"'); } if (admin_tools::HasPermission('Admin_User')) { $page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" '); } } //allow addons to affect page actions and how a page is displayed $cmd = common::GetCommand(); $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd)); if ($cmd !== $cmd_after) { $cmd = $cmd_after; if ($cmd === 'return') { return; } } if ($menu_permissions) { switch ($cmd) { // rename & details case 'renameform': $this->RenameForm(); return; case 'renameit': if ($this->RenameFile()) { return; } break; } } $this->contentBuffer = special_display::ExecInfo($scriptinfo); }
/** * Toggle the visibility of a page * */ static function Toggle($index, $visibility = '') { global $gp_titles, $langmessage; if (!isset($gp_titles[$index])) { msg($langmessage['OOPS'] . ' (Invalid Request)'); return false; } if ($visibility == 'private') { $gp_titles[$index]['vis'] = 'private'; } else { unset($gp_titles[$index]['vis']); } if (!\admin_tools::SavePagesPHP()) { msg($langmessage['OOPS'] . ' (VT1)'); return false; } return true; }
/** * Update the gp_index, gp_titles and menus so that special pages can be renamed * */ function Upgrade_234() { global $gp_index, $gp_titles, $gp_menu, $config, $dataDir; includeFile('tool/gpOutput.php'); $special_indexes = array(); $new_index = array(); $new_titles = array(); foreach ($gp_index as $title => $index) { $info = $gp_titles[$index]; $type = common::SpecialOrAdmin($title); if ($type === 'special') { $special_indexes[$index] = strtolower($title); $index = strtolower($title); $info['type'] = 'special'; //some older versions didn't maintain this value well } $new_index[$title] = $index; $new_titles[$index] = $info; } $gp_titles = $new_titles; $gp_index = $new_index; //update gp_menu $gp_menu = $this->FixMenu($gp_menu, $special_indexes); //save pages if (!admin_tools::SavePagesPHP()) { return; } $config['gpversion'] = '2.3.4'; admin_tools::SaveConfig(); //update alt menus if (isset($config['menus']) && is_array($config['menus'])) { foreach ($config['menus'] as $key => $value) { $menu_file = $dataDir . '/data/_menus/' . $key . '.php'; if (gpFiles::Exists($menu_file)) { $menu = gpOutput::GetMenuArray($key); $menu = $this->FixMenu($menu, $special_indexes); gpFiles::SaveData($menu_file, 'menu', $menu); } } } }
function ProtectCommand($cmd) { global $protect_object, $gp_titles, $langmessage; if (!admin_tools::HasPermission('Admin_Protect')) { return; } switch ($cmd) { case 'passprotect': case 'rm_protection': case 'protect_page': break; default: return $cmd; } if (!isset($_POST['index']) || !isset($gp_titles[$_POST['index']])) { message($langmessage['OOPS']); return $cmd; } $index = $_POST['index']; $protect_object->IsProtected($index); return $protect_object->Admin($cmd, $index); }
function Admin($cmd, $index) { global $gp_titles, $langmessage, $page; if (!admin_tools::HasPermission('Admin_Protect')) { return; } switch ($cmd) { case 'passprotect': $this->OptionsForm($index); return 'return'; case 'rm_protection': $page->ajaxReplace = array(); unset($this->config['pages'][$index]); if ($this->SaveConfig()) { $this->is_protected = false; message($langmessage['SAVED']); } else { message($langmessage['OOPS']); } return $cmd; case 'protect_page': $page->ajaxReplace = array(); $this->config['pages'][$index] = true; if ($this->SaveConfig()) { $this->is_protected = true; message($langmessage['SAVED']); } else { message($langmessage['OOPS']); } return $cmd; } if ($this->is_protected) { message('Notice: This page is currently protected and can only be viewed by logged in users.'); } return $cmd; }
/** * Return a formatted list of links associated with $addon * @return string */ static function GetAddonSubLinks($addon = false) { global $config; $special_links = admin_tools::GetAddonTitles($addon); $admin_links = admin_tools::GetAddonComponents($config['admin_links'], $addon); $result = ''; foreach ($special_links as $linkName => $linkInfo) { $result .= '<li>'; $result .= common::Link($linkName, $linkInfo['label']); $result .= '</li>'; } foreach ($admin_links as $linkName => $linkInfo) { if (admin_tools::HasPermission($linkName)) { $result .= '<li>'; $result .= common::Link($linkName, $linkInfo['label']); $result .= '</li>'; } } return $result; }
function ShowAddon($addon = false) { global $config, $langmessage; if ($addon === false) { $addon =& $_REQUEST['addon']; } if (!isset($config['addons'][$addon])) { message($langmessage['OOPS'] . '(s1)'); $this->Select(); return; } $cmd = common::GetCommand(); switch ($cmd) { case 'enable': case 'disable': $this->GadgetVisibility($addon, $cmd); break; /* case 'changeinstall': $this->ChangeInstallType($addon); break; case 'changeinstall_confirmed': $this->ChangeInstallConfirmed($addon); break; */ } $this->FindForm(); echo '<h2 class="hmargin">'; echo common::Link('Admin_Addons', $langmessage['Manage Plugins']); echo ' » '; echo $config['addons'][$addon]['name']; echo '</h2>'; echo '<table class="bordered" style="width:90%">'; //show Special Links $sublinks = admin_tools::GetAddonTitles($addon); if (!empty($sublinks)) { echo '<tr><th>'; echo 'Special Links'; echo '</th>'; echo '<th>'; echo $langmessage['options']; echo '</th></tr>'; foreach ($sublinks as $linkName => $linkInfo) { echo '<tr><td>'; echo common::Link($linkName, $linkInfo['label']); echo '</td>'; echo '<td>'; echo '-'; echo '</td></tr>'; } } //show Admin Links $sublinks = admin_tools::GetAddonComponents($config['admin_links'], $addon); if (!empty($sublinks)) { echo '<tr><th>'; echo 'Admin Links'; echo '</th>'; echo '<th>'; echo $langmessage['options']; echo '</th></tr>'; foreach ($sublinks as $linkName => $linkInfo) { echo '<tr><td>'; echo common::Link($linkName, $linkInfo['label']); echo '</td>'; echo '<td>'; echo '-'; echo '</td></tr>'; } } //show Gadgets $gadgets = admin_tools::GetAddonComponents($config['gadgets'], $addon); if (is_array($gadgets) && count($gadgets) > 0) { echo '<tr><th>'; echo $langmessage['gadgets']; echo '</th>'; echo '<th>'; echo $langmessage['options']; echo '</th></tr>'; foreach ($gadgets as $name => $value) { echo '<tr><td>'; echo str_replace('_', ' ', $name); echo '</td><td>'; if (isset($value['disabled'])) { echo common::Link('Admin_Addons', $langmessage['enable'], 'cmd=enable&addon=' . $addon . '&gadget=' . rawurlencode($name), ' name="creq" '); echo ' - '; echo '<b>' . $langmessage['disabled'] . '</b>'; } else { echo ' <b>' . $langmessage['enabled'] . '</b>'; echo ' - '; echo common::Link('Admin_Addons', $langmessage['disable'], 'cmd=disable&addon=' . $addon . '&gadget=' . rawurlencode($name), ' name="creq" '); } echo '</td></tr>'; } } //editable text if (isset($config['addons'][$addon]['editable_text']) && admin_tools::HasPermission('Admin_Theme_Content')) { echo '<tr><th>'; echo $langmessage['editable_text']; echo '</th>'; echo '<th>'; echo $langmessage['options']; echo '</th></tr>'; echo '<tr><td>'; echo $config['addons'][$addon]['editable_text']; echo '</td>'; echo '<td>'; echo common::Link('Admin_Theme_Content', $langmessage['edit'], 'cmd=addontext&addon=' . urlencode($addon), ' title="' . urlencode($langmessage['editable_text']) . '" name="gpabox" '); echo '</td></tr>'; } //hooks $hooks = admin_addons::AddonHooks($addon); if (count($hooks) > 0) { echo '<tr><th>'; echo 'Hooks'; echo '</th>'; echo '<th>'; echo $langmessage['options']; echo '</th></tr>'; foreach ($hooks as $name => $info) { echo '<tr><td>'; echo str_replace('_', ' ', $name); echo '</td><td>'; echo ' '; echo '</td></tr>'; } } echo '</table>'; if (!isset($config['addons'][$addon]['id'])) { return; } echo '<h3>' . $langmessage['rate_this_addon'] . '</h3>'; $id = $config['addons'][$addon]['id']; if (isset($this->addonReviews[$id])) { $review =& $this->addonReviews[$id]; $review += array('time' => time()); echo 'You posted the following review on ' . date('M j, Y', $review['time']); echo '<table cellpadding="7">'; echo '<tr>'; echo '<td>'; echo 'Rating'; echo '</td>'; echo '<td>'; $this->ShowRating($id, $review['rating']); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo 'Review'; echo '</td>'; echo '<td>'; echo nl2br(htmlspecialchars($review['review'])); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>'; echo '</td>'; echo '<td>'; echo common::Link('Admin_Addons', 'Edit Review', 'cmd=rate&arg=' . $id); echo '</td>'; echo '</tr>'; echo '</table>'; } else { echo '<table cellpadding="7">'; echo '<tr>'; echo '<td>'; echo 'Rating'; echo '</td>'; echo '<td>'; $this->ShowRating($id, 5); echo '</td>'; echo '</tr>'; echo '</table>'; } }
/** * Assign a layout to the $title. Child pages without a layout assigned will inherit this setting * @param string $title */ function SetLayout() { global $gp_index, $gp_titles, $langmessage, $gpLayouts; $index = $_POST['index']; $title = common::IndexToTitle($index); if (!$title) { message($langmessage['OOPS']); return; } $this->title = $title; $layout = $_POST['layout']; if (!isset($gpLayouts[$layout])) { message($langmessage['OOPS']); return; } if (!common::verify_nonce('use_' . $layout)) { message($langmessage['OOPS']); return; } //unset, then reset if needed unset($gp_titles[$index]['gpLayout']); $currentLayout = display::OrConfig($index, 'gpLayout'); if ($currentLayout != $layout) { $gp_titles[$index]['gpLayout'] = $layout; } if (!admin_tools::SavePagesPHP()) { message($langmessage['OOPS'] . '(3)'); return false; } message($langmessage['SAVED']); }
/** * Get addon data from gpEasy.com and display to user * */ function RemoteBrowse() { global $langmessage, $config, $dataDir; //search options if (isset($_GET['search_option'])) { $save = true; switch ($_GET['search_option']) { case 'version': unset($config['search_version']); break; case 'noversion': $config['search_version'] = false; break; default: $save = false; break; } if ($save) { admin_tools::SaveConfig(); } } //make a list of installed addon id's $this->installed_ids = array(); if (isset($config['addons']) && is_array($config['addons'])) { foreach ($config['addons'] as $addon_info) { if (isset($addon_info['id'])) { $this->installed_ids[] = $addon_info['id']; } } } includeFile('tool/RemoteGet.php'); //search settings $this->searchUrl = $this->path_remote; $this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated']; $this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded']; $this->searchOrderOptions['modified'] = $langmessage['Recently Updated']; $this->searchOrderOptions['created'] = $langmessage['Newest']; $_GET += array('q' => ''); if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) { $this->searchPage = $_REQUEST['page']; } //version specific search $search_version = false; if (!isset($config['search_version']) || $config['search_version']) { $this->searchQuery .= '&ug=' . rawurlencode(gpversion); $search_version = true; } if (!empty($_GET['q'])) { $this->searchQuery .= '&q=' . rawurlencode($_GET['q']); } $this->SearchOrder(); $slug = 'Plugins'; if ($this->config_index == 'themes') { $slug = 'Themes'; } $src = addon_browse_path . '/' . $slug . '?cmd=remote&format=json&' . $this->searchQuery . '&page=' . $this->searchPage; // format=json added 4.6b3 //check cache $cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt'; $use_cache = false; if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) { $result = file_get_contents($cache_file); $use_cache = true; } else { $result = gpRemoteGet::Get_Successful($src); } //no response if (!$result) { if ($use_cache) { unlink($cache_file); } echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched') . '</p>'; return; } //serialized or json (serialized data may be cached) if (strpos($result, 'a:') === 0) { $data = unserialize($result); } elseif (strpos($result, '{') === 0) { $data = json_decode($result, true); } else { if ($use_cache) { unlink($cache_file); } $debug = array(); $debug['Two'] = substr($result, 0, 2); $debug['Twotr'] = substr(trim($result), 0, 2); echo '<p>' . gpRemoteGet::Debug('Sorry, data not fetched', $debug) . '</p>'; return; } //not unserialized? if (!is_array($data) || count($data) == 0) { if ($use_cache) { unlink($cache_file); } echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (F3)</p>'; return; } //save the cache if (!$use_cache) { gpFiles::Save($cache_file, $result); } $this->searchMax = $data['max']; if (isset($data['per_page']) && $data['per_page']) { $this->searchPerPage = $data['per_page']; } else { $this->searchPerPage = count($data['rows']); } $this->ShowHeader(); $this->SearchOptions(); echo '<table class="bordered full_width">'; echo '<tr><th></th><th>' . $langmessage['name'] . '</th><th>' . $langmessage['version'] . '</th><th>' . $langmessage['Statistics'] . '</th><th>' . $langmessage['description'] . '</th></tr>'; $i = 0; if (count($data['rows'])) { foreach ($data['rows'] as $row) { echo '<tr class="' . ($i % 2 ? 'even' : '') . '">'; echo '<td>'; echo $this->DetailLink($row['type'], $row['id'], '<img src="' . $row['icon'] . '" height="100" width="100" alt=""/>', '', ' class="shot"'); echo '</td>'; echo '<td class="nowrap">'; echo '<b>' . $row['name'] . '</b>'; echo '<br/>'; echo $this->DetailLink($row['type'], $row['id']); echo ' | '; $this->InstallLink($row); echo '</td><td>'; echo $row['version']; echo '</td><td class="nowrap">'; echo sprintf($langmessage['_downloads'], number_format($row['downloads'])); echo '<br/>'; $this->CurrentRating($row['rating_weighted']); echo '<br/>'; echo $row['rating_count'] . ' ratings'; echo '</td><td>'; echo $row['short_description']; echo '</td></tr>'; $i++; } echo '</table>'; $this->SearchNavLinks(); } else { echo '</table>'; echo '<p>' . $langmessage['Sorry, nothing matched'] . '</p>'; } echo '<h3>Search Options</h3>'; echo '<ul>'; echo '<li>Limit results to addons that are compatible with your version of gpEasy (' . gpversion . ') '; if ($search_version) { echo '<b>' . $langmessage['On'] . '</b> '; echo common::Link($this->searchUrl, $langmessage['Off'], $this->searchQuery . '&search_option=noversion', ' data-cmd="gpajax"'); } else { echo common::Link($this->searchUrl, $langmessage['On'], $this->searchQuery . '&search_option=version', ' data-cmd="gpajax"'); echo ' <b>' . $langmessage['Off'] . '</b>'; } echo '</li>'; echo '</ul>'; }
public static function NewFileNumber() { global $config; includeFile('admin/admin_tools.php'); if (!isset($config['file_count'])) { $config['file_count'] = 0; } $config['file_count']++; admin_tools::SaveConfig(); return $config['file_count']; }
static function RenameFileWorker($title) { global $langmessage, $dataDir, $gp_index; //use new_label or new_title if (isset($_POST['new_title'])) { $new_title = admin_tools::PostedSlug($_POST['new_title']); } else { $new_title = admin_tools::LabelToSlug($_POST['new_label']); } //title unchanged if ($new_title == $title) { return $title; } $special_file = false; if (common::SpecialOrAdmin($title)) { $special_file = true; } if (!admin_tools::CheckTitle($new_title, $message)) { msg($message); return false; } $old_gp_index = $gp_index; //re-index: make the new title point to the same data index $old_file = gpFiles::PageFile($title); $file_index = $gp_index[$title]; unset($gp_index[$title]); $gp_index[$new_title] = $file_index; //rename the php file if (!$special_file) { $new_file = gpFiles::PageFile($new_title); //we don't have to rename files if we're using the index naming convention. See gpFiles::PageFile() for more info if ($new_file == $old_file) { //if the file being renamed doesn't use the index naming convention, then we'll still need to rename it } elseif (!rename($old_file, $new_file)) { msg($langmessage['OOPS'] . ' (N3)'); $gp_index = $old_gp_index; return false; } //gallery rename includeFile('special/special_galleries.php'); special_galleries::RenamedGallery($title, $new_title); } //create a 301 redirect if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') { includeFile('admin/admin_missing.php'); admin_missing::AddRedirect($title, $new_title); } gpPlugin::Action('RenameFileDone', array($file_index, $title, $new_title)); return $new_title; }
/** * Show the default admin page * */ function AdminPanel() { global $langmessage; $cmd = common::GetCommand(); switch ($cmd) { case 'embededcheck': includeFile('tool/update.php'); new update_class('embededcheck'); return; case 'autocomplete-titles': $opts = array('var_name' => false); echo gp_edit::AutoCompleteValues(false, $opts); die; } $this->head_js[] = '/include/js/auto_width.js'; echo '<h2>' . $langmessage['administration'] . '</h2>'; echo '<div id="adminlinks2">'; admin_tools::AdminPanelLinks(false); echo '</div>'; }
/** * Save the posted page as the homepage * */ function HomepageSave() { global $langmessage, $config, $gp_index, $gp_titles, $page; $homepage = $_POST['homepage']; $homepage_key = false; if (isset($gp_index[$homepage])) { $homepage_key = $gp_index[$homepage]; } else { foreach ($gp_titles as $index => $title) { if ($title['label'] === $homepage) { $homepage_key = $index; break; } } if (!$homepage_key) { message($langmessage['OOPS']); return; } } $config['homepath_key'] = $homepage_key; $config['homepath'] = common::IndexToTitle($config['homepath_key']); if (!admin_tools::SaveConfig()) { message($langmessage['OOPS']); return; } //update the display ob_start(); $this->HomepageDisplay(); $content = ob_get_clean(); $page->ajaxReplace[] = array('inner', '.homepage_setting', $content); }
/** * Finalize theme removal * */ function DeleteThemeConfirmed() { global $langmessage, $dataDir, $gpLayouts, $config; $gpLayoutsBefore = $gpLayouts; $can_delete = true; $theme_folder_name =& $_POST['folder']; $theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name; if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name) || !isset($config['themes'][$theme_folder_name])) { message($langmessage['OOPS']); return false; } $order = false; if (isset($config['themes'][$theme_folder_name]['order'])) { $order = $config['themes'][$theme_folder_name]['order']; } if (!$this->CanDeleteTheme($theme_folder_name, $message)) { message($message); return false; } //remove layouts foreach ($gpLayouts as $layout_id => $layout_info) { if (!isset($layout_info['is_addon']) || !$layout_info['is_addon']) { continue; } $layout_folder = dirname($layout_info['theme']); if ($layout_folder == $theme_folder_name) { $this->RmLayout($layout_id); } } //delete the folder $dir = $dataDir . '/data/_themes/' . $theme_folder_name; gpFiles::RmAll($dir); //remove from settings unset($config['themes'][$theme_folder_name]); if (admin_tools::SaveAllConfig()) { message($langmessage['SAVED']); if ($order) { $img_path = common::IdUrl('ci'); common::IdReq($img_path); } } else { $gpLayouts = $gpLayoutsBefore; message($langmessage['OOPS'] . ' (s1)'); } }
/** * Generate a file with all of the combined content * */ static function GenerateFile($files, $type) { global $dataDir; //get etag $modified = $content_length = 0; $full_paths = array(); foreach ($files as $file) { $full_path = gp_combine::CheckFile($file); if ($full_path === false) { continue; } gp_combine::FileStat_Static($full_path, $modified, $content_length); $full_paths[$file] = $full_path; } //check css imports if ($type == 'css') { $had_imported = false; $import_data = array(); $imported_file = $dataDir . '/data/_cache/import_info.php'; if (file_exists($imported_file)) { include_once $imported_file; } foreach ($full_paths as $file => $full_path) { if (!isset($import_data[$full_path])) { continue; } $had_imported = true; foreach ($import_data[$full_path] as $imported_full) { gp_combine::FileStat_Static($imported_full, $modified, $content_length); } unset($import_data[$full_path]); } } //check to see if file exists $etag = common::GenEtag(json_encode($files), $modified, $content_length); $cache_relative = '/data/_cache/combined_' . $etag . '.' . $type; $cache_file = $dataDir . $cache_relative; if (file_exists($cache_file)) { // change modified time to extend cache if (time() - filemtime($cache_file) > 604800) { touch($cache_file); } return $cache_relative; } //create file if ($type == 'js') { ob_start(); common::jsStart(); foreach ($full_paths as $full_path) { readfile($full_path); echo ";\n"; } $combined_content = ob_get_clean(); } else { $imports = $combined_content = ''; $new_imported = array(); foreach ($full_paths as $file => $full_path) { $temp = new gp_combine_css($file); $combined_content .= "\n/* " . $file . " */\n"; $combined_content .= $temp->content; $imports .= $temp->imports; if (count($temp->imported)) { $new_imported[$full_path] = $temp->imported; } } $combined_content = $imports . $combined_content; //save imported data if (count($new_imported) || $had_imported) { if (count($new_imported)) { $import_data = $new_imported + $import_data; } gpFiles::SaveData($imported_file, 'import_data', $import_data); } } if (!gpFiles::Save($cache_file, $combined_content)) { return false; } includeFile('admin/admin_tools.php'); admin_tools::CleanCache(); return $cache_relative; }
function Exported() { global $langmessage; if (count($this->exported) == 0) { return; } echo '<table class="bordered">'; echo '<tr><th>'; echo $langmessage['Previous Exports']; echo '</th><th> </th><th>'; echo $langmessage['File Size']; echo '</th><th>'; echo $langmessage['options']; echo '</th></tr>'; $total_size = 0; $total_count = 0; foreach ($this->exported as $file) { $info = $this->FileInfo($file); if (!$info) { continue; } $full_path = $this->export_dir . '/' . $file; if ($total_count % 2 == 0) { echo '<tr class="even">'; } else { echo '<tr>'; } echo '<td>'; echo str_replace(' ', ' ', $info['time']); echo '</td><td>'; echo implode(', ', $info['exported']); echo '</td><td>'; $size = filesize($full_path); echo admin_tools::FormatBytes($size); echo ' '; echo $info['ext']; echo '</td><td>'; echo '<a href="' . common::GetDir('/data/_exports/' . $file) . '">' . $langmessage['Download'] . '</a>'; echo ' '; if ($this->CanRevert($info['bits'])) { echo common::Link('Admin_Port', $langmessage['Revert'], 'cmd=revert&archive=' . rawurlencode($file), '', $file); } else { echo $langmessage['Revert']; } echo ' '; echo common::Link('Admin_Port', $langmessage['delete'], 'cmd=delete&file=' . rawurlencode($file), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_confirm'], 'class' => 'gpconfirm'), $file); echo '</td></tr>'; $total_count++; $total_size += $size; } //totals echo '<tr><th>'; echo $langmessage['Total']; echo ': '; echo $total_count; echo '</th><th> </th><th>'; echo admin_tools::FormatBytes($total_size); echo '</th><th> </th></tr>'; echo '</table>'; }
function GetUsers() { global $dataDir; require $dataDir . '/data/_site/users.php'; $this->users = $users; //fix the editing value foreach ($this->users as $username => $userinfo) { $userinfo += array('granted' => ''); admin_tools::EditingValue($userinfo); $this->users[$username] = $userinfo; } }
static function RunOut() { global $page; $page->RunScript(); //decide how to send the content self::Prep(); switch (common::RequestType()) { // <a data-cmd="admin_box"> case 'flush': self::Flush(); break; // remote request // file browser // remote request // file browser case 'body': common::CheckTheme(); self::BodyAsHTML(); break; case 'admin': self::AdminHtml(); break; // <a data-cmd="gpajax"> // <a data-cmd="gpabox"> // <input data-cmd="gpabox"> // <a data-cmd="gpajax"> // <a data-cmd="gpabox"> // <input data-cmd="gpabox"> case 'json': common::CheckTheme(); includeFile('tool/ajax.php'); gpAjax::Response(); break; case 'content': self::Content(); break; default: common::CheckTheme(); self::Template(); break; } //if logged in, prepare the admin content and don't send 304 response if (common::LoggedIn()) { admin_tools::AdminHtml(); //empty edit links if there isn't a layout if (!$page->gpLayout) { self::$editlinks = ''; } return; } /* attempt to send 304 response */ if ($page->fileModTime > 0) { global $wbMessageBuffer, $gp_head_content; $len = strlen($gp_head_content) + ob_get_length(); if (count($wbMessageBuffer)) { $len += strlen(serialize($wbMessageBuffer)); } common::Send304(common::GenEtag($page->fileModTime, $len)); } }
function create(&$user_info, $username) { global $dataDir, $langmessage; //update the session files to .php files //changes to $userinfo will be saved by UpdateAttempts() below $user_info = gpsession::SetSessionFileName($user_info, $username); $user_file_name = $user_info['file_name']; $user_file = $dataDir . '/data/_sessions/' . $user_file_name; //use an existing session_id if the new login matches an existing session (uid and file_name) $sessions = gpsession::GetSessionIds(); $uid = gpsession::auth_browseruid(); $session_id = false; foreach ($sessions as $sess_temp_id => $sess_temp_info) { if (isset($sess_temp_info['uid']) && $sess_temp_info['uid'] == $uid && $sess_temp_info['file_name'] == $user_file_name) { $session_id = $sess_temp_id; } } //create a unique session id if needed if ($session_id === false) { do { $session_id = common::RandomString(40); } while (isset($sessions[$session_id])); } $expires = !isset($_POST['remember']); gpsession::cookie(gp_session_cookie, $session_id, $expires); //save session id $sessions[$session_id] = array(); $sessions[$session_id]['file_name'] = $user_file_name; $sessions[$session_id]['uid'] = $uid; //$sessions[$session_id]['time'] = time(); //for session locking if (!gpsession::SaveSessionIds($sessions)) { return false; } //make sure the user's file exists $new_data = gpsession::SessionData($user_file, $checksum); $new_data['username'] = $username; $new_data['granted'] = $user_info['granted']; admin_tools::EditingValue($new_data); gpFiles::SaveArray($user_file, 'gpAdmin', $new_data); return $session_id; }
/** * Perform a page copy * */ function CopyPage() { global $gp_index, $gp_titles, $page, $langmessage; //existing page info $from_title = $_POST['from_title']; if (!isset($gp_index[$from_title])) { message($langmessage['OOPS_TITLE']); return false; } $from_index = $gp_index[$from_title]; $info = $gp_titles[$from_index]; //check the new title $title = $_POST['title']; $title = admin_tools::CheckPostedNewPage($title, $message); if ($title === false) { message($message); return false; } //get the existing content $from_file = gpFiles::PageFile($from_title); $contents = file_get_contents($from_file); //add to $gp_index first! $index = common::NewFileIndex(); $gp_index[$title] = $index; $file = gpFiles::PageFile($title); if (!gpFiles::Save($file, $contents)) { message($langmessage['OOPS'] . ' (File not saved)'); return false; } //add to gp_titles $new_titles = array(); $new_titles[$index]['label'] = admin_tools::PostedLabel($_POST['title']); $new_titles[$index]['type'] = $info['type']; $gp_titles += $new_titles; if (!admin_tools::SavePagesPHP()) { message($langmessage['OOPS'] . ' (CP2)'); return false; } message($langmessage['SAVED']); if (isset($_REQUEST['redir'])) { $url = common::AbsoluteUrl($title, '', true, false); $page->ajaxReplace[] = array('eval', '', 'window.setTimeout(function(){window.location="' . $url . '"},15000);'); message(sprintf($langmessage['will_redirect'], common::Link_Page($title))); } return $index; }
function PluginPanelGroup($addon_key, $info) { global $config, $langmessage, $gpLayouts; $addon_config = gpPlugin::GetAddonConfig($addon_key); $addon_config += $info; //merge the upgrade info echo '<div class="panelgroup" id="panelgroup_' . md5($addon_key) . '">'; $label = '<i class="gpicon_plug"></i>' . $addon_config['name']; echo common::Link('Admin_Addons/' . admin_tools::encode64($addon_key), $label); echo '<div class="panelgroup2">'; echo '<ul class="submenu">'; $this->AddonPanelGroup($addon_key, $addon_config); //options if (!isset($addon_config['is_theme']) || !$addon_config['is_theme']) { echo '<li class="expand_child_click">'; echo '<a>' . $langmessage['options'] . '</a>'; echo '<ul>'; //editable text if (isset($config['addons'][$addon_key]['editable_text']) && admin_tools::HasPermission('Admin_Theme_Content')) { echo '<li>'; echo common::Link('Admin_Theme_Content', $langmessage['editable_text'], 'cmd=addontext&addon=' . urlencode($addon_key), array('title' => urlencode($langmessage['editable_text']), 'data-cmd' => 'gpabox')); echo '</li>'; } //upgrade link if (isset($addon_config['upgrade_from'])) { echo '<li>'; echo common::Link('Admin_Addons', $langmessage['upgrade'], 'cmd=local_install&source=' . $addon_config['upgrade_from'], array('data-cmd' => 'creq')); echo '</li>'; } //uninstall echo '<li>'; echo common::Link('Admin_Addons', $langmessage['uninstall'], 'cmd=uninstall&addon=' . rawurlencode($addon_key), 'data-cmd="gpabox"'); echo '</li>'; //version if (!empty($addon_config['version'])) { echo '<li><a>' . $langmessage['Your_version'] . ' ' . $addon_config['version'] . '</a></li>'; } //rating if (isset($addon_config['id']) && is_numeric($addon_config['id'])) { $id = $addon_config['id']; $rating = 5; if (isset($this->addonReviews[$id])) { $rating = $this->addonReviews[$id]['rating']; } $label = $langmessage['rate_this_addon'] . ' ' . $this->ShowRating($id, $rating); echo '<li><span>' . $label . '</span></li>'; } echo '</ul></li>'; } else { //show list of themes using these addons echo '<li class="expand_child_click">'; echo '<a>' . $langmessage['layouts'] . '</a>'; echo '<ul>'; foreach ($gpLayouts as $layout_id => $layout_info) { if (!isset($layout_info['addon_key']) || $layout_info['addon_key'] !== $addon_key) { continue; } echo '<li>'; echo '<span>'; echo '<span class="layout_color_id" style="background:' . $layout_info['color'] . '"></span> '; echo common::Link('Admin_Theme_Content', $layout_info['label']); echo ' ( '; echo common::Link('Admin_Theme_Content/' . $layout_id, $langmessage['edit']); echo ' )'; echo '</span>'; //echo '<a>'; //echo $layout_info['label']; //echo '</a>'; //echo pre($layout_info); echo '</li>'; } echo '</ul>'; echo '</li>'; } echo '</ul>'; //upgrade gpeasy.com if (isset($addon_config['id']) && isset(admin_tools::$new_versions[$addon_config['id']])) { $version_info = admin_tools::$new_versions[$addon_config['id']]; echo '<div class="gp_notice">'; echo '<a href="' . addon_browse_path . '/Plugins?id=' . $addon_config['id'] . '" data-cmd="remote">'; echo $langmessage['new_version']; echo ' ' . $version_info['version'] . ' (gpEasy.com)</a>'; echo '</div>'; } //upgrade local if (isset($addon_config['upgrade_from']) && isset($addon_config['upgrade_version'])) { if (version_compare($addon_config['upgrade_version'], $addon_config['version'], '>')) { echo '<div class="gp_notice">'; $label = $langmessage['new_version'] . ' ' . $addon_config['upgrade_version']; echo common::Link('Admin_Addons', $label, 'cmd=local_install&source=' . $addon_config['upgrade_from'], array('data-cmd' => 'creq')); echo '</div>'; } } echo '</div>'; echo '</div>'; }
function GetUsers() { $this->users = gpFiles::Get('_site/users'); //fix the editing value foreach ($this->users as $username => $userinfo) { $userinfo += array('granted' => ''); admin_tools::EditingValue($userinfo); $this->users[$username] = $userinfo; } }
/** * Save a new redirection * */ function SaveRedir() { global $langmessage; if (!$this->CheckRedir()) { return false; } $source = admin_tools::PostedSlug($_POST['source']); if (isset($this->error_data['redirects'][$source])) { message($langmessage['OOPS'] . ' (Redirect Already Set)'); return false; } $this->error_data['redirects'][$source] = array(); $this->error_data['redirects'][$source]['target'] = $_POST['target']; $this->error_data['redirects'][$source]['code'] = $_POST['code']; $this->error_data['redirects'][$source]['raw_source'] = $_POST['source']; return $this->SaveData_Message(); }
/** * Get addon data from gpEasy.com and display to user * */ function RemoteBrowse() { global $langmessage, $config, $dataDir, $gpversion; //search options if (isset($_GET['search_option'])) { $save = true; switch ($_GET['search_option']) { case 'version': unset($config['search_version']); break; case 'noversion': $config['search_version'] = false; break; default: $save = false; break; } if ($save) { admin_tools::SaveConfig(); } } //make a list of installed addon id's $this->installed_ids = array(); if (isset($config['addons']) && is_array($config['addons'])) { foreach ($config['addons'] as $addon_info) { if (isset($addon_info['id'])) { $this->installed_ids[] = $addon_info['id']; } } } includeFile('tool/RemoteGet.php'); $orderby = array(); $orderby['rating_score'] = $langmessage['Highest Rated']; $orderby['downloads'] = $langmessage['Most Downloaded']; $orderby['modified'] = $langmessage['Recently Updated']; $orderby['created'] = $langmessage['Newest']; $_GET += array('q' => ''); $this->searchPage = 0; if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) { $this->searchPage = $_REQUEST['page']; } $this->searchQuery = 'cmd=remote'; //version specific search $search_version = false; if (!isset($config['search_version']) || $config['search_version']) { $this->searchQuery .= '&ug=' . rawurlencode($gpversion); $search_version = true; } if (!empty($_GET['q'])) { $this->searchQuery .= '&q=' . rawurlencode($_GET['q']); } if (isset($_GET['order']) && isset($orderby[$_GET['order']])) { $this->searchOrder = $_GET['order']; $this->searchQuery .= '&order=' . rawurlencode($_GET['order']); } else { reset($orderby); $this->searchOrder = key($orderby); } $slug = 'Special_Addon_Plugins'; if ($this->config_index == 'themes') { $slug = 'Special_Addon_Themes'; } $src = $GLOBALS['addonBrowsePath'] . '/' . $slug . '?' . $this->searchQuery . '&page=' . $this->searchPage; //check cache $cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt'; $use_cache = false; if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) { $result = file_get_contents($cache_file); $use_cache = true; } else { $result = gpRemoteGet::Get_Successful($src); } if (!$result) { echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f1)</p>'; return; } if (strpos($result, 'a:') !== 0) { echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f2)</p>'; return; } $data = unserialize($result); if (count($data) == 0) { echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f3)</p>'; return; } //save the cache if (!$use_cache) { gpFiles::Save($cache_file, $result); } $this->searchMax = $data['max']; if (isset($data['per_page']) && $data['per_page']) { $this->searchPerPage = $data['per_page']; } else { $this->searchPerPage = count($data['rows']); } $this->searchOffset = $this->searchPage * $this->searchPerPage; $this->FindForm(); echo '<h2 class="hmargin">'; echo common::Link($this->browser_path, $this->manage_label); echo ' <span>|</span> '; if (!empty($_GET['q'])) { echo common::Link($this->browser_path, $this->find_label, 'cmd=remote'); echo ' » '; echo htmlspecialchars($_GET['q']); } else { echo $this->find_label; } echo '</h2>'; echo '<div class="gp_search_options">'; $this->SearchNavLinks(); echo '<div class="search_order">'; foreach ($orderby as $key => $label) { if ($key === $this->searchOrder) { echo '<span>' . $label . '</span>'; } else { echo common::Link($this->browser_path, $label, $this->searchQuery . '&order=' . $key); } } echo '</div></div>'; echo '<table class="bordered full_width">'; echo '<tr><th></th><th>' . $langmessage['name'] . '</th><th>' . $langmessage['version'] . '</th><th>' . $langmessage['Statistics'] . '</th><th>' . $langmessage['description'] . '</th></tr>'; $i = 0; if (count($data['rows'])) { foreach ($data['rows'] as $row) { echo '<tr class="' . ($i % 2 ? 'even' : '') . '">'; echo '<td>'; $this->DetailLink($row, '<img src="' . $row['icon'] . '" height="100" width="100" alt=""/>', '', ' class="shot"'); echo '</td>'; echo '<td class="nowrap">'; echo '<b>' . $row['name'] . '</b>'; echo '<br/>'; $this->DetailLink($row); echo ' | '; $this->InstallLink($row); echo '</td><td>'; echo $row['version']; echo '</td><td class="nowrap">'; echo sprintf($langmessage['_downloads'], number_format($row['downloads'])); echo '<br/>'; $this->CurrentRating($row['rating_weighted']); echo '<br/>'; echo $row['rating_count'] . ' ratings'; echo '</td><td>'; echo $row['short_description']; //echo showArray($row); echo '</td></tr>'; $i++; } echo '</table>'; $this->SearchNavLinks(); } else { echo '</table>'; echo '<p>' . $langmessage['Sorry, nothing matched'] . '</p>'; } echo '<h3>Search Options</h3>'; echo '<ul>'; echo '<li>Limit results to addons that are compatible with your version of gpEasy (' . $gpversion . ') '; if ($search_version) { echo '<b>' . $langmessage['On'] . '</b> '; echo common::Link($this->browser_path, $langmessage['Off'], $this->searchQuery . '&search_option=noversion', ' name="gpajax"'); } else { echo common::Link($this->browser_path, $langmessage['On'], $this->searchQuery . '&search_option=version', ' name="gpajax"'); echo ' <b>' . $langmessage['Off'] . '</b>'; } echo '</li>'; echo '</ul>'; }
/** * Show the default admin page * */ function AdminPanel() { global $langmessage; $cmd = common::GetCommand(); switch ($cmd) { case 'embededcheck': $this->EmbededCheck(); return; } echo '<div id="adminlinks2" class="cf">'; admin_tools::AdminPanelLinks(false); //resources echo '<div class="panelgroup">'; echo '<span class="icon_page_gear"><span>' . $langmessage['resources'] . ' (gpEasy.com)</span></span>'; echo '<ul>'; echo '<li>' . common::Link('Admin_Addons', $langmessage['Download Plugins'], 'cmd=remote') . '</li>'; echo '<li>' . common::Link('Admin_Theme_Content', $langmessage['Download Themes'], 'cmd=remote') . '</li>'; echo '<li><a href="http://gpeasy.com">Support Forum</a></li>'; echo '<li><a href="http://gpeasy.com/Special_Services">Service Providers</a></li>'; echo '<li><a href="http://gpeasy.com">Official gpEasy Site</a></li>'; echo '<li><a href="https://sourceforge.net/tracker/?group_id=264307&atid=1127698">Report A Bug (sf.net)</a></li>'; echo '</ul>'; echo '</div>'; echo '</div>'; echo '<div id="adminfooter">'; echo '<ul>'; echo '<li>'; echo 'WYSIWYG editor by <a href="http://ckeditor.com/">CKEditor.net</a>'; echo '</li>'; echo '<li>'; echo 'Galleries made possible by <a href="http://colorpowered.com/colorbox/">ColorBox</a>'; echo '</li>'; echo '<li>'; echo 'Icons by <a href="http://www.famfamfam.com/">famfamfam.com</a>'; echo '</li>'; echo '</ul>'; echo '</div>'; }
function SetImage($img_rel, $width, $height) { global $gpLayouts, $langmessage, $page; $save_info = array(); $save_info['img_rel'] = $img_rel; $save_info['width'] = $width; $save_info['height'] = $height; $container = $_REQUEST['container']; //$gpLayouts[$this->curr_layout]['images'] = array(); //prevents shuffle - REMOVED to allow images per container to be saved. $gpLayouts[$this->curr_layout]['images'][$container] = array(); //prevents shuffle $gpLayouts[$this->curr_layout]['images'][$container][] = $save_info; if (!admin_tools::SavePagesPHP()) { message($langmessage['OOPS'] . ' (Data not saved)'); return false; } $page->ajaxReplace[] = array('ck_saved', '', ''); return true; }
/** * Plugin option links * */ function OptionLinks($addon_key, $addon_config, $format = false) { global $langmessage; $list = array(); if (!isset($addon_config['is_theme']) || !$addon_config['is_theme']) { //editable text if (isset($addon_config['editable_text']) && admin_tools::HasPermission('Admin_Theme_Content')) { $list[] = common::Link('Admin_Theme_Content', $langmessage['editable_text'], 'cmd=addontext&addon=' . urlencode($addon_key), array('title' => urlencode($langmessage['editable_text']), 'data-cmd' => 'gpabox')); } //upgrade link if (isset($addon_config['upgrade_from'])) { //$list[] = common::Link('Admin_Addons',$langmessage['upgrade'],'cmd=LocalInstall&source='.$addon_config['upgrade_from'],array('data-cmd'=>'creq')); $list[] = '<a href="?cmd=LocalInstall&source=' . rawurlencode($addon_config['upgrade_from']) . '" data-cmd="creq">' . $langmessage['upgrade'] . '</a>'; } //uninstall $list[] = common::Link('Admin_Addons', $langmessage['uninstall'], 'cmd=uninstall&addon=' . rawurlencode($addon_key), 'data-cmd="gpabox"'); //version if (!empty($addon_config['version'])) { $list[] = '<a>' . $langmessage['Your_version'] . ' ' . $addon_config['version'] . '</a>'; } //rating if (isset($addon_config['id']) && is_numeric($addon_config['id'])) { $id = $addon_config['id']; $rating = 5; if (isset($this->addonReviews[$id])) { $rating = $this->addonReviews[$id]['rating']; } $label = $langmessage['rate_this_addon'] . ' ' . $this->ShowRating($id, $rating); $list[] = '<span>' . $label . '</span>'; } echo $this->FormatList($list, $langmessage['options'], $format); return; } //show list of themes using these addons foreach ($gpLayouts as $layout_id => $layout_info) { if (!isset($layout_info['addon_key']) || $layout_info['addon_key'] !== $addon_key) { continue; } $item = '<span><span class="layout_color_id" style="background:' . $layout_info['color'] . '"></span> '; $item .= common::Link('Admin_Theme_Content', $layout_info['label']); $item .= ' ( '; $item .= common::Link('Admin_Theme_Content/' . $layout_id, $langmessage['edit']); $item .= ' )</span>'; $list[] = $item; } echo $this->FormatList($list, $langmessage['layouts'], $format); }