176

(5 replies, posted in Hacks & Tricks / FAQ)

yeah, another filter https://cutephp.com/forum/style_emoticons/default/smile.gif
this is the third i believe https://cutephp.com/forum/style_emoticons/default/wink.gif

Can you please reply to my last post?

i thought i had answered both of you with my previous post https://cutephp.com/forum/style_emoticons/default/smile.gif
changing that path would seem ok i think, altough i think that you could use this page caching also on the pages where you have CN include codes; And then you do need ./cutenews/data/comments.txt

like Newuser pointed out on line 7 you must change the path to comments.txt
the 2nd warning might be related to the first.

yes

180

(0 replies, posted in Hacks & Tricks / FAQ)

Name: Linked Categories
Author: FUNimations
CuteNews Compatibility: 1.4.5 - * (no incompatibility reported yet)
Description: Adds the category names from an article to your post and clickable. Once clicked, all short stories for the clicked category will be shown.
Instructions:
in shows.inc.php find all

$output = str_replace("{category}", catid2name($news_arr[6]), $output);


add below

$cat_url = array();
                        $art_cat_arr = explode(",", $news_arr[6]);
                        if(count($art_cat_arr)==1)
                            $output = str_replace("{category-url}", "[url=?cid=]".catid2name($news_arr[6])."[/url]", $output);
                        else
                        {
                            foreach($art_cat_arr as $thiscat)
                                    {    $cat_url[] = "[url=?cid=]".catid2name($thiscat)."[/url] ";}
                            $output = str_replace("{category-url}", implode(", ", $cat_url), $output);
                        }

this should work for the articles in a single category too. And in case you're wondering, you're making a new tag here that you must use in the templates.

with your CN include code use

if(isset($_GET['cid']))
$category = $_GET['cid'];
elseif(!isset($_REQUEST['subaction']))
$category = "ID THAT SHOULD SHOW BY DEFAULT"
if ($action == 'rename' and $image and $name){
    $dir = end(explode("/", $path));
    @rename($path.'/'.$image, $path.'/'.$name);
    @rename($path.'/thumbs/'.$image, $path.'/thumbs/'.$name);
    echo '<script type="text/javascript">self.location.href="'.$PHP_SELF.'?mod=images&folder='.($path == $static_path_image_upload ? '' : $dir).'&start_from='.$start_from.'";</script>';
}

i migth be missing something here, but where do you replace spaces?

If I upload the image with a space in the file name, everything seems to work fine.

hmm
strange, in any case i can't find code that does any checking or limiting on file names when renaming.
Just in case could you ask your host about this too.

something like
when submitting a string through a php form, the part of my string after a space seem to get missing and my file get's the wrong filename.
I'm curious about their answer on that matter.On the bright side, if it is some doing due to the hack
I tried on my cn aswell, and got the same problem. Still that doesn't mean it's the hack.

1) probably https://cutephp.com/forum/style_emoticons/default/tongue.gif
find

($member_db[1] != 1 and $action == "doimagedelete")


adn replace the  != 1 with

> 2


2) I'm surprised it can handle the space of the full image, but not the thumb...
But it's NEVER a good idea to have spaces in names or directories on your server.
For example, linux servers cannot handle spaces properly. Which i think would be the problem here as well. You have linux hosting. (if you need to chmodd, your on  linux )

I'm even surprised FI-DD didn't trim names of images.
As he does do this for his file upload hack

1) that's normal
2) it's possible the thumb isn't renamed?

CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: When listing all archives it might happen that the archives are'nt ordered by date. This happens when not using the auto-archive but when manually archiving.
Instructions:
in show_archives.php find

