Guests can add news

Download plugins, language packs and stuff.

Postby flesh » Thu Jan 25, 2007 6:43 pm

FI-DD wrote:
flesh wrote:It is included but when I press submit story - it loads the same page :roll:


You said in your first post that it is working when you open guest.php directly. So you have to do it this way because including guest.php is not working for you.



Btw, I just tested it and including guest.php is working for me.


I did it with frames ...

in spite of my problems with including it - the script is great :D Sorry for troubles
flesh
 
Posts: 103
Joined: Sat Mar 04, 2006 3:51 pm
Location: Poland

Postby scottdallas » Fri Jan 26, 2007 8:41 pm

Well this is weird. When users submit stories to www.itsgamertime.com using guest can add news hack they go unapproved but still show up in my news on index.php... obviously the people submitting dont always submit with proper credentials and I like to modify before posting it live. If too many people realize they can post for free on my site they're going to ruin it. Any idea why they are getting included even though they aren't approved yet?
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby flesh » Fri Jan 26, 2007 9:29 pm

scottdallas wrote:Well this is weird. When users submit stories to www.itsgamertime.com using guest can add news hack they go unapproved but still show up in my news on index.php... obviously the people submitting dont always submit with proper credentials and I like to modify before posting it live. If too many people realize they can post for free on my site they're going to ruin it. Any idea why they are getting included even though they aren't approved yet?


FI-DD explained it ... only you can see them because you are logged in ... try to logout and if the new submitted(unapproved) news are showed - then you've got a problem - elseif the things are just on their right places ! :wink:
flesh
 
Posts: 103
Joined: Sat Mar 04, 2006 3:51 pm
Location: Poland

Postby scottdallas » Sat Jan 27, 2007 3:44 am

OH! Maybe that's it! Something to do with having head.php included at the very top of the page I bet. Well, thanks.. I never thought of that.



Well.. I tested it and you're right. Man I was scared for a minute. That makes me feel so much better.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby scottdallas » Thu Feb 01, 2007 3:22 pm

Code: Select all
     echo "Thank you for submitting your story.<br />";

     echo "The admin will publish it after approval.";




If I have it set so guest can add news without approval.. how can I change this to do something more like:



Code: Select all
     echo "Thank you for submitting your story.<br />";

     echo "<a href=url-to-post.html>Click here to view your post.</a>";




?
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Fri Feb 02, 2007 12:12 am

Try this:

Code: Select all
echo "Thank you for submitting your story.<br />";

$link = reset($sql->select(array('table' => 'news', 'where' => array("id = ".$id))));

echo '<a href="'.cute_get_link($link).'">Click here to view your post.</a>';




(Not tested.)
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Fri Feb 02, 2007 1:06 am

Yeah, no way I would have ever figured that out. Thanks man I haven't tested it either but I will very soon.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby scottdallas » Wed Mar 07, 2007 1:27 am

It seems that all my admin panels after some time have the inevitability of blanking out. I don't mind adding and editing content with this hack and phpmyadmin however..



