Forum Replies Created

Viewing 15 replies - 286 through 300 (of 318 total)
  • Forum: Plugins
    In reply to: [Plugin: Upload ] WP 2.6

    No news…

    Here’s a dump of uploadplus.php

    Plugin Name: Upload+
    Plugin URI:
    Description: Security and sanity in file names while uploading. Once activate, please <a href="options-general.php?page=uploadplus">define your settings</a>.
    Author: Pixline
    Version: 2.5.1.x Patched for 2.6
    Author URI:
    Copyright (C) 2007/2008 Paolo Tresso / Pixline (
    Includes hints and code by:
    	Francesco Terenzani (
    	Jennifer Hodgdon (
    Uses UTF8 PHP classes by
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    require_once 'utf8/utf8.php';
    require_once 'utf8/str_ireplace.php';
    require_once UTF8 . '/utils/validation.php';
    require_once UTF8 . '/utils/ascii.php';
    require_once 'utf8_to_ascii/utf8_to_ascii.php';
    $version = get_option('uploadplus_version');
    if ($version == '') $version = 0;
    if ($version < 3) {
    	add_option('uploadplus_style','a:1:{i:0;s:1:"1";}','Choose what style will be used','yes');
    	add_option('uploadplus_lettercase','a:1:{i:0;s:1:"1";}','Make all lowercase','yes');
    	update_option('uploadplus_version', 3);
    /* add option page */
    function upp_add_mangle_options_page(){
    		add_options_page('Upload+ Options','Upload+',8,'uploadplus','upp_mangle_options_page');
    /* the real option page */
    function upp_mangle_options_page(){
    global $wp_db_version;
    	if (isset($_POST['info_update'])) {
    		$style = serialize($_POST['uploadplus_style']);
    		$lettercase = serialize($_POST['uploadplus_lettercase']);
    		if( !empty($_POST['uploadplus_prefix_custom']) && $_POST['uploadplus_prefix']=='none' ){
    		echo('<div id="message" class="updated fade"><p><strong>Settings saved.</strong></p></div>');
    	$flag1 = ""; $flag2 = $flag1; $flag3 = $flag1; $flag4 = $flag1; $flag5 = $flag1;
    	$x = get_option('uploadplus_style');
    	//$x = unserialize($y);
    	if($x == 1){ $flag1 = 'checked="checked"'; }
    	if($x == 2){ $flag2 = 'checked="checked"'; }
    	if($x == 3){ $flag3 = 'checked="checked"'; }
    	$new_lettercase = get_option('uploadplus_lettercase');
    	//$new_lettercase = unserialize($opt_lettercase);
    	if($new_lettercase == 1){ $flag4='checked="checked"'; }else{ $flag5='checked="checked"'; }
    	$custom		= get_option('uploadplus_prefix_custom');
    	$standard	= get_option('uploadplus_prefix_standard');
    	$pref_custom = "";
    	$prefs = array("none"=>"","md"=>"","ymd"=>"","ymdhi"=>"","ymdhis"=>"","random"=>"","unix"=>"");
    		$pref_custom = $custom;
    		$prefs[$standard] = "selected='selected'";
    	$test_string1 = "WordPress Manual (for dummies, experts and pro's) 2.2nd Edition.pdf";
    #	$test_string1 = 'У беларускіх гарадах працягваецца паказ культавага швэдзкага кіно.pdf';
    #	$test_string3 = 'اذاعة شباب اف ام.pdf';
    	$demo_string1 = upp_mangle_filename($test_string1);
    #	$demo_string2 = upp_mangle_filename($test_string2);
    #	$demo_string3 = upp_mangle_filename($test_string3);
    	echo("<div class='wrap'>");
    	echo("<form method='post' accept-charset='utf-8'>");
    	echo("<h2>Upload+ Options</h2>");
    	echo("<p>Welcome to Upload+. This plugin allows you to rename every file you upload, and in this page you can define this behaviour.</p>");
    	echo("<p> According to your actual ruleset, your files will be renamed like this:<br />
    	<li> <em>".$test_string1."</em><br /> saved as &rsaquo; <strong>".$demo_string1."</strong></li>
    	<!-- li> <em>".$test_string2."</em><br /> saved as &rsaquo; <strong>".$demo_string2."</strong></li>
    	<li> <em>".$test_string3."</em><br /> saved as &rsaquo; <strong>".$demo_string3."</strong></li -->
    	echo("<p><small>You can choose to <em>convert spaces and underscores into dashes</em>, <em>strip all dashes/underscores/spaces</em>, or <em>convert every spaces into an underscore</em>. Also, you can choose to <em>lowercase</em> the file name or leave it with mixed case, and finally you can define a custom prefix to prepend, either a fixed one (like the name of your blog) or a date-based one. Feel free to play with the settings and save them, because you can check in this page what kind of transformation will be applied.</small></p>");
    	if($wp_db_version < 6846) $tableclass = "editform optiontable"; else $tableclass = "form-table";
    	echo('<fieldset class="options" name="set1">
    	<legend>Cleaning rules</legend>
    	<table class="'.$tableclass.'">
    	<th scope="row" valign="top">Basic cleaning</th>
    	<p><input type="radio" name="uploadplus_style[]" id="uploadplus_style-1" value="1" '.$flag1.'/>
    	<label for="uploadplus_style-1">Convert spaces and underscores into dashes.
    	<small>[ &rsaquo; <em>wordpress-manual.pdf</em> ]</small></label></p>
    	<p><input type="radio" name="uploadplus_style[]" id="uploadplus_style-2" value="2" '.$flag2.'/>
    	<label for="uploadplus_style-2">Strip all spaces/dashes/underscores.
    	<small>[ &rsaquo; <em>wordpressmanual.pdf</em> ]</small></label></p>
    	<p><input type="radio" name="uploadplus_style[]" id="uploadplus_style-3" value="3" '.$flag3.'/>
    	<label for="uploadplus_style-3">Convert spaces into underscores (dashes allowed).
    	<small>[ &rsaquo; <em>wordpress_manual.pdf</em> ]</small></label></p>
    	<th scope="row" valign="top">Lowercase</th>
    	<input type="radio" name="uploadplus_lettercase[]" id="uploadplus_lettercase-1" value="1" '.$flag4.'/>
    	Make ALL lowercase.
    	<input type="radio" name="uploadplus_lettercase[]" id="uploadplus_lettercase-0" value="0" '.$flag5.'/>
    	Leave untouched.
    echo('<fieldset class="options" name="set1">
    	<table class="'.$tableclass.'">
    	<th scope="row" valign="top">Prefix</th>
    	<select name="uploadplus_prefix" id="uploadplus_prefix">
    	<option value="none" label="No prefix, or custom prefix">No prefix, or custom prefix</option>
    	<optgroup label="Human Readable">
    	<option value="d" label="dd (like: '.date('d').'_)" '.$prefs['d'].'>d (like: '.date('d').'_)</option>
    	<option value="md" label="mmdd (like: '.date('md').'_)" '.$prefs['md'].'>mmdd (like: '.date('md').'_)</option>
    	<option value="ymd" label="yyyymmdd (like: '.date('Ymd').'_)" '.$prefs['ymd'].'>yyyymmdd (like: '.date('Ymd').'_)</option>
    	<option value="ymdhi" label="yyyymmddhhmm (like: '.date('YmdHi').'_)" '.$prefs['ymdhi'].'>yyyymmddhhmm (like: '.date('YmdHi').'_)</option>
    	<option value="ymdhis" label="yyyymmddhhmmss (like: '.date('YmdHis').'_)" '.$prefs['ymdhis'].'>yyyymmddhhmmss (like: '.date('YmdHis').'_)</option>
    	<optgroup label="Other Styles">
    	<option value="random" label="[random (mt-rand)] '.mt_rand().'_" '.$prefs['random'].'>[random] '.mt_rand().'_</option>
    	<option value="unix" label="[unix timestamp] '.date('U').'_" '.$prefs['unix'].'>[unix] '.date('U').'_</option>
    	<!-- option value="blog" label="[blog name] '.strtolower(get_bloginfo('name')).'_" '.$prefs['blog'].'>[blog] '.strtolower(get_bloginfo('name')).'_</option -->
    	<input type="text" name="uploadplus_prefix_custom" size="50" id="uploadplus_prefix_custom" value="'.$pref_custom.'"/><br />
    	<small>Enter your custom textual prefix (like "prefix_"). Please note this is a *string*, so please do not use php <em>date()</em> arguments :-)</a>.</small>
    	echo('<p class="submit">
    	<input type="hidden" name="action" value="update" />
    	<input type="submit" name="info_update" value="Update Settings &raquo;" />
    	echo('<hr/> <p><small><a href="">Upload+</a> is GPL&copy; <a href="">Paolo Tresso / Pixline</a>. UTF8 php classes and translitteration by <a href="">phputf8</a>.<br /> If you find this plugin useful you can donate and support its development. Thank you!
    <form action="" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="image" src="" border="0" name="submit" alt="Support via PayPal">
    <img alt="" border="0" src="" width="1" height="1">
    /* find extension */
    function upp_findexts ($filename) {
    	$exts = split("[/\\.]", $filename) ;
    	$n = count($exts)-1;
    	$exts = $exts[$n];
    	return $exts;
    /* find full filename */
    function upp_find_filename ($filename) {
    	$explode = explode("/",$filename);
    	$explode = array_reverse($explode);
    	return $explode[0];
    /*    sanitize uploaded file name    */
    function upp_mangle_filename($file_name){
    	/* remove internal dots (cosmetical, it would be done by WP, but we need to display it :)*/
    	$ext = upp_findexts($file_name);
    	$file_name = str_replace(".".$ext,"",$file_name);
    	$file_name = str_replace(".","",$file_name);
    	// initial cleaning
    	$file_name = str_replace("(","",$file_name);
    	$file_name = str_replace(")","",$file_name);
    	$file_name = str_replace("'","",$file_name);
    	$file_name = str_replace('"',"",$file_name);
    	$file_name = str_replace(',',"",$file_name);
    	// some language-based prefilter. props denis.
    	$de_from 	= array('ä','ö','ü','ß','Ä','Ö','Ü');
    	$de_to 		= array('ae','oe','ue','ss','Ae','Oe','Ue');
    	$file_name	= str_replace($de_from, $de_to, $file_name);
    	if ( utf8_is_valid($file_name) ) {
            $file_name = utf8_to_ascii($file_name);
            $file_name = utf8_to_ascii($file_name);
    	$file_name = $file_name.".".$ext;
    	$un_lettercase = get_option('uploadplus_lettercase');
    	//$un_lettercase = unserialize($lettercase);
    		case "1":
    			$file_name = utf8_strtolower($file_name);
    	$x = get_option('uploadplus_style');
    	//$x = unserialize($y);
    	case "1":
    		$file_name = ereg_replace("[^A-Za-z0-9._]", "-", $file_name);
    		$file_name = utf8_ireplace("_", "-", $file_name);
    		$file_name = utf8_ireplace(" ", "-", $file_name);
    		$file_name = utf8_ireplace("%20", "-", $file_name);
    	case "2":
    		$file_name = ereg_replace("[^A-Za-z0-9._]", "", $file_name);
    		$file_name = utf8_ireplace("_", "", $file_name);
    		$file_name = utf8_ireplace("-", "", $file_name);
    		$file_name = utf8_ireplace("%20", "", $file_name);
    	case "3":
    		$file_name = ereg_replace("[^A-Za-z0-9._]", "_", $file_name);
    		$file_name = utf8_ireplace("-", "_", $file_name);
    		$file_name = utf8_ireplace(" ", "_", $file_name);
    		$file_name = utf8_ireplace("%20", "_", $file_name);
    	$custom = get_option('uploadplus_prefix_custom');
    	$standard = get_option('uploadplus_prefix_standard');
    	if($custom!="" && $standard=="none"){
    		$file_name = $custom.$file_name;
    			case "d":		$file_name = date('d')."_".$file_name;			break;
    			case "md":		$file_name = date('md')."_".$file_name;			break;
    			case "ymd":		$file_name = date('Ymd')."_".$file_name;		break;
    			case "ymdhi":	$file_name = date('YmdHi')."_".$file_name;		break;
    			case "ymdhis":	$file_name = date('YmdHis')."_".$file_name;		break;
    			case "random":	$file_name = mt_rand()."_".$file_name;			break;
    			case "unix":	$file_name = date('U')."_".$file_name;			break;
    #			case "blog":	$file_name = strtolower(get_bloginfo('name'))."_".$file_name;	break;
    	return $file_name;
    /* apply out changes to the real file while it's being moved to its destination */
    // $array( 'file' => $new_file, 'url' => $url, 'type' => $type );
    function upp_rename($array){
    global $action;
    	$current_name = upp_find_filename($array['file']);
    	$current_name = urldecode($current_name);
    	$new_name = upp_mangle_filename($current_name);
    	$lpath = str_replace($current_name, "", urldecode($array['file']));
    	$wpath = str_replace($current_name, "", urldecode($array['url']));
    	$lpath_new = $lpath . $new_name;
    	$wpath_new = $wpath . $new_name;
    	if( @rename($array['file'], $lpath_new) )
    	return array(
    		'file' => $lpath_new,
    		'url' => $wpath_new,
    		'type' => $array['type']
    	return $array;
    add_action( 'admin_menu', 'upp_add_mangle_options_page' );	// add option page
    add_action('wp_handle_upload', 'upp_rename');				// apply our modifications


    For others who need this background:

    both ASCII and binary files can be sent in binary mode with no problems, but sending a binary file in ASCII mode will corrupt the binary file’s structure. ASCII mode makes for faster transfers, but if you accidentally upload a Microsoft Word file or JPG image in ASCII mode, your file will hit the server dead on arrival. If there’s any question, transfer in binary mode.

    Of course, we wouldn’t have such a handy rule without one exception:CGI scripts. You must use ASCII mode when sending CGI scripts. They just won’t work otherwise!

    Hey Rebecca,

    I use this theme, somewhere. A mess of various colors? Email me the link please…hopefully I’ll catch you in the next few minutes…

    Dang it.

    I even tried editing the plugin’s .js to tweak the jQuery:

    .css({ listStyleImage: ‘none’ });

    .css({ listStyleImage: ‘none’ });

    // Supress the liststyleimage
    jQuery(‘li’, this)
    .css({ listStyleImage: ‘none’

    Forum: Plugins
    In reply to: Image shack error in WP2.6


    Forum: Plugins
    In reply to: Image shack error in WP2.6

    What is the obfuscated code (base64?) in this file?


    If you have the resources (time and mojo) to develop a real CMS, Drupal is the way to go. The framework abstraction is brilliant. Not for the spoon-fed though and like all things which allow some folks to earn a living wage -filled with reticent mercenary-type developers. Well worth learning.

    I think the radioactivity is the shadow of: WP is a blogging platform that lends itself to styling, rather than data node abstraction. It is what it is and it looks good doing it. Just like Microsoft Windows NT back in the day when it was pimped as a server OS. Still makes me laugh. Years later, the emperor has a thong…

    When I spoke with EventBrite, they were very enthusiastic about solving my issues. I like them.

    For those following the action at home, no joy, link sent…

    Hey George,

    I feel your pain! I’ve spent months looking at Drupal etc to finally realize that people have already invented fire, all I had to do was to integrate their great work into my site…

    I suggest signing up for an account with EventBrite. They have every event management thing you need including setting up free tickets etc. You can run reports, reserve tickets, contact specific groups etc. Awesome. Just awesome.


    I was excited for a moment there!

    From the plugin, does this help?

    echo '<ul class="enhanced-categories-' . $this->ul_index . '">';
    		echo '</ul>';

    I tried ul.enhanced-categories-1 etc…

    May I email you the link to this early alph dev site (I’m not worthy) via your website?

    How about serious money to recommend a plugin? This plugin is pretty cool (besides the Geo stuff) in that you can call specific templates for specific quicktag calls…

    I set this up this morning for a friend. It has gravatar support too, although I couldn’t get that to work -not that important right now…

    Send money and kittens and orange juice with lots of pulp ASAP.

    Forum: Plugins
    In reply to: Image shack error in WP2.6

    Let’s fix it!

    Ok, it looks like in WP 2.6 the function it needs (media_admin_css) has been moved from wp-admin/includes/media.php to wp-includes/general-template.php. Note the name of the function and the way it is used has changed too!

    so to fix it:

    Edit the imageshack.php file at line 177


    Delete that and put this in the same place:

    // Hack: RedFish: START:
    			// Hack to make WP 2.6 compatible.
    			// Replaced original line.
    			// media_admin_css('css/media');
    // Hack: RedFish: END:

    I label my edits to make it clear which part of what multi-file hack is where…

    Oldskool. Before SVN etc!

    Forum: Plugins
    In reply to: Image shack error in WP2.6

    Urrgh, me four

    Hey Pete,

    Besides the files you’ve put on your server (that have your post images etc) you’re going to need the contents of your wp database on your old server/host to load into the database you’ll have to create on your new host. May as well create the exact same named database and database user and password for now…

    To get the contents, you could ask your old host for an SQL backup of your old wp database (or do it yourself if you know how). Ask for full data and structure so that the SQL will create the tables if they do not exist…

    I’m generalizing here, but that works for most setups. If your db is huge (you use zipcode lookup tables or country info etc) you may run into PHP timeouts/sql file size limitations even if you choose a compressed sql file, but let’s cross that bridge if you come to it!

    Look in wp-config.php for the name of the db that WP uses. You’ll have to setup the exact same thing on your new host.

    So you’re editing the contact form using the plugins settings page, you generate the BBC tag, paste it into the form where you want it, save the entire form, go to your post or page in HTML (not visual) mode and paste the [contact-form4] or similar tag and save/publish that post/page?

    Clearing your browser cache didn’t help?

Viewing 15 replies - 286 through 300 (of 318 total)