RE: Downloadbereich erweitern - Michael - 04.05.2006
Reicht es nicht den Link in der Beschreibung des Downloads mit anzugeben? Das was du vorhast ist nicht so leicht, die neuen Daten müssen ja schließlich auch in der Datenbank gespeichert werden.
RE: Downloadbereich erweitern - Ramm - 04.05.2006
ist det wirklich so schwer ?
RE: Downloadbereich erweitern - Michael - 04.05.2006
Nicht getestet
Führe folgenden Query aus:
Code: ALTER TABLE `mybb_forumdownloads` ADD `customlink` VARCHAR( 200 ) NOT NULL , ADD `customurl` VARCHAR( 200 ) NOT NULL ;
Öffne die Datei admin/downloads.php und suche nach:
PHP-Code: if($mybb->input['type'] == 'download') { $new_entry['cid'] = intval($mybb->input['cid']); $new_entry['uid'] = intval($mybb->input['uid']); $new_entry['cid'] = addslashes($mybb->input['cid']); $new_entry['url'] = addslashes($mybb->input['url']); $new_entry['visible'] = addslashes($mybb->input['visible']); $new_entry['sticky'] = addslashes($mybb->input['sticky']); $new_entry['validated'] = 'yes'; $db->insert_query(TABLE_PREFIX."forumdownloads", $new_entry); $message = 'Download hinzugefügt'; }
Ersetzen durch:
PHP-Code: if($mybb->input['type'] == 'download') { $new_entry['cid'] = intval($mybb->input['cid']); $new_entry['uid'] = intval($mybb->input['uid']); $new_entry['cid'] = addslashes($mybb->input['cid']); $new_entry['url'] = addslashes($mybb->input['url']); $new_entry['visible'] = addslashes($mybb->input['visible']); $new_entry['sticky'] = addslashes($mybb->input['sticky']); $new_entry['validated'] = 'yes'; $new_entry['customlink'] = addslashes($mybb->input['customlink']); $new_entry['customurl'] = addslashes($mybb->input['customurl']); $db->insert_query(TABLE_PREFIX."forumdownloads", $new_entry); $message = 'Download hinzugefügt'; }
Suche nach:
PHP-Code: if(intval($mybb->input['did'])) { $update_download = array( 'did' => intval($mybb->input['did']), 'cid' => intval($mybb->input['cid']), 'uid' => intval($mybb->input['uid']), 'name' => addslashes($mybb->input['name']), 'description' => addslashes($mybb->input['description']), 'url' => addslashes($mybb->input['url']), 'sticky' => addslashes($mybb->input['sticky']), 'visible' => addslashes($mybb->input['visible']), ); $db->update_query(TABLE_PREFIX."forumdownloads", $update_download, "did='".intval($mybb->input['did'])."'"); $message = 'Download geändert'; }
Ersetzen durch:
PHP-Code: if(intval($mybb->input['did'])) { $update_download = array( 'did' => intval($mybb->input['did']), 'cid' => intval($mybb->input['cid']), 'uid' => intval($mybb->input['uid']), 'name' => addslashes($mybb->input['name']), 'description' => addslashes($mybb->input['description']), 'url' => addslashes($mybb->input['url']), 'sticky' => addslashes($mybb->input['sticky']), 'visible' => addslashes($mybb->input['visible']), 'customlink' => addslashes($mybb->input['customlink']), 'customurl' => addslashes($mybb->input['customurl']), ); $db->update_query(TABLE_PREFIX."forumdownloads", $update_download, "did='".intval($mybb->input['did'])."'"); $message = 'Download geändert'; }
Suche nach:
PHP-Code: $update_download = array( 'cid' => intval($mybb->input['cid'][$did]), 'name' => addslashes($mybb->input['name'][$did]), 'description' => addslashes($mybb->input['description'][$did]), 'url' => addslashes($mybb->input['url'][$did]), 'sticky' => addslashes($mybb->input['sticky'][$did]), 'visible' => addslashes($mybb->input['visible'][$did]), 'validated' => 'yes', );
Ersetzen durch:
PHP-Code: $update_download = array( 'cid' => intval($mybb->input['cid'][$did]), 'name' => addslashes($mybb->input['name'][$did]), 'description' => addslashes($mybb->input['description'][$did]), 'url' => addslashes($mybb->input['url'][$did]), 'sticky' => addslashes($mybb->input['sticky'][$did]), 'visible' => addslashes($mybb->input['visible'][$did]), 'validated' => 'yes', 'customlink' => addslashes($mybb->input['customlink'][$did]), 'customurl' => addslashes($mybb->input['customurl'][$did]), );
Suche nach:
PHP-Code: if($count['numcats'] > 0) { echo "<br />\n"; startform('downloads.php', '', 'do_add'); makehiddencode('type', 'download'); starttable(); tableheader('Download hinzufügen'); makeinputcode('Download Name', 'name'); maketextareacode('Download Beschreibung', 'description'); makeinputcode('Download URL', 'url'); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name'); makeyesnocode('Ist der Download sichtbar?', 'visible'); makeyesnocode('Ist der Download wichtig?', 'sticky', 'no'); endtable(); endform('Download hinzufügen', 'Zurücksetzen'); }
Ersetzen durch:
PHP-Code: if($count['numcats'] > 0) { echo "<br />\n"; startform('downloads.php', '', 'do_add'); makehiddencode('type', 'download'); starttable(); tableheader('Download hinzufügen'); makeinputcode('Download Name', 'name'); maketextareacode('Download Beschreibung', 'description'); makeinputcode('Download URL', 'url'); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name'); makeyesnocode('Ist der Download sichtbar?', 'visible'); makeyesnocode('Ist der Download wichtig?', 'sticky', 'no'); makeinputcode('Eigener Link (Name)', 'customlink'); makeinputcode('Eigener Link (URL)', 'customurl'); endtable(); endform('Download hinzufügen', 'Zurücksetzen'); }
Suche nach:
PHP-Code: if(intval($mybb->input['did'])) { $did = intval($mybb->input['did']); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."forumdownloads WHERE did='$did'"); $download = $db->fetch_array($query); $download['description'] = stripslashes($download['description']); startform('downloads.php', '', 'do_edit'); starttable(); tableheader('Download bearbeiten'); makeinputcode('Download Name', 'name', $download['name']); maketextareacode('Download Beschreibung', 'description', $download['description']); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name', $download['cid']); makeinputcode('Datei URL', 'url', $download['url']); makeyesnocode('Ist der Download sichtbar?', 'visible', $download['visible']); makeyesnocode('Ist der Download wichtig?', 'sticky', $download['sticky']); endtable(); makehiddencode('did', $did); endform('Download ändern', 'Zurücksetzen'); }
Ersetzen durch:
PHP-Code: if(intval($mybb->input['did'])) { $did = intval($mybb->input['did']); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."forumdownloads WHERE did='$did'"); $download = $db->fetch_array($query); $download['description'] = stripslashes($download['description']); startform('downloads.php', '', 'do_edit'); starttable(); tableheader('Download bearbeiten'); makeinputcode('Download Name', 'name', $download['name']); maketextareacode('Download Beschreibung', 'description', $download['description']); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name', $download['cid']); makeinputcode('Datei URL', 'url', $download['url']); makeyesnocode('Ist der Download sichtbar?', 'visible', $download['visible']); makeyesnocode('Ist der Download wichtig?', 'sticky', $download['sticky']); makeinputcode('Eigener Link (Name)', 'customlink', $download['customlink']); makeinputcode('Eigener Link (URL)', 'customurl', $download['customurl']); endtable(); makehiddencode('did', $did); endform('Download ändern', 'Zurücksetzen'); }
Suche nach:
PHP-Code: while($download = $db->fetch_array($query)) { makeinputcode('Download Name', "name[$download[did]]", $download['name']); makelabelcode('Eingereicht von', "<a href=\"users.php?action=edit&uid=$download[uid]\">$download[username]</a>"); maketextareacode('Beschreibung', "description[$download[did]]", $download['description']); makeselectcode('Kategorie', "cid[$download[did]]", "downloadcategories", "cid", "name", $download['cid']); makeinputcode('Datei URL', "url[$download[did]]", $download['url']); makeyesnocode('Ist der Download sichtbar?', "visible[$download[did]]", 'yes'); makeyesnocode('Ist der Download wichtig?', "sticky[$download[did]]", 'no'); makeyesnocode('Einreichung annehmen?', "validated[$download[did]]", 'yes'); makeyesnocode('Einreichung ablehnen?', "delete[$download[did]]", 'no'); echo "<tr>\n<td class=\"subheader\" align=\"center\" colspan=\"2\" height=\"2\"><img src=\"pixel.gif\" width=\"1\" height=\"1\"></td>\n</tr>\n"; }
Ersetzen durch:
PHP-Code: while($download = $db->fetch_array($query)) { makeinputcode('Download Name', "name[$download[did]]", $download['name']); makelabelcode('Eingereicht von', "<a href=\"users.php?action=edit&uid=$download[uid]\">$download[username]</a>"); maketextareacode('Beschreibung', "description[$download[did]]", $download['description']); makeselectcode('Kategorie', "cid[$download[did]]", "downloadcategories", "cid", "name", $download['cid']); makeinputcode('Datei URL', "url[$download[did]]", $download['url']); makeyesnocode('Ist der Download sichtbar?', "visible[$download[did]]", 'yes'); makeyesnocode('Ist der Download wichtig?', "sticky[$download[did]]", 'no'); makeinputcode('Eigener Link (Name)', "customlink[$download[did]]", $download['customlink']); makeinputcode('Eigener Link (URL)', "customurl[$download[did]]", $download['customurl']); makeyesnocode('Einreichung annehmen?', "validated[$download[did]]", 'yes'); makeyesnocode('Einreichung ablehnen?', "delete[$download[did]]", 'no'); echo "<tr>\n<td class=\"subheader\" align=\"center\" colspan=\"2\" height=\"2\"><img src=\"pixel.gif\" width=\"1\" height=\"1\"></td>\n</tr>\n"; }
Anschließend kannst du ins Template downloads_download den Link einfügen:
Code: <a href="$download[customurl]">$download[customlink]</a>
RE: Downloadbereich erweitern - Ramm - 04.05.2006
Ja ich Bedanke mich sehr.....aber kann man das auch noch so amchen das man den link Herunterladen auch eingeben kann ? also den namen ?
*schäm*
RE: Downloadbereich erweitern - Michael - 04.05.2006
Was willst du denn als Namen eingeben? Soll dieser generell geändert werden oder soll der Name des Downloads angezeigt werden, also "Dateiname herunterladen".
RE: Downloadbereich erweitern - Ramm - 05.05.2006
Nene ich will jetzt einfach den link Herunterladen auch bei jedem Download unbennen können.
RE: Downloadbereich erweitern - Michael - 05.05.2006
Dafür musst du zuerst wieder einen Query ausführen:
Code: ALTER TABLE `mybb_forumdownloads` ADD `downloadlinkname` VARCHAR( 200 ) NOT NULL ;
Anschließend musst du in die oben genannten Teile der Datei admin/downloads.php die Felder für das Feld downloadlinkname einfügen. Beispiel für den ersten Codeblock:
PHP-Code: if($mybb->input['type'] == 'download') { $new_entry['cid'] = intval($mybb->input['cid']); $new_entry['uid'] = intval($mybb->input['uid']); $new_entry['cid'] = addslashes($mybb->input['cid']); $new_entry['url'] = addslashes($mybb->input['url']); $new_entry['visible'] = addslashes($mybb->input['visible']); $new_entry['sticky'] = addslashes($mybb->input['sticky']); $new_entry['validated'] = 'yes'; $new_entry['customlink'] = addslashes($mybb->input['customlink']); $new_entry['customurl'] = addslashes($mybb->input['customurl']); $new_entry['downloadlinkname'] = addslashes($mybb->input['downloadlinkname']); $db->insert_query(TABLE_PREFIX."forumdownloads", $new_entry); $message = 'Download hinzugefügt'; }
Hat alles funktioniert, kannst du im Template die Variable $download[downloadlinkname] nutzen, um den Namen auszugeben.
RE: Downloadbereich erweitern - Ramm - 06.05.2006
ÄHH was meinst du damit genau ?
RE: Downloadbereich erweitern - Michael - 07.05.2006
Führe diesen Query aus:
Code: ALTER TABLE `mybb_forumdownloads` ADD `downloadlinkname` VARCHAR( 200 ) NOT NULL ;
Suche nach:
PHP-Code: if($mybb->input['type'] == 'download') { $new_entry['cid'] = intval($mybb->input['cid']); $new_entry['uid'] = intval($mybb->input['uid']); $new_entry['cid'] = addslashes($mybb->input['cid']); $new_entry['url'] = addslashes($mybb->input['url']); $new_entry['visible'] = addslashes($mybb->input['visible']); $new_entry['sticky'] = addslashes($mybb->input['sticky']); $new_entry['validated'] = 'yes'; $new_entry['customlink'] = addslashes($mybb->input['customlink']); $new_entry['customurl'] = addslashes($mybb->input['customurl']); $db->insert_query(TABLE_PREFIX."forumdownloads", $new_entry); $message = 'Download hinzugefügt'; }
Ersetzen durch:
PHP-Code: if($mybb->input['type'] == 'download') { $new_entry['cid'] = intval($mybb->input['cid']); $new_entry['uid'] = intval($mybb->input['uid']); $new_entry['cid'] = addslashes($mybb->input['cid']); $new_entry['url'] = addslashes($mybb->input['url']); $new_entry['visible'] = addslashes($mybb->input['visible']); $new_entry['sticky'] = addslashes($mybb->input['sticky']); $new_entry['validated'] = 'yes'; $new_entry['customlink'] = addslashes($mybb->input['customlink']); $new_entry['customurl'] = addslashes($mybb->input['customurl']); $new_entry['downloadlinkname'] = addslashes($mybb->input['downloadlinkname']); $db->insert_query(TABLE_PREFIX."forumdownloads", $new_entry); $message = 'Download hinzugefügt'; }
Suche nach:
PHP-Code: if(intval($mybb->input['did'])) { $update_download = array( 'did' => intval($mybb->input['did']), 'cid' => intval($mybb->input['cid']), 'uid' => intval($mybb->input['uid']), 'name' => addslashes($mybb->input['name']), 'description' => addslashes($mybb->input['description']), 'url' => addslashes($mybb->input['url']), 'sticky' => addslashes($mybb->input['sticky']), 'visible' => addslashes($mybb->input['visible']), 'customlink' => addslashes($mybb->input['customlink']), 'customurl' => addslashes($mybb->input['customurl']), ); $db->update_query(TABLE_PREFIX."forumdownloads", $update_download, "did='".intval($mybb->input['did'])."'"); $message = 'Download geändert'; }
Ersetzen durch:
PHP-Code: if(intval($mybb->input['did'])) { $update_download = array( 'did' => intval($mybb->input['did']), 'cid' => intval($mybb->input['cid']), 'uid' => intval($mybb->input['uid']), 'name' => addslashes($mybb->input['name']), 'description' => addslashes($mybb->input['description']), 'url' => addslashes($mybb->input['url']), 'sticky' => addslashes($mybb->input['sticky']), 'visible' => addslashes($mybb->input['visible']), 'customlink' => addslashes($mybb->input['customlink']), 'customurl' => addslashes($mybb->input['customurl']), 'downloadlinkname' => addslashes($mybb->input['downloadlinkname']), ); $db->update_query(TABLE_PREFIX."forumdownloads", $update_download, "did='".intval($mybb->input['did'])."'"); $message = 'Download geändert'; }
Suche nach:
PHP-Code: $update_download = array( 'cid' => intval($mybb->input['cid'][$did]), 'name' => addslashes($mybb->input['name'][$did]), 'description' => addslashes($mybb->input['description'][$did]), 'url' => addslashes($mybb->input['url'][$did]), 'sticky' => addslashes($mybb->input['sticky'][$did]), 'visible' => addslashes($mybb->input['visible'][$did]), 'validated' => 'yes', 'customlink' => addslashes($mybb->input['customlink'][$did]), 'customurl' => addslashes($mybb->input['customurl'][$did]), );
Ersetzen durch:
PHP-Code: $update_download = array( 'cid' => intval($mybb->input['cid'][$did]), 'name' => addslashes($mybb->input['name'][$did]), 'description' => addslashes($mybb->input['description'][$did]), 'url' => addslashes($mybb->input['url'][$did]), 'sticky' => addslashes($mybb->input['sticky'][$did]), 'visible' => addslashes($mybb->input['visible'][$did]), 'validated' => 'yes', 'customlink' => addslashes($mybb->input['customlink'][$did]), 'customurl' => addslashes($mybb->input['customurl'][$did]), 'downloadlinkname' => addslashes($mybb->input['downloadlinkname'][$did]), );
Suche nach:
PHP-Code: if($count['numcats'] > 0) { echo "<br />\n"; startform('downloads.php', '', 'do_add'); makehiddencode('type', 'download'); starttable(); tableheader('Download hinzufügen'); makeinputcode('Download Name', 'name'); maketextareacode('Download Beschreibung', 'description'); makeinputcode('Download URL', 'url'); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name'); makeyesnocode('Ist der Download sichtbar?', 'visible'); makeyesnocode('Ist der Download wichtig?', 'sticky', 'no'); makeinputcode('Eigener Link (Name)', 'customlink'); makeinputcode('Eigener Link (URL)', 'customurl'); endtable(); endform('Download hinzufügen', 'Zurücksetzen'); }
Ersetzen durch:
PHP-Code: if($count['numcats'] > 0) { echo "<br />\n"; startform('downloads.php', '', 'do_add'); makehiddencode('type', 'download'); starttable(); tableheader('Download hinzufügen'); makeinputcode('Download Name', 'name'); maketextareacode('Download Beschreibung', 'description'); makeinputcode('Download URL', 'url'); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name'); makeyesnocode('Ist der Download sichtbar?', 'visible'); makeyesnocode('Ist der Download wichtig?', 'sticky', 'no'); makeinputcode('Eigener Link (Name)', 'customlink'); makeinputcode('Eigener Link (URL)', 'customurl'); makeinputcode('Eigener Name', 'downloadlinkname'); endtable(); endform('Download hinzufügen', 'Zurücksetzen'); }
Suche nach:
PHP-Code: if(intval($mybb->input['did'])) { $did = intval($mybb->input['did']); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."forumdownloads WHERE did='$did'"); $download = $db->fetch_array($query); $download['description'] = stripslashes($download['description']); startform('downloads.php', '', 'do_edit'); starttable(); tableheader('Download bearbeiten'); makeinputcode('Download Name', 'name', $download['name']); maketextareacode('Download Beschreibung', 'description', $download['description']); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name', $download['cid']); makeinputcode('Datei URL', 'url', $download['url']); makeyesnocode('Ist der Download sichtbar?', 'visible', $download['visible']); makeyesnocode('Ist der Download wichtig?', 'sticky', $download['sticky']); makeinputcode('Eigener Link (Name)', 'customlink', $download['customlink']); makeinputcode('Eigener Link (URL)', 'customurl', $download['customurl']); endtable(); makehiddencode('did', $did); endform('Download ändern', 'Zurücksetzen'); }
Ersetzen durch:
PHP-Code: if(intval($mybb->input['did'])) { $did = intval($mybb->input['did']); $query = $db->query("SELECT * FROM ".TABLE_PREFIX."forumdownloads WHERE did='$did'"); $download = $db->fetch_array($query); $download['description'] = stripslashes($download['description']); startform('downloads.php', '', 'do_edit'); starttable(); tableheader('Download bearbeiten'); makeinputcode('Download Name', 'name', $download['name']); maketextareacode('Download Beschreibung', 'description', $download['description']); makeselectcode('Kategorie', 'cid', 'downloadcategories', 'cid', 'name', $download['cid']); makeinputcode('Datei URL', 'url', $download['url']); makeyesnocode('Ist der Download sichtbar?', 'visible', $download['visible']); makeyesnocode('Ist der Download wichtig?', 'sticky', $download['sticky']); makeinputcode('Eigener Link (Name)', 'customlink', $download['customlink']); makeinputcode('Eigener Link (URL)', 'customurl', $download['customurl']); makeinputcode('Eigener Name', 'downloadlinkname', $download['downloadlinkname']); endtable(); makehiddencode('did', $did); endform('Download ändern', 'Zurücksetzen'); }
Suche nach:
PHP-Code: while($download = $db->fetch_array($query)) { makeinputcode('Download Name', "name[$download[did]]", $download['name']); makelabelcode('Eingereicht von', "<a href=\"users.php?action=edit&uid=$download[uid]\">$download[username]</a>"); maketextareacode('Beschreibung', "description[$download[did]]", $download['description']); makeselectcode('Kategorie', "cid[$download[did]]", "downloadcategories", "cid", "name", $download['cid']); makeinputcode('Datei URL', "url[$download[did]]", $download['url']); makeyesnocode('Ist der Download sichtbar?', "visible[$download[did]]", 'yes'); makeyesnocode('Ist der Download wichtig?', "sticky[$download[did]]", 'no'); makeinputcode('Eigener Link (Name)', "customlink[$download[did]]", $download['customlink']); makeinputcode('Eigener Link (URL)', "customurl[$download[did]]", $download['customurl']); makeyesnocode('Einreichung annehmen?', "validated[$download[did]]", 'yes'); makeyesnocode('Einreichung ablehnen?', "delete[$download[did]]", 'no'); echo "<tr>\n<td class=\"subheader\" align=\"center\" colspan=\"2\" height=\"2\"><img src=\"pixel.gif\" width=\"1\" height=\"1\"></td>\n</tr>\n"; }
Ersetzen durch:
PHP-Code: while($download = $db->fetch_array($query)) { makeinputcode('Download Name', "name[$download[did]]", $download['name']); makelabelcode('Eingereicht von', "<a href=\"users.php?action=edit&uid=$download[uid]\">$download[username]</a>"); maketextareacode('Beschreibung', "description[$download[did]]", $download['description']); makeselectcode('Kategorie', "cid[$download[did]]", "downloadcategories", "cid", "name", $download['cid']); makeinputcode('Datei URL', "url[$download[did]]", $download['url']); makeyesnocode('Ist der Download sichtbar?', "visible[$download[did]]", 'yes'); makeyesnocode('Ist der Download wichtig?', "sticky[$download[did]]", 'no'); makeinputcode('Eigener Link (Name)', "customlink[$download[did]]", $download['customlink']); makeinputcode('Eigener Link (URL)', "customurl[$download[did]]", $download['customurl']); makeinputcode('Eigener Name', "downloadlinkname[$download[did]]", $download['downloadlinkname']); makeyesnocode('Einreichung annehmen?', "validated[$download[did]]", 'yes'); makeyesnocode('Einreichung ablehnen?', "delete[$download[did]]", 'no'); echo "<tr>\n<td class=\"subheader\" align=\"center\" colspan=\"2\" height=\"2\"><img src=\"pixel.gif\" width=\"1\" height=\"1\"></td>\n</tr>\n"; }
Danach musst du im Template das Wort "Herunterladen" durch die Variable $download[downloadlinkname] ersetzen.
RE: Downloadbereich erweitern - Ramm - 07.05.2006
Perfek (FAST) danke.
Es schneiden sich jetzt die umenderung oben bei mir und der Fehler: https://www.mybb.de/forum/showthread.php?tid=1740
|