Example #1
0
 function referrer_as_link()
 {
     if ($this->referrer) {
         $referrer = $this->get_referrer();
         $parts = explode('?', $referrer);
         return '<a href="' . DH_Plugin::url($referrer) . '">' . $parts[0] . '</a>';
     }
     return '';
 }
Example #2
0
		<br/>
		<div class="errorx" style="display: none" id="error_url">
			<p><?php 
_e('<p>Your chosen <strong>URL</strong> is outside of your WordPress site and as such Drain Hole <strong>may not be able to control access</strong> to files unless a <code>.htaccess</code> file is placed in the directory.  Drain Hole will attempt to do this for you, but may not have permission to do so.  If this is the case then you will need to create this file yourself (<a href="#" onclick="jQuery(\'#htaccess\').toggle (); return false">click to view</a>)</p>', 'drain-hole');
?>
</p>
		</div>
		
		<div class="updatedx" id="htaccess" style="display: none">
			<p><?php 
_e('The following should be created in the directory given above:', 'drain-hole');
?>
</p>
			<pre style="margin: 0px">
			<?php 
$this->render_admin('htaccess', array('index' => DH_Plugin::realpath(ABSPATH) . '/index.php'));
?>
			</pre>
		</div>

		<div id="dialog"></div>
		
		<?php 
$this->render_admin('loading');
?>
		
		<script type="text/javascript" charset="utf-8">
			var wp_dh_base_url  = '<?php 
echo htmlspecialchars($base_url);
?>
';
Example #3
0
File: hole.php Project: Jintha/cama
 /**
  * Create a new hole, making the appropriate directory and creating a default .htaccess to prevent direct access
  *
  * @static
  * @param array $data Array of values (urlx,directoryx,role)
  * @return boolean
  **/
 function create($data)
 {
     global $wpdb;
     $url = $wpdb->escape(DH_Hole::sanitize_url($data['urlx']));
     $directory = $wpdb->escape(DH_Hole::sanitize_dir(DH_Plugin::realpath($data['directoryx'])));
     $redirect = $wpdb->escape($data['redirect_urlx']);
     if (isset($data['role']) && ($data['role'] == '-' || $data['role'] == '')) {
         $role = 'NULL';
     } else {
         $role = "'" . $data['role'] . "'";
     }
     //		error_reporting (E_ALL);
     //		ini_set("display_errors", 1);
     $hotlink = isset($data['hotlink']) ? true : false;
     if (strlen($directory) > 0 && preg_match('@https?://@', $directory, $matches) === 0) {
         if (strlen($url) > 1 && $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}drainhole_holes WHERE url LIKE '{$url}'") == 0) {
             // Try and create the directory and add a .htaccess file to protect it from nefarious users
             if (!@file_exists($directory)) {
                 $last = error_get_last();
                 $result = DH_Hole::can_create_dir($directory);
                 if ($result === true) {
                     if (wp_mkdir_p($directory)) {
                         $options = get_option('drainhole_options');
                         if ($options === false || !isset($options['htaccess']) || $options['htaccess'] == true) {
                             $fp = @fopen($directory . '/.htaccess', 'w+');
                             fwrite($fp, $this->capture_admin('htaccess', array('index' => DH_Plugin::realpath(ABSPATH) . '/index.php')));
                             @fclose($fp);
                         }
                     } else {
                         return sprintf(__('could not create directory <code>%s</code><br/>You have insufficient permissions - create the directory with FTP or assign group/other write permissions to the parent directory and try again', 'drain-hole'), $directory);
                     }
                 } else {
                     return $result;
                 }
             }
             $wpdb->query("INSERT INTO {$wpdb->prefix}drainhole_holes (url,directory,role,role_error_url,hotlink) VALUES ('{$url}','{$directory}',{$role},'{$url}','{$hotlink}')");
             return true;
         }
     }
     return __('you must supply a unique URL (without <code>http://</code> prefix) and directory', 'drain-hole');
 }