[ Video Sharing CMS v4 ] Changing login link in header and removing links from comments

Started by Digipath14,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Digipath14Topic starter

If anyone knows where to point me before I pay for coding, I would appreciate it. I can modify fine but cannot write code as far as experience goes. Here are my problems I need to fix:

Email verification - I have signed up myself to test becoming a new members and there was no notice to be verified by email. This helps stop spam/fake accounts to some extent.

Allowing no linking (users) - This one could lead to a shit-ton of fake spammer accounts being created in auto programs like Ultimate Demon and GSA in order to pass link juice. I went in as a user from an account I created and uploaded a video. I then placed coding in the video text description for a link which could have easily been a do-follow link. I need a way to not allow html codes (hyperlinks, etc) in the video description text.

Hover notice for hidden menu - When a visitor is on a page, if they want to join, it's hard to see where at first. You have to click on the "Visitor" avatar at the top to show the hidden menu drop down. It would be nice if when you where hovering it showed a notice about this hidden menu with a call-to-action. Also when you are logged in, same goes here with your avatar. There is the hidden menu to upload, etc.

Any help or suggestions are appreciated. - Charles
  •  

TheBritain

I think email verification is a very needed feature, it stops people from making shell accounts using other people's emails.
  •  

ollipaust

first before spending unnecessary money for a programmer who will scam you anyways,
wait for the 3.7 update. you can make a suggestion for the buildlist. im pretty sure a lot of people
already asked for email verification/notice or so.

Quote from: Digipath14 on
Hover notice for hidden menu - When a visitor is on a page, if they want to join, it's hard to see where at first. You have to click on the "Visitor" avatar at the top to show the hidden menu drop down. It would be nice if when you where hovering it showed a notice about this hidden menu with a call-to-action. Also when you are logged in, same goes here with your avatar. There is the hidden menu to upload, etc.

people who will visit your site should now how a website works. unless the visitor is not a full-retard,
he will click on that "Visitor-link" and notice that something has popped up and will recognize that thats the login.

personally it would be much more disturbing for me, if that hidden menu pops up each time i hover it.

otherwise if you still plan on changing it, you can find it in tpl.globals.php @ line 130 and in vibe.style.css
  •  

Digipath14Topic starter

  •  

Digipath14Topic starter

Actually, my main concern was the links being put into the video description text. I have a website and the automated account creation (and verify) happens multiple times daily and then they blast a ton of articles on it spun with links in it (it gets held and eventually deleted before posting). I really feel I need to not allow links. I know youtube allows it but they cancel accounts or pull the videos that has this type of activity. I'm just one guy.
  •  

PHPVibe A.

In practice I don't have this, and links in video description are not clickable for this reason.
Read this very fast, will come back to read in detail.

Digipath14Topic starter

Here is an example http://www.kiteobsession.net/video/1666/trick-kite-flying-at-coyote-hills/. Someone uploaded to show linking (its the youtube link for the example). They could have put 100 links to pharmaceutical diet pills, gambling and porn, etc. I also need to post in the suggestions section that if you select a standard strong password with characters like [98Fd3%$##%#], it will just refresh and says you don't have the right password. So if you select this, you can never get in. They don't know why. If it does not allow characters, it should tell you.
  •  

PHPVibe A.

You're sure that's not blocked by your firewall/mod_security?

Digipath14Topic starter

I'm saying, I guess I will need to pay to have this modded so that no links will be permissible when a user is posting a video. I can't allow hyperlinks in the video descriptions. I wish the script had the option of allowing or disallowing this feature.
  •  

TheBritain

#9
I am not aware of you ability to code, but this is a simple mode that you can hook the comment function with. I swiped this from stack overflow:

$pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i";
$replacement = "";
preg_replace($pattern, $replacement, $string);


I will find the exact lines you need to mod in a bit.

To the mods:

You could just put an option check, and then it could switch between this and the regular. So people could just choose to have links enabled or not.
  •  

Digipath14Topic starter

Quote from: TheBritain on
I am not aware of you ability to code, but this is a simple mode that you can hook the comment function with. I swiped this from stack overflow:

$pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i";
$replacement = "";
preg_replace($pattern, $replacement, $string);


I will find the exact lines you need to mod in a bit.

