Changeset 917

Show
Ignore:
Timestamp:
12/10/05 13:05:46 (3 years ago)
Author:
hirokai
Message:

root accessor refactoring

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/feedmelinks/feedmelinks/admin/log.php

    r916 r917  
    3434        echo " $f lines in $l (recent-most entries are first) \n\n"; 
    3535        exec( "tail -n 50 $l " 
    36         . "| sed s:" . get_home_dir() . ":root: " 
    3736        . "| sed s:" . get_root() . ":root:" 
    3837        . "| sed s/-2005//" 
  • trunk/feedmelinks/feedmelinks/comments.php

    r916 r917  
    3636 
    3737<% 
    38         chdir( get_home_dir() ); 
     38        chdir( get_root() ); 
    3939        $cmd = "find _comments/$user -type f | xargs -n1 grep -H -v $user | sort -rk 2"; 
    4040        if( $debug ) 
     
    9696<% 
    9797        $c = 1; #counter 
    98         $the_dir = get_home_dir() . '/_comments/' . $user; 
     98        $the_dir = get_root() . '/_comments/' . $user; 
    9999        if( is_dir( $the_dir )) { 
    100100        chdir( $the_dir ); 
     
    148148 
    149149<% 
    150         chdir( get_home_dir() ); 
     150        chdir( get_root() ); 
    151151        $cmd = "find _comments/ -type f | sort -r | xargs -n1 grep -H $user, | grep -v comments/$user | sort -r -k 2"; 
    152152        if( $debug ) 
  • trunk/feedmelinks/feedmelinks/modules/utils.inc.php

    r916 r917  
    616616        ob_start(); 
    617617        if( func_get_arg( 0 )) {  
    618                 %><a href="<%= get_site() %>/contacts/">view all <%= get_ownoun() %> peeps' links</a><% 
     618                %><a href="<%= getSiteURL() %>/contacts/">view all <%= get_ownoun() %> peeps' links</a><% 
    619619        } else {  
    620                 %><a href="<%= get_site() %>/contacts/?summarize=1">view just the most recent link from each of <%= get_ownoun() %> peeps</a><% 
     620                %><a href="<%= getSiteURL() %>/contacts/?summarize=1">view just the most recent link from each of <%= get_ownoun() %> peeps</a><% 
    621621        } 
    622622        return ob_get_clean(); 
     
    721721} 
    722722 
    723 # DEPRECATED: function footer_cb() { #a href="%= get_site() %/contacts/links"view %= get_ownoun() % peeps' links/a return $s; } 
     723# DEPRECATED: function footer_cb() { #a href="%= getSiteURL() %/contacts/links"view %= get_ownoun() % peeps' links/a return $s; } 
    724724 
    725725function title_cb() { 
     
    873873function get_contact_link_driver( $user, $argVerbose ) { 
    874874        if( $user == get_user()) 
    875                 $r = "<img src=\"" . get_site() . "/img/mebay.gif\" />"; 
     875                $r = "<img src=\"" . getSiteURL() . "/img/mebay.gif\" />"; 
    876876        else { 
    877877                $inList = inList( $user, "contacts", get_cache() ) ; 
    878878                if( ! $inList ) { 
    879                         $r .= "<a href='" . get_site() . "/contacts/add?user=$user'>" 
    880                         . "<img src=\"" . get_site() . "/img/plus.gif\" alt=\"+\" border=\"0\" />" 
     879                        $r .= "<a href='" . getSiteURL() . "/contacts/add?user=$user'>" 
     880                        . "<img src=\"" . getSiteURL() . "/img/plus.gif\" alt=\"+\" border=\"0\" />" 
    881881                        . ($argVerbose ? " Add <b>$user</b> as " . get_ownoun() . " peep?</a> " : "</a>") 
    882882                        .  ($argVerbose ? " <a href='/contacts/ignore?user=$user'>Ignore <b>$user</b>?</a>" : "" ) 
     
    885885                        #$r = "<small>(<a href='/contacts/add?user=$user'>add to <b>" . get_ownoun() . " Peeps</b>?</a>)</small>"; 
    886886                } else { 
    887                         $r .= "<a href=\"" . get_site() . "/contacts/\">" 
    888                         . "<img src=\"" . get_site() . "/img/happy.png\" alt=\"*\" border=\"0\" class=\"icon\" align=\"middle\" /></a>" 
     887                        $r .= "<a href=\"" . getSiteURL() . "/contacts/\">" 
     888                        . "<img src=\"" . getSiteURL() . "/img/happy.png\" alt=\"*\" border=\"0\" class=\"icon\" align=\"middle\" /></a>" 
    889889                        . ($argVerbose ? " <b>$user</b> is your peep. " : "") 
    890890                        .  ($argVerbose ? " <a href='/contacts/remove?user=$user'>Remove <b>$user</b>?</a>" : "" ) 
     
    16801680                $exts = array( "gif", "jpg", "jpeg", "png" ); 
    16811681                foreach ($exts as $ext) { 
    1682                         $f =  get_home_dir() . "/usr/$u/profile.$ext"; 
     1682                        $f =  get_root() . "/usr/$u/profile.$ext"; 
    16831683                        if( is_file( $f )) { 
    16841684                                unlink( $f ); 
     
    16951695                $exts = array( "gif", "jpg", "jpeg", "png" ); 
    16961696                foreach ($exts as $ext) { 
    1697                         $f = get_home_dir() . "/usr/$u/profile.$ext"; 
     1697                        $f = get_root() . "/usr/$u/profile.$ext"; 
    16981698                        if( is_file( $f )) { 
    16991699%> 
     
    18481848                                                        echo "then, "; 
    18491849                                                        $d = formatTS( $date ); 
    1850                                                 echo "<a href='" . get_site() . "/~$user'>$user</a>, "  
     1850                                                echo "<a href='" . getSiteURL() . "/~$user'>$user</a>, "  
    18511851                                                . ($d != "today" && $d != "yesterday" ? " at " : "" )  
    18521852                                                .  $d . ", said:"; 
     
    27462746function getStealItLinkWithText( $id ) { 
    27472747        ob_start(); 
    2748 %><a href="/g/<%= $id %>"><img src="<%= get_site() %>/img/plus.gif" border="0" alt="+" /> Add to your Links?</a><% 
     2748%><a href="/g/<%= $id %>"><img src="<%= getSiteURL() %>/img/plus.gif" border="0" alt="+" /> Add to your Links?</a><% 
    27492749        return ob_get_clean(); 
    27502750} 
     
    27562756function getStealItLink( $id ) { 
    27572757        ob_start(); 
    2758 %><a title="Add to your links?" href="/g/<%= $id %>"><img src="<%= get_site() %>/img/plus.gif" border="0" alt="+" /></a><% 
     2758%><a title="Add to your links?" href="/g/<%= $id %>"><img src="<%= getSiteURL() %>/img/plus.gif" border="0" alt="+" /></a><% 
    27592759        return ob_get_clean(); 
    27602760        } 
     
    30323032$env = getFmlEnv(); 
    30333033 
    3034 function get_home_dir() { 
     3034function get_bin() { 
     3035        return get_root() . "/bin"; 
     3036
     3037$bin = get_bin(); 
     3038 
     3039function get_modules() { 
     3040        return $modules = get_root() . "/modules"; 
     3041
     3042$modules = get_modules(); 
     3043 
     3044function get_root() { 
    30353045        global $env; 
    30363046        if( $env == "powerbook" ) 
     
    30563066} 
    30573067 
    3058 function getSiteUrl() { 
    3059         global $env; 
    3060         if( $env == "powerbook" ) 
    3061                 return "http://localhost:8080"; 
    3062         else 
    3063                 return "http://feedmelinks.com"; 
    3064 
    3065  
    3066 function get_root() { 
    3067         if( $env == "powerbook" ) 
    3068                 $root = "/Users/erdnase/www/feedmelinks.com"; 
    3069         else 
    3070                 $root = "/usr/home/hirokai/feedmelinks.com"; 
    3071         return $root; 
    3072 
    3073  
    3074 function get_cookie_domain() { 
    3075         global $env; 
    3076         if( $env == "powerbook" ) 
    3077                 return ""; 
    3078         else 
    3079                 return ".feedmelinks.com"; 
    3080 
    3081  
    3082 function get_http_downloader() { 
    3083         global $env; 
    3084         if( $env == "powerbook" ) 
    3085                 return "/sw/bin/lynx"; 
    3086         else 
    3087                 return "/usr/local/bin/lynx"; 
    3088 
    3089  
    3090 function get_bin() { 
    3091         global $env; 
    3092         if( $env == "powerbook" ) 
    3093                 $bin = get_root() . "/bin"; 
    3094         else if( $env == "live" ) 
    3095                 $bin = "/usr/home/hirokai/feedmelinks.com/bin"; 
    3096 
    3097 $bin = get_bin(); 
    3098  
    3099 function get_modules() { 
    3100         global $env; 
    3101         if( $env == "powerbook" ) 
    3102                 $modules = get_root() . "/modules"; 
    3103         else 
    3104                 $modules = "/usr/home/hirokai/feedmelinks.com/modules"; 
    3105 
    3106 $modules = get_modules(); 
    3107  
    3108 function get_site() { 
     3068function getSiteURL() { 
    31093069        global $env; 
    31103070        global $site; 
     
    31153075        return $site; 
    31163076} 
    3117 $site = get_site(); 
     3077$site = getSiteURL(); 
     3078 
     3079function get_cookie_domain() { 
     3080        global $env; 
     3081        if( $env == "powerbook" ) 
     3082                return ""; 
     3083        else 
     3084                return ".feedmelinks.com"; 
     3085
     3086 
     3087function get_http_downloader() { 
     3088        global $env; 
     3089        if( $env == "powerbook" ) 
     3090                return "/sw/bin/lynx"; 
     3091        else 
     3092                return "/usr/local/bin/lynx"; 
     3093
    31183094 
    31193095# accessible so that any page can build links otf (note that QS is removed)