Merge lp:~malizor/ubuntu-fr-forum/fixe-384088 into lp:ubuntu-fr-forum

Proposed by Nicolas Delvaux
Status: Merged
Merged at revision: 121
Proposed branch: lp:~malizor/ubuntu-fr-forum/fixe-384088
Merge into: lp:ubuntu-fr-forum
Diff against target: 98 lines (+24/-11)
1 file modified
plugins/AP_Forum_Annonces.php (+24/-11)
To merge this branch: bzr merge lp:~malizor/ubuntu-fr-forum/fixe-384088
Reviewer Review Type Date Requested Status
Ubuntu-fr-webteam Pending
Review via email: mp+56976@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/AP_Forum_Annonces.php' (properties changed: -x to +x)
2--- plugins/AP_Forum_Annonces.php 2008-07-12 15:48:50 +0000
3+++ plugins/AP_Forum_Annonces.php 2011-04-08 17:21:44 +0000
4@@ -1,7 +1,7 @@
5 <?php
6 /***********************************************************************
7
8- Copyright (C) 2007 Christophe Sauthier (sauthier.christophe@gmail.com).
9+ Copyright (C) 2011 Christophe Sauthier (sauthier.christophe@gmail.com).
10
11 This file is a plugin for PunBB. Created for ubuntu-fr.
12
13@@ -22,6 +22,19 @@
14
15 ************************************************************************/
16
17+/*
18+
19+This plugin needs an 'annonces' table.
20+Here is a script for MySQL (don't forget to add your db prefix!):
21+
22+CREATE TABLE `annonces` (
23+ `forum_id` int(11) NOT NULL default '0',
24+ `forum_annonce` text,
25+ `forum_annonce_visible` tinyint(1) NOT NULL default '0',
26+ PRIMARY KEY (`forum_id`)
27+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
28+
29+*/
30
31
32
33@@ -33,7 +46,7 @@
34 define('PUN_PLUGIN_LOADED', 1);
35
36 // Plugin version
37-define('PLUGIN_VERSION', '1.0.1');
38+define('PLUGIN_VERSION', '1.0.2');
39 // Load the annonces language files
40 require PUN_ROOT.'lang/'.$pun_user['language'].'/annonces.php';
41
42@@ -54,7 +67,7 @@
43 }
44 else {
45 if ($_POST['new_annonce_text']!='')
46- $query = 'INSERT INTO '.$db->prefix.'annonces (forum_id, forum_annonce, forum_annonce_visible) VALUES (\''.$db->escape($_POST['annonce_id']).'\',\''.$db->escape($_POST['new_annonce_text']).'\',\''.$db->escape($_POST['annonce_visible']).'\')';
47+ $query = 'INSERT INTO '.$db->prefix.'annonces (forum_id, forum_annonce, forum_annonce_visible) VALUES (\''.$db->escape($_POST['annonce_id']).'\',\''.$db->escape($_POST['new_annonce_text']).'\',\''.$db->escape(($_POST['isVisible'] == 'True') ? "1":"0").'\')';
48 }
49 if (defined('DEBUG'))
50 error_log("[ForumAnnonces] Query : ".$query);
51@@ -100,7 +113,8 @@
52
53 ?>
54
55-<script language="javascript">
56+<script type="text/javascript">
57+//<![CDATA[
58 var old_annonce_text="";
59
60 function editAnnonce(fid, checked) {
61@@ -120,14 +134,13 @@
62 if (! document.getElementById('new_forum_'+fid)) {
63 var annonceText = document.getElementById('forum_'+fid).innerHTML;
64 var newAnnonceText;
65- old_annonce_text=annonceText;
66- newAnnonceText = "<div id='new_forum_"+fid+"'><form id=\"form\" action=\"<?php echo $_SERVER['REQUEST_URI'] ?>\" method=\"post\"><input type=\"hidden\" name=\"annonce_id\" value=\""+fid+"\"><textarea cols='80' name=\"new_annonce_text\" id=\"new_annonce_text\">"+annonceText+"</textarea><div><?php echo $lang_annonces['is visible'] ?><input type=\"checkbox\" name=\"isVisible\" id=\"isVisible\" value=\"True\" "+checked+"></div>";
67+ old_annonce_text = annonceText;
68+ newAnnonceText = "<div id='new_forum_"+fid+"'><form id='form' action='<?php echo $_SERVER['REQUEST_URI'] ?>' method='post'><input type='hidden' name='annonce_id' value='"+fid+"'/><textarea cols='80' rows='3' name='new_annonce_text' id='new_annonce_text'>"+annonceText.replace(/<br>/g, '<br/>')+"</textarea><div><?php echo $lang_annonces['is visible'] ?><input type='checkbox' name='isVisible' id='isVisible' value='True' checked='"+checked+"'/></div>";
69
70 if (annonceText!='') {
71- newAnnonceText += "<input type=\"hidden\" name=\"annonce_exists\" value=\"1\">";
72+ newAnnonceText += "<input type='hidden' name='annonce_exists' value='1'/>";
73 }
74-
75- newAnnonceText += "</div><div><input type='button' value='<?php echo $lang_annonces['save'] ?>' onclick='saveAnnonceModification("+fid+")'><input type='button' value='<?php echo $lang_annonces['cancel'] ?>' onclick='cancelAnnonceModification("+fid+")'></div></form></div>";
76+ newAnnonceText += "<div><input type='button' value='<?php echo $lang_annonces['save'] ?>' onclick='saveAnnonceModification("+fid+")'/><input type='button' value='<?php echo $lang_annonces['cancel'] ?>' onclick='cancelAnnonceModification("+fid+")'/></div></form></div>";
77 document.getElementById('forum_'+fid).innerHTML = newAnnonceText;
78 }
79 }
80@@ -145,8 +158,9 @@
81 old_annonce_text="";
82 }
83 }
84+//]]>
85 </script>
86-<br>
87+<br/>
88 <div id="idx<?php echo $cat_count ?>" class="blocktable">
89 <h2><span><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></span></h2>
90 <div class="box">
91@@ -164,7 +178,6 @@
92 }
93 $checked = ($cur_forum['forum_annonce_visible'] == 1) ? "checked": "";
94 $forum_field = '<div style="cursor:pointer"><h3><a onclick="editAnnonce(\''.$cur_forum['fid'].'\',\''.$checked.'\')">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3></div>';
95-// $forum_field .= "\n\t\t\t\t\t\t\t\t<div id='forum_".$cur_forum['fid']."'>Ceci est un test</div>";
96
97 $forum_field .= "\n\t\t\t\t\t\t\t\t<div id='forum_".$cur_forum['fid']."'>";
98 if ($cur_forum['forum_annonce'] != '') {

Subscribers

People subscribed via source and target branches