--- C:\Documents and Settings\Aldo\Local Settings\Temp\TCV0fc2.tmp\flexinode.1.79.module Sat Jul 01 00:00:16 2006 +++ D:\drupal cvs\contributions\modules\flexinode\flexinode.module Fri Jun 30 22:38:23 2006 @@ -1140,12 +1147,63 @@ drupal_set_message(t('deleted field %name', array('%name' => $field->label))); } + +function flexinode_save_path($metapath) { + $savepath=variable_get('file_directory_path', NULL); + if(isset($metapath)) { + $path_extention=preg_replace_callback("/%.*?(?=(\W|$))/","_flexinode_save_path_markup",$metapath); + // create the subdirectories if path_extention is set + foreach(explode("/",$path_extention) as $p) { + if($p!="/") { + $extpath.="/$p"; + if(!file_exists($savepath."/".$extpath)) { + mkdir($savepath."/".$extpath); + } + } + } + $savepath.=$extpath; + } + return $savepath; +} + +// replaces save path tags with correct values +function _flexinode_save_path_markup($metatag) { + global $user; + + // add any extra functionality here, such as %workflowstate etc + foreach($metatag as $tag) { + switch(strtolower($tag)) { + case "%day": + return date("j"); + break; + case "%dayname": + return date("l"); + break; + case "%month": + return date("n"); + break; + case "%monthname": + return date("F"); + break; + case "%year": + return date("Y"); + break; + case "%username": + return $user->name; + break; + case "%userid": + return $user->uid; + break; + } + } +} + /** * THEME FUNCTIONS **/ function theme_flexinode_type($type, $first) { $output = "