Broken Link Checker - Version 0.7.2

Version Description

  • Only use the custom access rights detection routine if open_basedir is set.
Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Broken Link Checker
Version 0.7.2
Comparing to
See all releases

Code changes from version 0.7.1 to 0.7.2

Files changed (4) hide show
  1. broken-link-checker.php +1 -1
  2. core.php +4 -3
  3. readme.txt +4 -1
  4. utility-class.php +22 -4
broken-link-checker.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Broken Link Checker
5
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
6
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
7
- Version: 0.7.1
8
  Author: Janis Elsts
9
  Author URI: http://w-shadow.com/blog/
10
  Text Domain: broken-link-checker
4
  Plugin Name: Broken Link Checker
5
  Plugin URI: http://w-shadow.com/blog/2007/08/05/broken-link-checker-for-wordpress/
6
  Description: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found.
7
+ Version: 0.7.2
8
  Author: Janis Elsts
9
  Author URI: http://w-shadow.com/blog/
10
  Text Domain: broken-link-checker
core.php CHANGED
@@ -2713,7 +2713,7 @@ div.search-box{
2713
  //Try the user-specified temp. directory first, if any
2714
  if ( !empty( $this->conf->options['custom_tmp_dir'] ) ) {
2715
  $custom_dir = trailingslashit($this->conf->options['custom_tmp_dir']);
2716
- if ( blcUtility::is_writable( $custom_dir ) && @is_dir( $custom_dir ) ) {
2717
  return $custom_dir . 'wp_blc_lock';
2718
  } else {
2719
  return false;
@@ -2721,8 +2721,9 @@ div.search-box{
2721
  }
2722
 
2723
  //Try the plugin's own directory.
2724
- if ( blcUtility::is_writable( trailingslashit(dirname(__FILE__)) ) ){
2725
- return dirname(__FILE__) . '/wp_blc_lock';
 
2726
  } else {
2727
 
2728
  //Try the system-wide temp directory
2713
  //Try the user-specified temp. directory first, if any
2714
  if ( !empty( $this->conf->options['custom_tmp_dir'] ) ) {
2715
  $custom_dir = trailingslashit($this->conf->options['custom_tmp_dir']);
2716
+ if ( blcUtility::is_writable( $custom_dir ) && is_dir( $custom_dir ) ) {
2717
  return $custom_dir . 'wp_blc_lock';
2718
  } else {
2719
  return false;
2721
  }
2722
 
2723
  //Try the plugin's own directory.
2724
+ $plugins_directory = trailingslashit(dirname(__FILE__));
2725
+ if ( blcUtility::is_writable( $plugins_directory ) ){
2726
+ return $plugins_directory . 'wp_blc_lock';
2727
  } else {
2728
 
2729
  //Try the system-wide temp directory
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: whiteshadow
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.8.0
5
  Tested up to: 2.9
6
- Stable tag: 0.7.1
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you if any are found.
9
 
@@ -74,6 +74,9 @@ To upgrade your installation
74
 
75
  *This is an automatically generated changelog*
76
 
 
 
 
77
  = 0.7.1 =
78
  * Updated Russian translation.
79
  * Yet another modification of the algorithm that tries to detect a usable directory for the lockfile.
3
  Tags: links, broken, maintenance, blogroll, custom fields, admin
4
  Requires at least: 2.8.0
5
  Tested up to: 2.9
6
+ Stable tag: 0.7.2
7
 
8
  This plugin will check your posts, custom fields and the blogroll for broken links and missing images and notify you if any are found.
9
 
74
 
75
  *This is an automatically generated changelog*
76
 
77
+ = 0.7.2 =
78
+ * Only use the custom access rights detection routine if open\_basedir is set.
79
+
80
  = 0.7.1 =
81
  * Updated Russian translation.
82
  * Yet another modification of the algorithm that tries to detect a usable directory for the lockfile.
utility-class.php CHANGED
@@ -207,22 +207,40 @@ class blcUtility {
207
 
208
  /**
209
  * blcUtility::is_writable()
210
- * Check if a file or directory is writable
211
  *
212
  * @param string $path
213
  * @return bool
214
  */
215
  function is_writable($path){
216
- //will work in despite of Windows ACLs bug
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  //NOTE: use a trailing slash for folders!!!
218
  //see http://bugs.php.net/bug.php?id=27609
219
  //see http://bugs.php.net/bug.php?id=30931
220
 
221
  if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path
222
- return blcUtility::is_writable($path . uniqid(mt_rand()) . '.tmp');
223
  else
224
  if (@is_dir($path))
225
- return blcUtility::is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');
226
  // check tmp file for read/write capabilities
227
  $rm = @file_exists($path);
228
  $f = @fopen($path, 'a');
207
 
208
  /**
209
  * blcUtility::is_writable()
210
+ * Check if a file or directory is writable.
211
  *
212
  * @param string $path
213
  * @return bool
214
  */
215
  function is_writable($path){
216
+ //The raison d'etre of this function is that the built-in is_writable() function
217
+ //may behave incorrectly when open_basedir is set. So we check for it and use
218
+ //a custom algorithm if that's the case.
219
+ if ( blcUtility::is_open_basedir() ){
220
+ return blcUtility::_custom_is_writable( $path );
221
+ } else {
222
+ return is_writable($path);
223
+ }
224
+ }
225
+
226
+ /**
227
+ * blcUtility::_custom_is_writable()
228
+ * Check if a file or directory is writable by attempting to actually write to that file or directory.
229
+ *
230
+ * @param string $path
231
+ * @return bool
232
+ */
233
+ function _custom_is_writable($path){
234
+ //will work in despite of Windows ACLs bug
235
  //NOTE: use a trailing slash for folders!!!
236
  //see http://bugs.php.net/bug.php?id=27609
237
  //see http://bugs.php.net/bug.php?id=30931
238
 
239
  if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path
240
+ return blcUtility::_custom_is_writable($path . uniqid(mt_rand()) . '.tmp');
241
  else
242
  if (@is_dir($path))
243
+ return blcUtility::_custom_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');
244
  // check tmp file for read/write capabilities
245
  $rm = @file_exists($path);
246
  $f = @fopen($path, 'a');