|
Profile
Personal Photo
Rating
Options
Personal Statement
My Brain Is Called Google
Personal Info
FUNimations
CuteNews Support Crew Pimp
26 years old
Gender Not Set
Belgium
Born Mar-10-1987
Interests
Programming, Atletics
Statistics
Joined: 28-August 05
Profile Views: 51,971*
Last Seen: Private
Local Time: May 25 2013, 01:49 AM
16,501 posts (6 per day)
Contact Information
No Information
No Information
No Information
No Information
* Profile views updated each hour
|
Topics
Posts
Comments
Friends
My Content
9 Feb 2012
if you dould set up a demo cutenews that uses this hack as prove, i could move it to the hack forum, that or a couple of people need to have confirmed this to be working.
30 May 2011
The latest version of CuteNews UTF-8 comes with a build Captcha, our rather a pluginable captcha.
More instructions can be found at http://korn19.ch/coding/utf8-cutenews/image-captcha.php Below some captcha alternatives:
7 Nov 2010
CuteNews Compatibility: 1.4.5 - * (no incompatibility reported yet)
Description: This is a bug found by the user afullo. For the postpone news and search you have a dropdown for selecting the year. This option was very poorly coded, You'll only be able to select up to year 2010. Instructions: in addnews.mdu and search.php find CODE for($i=2005;$i<2011;$i++){ and replace by CODE for($i=2005;$i<(date('Y')+3);$i++){ This code will make sure you'll always will be able to select 2 years into the future.
22 Jun 2009
Name: Import RSS feed in CuteNews
Author: FUNimations CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet) Description: Reads an rss feed and imports the news items into CuteNews. Feeds are saved in CuteNews, any changes made to the original post won't be noticed by CuteNews!! This hack makes use of a public script. The license agreement etc. can be found in one of the files you'll have to make. The feed will be loaded each time you visit the Cn panels main page. Requirements: RSS2.0 feed Instructions: open shows.inc.php find CODE $output = str_replace("[link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output); add aboveCODE if( substr($news_arr[4], 0, 5) == "<RSS>" ) $output = str_replace("[link]","<a target=\"_blank\" href=\"".substr($news_arr[4], 5)."\">", $output); else find 2 times CODE if($config_comments_popup == "yes"){ $output = str_replace("[com-link]","<a href=\"#\" onclick=\"window.open('$config_http_script_dir/show_news.php?subaction=showcomments&template=$template&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]', '_News', '$config_comments_popup_string');return false;\">", $output); replace with CODE if( substr($news_arr[4], 0, 5) == "<RSS>" ) $output = preg_replace("'\\[com-link\\].*?\\[/com-link\\]'si","<!--rss feed can't be commented-->", $output); elseif($config_comments_popup == "yes"){ $output = str_replace("[com-link]","<a href=\"#\" onclick=\"window.open('$config_http_script_dir/show_news.php?subaction=showcomments&template=$template&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]', '_News', '$config_comments_popup_string');return false;\">", $output); open functions.inc.php and find CODE /////////////////////////////////////////////////////// add above// Function: formatsize // Description: Format the size of given file CODE /////////////////////////////////////////////////////// // Function: ResynchronizeRSS // Description: Auto-Adds rss function AutoSyncRSS() { require_once './inc/rssReader.php'; // include library include './inc/rssImportFunction.mdu'; } open the CuteNews index.php and find CODE if($mod == ""){ require("./inc/main.mdu"); } replace with CODE if($mod == ""){ require("./inc/main.mdu");AutoSyncRSS(); } Make a new file called rss_update.db.php, put it in the data folder and chmodd to 777. make a new file called rssReader.php and, put it in the inc folder. Add the following code to the file CODE <?php /** * Rss Feed Reader * * After two years, I decided to rewrite and fix this * class. Thanks to all of you who sent me bug reports * and sorry that I didn't replied. I'm lazy when it * comes to talking. * * Changelog v2.1: * - added Text parser support. Got this idea today * while working on something else. Maybe help in * some cases where XML and SimpleXML fails. To be * honest, it's not really the finest solution but * it works and I was too tired to think more about * it... * * Changelog v2.0: * - new version, hopefully without stupid bugs * if left in first version * - added SimpleXML parser support * * Bugs: * - Opening local files won't work for some reason, * probably because of headers or something. Using * SXML or TXT instead of XML may help. * * Issues: * - Because of some PHP configurations deny to open * remote files with fopen(), I used file_get_contents() * but you still can switch to fopen(). See code for * more informations. * * Usage: * - See example.php * * Notes: * - If you study this code a little, you can see that * SXML is just a little wrapper around very few lines * of code. SimpleXML is really nice and simple way to * parse XML, but it has problems with special chars * entities. * - Even that this class is released under GPL licence, * I'm not responsible for anything that happens to you * (e.g. you die by reading these dull lines of text) * or your computer/website/whatever. * * Copyright 2007-2009, Daniel Tlach * * Licensed under GNU GPL * * @copyright Copyright 2007-2009, Daniel Tlach * @link http://www.danaketh.com * @version 2.1 * @license http://www.gnu.org/licenses/gpl.txt */ class Rss { private $parser; private $feed_url; private $item; private $tag; private $output; private $counter = 0; private $title = NULL; private $description = NULL; private $link = NULL; private $pubDate = NULL; // {{{ construct /** * Constructor * * @author Daniel Tlach <mail@danaketh.com> */ function __construct( ) { } // }}} // {{{ getFeed /** * Get RSS feed from given URL, parse it and return * as classic array. You can switch between XML * and SimpleXML method of reading. * * @author Daniel Tlach <mail@danaketh.com> * @access public * @param string $url Feed URL * @param constant $method Reading method */ public function getFeed($url, $method = 'XML') { $this->counter = 0; switch($method) { case 'TXT': return $this->txtParser($url); break; case 'SXML': return $this->sXmlParser($url); break; default: case 'XML': return $this->xmlParser($url); break; } } // }}} // {{{ sXmlParser /** * Parser for the SimpleXML way. * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param string $url Feed URL * @return array $feed Array of items */ private function sXmlParser($url) { $xml = simplexml_load_file($url); foreach($xml->channel->item as $item) { $this->output[$this->counter]['title'] = $item->title; $this->output[$this->counter]['description'] = $item->description; $this->output[$this->counter]['link'] = $item->link; $this->output[$this->counter]['date'] = $item->pubDate; $this->counter++; } return $this->output; } // }}} // {{{ xmlParser /** * Parser for the XML way. * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param string $url Feed URL * @return array $feed Array of items */ private function xmlParser($url) { $this->parser = xml_parser_create(); xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1); $this->feed_url = $url; xml_set_object($this->parser,&$this); xml_set_element_handler($this->parser, "xmlStartElement", "xmlEndElement"); xml_set_character_data_handler($this->parser, "xmlCharacterData"); $this->xmlOpenFeed(); return $this->output; } // }}} // {{{ txtParser /** * Parser for the Text way. * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param string $url Feed URL * @return array $feed Array of items */ private function txtParser($url) { //* Comment following lines $feed = file_get_contents($url); /*/ /* And uncomment these $feed = ''; $fh = fopen($url, 'r'); while(!feof($fh)) { $feed .= fread($fh, 4096); } // while */ $this->txtParseFeed($feed); return $this->output; } // }}} // {{{ xmlOpenFeed /** * Parser for the XML way. * I used file_get_contents() as a method to get * content of the feed, because I found that some * have denied opening remote files with fopen(). * Tho you still can try switch functions if you * like... * * @author Daniel Tlach <mail@danaketh.com> * @access private * @return void */ private function xmlOpenFeed() { //* Comment following lines $feed = file_get_contents($this->feed_url); xml_parse($this->parser, $feed, TRUE); /*/ /* And uncomment these $fh = fopen($this->feed_url, 'r'); while($feed = fread($fh, 4096)) { xml_parse($this->parser, $feed, feof($fh)); } // while */ xml_parser_free($this->parser); } // }}} // {{{ xmlStartElement /** * Item start * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param object $parser Parser reference * @param string $tag Tag * @return void */ private function xmlStartElement($parser, $tag) { if ($this->item === TRUE) { $this->tag = $tag; } else if ($tag === "ITEM") { $this->item = TRUE; } } // }}} // {{{ xmlCharacterElement /** * Item content * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param object $parser Parser reference * @param string $data Content data * @return void */ private function xmlCharacterData($parser, $data) { if ($this->item === TRUE) { // read the content tags switch ($this->tag) { case "TITLE": $this->title .= $data; break; case "DESCRIPTION": $this->description .= $data; break; case "LINK": $this->link .= $data; break; case "PUBDATE": $this->pubDate .= $data; break; } } } // }}} // {{{ xmlEndElement /** * Item end * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param object $parser Parser reference * @param string $tag Tag * @return void */ function xmlEndElement($parser, $tag) { if ($tag == 'ITEM') { $this->output[$this->counter]['title'] = trim($this->title); $this->output[$this->counter]['description'] = trim($this->description); $this->output[$this->counter]['link'] = trim($this->link); $this->output[$this->counter]['date'] = trim($this->pubDate); $this->counter++; $this->title = NULL; $this->description = NULL; $this->link = NULL; $this->pubDate = NULL; $this->item = FALSE; } } // }}} // {{{ txtParseFeed /** * Parse feed using regexp * * @author Daniel Tlach <mail@danaketh.com> * @access private * @param string $feed Feed string * @return void */ private function txtParseFeed($feed) { $feed = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $feed); $feed = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $feed); preg_match_all('|<item>(.*)</item>|U', $feed, $m); foreach($m[1] as $item) { preg_match('|<title>(.*)</title>|U', $item, $title); preg_match('|<link>(.*)</link>|U', $item, $link); preg_match('|<description>(.*)</description>|U', $item, $description); preg_match('|<pubDate>(.*)</pubDate>|U', $item, $pubdate); $this->output[$this->counter]['title'] = $title[1]; $this->output[$this->counter]['description'] = $description[1]; $this->output[$this->counter]['link'] = $link[1]; $this->output[$this->counter]['date'] = $pubdate[1]; $this->counter++; } } // }}} // {{{ destruct /** * Destructor * * @author Daniel Tlach <mail@danaketh.com> */ function __destruct() { } // }}} } ?></div> make a file called rssImportFunction.mdu, put it in the inc folder. Add the following code to the file CODE <?php Don't forget the configuration section in this file
//#########CONFIGURATION########################################################## //category to post the feed in. May be multiple, seperated by a ',' $category = ''; //author name $author = 'RSS FEED'; //Feed url $feed_url = ''; //Avatar url for feed author $avatar_url=''; //################################################################################ //#########DO NOT EDIT BELOW############################################################## require_once './inc/rssReader.php'; // include library $Rss = new Rss; // create object $feed = $Rss->getFeed($feed_url); $first_feed = false; $output = ''; $loaded_rss = file("./data/rss_update.db.php"); $all_db = file("./data/news.txt"); $news_file = fopen("./data/news.txt", "w"); rsort( $feed ); foreach($feed as $item) { $item[date] = strtotime($item[date]); if(!$first_feed) {$first_feed = $item[date];} if( $item[date] <= (int)$loaded_rss[0] ) continue; foreach($all_db as $news_line){ $news_arr = explode("|", $news_line); if($news_arr[0] == $item[date]){ $item[date]--; } } reset($all_db); $output .= "$item[date]|$author|$item[title]|$item[description]|<RSS>$item[link]|$avatar|$category||\n"; } $news_file = fopen("./data/news.txt", "w"); fwrite($news_file, $output ); foreach ($all_db as $line){ fwrite($news_file, "$line");} fclose($news_file); $fp = @fopen("./data/rss_update.db.php", "w"); @flock ($fp,2); @fwrite($fp, $first_feed); @flock ($fp,3); @fclose($fp); ?>
13 Jun 2009
Name: IE8 and Javascript problem
Author: Damoor CuteNews Compatibility: ALL CuteNews versions Description: Well, many will have noticed that in Internet Explorer 8 a whole new set of Javascript rules apply. We don't feel this is a bug on behalf of CuteNews but a fault in the IE8 browser. Meaning, many Javascript functions don't work anymore. For CN this has also it's consequences. The only "fix" at the moment is telling IE8 to use the IE7 Javascript rules. Even when you don't use CuteNews but do use Javascript on your site, it doesn't hurt to add this line of html code. Instructions: START EDIT: Seems the original images.mdu still won't work after that. It does work for the advanced image module made by FI-DD. END EDIT: So open images.mdu (even if you're using a hack), compact.skin.php, default.skin.php and simple.skin.php find all CODE <head> add below or after, and not just between the head tags if you think you're smarter. CODE <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> (even facebook uses this so it's bound to be good EDIT 2: It seems that inserting smilies doesn't work either in IE8 despite the above solution. A solution to this will be posted shortly. At this point the latest CN version is 1.4.6. As long as this is true, I suggest using UTF-8 CuteNews. It's a spin-off that is more secure and it contains a fix for these Javascript problems. in images.mdu (not hack) find CODE echo" and replace withMYRTE=window.opener.document.getElementById(area).contentWindow; window.opener.currentRTE=area; MYRTE.document.execCommand('InsertImage', false, '-my-temp-img-url-'); replacement = \"$config_http_script_dir/data/upimages/\" + selectedImage + \"\\\" alt=\\\"\" + alternativeText + \"\\\" border=\\\"\" + imageBorder + \"\\\" align=\\\"\" + imageAlign; MYRTE.document.body.innerHTML = MYRTE.document.body.innerHTML.replace(/-my-temp-img-url-/gi,replacement); "; CODE MYRTE=window.opener.document.getElementById(area).contentWindow; in addnews and editnews.mdu findwindow.opener.currentRTE=area; MYRTE.document.body.innerHTML += finalImage; CODE function preview(){ add aboveCODE function insert_smilie( ttarget, url, name ) { url = \"<img src='\"+url+\"' title='\"+name+\"' style='border:none;' />\"; insert_HTML( ttarget, url ); } function insert_HTML( ttarget, html ) { MYRTE=document.getElementById(ttarget).contentWindow; currentRTE=ttarget; MYRTE.document.body.innerHTML += html; } in functions.inc.php find CODE function insertSmilies($insert_location, $break_location = FALSE, $admincp = FALSE, $wysiwyg = FALSE) replace with{ global $config_http_script_dir, $config_smilies; $smilies = explode(",", $config_smilies); foreach($smilies as $smile) { $i++; $smile = trim($smile); if($admincp){ if($wysiwyg){ // $advanced_smile = "<img alt=\':$smile:\' src=\'data/emoticons/$smile.gif\' />"; // $output .= "<a href=# onclick=\"java script:InsertIntoArea('$insert_location','$advanced_smile'); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; $output .= "<a href=# onclick=\"document.getElementById('$insert_location').contentWindow.document.execCommand('InsertImage', false, '$config_http_script_dir/data/emoticons/$smile.gif'); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; } else{ $output .= "<a href=# onclick=\"java script:document.getElementById('$insert_location').value += ' :$smile:'; return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; } }else{ $output .= "<a href=\"java script:insertext(':$smile:','$insert_location')\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; } if($i%$break_location == 0 and $break_location) { $output .= "<br />"; }else{ $output .= " "; } } return $output; } CODE function insertSmilies($insert_location, $break_location = FALSE, $admincp = FALSE, $wysiwyg = FALSE) and make sure that in the above code the word javascript isn't split into 'java script'.
{ global $config_http_script_dir, $config_smilies; $smilies = explode(",", $config_smilies); foreach($smilies as $smile) { $i++; $smile = trim($smile); if($admincp){ if($wysiwyg){ // $advanced_smile = "<img alt=\':$smile:\' src=\'data/emoticons/$smile.gif\' />"; // $output .= "<a href=# onclick=\"java script:InsertIntoArea('$insert_location','$advanced_smile'); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; $output .= "<a href=# onclick=\"insert_smilie( '".$insert_location."', '".$config_http_script_dir."/data/emoticons/".$smile.".gif', '".$smile."' ); return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; } else{ $output .= "<a href=# onclick=\"java script:document.getElementById('$insert_location').value += ' :$smile:'; return false;\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; } }else{ $output .= "<a href=\"java script:insertext( ':".$smile.":', ':".$insert_location.":' );\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>"; }; if( isset($break_location) && (int)$break_location > 0 && $i%$break_location == 0 ) { $output .= "<br />"; }else{ $output .= " "; } } return $output; } |
Last Visitors
Comments
fern
any chance you can help me implement search friendly url's and captcha hack? ive tried over and over and im very frustrated 15 Dec 2009 - 2:32 |
|
Lo-Fi Version | Time is now: 25th May 2013 - 12:49 AM |