function add_extra_head() { $cache = new \cache\main(); if ($show_from_cache = $cache->check('admin_head')) { return $show_from_cache; } else { $head = ''; foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'admin', 'orderby' => 'date desc'))) as $line) { $head .= \site\plugin::replace_constant($line->text) . "\n"; } $cache->add('admin_head', $head); return $head; } }
function add_extra_head() { $cache = new \cache\main(); if ($show_from_cache = $cache->check('theme_head')) { return $show_from_cache; } else { $head = ''; foreach (\query\others::while_head_lines(array_merge(array('max' => 0, 'show' => 'theme', 'orderby' => 'date desc'))) as $line) { $head .= \site\plugin::replace_constant($line->text) . "\n"; } if (file_exists(COMMON_LOCATION . '/head.html')) { $head .= @file_get_contents(COMMON_LOCATION . '/head.html'); $head .= "\n"; } $cache->add('theme_head', $head); return $head; } }
<ul class="list-of-items">'; foreach (explode(',', $info->uninstall_preview['delete']['tables']) as $table) { echo '<li>' . \site\plugin::replace_constant($table) . '</li>'; } echo '</ul>'; } if (isset($info->uninstall_preview['delete']['columns'])) { echo '<div class="title" style="margin-top: 40px;"> <h2>' . $LANG['plugins_unist_columns'] . '</h2> </div> <ul class="list-of-items">'; foreach (explode(',', $info->uninstall_preview['delete']['columns']) as $column) { $coltab = explode('/', $column); if (count($coltab) === 2) { echo '<li>' . htmlspecialchars($coltab[0]) . ' from ' . \site\plugin::replace_constant(trim($coltab[1])) . '</li>'; } } echo '</ul>'; } if (isset($info->uninstall_preview['delete']['options'])) { echo '<div class="title" style="margin-top: 40px;"> <h2>' . $LANG['plugins_unist_options'] . '</h2> </div> <ul class="list-of-items">'; foreach (explode(',', $info->uninstall_preview['delete']['options']) as $option) { echo '<li>' . htmlspecialchars($option) . '</li>'; } echo '</ul>'; }
public function db_query() { if (isset($this->xml->db_query)) { $scope = (string) $this->scope(); if (empty($scope) || $this->scopes[$scope]['db_query']) { $out = array(); foreach ($this->xml->db_query as $v) { $out[] = \site\plugin::replace_constant((string) $v); } return $out; } } return false; }
public static function delete_plugin($id) { global $db; if (!$GLOBALS['me']->is_admin) { return false; } $id = (array) $id; $stmt = $db->stmt_init(); $stmt->prepare("DELETE FROM " . DB_TABLE_PREFIX . "plugins WHERE id = ?"); foreach ($id as $ID) { $plugin = admin_query::plugin_infos($ID); // delete plugin $stmt->bind_param("i", $ID); $stmt->execute(); // directory $dir = rtrim(dirname($plugin->main_file), '/'); // delete tables if (isset($plugin->uninstall_preview['delete']['tables'])) { $tables = explode(',', $plugin->uninstall_preview['delete']['tables']); foreach (array_map('trim', $tables) as $table) { $table = \site\plugin::replace_constant($table); $db->query("DROP TABLE `{$table}`"); } } // delete options if (isset($plugin->uninstall_preview['delete']['options'])) { $rows = explode(',', $plugin->uninstall_preview['delete']['options']); foreach (array_map('trim', $rows) as $row) { $db->query("DELETE FROM `" . DB_TABLE_PREFIX . "options` WHERE `option_name` = '{$row}'"); } } // delete table columns if (isset($plugin->uninstall_preview['delete']['columns'])) { $columns = explode(',', $plugin->uninstall_preview['delete']['columns']); foreach (array_map('trim', $columns) as $column) { $coltab = explode('/', $column); if (count($coltab) === 2) { $table = \site\plugin::replace_constant($coltab[1]); $db->query("ALTER TABLE `{$table}` DROP {$coltab[0]}"); } } } // delete head lines $db->query("DELETE FROM `" . DB_TABLE_PREFIX . "head` WHERE `plugin` = '{$dir}'"); /* Resolve possible problems caused by uninstalling */ switch ($plugin->scope) { case 'language': if (\query\main::get_option('sitelang') == 'up_' . strtolower($plugin->name)) { actions::set_option(array('sitelang' => 'english')); } if (\query\main::get_option('adminpanel_lang') == 'up_' . strtolower($plugin->name)) { actions::set_option(array('adminpanel_lang' => 'english')); } break; } // delete plugin directory \site\files::delete_directory(DIR . '/' . UPDIR . '/' . $dir); // delete image, if plugins has an image @unlink(DIR . '/' . $plugin->image); } @$stmt->close(); return true; }