diff -burN --exclude=.git openplanet/changelog.txt openplanet-1.2-patch-hugo/changelog.txt --- openplanet/changelog.txt 2008-08-14 18:01:09.000000000 -0400 +++ openplanet-1.2-patch-hugo/changelog.txt 2010-02-18 11:13:10.000000000 -0500 @@ -1,3 +1,14 @@ + +Version : 1.2 (Patch hugo www.digitalspirit.org) + + On ne modifie pas le status d'un billet qu'on update, ainsi, si il est marqué hors ligne, il le reste... + Skip if no title ot no content_post... + Autorisation dans SimplePie des balises Object, Param, Embed + Afin de pouvoir lire les vidéos... + On ne modifie pas la categorie d'un billet dont on fait la mise a jour + Résolution de problemes avec les tags importés comportant des accents + + Version : 1.2 Ajout du système de tag. diff -burN --exclude=.git openplanet/functions.php openplanet-1.2-patch-hugo/functions.php --- openplanet/functions.php 2008-12-10 22:41:09.000000000 -0500 +++ openplanet-1.2-patch-hugo/functions.php 2010-02-18 10:20:56.000000000 -0500 @@ -26,9 +26,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# Disvroiañ ( http://www.le-regent.org/ ) 2007 Copyright (C) +# Disvroia� ( http://www.le-regent.org/ ) 2007 Copyright (C) # # ***** END LICENSE BLOCK ***** + /* * * @@ -428,32 +429,42 @@ global $core, $aCONFIG; $aLog= $aError= $aMeta= array(); $bUpdate= false; - if((isset($aCONFIG["log"]) && $aCONFIG["log"]=="1") - && (isset($p_aPosted["cron"]) && $p_aPosted["cron"]=="0")) { + if((isset($aCONFIG["log"]) && $aCONFIG["log"]=="1") && (isset($p_aPosted["cron"]) && $p_aPosted["cron"]=="0")) { if(isset($p_aPosted["update"]) && $p_aPosted["update"]!="") { $sOperation= "UPDATE"; - } - else { + } else { $sOperation= "INSERT"; } } + if ($p_bAction) { - if($p_aParsed->get_content()!="") { - $sContent= $p_aParsed->get_content(); + + $sContent = $p_aParsed->get_content(); + + if (trim($sContent)=="\"\"") { + $sContent=""; } - if (trim($sContent)=="\"\""){$sContent="";} + $aUser= $core->getUser($p_aPosted["users"]); $p_oCursor->blog_id= $aCONFIG["blogid"]; $p_oCursor->user_id= $p_aPosted["users"]; $p_oCursor->post_tz= $aUser->user_tz; $p_oCursor->post_title= $p_aParsed->get_title(true); - $p_oCursor->cat_id= $aCONFIG["categories"]; - if(trim($p_aParsed->get_date("Y-m-d H:i:s"))!="") { - $p_oCursor->post_upddt= $p_oCursor->post_creadt= $p_oCursor->post_dt= $p_aParsed->get_date("Y-m-d H:i:s"); + + // Modif Hugo : Ne pas modifier la categorie d'un billet qu'on update, ni son status... + if (!isset($p_aPosted["update"]) || !$p_aPosted["update"]) { + // Insert + $p_oCursor->cat_id = $aCONFIG["categories"]; + $p_oCursor->post_status= ($p_aPosted["stateimport"]=="2" ? $aCONFIG["statusdefault"] : $p_aPosted["stateimport"]); } - else { + // End Hugo + + if (trim($p_aParsed->get_date("Y-m-d H:i:s"))!="") { + $p_oCursor->post_upddt= $p_oCursor->post_creadt= $p_oCursor->post_dt= $p_aParsed->get_date("Y-m-d H:i:s"); + } else { $p_oCursor->post_upddt= $p_oCursor->post_creadt= $p_oCursor->post_dt= date("Y-m-d H:i:s"); } + $p_oCursor->post_format= "xhtml"; $p_oCursor->post_password= ""; $p_oCursor->post_lang= ($p_aPosted["langimport"]=="2" ? $aCONFIG["language"] : $p_aPosted["langimport"]); @@ -462,7 +473,6 @@ $p_oCursor->post_content= $sContent; $p_oCursor->post_content_xhtml= $sContent; $p_oCursor->post_notes= ""; - $p_oCursor->post_status= ($p_aPosted["stateimport"]=="2" ? $aCONFIG["statusdefault"] : $p_aPosted["stateimport"]); $p_oCursor->post_selected= 0; $p_oCursor->post_open_comment= 0; $p_oCursor->post_open_tb= 1; @@ -470,34 +480,59 @@ $p_oCursor->post_words= implode(' ',text::splitWords($p_oCursor->post_title.' '.$p_oCursor->post_excerpt_xhtml.' '.$p_oCursor->post_content_xhtml)); $p_oCursor->post_password= null; + // Modif Hugo + if (!trim($p_oCursor->post_title) || !trim($p_oCursor->post_content)) { + $aError[]= 'Title or post content are empty !'; + return $aError; + } + // End Hugo + //Add tags $bTagInsert= true; - if(trim($aCONFIG["taglist"])!="") { + $bTagList= false; + if (trim($aCONFIG["taglist"])) { $bTagInsert= false; $bTagList= true; - $aListTag= explode(",",$aCONFIG["taglist"]); + $aListTag= explode(',', $aCONFIG["taglist"]); } - else { $bTagList= false; } - if(count($p_aParsed->data["child"][""]["category"])>1) { - $aItem= $p_aParsed->data["child"][""]["category"]; - $iItem= (count($aItem)-1); - for($i=1;$i<$iItem;$i++) { - if($bTagList===true) { + + if (count($p_aParsed->data["child"][""]["category"]) > 1) { + $aItem = $p_aParsed->data["child"][""]["category"]; + $iItem = (count($aItem)); + + for ($i = 0; $i < $iItem; $i++) { + if($bTagList) { $bTagInsert= checkIfTagged($aItem[$i]["data"], $aListTag); } - $aMeta["tag"][]= strtolower($aItem[$i]["data"]); + + // Important pour eviter les problemes d'encodage + //$aMeta["tag"][]= strtolower($aItem[$i]["data"]); + $aMeta["tag"][]= $aItem[$i]["data"]; + } + + if($bTagInsert && sizeof($aMeta["tag"])) { + foreach ($aMeta['tag'] as &$tag) { + $tag = mb_convert_encoding($tag, 'UTF-8'); } - if($bTagInsert && sizeof($aMeta["tag"])>0) { $p_oCursor->post_meta= serialize($aMeta); } + $p_oCursor->post_meta= serialize($aMeta); } + } + if($bTagInsert) { try { - if(isset($p_aPosted["update"]) - && $p_aPosted["update"]=== true) { + if (isset($p_aPosted["update"]) && $p_aPosted["update"]=== true) { + + // Behavior + $core->callBehavior('adminBeforePostUpdate', $p_oCursor, $p_aPosted['post_id']); + $post_idEnd= $p_oCursor->update("WHERE post_id = ".(integer) $p_aPosted["post_id"]); $post_id= (integer) $p_aPosted["post_id"]; $bUpdate= true; - } - else { + } else { + + // Behavior + $core->callBehavior('adminBeforePostCreate', $p_oCursor); + $p_oCursor->post_id= $post_id= selectMax($core->prefix."post"); $post_idEnd= $p_oCursor->insert(); $bUpdate= true; @@ -507,20 +542,24 @@ ('".$p_aPosted["id"]."','".$post_id."')"; $core->con->execute($sSql) ; } - } - catch (Exception $e) { - if((isset($aCONFIG["log"]) && $aCONFIG["log"]=="1") - && (isset($p_aPosted["cron"]) && $p_aPosted["cron"]=="0")) { + } catch (Exception $e) { + if((isset($aCONFIG["log"]) && $aCONFIG["log"]=="1") && (isset($p_aPosted["cron"]) && $p_aPosted["cron"]=="0")) { $aLog[]= "[error] ".$sOperation." NOT OK FOR ".$p_aParsed->get_permalink(); } $aError[]= __($e->getMessage()); } + //Tags + try { if($bUpdate===true) { $sSql= "DELETE FROM ".$core->prefix."meta WHERE post_id='".$post_id."'"; $core->con->execute($sSql) ; - if(count($aMeta["tag"])>0){dcOpenPlanet::setMeta($aMeta,$post_id);} + if(isset($aMeta["tag"]) && count($aMeta["tag"])>0) { + dcOpenPlanet::setMeta($aMeta,$post_id); + } + } + } catch (Exception $e) { } } else { @@ -529,6 +568,9 @@ $aLog[]= "[tag] ".$sOperation." NOT OK FOR ".$p_aParsed->get_permalink(); } } + + $blog = new dcBlog($core, $p_oCursor->blog_id); + $blog->triggerBlog(); } else { $sSql= "SELECT post_id @@ -555,11 +597,9 @@ if (count($aError)==0 && $bUpdate==true) { if((isset($aCONFIG["log"]) && $aCONFIG["log"]=="1")) { if(isset($p_aPosted["cron"]) && $p_aPosted["cron"]=="0") { - $aLog[]= "[sucess] ".$sOperation." OK FOR ".$p_aParsed->get_permalink(); - } - else { - $core->blog->triggerBlog(); + $aLog[]= "[sucess] ".$sOperation." OK FOR ".$p_aParsed->get_permalink();$core->blog->triggerBlog(); } + else { $core->blog->triggerBlog() ; } } } if(isset($aError["LOG"])) { $aError["LOG"]= $aLog; } diff -burN --exclude=.git openplanet/.gitignore openplanet-1.2-patch-hugo/.gitignore --- openplanet/.gitignore 1969-12-31 19:00:00.000000000 -0500 +++ openplanet-1.2-patch-hugo/.gitignore 2010-02-18 09:49:56.000000000 -0500 @@ -0,0 +1 @@ +log/* diff -burN --exclude=.git openplanet/index.php openplanet-1.2-patch-hugo/index.php --- openplanet/index.php 2008-08-14 18:01:09.000000000 -0400 +++ openplanet-1.2-patch-hugo/index.php 2010-02-18 09:49:56.000000000 -0500 @@ -53,6 +53,16 @@ $aResult= detailsRss($_GET["det"]) ; // Create a new instance of the SimplePie object $aParsed = new SimplePie(); + + // Modif hugo + $strip_htmltags = $aParsed->strip_htmltags; + unset($strip_htmltags[array_search('object', $strip_htmltags)]); + unset($strip_htmltags[array_search('param', $strip_htmltags)]); + unset($strip_htmltags[array_search('embed', $strip_htmltags)]); + $strip_htmltags = array_values($strip_htmltags); + $aParsed->strip_htmltags($strip_htmltags); + // End Modif hugo + if(isset($_GET["det"]) && $_GET["det"]!="") { if(isset($_POST["txtFlux"]) && $aResult["web"]==urlencode($_POST["txtFlux"])) { $sUrlFeed= setUrlFlux(rawurlencode($_POST["txtFlux"])); diff -burN --exclude=.git openplanet/js/openplanet.js openplanet-1.2-patch-hugo/js/openplanet.js --- openplanet/js/openplanet.js 1969-12-31 19:00:00.000000000 -0500 +++ openplanet-1.2-patch-hugo/js/openplanet.js 2010-02-18 09:49:56.000000000 -0500 @@ -0,0 +1 @@ + diff -burN --exclude=.git openplanet/lib/class.dc.OpenPlanet.php openplanet-1.2-patch-hugo/lib/class.dc.OpenPlanet.php --- openplanet/lib/class.dc.OpenPlanet.php 2008-12-10 23:30:43.000000000 -0500 +++ openplanet-1.2-patch-hugo/lib/class.dc.OpenPlanet.php 2010-02-18 11:19:47.000000000 -0500 @@ -647,6 +647,7 @@ global $core, $aCONFIG; $sFile= $aCONFIG["repository"].self::getNamePlugins(true)."/log/update.log-".date("Y-m-d"); + if(!file_exists($sFile)) { $oHandle= fopen($sFile, 'a+'); fclose($oHandle); diff -burN --exclude=.git openplanet/lib/cron.php openplanet-1.2-patch-hugo/lib/cron.php --- openplanet/lib/cron.php 2008-12-08 22:23:03.000000000 -0500 +++ openplanet-1.2-patch-hugo/lib/cron.php 2010-02-18 11:20:59.000000000 -0500 @@ -29,6 +29,7 @@ # Disvroiañ ( http://www.le-regent.org/ ) 2007 Copyright (C) # # ***** END LICENSE BLOCK ***** + require_once(dirname(__FILE__)."/../../../inc/prepend.php"); require_once(dirname(__FILE__)."/../config.php"); $aLog= $aError= array(); @@ -51,6 +52,16 @@ unset($aCron, $aPosted); } $aCron= new SimplePie(); + + // Modif hugo + $strip_htmltags = $aCron->strip_htmltags; + unset($strip_htmltags[array_search('object', $strip_htmltags)]); + unset($strip_htmltags[array_search('param', $strip_htmltags)]); + unset($strip_htmltags[array_search('embed', $strip_htmltags)]); + $strip_htmltags = array_values($strip_htmltags); + $aCron->strip_htmltags($strip_htmltags); + // End Modif hugo + $aCONFIG= dcOpenPlanet::loadConfiguration($rsCron->f("blog_id")); if($aCONFIG["repository"]!="") { $sUrlFeed= setUrlFlux(rawurlencode(urldecode($rsCron->f("pl_web")))); @@ -64,19 +75,23 @@ // We'll make sure that the right content type and character encoding gets set automatically. // This function will grab the proper character encoding, as well as set the content type to text/html. $aCron->handle_content_type(); - $aPosted= array( "users"=> $rsCron->f("user_id"), - "langimport"=>$rsCron->f("pl_language"), - "stateimport"=>$rsCron->f("pl_post"), - "id"=>$rsCron->f("planeterss_id"), - "blog_id"=>$aCONFIG["blogid"], - "cron"=>"0"); + $aPosted= array( "users" => $rsCron->f("user_id"), + "langimport" => $rsCron->f("pl_language"), + "stateimport" => $rsCron->f("pl_post"), + "id" => $rsCron->f("planeterss_id"), + "blog_id" => $aCONFIG["blogid"], + "cron" => "0"); if($bSuccess=="0") { $aLog[]= "[info] Starting with ".$sUrlFeed; foreach($aCron->get_items() as $aItemRss) { + + // Post already exists ? if (($aPosted["post_id"]= checkUrlExist(addslashes($aItemRss->get_permalink()),true))!==true) { $aPosted["update"]= true; + } else { + $aPosted["update"]= false; } - else {$aPosted["update"]= false;} + if(!isset($aBanned[urlencode(trim($aItemRss->get_permalink()))])) { $aError= insertFluxDatabase($aItemRss, $aPosted, true, $cur); if(isset($aError["LOG"])) { @@ -117,8 +132,7 @@ } dcOpenPlanet::setLog($aLog); unset($cur); - $core->id= $aCONFIG["blogid"]; - $core->triggerBlog(); +// $core->blog->triggerBlog(); } ?> Binary files openplanet/pic/antispam.img.png and openplanet-1.2-patch-hugo/pic/antispam.img.png differ diff -burN --exclude=.git openplanet/ToDo openplanet-1.2-patch-hugo/ToDo --- openplanet/ToDo 1969-12-31 19:00:00.000000000 -0500 +++ openplanet-1.2-patch-hugo/ToDo 2010-02-18 09:49:56.000000000 -0500 @@ -0,0 +1,3 @@ +- Lors de l'ajout d'un flux par l'admin, le mettre actif. +- Pouvoir désactiver l'envoie vers identi.ca +- Pouvoir specifier des balises a enlever des flux diff -burN --exclude=.git openplanet/typeaction.php openplanet-1.2-patch-hugo/typeaction.php --- openplanet/typeaction.php 2008-11-10 08:26:41.000000000 -0500 +++ openplanet-1.2-patch-hugo/typeaction.php 2010-02-18 09:49:56.000000000 -0500 @@ -26,7 +26,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# Disvroiañ ( http://www.le-regent.org/ ) 2007 Copyright (C) +# Disvroia� ( http://www.le-regent.org/ ) 2007 Copyright (C) # # ***** END LICENSE BLOCK ***** /* @@ -115,7 +115,7 @@ mail::sendMail($aUser->user_email, $sSubject, $sMessage, $sHeaders); $sSql= "UPDATE ".dcOpenPlanet::getTable(0)." SET pl_mail='1' - WHERE planeterss_id'".$_GET["id"]."'"; + WHERE planeterss_id='".$_GET["id"]."'"; $core->con->execute($sSql); $core->setUserBlogPermissions($rs->f("user_id"), $aCONFIG["blogid"], array('usage'=>1), true); return $aError[]= __("Mail has been send successfully"); @@ -142,10 +142,20 @@ $sSql= "SELECT planeterss_id FROM ".dcOpenPlanet::getTable(0)." - WHERE pl_name='".addslashes($_POST["txtName"])."'"; + WHERE pl_name='".addslashes( $_POST["txtName"] )."'"; if (($rs= $core->con->select($sSql)) !== false) { if ($rs->isEmpty()) { $aFlux= new SimplePie(); + + // Modif hugo + $strip_htmltags = $aFlux->strip_htmltags; + unset($strip_htmltags[array_search('object', $strip_htmltags)]); + unset($strip_htmltags[array_search('param', $strip_htmltags)]); + unset($strip_htmltags[array_search('embed', $strip_htmltags)]); + $strip_htmltags = array_values($strip_htmltags); + $aFlux->strip_htmltags($strip_htmltags); + // End Modif hugo + $sUrlFeed= setUrlFlux(rawurlencode($_POST["txtFlux"])); // Make sure that page is getting passed a URL if (isset($sUrlFeed) && $sUrlFeed !== '') { @@ -164,7 +174,7 @@ if(isset($_POST["langimport"]) && $_POST["langimport"]) { $sLangImport= $_POST["langimport"]; } else { $sLangImport= $aCONFIG["language"]; } $sSql="INSERT INTO ".dcOpenPlanet::getTable(0)." (planeterss_id, pl_web, pl_name, user_id, pl_subscribe, - pl_status, pl_post, pl_mail,pl_language, blog_id) + pl_status, pl_post, pl_mail , pl_language, blog_id) VALUES ('".$iPlaneteId."','".urlencode($_POST["txtFlux"])."', '".addslashes($_POST["txtName"])."', '".$_POST["users"]."', '".date("Y-m-d H:i:s")."','".$chkStatus."', @@ -231,6 +241,7 @@ catch (Exception $e) { } } + $core->blog->triggerBlog(); $aError[]= __("The flux has been added"); } break; @@ -381,6 +392,16 @@ $iLangueImport= $rs->f("pl_language"); $sUrlFeed= setUrlFlux(rawurlencode(urldecode($rs->f("pl_web")))); $aFlux = new SimplePie(); + + // Modif hugo + $strip_htmltags = $aFlux->strip_htmltags; + unset($strip_htmltags[array_search('object', $strip_htmltags)]); + unset($strip_htmltags[array_search('param', $strip_htmltags)]); + unset($strip_htmltags[array_search('embed', $strip_htmltags)]); + $strip_htmltags = array_values($strip_htmltags); + $aFlux->strip_htmltags($strip_htmltags); + // End Modif hugo + // Make sure that page is getting passed a URL if (isset($sUrlFeed) && $sUrlFeed !== '') { // Strip slashes if magic quotes is enabled (which automatically escapes certain characters)