Changeset 490454
- Timestamp:
- 01/16/2012 04:48:54 AM (14 years ago)
- Location:
- wp-risal-download
- Files:
-
- 5 added
- 3 edited
- 8 copied
-
tags/1.3 (added)
-
tags/1.3/bg_header.jpg (copied) (copied from wp-risal-download/trunk/bg_header.jpg)
-
tags/1.3/bullet1.gif (copied) (copied from wp-risal-download/trunk/bullet1.gif)
-
tags/1.3/bullet2.gif (copied) (copied from wp-risal-download/trunk/bullet2.gif)
-
tags/1.3/downfile.php (copied) (copied from wp-risal-download/trunk/downfile.php)
-
tags/1.3/f.gif (added)
-
tags/1.3/screenshot-1.png (copied) (copied from wp-risal-download/tags/1.1/screenshot-1.png)
-
tags/1.3/screenshot-2.png (copied) (copied from wp-risal-download/tags/1.1/screenshot-2.png)
-
tags/1.3/screenshot-3.png (copied) (copied from wp-risal-download/tags/1.1/screenshot-3.png)
-
tags/1.3/screenshot-4.png (copied) (copied from wp-risal-download/tags/1.1/screenshot-4.png)
-
tags/1.3/sf.gif (added)
-
trunk/f.gif (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/risal-download.php (modified) (8 diffs)
-
trunk/risal.css (modified) (2 diffs)
-
trunk/sf.gif (added)
Legend:
- Unmodified
- Added
- Removed
-
wp-risal-download/trunk/readme.txt
r489133 r490454 5 5 Requires at least: 3.0.0 6 6 Tested up to: 3.3.0 7 Stable Tag: 1. 27 Stable Tag: 1.3 8 8 9 9 risal-download is a simple scripts to avoid download abuse(either by human or robot). … … 63 63 * Replace input syntax in Record's Form with "text box" rather than "browse file". More practical for user who remote their server. Sorry, you got to type manually filename and it's path. 64 64 65 = 1.3 = 66 * Add button for file browsing. 67 -
wp-risal-download/trunk/risal-download.php
r489133 r490454 4 4 Plugin URI: http://linuxuserjp.wordpress.com/ 5 5 Description: Filter direct download of files. Manage how your files from outside ROOT_DIRECTORY will be downloaded. Monitor who download your files. 6 Version: 1. 26 Version: 1.3 7 7 Author: Risal Affendie 8 8 Author URI: http://linuxuserjp.wordpress.com … … 57 57 function risal_config_page() { 58 58 if ( function_exists('add_submenu_page') ) 59 add_submenu_page('plugins.php', __('Risal Configuration'), __('Risal Configuration'), 'manage_options', 'risal', 'risal_conf'); 60 } 61 62 63 59 add_submenu_page('plugins.php', __('Risal Configuration'), __('Risal Configuration'), 'manage_options', 'risal', 'risal_confx'); 60 } 61 62 function browsefs() { 63 // Explore the files via a web interface. 64 $xcript = basename(__FILE__); // the name of this script 65 if ( $_GET['path'] == "" || !isset($_GET['path']) ) 66 { 67 $xath = $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']); 68 } else { 69 $xath = $_GET['path']; 70 } 71 //$xath = !empty($_REQUEST['path']) ? $_REQUEST['path'] : $_SERVER['DOCUMENT_ROOT'].'/'.dirname($_SERVER['PHP_SELF'])/*dirname(__FILE__)*/; // the path the script should access 72 73 echo "<p>Browsing Location: <input type=text size=70 readonly=readonly value=\"{$xath}\"></p>"; 74 75 $drtries = array(); 76 $tiles = array(); 77 78 // Check we are focused on a dir 79 if (is_dir($xath)) { 80 chdir($xath); // Focus on the dir 81 if ($handle = opendir('.')) { 82 while (($item = readdir($handle)) !== false) { 83 // Loop through current directory and divide files and directorys 84 if(is_dir($item)){ 85 array_push($drtries, realpath($item)); 86 } 87 else 88 { 89 array_push($tiles, ($item)); 90 } 91 } 92 closedir($handle); // Close the directory handle 93 } 94 else { 95 echo "<p class=\"error\">Directory handle could not be obtained.</p>"; 96 } 97 } 98 else 99 { 100 echo "<p class=\"error\">Path is not a directory</p>"; 101 } 102 103 // There are now two arrays that contains the contents of the path. 104 105 // List the directories as browsable navigation 106 107 echo "<table><tr class=d0><td>Name</td><td>Size</td><td>Type</td></tr>"; 108 sort($drtries); 109 $kira = 0; 110 foreach( $drtries as $drtry ){ 111 if ( $xath !== $drtry ) { 112 if ( $kira !== 2 ) { $kira = $kira + 1; } else { $kira = 1; } 113 echo "<tr class=d".$kira.">"; 114 if ( dirname($xath) == $drtry ) { 115 echo "<td><a href=\"plugins.php?page=risal&browse=true&path={$drtry}\" icon='sf'> .. </a></td>"; 116 } else { 117 echo "<td><a href=\"plugins.php?page=risal&browse=true&path={$drtry}\" icon='sf'>".basename($drtry)."</a></td>"; 118 } 119 echo "<td>".filesize($drtry)."</td><td>".mime_content_type($drtry)."</td></tr>"; 120 } 121 } 122 foreach( $tiles as $tile ){ 123 // Comment the next line out if you wish see hidden files while browsing 124 125 if(preg_match("/^\./", $tile) || $tile == $xcript): continue; endif; // This line will hide all invisible files. 126 if ( $kira !== 2 ) { $kira = $kira + 1; } else { $kira = 1; } 127 echo "<tr class=d".$kira.">"; 128 echo '<td><a href="javascript:void(0)" onClick="refreshParent(\''.$tile.'\',\''.$xath.'\');" icon="f">' . $tile . '</a></td>'; 129 echo "<td>".filesize($xath.'/'.$tile)."</td><td>".mime_content_type($xath.'/'.$tile)."</td></tr>"; 130 } 131 132 echo "</table>"; 133 134 } 135 136 137 function risal_confx() { 138 echo '<div class="wrap"><div id="icon-plugins" class="icon32"><br /></div>'; 139 if ( $_GET['browse'] !== "true" ) 140 { 141 echo '<h2>Risal Download Configuration</h2>'; 142 risal_conf(); 143 } else { 144 echo '<h2>Risal Download Configuration: Browse File</h2>'; 145 browsefs(); 146 } 147 } 64 148 65 149 function risal_conf() { … … 67 151 $rissettings = $table_prefix . 'rissettings'; 68 152 $risfiles = $table_prefix . 'risfiles'; 69 echo '<div class="wrap"><div id="icon-plugins" class="icon32"><br /></div> 70 <h2>Risal Download Configuration</h2></div> 153 echo '</div> 71 154 <div class="rissdiv">'; 72 155 ///step 1: Create alert … … 142 225 ///step 3: Create Editor //form to POST (insert/edit) will be here. 143 226 echo '</tbody></table><hr> 144 <form id="myform" class="cssform" method="post" action="">';227 <form id="myform" name=rform class="cssform" method="post" action="">'; 145 228 if ( $_POST['submit'] == "edit" && $_POST['myid'] !== "" ) { 146 229 $myid = $_POST['myid']; … … 151 234 } 152 235 $vris = "Update"; 236 $xfile = $myrow->file; 237 $xpath = $myrow->outsidepath; 153 238 echo '<h2>Modify Record:</h2>'; 239 154 240 if ( $myrow->method == "md5" ) { $fmd5 = "checked"; $fsha1 = "";} 155 241 if ( $myrow->method == "sha1" ) { $fsha1 = "checked"; $fmd5 = ""; } … … 161 247 } 162 248 echo '<p><label for="ID">ID</label><input type=text name="myid" value="'.$tris.'"></p> 163 <p><label for="File">Server\'s File Name</label><input type=text name="myfile" value="'.$myrow->file.'"></p> 164 <p><label for="File Path">Server\'s File Path</label><input type=text name="mypath" value="'.$myrow->outsidepath.'"></p> 249 <p><label for="File">Server\'s File Name</label><input type=text name="myfile" value="'.$xfile.'"></p> 250 <p><label for="File Path">Server\'s File Path</label><input type=text name="mypath" value="'.$xpath.'"></p> 251 <p><input type="button" value="BROWSE FILE" onclick="window.open(\'plugins.php?page=risal&browse=true\')" /></p> 165 252 <p><label for="Method">Method</label><input type="radio" name="mymeth" value="md5" '.$fmd5.'> MD5 166 253 <input type="radio" name="mymeth" value="sha1" '.$fsha1.'> SHA1</p> … … 330 417 } 331 418 419 function risal_browse() { 420 echo "<script language=\"JavaScript\"> 421 function refreshParent(i,j) { 422 window.opener.document.rform.myfile.value = i; 423 window.opener.document.rform.mypath.value = j; 424 window.close(); 425 } 426 </script>"; 427 } 428 332 429 //inserts java script into head of document 333 430 add_action ( 'wp_head', 'risal_popup' ); … … 340 437 if ( $_GET['page'] == 'risal' ) { 341 438 add_action('admin_head', 'css_admin_head'); 439 add_action('admin_head', 'risal_browse'); 342 440 } 343 441 ?> -
wp-risal-download/trunk/risal.css
r488497 r490454 1 a { 2 color: #c75f3e; 1 a[icon ^="sf"] { 2 padding: 0 2px 1px 20px; 3 background: transparent url(sf.gif) left center no-repeat; 4 text-decoration: none; 5 } 6 7 a[icon ^="f"] { 8 padding: 0 2px 1px 20px; 9 background: transparent url(f.gif) left center no-repeat; 10 color: black; 3 11 } 4 12 … … 104 112 margin-left: 3px; 105 113 } 114 115 tr.d0 td { 116 background-color: #C7BBBB; color: black; 117 } 118 119 tr.d1 td { 120 background-color: white; color: black; 121 } 122 tr.d2 td { 123 background-color: #E3D1D1; color: black; 124 }
Note: See TracChangeset
for help on using the changeset viewer.