Changeset 2435
- Timestamp:
- 07/03/10 18:51:04 (13 years ago)
- Location:
- plugins/wikioWorld
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/wikioWorld/_define.php
r2308 r2435 17 17 /* Description*/ "Share your blog through wikio", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 3',19 /* Version */ '0.4', 20 20 /* Permissions */ 'admin' 21 21 ); 22 /* date */ #20100 60522 /* date */ #20100703 23 23 ?> -
plugins/wikioWorld/inc/class.wikioworld.php
r2262 r2435 67 67 { 68 68 $res = ''; 69 $wikioThisUrl = htmlspecialchars(strip_tags($url),ENT_QUOTES); 70 $wikioReferer = htmlspecialchars(strip_tags('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']),ENT_QUOTES); 69 70 # Object to vote on 71 $obj_url = htmlspecialchars(strip_tags($url),ENT_QUOTES); 72 $obj_ref = htmlspecialchars(strip_tags('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']),ENT_QUOTES); 71 73 72 74 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 73 75 { 74 $ wikioCliIp = $_SERVER['HTTP_X_FORWARDED_FOR'];76 $obj_id = $wikioCliIp = $_SERVER['HTTP_X_FORWARDED_FOR']; 75 77 } 76 78 elseif(isset($_SERVER['HTTP_CLIENT_IP'])) 77 79 { 78 $ wikioCliIp = $_SERVER['HTTP_CLIENT_IP'];80 $obj_id = $wikioCliIp = $_SERVER['HTTP_CLIENT_IP']; 79 81 } 80 82 else 81 83 { 82 $wikioCliIp = $_SERVER['REMOTE_ADDR']; 83 } 84 85 $wikioSuffix="fr"; 86 $wikioUrl="web.wikio.".$wikioSuffix; 87 $wikioSuffix=""; 88 $wikioNote=0; 89 $wikioId=0; 90 $wikioPattern1=""; 91 $wikioPattern2=""; 92 $wikioPattern3="/article="; 93 $wikiohasVoted=""; 94 $bVoted=0; 95 $wikioAllowVote=1; 96 97 if($wikioNote=file_get_contents("http://".$wikioUrl.$wikioSuffix."/getnote?u=".MD5($wikioThisUrl)."&i=".$wikioCliIp."&referer=".MD5($wikioReferer))) 98 { 99 if(ereg("([0-9]*)\|([0-9]*)\|(.*)\|(.*)\|([0-9]*)\|(.*)\|([0-9]*)\|",$wikioNote,$res)) 100 { 101 $wikioNote=$res[1]; 102 $wikioId=$res[2]; 103 $wikioPattern1=($res[5]==1)? $res[4]:$res[3]; 104 $wikioPattern2=$res[4]; 105 $wikiohasVoted=($res[5]==0 && $res[7]==1)? "&vote=1":""; 106 $bVoted=$res[5]; 107 $wikioSuffix=$res[6]; 108 $wikioAllowVote=$res[7]; 109 } 110 } 111 112 if($wikioId > 0) 113 { 114 $wikioUrl = 'www.wikio.'.$wikioSuffix; 115 84 $obj_id = $wikioCliIp = $_SERVER['REMOTE_ADDR']; 85 } 86 87 # Query default values 88 //0|0|votez|a voté|0|com|0| 89 //Note Wikio | Id du billet dans Wikio | Texte pour voter | Texte déjà voté | A déjà voté | Domaine wikio à utiliser pour voter | Autorisé à voter 90 $rsp_note = 0; 91 $rsp_id = 0; 92 $rs_txt_tovote = __('Vote'); 93 $rsp_txt_voted = __('Voted'); 94 $rsp_voted = 0; 95 $rsp_domain = ''; 96 $rsp_auth = 0; 97 $rsp_more = ''; 98 99 # Request values 100 $api_url = 'http://web.wikio.fr/getnote?'; 101 $api_path = ''; 102 $api_data = array( 103 'u' => MD5($obj_url), 104 'i' => $obj_id, 105 'referer' => MD5($obj_ref) 106 ); 107 108 # Send request 109 $client = netHttp::initClient($api_url,$api_path); 110 $client->setUserAgent('wikioWorld for Dotclear'); 111 $client->setPersistReferers(false); 112 $client->get($api_path,$api_data); 113 114 # Request response 115 if ($client->getStatus() == 200) 116 { 117 $rs = $client->getContent(); 118 $exp = explode('|',$rs); 119 120 # Parse response 121 if(count($exp) == 8) 122 { 123 list( 124 $rsp_note, 125 $rsp_id, 126 $rs_txt_tovote, 127 $rsp_txt_voted, 128 $rsp_voted, 129 $rsp_domain, 130 $rsp_auth, 131 $rsp_more, 132 ) = $exp; 133 } 134 } 135 136 # Existing 137 if($rsp_id > 0) 138 { 116 139 $res .= 117 140 "<script type=\"text/javascript\"> \n". … … 119 142 "function setWikio(){ \n"; 120 143 121 if($wikioAllowVote > 0 && $bVoted==0) 122 { 144 # Can vote 145 $suffix = ''; 146 if($rsp_auth && !$rsp_voted) 147 { 148 $suffix = '&vote=1'; 149 123 150 $res .= 124 151 "var t=top.document; \n"; … … 126 153 if ($style == 'normal') 127 154 { 128 $res .= "if(!wikiovoted){n=t.getElementById('wikioNote1');a=t.getElementById('wikioAction1'); \n"; 155 $res .= 156 "if(!wikiovoted){ ". 157 "n=t.getElementById('wikioNote1'); ". 158 "a=t.getElementById('wikioAction1'); \n"; 129 159 } 130 160 # Compact 131 161 else 132 162 { 133 $res .= "if(!wikiovoted){var n=t.getElementById('wikionote');var a=t.getElementById('wikioaction'); \n"; 163 $res .= 164 "if(!wikiovoted){ ". 165 "var n=t.getElementById('wikionote'); ". 166 "var a=t.getElementById('wikioaction'); \n"; 134 167 } 135 168 $res .= 136 "if(n && !isNaN(parseInt(n.innerHTML))){n.innerHTML=parseInt(n.innerHTML)+1};if(a){a.innerHTML='".$wikioPattern2."'}; \n". 169 "if(n && !isNaN(parseInt(n.innerHTML))){ ". 170 "n.innerHTML=parseInt(n.innerHTML)+1}; ". 171 "if(a){a.innerHTML='".$rsp_txt_voted."'}; \n". 137 172 "} \n". 138 173 "wikiovoted=true; \n"; … … 146 181 if ($style == 'normal') 147 182 { 183 $voted = 148 184 $res .= 149 185 '<div class="wikiobutton1">'. 150 '<div class="wikioaction1"><a href="http:// '.$wikioUrl.$wikioPattern3.$wikioId.$wikiohasVoted.'" target="_blank" id="wikioAction1" onclick="setWikio();">'.$wikioPattern1.'</a></div>'.151 '<a href="http:// '.$wikioUrl.$wikioPattern3.$wikioId.$wikiohasVoted.'" class="wikiolink" target="_blank" onclick="setWikio();">'.152 '<div class="wikiovote1" align="center" id="wikioNote1">'.$ wikioNote.'</div>'.186 '<div class="wikioaction1"><a href="http://www.wikio.'.$rsp_domain.'/article='.$rsp_id.$suffix.'" target="_blank" id="wikioAction1" onclick="setWikio();">'.$suffix.'</a></div>'. 187 '<a href="http://www.wikio.'.$rsp_domain.'/article='.$rsp_id.$suffix.'" class="wikiolink" target="_blank" onclick="setWikio();">'. 188 '<div class="wikiovote1" align="center" id="wikioNote1">'.$rsp_note.'</div>'. 153 189 '</a>'. 154 190 '</div>'; … … 159 195 $res .= 160 196 '<div class="wikiobutton">'. 161 '<a href="http:// '.$wikioUrl.$wikioPattern3.$wikioId.$wikiohasVoted.'" class="wikioaction" target="_blank" onclick="setWikio();">'.197 '<a href="http://www.wikio.'.$rsp_domain.'/article='.$rsp_id.$suffix.'" class="wikioaction" target="_blank" onclick="setWikio();">'. 162 198 '<div class="wikiotxt wb">'. 163 '<div class="wikionote"><a id="wikionote" href="http:// '.$wikioUrl.$wikioPattern3.$wikioId.$wikiohasVoted.'" class="wikioaction" target="_blank" onclick="setWikio();">'.$wikioNote.'</a></div>'.164 '<div class="wikioaction"><a href="http:// '.$wikioUrl.$wikioPattern3.$wikioId.$wikiohasVoted.'" class="wikioaction" id="wikioaction" target="_blank" onclick="setWikio();">'.$wikioPattern1.'</a></div>'.199 '<div class="wikionote"><a id="wikionote" href="http://www.wikio.'.$rsp_domain.'/article='.$rsp_id.$suffix.'" class="wikioaction" target="_blank" onclick="setWikio();">'.$rsp_note.'</a></div>'. 200 '<div class="wikioaction"><a href="http://www.wikio.'.$rsp_domain.'/article='.$rsp_id.$suffix.'" class="wikioaction" id="wikioaction" target="_blank" onclick="setWikio();">'.($rsp_voted ? $rsp_txt_voted : $rsp_txt_vote).'</a></div>'. 165 201 '</div>'. 166 202 '</a>'. 167 '<div class="wikio"><a href="http:// '.$wikioUrl.'" target="_blank" class="wikioimg"><img src="http://'.$wikioUrl.'/shared/img/vote/wikio.gif" alt="'.$wikioUrl.'" border="0" /></a></div>'.203 '<div class="wikio"><a href="http://www.wikio.'.$rsp_domain.'" target="_blank" class="wikioimg"><img src="http://www.wikio.'.$rsp_domain.'/shared/img/vote/wikio.gif" alt="www.wikio.'.$rsp_domain.'" border="0" /></a></div>'. 168 204 '</div>'; 169 205 } -
plugins/wikioWorld/release.txt
r2308 r2435 1 0.4 20100703 2 * Fixed wikio request (top wikio rank now works) 3 1 4 0.3 20100605 2 5 * Switched to DC 2.2
Note: See TracChangeset
for help on using the changeset viewer.