atmoner / php-pastebin-v3

Php pastebin tool
110 stars 56 forks source link

Disabling Guests/ #34

Open zerondar opened 10 years ago

zerondar commented 10 years ago

is there any way to disable guests from making pastes? (as max ° of lines 0 does not seem to stop them from pasting stuff)

and or an option that allows private pastes to be turned off

Thank you in advance.

JohnnyCrazy commented 10 years ago

There is a way, although it requires one code-change.

The File you need: /pages/main.php

Replace:

$hook->add_block('pasteForm', '', '',740,10); 
$hook->add_block('pasteOptions', '', '',740,11);  
$hook->add_block('pasteName', '', '',740,12);  

with

if($startUp->isLogged())
{
    $hook->add_block('pasteForm', '', '',740,10)
    $hook->add_block('pasteOptions', '', '',740,11);
    $hook->add_block('pasteName', '', '',740,12);
} 

Guests will see an empty page while logged-in Users will still be able to create pastes.

If you want to disable it completly (ignore POST-Request from incoming pastes), replace one more line

$startUp->addPaste($userId,$title,$_POST['syntax'],$_POST['paste'],$_POST['expiration'],$_POST['exposure']);

with

if($startup->isLogged())
{
    $startUp->addPaste($userId,$title,$_POST['syntax'],$_POST['paste'],$_POST['expiration'],$_POST['exposure']);
}