Subversion Repositories Applications.papyrus

Rev

Rev 921 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 921 Rev 1694
Line 19... Line 19...
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: iw_integrateur.fonct.php,v 1.19 2006-08-29 20:22:41 ddelon Exp $
24
// CVS : $Id: iw_integrateur.fonct.php,v 1.20 2007-11-19 09:54:20 ddelon Exp $
25
/**
25
/**
26
* Fonctions de l'integrateur de page Wikini
26
* Fonctions de l'integrateur de page Wikini
27
*
27
*
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
29
*
29
*
Line 31... Line 31...
31
//Auteur original :
31
//Auteur original :
32
*@author        David Delon <david.delon@clapas.net>
32
*@author        David Delon <david.delon@clapas.net>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.19 $ $Date: 2006-08-29 20:22:41 $
36
*@version       $Revision: 1.20 $ $Date: 2007-11-19 09:54:20 $
37
*
37
*
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 203... Line 203...
203
		
203
		
Line 204... Line 204...
204
				$result='';
204
				$result='';
205
		
205
		
-
 
206
				if ($_POST) {
-
 
207
					if ($_POST["submit"] == "Sauver")	{
-
 
208
						
-
 
209
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
-
 
210
					if($_POST["hashcash_value"] != hashcash_field_value()) {
-
 
211
						$this->SetMessage("Cette page n\'a pas &eacute;t&eacute; enregistr&eacute;e car ce wiki pense que vous etes un robot !");
-
 
212
						$this->Redirect($this->href());
206
				if ($_POST) {
213
					}
207
					if ($_POST["submit"] == "Sauver")	{
214
	
208
					// check for overwriting
215
					// check for overwriting
209
						if ($this->page) {
216
						if ($this->page) {
210
							if ($this->page["id"] != $_POST["previous"]) {
217
							if ($this->page["id"] != $_POST["previous"]) {
Line 261... Line 268...
261
						$this->FormClose()."\n";
268
						$this->FormClose()."\n";
262
					return $result;
269
					return $result;
263
				}
270
				}
264
				else
271
				else
265
				{
272
				{
-
 
273
					
-
 
274
					// Edition 
-
 
275
		
-
 
276
					require_once(ADWI_CHEMIN_BIBLIOTHEQUE.'/hashcash/secret/wp-hashcash.lib');
-
 
277
            
-
 
278
            		// UPDATE RANDOM SECRET
-
 
279
            		$curr = @file_get_contents(HASHCASH_SECRET_FILE);
-
 
280
            		if(empty($curr) || (time() - @filemtime(HASHCASH_SECRET_FILE)) > HASHCASH_REFRESH){
-
 
281
            	
-
 
282
            			// update our secret
-
 
283
            			$fp = fopen(HASHCASH_SECRET_FILE, 'w');
-
 
284
            
-
 
285
            			if(@flock($fp, LOCK_EX)){
-
 
286
            				fwrite($fp, rand(21474836, 2126008810));
-
 
287
            				@flock($fp, LOCK_UN);
-
 
288
            			}
-
 
289
            
-
 
290
            			fclose($fp);
-
 
291
            	
-
 
292
            		}
-
 
293
            		
-
 
294
            		if (isset($GLOBALS['_GEN_commun']['url_sauvegarde']) && ($GLOBALS['_GEN_commun']['url_sauvegarde']!='')) {
-
 
295
	                  $a=parse_url(str_replace('&amp;', '&', $GLOBALS['_GEN_commun']['url_sauvegarde']->getUrl()));
-
 
296
					}
-
 
297
 
-
 
298
					else {
-
 
299
                        $a = parse_url($this->config['base_url']);
-
 
300
					}
-
 
301
            		
-
 
302
                    $siteurl = ($a['scheme'].'://'.$a['host'].dirname($a['path']));
-
 
303
            
-
 
304
            
-
 
305
            		$ChampsHashcash = 
-
 
306
            		 '<link rel="powered" title="Elliott Back\'s Antispam" href="http://elliottback.com" />'.
-
 
307
            		 '<script type="text/javascript" src="' . $siteurl . '/client/integrateur_wikini/bibliotheque/hashcash/wp-hashcash-js.php?siteurl='.$siteurl.'"></script>';
-
 
308
            	 
266
					$ACbuttonsBar='';
309
					$ACbuttonsBar='';
267
				    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
310
				    require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
Line 268... Line 311...
268
		
311
		
269
					$result .=
312
					$result .=
270
					$this->FormOpen("edit").
313
					$this->FormOpen("edit").
271
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
314
					"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".$ACbuttonsBar.
272
					"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
315
					"<textarea onkeydown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n".
273
					htmlspecialchars($body).
316
					htmlspecialchars($body).
274
					"\n</textarea><br />\n".'<div class="boutons_wiki">'.
317
					"\n</textarea><br />\n".'<div class="boutons_wiki">'.
275
					($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
318
					($this->config["preview_before_save"] ? "" : $ChampsHashcash."<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n").
276
					"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
319
					"<input name=\"submit\" type=\"submit\" value=\"Aper&ccedil;u\" accesskey=\"p\" />\n".
277
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" /></div>\n".
320
					"<input type=\"button\" value=\"Annulation\" onclick=\"document.location='".$this->href("")."';\" /></div>\n".
Line 278... Line 321...
278
					$this->FormClose();
321
					$this->FormClose();