Plugin Directory

Changeset 1351860


Ignore:
Timestamp:
02/16/2016 01:54:50 PM (10 years ago)
Author:
markusklems
Message:

Added support and bugtracking features for customized or shared WordPress installations where central php configs might not be at the default paths.

Location:
cloudwok-file-upload/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cloudwok-file-upload/trunk/admin.php

    r1350971 r1351860  
    11<?php
    22    define( 'BLOCK_LOAD', true );
    3     require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' );
    4     require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' );
     3    define('MYPATH', dirname(__FILE__));
     4    if ( file_exists( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php') ) {
     5      require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' );
     6    } else {
     7      // trying probable locations of wp-config.php
     8      if (file_exists( MYPATH . '/../../../wp-config.php' )) {
     9        require_once( MYPATH . '/../../../wp-config.php' );
     10      } elseif (file_exists( MYPATH . '/../../wp-config.php' )) {
     11        require_once( MYPATH . '/../../wp-config.php' );
     12      } elseif (file_exists( MYPATH . '/../wp-config.php' )) {
     13        require_once( MYPATH . '/../wp-config.php' );
     14      } elseif (file_exists( MYPATH . '/wp-config.php' )) {
     15        require_once( MYPATH . '/wp-config.php' );
     16      } else {
     17        // shit, could not find wp-config.php
     18        die();
     19      }
     20    }
     21    if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php') ) {
     22      require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' );
     23    } else {
     24      // trying probable locations of wp-config.php
     25      if (file_exists( MYPATH . '/../../../wp-includes/wp-db.php' )) {
     26        require_once( MYPATH . '/../../../wp-includes/wp-db.php' );
     27      } elseif (file_exists( MYPATH . '/../../wp-includes/wp-db.php' )) {
     28        require_once( MYPATH . '/../../wp-includes/wp-db.php' );
     29      } elseif (file_exists( MYPATH . '/../wp-includes/wp-db.php' )) {
     30        require_once( MYPATH . '/../wp-includes/wp-db.php' );
     31      } elseif (file_exists( MYPATH . '/wp-includes/wp-db.php' )) {
     32        require_once( MYPATH . '/wp-includes/wp-db.php' );
     33      } else {
     34        // shit, could not find wp-includes/wp-db.php
     35        die();
     36      }
     37    }
    538
    639    global $wpdb;
     
    1043    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    1144      // update
    12      if(!array_diff(array('cwnonce','ref','code'), array_keys($_POST)) || ! wp_verify_nonce( $_POST['cwnonce'], $noncetxt ))
     45     if(!array_diff(array('cwnonce','ref','code'), array_keys($_POST)) && wp_verify_nonce( $_POST['cwnonce'], $noncetxt ))
    1346     {
    1447          $ref=(int)$_POST['ref'];
     
    2659          );
    2760          echo "Updated";
    28       } else if(!array_diff(array('cwnonce','code'), array_keys($_POST)) || ! wp_verify_nonce( $_POST['cwnonce'], $noncetxt )) {
     61      } else if(!array_diff(array('cwnonce','code'), array_keys($_POST)) && wp_verify_nonce( $_POST['cwnonce'], $noncetxt )) {
    2962         // create
    3063        $wpdb->insert(
     
    70103     parse_str(file_get_contents('php://input'), $_DELETE );
    71104      // delete row
    72      if(!array_diff(array('cwnonce','ref'), array_keys($_DELETE)) || ! wp_verify_nonce( $_DELETE['cwnonce'], $noncetxt ))
     105     if(!array_diff(array('cwnonce','ref'), array_keys($_DELETE)) && wp_verify_nonce( $_DELETE['cwnonce'], $noncetxt ))
    73106     {
    74107         $ref=(int)$_DELETE['ref'];
  • cloudwok-file-upload/trunk/cloudwok.php

    r1350971 r1351860  
    44Plugin URI: http://www.cloudwok.com
    55Description: CloudWok enables you to let your website visitors upload files directly into a Dropbox, Google Drive, Amazon S3, Box.com, or other cloud storage folder that you own.
    6 Version: 0.5.0
     6Version: 0.5.1
    77Author: CloudWok
    88Author Email: [email protected]
     
    335335    ) $charset_collate;";
    336336
    337     require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     337  if (file_exists( ABSPATH . 'wp-admin/includes/upgrade.php' )) {
     338      require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     339  } else {
     340    // could not find upgrade.php where we expected it to be
     341    // trying out some other paths to find it
     342    if (file_exists( ABSPATH . '/../wp-admin/includes/upgrade.php' )) {
     343      require_once( ABSPATH . '/../wp-admin/includes/upgrade.php' );
     344    } elseif (file_exists( ABSPATH . '/../../wp-admin/includes/upgrade.php' )) {
     345      require_once( ABSPATH . '/../../wp-admin/includes/upgrade.php' );
     346    } elseif (file_exists( ABSPATH . '/../../../wp-admin/includes/upgrade.php' )) {
     347      require_once( ABSPATH . '/../../../wp-admin/includes/upgrade.php' );
     348    }
     349  }
    338350    dbDelta( $sql1 );
    339351}
     
    367379  $adminUrl = plugin_dir_url( __FILE__ ) . 'admin.php';
    368380  $nonce = wp_create_nonce( "cWn0Nc€4tW" );
     381  // check if wp-config.php and wp-includes/wp-db.php files can be found
     382  define('MYPATH', dirname(__FILE__));
     383  if (!file_exists( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php') && !file_exists( MYPATH . '/../../../wp-config.php' ) && !file_exists( MYPATH . '/../../wp-config.php' ) && !file_exists( MYPATH . '/../wp-config.php' ) && !file_exists( MYPATH . '/wp-config.php' )) {
     384    echo '<p style="color:red;">Warning: wp-config.php could not be found at ' . $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' . ' or sub paths of ' . MYPATH . '. The CloudWok settings page might therefore not work correctly. Please send an e-mail with this warning to [email protected] and ask for a solution of the issue.</p>';
     385  }
     386  if (!file_exists( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php') && !file_exists( MYPATH . '/../../../wp-includes/wp-db.php' ) && !file_exists( MYPATH . '/../../wp-includes/wp-db.php' ) && !file_exists( MYPATH . '/../wp-includes/wp-db.php' ) && !file_exists( MYPATH . '/wp-includes/wp-db.php' )) {
     387    echo '<p style="color:red;">Warning: wp-includes/wp-db.php could not be found at ' . $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' . ' or sub paths of ' . MYPATH . '. The CloudWok settings page might therefore not work correctly. Please send an e-mail with this warning to [email protected] and ask for a solution of the issue.</p>';
     388  }
     389  if (!file_exists( ABSPATH . 'wp-admin/includes/upgrade.php' ) && !file_exists( ABSPATH . '/../wp-admin/includes/upgrade.php' ) && !file_exists( ABSPATH . '/../../wp-admin/includes/upgrade.php' ) && !file_exists( ABSPATH . '/../../../wp-admin/includes/upgrade.php' )) {
     390    echo '<p style="color:red;">Warning: wp-admin/includes/upgrade.php could not be found at ' . ABSPATH . 'wp-admin/includes/upgrade.php' . ' or sub paths. The CloudWok settings page might therefore not work correctly. Please send an e-mail with this warning to [email protected] and ask for a solution of the issue.</p>';
     391  }
     392
    369393  // Add bootstrap css and js
    370394  echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
     
    449473            jQuery("#editRef").val("");
    450474            jQuery("#cloudwokEmbedCode").val("");
    451             console.log(resp);
    452475        }
    453476    });
     
    504527      appendRefListItem(ref);
    505528    });
    506     jQuery("#cloudwokEmbedCode").prop("placeholder","Please enter your embed code here (visit https://www.cloudwok.com/developers to generate your customiezd code)");
     529    jQuery("#cloudwokEmbedCode").prop("placeholder","Please enter your embed code here (visit https://www.cloudwok.com/developers to generate your customized code)");
    507530  });';
    508531  echo '</script>';
  • cloudwok-file-upload/trunk/readme.txt

    r1350971 r1351860  
    55Requires at least: 3.0.0
    66Tested up to: 4.4.2
    7 Stable tag: 0.5.0
     7Stable tag: 0.5.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    143143== Changelog ==
    144144
     145= 0.5.1 =
     146On some custom WordPress installations the settings page does not work if central php config files cannot be accessed. This update helps tracking down and reporting possible issues that occur in these cases.
    145147= 0.5.0 =
    146148New shortcode feature. Create a customized widget via the Settings > CloudWok menu in the admin sidebar. The old shortcode still works but will not be further developed. Please use the new shortcode to customize the CloudWok widget.
Note: See TracChangeset for help on using the changeset viewer.