Turning "ask question" on and off

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

sallygreen100
Posts: 6
Joined: Sat Jan 07, 2006 10:14 am

Turning "ask question" on and off

Post by sallygreen100 » Wed Jan 11, 2006 11:10 pm

hi,

is there a way to turn the "ask question feature on and off?

regards,
sally.

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Thu Jan 12, 2006 7:42 am

Hi Sally,

sure. Just remove the link in index.tpl.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

sallygreen100
Posts: 6
Joined: Sat Jan 07, 2006 10:14 am

Post by sallygreen100 » Thu Jan 12, 2006 11:36 am

hi,

is there an easier way?

one where i can just click a link from the admin panel and questions can be stopped.

I can delete the link, but the people i am setting it up for a not technicle and wont understand what to do.

thank you.
sally.

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Thu Jan 12, 2006 12:27 pm

Hi,

no, there's no option for that in the admin panel. Sorry.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

BSOD2600
Posts: 36
Joined: Thu Nov 10, 2005 4:50 am
Location: USA

Post by BSOD2600 » Fri Jan 13, 2006 1:30 am

Why not add it as a feature in 1.5.6?
| phpmyfaq 1.6.3 |
| MySQL 4.1.18 | PHP 4.4.2 | Apache |

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Fri Jan 13, 2006 7:28 am

Hi,

this isn't as possible as it might be and there are no new features in 1.5.x.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

remove the link

Post by jazcyk » Sat Jan 28, 2006 12:09 am

Just removing the link won't do! I have been spammed after doing so. The PHP page is still available! I don't know if robots can track it or some people just know it is there!

Is there a function/routine/module that can be deleted/renamed/commented_out to COMPLETELY disable it? Or change something to display "GO PLAY SOMEWHERE ELSE" :)

I don't mean to say it is a big problem! But removing LINKS is not a proper way. FUNCTIONALITIES should be removed.

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Sat Jan 28, 2006 8:53 am

Hi,

okay, but this needs a big enhancement to our template engine to support blocks which ca be enabled or disabled.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

OK ..

Post by jazcyk » Sat Jan 28, 2006 9:03 am

As I wrote it is not a big problem. I have banned a few ip's and it stopped!

tmonaghan
Posts: 7
Joined: Sat Jan 28, 2006 1:06 pm

Post by tmonaghan » Sat Jan 28, 2006 1:07 pm

I'm being repeatedly spammed despite removing links to the ask questions part. Banning IP's doesn't work. How can I stop this from happening?

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Sat Jan 28, 2006 1:21 pm

Hi,

delete the file savequestion.php.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

jazcyk
Posts: 385
Joined: Wed Sep 07, 2005 1:32 pm

that was better

Post by jazcyk » Sun Jan 29, 2006 9:50 am

of course :)

bouton
Posts: 10
Joined: Thu Jan 19, 2006 3:13 pm

Post by bouton » Tue Feb 07, 2006 3:29 pm

I am a beginner too - and the spammers on ask question were driving me nuts

so with php book in hand i wrote a banned word function and did some tweaking

1. added to functions.php

function checkBannedWord($content)
{
require_once('inc/fileIterator.php'); //http://www.phpguru.org/

// Set the block counter

foreach (new FileIterator('inc/blockedWords.txt') as $line)
{
if (preg_match("/$content/i", $line)) {
return FALSE;
}
}
}


2 in savequestion.php i changed
A)
if (isset($_REQUEST["username"]) && $_REQUEST["username"] != '' && isset($_REQUEST["usermail"]) && checkEmail($_REQUEST["usermail"]) && isset($_REQUEST["content"]) && $_REQUEST["content"] != '' && IPCheck($_SERVER["REMOTE_ADDR"])) {

to

if (isset($_REQUEST["username"]) && $_REQUEST["username"] != '' && isset($_REQUEST["usermail"]) && checkEmail($_REQUEST["usermail"]) && isset($_REQUEST["content"]) && $_REQUEST["content"] != '' && checkBannedWord($_REQUEST["content"]) && IPCheck($_SERVER["REMOTE_ADDR"])) {

B) changed
if (checkEmail($usermail)) {

to
if (checkEmail($usermail)&& checkBannedWord($_REQUEST["content"])) {

C) changed


if (IPCheck($_SERVER["REMOTE_ADDR"]) == FALSE) {
$tpl->processTemplate ("writeContent", array(
"msgQuestion" => $PMF_LANG["msgQuestion"],
"Message" => $PMF_LANG["err_bannedIP"]
));
} else {
$tpl->processTemplate ("writeContent", array(
"msgQuestion" => $PMF_LANG["msgQuestion"],
"Message" => $PMF_LANG["err_SaveQuestion"]
));
}


to

if (IPCheck($_SERVER["REMOTE_ADDR"]) == FALSE) {
$tpl->processTemplate ("writeContent", array(
"msgQuestion" => $PMF_LANG["msgQuestion"],
"Message" => $PMF_LANG["err_bannedIP"]
));
} elseif (checkBannedWord($_REQUEST["content"]) == FALSE) {
$tpl->processTemplate ("writeContent", array(
"msgQuestion" => $PMF_LANG["msgQuestion"],
"Message" => $PMF_LANG["err_bannedWord"]
));
} else {
$tpl->processTemplate ("writeContent", array(
"msgQuestion" => $PMF_LANG["msgQuestion"],
"Message" => $PMF_LANG["err_SaveQuestion"]
));
}

3) and last added
$PMF_LANG["err_bannedWord"] = "Your content has been banned.";
to language_en.php

i got blocked words from the pmwiki cookbook blocklist2

bouton
Posts: 10
Joined: Thu Jan 19, 2006 3:13 pm

Post by bouton » Tue Feb 07, 2006 4:06 pm

oops
typo in function - add last lines

function checkBannedWord($content)
{
require_once('inc/fileIterator.php');

// Set the block counter

foreach (new FileIterator('inc/blockedWords.txt') as $line)
{
// gets the content as part of a whole if (preg_match("/$content/i", $line)) {
if (preg_match("/\b$content\b/i", $line)) {
return FALSE;
} else {
return true;
}
}
}

Thorsten
Posts: 15025
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten » Tue Feb 07, 2006 7:24 pm

Hi,

can I take your code under the terms of the MPL and add it into 1.6? If yes, please write me an e-mail and tell me your full name for your credits.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Post Reply