How can I turn the category drop down into the check box list? I have no easy way to add to multiple categories when my admin panel blanks out :(
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Wed Mar 07, 2007 3:59 pm

Change this:

Code: Select all
get_categories($config_categories)




to this:

Code: Select all
category_get_tree('&nbsp;', '<label for="cat{id}"><input type="checkbox" [php]multicats({id})[/php] name="cat[{id}]" id="cat{id}")">&nbsp;{name}</label><br />')
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Wed Mar 07, 2007 5:16 pm

That makes no category list show :(
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Wed Mar 07, 2007 6:03 pm

It surely does. I tested it. :)



It's this part in guest.php:

echo '<tr><td>Category:</td><td>'.get_categories($config_categories).'</td></tr>';
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Wed Mar 07, 2007 8:15 pm

Maybe it has something to do with some of my guest.php modifications (there weren't many though):



Code: Select all
<script type="text/javascript" src="skins/cute.js"></script>

<?php

//Installation:

//Open inc/show.news.php and change this:

//$output = str_replace('{author}', $user_name[$row['author']], $output);

//to this:

//$output = str_replace('{author}', $row['author'], $output);



//Config maximum unapproved

$max_unapproved = 50;

///////////////////////////

//Config XFields

$show_xfields = true;

///////////////////////////

//Config categories

$config_categories = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20';

///////////////////////////

//Config captcha

$use_captcha = false; //true or false

$path_to_captcha = './plugins/captcha/';



if($use_captcha){

   @include $path_to_captcha.'php-captcha.inc.php';

}



?>

<link rel="stylesheet" type="text/css" href="skins/default.css">

<script type="text/javascript">

function check_fields(){

   if (document.guest.short_story.value == ""){

     document.guest.short_story.focus();

     alert ("The short story can't be blank.");

     return false;

   }

   return true;

}

</script>

<?

include 'head.php';



if($_POST['dosend'] == "yes"){



   $unapproved = count($sql->select(array('table' => 'news', 'where' => array('hidden = 1'))));

   if($unapproved > $max_unapproved) echo "Sorry, we have enough unapproved stories.";

   if ($use_captcha and !PhpCaptcha::Validate($_POST['code'])) {

      echo("<div style=\"text-align: center;\">Please enter the numbers from the image.<br /><a href=\"javascript:history.go(-1)\">go back</a></div>");

   }

   else{



     $added_time = (time() + $config_date_adjust * 60);



     if (!$title){

       $title = substr($short_story, 0, 10).'...';

     }



     $id = $sql->last_insert_id('news', '', 'id') + 1;

     $xfields = new XfieldsData();

          $xfields->set($_POST['meta_keywords'], $id, 'meta_keywords');

          $xfields->set($_POST['meta_description'], $id, 'meta_description');

          $xfields->save();



     if ($cat){

       foreach ($cat as $k => $v){

         $category_tmp[] = $k;

       }

       $category = join(',', $category_tmp);

     }

      

     $sql->insert(array(

     'table'    => 'news',

     'values' => array(

         'date'      => $added_time,

         'author'   => ($_POST['name'] ? $_POST['name'] : 'guest'),

         'title'       => replace_news('add', $title),

         'short'       => strlen(replace_news('add', $short_story)),

         'full'      => strlen(replace_news('add', $full_story)),

         'avatar'   => $avatar,

         'category' => $category,

         'url'      => namespace(totranslit($title)),

         'hidden'   => '0'

         )

     ));



     $sql->insert(array(

     'table'    => 'story',

     'values' => array(

         'post_id' => $id,

         'short'      => replace_news('add', $short_story),

         'full'      => replace_news('add', $full_story)

         )

     ));

      

     if($show_xfields){

       call_xfields_Save();

     }

   

     echo "Stored successfully.<br />";

     echo "<a href=submit.php>Click here to add another.</a>";

   }

}



else{

?>

<form action="" name="guest" method="post" onsubmit="return check_fields()">

<table>

<tr><td>Author:</td><td><input size="20" type="text" name="name"></td></tr>

<tr><td>Avatar:</td><td>

<fieldset id="avatar">

<input onchange="showpreview(this.value, 'previewimage')" tabindex="2" type="text" name="avatar" value="">

<img name="previewimage" src="skins/images/blank.gif" align="left" style="margin: 5px;">

</fieldset></td></tr>

<tr><td>Title:</td><td><input size="60" type="text" name="title"></td></tr>

<?

     echo '<tr><td>Category:</td><td>'.category_get_tree('&nbsp;', '<label for="cat{id}"><input type="checkbox" [php]multicats({id})[/php] name="cat[{id}]" id="cat{id}")">&nbsp;{name}</label><br />').'</td></tr>';

?>

<tr><td>Short story:</td><td><textarea rows=8 name="short_story"></textarea></td></tr>

<tr><td>Full story:</td><td><textarea rows=6 name="full_story"></textarea></td></tr>

<tr><td>Meta Keywords:</td><td><textarea name="meta_keywords"></textarea></td></tr>

<tr><td>Meta Description:</td><td><textarea name="meta_description"></textarea></td></tr>

<?

if($show_xfields){

   echo "<tr><td>XFields:</td><td>";

   echo admins_xfields();

   echo "</td></tr>";

}

if($use_captcha){

?>

<tr><td>Enter this code in the field below.<br /><img src="<?=$path_to_captcha; ?>/captcha.php?width=144" width="144" alt="Security Image"/><br /><input type="text" size="10" name="code" maxlength="6" />

<?

}

?>

<tr><td align="center" colspan="2"><input type="submit" value="Submit story"></td></tr>

<input type="hidden" name="dosend" value="yes">

</table>

</form>

<?

}



function get_categories($selection){

global $sql;



$category = '<select name="category">';



foreach($single_cats = explode(",", $selection) as $id){



   foreach ($sql->select(array('table' => 'categories', 'where' => array("id = $id"))) as $row){

     $category .= '<option value="'.$id.'">'.$row['name'].'</option>';

   }

}



$category .= '</select>';



return $category;

}



?>
Last edited by scottdallas on Wed Mar 07, 2007 10:33 pm, edited 1 time in total.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Wed Mar 07, 2007 8:38 pm

User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby scottdallas » Wed Mar 07, 2007 9:45 pm

Woah.. weird. :shock:
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby scottdallas » Tue Mar 13, 2007 4:56 pm

Well you're right.. I tried it on another site and it worked. Just doesn't seem to want to work on http://www.scottdizzle.com oh well I don't need it on that.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

PreviousNext

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests