Changeset 1336
- Timestamp:
- 02/16/07 22:37:19 (2 years ago)
- Files:
-
- feedmelinks/action.php (modified) (1 diff)
- feedmelinks/edit-folder.php (modified) (1 diff)
- feedmelinks/import/present-clean-pre-flight-input.inc.php (modified) (4 diffs)
- feedmelinks/import/processing.php (modified) (4 diffs)
- feedmelinks/modules/main-controller.inc.php (modified) (2 diffs)
- feedmelinks/modules/utils.inc.php (modified) (7 diffs)
- feedmelinks/recent-kompact.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
feedmelinks/action.php
r1334 r1336 169 169 $valuesClause = "$valuesClause($link, $tag) "; 170 170 $c++; 171 $qs = "INSERT INTO links_tags_xref VALUES($link, $tag);";171 $qs = getQuery( "add_new_category_xref", $link, $tag ); 172 172 $q = mysql_query( $qs ); 173 173 if( ! $q ) { feedmelinks/edit-folder.php
r1334 r1336 167 167 } 168 168 169 $folderId = addFolder( urlencode( $name ), $u );169 $folderId = addFolder( $name, $u ); 170 170 if( $debug ) 171 171 echo "\$folderId: $folderId<br/>"; feedmelinks/import/present-clean-pre-flight-input.inc.php
r1177 r1336 19 19 new tags to be created: 20 20 </div> 21 < form name="tags">21 <div> 22 22 <% 23 23 for( $i = 0; $i < $ts; $i++ ) { 24 24 $line = rtrim( $tags[$i] ); 25 if( ! $line ) 26 continue; 25 27 if( substr( $line, 0, 2 ) == "X " ) { 26 28 $tag = preg_replace( "/^X /", "", $line ); 27 echo row_wrap( " <span class='subtle'>Ignoring duplicate tag $tag</span>", ($i % 2 == 0) ? 1 : 0 ) ;29 echo row_wrap( " <span class='subtle'>Ignoring duplicate tag $tag</span>", ($i % 2 == 0) ? 1 : 0 ) . "\n"; 28 30 } else { 29 31 ++$num_tags; 30 echo row_wrap( " <span class='hot'> <label><!-- input type='checkbox' checked='checked' name='tag' value='$line' /-->Create tag: </label> $line</span>", ($i % 2 == 0) ? 1 : 0 );32 echo row_wrap( " <span class='hot'>Create tag: $line</span>", ($i % 2 == 0) ? 1 : 0 ) . "\n"; 31 33 } 32 34 echo "</div>\n"; 33 35 } 34 36 %> 35 </form>37 </div> 36 38 </div> 37 39 … … 47 49 $name = $l[1]; 48 50 $max_length = 65; 51 if( ! $line ) 52 continue; 49 53 if( substr( $line, 0, 2 ) == "X " ) { 50 54 $url = getCompactString( preg_replace( "/^X /", "", $url ), $max_length); … … 58 62 } 59 63 %> 64 </div> 60 65 </div> 61 <% 62 $html = ob_get_clean(); 63 %> 66 67 <?php $html = ob_get_clean(); ?> 64 68 65 69 <center> … … 71 75 72 76 <% 73 shout( "Ready to Import?", "Our link-importing robot found <b>$num_links new link s</b> and <b>$num_tags new tags</b> to create. If the links below look correct, <b>scroll to the bottom of the list and click <u>Import</u></b>. <p/>Because you are importing a batch of potentially personal favorites, these links <b>will not</b> be publicly viewable on Feed Me Links until you mark them public. (Remember, nothing will be added until you scroll down and click <b>Import</b>)" );77 shout( "Ready to Import?", "Our link-importing robot found <b>$num_links new link" . ($num_links == 1 ? "" : "s") . "</b> and <b>$num_tags new tag" . ($num_tags == 1 ? "" : "s") . "</b> to create. If the links below look correct, <b>scroll to the bottom of the list and click <u>Import</u></b>. <p/>Because you are importing a batch of potentially personal favorites, these links <b>will not</b> be publicly viewable on Feed Me Links until you mark them public. (Remember, nothing will be added until you scroll down and click <b>Import</b>)" ); 74 78 75 79 echo $html; feedmelinks/import/processing.php
r1334 r1336 13 13 14 14 # 6. using the prep files, generate the proper SQL commands to 15 # INSERTlink, tag, and link/tag rows. need to do some heavy state15 # insert link, tag, and link/tag rows. need to do some heavy state 16 16 # caching. 17 17 … … 42 42 #e( "$i ::" ); 43 43 $l = preg_split( "/$delimeter/", $line ); 44 $url = urlencode( $l[0] );45 $name = urlencode( $l[1] );46 44 $taglist = array_slice( $l, 2, sizeof( $l )); 47 $qs = "INSERT INTO links VALUES( NULL, '$url', '$name', NULL, NULL, '$user', NULL, 1 );\n"; 48 $q = mysql_query( $qs ); 49 if( !$q ) { 45 $inserted_id = addLinkSimple( $l[0], $l[1], $user, 1 ); 46 if( !$inserted_id ) 50 47 ++$db_errors; 51 l( "INSERTING LINK FAILED: $qs\n" );52 }53 48 54 49 # B. the tag / link associations … … 79 74 } 80 75 81 # F INALLY, WITH NO RECOURSE LEFT TO US, WE INSERT THE NEW TAG IN THE DB76 # Finally, with no recourse left to us, we insert the new tag in the db 82 77 if( $run_query ) { 83 $qs = "INSERT INTO tags VALUES( NULL, '$user', '$tag', '' );\n";78 $qs = getQuery( "add_tag", $user, $tag ); 84 79 $q = mysql_query( $qs ); 85 80 if( !$q ) { 86 81 ++$db_errors; 87 l ( "INSERTING TAG FAILED: $qs\n" );82 log_mesg_to( "Inserting tag $tag for $u failed: $qs", "global" ); 88 83 } else { 89 84 90 # FIRST, WE SAVE THE NEW TAG ID FOR INSERTING IN THE XREF TABLE85 # first, we save the new tag id for inserting in the xref table 91 86 $current_tag_ID = mysql_insert_id(); 92 87 … … 105 100 106 101 if( $current_link_ID && $current_tag_ID ) { 107 $qs = "INSERT INTO links_tags_xref VALUES( $current_link_ID, $current_tag_ID );\n";102 $qs = getQuery( "add_new_category_xref", $current_link_ID, $current_tag_ID ); 108 103 $q = mysql_query( $qs ); 109 104 if( !$q ) { 110 105 ++$db_errors; 111 l( "I NSERTING LINK-TAG XREF FAILED: $qs\n" );106 l( "Inserting link-tag xref failed: $qs\n" ); 112 107 } 113 108 } else { 114 109 ++$db_errors; 115 l( "current_link_ID and/or current_tag_ID were 0, meaning a database I NSERTfailed on import" );110 l( "current_link_ID and/or current_tag_ID were 0, meaning a database Insert failed on import" ); 116 111 } 117 112 } feedmelinks/modules/main-controller.inc.php
r1331 r1336 41 41 42 42 # then we add the link: 43 $q = addLink ( $url, $name, $userid, $folderId, $isPrivate, $options);43 $q = addLinkSimple( $url, $name, $userid, $isPrivate ); 44 44 if( $q ) { 45 45 echo "link added!<br />\n"; … … 86 86 --> 87 87 <?php 88 $q = addLink ( $url, $name, $userid, $groupid, $isPrivate, $options);88 $q = addLinkSimple( $url, $name, $userid, $isPrivate ); 89 89 if( $q ) { 90 90 echo "link added!<br />\n"; feedmelinks/modules/utils.inc.php
r1334 r1336 2069 2069 INSERT INTO links_tags_xref VALUES( " . $args[1] . ", " . $args[2] . " ) "; 2070 2070 2071 } else if( $argWhichQuery == "add_link" ) { 2072 return " 2073 INSERT INTO links VALUES(NULL,'" . urlencode( $args[1] ) . "','" . urlencode(escapeQuotes($args[2])) . "', NULL, NULL,'" . urlencode( $args[3] ) . "', NULL, " . $args[4] . ");"; 2074 2075 } else if( $argWhichQuery == "add_tag" ) { 2076 $isPrivate = $args[3] ? 1 : 0; 2077 return " 2078 INSERT INTO tags VALUES(NULL,'" . urlencode( $args[1] ) . "','" . urlencode( $args[2] ) . "','', $isPrivate);"; 2079 2071 2080 } else if( $argWhichQuery == "tag_by_name" ) { 2072 2081 return " … … 2197 2206 mysql_selectdb( getDBName() ); 2198 2207 foreach( $argCats as $catNum ) { 2199 $qs = "INSERT INTO links_tags_xref VALUES( $argId, $catNum );";2208 $qs = getQuery( "add_new_category_xref", $argId, $catNum ); 2200 2209 $q = mysql_query( $qs ); 2201 2210 if( ! $q ) { … … 2887 2896 2888 2897 function addFolderDriver( $argFolderName, $argUserId, $argIsPrivate ) { 2889 $debug=1;2890 2898 if( $argFolderName && $argUserId ) { 2891 2899 … … 2908 2916 if( $debug ) 2909 2917 echo "DEBUG: \"$argFolderName\" is a new tag -- let's add it:<br/>"; 2910 $qs = "INSERT INTO tags VALUES(NULL,'$argUserId','$argFolderName','', $argIsPrivate);";2918 $qs = getQuery( "add_tag", $argUserId, $argFolderName, $argIsPrivate); 2911 2919 if( $debug ) 2912 2920 echo "DEBUG: $qs<br/>"; … … 2992 3000 } 2993 3001 2994 $qs = "INSERT INTO links VALUES(NULL,'" . urlencode( $argUrl ) . "','" . urlencode(escapeQuotes($argName)) . "', NULL, NULL,'" . urlencode( $argSubmitter ) . "', NULL, $isPrivate );";3002 $qs = getQuery( "add_link", $argUrl, $argName, $argSubmitter, $isPrivate ); 2995 3003 if( $debug ) 2996 3004 echo "qs: $qs<br>"; … … 3001 3009 } 3002 3010 3011 # deprecated; call addLinkSimple() instead 3003 3012 function addLink( $argUrl, $argName, $argSubmitter, $argFolderId, $argPrivate, $argOptions ) { 3004 3013 if( !( $argUrl && $argName && $argSubmitter )) … … 3008 3017 return 0; # FIXME: signal this error back to the user!!!! 3009 3018 3010 if( ! $argFolderId || $argFolderId == "NULL" ) { 3011 $q = addLinkSimple( urldecode( $argUrl ), urldecode( $argName ), urldecode( $argSubmitter ) ); 3012 } else { 3013 $isPrivate = $argPrivate ? $argPrivate : "NULL"; 3014 3015 # spammers and newbies' links are private 3016 if( get_tag_to_link_ratio( $argSubmitter ) > get_max_ttl_ratio() ) { 3017 $isPrivate = 1; 3018 log_mesg_to( get_ip() . ": privatizing new link from $argSubmitter due to T:L ratio", "security" ); 3019 } 3020 3021 mysql_connect(); 3022 mysql_selectdb( getDBName() ); 3023 3024 # check to make sure the folder is not private; if it is, make the link private too: 3025 $folderName = getNameForFolder( $argFolderId ); 3026 if( $folderName && (! isPublicFolder( $argFolderId ))) 3027 $isPrivate = 1; 3028 3029 $qs = "INSERT INTO links VALUES(NULL,'$argUrl','$argName', NULL, NULL,'$argSubmitter', $argFolderId, '$argOptions', $isPrivate );"; 3030 $q = mysql_query( $qs ); 3031 conClose(); 3032 } 3019 $q = addLinkSimple( urldecode( $argUrl ), urldecode( $argName ), urldecode( $argSubmitter ) ); 3033 3020 return $q; 3034 3021 } feedmelinks/recent-kompact.php
r1178 r1336 3 3 $page = "recent-kompact"; 4 4 include_once( "modules/utils.inc.php" ); 5 $tok = $authenticated = $_COOKIE["c_pass_token"];6 $u = $sessionUserId = $_COOKIE["c_uid"];7 8 5 $site = getSiteUrl(); 9 6 … … 18 15 <% 19 16 $con_recentKompact = mysql_connect(); 20 mysql_selectdb( getDBName() );21 17 22 18 $qs2 = getQuery( "num_links" );