if(is_array($arch_arr)){
$arch_arr = array_reverse($arch_arr);

and replace with

if(is_array($arch_arr)){
rsort($arch_arr);
$arch_arr = array_reverse($arch_arr);

yep

<td>hspace</td>
<td><input type=text value='15' name=\"hSpace\" style=\"width:35\"> pixels</td>
</tr>
<tr>
<td>vspace</td>
<td><input type=text value='5' name=\"vSpace\" style=\"width:35\"> pixels</td>
</tr>

other then that i don't see any reason why it wouldn't work.
altough

finalImage = \" <img border=\\\"\"+ imageBorder +\"\\\" align=\\\"\"+ imageAlign +\"\\\" alt=\\\"\"+ alternativeText +\"\\\" src=\\\"$config_http_script_dir/data/upimages/\"+ selectedImage +\"\\\" hspace=\\\"\"+ hSpace +\"\\\" vspace=\\\"\"+ vSpace +\"\\\" >\";";

has a "; to much which should result in a error. So then i would think you've uploaded the modified images.mdu in a wrong place, or you used a wrong source. But seeing you say it gives no difference i'll let you be the judge of that.

188

(5 replies, posted in Hacks & Tricks / FAQ)

The topics in this forum are categorized and ordered with the following labels:
[BUG]: discussion about bugs and how to fix them
[EXPLOIT]: security issues that have been found, including code to fix these
[FAQ]: general questions and tricks/addons/new functions where no CuteNews files need to be edited.
[HACK]: tricks/addons/new functions where you need to edit some CuteNews files.
[SKIN]: change the look of your CuteNews Panel
[TOOL]: some tools related to the use of CuteNews
[TUTORIAL]: with aid of an example we'll guide you through important information on how to do something. (for example: use some cool javascript for the CN articles).
[WYSIWYG]: instructions on how to use other <acronym title='What You See Is What You Get'>WYSIWYG</acronym> editors than the default.

189

(1 replies, posted in Hacks & Tricks / FAQ)

**OTHER service in next post**
Name: Social bookmarks
Author: FUNimations
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Though there are numereous services for this, we'll use 1 as example. The needed info for other services should be the same as given for the example service. (AddToAny)
Instructions:
go to this site
Type: choose for the "Share/Save/Bookmark Widget" to share links to full stories. Or "Subscribe widget" to add the article to your rss news feed reader.
Button: well whatever you want.
Page Name: Name of your site if you like to do that.
Page url: add something like this

http://www.domain.com/index.php?subaction=showfull&id={news-id}&archive={archive-id}&start_from=&ucat={category-id}&

Then there are still some optional configuration settings i'm not going to discus.
Next click: "Get Button Code" and you'll get some code like

[url=h][img]http://static.addtoany.com/buttons/share_save_171_16.gif[/img][/url]<script type="text/javascript">a2a_linkname="MySite";a2a_linkurl="http://www.domain.com/index.php?subaction=showfull&id={news-id}&archive={archive-id}&start_from=&ucat={category-id}&";</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>

Now this part get's f*cked up in the generated code

linkurl=http%3A%2F%2Fwww.domain.com%2Findex.php%3Fsubaction%3Dshowfull%26id%3D%7Bnews-id%7D%26archive%3D%7Barchive-id%7D%26start_from%3D%26ucat%3D%7Bcategory-id%7D%26"

so make sure to rebuild the url like the one you had to insert in the form.

http%3A%2F%2Fwww.domain.com%2Findex.php%3F

this part is changed as it should but this for example

id%3D%7Bnews-id%7D%26

should be rebuild to contain the CuteNews template tags {}
-->

id%3D{news-id}%26

and well, you add it to your full story template. Do not try to add this to your short stories. But if you do want it in the short story (and this is untested!) put the last <script> tag on the page where you have your CN include code and not in the templates.

190

(3 replies, posted in HTML, CSS and Overall Look)

Change the color of the CuteNews links
like the read more links of your CuteNews articles
now take your average [link]read more[/link]
and put it inside <span>
like

<span class="full_link">[link]read more[/link]</span>


and then use some css as in

.full_link a
{
color:#0000ff;
}

meaning all <a> within the full_link span will be affected.

191

(3 replies, posted in HTML, CSS and Overall Look)

avatar: align left/right with text flowing next to the whole picture and not just 1 line.

Isn't all that hard. Just add the following line in your templates:

<div style="float: left;">{avatar}</div>

Obviously, you may want to replace "left" with "right".

This will give you

/////////////1ste line of text
//image   //2nd line of text
/////////////3th line of text
/////////////4th line of text
continuation of text right under the image

You can't have it centered if you're trying to do that.

192

(3 replies, posted in HTML, CSS and Overall Look)

1) this is mainly a CuteNews forum. You may pose questions about html, css here. But be aware you're very likely to get an answer like 'validate your site and fix the errors'. And make sure all your opened html mobile casino no deposit required tags have a closing tag. For this it might be useful to actually look at the source code as given by the browser.
Seeing this forum is also called 'css' we'll most likely give a solution that uses css. if you don't know what css is or how to use it:
link1 & link2

2) INDEX

* avatar: align left/right with text flowing next to the whole picture and not just 1 line.
* Change the color of the CuteNews links.
* Change the look and feel of the CuteNews articles on your site.
* How to use css with CuteNews.

CuteNews Compatibility: 1.4.5 - 1.4.7
Description: The category icons for articles inside multiple categories don't show. The code for showing icons was never updated when intoducing multiple categories.
Instructions:
in shows.inc.php find 2 times

if($cat_icon[$news_arr[6]] != ""){ $output = str_replace("{category-icon}", "<img style=\"border: none;\" alt=\"".$cat[$news_arr[6]]." icon\" src=\"".$cat_icon[$news_arr[6]]."\" />", $output); }
                        else{ $output = str_replace("{category-icon}", "", $output); }


and replace with

if($news_arr[6] == ""){ $output = str_replace("{category-icon}", "", $output); }

elseif($cat_icon[$news_arr[6]] != ""){ $output = str_replace("{category-icon}", "<img style=\"border: none;\" alt=\"".$cat[$news_arr[6]]." icon\" src=\"".$cat_icon[$news_arr[6]]."\" />", $output); }

else{ $icons = explode(",",$news_arr[6]);
$show_icons="";
for($counter = 0; $counter < sizeof($icons); $counter++){
if(strlen(trim($cat[$icons[$counter]])))
$show_icons = $show_icons."<img style=\"border: none;\" alt=\"".$cat[$icons[$counter]]." icon\" src=\"".$cat_icon[$icons[$counter]]."\" />";
}
$output = str_replace("{category-icon}", "$show_icons", $output);
}

194

(0 replies, posted in Hacks & Tricks / FAQ)

CuteNews Compatibility: 1.4.0 - * (no incompatibility reported yet)
Description:  You have setup your rss. You've choosen the correct charset for your feed. And you're happy that the feed finally shows;
Unfortunately the link to the full story doesn't work. Well this is what you could call a bug.
take your regular news and have a look at a "read more" link. Then you'll see all these parameters after the .php?
Now CN doesn't work unless all these parameters are in the link. (for some reason i haven't figured out)
Instructions:
So you'll have to edit your RSS template and add

&ucat={category-id}

before

</link>

error: Warning: main() [function.main]: URL file-access is disabled in the server configuration in /home/****/mydomain.com/index.php on line 170
Warning: main(http://****) [function.main]: failed to open stream: no suitable wrapper could be found in /home/.mardi/mydomain.com/index.php on line 170

solution: do as the readme.html says. And use a relative path instead of an absolute path.
In other words: DON'T put http://www.domain.com/ in your include.

Name: Saving additional data with my news.
Author: FUNimations
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: In this topic we'll discuss an alternative way to add new data other then the xfields which works great for adding stuff, but many people seem to have problems editing the stuff. This tutorial will mainly be about adding data to your news item.
Adding stuff to personal options or comments is a bit more difficult. This tutorial uses code from Cn 1.4.6. I'll explain how you do, not a copy and paste procedure. So for younger CN versions you will be able to use this tutorial.
Also be aware that this is for saving DATA and not (html) code or texts.
Instructions:

1) addnews.mdu
find

<td width=\"75\">
        Title
        <td width=\"575\" colspan=\"2\">
        <input type=text size=\"55\" name=\"title\" tabindex=1>
        </tr>


before the "; we'll add a new row for the new data. For example

<td width=\"75\">
        newdata
        <td width=\"575\" colspan=\"2\">
        <input type=text size=\"55\" name=\"newdata\">
        </tr>


of course you can use dropdowns here as well. But that's a hml related matter. There are many sites that give you html code for those web elements.
and next we'll have to save this new data.
so find

fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$nice_category||\n");


and add the new data like this

fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$nice_category|$newdata|\n");


notice how we add the NAME of the new input field with a $ in front of it.
And remember! $nice-category is slot #6 so your new data will start counting from there on forwards. $newdata being 7

To make the new data obligated find

$title       = replace_news("add", $title, TRUE, FALSE); // HTML in title is not allowed
if(trim($title) == "" or !$title){ msg("error","Error !!!","The title can not be blank.", "java script:history.go(-1)"); }


add under

$newdata       = replace_news("add",$newdata, TRUE, FALSE); // HTML in title is not allowed
if(trim($newdata) == "" or !$newdata){ msg("error","Error !!!","The newdata can not be blank.", "java script:history.go(-1)"); }


again ntice the $ in front of the name.

This is it. We have added a new data to news.tx

2) editnews.mdu
of course you'll also want to edit your new data so we'll need to add similar code to editnews.mdu
find

<tr>
        <td valign=middle width=\"75\" valign=\"top\">
        Title
        <td width=\"464\" colspan=\"3\">
        <input type=text name=title value=\"$item_db[2]\" size=55 tabindex=1>
    <td width=\"103\" valign=\"top\">
        </tr>

and we'll add a new row.

<tr>
        <td valign=middle width=\"75\" valign=\"top\">
        Title
        <td width=\"464\" colspan=\"3\">
        <input type=text name=newdata value=\"$item_db[7]\" size=55 tabindex=1>
    <td width=\"103\" valign=\"top\">
        </tr>

make sure you use the SAME name as addnews.mdu.
as value we give the 7th slot of $item_db. this number is the number i told you to remember earlier.
and next find

fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$nice_category||\n");

and just like in addnews we'll add $newdata to this line.

3) open massactions.mdu and find

fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$nice_category|||\n");


foreach new data you added, ad a $old_db_arr[#] to the line just like you did for addnews and editnews. ($nice_category is slot 6!)

4) shows.inc.php
final step, let's create a tag for this new data so we may use this data in the templates.
find the following 2 lines

$output = str_replace("{title}", $news_arr[2], $template_full);
$output = str_replace("{title}", $news_arr[2], $output);

and add under

$output = str_replace("{newdata}", $news_arr[7], $output);


again notice how we use the 7 (that number you needed to remember)

5)
all that is left is to try your new field out https://cutephp.com/forum/style_emoticons/default/smile.gif

Error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 163049 bytes) in /home/******/public_html/cutenews/inc/functions.inc.php on line 430

It means that your host has a limit on the resource you may use on the server. This to prevent you overloed the server. Be glad it's this error; In worst case your host has a max filesize restriction in effect and when exceeding that limit then, your txt file is emptied. In other words comments or/and news are deleted.

reason 1 This is due to excessive spam. in that case you'll see this message on your site and on your editnews page.
get spam protection (see spam protection topic), upload an empty comments.txt on your server and see the topic about comments in my signature so visitors may comment on older posts again as well.

reason 2 You have massive amounts of news and never made archives. In the best case scenario you'll see te error on your site and on your editnews page.
In the worst case it shows after adding a new article. Then you got a problem as all your news will be lost except for your latest article.
Now for the first scenario the only way to fix this is to make a manual archive. Meaning, not all news in 1 archive, but divide the news in at least 2 archives.

try
in images.mdu find all

'/data/upimages/'


and replace with

$static_path_image_upload

199

(2 replies, posted in Hacks & Tricks / FAQ)

Name: Disable Posting of Comments for individual News Articles
Author: Jetski
Updated by: FUNimations
CuteNews Compatibility: 1.4.5 - * (no incompatibility reported yet)
Description: Same hack but compatible for newer CuteNews versions. As this hack destroys your ability to save categories.
Requirements: this hack
Instructions:

install the original hack and then in addnews.mdu and editnews.mdu find

fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$category|$dis_comm||\n");

and

fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$category|$dis_comm||\n");

and replace $category with $nice_category

200

(2 replies, posted in Hacks & Tricks / FAQ)

Name: List categories
Author: unknown
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Add a list of categories on your site. Each category will link articles from that category.
Instructions:

make a file. Call it "list_cats.php" and put it in the CuteNews root directory.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?PHP
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Configurations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

// If it is set to FALSE, the categories wont be displayed
// after a visitor click some category to see the news from it
  $display_categories_when_showing_news = TRUE;
$display_news_under_list = TRUE;

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Main Part (Do not edit below)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$cutepath =  __FILE__;
$cutepath = preg_replace( "'\\\list_cats\.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats\.php'", "", $cutepath);

require_once("$cutepath/inc/functions.inc.php");

if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
    $cat_lines = file("$cutepath/data/category.db.php") or die("Can not open $cutepath/data/category.db.php");
    foreach($cat_lines as $cat_line){
        $cat_arr = explode("|", $cat_line);
        echo "[url=]{$cat_arr[1]}[/url]
";
    }
}
if(isset($_GET['show_cat']) && preg_match('/^[1-9]{1}[0-9]{0,}$/', $_GET['show_cat'] && $display_news_under_list)){
    $category = $show_cat;
    include("$cutepath/show_news.php");
}
?></div>
After making this file, add the following code so the list of categories may appear on your site

<?php
include( 'path_to_cutenews/list_cats.php' );
?>


now use the following code for your CN include code if you don't want a list of articles in  the chosen category to appear under the category list, but shown instead of regualr news.

if(isset($_GET['show_cat']) && preg_match('/^[1-9]{1}[0-9]{0,}$/', $_GET['show_cat']))
{
$category = $_GET['show_cat'];
}
elseif(!isset($request['subaction']))
$category = DEFAULT_CATEGORY_HERE;


and change the value from true to false.

$display_categories_when_showing_news = TRUE;

Posts found: 176 to 200 of 286

Pages Previous 1 6 7 8 9 10 11 12 Next

CutePHP Forums → Posts by FUNimations



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.