To the mods:

You could just put an option check, and then it could switch between this and the regular. So people could just choose to have links enabled or not.

Thanks @TheBritain. Gave a +1 to you. Would love to put this in once I find where.
  •  

TheBritain

Alright.

1. Go to yoursite.com/moderator
2. Click 'Tools'
3. Click 'Options Api'
4. In 'Option name' enter 'allow-post-link' without the quotes.
5. In 'Option value' enter '0' without the quotes.
6. Click 'Add option'
7. Open '/lib/ajax/addComment.php'
8. Find these lines.

<?php  require_once('../../load.php');
if (is_user( )) {


9. Modify to look like this.

<?php  require_once('../../load.php');
if (is_user( )) {
	$_post = $db->get_row("select * from ".DB_PREFIX."posts where pid = '".$pid."'");
	$pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i";
	$replacement = "";


10. Find these lines:

$it = "INSERT INTO ".DB_PREFIX."em_comments(`object_id`, `created`, `sender_id`, `comment_text`, `access_key`) VALUES ('".$obj_id."', '".date("F j, Y, g:i a",time())."', '".$info_user."', '".$com_body."', '".md5(uniqid())."')";


11. Modify to look like this:

if(get_option('allow-post-link') == 1) {
		$it = "INSERT INTO ".DB_PREFIX."em_comments(`object_id`, `created`, `sender_id`, `comment_text`, `access_key`) VALUES ('".$obj_id."', '".date("F j, Y, g:i a",time())."', '".$info_user."', '".$com_body."', '".md5(uniqid())."')";
	} else {
		$it = "INSERT INTO ".DB_PREFIX."em_comments(`object_id`, `created`, `sender_id`, `comment_text`, `access_key`) VALUES ('".$obj_id."', '".date("F j, Y, g:i a",time())."', '".$info_user."', '".preg_replace($pattern, $replacement, $com_body)."', '".md5(uniqid())."')";
	}


12. Find these lines:

'id'    => $commentID,
'text'  => stripslashes($com_body),
'name'  => stripslashes(user_name()),


13. Replace with:

'id'    => $commentID,
'text'  => stripslashes(preg_replace($pattern, $replacement, $com_body)),
'name'  => stripslashes(user_name()),


This is the full modified vanilla code to /lib/ajax/addComment.php:

<?php  require_once('../../load.php');
if (is_user( )) {
	$_post = $db->get_row("select * from ".DB_PREFIX."posts where pid = '".$pid."'");
	$pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i";
	$replacement = "";

    $info_user = user_id( );
	
    if($_REQUEST['comment'] == _lang('enterComment')){
        unset($_REQUEST['comment']);
    }

    if($_REQUEST['comment']) {
	
	$com_body = toDb($_REQUEST['comment']);
	$obj_id = toDb($_REQUEST['object_id']);
	
	if(get_option('allow-post-link') == 1) {
		$it = "INSERT INTO ".DB_PREFIX."em_comments(`object_id`, `created`, `sender_id`, `comment_text`, `access_key`) VALUES ('".$obj_id."', '".date("F j, Y, g:i a",time())."', '".$info_user."', '".$com_body."', '".md5(uniqid())."')";
	} else {
		$it = "INSERT INTO ".DB_PREFIX."em_comments(`object_id`, `created`, `sender_id`, `comment_text`, `access_key`) VALUES ('".$obj_id."', '".date("F j, Y, g:i a",time())."', '".$info_user."', '".preg_replace($pattern, $replacement, $com_body)."', '".md5(uniqid())."')";
	}
	
     	$addit = $db->query($it);
		$commentID  = $db->insert_id;
         add_activity('6', toDb(str_replace('video_','',$obj_id)));
      
        // /finished insert
        
        
        
         //send reply to browser
        //header('Content-type: application/x-json');
		
        echo json_encode(array(
                                'id'    => $commentID,
								'text'  => stripslashes(preg_replace($pattern, $replacement, $com_body)),
                                'name'  => stripslashes(user_name()), 
                                'url'  => my_profile(),								
                                'image' => user_avatar(),
                                'date'  => time_ago(date("F j, Y, g:i a",time())),                              
                                'like'  => '<a href="javascript:iLikeThisComment('.$commentID.')">'._lang("ilike").'</a>'
                                ));
    }
} else {
 echo json_encode(array(
                                'id'    => 0,
                                'text'  => _lang('Register First'),
                                'name'  => _lang('Error'),
                                'mail'  => '',
                                'image' => '',
                                'date'  => '',
                                'total' => '',
                                'like'  => ''
                                ));
}

	?>
  •  

TheBritain

  •  

TheBritain

Also, always save your pre-modified scripts as .bak offsite (never save a .bak on the actual host). You never know when someone on some forums is giving you wonky code.
  •  

TheBritain

As for the 'Visitor' login notification problem, there is actually a very, very, simple solution to that.

Go to '/tpl/main/tpl.globals.php'

Find this line:

<span class="username">'._lang("Visitor").'</span>		<img src="'.thumb_fix("uploads/def-avatar.jpg", true, 25, 25).'" alt="">


Change to this:

<span class="username">'._lang("Login").'</span>		<img src="'.thumb_fix("uploads/def-avatar.jpg", true, 25, 25).'" alt="">


Ta-Da, now they see a 'Login' button.
  •  

TheBritain

Quote from: TheBritain on
As for the 'Visitor' login notification problem, there is actually a very, very, simple solution to that.

Go to '/tpl/main/tpl.globals.php'

Find this line:

<span class="username">'._lang("Visitor").'</span>		<img src="'.thumb_fix("uploads/def-avatar.jpg", true, 25, 25).'" alt="">


Change to this:

<span class="username">'._lang("Login").'</span>		<img src="'.thumb_fix("uploads/def-avatar.jpg", true, 25, 25).'" alt="">


Ta-Da, now they see a 'Login' button.

To the mods:
- I suggest changing the title of this thread, so related searches will end up here.
  •  

Digipath14Topic starter

Quote from: TheBritain on
To the mods:
- I suggest changing the title of this thread, so related searches will end up here.
This is amazing stuff @TheBritain. I'm going over all this now
  •  

PHPVibe A.

Quote from: TheBritain on
To the mods:
- I suggest changing the title of this thread, so related searches will end up here.

Done! Thanks alot for helping around!

Digipath14Topic starter

Quote from: TheBritain on
Here is a test.

Before:


After:

Hi TheBritain, I couldn't get this to work. I added the code but it still showed the link. I'm not sure what happened. I did have to make the Options API "allow-post-links" adding the "s" because I added the "allow-post-link" but forgot to enter value "0". I couldn't remove it, so just changed it to "allow-post-links" with the "s" there and in the code on addComment.php. Anyway, here is my post. http://www.kiteobsession.net/video/2018/trick-kite-flying-at-coyote-hills-mp4/. It added the link. I must have done something wrong.
  •  

PHPVibe A.


Digipath14Topic starter

Quote from: Alexander on
Did you clear cache to refresh options in front-end?
Yes. I just cleared again, made a new user, uploaded and placed link. I'm not sure what went wrong. The links are showing up. http://www.kiteobsession.net/video/2019/cabrinha-kitesurf-pro-maui-2013-day-4-mp4/ --
  •  

PHPVibe A.

The Britain did you check that reqex?

Just do this in /lib/ajax/addComment.php:


$com_body = toDb(strip_tags($_REQUEST['comment']));



Digipath14Topic starter

Quote from: Alexander on
The Britain did you check that reqex?

Just do this in /lib/ajax/addComment.php:


$com_body = toDb(strip_tags($_REQUEST['comment']));

Hi, I tried altering that code and it did not work (see here - http://www.canningvideo.com/video/28/whatever/). Any suggestions?
  •  

PHPVibe A.

This is set to remove them when inserted, won't affect old ones.
If you want to affect old ones, open lib/comments.php and apply it to
_html($comment->comment_text)


also.

Digipath14Topic starter

Quote from: Alexander on
This is set to remove them when inserted, won't affect old ones.
If you want to affect old ones, open lib/comments.php and apply it to
_html($comment->comment_text)


also.
It was a new (after cleared cache) comment with link. I also tried adding the code posted here to strip out old comments as well bu the links were still there. I've given up on this for now. I closed all new users until I can get this 'no link' situation worked out. Thanks for all your help.
  •  

Similar topics (7)