From: csarven Date: Wed, 10 Dec 2008 02:16:07 +0000 (-0500) Subject: Jcrop v2 (POST cropping to be completed) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=33196c24f4c9609611cfbcf6466ceee60c51ef8e;p=quix0rs-gnu-social.git Jcrop v2 (POST cropping to be completed) darcs-hash:20081210021607-eefa4-c3590f3e734255faf098bf5ca09fc17901a6db70.gz --- diff --git a/_darcs/inventory b/_darcs/inventory index 8e63bf0ffa..4926f6f3b1 100644 --- a/_darcs/inventory +++ b/_darcs/inventory @@ -118,4 +118,6 @@ Zach Copley **20090105010407] [trac750 configurable sync flags for Facebook app (noticesync, replysync) Zach Copley **20090105040212] [trac750 added some output to the facebook_update.php script -Zach Copley **20090105045603] \ No newline at end of file +Zach Copley **20090105045603] +[Jcrop v2 (POST cropping to be completed) +csarven@controlyourself.ca**20081210021607] \ No newline at end of file diff --git a/_darcs/patches/20081210021607-eefa4-c3590f3e734255faf098bf5ca09fc17901a6db70.gz b/_darcs/patches/20081210021607-eefa4-c3590f3e734255faf098bf5ca09fc17901a6db70.gz new file mode 100644 index 0000000000..575df96185 Binary files /dev/null and b/_darcs/patches/20081210021607-eefa4-c3590f3e734255faf098bf5ca09fc17901a6db70.gz differ diff --git a/_darcs/patches/unrevert b/_darcs/patches/unrevert new file mode 100644 index 0000000000..fbfd7b2fc0 --- /dev/null +++ b/_darcs/patches/unrevert @@ -0,0 +1,333 @@ + +New patches: + +[unrevert +anonymous**20090106212611] { +hunk ./actions/profilesettings.php 57 + return; + } + ++v v v v v v v + if ($this->arg('save')) { + $this->save_profile(); + } else if ($this->arg('upload')) { +hunk ./actions/profilesettings.php 62 + $this->upload_avatar(); ++ } else if ($this->arg('crop')) { ++ $this->crop_avatar(); + } else if ($this->arg('changepass')) { + $this->change_password(); + } +hunk ./actions/profilesettings.php 67 ++************* ++ if ($this->arg('save')) { ++ $this->save_profile(); ++ } else if ($this->arg('upload')) { ++ $this->upload_avatar(); ++ } else if ($this->arg('changepass')) { ++ $this->change_password(); ++ } ++^ ^ ^ ^ ^ ^ ^ + + } + +hunk ./actions/profilesettings.php 85 + $user = common_current_user(); + $profile = $user->getProfile(); + ++v v v v v v v + common_element_start('form', array('method' => 'POST', + 'id' => 'profilesettings', +hunk ./actions/profilesettings.php 88 +- 'action' => +- common_local_url('profilesettings'))); ++ 'action' => common_local_url('profilesettings'))); + common_hidden('token', common_session_token()); + + # too much common patterns here... abstractable? +hunk ./actions/profilesettings.php 110 + common_input('tags', _('Tags'), + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), + _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); ++************* ++ common_element_start('form', array('method' => 'POST', ++ 'id' => 'profilesettings', ++ 'action' => ++ common_local_url('profilesettings'))); ++ common_hidden('token', common_session_token()); ++ ++ # too much common patterns here... abstractable? ++ ++ common_input('nickname', _('Nickname'), ++ ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname, ++ _('1-64 lowercase letters or numbers, no punctuation or spaces')); ++ common_input('fullname', _('Full name'), ++ ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname); ++ common_input('homepage', _('Homepage'), ++ ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage, ++ _('URL of your homepage, blog, or profile on another site')); ++ common_textarea('bio', _('Bio'), ++ ($this->arg('bio')) ? $this->arg('bio') : $profile->bio, ++ _('Describe yourself and your interests in 140 chars')); ++ common_input('location', _('Location'), ++ ($this->arg('location')) ? $this->arg('location') : $profile->location, ++ _('Where you are, like "City, State (or Region), Country"')); ++ common_input('tags', _('Tags'), ++ ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), ++ _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); ++^ ^ ^ ^ ^ ^ ^ + + $language = common_language(); + common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language); +hunk ./actions/profilesettings.php 179 + common_local_url('profilesettings'))); + common_hidden('token', common_session_token()); + ++v v v v v v v + if ($original) { +hunk ./actions/profilesettings.php 181 ++ common_element('h3', null, _("Original:")); ++ common_element_start('div', array('id'=>'avatar_original')); + common_element('img', array('src' => $original->url, + 'class' => 'avatar original', + 'width' => $original->width, +hunk ./actions/profilesettings.php 188 + 'height' => $original->height, + 'alt' => $user->nickname)); ++ common_element_end('div'); ++ ++ foreach(array('avatar_crop_x', 'avatar_crop_y', 'avatar_crop_w', 'avatar_crop_h') as $crop_info) { ++ common_element('input', array('name' => $crop_info, ++ 'type' => 'hidden', ++ 'id' => $crop_info)); ++ } ++ common_submit('avatar_crop', _('Crop')); + } +hunk ./actions/profilesettings.php 197 ++************* ++ if ($original) { ++ common_element('img', array('src' => $original->url, ++ 'class' => 'avatar original', ++ 'width' => $original->width, ++ 'height' => $original->height, ++ 'alt' => $user->nickname)); ++ } ++^ ^ ^ ^ ^ ^ ^ + + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); + +hunk ./actions/profilesettings.php 209 ++v v v v v v v + if ($avatar) { +hunk ./actions/profilesettings.php 211 +- common_element('img', array('src' => $avatar->url, ++ common_element('h3', null, _("Preview:")); ++ common_element_start('div', array('id'=>'avatar_preview')); ++ common_element('img', array('src' => $original->url,//$avatar->url, + 'class' => 'avatar profile', + 'width' => AVATAR_PROFILE_SIZE, + 'height' => AVATAR_PROFILE_SIZE, +hunk ./actions/profilesettings.php 218 + 'alt' => $user->nickname)); ++ common_element_end('div'); + } +hunk ./actions/profilesettings.php 220 ++************* ++ if ($avatar) { ++ common_element('img', array('src' => $avatar->url, ++ 'class' => 'avatar profile', ++ 'width' => AVATAR_PROFILE_SIZE, ++ 'height' => AVATAR_PROFILE_SIZE, ++ 'alt' => $user->nickname)); ++ } ++^ ^ ^ ^ ^ ^ ^ + + + common_element('input', array('name' => 'MAX_FILE_SIZE', +hunk ./actions/profilesettings.php 465 + $this->show_form(_('Failed updating avatar.')); + } + ++v v v v v v v + @unlink($_FILES['avatarfile']['tmp_name']); + } + +hunk ./actions/profilesettings.php 469 ++ function crop_avatar() { ++// http://deepliquid.com/content/Jcrop_Implementation_Theory.html ++// Grab POSTs x, y, w, h and crop out a rectangle topleft: (x,y), bottomright: (x+w, x+h) using the original image. ++ } ++************* ++ @unlink($_FILES['avatarfile']['tmp_name']); ++ } ++^ ^ ^ ^ ^ ^ ^ ++ + function nickname_exists($nickname) + { + $user = common_current_user(); +hunk ./lib/settingsaction.php 63 + } + } + ++v v v v v v v + function form_header($title, $msg=NULL, $success=false) { + common_show_header($title, +hunk ./lib/settingsaction.php 66 +- NULL, ++ array($this, 'show_header'), + array($msg, $success), + array($this, 'show_top')); + } +hunk ./lib/settingsaction.php 71 + ++ function show_header() { ++ common_element('link', array('rel' => 'stylesheet', ++ 'type' => 'text/css', ++ 'href' => common_path('js/jcrop/jquery.Jcrop.css?version='.LACONICA_VERSION), ++ 'media' => 'screen, projection, tv')); ++ common_element('script', array('type' => 'text/javascript', ++ 'src' => common_path('js/jcrop/jquery.Jcrop.pack.js'))); ++ common_element('script', array('type' => 'text/javascript', ++ 'src' => common_path('js/jcrop/jquery.Jcrop.go.js'))); ++ } ++************* ++ function form_header($title, $msg=null, $success=false) ++ { ++ common_show_header($title, ++ null, ++ array($msg, $success), ++ array($this, 'show_top')); ++ } ++^ ^ ^ ^ ^ ^ ^ ++ + function show_top($arr) + { + $msg = $arr[0]; +} + +Context: + +[Jcrop v2 (POST cropping to be completed) +csarven@controlyourself.ca**20081210021607] +[trac750 added some output to the facebook_update.php script +Zach Copley **20090105045603] +[trac750 configurable sync flags for Facebook app (noticesync, replysync) +Zach Copley **20090105040212] +[trac750 Automatically update linked Facebook users' statuses +Zach Copley **20090105010407] +[wrapper element for config.xml +Evan Prodromou **20081230212202] +[better serialization of arrays and booleans in config output +Evan Prodromou **20081230211957] +[implement the api/laconica/config method +Evan Prodromou **20081230211444] +[add some breaks so that switch statement works +Evan Prodromou **20081230210114] +[implement api/laconica/version method +Evan Prodromou **20081230205939] +[add laconica methods to unauthed ones +Evan Prodromou **20081230203747] +[add laconica-specific methods to htaccess.sample +Evan Prodromou **20081230202513] +[Laconica-specific extensions for Twitter API +Evan Prodromou **20081230202019] +[whitespace changes in actions/register.php after global search-and-replace +Evan Prodromou **20081223195722] +[Twitter-bridge: fix for Twitter's new strict policy of rejecting HTTP POSTs with invalid "expect" headers +Zach Copley **20081225152207] +[move opening brace of class declaration to next line +Evan Prodromou **20081223194923 + + Another gigantor PEAR coding standards patch. Here, I've moved the + opening curly bracket on a class statement to the following line. + +] +[TRUE => true, FALSE => false +Evan Prodromou **20081223194428 + + More PEAR coding standards global changes. Here, I've changed all + instances of TRUE to true and FALSE to false. + +] +[change function headers to K&R style +Evan Prodromou **20081223193323 + + Another huge change, for PEAR code standards compliance. Function + headers have to be in K&R style (opening brace on its own line), + instead of having the opening brace on the same line as the function + and parameters. So, a little perl magic found all the function + definitions and move the opening brace to the next line (properly + indented... usually). + +] +[replace NULL with null +Evan Prodromou **20081223192129 + + Another global search-and-replace update. Here, I've replaced the PHP + keyword 'NULL' with its lowercase version. This is another PEAR code + standards change. + +] +[replace all tabs with four spaces +Evan Prodromou **20081223191907 + + The PEAR coding standards decree: no tabs, but indent by four spaces. + I've done a global search-and-replace on all tabs, replacing them by + four spaces. This is a huge change, but it will go a long way to + getting us towards phpcs-compliance. And that means better code + readability, and that means more participation. + +] +[incorrect label on notice list file comment +Evan Prodromou **20081223191430] +[bring lib/noticelist.php into line with PEAR code standards +Evan Prodromou **20081223190851] +[reformat and document lib/mail.php for phpcs conformance +Evan Prodromou **20081223173330] +[bring messaging section (inbox, outbox, mailbox) into PEAR Code Standards compliance +Evan Prodromou **20081222201304 + + Actually refactored the method names on these classes to come into + complete compliance with the code standards. Untested; maybe there are + some bad method names now. + +] +[bring mailbox.php into line with PEAR Coding Standards (mostly) +Evan Prodromou **20081222195041] +[reformat lib/language.php for PEAR Coding Standards +Evan Prodromou **20081222193029] +[reformat lib/jabber.php for phpcs, including doc comments +Evan Prodromou **20081222173249] +[reformat for phpcs +Evan Prodromou **20081221005837] +[reformat lib/daemon.php for phpcs +Evan Prodromou **20081221004607] +[some modifications to assuage phpcs +Evan Prodromou **20081221003955] +[reformatting for phpcs in lib/util.php +Evan Prodromou **20081221003016] +[first step of phpcs-cleanup of index.php +Evan Prodromou **20081221002332] +[more information in subscription notices +Evan Prodromou **20081212171135] +[identica badge by Kent Brewster. For more information see: +Sarven Capadisli **20081218003302 + http://kentbrewster.com/identica-badge/ + + Copy and paste the following wherever you want the badge to show up: + + + + Substitute your own ID in the user parameter. + +] +[TAG 0.6.4.1 +Evan Prodromou **20081220204906] +Patch bundle hash: +afe7b4b695e91033a56499c2eee94a02fa1f0105 diff --git a/_darcs/pristine/actions/profilesettings.php b/_darcs/pristine/actions/profilesettings.php index 6c22a7933f..caec2f93d7 100644 --- a/_darcs/pristine/actions/profilesettings.php +++ b/_darcs/pristine/actions/profilesettings.php @@ -54,13 +54,13 @@ class ProfilesettingsAction extends SettingsAction return; } - if ($this->arg('save')) { - $this->save_profile(); - } else if ($this->arg('upload')) { - $this->upload_avatar(); - } else if ($this->arg('changepass')) { - $this->change_password(); - } + if ($this->arg('save')) { + $this->save_profile(); + } else if ($this->arg('upload')) { + $this->upload_avatar(); + } else if ($this->arg('changepass')) { + $this->change_password(); + } } @@ -70,31 +70,31 @@ class ProfilesettingsAction extends SettingsAction $user = common_current_user(); $profile = $user->getProfile(); - common_element_start('form', array('method' => 'POST', - 'id' => 'profilesettings', - 'action' => - common_local_url('profilesettings'))); - common_hidden('token', common_session_token()); - - # too much common patterns here... abstractable? - - common_input('nickname', _('Nickname'), - ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname, - _('1-64 lowercase letters or numbers, no punctuation or spaces')); - common_input('fullname', _('Full name'), - ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname); - common_input('homepage', _('Homepage'), - ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage, - _('URL of your homepage, blog, or profile on another site')); - common_textarea('bio', _('Bio'), - ($this->arg('bio')) ? $this->arg('bio') : $profile->bio, - _('Describe yourself and your interests in 140 chars')); - common_input('location', _('Location'), - ($this->arg('location')) ? $this->arg('location') : $profile->location, - _('Where you are, like "City, State (or Region), Country"')); - common_input('tags', _('Tags'), - ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), - _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); + common_element_start('form', array('method' => 'POST', + 'id' => 'profilesettings', + 'action' => + common_local_url('profilesettings'))); + common_hidden('token', common_session_token()); + + # too much common patterns here... abstractable? + + common_input('nickname', _('Nickname'), + ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname, + _('1-64 lowercase letters or numbers, no punctuation or spaces')); + common_input('fullname', _('Full name'), + ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname); + common_input('homepage', _('Homepage'), + ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage, + _('URL of your homepage, blog, or profile on another site')); + common_textarea('bio', _('Bio'), + ($this->arg('bio')) ? $this->arg('bio') : $profile->bio, + _('Describe yourself and your interests in 140 chars')); + common_input('location', _('Location'), + ($this->arg('location')) ? $this->arg('location') : $profile->location, + _('Where you are, like "City, State (or Region), Country"')); + common_input('tags', _('Tags'), + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), + _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); $language = common_language(); common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language); @@ -137,23 +137,23 @@ class ProfilesettingsAction extends SettingsAction common_local_url('profilesettings'))); common_hidden('token', common_session_token()); - if ($original) { - common_element('img', array('src' => $original->url, - 'class' => 'avatar original', - 'width' => $original->width, - 'height' => $original->height, - 'alt' => $user->nickname)); - } + if ($original) { + common_element('img', array('src' => $original->url, + 'class' => 'avatar original', + 'width' => $original->width, + 'height' => $original->height, + 'alt' => $user->nickname)); + } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); - if ($avatar) { - common_element('img', array('src' => $avatar->url, - 'class' => 'avatar profile', - 'width' => AVATAR_PROFILE_SIZE, - 'height' => AVATAR_PROFILE_SIZE, - 'alt' => $user->nickname)); - } + if ($avatar) { + common_element('img', array('src' => $avatar->url, + 'class' => 'avatar profile', + 'width' => AVATAR_PROFILE_SIZE, + 'height' => AVATAR_PROFILE_SIZE, + 'alt' => $user->nickname)); + } common_element('input', array('name' => 'MAX_FILE_SIZE', @@ -390,8 +390,8 @@ class ProfilesettingsAction extends SettingsAction $this->show_form(_('Failed updating avatar.')); } - @unlink($_FILES['avatarfile']['tmp_name']); - } + @unlink($_FILES['avatarfile']['tmp_name']); + } function nickname_exists($nickname) { diff --git a/_darcs/pristine/js/jcrop/Jcrop.gif b/_darcs/pristine/js/jcrop/Jcrop.gif new file mode 100644 index 0000000000..72ea7ccb53 Binary files /dev/null and b/_darcs/pristine/js/jcrop/Jcrop.gif differ diff --git a/_darcs/pristine/js/jcrop/jquery.Jcrop.css b/_darcs/pristine/js/jcrop/jquery.Jcrop.css new file mode 100644 index 0000000000..b95178a726 --- /dev/null +++ b/_darcs/pristine/js/jcrop/jquery.Jcrop.css @@ -0,0 +1,45 @@ +/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */ +.jcrop-holder +{ + text-align: left; +} + +.jcrop-vline, .jcrop-hline +{ + font-size: 0; + position: absolute; + background: white url('Jcrop.gif') top left repeat; + /* + opacity: .5; + *filter:alpha(opacity=50); + */ +} +.jcrop-vline { height: 100%; width: 1px !important; } +.jcrop-hline { width: 100%; height: 1px !important; } +.jcrop-handle { + font-size: 1px; + width: 7px !important; + height: 7px !important; + border: 1px #eee solid; + background-color: #333; + *width: 9px; + *height: 9px; +} + +.jcrop-tracker { + *background-color: gray; + width: 100%; height: 100%; +} + +.custom .jcrop-vline, +.custom .jcrop-hline +{ + background: yellow; +} +.custom .jcrop-handle +{ + border-color: black; + background-color: #C7BB00; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} diff --git a/_darcs/pristine/js/jcrop/jquery.Jcrop.go.js b/_darcs/pristine/js/jcrop/jquery.Jcrop.go.js new file mode 100644 index 0000000000..57639814f0 --- /dev/null +++ b/_darcs/pristine/js/jcrop/jquery.Jcrop.go.js @@ -0,0 +1,41 @@ + $(function(){ + jQuery("#avatar_original img.avatar").Jcrop({ onChange: showPreview, + setSelect: [ 0, 0, $("#avatar_original img.avatar").attr("width"), $("#avatar_original img.avatar").attr("height") ], + onSelect: updateCoords, + aspectRatio: 1, + boxWidth: 640, + boxHeight: 640, + bgColor: '#000', + bgOpacity: .4 + }); + }); + + function showPreview(coords) { + var rx = 96 / coords.w; + var ry = 96 / coords.h; + + var img_width = $("#avatar_original img.avatar").attr("width"); + var img_height = $("#avatar_original img.avatar").attr("height"); + + + $('#avatar_preview img.avatar').css({ + width: Math.round(rx *img_width) + 'px', + height: Math.round(ry * img_height) + 'px', + marginLeft: '-' + Math.round(rx * coords.x) + 'px', + marginTop: '-' + Math.round(ry * coords.y) + 'px' + }); + }; + + function updateCoords(c) { + $('#avatar_crop_x').val(c.x); + $('#avatar_crop_y').val(c.y); + $('#avatar_crop_w').val(c.w); + $('#avatar_crop_h').val(c.h); + }; + + function checkCoords() { + if (parseInt($('#avatar_crop_w').val())) return true; + alert('Please select a crop region then press submit.'); + return false; + }; + diff --git a/_darcs/pristine/js/jcrop/jquery.Jcrop.pack.js b/_darcs/pristine/js/jcrop/jquery.Jcrop.pack.js new file mode 100644 index 0000000000..aa82e8abec --- /dev/null +++ b/_darcs/pristine/js/jcrop/jquery.Jcrop.pack.js @@ -0,0 +1,8 @@ +/** + * Jcrop v.0.9.5 (packed) + * (c) 2008 Kelly Hallman and DeepLiquid.com + * More information: http://deepliquid.com/content/Jcrop.html + * Released under MIT License - this header must remain with code + */ + +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('$.1n=7(G,F){d G=G,F=F;g(1p(G)!==\'2d\')G=$(G)[0];g(1p(F)!==\'2d\')F={};g(!(\'2x\'1a F))F.2x=$.3d.3e?K:M;g(!(\'2c\'1a F))F.2c=$.3d.3e?K:M;d 4f={2x:K,3W:\'4C\',1f:4D,3T:\'4Y\',3x:.6,3O:.4,3P:.5,53:5,3N:9,3D:5,51:14,25:0,2c:M,3I:M,3B:M,30:M,3A:M,49:0,4p:0,4k:8,3V:20,3X:3,2f:K,3n:[0,0],2z:[0,0],2O:[0,0],2D:7(){},2G:7(){}};d j=4f;21(F);d $I=$(G).B({16:\'1b\'});47($I,j.49,j.4p);d S=$I.W(),L=$I.U(),$12=$(\'<12 />\').W(S).U(L).1f(1L(\'4F\')).B({16:\'4H\',4B:j.3T});g(j.1f)$12.1f(j.1f);$I.54($12);d $34=$(\'\').3Y(\'2N\',$I.3Y(\'2N\')).B(\'16\',\'1b\').W(S).U(L);d $2C=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:59,16:\'1b\',4o:\'4g\'}).1P($34);d $2g=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:5b});d $28=$(\'<12 />\').B({16:\'1b\',1l:55}).3U($I).1P($2C,$2g);d 23=j.4k;d $1S=$(\'<12 />\').1f(1L(\'3v\')).W(S+(23*2)).U(L+(23*2)).B({16:\'1b\',R:D(-23),P:D(-23),1l:3R,1z:0}).3q(48);d 1I,1Q;d 2u=2Q(G),1q,1B,3i,58,3h,1O;g(\'36\'1a j){1I=j.36[0]/S;1Q=j.36[1]/L}d E=7(){d A=0,u=0,q=0,m=0,Z,Y;7 1A(z){d z=2T(z);q=A=z[0];m=u=z[1]};7 1y(z){d z=2T(z);Z=z[0]-q;Y=z[1]-m;q=z[0];m=z[1]};7 3f(){k[Z,Y]};7 2b(2y){d Z=2y[0],Y=2y[1];g(0>A+Z)Z-=Z+A;g(0>u+Y)Y-=Y+u;g(LS){15=S;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}}1g{15=q;h=3c/1k;13=1Z<0?u-h:u+h;g(13<0){13=0;w=N.17((13-u)*1k);15=1V<0?A-w:w+A}1g g(13>L){13=L;w=N.17(13-u)*1k;15=1V<0?A-w:w+A}}k 4E=3g(1F(A,u,15,13))};7 2T(p){g(p[0]<0)p[0]=0;g(p[1]<0)p[1]=0;g(p[0]>S)p[0]=S;g(p[1]>L)p[1]=L;k[p[0],p[1]]};7 1F(A,u,q,m){d 2R=A,3r=q,3o=u,3l=m;g(q2q))q=(1U>0)?(A+2q):(A-2q);g(2n&&(N.17(22)>2n))m=(22>0)?(u+2n):(u-2n);g(2i&&(N.17(22)<2i))m=(22>0)?(u+2i):(u-2i);g(2m&&(N.17(1U)<2m))q=(1U>0)?(A+2m):(A-2m);g(A<0){q-=A;A-=A}g(u<0){m-=u;u-=u}g(q<0){A-=q;q-=q}g(m<0){u-=m;m-=m}g(q>S){d X=q-S;A-=X;q-=X}g(m>L){d X=m-L;u-=X;m-=X}g(A>S){d X=A-L;m-=X;u-=X}g(u>L){d X=u-L;m-=X;u-=X}k 3g(1F(A,u,q,m))};7 3g(a){k{x:a[0],y:a[1],q:a[2],m:a[3],w:a[2]-a[0],h:a[3]-a[1]}};k{1F:1F,1A:1A,1y:1y,3f:3f,2b:2b,2K:2K,Q:Q}}();d J=7(){d 4v,4z,4y,1R,2U=4x;d 2F={};d H={};d 2E=K;d 1i=j.3D;g(j.30){2F={R:1Y(\'3C\').B(\'R\',$.3d.3e?D(-1):D(0)),3Q:1Y(\'3C\'),P:1Y(\'3z\'),3L:1Y(\'3z\')}}g(j.3A){H.t=1W(\'n\');H.b=1W(\'s\');H.r=1W(\'e\');H.l=1W(\'w\')}j.3B&&2Y([\'n\',\'s\',\'e\',\'w\']);j.3I&&2Y([\'1M\',\'11\',\'1s\',\'2e\']);7 1Y(1u){d 1J=$(\'<12 />\').B({16:\'1b\',1z:j.3O}).1f(1L(1u));$2C.1P(1J);k 1J};7 2W(T,3y){d 1J=$(\'<12 />\').3q(3b(T)).B({3p:T+\'-2A\',16:\'1b\',1l:3y});$2g.1P(1J);k 1J};7 3J(T){k 2W(T,2U++).B({R:D(-1i+1),P:D(-1i+1),1z:j.3P}).1f(1L(\'H\'))};7 1W(T){d s=j.3N,o=1i,h=s,w=s,t=o,l=o;1E(T){C\'n\':C\'s\':w=1t(V);O;C\'e\':C\'w\':h=1t(V);O}k 2W(T,2U++).W(w).U(h).B({R:D(-t+1),P:D(-l+1)})};7 2Y(2J){4U(i 1a 2J)H[2J[i]]=3J(2J[i])};7 31(c){d 3a=N.1K((c.h/2)-1i),35=N.1K((c.w/2)-1i),4V=4W=-1i+1,2a=c.w-1i,1X=c.h-1i,x,y;\'e\'1a H&&H.e.B({R:D(3a),P:D(2a)})&&H.w.B({R:D(3a)})&&H.s.B({R:D(1X),P:D(35)})&&H.n.B({P:D(35)});\'1s\'1a H&&H.1s.B({P:D(2a)})&&H.2e.B({R:D(1X),P:D(2a)})&&H.1M.B({R:D(1X)});\'b\'1a H&&H.b.B({R:D(1X)})&&H.r.B({P:D(2a)})};7 3K(x,y){$34.B({R:D(-y),P:D(-x)});$28.B({R:D(y),P:D(x)})};7 2A(w,h){$28.W(w).U(h)};7 3s(){d p=E.Q();E.1A([p.x,p.y]);E.1y([p.q,p.m])};7 2I(){g(1R)k 1e()};7 1e(){d c=E.Q();2A(c.w,c.h);3K(c.x,c.y);j.30&&2F[\'3L\'].B({P:D(c.w-1)})&&2F[\'3Q\'].B({R:D(c.h-1)});2E&&31(c);1R||1w();j.2D(2H(c))};7 1w(){$28.1w();$I.B(\'1z\',j.3x);1R=M};7 1r(){1o();$28.1v();$I.B(\'1z\',1);1R=K};7 1v(){1r();$I.B(\'1z\',1);1R=K};7 2t(){2E=M;31(E.Q());$2g.1w()};7 1o(){2E=K;$2g.1v()};7 2o(v){(3h=v)?1o():2t()};7 1h(){d c=E.Q();2o(K);3s()};1o();$2C.1P($(\'<12 />\').1f(1L(\'3v\')).3q(3b(\'1N\')).B({3p:\'1N\',16:\'1b\',1l:4M,1z:0}));k{2I:2I,1e:1e,1r:1r,1w:1w,1v:1v,2t:2t,1o:1o,2o:2o,1h:1h}}();d 1j=7(){d 2w=7(){},2v=7(){},2L=j.2x;g(!2L){$1S.3k(2B).2S(26).4N(26)}7 4j(){g(2L){$(3t).3k(2B).2S(26)}$1S.B({1l:4G})}7 4i(){g(2L){$(3t).3H(\'3k\',2B).3H(\'2S\',26)}$1S.B({1l:3R})}7 2B(e){2w(2r(e))};7 26(e){e.2j();e.2k();g(1q){1q=K;2v(2r(e));j.2G(2H(E.Q()));4i();2w=7(){};2v=7(){}}k K};7 1G(1N,1h){1q=M;2w=1N;2v=1h;4j();k K};7 1x(t){$1S.B(\'3p\',t)};$I.4s($1S);k{1G:1G,1x:1x}}();d 33=7(){d $24=$(\'<4w 1u="4L" />\').B({16:\'1b\',P:\'-4O\'}).57(43).56(2f).5a(41),$3S=$(\'<12 />\').B({16:\'1b\',4o:\'4g\'}).1P($24);7 2l(){g(j.2c){$24.1w();$24.4Z()}};7 41(e){$24.1v()};7 2f(e){g(!j.2f)k;d 42=1O,1C;1O=e.4Q?M:K;g(42!=1O){g(1O&&1q){1C=E.Q();1B=1C.w/1C.h}1g 1B=0;J.1e()}e.2k();e.2j();k K};7 29(e,x,y){E.2b([x,y]);J.2I();e.2j();e.2k()};7 43(e){g(e.4T)k M;2f(e);d 2h=1O?10:1;1E(e.5d){C 37:29(e,-2h,0);O;C 39:29(e,2h,0);O;C 38:29(e,0,-2h);O;C 40:29(e,0,2h);O;C 27:J.1r();O;C 9:k M}k K};g(j.2c)$3S.3U($I);k{2l:2l}}();7 D(n){k\'\'+1m(n)+\'D\'};7 1t(n){k\'\'+1m(n)+\'%\'};7 1L(44){k j.3W+\'-\'+44};7 2Q(G){d z=$(G).2y();k[z.P,z.R]};7 2r(e){k[(e.4q-2u[0]),(e.4r-2u[1])]};7 46(1u){g(1u!=3i){1j.1x(1u);3i=1u}};7 4a(19,z){2u=2Q(G);1j.1x(19==\'1N\'?19:19+\'-2A\');g(19==\'1N\')k 1j.1G(4e(z),2P);d 1C=E.Q();E.1A(E.2K(4b(19)));1j.1G(45(19,1C),2P)};7 45(19,f){k 7(z){g(!j.25&&!1B)1E(19){C\'e\':z[1]=f.m;O;C\'w\':z[1]=f.m;O;C\'n\':z[0]=f.q;O;C\'s\':z[0]=f.q;O}1g 1E(19){C\'e\':z[1]=f.y+1;O;C\'w\':z[1]=f.y+1;O;C\'n\':z[0]=f.x+1;O;C\'s\':z[0]=f.x+1;O}E.1y(z);J.1e()}};7 4e(z){d 2M=z;33.2l();k 7(z){E.2b([z[0]-2M[0],z[1]-2M[1]]);2M=z;J.1e()}};7 4b(T){1E(T){C\'n\':k\'1M\';C\'s\':k\'11\';C\'e\':k\'11\';C\'w\':k\'1s\';C\'1s\':k\'1M\';C\'11\':k\'2e\';C\'2e\':k\'11\';C\'1M\':k\'1s\'}};7 3b(T){k 7(e){1q=M;4a(T,2r(e));e.2k();e.2j();k K}};7 47($G,w,h){d 11=$G.W(),1H=$G.U();g((11>w)&&w>0){11=w;1H=(w/$G.W())*$G.U()}g((1H>h)&&h>0){1H=h;11=(h/$G.U())*$G.W()}1I=$G.W()/11;1Q=$G.U()/1H;$G.W(11).U(1H)};7 2H(c){k{x:1m(c.x*1I),y:1m(c.y*1Q),q:1m(c.q*1I),m:1m(c.m*1Q),w:1m(c.w*1I),h:1m(c.h*1Q)}};7 2P(z){d c=E.Q();g(c.w>j.3n[0]&&c.h>j.3n[1]){J.2t();J.1h()}1g{J.1r()}1j.1x(\'2X\')};7 48(e){1q=M;2u=2Q(G);J.1r();J.1o();46(\'2X\');E.1A(2r(e));1j.1G(4c,2P);33.2l();e.2k();e.2j();k K};7 4c(z){E.1y(z);J.1e()};7 2Z(a){d A=a[0],u=a[1],q=a[2],m=a[3];g(3h)k;d 2s=E.1F(A,u,q,m);d c=E.Q();d 18=2p=[c.x,c.y,c.q,c.m];d 3w=j.3V;d x=18[0];d y=18[1];d q=18[2];d m=18[3];d 3Z=2s[0]-2p[0];d 4m=2s[1]-2p[1];d 4n=2s[2]-2p[2];d 4l=2s[3]-2p[3];d 1c=0;d 4h=j.3X;J.2o(M);d 3u=7(){k 7(){1c+=(V-1c)/4h;18[0]=x+((1c/V)*3Z);18[1]=y+((1c/V)*4m);18[2]=q+((1c/V)*4n);18[3]=m+((1c/V)*4l);g(1c=4K.8)1c=V;1d(18)}}();7 32(){4I.4t(3u,3w)};32()};7 1d(l){E.1A([l[0],l[1]]);E.1y([l[2],l[3]]);J.1e()};7 21(F){g(1p(F)!=\'2d\')F={};j=$.4X(j,F);g(1p(j.2D)!==\'7\')j.2D=7(){};g(1p(j.2G)!==\'7\')j.2G=7(){}};7 3m(){k 2H(E.Q())};7 2V(){k E.Q()};7 3E(F){21(F);g(\'1d\'1a F){1d(F.1d);J.1h()}};g(1p(F)!=\'2d\')F={};g(\'1d\'1a F){1d(F.1d);J.1h()}d 2q=j.2z[0]||0;d 2n=j.2z[1]||0;d 2m=j.2O[0]||0;d 2i=j.2O[1]||0;1j.1x(\'2X\');k{2Z:2Z,1d:1d,21:3E,3m:3m,2V:2V}};$.5e.1n=7(j){7 3G(1D){d 4d=j.4R||1D.2N;d I=4P 4S();d 1D=1D;I.50=7(){$(1D).1v().4A(I);1D.1n=$.1n(I,j)};I.2N=4d};g(1p(j)!==\'2d\')j={};1T.4J(7(){g(\'1n\'1a 1T){g(j==\'52\')k 1T.1n;1g 1T.1n.21(j)}1g 3G(1T)});k 1T};',62,325,'|||||||function||||||var|||if|||options|return||y2||||x2||||y1|||||pos|x1|css|case|px|Coords|opt|obj|handle|img|Selection|false|boundy|true|Math|break|left|getFixed|top|boundx|ord|height|100|width|delta|oy|ox||nw|div|yy||xx|position|abs|animat|mode|in|absolute|pcent|setSelect|update|addClass|else|done|hhs|Tracker|aspect|zIndex|parseInt|Jcrop|disableHandles|typeof|btndown|release|ne|pct|type|hide|show|setCursor|setCurrent|opacity|setPressed|aspectLock|fc|from|switch|flipCoords|activateHandlers|nh|xscale|jq|round|cssClass|sw|move|shift_down|append|yscale|awake|trk|this|xsize|rw|insertDragbar|south|insertBorder|rh||setOptions|ysize|bound|keymgr|aspectRatio|trackUp||sel|doNudge|east|moveOffset|keySupport|object|se|watchShift|hdl_holder|nudge|ymin|preventDefault|stopPropagation|watchKeys|xmin|ylimit|animMode|initcr|xlimit|mouseAbs|animto|enableHandles|docOffset|onDone|onMove|trackDocument|offset|maxSize|resize|trackMove|img_holder|onChange|seehandles|borders|onSelect|unscale|updateVisible|li|getCorner|trackDoc|lloc|src|minSize|doneSelect|getPos|xa|mouseup|rebound|hdep|tellScaled|dragDiv|crosshair|createHandles|animateTo|drawBorders|moveHandles|animateStart|KeyManager|img2|midhoriz|trueSize||||midvert|createDragger|rwa|browser|msie|getOffset|makeObj|animating|lastcurs|rha|mousemove|yb|tellSelect|minSelect|ya|cursor|mousedown|xb|refresh|document|animator|tracker|interv|bgOpacity|zi|vline|dragEdges|sideHandles|hline|handleOffset|setOptionsNew|getRect|attachWhenDone|unbind|cornerHandles|insertHandle|moveto|right|real_ratio|handleSize|borderOpacity|handleOpacity|bottom|290|keywrap|bgColor|insertBefore|animationDelay|baseClass|swingSpeed|attr|ix1||onBlur|init_shift|parseKey|cl|dragmodeHandler|myCursor|presize|newSelection|boxWidth|startDragMode|oppLockCorner|selectDrag|loadsrc|createMover|defaults|hidden|velocity|toBack|toFront|boundary|iy2|iy1|ix2|overflow|boxHeight|pageX|pageY|before|setTimeout|max|start|input|370|dragmode|end|after|backgroundColor|jcrop|null|last|holder|450|relative|window|each|99|radio|360|mouseout|30px|new|shiftKey|useImg|Image|ctrlKey|for|north|west|extend|black|focus|onload|edgeMargin|api|handlePad|wrap|300|keyup|keydown|dimmed|310|blur|320|min|keyCode|fn'.split('|'),0,{})) diff --git a/_darcs/pristine/lib/settingsaction.php b/_darcs/pristine/lib/settingsaction.php index 46f713fa85..62de39d459 100644 --- a/_darcs/pristine/lib/settingsaction.php +++ b/_darcs/pristine/lib/settingsaction.php @@ -60,13 +60,12 @@ class SettingsAction extends Action } } - function form_header($title, $msg=null, $success=false) - { - common_show_header($title, - null, - array($msg, $success), - array($this, 'show_top')); - } + function form_header($title, $msg=NULL, $success=false) { + common_show_header($title, + NULL, + array($msg, $success), + array($this, 'show_top')); + } function show_top($arr) { diff --git a/_darcs/pristine/theme/default/display.css b/_darcs/pristine/theme/default/display.css index 0b894550c1..9773216169 100644 --- a/_darcs/pristine/theme/default/display.css +++ b/_darcs/pristine/theme/default/display.css @@ -440,6 +440,17 @@ p.time a { float: left; margin: 0 10px 18px 0; } +#avatar_original { + margin-bottom:1em; +} + +#avatar_preview { + overflow:hidden; + width:96px; + height:96px; +} + + a.nickname { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; diff --git a/_darcs/tentative_inventory b/_darcs/tentative_inventory new file mode 100644 index 0000000000..4926f6f3b1 --- /dev/null +++ b/_darcs/tentative_inventory @@ -0,0 +1,123 @@ +Starting with tag: +[TAG 0.6.4.1 +Evan Prodromou **20081220204906] +[identica badge by Kent Brewster. For more information see: +Sarven Capadisli **20081218003302 + http://kentbrewster.com/identica-badge/ + + Copy and paste the following wherever you want the badge to show up: + + + + Substitute your own ID in the user parameter. + +] +[more information in subscription notices +Evan Prodromou **20081212171135] +[first step of phpcs-cleanup of index.php +Evan Prodromou **20081221002332] +[reformatting for phpcs in lib/util.php +Evan Prodromou **20081221003016] +[some modifications to assuage phpcs +Evan Prodromou **20081221003955] +[reformat lib/daemon.php for phpcs +Evan Prodromou **20081221004607] +[reformat for phpcs +Evan Prodromou **20081221005837] +[reformat lib/jabber.php for phpcs, including doc comments +Evan Prodromou **20081222173249] +[reformat lib/language.php for PEAR Coding Standards +Evan Prodromou **20081222193029] +[bring mailbox.php into line with PEAR Coding Standards (mostly) +Evan Prodromou **20081222195041] +[bring messaging section (inbox, outbox, mailbox) into PEAR Code Standards compliance +Evan Prodromou **20081222201304 + + Actually refactored the method names on these classes to come into + complete compliance with the code standards. Untested; maybe there are + some bad method names now. + +] +[reformat and document lib/mail.php for phpcs conformance +Evan Prodromou **20081223173330] +[bring lib/noticelist.php into line with PEAR code standards +Evan Prodromou **20081223190851] +[incorrect label on notice list file comment +Evan Prodromou **20081223191430] +[replace all tabs with four spaces +Evan Prodromou **20081223191907 + + The PEAR coding standards decree: no tabs, but indent by four spaces. + I've done a global search-and-replace on all tabs, replacing them by + four spaces. This is a huge change, but it will go a long way to + getting us towards phpcs-compliance. And that means better code + readability, and that means more participation. + +] +[replace NULL with null +Evan Prodromou **20081223192129 + + Another global search-and-replace update. Here, I've replaced the PHP + keyword 'NULL' with its lowercase version. This is another PEAR code + standards change. + +] +[change function headers to K&R style +Evan Prodromou **20081223193323 + + Another huge change, for PEAR code standards compliance. Function + headers have to be in K&R style (opening brace on its own line), + instead of having the opening brace on the same line as the function + and parameters. So, a little perl magic found all the function + definitions and move the opening brace to the next line (properly + indented... usually). + +] +[TRUE => true, FALSE => false +Evan Prodromou **20081223194428 + + More PEAR coding standards global changes. Here, I've changed all + instances of TRUE to true and FALSE to false. + +] +[move opening brace of class declaration to next line +Evan Prodromou **20081223194923 + + Another gigantor PEAR coding standards patch. Here, I've moved the + opening curly bracket on a class statement to the following line. + +] +[Twitter-bridge: fix for Twitter's new strict policy of rejecting HTTP POSTs with invalid "expect" headers +Zach Copley **20081225152207] +[whitespace changes in actions/register.php after global search-and-replace +Evan Prodromou **20081223195722] +[Laconica-specific extensions for Twitter API +Evan Prodromou **20081230202019] +[add laconica-specific methods to htaccess.sample +Evan Prodromou **20081230202513] +[add laconica methods to unauthed ones +Evan Prodromou **20081230203747] +[implement api/laconica/version method +Evan Prodromou **20081230205939] +[add some breaks so that switch statement works +Evan Prodromou **20081230210114] +[implement the api/laconica/config method +Evan Prodromou **20081230211444] +[better serialization of arrays and booleans in config output +Evan Prodromou **20081230211957] +[wrapper element for config.xml +Evan Prodromou **20081230212202] +[trac750 Automatically update linked Facebook users' statuses +Zach Copley **20090105010407] +[trac750 configurable sync flags for Facebook app (noticesync, replysync) +Zach Copley **20090105040212] +[trac750 added some output to the facebook_update.php script +Zach Copley **20090105045603] +[Jcrop v2 (POST cropping to be completed) +csarven@controlyourself.ca**20081210021607] \ No newline at end of file diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine index 212e028d83..e69de29bb2 100644 --- a/_darcs/tentative_pristine +++ b/_darcs/tentative_pristine @@ -1,10 +0,0 @@ -hunk ./scripts/update_facebook.php 51 -+print date('r', $current_time) . " Looking for notices to send to Facebook...\n"; -+ -+$cnt = 0; -+ -hunk ./scripts/update_facebook.php 67 -+ $cnt++; -hunk ./scripts/update_facebook.php 74 -+print "Sent $cnt notices to Facebook.\n"; -+ diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 6c22a7933f..caec2f93d7 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -54,13 +54,13 @@ class ProfilesettingsAction extends SettingsAction return; } - if ($this->arg('save')) { - $this->save_profile(); - } else if ($this->arg('upload')) { - $this->upload_avatar(); - } else if ($this->arg('changepass')) { - $this->change_password(); - } + if ($this->arg('save')) { + $this->save_profile(); + } else if ($this->arg('upload')) { + $this->upload_avatar(); + } else if ($this->arg('changepass')) { + $this->change_password(); + } } @@ -70,31 +70,31 @@ class ProfilesettingsAction extends SettingsAction $user = common_current_user(); $profile = $user->getProfile(); - common_element_start('form', array('method' => 'POST', - 'id' => 'profilesettings', - 'action' => - common_local_url('profilesettings'))); - common_hidden('token', common_session_token()); - - # too much common patterns here... abstractable? - - common_input('nickname', _('Nickname'), - ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname, - _('1-64 lowercase letters or numbers, no punctuation or spaces')); - common_input('fullname', _('Full name'), - ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname); - common_input('homepage', _('Homepage'), - ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage, - _('URL of your homepage, blog, or profile on another site')); - common_textarea('bio', _('Bio'), - ($this->arg('bio')) ? $this->arg('bio') : $profile->bio, - _('Describe yourself and your interests in 140 chars')); - common_input('location', _('Location'), - ($this->arg('location')) ? $this->arg('location') : $profile->location, - _('Where you are, like "City, State (or Region), Country"')); - common_input('tags', _('Tags'), - ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), - _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); + common_element_start('form', array('method' => 'POST', + 'id' => 'profilesettings', + 'action' => + common_local_url('profilesettings'))); + common_hidden('token', common_session_token()); + + # too much common patterns here... abstractable? + + common_input('nickname', _('Nickname'), + ($this->arg('nickname')) ? $this->arg('nickname') : $profile->nickname, + _('1-64 lowercase letters or numbers, no punctuation or spaces')); + common_input('fullname', _('Full name'), + ($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname); + common_input('homepage', _('Homepage'), + ($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage, + _('URL of your homepage, blog, or profile on another site')); + common_textarea('bio', _('Bio'), + ($this->arg('bio')) ? $this->arg('bio') : $profile->bio, + _('Describe yourself and your interests in 140 chars')); + common_input('location', _('Location'), + ($this->arg('location')) ? $this->arg('location') : $profile->location, + _('Where you are, like "City, State (or Region), Country"')); + common_input('tags', _('Tags'), + ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $user->getSelfTags()), + _('Tags for yourself (letters, numbers, -, ., and _), comma- or space- separated')); $language = common_language(); common_dropdown('language', _('Language'), get_nice_language_list(), _('Preferred language'), true, $language); @@ -137,23 +137,23 @@ class ProfilesettingsAction extends SettingsAction common_local_url('profilesettings'))); common_hidden('token', common_session_token()); - if ($original) { - common_element('img', array('src' => $original->url, - 'class' => 'avatar original', - 'width' => $original->width, - 'height' => $original->height, - 'alt' => $user->nickname)); - } + if ($original) { + common_element('img', array('src' => $original->url, + 'class' => 'avatar original', + 'width' => $original->width, + 'height' => $original->height, + 'alt' => $user->nickname)); + } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); - if ($avatar) { - common_element('img', array('src' => $avatar->url, - 'class' => 'avatar profile', - 'width' => AVATAR_PROFILE_SIZE, - 'height' => AVATAR_PROFILE_SIZE, - 'alt' => $user->nickname)); - } + if ($avatar) { + common_element('img', array('src' => $avatar->url, + 'class' => 'avatar profile', + 'width' => AVATAR_PROFILE_SIZE, + 'height' => AVATAR_PROFILE_SIZE, + 'alt' => $user->nickname)); + } common_element('input', array('name' => 'MAX_FILE_SIZE', @@ -390,8 +390,8 @@ class ProfilesettingsAction extends SettingsAction $this->show_form(_('Failed updating avatar.')); } - @unlink($_FILES['avatarfile']['tmp_name']); - } + @unlink($_FILES['avatarfile']['tmp_name']); + } function nickname_exists($nickname) { diff --git a/js/jcrop/Jcrop.gif b/js/jcrop/Jcrop.gif new file mode 100644 index 0000000000..72ea7ccb53 Binary files /dev/null and b/js/jcrop/Jcrop.gif differ diff --git a/js/jcrop/jquery.Jcrop.css b/js/jcrop/jquery.Jcrop.css new file mode 100644 index 0000000000..b95178a726 --- /dev/null +++ b/js/jcrop/jquery.Jcrop.css @@ -0,0 +1,45 @@ +/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */ +.jcrop-holder +{ + text-align: left; +} + +.jcrop-vline, .jcrop-hline +{ + font-size: 0; + position: absolute; + background: white url('Jcrop.gif') top left repeat; + /* + opacity: .5; + *filter:alpha(opacity=50); + */ +} +.jcrop-vline { height: 100%; width: 1px !important; } +.jcrop-hline { width: 100%; height: 1px !important; } +.jcrop-handle { + font-size: 1px; + width: 7px !important; + height: 7px !important; + border: 1px #eee solid; + background-color: #333; + *width: 9px; + *height: 9px; +} + +.jcrop-tracker { + *background-color: gray; + width: 100%; height: 100%; +} + +.custom .jcrop-vline, +.custom .jcrop-hline +{ + background: yellow; +} +.custom .jcrop-handle +{ + border-color: black; + background-color: #C7BB00; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; +} diff --git a/js/jcrop/jquery.Jcrop.go.js b/js/jcrop/jquery.Jcrop.go.js new file mode 100644 index 0000000000..57639814f0 --- /dev/null +++ b/js/jcrop/jquery.Jcrop.go.js @@ -0,0 +1,41 @@ + $(function(){ + jQuery("#avatar_original img.avatar").Jcrop({ onChange: showPreview, + setSelect: [ 0, 0, $("#avatar_original img.avatar").attr("width"), $("#avatar_original img.avatar").attr("height") ], + onSelect: updateCoords, + aspectRatio: 1, + boxWidth: 640, + boxHeight: 640, + bgColor: '#000', + bgOpacity: .4 + }); + }); + + function showPreview(coords) { + var rx = 96 / coords.w; + var ry = 96 / coords.h; + + var img_width = $("#avatar_original img.avatar").attr("width"); + var img_height = $("#avatar_original img.avatar").attr("height"); + + + $('#avatar_preview img.avatar').css({ + width: Math.round(rx *img_width) + 'px', + height: Math.round(ry * img_height) + 'px', + marginLeft: '-' + Math.round(rx * coords.x) + 'px', + marginTop: '-' + Math.round(ry * coords.y) + 'px' + }); + }; + + function updateCoords(c) { + $('#avatar_crop_x').val(c.x); + $('#avatar_crop_y').val(c.y); + $('#avatar_crop_w').val(c.w); + $('#avatar_crop_h').val(c.h); + }; + + function checkCoords() { + if (parseInt($('#avatar_crop_w').val())) return true; + alert('Please select a crop region then press submit.'); + return false; + }; + diff --git a/js/jcrop/jquery.Jcrop.pack.js b/js/jcrop/jquery.Jcrop.pack.js new file mode 100644 index 0000000000..aa82e8abec --- /dev/null +++ b/js/jcrop/jquery.Jcrop.pack.js @@ -0,0 +1,8 @@ +/** + * Jcrop v.0.9.5 (packed) + * (c) 2008 Kelly Hallman and DeepLiquid.com + * More information: http://deepliquid.com/content/Jcrop.html + * Released under MIT License - this header must remain with code + */ + +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('$.1n=7(G,F){d G=G,F=F;g(1p(G)!==\'2d\')G=$(G)[0];g(1p(F)!==\'2d\')F={};g(!(\'2x\'1a F))F.2x=$.3d.3e?K:M;g(!(\'2c\'1a F))F.2c=$.3d.3e?K:M;d 4f={2x:K,3W:\'4C\',1f:4D,3T:\'4Y\',3x:.6,3O:.4,3P:.5,53:5,3N:9,3D:5,51:14,25:0,2c:M,3I:M,3B:M,30:M,3A:M,49:0,4p:0,4k:8,3V:20,3X:3,2f:K,3n:[0,0],2z:[0,0],2O:[0,0],2D:7(){},2G:7(){}};d j=4f;21(F);d $I=$(G).B({16:\'1b\'});47($I,j.49,j.4p);d S=$I.W(),L=$I.U(),$12=$(\'<12 />\').W(S).U(L).1f(1L(\'4F\')).B({16:\'4H\',4B:j.3T});g(j.1f)$12.1f(j.1f);$I.54($12);d $34=$(\'\').3Y(\'2N\',$I.3Y(\'2N\')).B(\'16\',\'1b\').W(S).U(L);d $2C=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:59,16:\'1b\',4o:\'4g\'}).1P($34);d $2g=$(\'<12 />\').W(1t(V)).U(1t(V)).B({1l:5b});d $28=$(\'<12 />\').B({16:\'1b\',1l:55}).3U($I).1P($2C,$2g);d 23=j.4k;d $1S=$(\'<12 />\').1f(1L(\'3v\')).W(S+(23*2)).U(L+(23*2)).B({16:\'1b\',R:D(-23),P:D(-23),1l:3R,1z:0}).3q(48);d 1I,1Q;d 2u=2Q(G),1q,1B,3i,58,3h,1O;g(\'36\'1a j){1I=j.36[0]/S;1Q=j.36[1]/L}d E=7(){d A=0,u=0,q=0,m=0,Z,Y;7 1A(z){d z=2T(z);q=A=z[0];m=u=z[1]};7 1y(z){d z=2T(z);Z=z[0]-q;Y=z[1]-m;q=z[0];m=z[1]};7 3f(){k[Z,Y]};7 2b(2y){d Z=2y[0],Y=2y[1];g(0>A+Z)Z-=Z+A;g(0>u+Y)Y-=Y+u;g(LS){15=S;h=N.17((15-A)/1k);13=1Z<0?u-h:h+u}}1g{15=q;h=3c/1k;13=1Z<0?u-h:u+h;g(13<0){13=0;w=N.17((13-u)*1k);15=1V<0?A-w:w+A}1g g(13>L){13=L;w=N.17(13-u)*1k;15=1V<0?A-w:w+A}}k 4E=3g(1F(A,u,15,13))};7 2T(p){g(p[0]<0)p[0]=0;g(p[1]<0)p[1]=0;g(p[0]>S)p[0]=S;g(p[1]>L)p[1]=L;k[p[0],p[1]]};7 1F(A,u,q,m){d 2R=A,3r=q,3o=u,3l=m;g(q2q))q=(1U>0)?(A+2q):(A-2q);g(2n&&(N.17(22)>2n))m=(22>0)?(u+2n):(u-2n);g(2i&&(N.17(22)<2i))m=(22>0)?(u+2i):(u-2i);g(2m&&(N.17(1U)<2m))q=(1U>0)?(A+2m):(A-2m);g(A<0){q-=A;A-=A}g(u<0){m-=u;u-=u}g(q<0){A-=q;q-=q}g(m<0){u-=m;m-=m}g(q>S){d X=q-S;A-=X;q-=X}g(m>L){d X=m-L;u-=X;m-=X}g(A>S){d X=A-L;m-=X;u-=X}g(u>L){d X=u-L;m-=X;u-=X}k 3g(1F(A,u,q,m))};7 3g(a){k{x:a[0],y:a[1],q:a[2],m:a[3],w:a[2]-a[0],h:a[3]-a[1]}};k{1F:1F,1A:1A,1y:1y,3f:3f,2b:2b,2K:2K,Q:Q}}();d J=7(){d 4v,4z,4y,1R,2U=4x;d 2F={};d H={};d 2E=K;d 1i=j.3D;g(j.30){2F={R:1Y(\'3C\').B(\'R\',$.3d.3e?D(-1):D(0)),3Q:1Y(\'3C\'),P:1Y(\'3z\'),3L:1Y(\'3z\')}}g(j.3A){H.t=1W(\'n\');H.b=1W(\'s\');H.r=1W(\'e\');H.l=1W(\'w\')}j.3B&&2Y([\'n\',\'s\',\'e\',\'w\']);j.3I&&2Y([\'1M\',\'11\',\'1s\',\'2e\']);7 1Y(1u){d 1J=$(\'<12 />\').B({16:\'1b\',1z:j.3O}).1f(1L(1u));$2C.1P(1J);k 1J};7 2W(T,3y){d 1J=$(\'<12 />\').3q(3b(T)).B({3p:T+\'-2A\',16:\'1b\',1l:3y});$2g.1P(1J);k 1J};7 3J(T){k 2W(T,2U++).B({R:D(-1i+1),P:D(-1i+1),1z:j.3P}).1f(1L(\'H\'))};7 1W(T){d s=j.3N,o=1i,h=s,w=s,t=o,l=o;1E(T){C\'n\':C\'s\':w=1t(V);O;C\'e\':C\'w\':h=1t(V);O}k 2W(T,2U++).W(w).U(h).B({R:D(-t+1),P:D(-l+1)})};7 2Y(2J){4U(i 1a 2J)H[2J[i]]=3J(2J[i])};7 31(c){d 3a=N.1K((c.h/2)-1i),35=N.1K((c.w/2)-1i),4V=4W=-1i+1,2a=c.w-1i,1X=c.h-1i,x,y;\'e\'1a H&&H.e.B({R:D(3a),P:D(2a)})&&H.w.B({R:D(3a)})&&H.s.B({R:D(1X),P:D(35)})&&H.n.B({P:D(35)});\'1s\'1a H&&H.1s.B({P:D(2a)})&&H.2e.B({R:D(1X),P:D(2a)})&&H.1M.B({R:D(1X)});\'b\'1a H&&H.b.B({R:D(1X)})&&H.r.B({P:D(2a)})};7 3K(x,y){$34.B({R:D(-y),P:D(-x)});$28.B({R:D(y),P:D(x)})};7 2A(w,h){$28.W(w).U(h)};7 3s(){d p=E.Q();E.1A([p.x,p.y]);E.1y([p.q,p.m])};7 2I(){g(1R)k 1e()};7 1e(){d c=E.Q();2A(c.w,c.h);3K(c.x,c.y);j.30&&2F[\'3L\'].B({P:D(c.w-1)})&&2F[\'3Q\'].B({R:D(c.h-1)});2E&&31(c);1R||1w();j.2D(2H(c))};7 1w(){$28.1w();$I.B(\'1z\',j.3x);1R=M};7 1r(){1o();$28.1v();$I.B(\'1z\',1);1R=K};7 1v(){1r();$I.B(\'1z\',1);1R=K};7 2t(){2E=M;31(E.Q());$2g.1w()};7 1o(){2E=K;$2g.1v()};7 2o(v){(3h=v)?1o():2t()};7 1h(){d c=E.Q();2o(K);3s()};1o();$2C.1P($(\'<12 />\').1f(1L(\'3v\')).3q(3b(\'1N\')).B({3p:\'1N\',16:\'1b\',1l:4M,1z:0}));k{2I:2I,1e:1e,1r:1r,1w:1w,1v:1v,2t:2t,1o:1o,2o:2o,1h:1h}}();d 1j=7(){d 2w=7(){},2v=7(){},2L=j.2x;g(!2L){$1S.3k(2B).2S(26).4N(26)}7 4j(){g(2L){$(3t).3k(2B).2S(26)}$1S.B({1l:4G})}7 4i(){g(2L){$(3t).3H(\'3k\',2B).3H(\'2S\',26)}$1S.B({1l:3R})}7 2B(e){2w(2r(e))};7 26(e){e.2j();e.2k();g(1q){1q=K;2v(2r(e));j.2G(2H(E.Q()));4i();2w=7(){};2v=7(){}}k K};7 1G(1N,1h){1q=M;2w=1N;2v=1h;4j();k K};7 1x(t){$1S.B(\'3p\',t)};$I.4s($1S);k{1G:1G,1x:1x}}();d 33=7(){d $24=$(\'<4w 1u="4L" />\').B({16:\'1b\',P:\'-4O\'}).57(43).56(2f).5a(41),$3S=$(\'<12 />\').B({16:\'1b\',4o:\'4g\'}).1P($24);7 2l(){g(j.2c){$24.1w();$24.4Z()}};7 41(e){$24.1v()};7 2f(e){g(!j.2f)k;d 42=1O,1C;1O=e.4Q?M:K;g(42!=1O){g(1O&&1q){1C=E.Q();1B=1C.w/1C.h}1g 1B=0;J.1e()}e.2k();e.2j();k K};7 29(e,x,y){E.2b([x,y]);J.2I();e.2j();e.2k()};7 43(e){g(e.4T)k M;2f(e);d 2h=1O?10:1;1E(e.5d){C 37:29(e,-2h,0);O;C 39:29(e,2h,0);O;C 38:29(e,0,-2h);O;C 40:29(e,0,2h);O;C 27:J.1r();O;C 9:k M}k K};g(j.2c)$3S.3U($I);k{2l:2l}}();7 D(n){k\'\'+1m(n)+\'D\'};7 1t(n){k\'\'+1m(n)+\'%\'};7 1L(44){k j.3W+\'-\'+44};7 2Q(G){d z=$(G).2y();k[z.P,z.R]};7 2r(e){k[(e.4q-2u[0]),(e.4r-2u[1])]};7 46(1u){g(1u!=3i){1j.1x(1u);3i=1u}};7 4a(19,z){2u=2Q(G);1j.1x(19==\'1N\'?19:19+\'-2A\');g(19==\'1N\')k 1j.1G(4e(z),2P);d 1C=E.Q();E.1A(E.2K(4b(19)));1j.1G(45(19,1C),2P)};7 45(19,f){k 7(z){g(!j.25&&!1B)1E(19){C\'e\':z[1]=f.m;O;C\'w\':z[1]=f.m;O;C\'n\':z[0]=f.q;O;C\'s\':z[0]=f.q;O}1g 1E(19){C\'e\':z[1]=f.y+1;O;C\'w\':z[1]=f.y+1;O;C\'n\':z[0]=f.x+1;O;C\'s\':z[0]=f.x+1;O}E.1y(z);J.1e()}};7 4e(z){d 2M=z;33.2l();k 7(z){E.2b([z[0]-2M[0],z[1]-2M[1]]);2M=z;J.1e()}};7 4b(T){1E(T){C\'n\':k\'1M\';C\'s\':k\'11\';C\'e\':k\'11\';C\'w\':k\'1s\';C\'1s\':k\'1M\';C\'11\':k\'2e\';C\'2e\':k\'11\';C\'1M\':k\'1s\'}};7 3b(T){k 7(e){1q=M;4a(T,2r(e));e.2k();e.2j();k K}};7 47($G,w,h){d 11=$G.W(),1H=$G.U();g((11>w)&&w>0){11=w;1H=(w/$G.W())*$G.U()}g((1H>h)&&h>0){1H=h;11=(h/$G.U())*$G.W()}1I=$G.W()/11;1Q=$G.U()/1H;$G.W(11).U(1H)};7 2H(c){k{x:1m(c.x*1I),y:1m(c.y*1Q),q:1m(c.q*1I),m:1m(c.m*1Q),w:1m(c.w*1I),h:1m(c.h*1Q)}};7 2P(z){d c=E.Q();g(c.w>j.3n[0]&&c.h>j.3n[1]){J.2t();J.1h()}1g{J.1r()}1j.1x(\'2X\')};7 48(e){1q=M;2u=2Q(G);J.1r();J.1o();46(\'2X\');E.1A(2r(e));1j.1G(4c,2P);33.2l();e.2k();e.2j();k K};7 4c(z){E.1y(z);J.1e()};7 2Z(a){d A=a[0],u=a[1],q=a[2],m=a[3];g(3h)k;d 2s=E.1F(A,u,q,m);d c=E.Q();d 18=2p=[c.x,c.y,c.q,c.m];d 3w=j.3V;d x=18[0];d y=18[1];d q=18[2];d m=18[3];d 3Z=2s[0]-2p[0];d 4m=2s[1]-2p[1];d 4n=2s[2]-2p[2];d 4l=2s[3]-2p[3];d 1c=0;d 4h=j.3X;J.2o(M);d 3u=7(){k 7(){1c+=(V-1c)/4h;18[0]=x+((1c/V)*3Z);18[1]=y+((1c/V)*4m);18[2]=q+((1c/V)*4n);18[3]=m+((1c/V)*4l);g(1c=4K.8)1c=V;1d(18)}}();7 32(){4I.4t(3u,3w)};32()};7 1d(l){E.1A([l[0],l[1]]);E.1y([l[2],l[3]]);J.1e()};7 21(F){g(1p(F)!=\'2d\')F={};j=$.4X(j,F);g(1p(j.2D)!==\'7\')j.2D=7(){};g(1p(j.2G)!==\'7\')j.2G=7(){}};7 3m(){k 2H(E.Q())};7 2V(){k E.Q()};7 3E(F){21(F);g(\'1d\'1a F){1d(F.1d);J.1h()}};g(1p(F)!=\'2d\')F={};g(\'1d\'1a F){1d(F.1d);J.1h()}d 2q=j.2z[0]||0;d 2n=j.2z[1]||0;d 2m=j.2O[0]||0;d 2i=j.2O[1]||0;1j.1x(\'2X\');k{2Z:2Z,1d:1d,21:3E,3m:3m,2V:2V}};$.5e.1n=7(j){7 3G(1D){d 4d=j.4R||1D.2N;d I=4P 4S();d 1D=1D;I.50=7(){$(1D).1v().4A(I);1D.1n=$.1n(I,j)};I.2N=4d};g(1p(j)!==\'2d\')j={};1T.4J(7(){g(\'1n\'1a 1T){g(j==\'52\')k 1T.1n;1g 1T.1n.21(j)}1g 3G(1T)});k 1T};',62,325,'|||||||function||||||var|||if|||options|return||y2||||x2||||y1|||||pos|x1|css|case|px|Coords|opt|obj|handle|img|Selection|false|boundy|true|Math|break|left|getFixed|top|boundx|ord|height|100|width|delta|oy|ox||nw|div|yy||xx|position|abs|animat|mode|in|absolute|pcent|setSelect|update|addClass|else|done|hhs|Tracker|aspect|zIndex|parseInt|Jcrop|disableHandles|typeof|btndown|release|ne|pct|type|hide|show|setCursor|setCurrent|opacity|setPressed|aspectLock|fc|from|switch|flipCoords|activateHandlers|nh|xscale|jq|round|cssClass|sw|move|shift_down|append|yscale|awake|trk|this|xsize|rw|insertDragbar|south|insertBorder|rh||setOptions|ysize|bound|keymgr|aspectRatio|trackUp||sel|doNudge|east|moveOffset|keySupport|object|se|watchShift|hdl_holder|nudge|ymin|preventDefault|stopPropagation|watchKeys|xmin|ylimit|animMode|initcr|xlimit|mouseAbs|animto|enableHandles|docOffset|onDone|onMove|trackDocument|offset|maxSize|resize|trackMove|img_holder|onChange|seehandles|borders|onSelect|unscale|updateVisible|li|getCorner|trackDoc|lloc|src|minSize|doneSelect|getPos|xa|mouseup|rebound|hdep|tellScaled|dragDiv|crosshair|createHandles|animateTo|drawBorders|moveHandles|animateStart|KeyManager|img2|midhoriz|trueSize||||midvert|createDragger|rwa|browser|msie|getOffset|makeObj|animating|lastcurs|rha|mousemove|yb|tellSelect|minSelect|ya|cursor|mousedown|xb|refresh|document|animator|tracker|interv|bgOpacity|zi|vline|dragEdges|sideHandles|hline|handleOffset|setOptionsNew|getRect|attachWhenDone|unbind|cornerHandles|insertHandle|moveto|right|real_ratio|handleSize|borderOpacity|handleOpacity|bottom|290|keywrap|bgColor|insertBefore|animationDelay|baseClass|swingSpeed|attr|ix1||onBlur|init_shift|parseKey|cl|dragmodeHandler|myCursor|presize|newSelection|boxWidth|startDragMode|oppLockCorner|selectDrag|loadsrc|createMover|defaults|hidden|velocity|toBack|toFront|boundary|iy2|iy1|ix2|overflow|boxHeight|pageX|pageY|before|setTimeout|max|start|input|370|dragmode|end|after|backgroundColor|jcrop|null|last|holder|450|relative|window|each|99|radio|360|mouseout|30px|new|shiftKey|useImg|Image|ctrlKey|for|north|west|extend|black|focus|onload|edgeMargin|api|handlePad|wrap|300|keyup|keydown|dimmed|310|blur|320|min|keyCode|fn'.split('|'),0,{})) diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 46f713fa85..62de39d459 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -60,13 +60,12 @@ class SettingsAction extends Action } } - function form_header($title, $msg=null, $success=false) - { - common_show_header($title, - null, - array($msg, $success), - array($this, 'show_top')); - } + function form_header($title, $msg=NULL, $success=false) { + common_show_header($title, + NULL, + array($msg, $success), + array($this, 'show_top')); + } function show_top($arr) { diff --git a/theme/default/display.css b/theme/default/display.css index 0b894550c1..9773216169 100644 --- a/theme/default/display.css +++ b/theme/default/display.css @@ -440,6 +440,17 @@ p.time a { float: left; margin: 0 10px 18px 0; } +#avatar_original { + margin-bottom:1em; +} + +#avatar_preview { + overflow:hidden; + width:96px; + height:96px; +} + + a.nickname { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold;