/** * Make a table for the configuration page of the plugin system * * Now the code must be: * AdmPlugin($name_of_the_plugin, $description); * @author adri93 */ function AdmPlugin($name, $desc) { $page = $_GET['modo']; if (is_phpself('adm/SettingsPage') && $page == 'plugins') { $activado = PluginAct($name); $config_line .= "<tr>"; if ($activado == "1") { //if the plugin is on $config_line .= "<td class=\"c\" style=\"color:#FFFFFF\">" . $name . "</td>"; $config_line .= "<td align=\"left\" class=\"c\" style=\"color:green\"><b>On</b></td>"; $config_line .= "<td align=\"center\" class=\"c\" width=\"20px\" style=\"color:#FFFFFF\"><a href=\"SettingsPage.php?modo=plugins&desactivate=" . $name . "\">Desactivar</a></td>"; } else { //if the plugin is off $config_line .= "<td class=\"c\" style=\"color:#FFFFFF\"><a href=\"#\" onMouseOver='return overlib(\"" . $desc . "\", CENTER, OFFSETX, 120, OFFSETY, -40, WIDTH, 250);' onMouseOut='return nd();' class=\"big\">" . $name . "</a></td>"; $config_line .= "<td align=\"left\" class=\"c\" style=\"color:red\"><b>Off</b></td>"; $config_line .= "<td align=\"center\" class=\"c\" width=\"20px\" style=\"color:#FFFFFF\"><a href=\"SettingsPage.php?modo=plugins&activate=" . $name . "\">Activar</a></td>"; } $config_line .= "</tr>"; } return $config_line; }
doquery("INSERT INTO {{table}} (`config_name`, `config_value`) VALUES ('supp_plugin', 1)", "config"); $QryTablePluginsupp = "CREATE TABLE `{{table}}` ( "; $QryTablePluginsupp .= "`status` tinyint(1) NOT NULL default '0',"; $QryTablePluginsupp .= "`ID` int(11) NOT NULL auto_increment,"; $QryTablePluginsupp .= "`player_id` int(11) NOT NULL,"; $QryTablePluginsupp .= "`time` int(11) NOT NULL,"; $QryTablePluginsupp .= "`subject` varchar(255) NOT NULL,"; $QryTablePluginsupp .= "`text` longtext NOT NULL,"; $QryTablePluginsupp .= " PRIMARY KEY (`ID`)"; $QryTablePluginsupp .= ") ENGINE = MYISAM CHARACTER SET latin1 COLLATE latin1_bin;"; doquery($QryTablePluginsupp, 'supp'); } $sop_name = "Sistema de incidencias"; $sop_desc = "Para comunicarte con tus usuarios desde el panel de control"; $config_line .= AdmPlugin($sop_name, $sop_desc); if (PluginAct($sop_name) == 1) { //lang variables $lang['supp_header'] = "Sistema de Incidencias"; $lang['ticket_id'] = "#Ticket-ID"; $lang['subject'] = "Asunto"; $lang['status'] = "Estado"; $lang['ticket_posted'] = "Creado el:"; $lang['ticket_new'] = "Nuevo Ticket"; $lang['input_text'] = "Descripcion de la incidencia o problema:"; $lang['answer_new'] = "Texto Solucion:"; $lang['text'] = "Texto:"; $lang['message_a'] = "Estado del mensaje:"; $lang['sendit_a'] = "Mensaje ha sido enviado"; $lang['message_t'] = "Estado de los tickets:"; $lang['sendit_t'] = "El ticket ha sido registrado."; $lang['close_t'] = "El ticket ha sido cerrado.";
<?php //PLUGIN PARA XGPROYECT #@Name: Noticias #@Author: Think at waterspace.es #@Thanks: Adri93 por el plugin system. #@Compatibilidad: 2.9.X define('TIMESTAMP', time()); $name = "Noticias"; $config_line .= AdmPlugin($name, ""); if (PluginAct($name)) { $noticias = new noticias($lang); } class noticias { public function __construct(&$lang) { global $game_config; if (!isset($game_config['news'])) { $news = $this->runInstall(); } else { $news = $game_config['news']; } if (defined('IN_ADMIN')) { if (isset($_POST['config_news']) and $_POST['config_news'] != "" and $_POST['config_news'] != $news) { $this->updateNews(); } $this->setAdmLang($news, $lang); } else { $this->insertNews($news, $lang); }
<?php /** * @name Records Plugin * @author adri93 (plugin) * @author Algun frances de Xnova Project y diversas personas en la mejora del codigo * @category Plugin * @version 0.3 * @uses Plugin system 0.3 * @copyright (c) 2010 Adri93 for the plugin conversion and other some people for the records page code. * @license http://opensource.org/licenses/gpl-license.php GNU Public License */ $rec_name = "Records"; $rec_desc = "Qui&aecute;n a conseguido más de algo?"; $config_line .= AdmPlugin($rec_name, $rec_desc); if (PluginAct($rec_name) == 1) { $lang['lm_statistics'] .= '</a></font></div></td></tr><tr><td><div align="center"><font color="#FFFFFF"><a href="game.php?page=records">Records'; $page = $_GET['page']; if (is_phpself('game') && $page == 'records') { //funciones básicas include $game_root . 'includes/functions/SortUserPlanets.' . $phpEx; $dpath = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"]; include $game_root . 'includes/functions/SetSelectedPlanet.' . $phpEx; SetSelectedPlanet($user); $planetrow = doquery("SELECT * FROM `{{table}}` WHERE `id` = '" . $user['current_planet'] . "';", "planets", true); include $game_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx; CheckPlanetUsedFields($planetrow); //fin funciones basicas $RecordTpl = gettemplate('plugins/record/record_body'); $HeaderTpl = gettemplate('plugins/record/record_section_header'); $TableRows = gettemplate('plugins/record/record_section_rows');