vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   vB Link System - integrated, categorized link directory with extras... (https://vborg.vbsupport.ru/showthread.php?t=49156)

Aaron1 03-02-2003 07:31 AM

Quote:

Originally posted by nicksaunders
This fixes that issue with folders not updating when links are edited or deleted.
Thanks for the update, but how in earth do i delete links?
I tried visible to invisible, but no luck sofar. Do i really need to use phpmyadmin to delete some links?

Nevertheless a very cool hack! :)
Thanks man!

Kars10 03-02-2003 07:37 AM

Quote:

Originally posted by Aaron1


Thanks for the update, but how in earth do i delete links?
I tried visible to invisible, but no luck sofar. Do i really need to use phpmyadmin to delete some links?

Nevertheless a very cool hack! :)
Thanks man!

No, you have a new checkbox (delete) in "edit links"! :)

Aaron1 03-02-2003 07:43 AM

You're right!
I never updated the admin/links.php!
Me stupid :)

N!ck 03-02-2003 07:57 PM

This nifty little addon will display "down" next to a link title if it is not working.

Credit goes to Slynderdale, he did all the hard work.

So, open links.php and find:

PHP Code:

require("./global.php"); 

Replace it with:

PHP Code:

require("./global.php");

// URL Status Checker by Slynderdale
// Integrated by Nick Saunders
function check_url($url) {
    
$status_array = array(
      
"N/A"=>"Ikke HTTP",
      
"OK"=>"Valid hostname",
      
"FEJL"=>"Invalid hostname",
      
"D?d"=>"No response",
      
"100"=>"Continue",
      
"101"=>"Switching Protocols",
      
"200"=>"OK",
      
"201"=>"Created",
      
"202"=>"Accepted",
      
"203"=>"Non-Authoritative Information",
      
"204"=>"No Content",
      
"205"=>"Reset Content",
      
"206"=>"Partial Content",
      
"300"=>"Multiple Choices",
      
"301"=>"Moved Permanently",
      
"302"=>"Found",
      
"303"=>"See Other",
      
"304"=>"Not Modified",
      
"305"=>"Use Proxy",
      
"307"=>"Temporary Redirect",
      
"400"=>"Bad Request",
      
"401"=>"Unauthorized",
      
"402"=>"Payment Required",
      
"403"=>"Forbidden",
      
"404"=>"Not Found",
      
"405"=>"Method Not Allowed",
      
"406"=>"Not Acceptable",
      
"407"=>"Proxy Authentication Required",
      
"408"=>"Request Timeout",
      
"409"=>"Conflict",
      
"410"=>"Gone",
      
"411"=>"Length Required",
      
"412"=>"Precondition Failed",
      
"413"=>"Request Entity Too Large",
      
"414"=>"Request-URI Too Long",
      
"415"=>"Unsupported Media Type",
      
"416"=>"Requested Range Not Satisfiable",
      
"417"=>"Expectation Failed",
      
"500"=>"Internal Server Error",
      
"501"=>"Not Implemented",
      
"502"=>"Bad Gateway",
      
"503"=>"Service Unavailable",
      
"504"=>"Gateway Timeout",
      
"505"=>"HTTP Version Not Supported"
    
);
    
$urlArray parse_url($url);
    if (!
$urlArray[port]) $urlArray[port] = "80";
    if (!
$urlArray[path]) $urlArray[path] = "/";
    
$sock = @fsockopen($urlArray[host], $urlArray[port], &$errnum, &$errstr10);
    if (!
$sock) {
      
$return[code] = "Dead";
    } else {
        
$dump .= "HEAD $urlArray[path] HTTP/1.1\r\n";
        
$dump .= "User-Agent: Link Checker\r\n";
        
$dump .= "Host: $urlArray[host]\r\nConnection: close\r\n";
        
$dump .= "Connection: close\r\n\r\n";
        @
fputs($sock$dump);
        while(
$str = @fgets($sock1024)) {
            if (
eregi("^http/[0-9]+.[0-9]+ ([0-9]{3}) [a-z ]*"$str)) {
              
$return[code] = trim(eregi_replace("^http/[0-9]+.[0-9]+ ([0-9]{3}) [a-z ]*""\\1"$str));
            }
            if (
eregi("^Content-Type: "$str)) $return[contentType] = trim(eregi_replace("^Content-Type: """$str));
        }
        @
fclose($sock);
        
flush();
    }
    
$return[status] = $status_array[$return[code]];
    return 
$return;
}
// End URL Status Checker 

Still in links.php, find:

PHP Code:

    $link[title]=stripslashes($link[title]);
    
$link[date]=vbdate("m-d-Y",$link[dateline]);
    
$link[time]=vbdate("h:i A",$link[dateline]); 

After this, add:
PHP Code:

    $linkstatus=check_url($link[url]);
    if (
$linkstatus[code]!="200") {
      
$link[status]="<highlight><i>(down)</i></highlight>";
    } else {
      
$link[status]="";
    } 

Now save and upload links.php. For the next step go into your admin cp and edit template "links_listbit". Find:

PHP Code:

$link[title]</a></normalfont><br

Replace it with:

PHP Code:

$link[title]</a></normalfont> <smallfont>&nbsp;$link[status]</smallfont><br

Voila! If you want to test it, just enter a fictitious link with an obviously defunct URL. The word "down" should appear next to the link.

This may not work with some server configurations. If it doesn't, contact your web hosting company.

VampireMan 03-02-2003 08:20 PM

My demo updated , down link added :-)

eek , it says all my links are down lol

Aaron1 03-04-2003 09:51 AM

I just have one small problem, the time on the main links folder page doesn't seem to update when a link is submitted?

Btw: I have modified the links page alot, i also removed the rating stuff column, because that causes to many pop-ups and it disturbes viewing the submitted site.

Take a look if you want, on how it looks and works on my site:
http://www.housequake.com/forum/links.php

N!ck 03-04-2003 08:52 PM

Make sure you're upped to 0.1.4. If you followed the instructions, there should be a link "Update Folders" in your left frame. Click that when you delete or move a link (unless it's old anyway) and the main links page will have the correct information.

N!ck 03-04-2003 08:55 PM

BTW, looks great! :)

VampireMan 03-04-2003 10:25 PM

I agree i like the layout & scheme of that site. I wish i was that good at stuff lol.

What's suprising is i like the site even though im not a prince fan :-)

Aaron1 03-05-2003 08:37 AM

Thanks for the compliments guys!
Although my knowledge on PHP is very slim :-)

But back to my problem, i still can't figure out what i did wrong, i checked every template and php file, and also made sure that i updated the folders in admin links.php, but nevertheless the problem still remains. What could i have overlooked?

The example URL at:
http://www.in-here.co.uk/forum/links.php?s=
(i took the liberty to add a test link there, sorry for that)
Seems to have the same problem. The latesttime on the main link folder page doesn't seem to update, however the date works fine i guess.

Besides from this this small problem, i think this hack is great!
Wouldn't it be even nicer if members from the board could comment it, just as if the link was a discussion topic? Well, i am just thinking out load :)


All times are GMT. The time now is 09:43 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01295 seconds
  • Memory Usage 1,791KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete