Changeset 438
- Timestamp:
- 11/07/04 00:19:23 (4 years ago)
- Files:
-
- trunk/feedmelinks/feedmelinks/_xsl/flickr.xsl (modified) (2 diffs)
- trunk/feedmelinks/feedmelinks/edit-folder.php (modified) (2 diffs)
- trunk/feedmelinks/feedmelinks/mailer.php (modified) (1 diff)
- trunk/feedmelinks/feedmelinks/modules/utils.inc.php (modified) (5 diffs)
- trunk/feedmelinks/feedmelinks/submit-link.php (modified) (1 diff)
- trunk/feedmelinks/feedmelinks/t.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/feedmelinks/feedmelinks/_xsl/flickr.xsl
r429 r438 11 11 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> 12 12 13 <xsl:template match="/rsp[@stat='ok']"> 13 <xsl:template match="/rsp[@stat='ok']"><!-- 14 14 15 15 embedded rest call: … … 19 19 <xsl:text> 20 20 </xsl:text> 21 21 --> 22 22 <xsl:value-of select="sizes/size[@label='Thumbnail']/@source" /></xsl:template> 23 23 trunk/feedmelinks/feedmelinks/edit-folder.php
r427 r438 97 97 $qs = "SELECT userid FROM linksGroups where ID = $id"; 98 98 $q = mysql_query( $qs ); 99 $numRows = mysql_num_rows($q); 99 if( $q ) 100 $numRows = mysql_num_rows($q); 100 101 if( $numRows ) { 101 102 $dbUserId = mysql_result($q,0,"userid"); 102 103 if( $dbUserId == $u ) { 103 $qs = "DELETE from linksGroups where ID = $id";104 $qs = getQuery( "delete_category", $id ); 104 105 $q = mysql_query( $qs ); 105 106 if( $q ) { … … 146 147 } else { echo "deleting " . getCatName() . " failed! sorry, i suk!"; } 147 148 } 149 } else { 150 echo "\$q was |$q|<br>"; 151 echo "DEBUG:<br>$qs<br>"; 152 echo "Sorry, can't find a group with ID #$id<br>"; 148 153 } 149 154 trunk/feedmelinks/feedmelinks/mailer.php
r427 r438 97 97 <% 98 98 } 99 } else {99 } 100 100 %> 101 101 102 103 <%104 }105 %>106 trunk/feedmelinks/feedmelinks/modules/utils.inc.php
r437 r438 97 97 } 98 98 99 # handler:100 function handGetAll($processor,$scheme,$rest) {101 $rest=substr($rest,1);102 switch($scheme) {103 case 'http':104 $uri = "http://".$rest;105 $ch = curl_init( $uri );106 curl_setopt($ch, CURLOPT_HEADER, 0);107 ob_start();108 curl_exec($ch);109 curl_close($ch);110 $c = ob_get_clean();111 return $c;112 }113 break;114 }115 116 99 function get_flickr_thumb( $argPhotoId ) { 117 # XML content :118 100 $key = "91640f92a17280b1953f02c0b79956bf"; 119 $xml='<' . '?' . 'xml version="1.0"?> 120 <page url="www.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=' . $key . '&photo_id=' . $argPhotoId . '">W3C Recommendation page</page>'; 121 122 # XSL content : 123 $xsl='<' . '?xml version="1.0"?> 124 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 125 <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/> 126 <xsl:template match="/"> 127 <xsl:value-of select="document(concat(\'http:\',page/@url))/rsp/sizes/size[@label=\'Thumbnail\']/@source"/> 128 </xsl:template> 129 </xsl:stylesheet>'; 130 131 $xh = xslt_create(); 132 xslt_set_scheme_handlers($xh,array("get_all" => "handGetAll")); 133 $out = xslt_process($xh,'arg:/_xml', 'arg:/_xsl',NULL,array("/_xml"=>$xml,"/_xsl"=>$xsl)); 134 xslt_free($xh); 135 return $out; 101 $url = 'www.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=' . $key . '&photo_id=' . $argPhotoId; 102 $lines = xform( "_xsl/flickr.xsl", "http://$url" ); 103 if( sizeof( $lines == 1 )) 104 return $lines[0]; 105 else 106 return "/img/spacer.gif"; 136 107 } 137 108 … … 484 455 } 485 456 457 function xform( $argXSL, $argXML ) { 458 $lines = array(); 459 $cmd = get_parser() . " $argXSL \"$argXML\""; 460 461 $debug = 0; 462 if( $debug ) 463 echo "<br>$cmd<br>"; 464 465 exec( "$cmd", $lines ); 466 467 if( $debug ) { 468 echo "\$cmd: $cmd<br>"; 469 print "there are " . sizeof( $lines ) . " lines"; 470 print_r( $lines ); 471 foreach ($lines as $line) { 472 echo "$line<br>"; 473 } 474 } 475 476 return $lines; 477 } 478 486 479 function get_xml_cachelist( $argCacheFile ) { 487 480 chdir( get_root() ); … … 502 495 503 496 if( is_file( $argCacheFile ) && is_readable( $argCacheFile ) && is_writeable( $argCacheFile )) { 504 $parser = xslt_create(); 505 $result = xslt_process($parser, $argCacheFile, get_root() . "/_xsl/mailtos.xsl" ); 506 xslt_free($parser); 507 if( $result ) { 508 $items = explode( "\n", $result ); 497 498 $debug = 0; 509 499 510 # need to clean out the junk: 500 $lines = xform( get_root() . "/_xsl/mailtos.xsl", $argCacheFile ); 501 502 if( $debug ) { 503 echo "\$cmd: $cmd<br>"; 504 print "there are " . sizeof( $lines ) . " lines"; 505 print_r( $lines ); 506 foreach ($lines as $line) { 507 echo "$line<br>"; 508 } 509 } 510 511 if( $lines ) { 511 512 $t = array(); 512 foreach ($ items as $item) {513 $ item = ltrim( rtrim( chop( $item)));514 if( $ item)515 array_push( $t, $ item);513 foreach ($lines as $line) { 514 $line = ltrim( rtrim( chop( $line ))); 515 if( $line ) 516 array_push( $t, $line ); 516 517 } 517 $ items = $t;518 return $ items;518 $lines = $t; 519 return $lines; 519 520 } 520 521 } else { … … 583 584 function get_last_mailto() { 584 585 $mailtos = get_cachelist( "mailtos" ); 585 $tmp = array_keys( $mailtos ); 586 return $tmp[0]; 586 if( sizeof( $mailtos )) { 587 $tmp = array_keys( $mailtos ); 588 return $tmp[0]; 589 } else { 590 ""; 591 } 587 592 } 588 593 … … 1220 1225 else 1221 1226 return "hirokai_jm3DataMart"; 1227 } 1228 1229 function get_parser() { 1230 global $env; 1231 if( $env == "powerbook" ) 1232 return "/sw/bin/xsltproc"; 1233 else 1234 return "/usr/local/bin/xsltproc"; 1222 1235 } 1223 1236 trunk/feedmelinks/feedmelinks/submit-link.php
r429 r438 99 99 if( $debug ) 100 100 echo "<br />"; 101 $qs = "INSERT INTO linksCategoriesXRef VALUES( $newLinkID, $catNum );";101 $qs = getQuery( "add_new_category_xref", $newLinkID, $catNum ); 102 102 if( $debug ) 103 103 echo "DEBUG: $qs<br />"; trunk/feedmelinks/feedmelinks/t.php
r395 r438 11 11 mysql_selectdb( getDBName() ); 12 12 13 $qs = "INSERT INTO linkMetrics (linkID, date, user, source ) VALUES ( $linkID, NULL, '$u', 'unused' );"; 14 #echo "$qs<br />"; 13 $qs = getQuery( "track_hit", $linkID, $u ); 15 14 16 15 $q = mysql_query( $qs ); 17 16 conClose( $con_t); 18 #echo "q: $q\n";19 17 20 18 header("Location: " . urldecode( getURLForLink( $linkID )) ); 21 22 19 %> 23 20