Changeset 2387
- Timestamp:
- 06/22/10 17:48:36 (3 years ago)
- Location:
- plugins/noodles
- Files:
-
- 1 added
- 14 edited
-
_admin.php (modified) (1 diff)
-
_define.php (modified) (1 diff)
-
_install.php (added)
-
_prepend.php (modified) (2 diffs)
-
_public.php (modified) (11 diffs)
-
_uninstall.php (modified) (2 diffs)
-
default-templates/js/jquery.noodles.js (modified) (2 diffs)
-
inc/_default_noodles.php (modified) (2 diffs)
-
inc/_noodles_functions.php (modified) (6 diffs)
-
inc/class.noodles.php (modified) (7 diffs)
-
inc/lib.image.path.php (modified) (2 diffs)
-
index.php (modified) (8 diffs)
-
locales/fr/main.lang.php (modified) (2 diffs)
-
locales/fr/main.po (modified) (3 diffs)
-
release.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugins/noodles/_admin.php
r1399 r2387 18 18 'plugin.php?p=noodles','index.php?pf=noodles/icon.png', 19 19 preg_match('/plugin.php\?p=noodles(&.*)?$/',$_SERVER['REQUEST_URI']), 20 $core->auth->check('admin',$core->blog->id)); 20 $core->auth->check('admin',$core->blog->id) 21 ); 21 22 ?> -
plugins/noodles/_define.php
r1485 r2387 17 17 /* Description*/ "Add users gravatars everywhere", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 5',19 /* Version */ '0.6', 20 20 /* Permissions */ 'admin' 21 21 //* Priority */ 10000000 22 22 ); 23 /* date */ #20 09092323 /* date */ #20100622 24 24 ?> -
plugins/noodles/_prepend.php
r1485 r2387 16 16 17 17 $__autoload['noodlesImg'] = dirname(__FILE__).'/inc/lib.noodles.img.php'; 18 $__autoload['noodlesLibImagePath'] = dirname(__FILE__).'/inc/lib.image.path.php'; 19 20 $core->blog->settings->addNamespace('noodles'); 18 21 19 22 $core->url->register('noodlesmodule','noodles','^noodles/(.+)$', … … 22 25 array('urlNoodles','service')); 23 26 24 if (!is_callable(array('libImagePath','getArray')))25 require dirname(__FILE__).'/inc/lib.image.path.php';26 27 ?> -
plugins/noodles/_public.php
r1485 r2387 13 13 if (!defined('DC_RC_PATH')){return;} 14 14 15 if (!$core->blog->settings->noodles _active) return;15 if (!$core->blog->settings->noodles->noodles_active) return; 16 16 17 17 include dirname(__FILE__).'/inc/_default_noodles.php'; … … 24 24 25 25 global $__noodles; 26 $__noodles = noodles::decode($core->blog->settings->noodles _object);26 $__noodles = noodles::decode($core->blog->settings->noodles->noodles_object); 27 27 28 28 if ($__noodles->isEmpty()) … … 51 51 52 52 $targets[] = 53 ' $(\''.html::escapeJS($noodle->target).'\').noodles({'.53 ' $(\''.html::escapeJS($noodle->target).'\').noodles({'. 54 54 'imgId:\''.html::escapeJS($noodle->id()).'\','. 55 55 'imgPlace:\''.html::escapeJS($noodle->place).'\''. … … 60 60 61 61 echo 62 "\n<!-- CSS for noodles --> \n". 62 63 '<style type="text/css">'.html::escapeHTML($css).'</style>'. 64 "\n<!-- JS for noodles --> \n". 63 65 "<script type=\"text/javascript\" src=\"". 64 66 $core->blog->url.$core->url->getBase('noodlesmodule')."/js/jquery.noodles.js\"></script> \n". … … 80 82 { 81 83 global $core; 82 84 83 85 header('Content-Type: text/xml; charset=UTF-8'); 84 86 85 87 $rsp = new xmlTag('rsp'); 86 88 87 89 $i = !empty($_POST['noodleId']) ? $_POST['noodleId'] : null; 88 90 $c = !empty($_POST['noodleContent']) ? $_POST['noodleContent'] : null; 89 90 if (!$core->blog->settings->noodles_active) { 91 92 if (!$core->blog->settings->noodles->noodles_active) 93 { 91 94 $rsp->status = 'failed'; 92 95 $rsp->message(__('noodles is disabled on this blog')); … … 94 97 return false; 95 98 } 96 97 if ($i === null || $c === null) { 99 100 if ($i === null || $c === null) 101 { 98 102 $rsp->status = 'failed'; 99 103 $rsp->message(__('noodles failed because of missing informations')); … … 101 105 return false; 102 106 } 103 104 try {105 $__noodles =106 noodles::decode($core->blog->settings->noodles_object);107 107 108 try 109 { 110 $__noodles = noodles::decode($core->blog->settings->noodles->noodles_object); 111 108 112 if ($__noodles->isEmpty()) 113 { 109 114 $__noodles = $GLOBALS['__default_noodles']; 110 111 } catch(Excetpion $e) { 115 } 116 } 117 catch(Excetpion $e) 118 { 112 119 $rsp->status = 'failed'; 113 120 $rsp->message(__('Failed to load default noodles')); … … 115 122 return false; 116 123 } 117 118 if (!$__noodles->exists($i)) { 124 125 if (!$__noodles->exists($i)) 126 { 119 127 $rsp->status = 'failed'; 120 128 $rsp->message(__('Failed to load noodle')); … … 122 130 return false; 123 131 } 124 132 125 133 $m = $__noodles->{$i}->jsCallback($__noodles->{$i},$c); 126 134 127 135 $s = $__noodles->{$i}->size; 128 136 $r = $__noodles->{$i}->rating; 129 $d = $core->blog->settings->noodles _image ?130 urlencode( libImagePath::getUrl($core,'noodles')) : '';131 137 $d = $core->blog->settings->noodles->noodles_image ? 138 urlencode(noodlesLibImagePath::getUrl($core,'noodles')) : ''; 139 132 140 if (!$m) $m = 'nobody@nowhere.tld'; 133 141 if (!$s) $s = 32; 134 142 if (!$r) $r = 'g'; 135 143 136 144 $im = new xmlTag('noodle'); 137 145 $im->size = $s; 138 146 $im->src = 'http://www.gravatar.com/avatar/'.md5($m).'?s='.$s.'&r='.$r.'&d='.$d; 139 147 $rsp->insertNode($im); 140 148 141 149 $rsp->status = 'ok'; 142 150 echo $rsp->toXML(1); … … 148 156 global $core; 149 157 150 if (!$core->blog->settings->noodles_active) { 151 self::p404(); 152 return; 153 } 154 155 if (!preg_match('#^(.*?)$#',$args,$m)) { 158 if (!$core->blog->settings->noodles->noodles_active) 159 { 160 self::p404(); 161 return; 162 } 163 164 if (!preg_match('#^(.*?)$#',$args,$m)) 165 { 156 166 self::p404(); 157 167 return; … … 159 169 160 170 $f = $m[1]; 161 if (strstr($f,"..") !== false) { 162 self::p404(); 163 return; 164 } 165 171 172 if (!($f = self::searchTplFiles($f))) 173 { 174 self::p404(); 175 return; 176 } 177 166 178 $allowed_types = array('png','jpg','jpeg','gif','css','js','swf'); 167 if (!in_array(files::getExtension($f),$allowed_types)) { 168 self::p404(); 169 return; 170 } 171 172 self::serveDocument($args); 173 return; 179 if (!in_array(files::getExtension($f),$allowed_types)) 180 { 181 self::p404(); 182 return; 183 } 184 $type = files::getMimeType($f); 185 186 header('Content-Type: '.$type.'; charset=UTF-8'); 187 header('Content-Length: '.filesize($f)); 188 189 if ($type != "text/css" || $core->blog->settings->system->url_scan == 'path_info') 190 { 191 readfile($f); 192 } 193 else 194 { 195 echo preg_replace('#url\((?!(http:)|/)#','url('.$core->blog->url.$core->url->getBase('noodlesmodule').'/',file_get_contents($f)); 196 } 197 exit; 198 } 199 200 # Search noodles files like JS, CSS in default-templates subdirectories 201 private static function searchTplFiles($file) 202 { 203 if (strstr($file,"..") !== false) 204 { 205 return false; 206 } 207 $paths = $GLOBALS['core']->tpl->getPath(); 208 209 foreach($paths as $path) 210 { 211 if (preg_match('/tpl(\/|)$/',$path)) 212 { 213 $path = path::real($path.'/..'); 214 } 215 if (file_exists($path.'/'.$file)) 216 { 217 return $path.'/'.$file; 218 } 219 } 220 return false; 174 221 } 175 222 } -
plugins/noodles/_uninstall.php
r1485 r2387 32 32 /* action */ 'delete_all', 33 33 /* ns */ 'noodles', 34 /* description */ __('delete all noodles settings')34 /* description */ sprintf(__('delete all %s settings'),'noodles') 35 35 ); 36 36 … … 39 39 /* action */ 'delete', 40 40 /* ns */ 'noodles', 41 /* description */ __('delete noodles plugin files')41 /* description */ sprintf(__('delete %s plugin files'),'noodles') 42 42 ); 43 43 -
plugins/noodles/default-templates/js/jquery.noodles.js
r1485 r2387 24 24 25 25 var cur_line = $(target); 26 var content = $(target).get();26 var content = encodeURIComponent($(target).get()); 27 27 28 $.post(service_url,{ f:service_func,noodleContent:content,noodleId:imgId},28 $.post(service_url,{noodleContent:content,noodleId:imgId}, 29 29 function(data){ 30 30 data=$(data); 31 if(data.find('rsp').attr('status')=='ok' && $(data).find('noodle').attr('src')) {32 31 if(data.find('rsp').attr('status')=='ok' && $(data).find('noodle').attr('src')) 32 { 33 33 var size = $(data).find('noodle').attr('size')+'px'; 34 34 var res = $('<img src="'+$(data).find('noodle').attr('src')+'" alt="" />'); … … 44 44 $(cur_line).after($(res)); 45 45 } 46 /* else { 47 alert($(data).find('message').text()); 48 } 49 //*/ } 46 } 50 47 ); 51 48 return target; -
plugins/noodles/inc/_default_noodles.php
r1740 r2387 55 55 # Plugin auhtorMode 56 56 if ($core->plugins->moduleExists('authorMode') 57 && $core->blog->settings->authormode _active) {57 && $core->blog->settings->authormode->authormode_active) { 58 58 59 59 $__default_noodles->add('authorswidget',__('Authors widget'),array('authormodeNoodles','authors')); … … 76 76 # Plugin rateIt 77 77 if ($core->plugins->moduleExists('rateIt') 78 && $core->blog->settings->rateit _active) {78 && $core->blog->settings->rateit->rateit_active) { 79 79 80 80 $__default_noodles->add('rateitpostsrank',__('Top rated entries'),array('genericNoodles','postURL')); -
plugins/noodles/inc/_noodles_functions.php
r1399 r2387 18 18 { 19 19 global $core; 20 20 21 21 $types = $core->getPostTypes(); 22 22 $reg = '@^'.str_replace('%s','(.*?)', 23 23 preg_quote($core->blog->url.$types['post']['public_url'])).'$@'; 24 24 25 25 $ok = preg_match($reg,$content,$m); 26 26 27 27 if (!$ok || !$m[1]) return ''; 28 28 29 29 $rs = $core->blog->getPosts( 30 array('no_content'=>1,'post_url'=>urldecode($m[1]),'limit'=>1)); 31 30 array('no_content'=>1,'post_url'=>urldecode($m[1]),'limit'=>1) 31 ); 32 32 33 if ($rs->isEmpty()) return ''; 33 34 34 35 return $rs->user_email; 35 36 } … … 42 43 { 43 44 if (!$noodle->active) return; 44 45 45 46 $bhv = $noodle->place == 'prepend' || $noodle->place == 'before' ? 46 47 'publicEntryBeforeContent' : 'publicEntryAfterContent'; 47 48 48 49 $core->addBehavior($bhv,array('othersNoodles','publicEntryContent')); 49 50 } 50 51 51 52 public static function publicEntryContent() 52 53 { 53 54 global $core,$_ctx,$__noodles; 54 55 55 56 $m = $_ctx->posts->getAuthorEmail(false); 56 57 $c = $__noodles->posts->css; 57 58 $s = $__noodles->posts->size; 58 59 $r = $__noodles->posts->rating; 59 $d = $core->blog->settings->noodles _image ?60 urlencode( libImagePath::getUrl($core,'noodles')) : '';61 60 $d = $core->blog->settings->noodles->noodles_image ? 61 urlencode(noodlesLibImagePath::getUrl($core,'noodles')) : ''; 62 62 63 echo 63 64 '<img class="noodles-posts" style="width:'.$s.'px;height:'.$s.'px;'.$c.'"'. … … 69 70 { 70 71 if (!$noodle->active) return; 71 72 72 73 $bhv = $noodle->place == 'prepend' || $noodle->place == 'before' ? 73 74 'publicCommentBeforeContent' : 'publicCommentAfterContent'; 74 75 75 76 $core->addBehavior($bhv,array('othersNoodles','publicCommentContent')); 76 77 } 77 78 78 79 public static function publicCommentContent() 79 80 { 80 81 global $core,$_ctx,$__noodles; 81 82 82 83 $m = $_ctx->comments->getEmail(false); 83 84 $c = $__noodles->comments->css; 84 85 $s = $__noodles->comments->size; 85 86 $r = $__noodles->comments->rating; 86 $d = $core->blog->settings->noodles _image ?87 urlencode( libImagePath::getUrl($core,'noodles')) : '';88 87 $d = $core->blog->settings->noodles->noodles_image ? 88 urlencode(noodlesLibImagePath::getUrl($core,'noodles')) : ''; 89 89 90 echo 90 91 '<img class="noodles-comments" style="width:'.$s.'px;height:'.$s.'px;'.$c.'"'. … … 100 101 { 101 102 global $core; 102 103 103 104 $ok = preg_match('@\#c([0-9]+)$@',urldecode($content),$m); 104 105 105 106 if (!$ok || !$m[1]) return ''; 106 107 107 108 $rs = $core->blog->getComments( 108 array('no_content'=>1,'comment_id'=>$m[1],'limit'=>1)); 109 109 array('no_content'=>1,'comment_id'=>$m[1],'limit'=>1) 110 ); 111 110 112 if (!$rs->isEmpty()) return $rs->comment_email; 111 113 112 114 return ''; 113 115 } … … 121 123 global $core; 122 124 $ok = preg_match('@\/([^\/]*?)$@',$content,$m); 123 125 124 126 if (!$ok || !$m[1]) return ''; 125 127 126 128 $rs = $core->getUser($m[1]); 127 129 128 130 if ($rs->isEmpty()) return ''; 129 131 130 132 return $rs->user_email; 131 133 } 132 134 133 135 public static function author($core,$noodle) 134 136 { 135 if ($noodle->active) 137 if ($noodle->active) 138 { 136 139 $core->addBehavior('publicHeadContent', 137 140 array('authormodeNoodles','publicHeadContent')); 141 } 138 142 } 139 143 140 144 public static function publicHeadContent() 141 145 { 142 146 global $core,$_ctx,$__noodles; 143 147 144 148 if ($_ctx->current_tpl != 'author.html') return; 145 149 146 150 $id = $_ctx->users->user_id; 147 151 $u = $core->getUser($id); … … 150 154 $s = $__noodles->author->size; 151 155 $r = $__noodles->author->rating; 152 $d = $core->blog->settings->noodles _image ?153 urlencode( libImagePath::getUrl($core,'noodles')) : '';154 156 $d = $core->blog->settings->noodles->noodles_image ? 157 urlencode(noodlesLibImagePath::getUrl($core,'noodles')) : ''; 158 155 159 echo 156 160 '<script type="text/javascript">'."\n". -
plugins/noodles/inc/class.noodles.php
r1399 r2387 16 16 { 17 17 private $noodles = array(); 18 18 19 19 public static function decode($s) 20 20 { … … 23 23 return new self; 24 24 } 25 25 26 26 public function encode() 27 27 { 28 28 return base64_encode(serialize($this)); 29 29 } 30 30 31 31 public function add($id,$name,$js_callback,$php_callback=null) 32 32 { 33 33 $this->noodles[$id] = new noodle($id,$name,$js_callback,$php_callback); 34 34 } 35 35 36 36 public function __get($id) 37 37 { 38 38 return isset($this->noodles[$id]) ? $this->noodles[$id] : null; 39 39 } 40 40 41 41 public function __set($id,$noodle) 42 42 { 43 43 return $this->noodles[$id] = $noodle; 44 44 } 45 45 46 46 public function exists($id) 47 47 { 48 48 return isset($this->noodles[$id]); 49 49 } 50 50 51 51 public function isEmpty() 52 52 { 53 53 return !count($this->noodles); 54 54 } 55 55 56 56 public function noodles() 57 57 { … … 73 73 'place' => 'prepend' 74 74 ); 75 75 76 76 public function __construct($id,$name,$js_callback,$php_callback=null) 77 77 { … … 81 81 $this->php_callback = $php_callback; 82 82 } 83 83 84 84 public function id() 85 85 { 86 86 return $this->id; 87 87 } 88 88 89 89 public function name() 90 90 { 91 91 return $this->name; 92 92 } 93 93 94 94 public function jsCallback($g,$content='') 95 95 { … … 97 97 return call_user_func($this->js_callback,$g,$content); 98 98 } 99 99 100 100 public function hasJsCallback() 101 101 { 102 102 return !empty($this->js_callback); 103 103 } 104 104 105 105 public function phpCallback($core) 106 106 { … … 108 108 return call_user_func($this->php_callback,$core,$this); 109 109 } 110 110 111 111 public function hasPhpCallback() 112 112 { 113 113 return !empty($this->php_callback); 114 114 } 115 115 116 116 public function set($type,$value) 117 117 { 118 switch ($type) { 119 case 'active': 118 switch ($type) 119 { 120 case 'active': 120 121 $this->settings['active'] = abs((integer) $value); 121 122 break; 122 case 'rating': 123 124 case 'rating': 123 125 $this->settings['rating'] = in_array($value,array('g','pg','r','x')) ? 124 126 $value : 'g'; 125 127 break; 126 case 'size': 128 129 case 'size': 127 130 $this->settings['size'] = 128 131 in_array($value,array(16,24,32,48,56,64,92,128,256)) ? 129 132 $value : 16; 130 133 break; 131 case 'css': 134 135 case 'css': 132 136 $this->settings['css'] = (string) $value; 133 137 break; 134 case 'target': 138 139 case 'target': 135 140 $this->settings['target'] = (string) $value; 136 141 break; 137 case 'place': 142 143 case 'place': 138 144 $this->settings['place'] = 139 145 in_array($value,array('append','prepend','before','after')) ? … … 142 148 } 143 149 } 144 150 145 151 public function __set($type,$value) 146 152 { 147 153 $this->set($type,$value); 148 154 } 149 155 150 156 public function get($type) 151 157 { 152 158 return isset($this->settings[$type]) ? $this->settings[$type] : null; 153 159 } 154 160 155 161 public function __get($type) 156 162 { -
plugins/noodles/inc/lib.image.path.php
r1399 r2387 12 12 # -- END LICENSE BLOCK ------------------------------------ 13 13 14 class libImagePath14 class noodlesLibImagePath 15 15 { 16 public static $version = '1. 0';16 public static $version = '1.1'; 17 17 18 18 public static function getArray($core,$m='') … … 29 29 return array( 30 30 'theme' => array( 31 'dir' => $core->blog->themes_path.'/'.$core->blog->settings-> theme.'/img/'.$m.'-default-image.png',32 'url' => $core->blog->settings-> themes_url.$core->blog->settings->theme.'/img/'.$m.'-default-image.png'31 'dir' => $core->blog->themes_path.'/'.$core->blog->settings->system->theme.'/img/'.$m.'-default-image.png', 32 'url' => $core->blog->settings->system->themes_url.$core->blog->settings->system->theme.'/img/'.$m.'-default-image.png' 33 33 ), 34 34 'public' => array( 35 35 'dir' => $core->blog->public_path.'/'.$m.'-default-image.png', 36 'url' => $core->blog->host.path::clean($core->blog->settings-> public_url).'/'.$m.'-default-image.png'36 'url' => $core->blog->host.path::clean($core->blog->settings->system->public_url).'/'.$m.'-default-image.png' 37 37 ), 38 38 'module' => array( -
plugins/noodles/index.php
r1740 r2387 15 15 dcPage::check('admin'); 16 16 17 $s = $core->blog->settings->noodles; 17 18 $msg = isset($_POST['done']) ? __('Configuration successfully updated') : ''; 18 $tab = isset($_REQUEST['t ']) ? $_REQUEST['t'] : 'blocs';19 $tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'blocs'; 19 20 $img_green = '<img alt="%s" src="images/check-on.png" />'; 20 21 $img_red = '<img alt="%s" src="images/check-off.png" />'; … … 22 23 include dirname(__FILE__).'/inc/_default_noodles.php'; 23 24 24 $__noodles = noodles::decode($core->blog->settings->noodles_object); 25 26 if ($__noodles->isEmpty()) { 25 $__noodles = noodles::decode($s->noodles_object); 26 27 if ($__noodles->isEmpty()) 28 { 27 29 $__noodles = $__default_noodles; 28 29 } else { 30 } 31 else 32 { 30 33 $default_noodles_array = $__default_noodles->noodles(); 31 foreach($default_noodles_array AS $id => $noodle) { 34 foreach($default_noodles_array AS $id => $noodle) 35 { 32 36 if ($__noodles->exists($id)) continue; 33 37 $__noodles->{$id} = $noodle; … … 35 39 } 36 40 37 if (!$core->blog->settings->noodles_active) 41 if (!$s->noodles_active) 42 { 38 43 $tab = 'settings'; 44 } 39 45 40 46 $default_avatars_images = files::scandir(dirname(__FILE__).'/default-templates/img/'); 41 $avatar_paths = libImagePath::getArray($core,'noodles');47 $avatar_paths = noodlesLibImagePath::getArray($core,'noodles'); 42 48 43 49 $combo_active = array( … … 69 75 ); 70 76 71 if (!empty($_POST['save']) && isset($_POST['t']) && $_POST['t'] == 'settings') {72 try{73 $core->blog->settings->setNamespace('noodles');74 $core->blog->settings->put('noodles_active',$_POST['noodles_active'],75 'boolean','noodles plugin enabled',true,false);76 77 # Destination image according to libImagePath()78 $dest_file = DC_ROOT.'/'.$ core->blog->settings->public_path.'/noodles-default-image.png';77 if (!empty($_POST['save']) && $tab == 'settings') 78 { 79 try 80 { 81 $s->put('noodles_active',$_POST['noodles_active'],'boolean'); 82 83 # Destination image according to noodlesLibImagePath() 84 $dest_file = DC_ROOT.'/'.$s->public_path.'/noodles-default-image.png'; 79 85 80 86 # user upload image 81 if ($_POST['noodles_image'] == 'user') {82 87 if ($_POST['noodles_image'] == 'user') 88 { 83 89 if (2 == $_FILES['noodlesuserfile']['error']) 90 { 84 91 throw new Exception(__('Maximum file size exceeded')); 85 92 } 86 93 if ($_FILES['noodlesuserfile']['type'] != 'image/x-png') 94 { 87 95 throw new Exception(__('Image must be in png format')); 88 96 } 89 97 if (0 != $_FILES['noodlesuserfile']['error']) 98 { 90 99 throw new Exception(__('Something went wrong while download file')); 91 100 } 92 101 if ($_FILES['noodlesuserfile']['type'] != 'image/x-png') 102 { 93 103 throw new Exception(__('Image must be in png format')); 94 95 if (move_uploaded_file($_FILES['noodlesuserfile']['tmp_name'],$dest_file)) {96 $core->blog->settings->put('noodles_image',1,97 'boolean','noodles uses default gravatar.com image',true,false);98 } 99 104 } 105 if (move_uploaded_file($_FILES['noodlesuserfile']['tmp_name'],$dest_file)) 106 { 107 $s->put('noodles_image',1,'boolean'); 108 } 109 } 100 110 # Default gravatar.com avatar 101 } elseif ($_POST['noodles_image'] == 'gravatar.com') {102 $core->blog->settings->put('noodles_image',0,103 'boolean','noodles uses default gravatar.com image',true,false);104 111 elseif ($_POST['noodles_image'] == 'gravatar.com') 112 { 113 $s->put('noodles_image',0,'boolean'); 114 } 105 115 # existsing noodles image on blog 106 } elseif ($_POST['noodles_image'] == 'existsing') {107 $core->blog->settings->put('noodles_image',1,108 'boolean','noodles uses default gravatar.com image',true,false);109 116 elseif ($_POST['noodles_image'] == 'existsing') 117 { 118 $s->put('noodles_image',1,'boolean'); 119 } 110 120 # noodles image 111 } elseif (preg_match('/^gravatar-[0-9]+.png$/',$_POST['noodles_image'])) {112 121 elseif (preg_match('/^gravatar-[0-9]+.png$/',$_POST['noodles_image'])) 122 { 113 123 $source = dirname(__FILE__).'/default-templates/img/'.$_POST['noodles_image']; 114 124 115 125 if (!file_exists($source)) 126 { 116 127 throw new Exception(__('Something went wrong while search file')); 117 118 if (file_put_contents($dest_file,file_get_contents($source))) {119 $core->blog->settings->put('noodles_image',1,120 'boolean','noodles uses default gravatar.com image',true,false);121 } 122 } 123 128 } 129 if (file_put_contents($dest_file,file_get_contents($source))) 130 { 131 $s->put('noodles_image',1,'boolean'); 132 } 133 } 134 124 135 $core->blog->triggerBlog(); 125 http::redirect('plugin.php?p=noodles&t=settings&done=1'); 126 } 127 catch (Exception $e) { 136 http::redirect('plugin.php?p=noodles&tab=settings&done=1'); 137 } 138 catch (Exception $e) 139 { 128 140 $core->error->add($e->getMessage()); 129 141 } 130 142 } 131 143 132 if (!empty($_POST['save']) && isset($_POST['t']) && $_POST['t'] == 'blocs' 133 && !empty($_POST['noodle'])) { 134 try { 135 $core->blog->settings->setNamespace('noodles'); 144 if (!empty($_POST['save']) && $tab == 'blocs' && !empty($_POST['noodle'])) 145 { 146 try 147 { 148 foreach($_POST['noodle'] as $id => $s) 149 { 150 foreach($s as $k => $v) 151 { 152 $__noodles->{$id}->set($k,$v); 153 } 154 } 155 $s->put('noodles_object',$__noodles->encode(),'string'); 136 156 137 foreach($_POST['noodle'] as $id => $s) {138 foreach($s as $k => $v) {139 $__noodles->{$id}->set($k,$v);140 }141 }142 $core->blog->settings->put('noodles_object',$__noodles->encode(),143 'string','noodles object',true,false);144 145 157 $core->blog->triggerBlog(); 146 http::redirect('plugin.php?p=noodles&t=blocs&done=1'); 147 } 148 catch (Exception $e) { 158 http::redirect('plugin.php?p=noodles&tab=blocs&done=1'); 159 } 160 catch (Exception $e) 161 { 149 162 $core->error->add($e->getMessage()); 150 163 } 151 164 } 152 165 153 if (!empty($_POST['reset']) && isset($_POST['t']) && $_POST['t'] == 'blocs') {154 try{155 $core->blog->settings->setNamespace('noodles');156 $core->blog->settings->put('noodles_object','',157 'string','noodles object',true,false);166 if (!empty($_POST['reset']) && $tab == 'blocs') 167 { 168 try 169 { 170 $s->put('noodles_object','','string'); 158 171 $core->blog->triggerBlog(); 159 http::redirect('plugin.php?p=noodles&t=blocs&done=1'); 160 } 161 catch (Exception $e) { 172 http::redirect('plugin.php?p=noodles&tab=blocs&done=1'); 173 } 174 catch (Exception $e) 175 { 162 176 $core->error->add($e->getMessage()); 163 177 } … … 175 189 (!empty($msg) ? '<p class="message">'.$msg.'</p>' : ''); 176 190 177 if ($core->blog->settings->noodles_active) {178 179 191 # Blocs 180 echo 181 '<div class="multi-part" id="blocs" title="'.__('Controls').'">'. 182 '<form method="post" action="plugin.php">'. 183 '<table><tr>'. 184 '<th>'.__('Name').'</th>'. 185 '<th>'.__('Enable').'</th>'. 186 '<th>'.__('Size').'</th>'. 187 '<th>'.__('Rating').'</th>'. 188 '<th>'.__('php').'</th>'. 189 '<th>'.__('js').'</th>'. 190 '<th>'.__('Target').'</th>'. 191 '<th>'.__('Place').'</th>'. 192 '<th>'.__('Adjust avatar CSS').'</th></tr>'; 193 194 foreach($__noodles->noodles() as $noodle) { 195 echo 196 '<tr class="line">'. 197 '<td class="nowrap">'.$noodle->name().'</td>'. 198 '<td>'.form::combo(array('noodle['.$noodle->id().'][active]'),$combo_active,$noodle->active).'</td>'. 199 '<td>'.form::combo(array('noodle['.$noodle->id().'][size]'),$combo_size,$noodle->size).'</td>'. 200 '<td>'.form::combo(array('noodle['.$noodle->id().'][rating]'),$combo_rating,$noodle->rating).'</td>'. 201 '<td>'.($noodle->hasPhpCallback() ? $img_green : $img_red).'</td>'. 202 '<td>'.$img_green.'</td>'. 203 '<td>'.form::field(array('noodle['.$noodle->id().'][target]'),20,255,$noodle->target).'</td>'. 204 '<td>'.form::combo(array('noodle['.$noodle->id().'][place]'),$combo_place,$noodle->place).'</td>'. 205 '<td class="maximal">'. 206 form::textArea(array('noodle['.$noodle->id().'][css]'),50,2,$noodle->css). 207 ' .noodles-'.$noodle->id().'{}</td>'. 208 '</tr>'; 209 } 210 echo 211 '</table>'. 212 '<p>'. 213 form::hidden(array('p'),'noodles'). 214 form::hidden(array('t'),'blocs'). 215 $core->formNonce(). 216 '<input type="submit" name="save" value="'.__('Save').'" /> '. 217 '<input type="submit" name="reset" value="'.__('Reset').'" /></p>'. 218 '</form>'. 219 '</div>'; 220 221 } //endif ($core->blog->settings->noodles_active) 192 if ($s->noodles_active) 193 { 194 echo 195 '<div class="multi-part" id="blocs" title="'.__('Controls').'">'. 196 '<form method="post" action="plugin.php">'. 197 '<table><thead><tr>'. 198 '<th class="nowrap">'.__('Name').'</th>'. 199 '<th class="nowrap">'.__('Enable').'</th>'. 200 '<th class="nowrap">'.__('Size').'</th>'. 201 '<th class="nowrap">'.__('Rating').'</th>'. 202 '<th class="nowrap">'.__('PHP').'</th>'. 203 '<th class="nowrap">'.__('JS').'</th>'. 204 '<th class="nowrap">'.__('JS target').'</th>'. 205 '<th class="nowrap">'.__('JS place').'</th>'. 206 '<th class="nowrap">'.__('Adjust avatar CSS').'</th>'. 207 '</tr></thead>'; 208 209 foreach($__noodles->noodles() as $noodle) 210 { 211 echo 212 '<tr class="line">'. 213 '<td class="nowrap">'.$noodle->name().'</td>'. 214 '<td>'.form::combo(array('noodle['.$noodle->id().'][active]'),$combo_active,$noodle->active).'</td>'. 215 '<td>'.form::combo(array('noodle['.$noodle->id().'][size]'),$combo_size,$noodle->size).'</td>'. 216 '<td>'.form::combo(array('noodle['.$noodle->id().'][rating]'),$combo_rating,$noodle->rating).'</td>'. 217 '<td>'.($noodle->hasPhpCallback() ? $img_green : $img_red).'</td>'. 218 '<td>'.$img_green.'</td>'. 219 '<td>'.form::field(array('noodle['.$noodle->id().'][target]'),20,255,$noodle->target).'</td>'. 220 '<td>'.form::combo(array('noodle['.$noodle->id().'][place]'),$combo_place,$noodle->place).'</td>'. 221 '<td class="maximal">'. 222 form::textArea(array('noodle['.$noodle->id().'][css]'),50,2,$noodle->css). 223 ' .noodles-'.$noodle->id().'{}</td>'. 224 '</tr>'; 225 } 226 echo 227 '</table>'. 228 '<p>'. 229 form::hidden(array('p'),'noodles'). 230 form::hidden(array('tab'),'blocs'). 231 $core->formNonce(). 232 '<input type="submit" name="save" value="'.__('Save').'" /> '. 233 '<input type="submit" name="reset" value="'.__('Reset').'" /></p>'. 234 '</form>'. 235 '</div>'; 236 } 222 237 223 238 # Settings … … 225 240 '<div class="multi-part" id="settings" title="'.__('Settings').'">'. 226 241 '<form method="post" action="plugin.php" enctype="multipart/form-data">'. 227 '<div class="two-cols">'. 228 '<div class="col">'. 229 '<h2>'.__('Options').'</h2>'. 230 '<table>'. 231 '<tr><th colspan="2">'.__('Extension').'</th></tr>'. 232 '<tr><td>'.__('Enable plugin').'</td><td>'. 233 form::combo(array('noodles_active'),$combo_active, 234 $core->blog->settings->noodles_active).'</td></tr>'. 235 '<tr><th colspan="2">'.__('URL prefix').'</th></tr>'. 236 '<tr><td>'.__('Files').'</td><td>'. 237 '</table>'. 238 '</div>'. 239 '<div class="col">'. 240 '<h2>'.__('Default avatar').'</h2>'. 242 '<fieldset id="settings-plugin"><legend>'.__('Options').'</legend>'. 243 '<p class="field"><label>'. 244 form::combo(array('noodles_active'),$combo_active,$s->noodles_active).' '. 245 __('Enable plugin').'</label></p>'. 246 247 '</fieldset>'. 248 '<fieldset id="setting-avatar"><legend>'.__('Default avatar').'</legend>'. 241 249 '<table><tr><th> </th><th>'.__('Avatar').'</th><th>'.__('size').'</th></tr>'. 242 250 '<tr class="line">'; 243 251 244 252 // By default use gravatar.com image 245 $default = !$core->blog->settings->noodles_image;253 $default = '' == $s->noodles_image; 246 254 247 255 echo 248 '<td>'.form::radio(array('noodles_image'),'gravatar.com',$default).'</td>'. 249 '<td>'.__('gravatar.com default image').'</td>'. 256 '<td colspan="2"><label class="classic">'. 257 form::radio(array('noodles_image'),'gravatar.com',$default). 258 __('gravatar.com default image').'</label></td>'. 250 259 '<td></td>'. 251 260 '</tr>'; 252 261 253 if (!$default) { 262 if (!$default) 263 { 254 264 $exists = false; 255 265 256 266 // then use theme image 257 if (file_exists($avatar_paths['theme']['dir'])) { 267 if (file_exists($avatar_paths['theme']['dir'])) 268 { 258 269 $exists = $avatar_paths['theme']; 259 270 } 260 271 // then public image 261 } elseif (file_exists($avatar_paths['public']['dir'])) { 272 elseif (file_exists($avatar_paths['public']['dir'])) 273 { 262 274 $exists = $avatar_paths['public']; 263 275 } 264 276 // then module 265 } elseif (file_exists($avatar_paths['module']['dir'])) { 277 elseif (file_exists($avatar_paths['module']['dir'])) 278 { 266 279 $exists = $avatar_paths['module']; 267 268 }269 if ($exists){280 } 281 if ($exists) 282 { 270 283 $s = getimagesize($exists['dir']); 271 284 $s[2] = files::size(filesize($exists['dir'])); 285 272 286 echo 273 287 '<tr class="line">'. 274 '<td>'.form::radio(array('noodles_image'),'existing',1).'</td>'. 288 '<td><label class="classic">'.form::radio(array('noodles_image'),'existing',1). 289 basename($exists['dir']).'</label></td>'. 275 290 '<td><img src="'.$exists['url'].'" alt="" /></td>'. 276 291 '<td>'.$s[0].'x'.$s[1].'<br />'.$s[2].'</td>'. … … 281 296 // noodles avatars 282 297 sort($default_avatars_images); 283 foreach($default_avatars_images AS $f) { 298 foreach($default_avatars_images AS $f) 299 { 284 300 if (!preg_match('/gravatar-[0-9]+.png/',$f)) continue; 285 301 $s = getimagesize(dirname(__FILE__).'/default-templates/img/'.$f); 286 302 $s[2] = files::size(filesize(dirname(__FILE__).'/default-templates/img/'.$f)); 303 287 304 echo 288 305 '<tr class="line">'. 289 '<td>'.form::radio(array('noodles_image'),$f).'</td>'. 306 '<td><label class="classic">'.form::radio(array('noodles_image'),$f). 307 basename($f).'</label></td>'. 290 308 '<td><img src="index.php?pf=noodles/default-templates/img/'.$f.'" alt="" /></td>'. 291 309 '<td>'.$s[0].'x'.$s[1].'<br />'.$s[2].'</td>'. … … 302 320 '</table>'. 303 321 '<p class="form-note">* '.__('Image must be in "png" format and have a maximum file size of 30Ko').'</p>'. 304 '</div>'. 305 '</div>'. 322 '</fieldset>'. 306 323 '<p>'. 307 324 form::hidden(array('p'),'noodles'). 308 form::hidden(array('t '),'settings').325 form::hidden(array('tab'),'settings'). 309 326 $core->formNonce(). 310 327 '<input type="submit" name="save" value="'.__('Save').'" /></p>'. -
plugins/noodles/locales/fr/main.lang.php
r1399 r2387 1 1 <?php 2 // Language: français 3 // Module: noodles - 0.4 4 // Date: 2009-08-16 21:44:26 5 // Author: JC Denis, jcdenis@gdwd.com 6 // Translated with dcTranslater - 0.2.4 2 // Language: Français 3 // Module: noodles - 0.5.1 4 // Date: 2010-06-22 14:45:25 5 // Translated with dcTranslater - 1.4 7 6 8 7 #inc/_default_noodles.php:32 … … 12 11 $GLOBALS['__l10n']['Authors widget'] = 'Widgets des auteurs'; 13 12 14 #index.php: 4813 #index.php:54 15 14 $GLOBALS['__l10n']['Begin'] = 'Début'; 16 15 17 #index.php: 4916 #index.php:55 18 17 $GLOBALS['__l10n']['End'] = 'Fin'; 19 18 20 #index.php:5 019 #index.php:56 21 20 $GLOBALS['__l10n']['Before'] = 'Avant'; 22 21 23 #index.php:5 122 #index.php:57 24 23 $GLOBALS['__l10n']['After'] = 'Après'; 25 24 26 #index.php: 8825 #index.php:91 27 26 $GLOBALS['__l10n']['Maximum file size exceeded'] = 'Taille maximum de fichier dépassée'; 28 27 29 #index.php:97 28 #index.php:95 29 #index.php:103 30 30 $GLOBALS['__l10n']['Image must be in png format'] = 'L\'image doit être au format png'; 31 31 32 #index.php:9 433 $GLOBALS['__l10n']['Something went wrong while download file'] = 'Une erreur est survenue lors d etéléchargement de l\'image';32 #index.php:99 33 $GLOBALS['__l10n']['Something went wrong while download file'] = 'Une erreur est survenue lors du téléchargement de l\'image'; 34 34 35 #index.php:1 8536 $GLOBALS['__l10n'][' Controls'] = 'Controles';35 #index.php:127 36 $GLOBALS['__l10n']['Something went wrong while search file'] = 'Une erreur est survenue pendant la recherche de fichier'; 37 37 38 #index.php:189 38 #index.php:195 39 $GLOBALS['__l10n']['Controls'] = 'Contrôles'; 40 41 #index.php:198 42 $GLOBALS['__l10n']['Name'] = 'Nom'; 43 44 #index.php:199 39 45 $GLOBALS['__l10n']['Enable'] = 'Activer'; 40 46 41 #index.php: 19047 #index.php:200 42 48 $GLOBALS['__l10n']['Size'] = 'Taille'; 43 49 44 #index.php: 19150 #index.php:201 45 51 $GLOBALS['__l10n']['Rating'] = 'Évaluation'; 46 52 47 #index.php: 19448 $GLOBALS['__l10n'][' Target'] = 'Cible';53 #index.php:204 54 $GLOBALS['__l10n']['JS target'] = 'Cible JS'; 49 55 50 #index.php: 19551 $GLOBALS['__l10n'][' Place'] = 'Emplacement';56 #index.php:205 57 $GLOBALS['__l10n']['JS place'] = 'Emplacement JS'; 52 58 53 #index.php: 19654 $GLOBALS['__l10n']['Adjust avatar CSS'] = 'Ajuster l eCSS de l\'image';59 #index.php:206 60 $GLOBALS['__l10n']['Adjust avatar CSS'] = 'Ajuster la CSS de l\'image'; 55 61 56 #index.php:2 2162 #index.php:233 57 63 $GLOBALS['__l10n']['Reset'] = 'RAZ'; 58 64 59 #index.php:2 2965 #index.php:240 60 66 $GLOBALS['__l10n']['Settings'] = 'Paramètres'; 61 67 62 #index.php:235 63 $GLOBALS['__l10n']['Extension'] = 'Extension'; 64 65 #index.php:236 68 #index.php:245 66 69 $GLOBALS['__l10n']['Enable plugin'] = 'Activer l\'extension'; 67 70 68 #index.php:239 69 $GLOBALS['__l10n']['URL prefix'] = 'Prefix des liens'; 70 71 #index.php:240 72 $GLOBALS['__l10n']['Files'] = 'Fichiers'; 71 #index.php:248 72 $GLOBALS['__l10n']['Default avatar'] = 'Avatar par défaut'; 73 73 74 74 #index.php:249 75 $GLOBALS['__l10n']['Default avatar'] = 'Avatar par défaut';76 77 #index.php:25078 75 $GLOBALS['__l10n']['size'] = 'taille'; 79 76 80 77 #index.php:258 81 $GLOBALS['__l10n']['gravatar.com default image'] = 'Image par d efault de gravatar.com';78 $GLOBALS['__l10n']['gravatar.com default image'] = 'Image par défaut de gravatar.com'; 82 79 83 #index.php:3 1284 $GLOBALS['__l10n']['Image must be in "png" format and ha sa maximum file size of 30Ko'] = 'L\'image doit être au format "png" et avoir une taille maximum de 30Ko';80 #index.php:321 81 $GLOBALS['__l10n']['Image must be in "png" format and have a maximum file size of 30Ko'] = 'L\'image doit être au format "png" et avoir une taille maximum de 30Ko'; 85 82 86 83 ?> -
plugins/noodles/locales/fr/main.po
r1740 r2387 1 # Language: français2 # Module: noodles - 0. 43 # Date: 20 09-08-16 21:44:264 # Author: JC Denis, jcdenis@gdwd.com5 # Translated with dcTranslater - 0.2.4 1 # Language: Français 2 # Module: noodles - 0.5.1 3 # Date: 2010-06-22 14:45:25 4 # Translated with translater 1.4 5 6 6 msgid "" 7 7 msgstr "" 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 "Project-Id-Version: \n"9 "Project-Id-Version: noodles 0.5.1\n" 10 10 "POT-Creation-Date: \n" 11 "PO-Revision-Date: \n"12 "Last-Translator: Kozlika <kozlika@free.fr>\n"11 "PO-Revision-Date: 2010-06-22T14:45:25+00:00\n" 12 "Last-Translator: JC Denis\n" 13 13 "Language-Team: \n" 14 14 "MIME-Version: 1.0\n" … … 23 23 msgstr "Widgets des auteurs" 24 24 25 #: index.php: 4825 #: index.php:54 26 26 msgid "Begin" 27 27 msgstr "Début" 28 28 29 #: index.php: 4929 #: index.php:55 30 30 msgid "End" 31 31 msgstr "Fin" 32 32 33 #: index.php:5 033 #: index.php:56 34 34 msgid "Before" 35 35 msgstr "Avant" 36 36 37 #: index.php:5 137 #: index.php:57 38 38 msgid "After" 39 39 msgstr "Après" 40 40 41 #: index.php: 8841 #: index.php:91 42 42 msgid "Maximum file size exceeded" 43 43 msgstr "Taille maximum de fichier dépassée" 44 44 45 #: index.php:97 45 #: index.php:95 46 #: index.php:103 46 47 msgid "Image must be in png format" 47 48 msgstr "L'image doit être au format png" 48 49 49 #: index.php:9 450 #: index.php:99 50 51 msgid "Something went wrong while download file" 51 52 msgstr "Une erreur est survenue lors du téléchargement de l'image" 52 53 53 #: index.php:185 54 #: index.php:127 55 msgid "Something went wrong while search file" 56 msgstr "Une erreur est survenue pendant la recherche de fichier" 57 58 #: index.php:195 54 59 msgid "Controls" 55 60 msgstr "Contrôles" 56 61 57 #: index.php:189 62 #: index.php:198 63 msgid "Name" 64 msgstr "Nom" 65 66 #: index.php:199 58 67 msgid "Enable" 59 68 msgstr "Activer" 60 69 61 #: index.php: 19070 #: index.php:200 62 71 msgid "Size" 63 72 msgstr "Taille" 64 73 65 #: index.php: 19174 #: index.php:201 66 75 msgid "Rating" 67 76 msgstr "Évaluation" 68 77 69 #: index.php: 19470 msgid " Target"71 msgstr "Cible "78 #: index.php:204 79 msgid "JS target" 80 msgstr "Cible JS" 72 81 73 #: index.php: 19574 msgid " Place"75 msgstr "Emplacement "82 #: index.php:205 83 msgid "JS place" 84 msgstr "Emplacement JS" 76 85 77 #: index.php: 19686 #: index.php:206 78 87 msgid "Adjust avatar CSS" 79 88 msgstr "Ajuster la CSS de l'image" 80 89 81 #: index.php:2 2190 #: index.php:233 82 91 msgid "Reset" 83 92 msgstr "RAZ" 84 93 85 #: index.php:2 2994 #: index.php:240 86 95 msgid "Settings" 87 96 msgstr "Paramètres" 88 97 89 #: index.php:235 90 msgid "Extension" 91 msgstr "Extension" 92 93 #: index.php:236 98 #: index.php:245 94 99 msgid "Enable plugin" 95 100 msgstr "Activer l'extension" 96 101 97 #: index.php:239 98 msgid "URL prefix" 99 msgstr "Préfixe des liens" 100 101 #: index.php:240 102 msgid "Files" 103 msgstr "Fichiers" 104 105 #: index.php:249 102 #: index.php:248 106 103 msgid "Default avatar" 107 104 msgstr "Avatar par défaut" 108 105 109 #: index.php:2 50106 #: index.php:249 110 107 msgid "size" 111 108 msgstr "taille" … … 115 112 msgstr "Image par défaut de gravatar.com" 116 113 117 #: index.php:3 12118 msgid "Image must be in "png" format and have a maximum file size of 30Ko"114 #: index.php:321 115 msgid "Image must be in \"png\" format and have a maximum file size of 30Ko" 119 116 msgstr "L'image doit être au format \"png\" et avoir une taille maximum de 30Ko" 120 117 -
plugins/noodles/release.txt
r1485 r2387 1 0.6 20100605 2 * Switched to DC 2.2 3 * Fixed javascript encode URI 4 * Fixed image paths and urls 5 1 6 0.5 20090923 2 7 * Fixed DC 2.1.6 URL handlers ending
Note: See TracChangeset
for help on using the changeset viewer.