Eigener Mod macht Probleme

In diesem Forum kann man Fragen zur Programmierung stellen, die bei der Entwicklung von Mods für phpBB 3.0.x oder dem Modifizieren des eigenen Forums auftauchen.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
Angel190
Mitglied
Beiträge: 182
Registriert: 28.04.2004 09:38
Wohnort: @home

Eigener Mod macht Probleme

Beitrag von Angel190 »

Hallo,

habe nen Mod gebastelt mit dem ich die Befehle, auf einem Gameserver, in eine Liste eintragen kann. Das auslesen klappt auch ohne Probleme aber mein ACP Modul funktioniert nicht :(

Im ACP Modul selbst klappt die anzeige der vorhandenen Einträge auch nur das hinzufügen, bearbeiten und löschen funktioniert gar nicht.

hier mal meine includes/acp/acp_command.php

Code: Alles auswählen

<?php
    /**
    *
    * @package acp
    * @version $Id$
    * @copyright (c) 2005 phpBB Group
    * @license http://opensource.org/licenses/gpl-license.php GNU Public License
    *
    */

    /**
    * @ignore
    */
    if (!defined('IN_PHPBB'))
    {
       exit;
    }

    /**
    * @package acp
    */
    class acp_commands
    {
       var $u_action;

       function main($id, $mode)
       {
          global $db, $user, $auth, $template, $cache;
          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;

          // Set up general vars
          $action   = request_var('action', '');
          $commands_id = request_var('command_id', 0);

          $this->tpl_name = 'acp_commands';
          $this->page_title = 'ACP_COMMANDS';
          $form_key = 'acp_commands';

          add_form_key($form_key);

          // Set up mode-specific vars
          switch ($action)
          {
             case 'add':
             case 'edit':
             
                if ($command_id)
                {
                   $sql = 'SELECT command_title, command_desc1, command_desc2
                   FROM ' . COMMANDS_TABLE . '
                   WHERE command_id = ' . $command_id;
                   $result = $db->sql_query($sql);
                   $row = $db->sql_fetchrow($result);
                   $db->sql_freeresult($result);
                
                   if (!$row)
                   {
                      trigger_error($user->lang['COMMAND_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
                   }
                   
                   $command_title = $row['command'];
                   $command_desc1 = $row['com_desc_ger'];
                   $command_desc2 = $row['com_desc_eng'];

					}
                else
                {
                   $command_title = $command_desc1 = $command_desc2 = '';
                   
                }
             
                
             break;

             // No break here

             case 'create':
                $command_title = utf8_normalize_nfc(request_var('command_title', '', true));
				$command_desc1 = utf8_normalize_nfc(request_var('command_desc1', '', true));
				$command_desc2 = utf8_normalize_nfc(request_var('command_desc2', '', true));
             break;
          }

          // Do major work
          switch ($action)
          {
             case 'edit':
             case 'add':

                $template->assign_vars(array(
                   'S_EDIT_COMMAND'   => true,
                   'U_BACK'         => $this->u_action,
                   'U_ACTION'         => $this->u_action . "&action=$action&command_id=$command_id",

                   'SERVCOMMAND'	=> $command_title,
					'DESC1'			=> $command_desc1,
					'DESC2'			=> $command_desc2,
                ));

                break;

             case 'create':

                if (!$command_id)
                   {
                      $sql = 'SELECT MAX(command_id) as max_command_id
                         FROM ' . COMMANDS_TABLE;
                      $result = $db->sql_query($sql);
                      $command_id = $db->sql_fetchfield('max_command_id');
                      $db->sql_freeresult($result);

                      $command_id = $db->sql_nextid();

                      $sql_ary['command_id'] = (int) $command_id;

                      $db->sql_query('INSERT INTO ' . COMMANDS_TABLE . $db->sql_build_array('INSERT', $sql_ary));
                      $cache->destroy('sql', COMMANDS_TABLE);

                      $lang = 'COMMAND_ADDED';
                      $log_action = 'LOG_COMMAND_ADD';
                   }
                   else
                   {
                      $sql = 'UPDATE ' . COMMANDS_TABLE . '
                         SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
                         WHERE command_id = ' . $command_id;
                      $db->sql_query($sql);
                      $cache->destroy('sql', COMMANDS_TABLE);

                      $lang = 'COMMAND_EDITED';
                      $log_action = 'LOG_COMMAND_EDIT';
                   }

                   add_log('admin', $log_action, $data['command_title']);

                   trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
                            
             break;

             case 'delete':

                $sql = 'SELECT command_title
                   FROM ' . COMMANDS_TABLE . "
                   WHERE command_id = $command_id";
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);

                if ($row)
                {
                   if (confirm_box(true))
                   {
                      $db->sql_query('DELETE FROM ' . COMMANDS_TABLE . " WHERE command_id = $command_id");
                      $cache->destroy('sql', COMMANDS_TABLE);
                      add_log('admin', 'LOG_COMMAND_DELETE', $row['command']);
                   }
                   else
                   {
                      confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
                         'command_id'      => $command_id,
                         'i'            => $id,
                         'mode'         => $mode,
                         'action'      => $action))
                      );
                   }
                }

             break;
          }

          $template->assign_vars(array(
             'U_ACTION'      => $this->u_action . '&action=add')
          );

          $sql = 'SELECT *
             FROM ' . COMMANDS_TABLE . '
             ORDER BY command_id';
          $result = $db->sql_query($sql);

          while ($row = $db->sql_fetchrow($result))
          {
             $template->assign_block_vars('servcom', array(
                'COMMAND_ID'		=> $row['command_id'],
				'COMMAND_TITLE'		=> $row['command_title'],
				'DESC_ONE'			=> $row['command_desc1'],
				'DESC_TWO'			=> $row['command_desc2'],
                'U_EDIT'         => $this->u_action . '&action=edit&command_id=' . $row['command_id'],
                'U_DELETE'         => $this->u_action . '&action=delete&command_id=' . $row['command_id'])
             );
          }
          $db->sql_freeresult($result);
       }

    }

?>
und hier noch die adm/style/acp_commands.html

Code: Alles auswählen

<!-- INCLUDE overall_header.html -->

<a name="maincontent"></a>

<!-- IF S_EDIT_COMMAND -->

	<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">&laquo; {L_BACK}</a>

	<h1>{L_ACP_COMMANDS}</h1>

	<p>{L_ACP_COMMAND_DESC}</p>

	<form id="acp_commands" method="post" action="{U_ACTION}">

	<fieldset>
		<legend>{L_COMMAND_USAGE}</legend>
		<p>{L_COMMAND_USAGE_EXPLAIN}</p>
	<dl>
		<dd><input type="text" id="command_title" name="command_title" size="60" maxlength="255" value="{SERVCOMMAND}" /></dd>
	</dl>
	</fieldset>

	<fieldset>
		<legend>{L_DESC_ONE}</legend>
		<p>{L_DESCDE_EXPLAIN}</p>
	<dl>
		<dd><input type="text" id="command_desc1" name="command_desc1" size="60" maxlength="255" value="{DESC1}" /></dd>
	</dl>
	</fieldset>	
	
	<fieldset>
		<legend>{L_DESC_TWO}</legend>
		<p>{L_DESCEN_EXPLAIN}</p>
	<dl>
		<dd><input type="text" id="command_desc2" name="command_desc2" size="60" maxlength="255" value="{DESC2}" /></dd>
	</dl>
	</fieldset>

	<fieldset class="submit-buttons">
		<legend>{L_SUBMIT}</legend>
		<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
		<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
	</fieldset>
	</form>

<!-- ELSE -->

	<h1>{L_ACP_COMMANDS}</h1>

	<p>{L_ACP_COMMAND_DESC}</p>
	
	<form id="acp_commands" method="post" action="{U_ACTION}">
	
	<fieldset class="tabulated">
	<legend>{L_ACP_COMMANDS}</legend>

	<table cellspacing="1" id="down">
	<thead>
	<tr>
		<th class="cat" width="15%" style="text-align: center;"><b>{L_COMMAND_TITLE}</b></th>
		<th class="cat" width="40%" style="text-align: center;"><b>{L_DESC_ONE}</b></th>
		<th class="cat" width="40%" style="text-align: center;"><b>{L_DESC_TWO}</b></th>
		<th class="cat" width="5%" style="text-align: center;"><b>{L_ACTION}</b></th>
	</tr>
	</thead>
	<tbody>
	<!-- BEGIN servcom -->
		<!-- IF servcom.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
			<td class="row1" style="text-align:left;">{servcom.COMMAND_TITLE}</td>
			<td class="row1" style="text-align:left;">{servcom.DESC_ONE}</td>
			<td class="row1" style="text-align:left;">{servcom.DESC_TWO}</td>
			<td class="row1" style="text-align:right;"><a href="{servcom.U_EDIT}">{ICON_EDIT}</a> <a href="{servcom.U_DELETE}">{ICON_DELETE}</a></td>
		</tr>
	<!-- BEGINELSE -->
		<tr class="row3">
			<td colspan="2">{L_ACP_NO_ITEMS}</td>
		</tr>
	<!-- END servcom -->
	</tbody>
	</table>

	<p class="quick">
		<input class="button2" name="submit" type="submit" value="{L_ADD_COMMAND}" />
	</p>
	</fieldset>

	</form>

<!-- ENDIF -->

<!-- INCLUDE overall_footer.html -->
Was ist falsch bzw. wo ist der Fehler den ich finde diesen nicht.
Rechtschreibfehler könnt ihr behalten oder verschenken! :D
Antworten

Zurück zu „[3.0.x] Mod Bastelstube“