Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorpierovdfn
    • CommentTimeAug 6th 2010 edited
     permalink
    Hi.
    I've some suggestions for flatpress.
    I'm sorry for my English but I wanted to share them with all the community
    1. A filter for unknown url in PrettyURLs: it could make easier for plugin developers.
    Here's a patch:
    --- plugin.prettyurls.bak 2010-08-04 14:05:22.000000000 +0200
    +++ plugin.prettyurls.php 2010-08-05 14:14:49.000000000 +0200
    @@ -340,6 +340,7 @@
    function check_url($url) {
    if (!empty($url) && $url != '/') {
    $this->fp_params = array('entry'=>'entry000000-000000');
    + $url=apply_filters('prettyurls_unknown_url', $url);
    }
    }

    2. I've 2 ideas for Favicon plugin: the first is making a GUI for its configuration, so users can easily modify favicon. The second is adding an icon for iPod Touch/iPhone.
    I've improved both. When I have free time, I'll post a tarball.
    Here's the plugin: Plugin Favicon (v2.0) [Flatpress] on my blog (ita and eng).
    3. Using a textarea for the footer instead of the text input.
    Here's the patch:
    --- admin.config.tpl 2010-08-05 14:20:35.000000000 +0200
    +++ vanilla/admin.config.tpl 2009-10-10 15:50:38.000000000 +0200
    @@ -36,7 +36,7 @@
    <dd><input type="text" name="subtitle" id="subtitle" class="bigtextinput" value="{$flatpress.subtitle|escape:"html"}" /></dd>

    <dt><label for="blogfooter"> {$panelstrings.blogfooter} </label></dt>
    - <dd><textarea name="blogfooter" id="blogfooter" class="textinput">{$flatpress.footer|escape:"html"}</textarea></dd>
    + <dd><input type="text" name="blogfooter" id="blogfooter" class="textinput" value="{$flatpress.footer|escape:"html"}" /></dd>

    <dt><label for="author"> {$panelstrings.blogauthor} </label></dt>
    <dd><input type="text" name="author" id="author" class="textinput" value="{$flatpress.author}" /></dd>
    •  
      CommentAuthorpierovdfn
    • CommentTimeAug 6th 2010
     permalink
    Excuse me, I've made a post too long and I've split it.
    4. I think that some users (including me) would like to have the preview of entries under the editor.
    I solved with this:
    in admin/panels/config
    --- admin.config.tpl 2010-08-05 19:53:14.000000000 +0200
    +++ vanilla/admin.config.tpl 2010-08-05 14:20:35.000000000 +0200
    @@ -6,7 +6,6 @@
    {validate id="title" message=$panelstrings.error.title append="error"}
    {validate id="email" message=$panelstrings.error.email append="error"}
    {validate id="maxentries" message=$panelstrings.error.maxentries append="error"}
    -{validate id="preview" message=$panelstrings.error.maxentries append="preview"}

    {validate id="timeoffset" message=$panelstrings.error.maxentries append="error"}
    {validate id="timeformat" message=$panelstrings.error.maxentries append="error"}
    @@ -76,18 +75,6 @@
    <dt><label for="maxentries"> {$panelstrings.blogmaxentries} </label></dt>
    <dd><input type="text" name="maxentries" id="maxentries"
    class="smalltextinput{$error.maxentries|notempty:" field-error"}" value="{$flatpress.maxentries}" /></dd>
    -
    - <dt><label for="preview"> {$panelstrings.previewchoice} </label></dt>
    - <dd>
    - <select name="preview" id="preview" class="textinput">
    - <option value="top" {if 'top' == $fp_config.general.preview}selected="selected"{/if}>
    - {$panelstrings.previewtop}
    - </option>
    - <option value="bottom" {if 'bottom' == $fp_config.general.preview}selected="selected"{/if}>
    - {$panelstrings.previewbottom}
    - </option>
    - </select>
    - </dd>


    </dl>

    --- admin.config.php 2010-08-05 19:01:36.000000000 +0200
    +++ vanilla/admin.config.php 2009-10-10 15:50:38.000000000 +0200
    @@ -16,7 +16,6 @@
    //array('blogfooter', 'blogfooter', 'notEmpty', false, false, 'trim'),
    array('email', 'email', 'isEmail', false, false, 'trim'),
    array('maxentries', 'maxentries', 'isInt', false, false, 'trim'),
    - array('preview', 'preview', 'notEmpty', false, false, 'trim'),

    array('timeoffset', 'timeoffset', 'isNumber', false, false, 'trim'),
    array('timeformat', 'timeformat', 'notEmpty', false, false, 'trim'),
    @@ -50,7 +49,6 @@
    function onsave() {

    global $fp_config;
    - $_POST['preview']=$_POST['preview']=='bottom' ? 'bottom' : 'top';
    $l = explode(',',$_POST['lang']);
    $fp_config['general'] = array(
    //'BLOG_ROOT' => $_POST['blog_root'],
    @@ -64,7 +62,6 @@
    'maxentries' => $_POST['maxentries'],
    // 'voting' => $_POST['voting'],
    'notify' => isset($_POST['notify']),
    - 'preview' => $_POST['preview'],
    /* preserve the following */
    'theme' => $fp_config['general']['theme'],
    'style' => @$fp_config['general']['style'],
    •  
      CommentAuthorpierovdfn
    • CommentTimeAug 6th 2010 edited
     permalink
    In admin/panels/entry:
    --- admin.entry.write.tpl 2010-08-05 19:55:08.000000000 +0200
    +++ vanilla/admin.entry.write.tpl 2009-10-10 15:50:37.000000000 +0200
    @@ -8,7 +8,7 @@
    {include file='shared:errorlist.tpl'}

    {entry_block}
    - {if $preview and $fp_config.general.preview=='top'}
    + {if $preview}
    <fieldset id="post-preview"><legend>{$panelstrings.preview}</legend>
    {include file=preview.tpl}
    </fieldset>
    @@ -67,11 +67,6 @@
    </fieldset>
    </div>

    - {if $preview and $fp_config.general.preview=='bottom'}
    - <fieldset id="post-preview"><legend>{$panelstrings.preview}</legend>
    - {include file=preview.tpl}
    - </fieldset>
    - {/if}

    <div class="buttonbar">
    {html_submit name="save" id="save" value=$panelstrings.submit accesskey=s}

    In admin/panels/static:
    --- admin.static.write.tpl 2010-08-05 19:59:05.000000000 +0200
    +++ vanilla/admin.static.write.tpl 2009-10-10 15:50:39.000000000 +0200
    @@ -9,7 +9,7 @@


    {static_block}
    - {if $preview and $fp_config.general.preview=='top'}
    + {if $preview}
    <fieldset id="post-preview"><legend>{$panelstrings.preview}</legend>
    {include file=preview.tpl}
    </fieldset>
    @@ -33,13 +33,7 @@
    rows="20" cols="74">{$content|default:$smarty.request.content|htmlspecialchars}</textarea><br />
    {*here will go a plugin hook*}
    </p>
    -
    - {if $preview and $fp_config.general.preview=='bottom'}
    - <fieldset id="post-preview"><legend>{$panelstrings.preview}</legend>
    - {include file=preview.tpl}
    - </fieldset>
    - {/if}
    -
    +
    <fieldset id="admin-static-filename"><legend>{$panelstrings.fieldset2}</legend>
    <input type="hidden" name="oldid" id="oldid" value="{$id|default:$smarty.request.oldid}" />
    <p><label for="id">{$panelstrings.pagename}</label><br />

    In fp-interface/lang/en-us:
    --- lang.admin.config.php 2010-08-05 19:56:53.000000000 +0200
    +++ canilla/lang.admin.config.php 2009-10-10 15:50:43.000000000 +0200
    @@ -31,9 +31,6 @@
    'notifications' => 'Notifications',
    'mailnotify' => 'Enable email notification for comments',
    'blogmaxentries' => 'Number of posts per page',
    - 'previewchoice' => 'Where do you want to see entries/static pages preview?',
    - 'previewtop' => 'Over the editor',
    - 'previewbottom' => 'Under the editor',
    'langchoice' => 'Language',

    'intsetts' => 'International settings',
    @@ -62,7 +59,6 @@
    'title' => 'You must specify a title',
    'email' => 'Email must have a valid format',
    'maxentries'=> 'You didn\'t enter a valid number of entries',
    - 'preview' => 'Value not recognized',
    'timeoffset'=> 'You didn\'t enter a valid time offset! '.
    'You can use floating point (e.g. 2h30" => 2.5)',
    'timeformat'=> 'You must insert a format string for time',

    5. In my opinion, it would be great that after you have written an entry, you are redirected to this. It's not necessary the redirect but also a filter would be good because I've already written a plugin. If you are interested, see this page on my blog (Italian only, at the moment)
    6. With a plugin you can add an action for the administration panel, but not a panel like entry, static etc.
    It's not so different: you have to change only 2 files: admin/main.php and admin/panels/main/admin.main.tpl
    --- main.php 2010-08-05 20:57:31.000000000 +0200
    +++ main.bak 2009-10-10 15:50:41.000000000 +0200
    @@ -45,9 +45,9 @@

    $fp_admin = null;

    - if (file_exists($panelpath) || class_exists("admin_$panel")) {
    + if (file_exists($panelpath)) {

    - file_exists($panelpath) ? include($panelpath): NULL;
    + include($panelpath);
    $panelclass = "admin_$panel";

    if (!class_exists($panelclass))
    @@ -175,10 +175,7 @@
    $fp_config = config_load();
    system_init();
    main();
    - if(file_exists(ABS_PATH.LANG_DIR.$fp_config['locale']['lang'].'/lang.admin.'.ADMIN_PANEL.'.php'))
    - admin_panelstrings('admin.'.ADMIN_PANEL);
    - else
    - admin_panelstrings('admin.main');
    + admin_panelstrings('admin.'.ADMIN_PANEL);
    theme_init($smarty);
    $smarty->register_function('controlpanel', 'showcontrolpanel');

    --- panels/main/admin.main.tpl 2010-08-05 20:51:43.000000000 +0200
    +++ panels/main/admin.main.bak 2009-10-10 15:50:38.000000000 +0200
    @@ -42,6 +42,5 @@
    <a href="admin.php?p=maintain">{$panelstrings.op6}</a>
    </dt>
    <dd class="admin-icon-descr">{$panelstrings.op6d}</dd>
    -
    - {''|tag:'admin_main_otherpanels'}
    +
    </dl>

    The second file is modified only for adding a link to the new panel in the main panel.
    •  
      CommentAuthorpierovdfn
    • CommentTimeAug 6th 2010
     permalink
    Sorry for too-long post...
    7. I think it's a good idea using variables by reference in apply_filters
    8. Bug of BBCode: line 395
    $a = ' class="'. $a;
    Should be:
    $a = ' class="'. $a.'"';

    9. SyntaxHighlighter: is old too old? For the bug of BBCode I can't use it.
    10. Stubbing the multi user with levels:
    I think that we could replace all user_loggedin() with an appropriate filter that by default call user_loggedin, so everybody can implement the multiuser.
    This has an only bug: the privilege escalation could be easy if in the upload panel target directory you can run code: for example user "x" can upload a .php file that create and activate a plugin made to give him privileges.
    11. Finally, in my opinion jQuery is better than mootools, but I've explained this in another post.
    Thanks for attention
    •  
      CommentAuthorNoWhereMan
    • CommentTimeAug 12th 2010
     permalink
    1. Added, I've called it "prettyurls_unhandled_url" since once it is handled it would be no more unknown ;)

    2. I don't know if it is really worth to change the simple plugin with a fully customizable one, as long as we want to keep it simple; anyway, if people like it, they are free to use your plugin

    3. Done

    4. I understand the need, but I don't like a lot the execution (neither I really like the default, actually: it's been like that to mimic SPB)

    5. I'll have a look, I've been thinking about adding a default action hook for each panel, it would make some plugin development much easier;

    something like "admin_$panel_$action_$event" e.g. admin_entry_write_onsubmit

    6. Plugin was originally meant to add panels, too, by calling plugin add_panel('myplugin', true) (IIRC, compare with core.administration.php admin_getdir()), but finally I decided to confine them to the subpanels, since the fear was to overcrowd the panel list; I'll consider your suggestion, though.

    7. you mean something like function add_filters($tag, $function, &$parameters) ? you can't: parameters are variable in number, and you get them via func_get_args() which return them by value and not by reference. Also, see: http://it.php.net/manual/en/function.func-get-args.php#90095 (first comment)

    8. Thanks, fixed.

    9. yes, it should be just dropped; since I think I'll swap to jQuery it might be worth looking for an alternative; anyway, I would just remove the plugin from the standard distribution: from my experience using that plugin does not fall under a very common use case, and it is therefore more of a waste of space than anything else.

    10. Supporting multiple users is not only a matter of access control lists; in the case of FlatPress the real concerns are file locking, queuing, serializing concurrent accesses, etc.

    All of this can be generally ignored wherever a "real" DBMS can be used, which is the case for your average CMS: concurrent access management is one area where your DBMS would be meant to shine;

    unfortunately the same can't apply to FlatPress, which *does not* use a DBMS. More precisely, FP is its own DBMS; it is a single-user, non-transactional DBMS, now the question is: is it really worth setting up a complicated user management system when you can't even assure that two concurrent writes won't destroy the main index?

    Now, you could tell me dokuwiki is flatfile and multiuser, and you would be right; it's just that at the moment I don't have the time to do the thing, and I mean *doing it right*, and I don't want to spend my time on something I already know would be patchwork: imagine how many users would start complaining because their index keeps getting corrupt!

    11. Request accepted :)
    •  
      CommentAuthorpierovdfn
    • CommentTimeAug 12th 2010
     permalink
    2. Ok, so I'll rename my plugin... Infact I've always edited the original plugin, this change was for users scared from PHP

    4. Ok, if someone is interested an article in wiki could be created

    7. Yes, I've seen in core.wp-plugin-interface.php. So in plugin_qspam_validate declaration (plugin.qspam.php, line 20) there is &$bool that generates error (and it's logical wrong).

    8. I tried the 3.0.83 version of SyntaxHighlighter and I don't like it so I agree for the alternative... In the wiki there is already one.

    10. Yes, I understand your decision.

    However, thank you!
    •  
      CommentAuthorNoWhereMan
    • CommentTimeAug 12th 2010
     permalink
    7. Yes, I've seen in core.wp-plugin-interface.php. So in plugin_qspam_validate declaration (plugin.qspam.php, line 20) there is &$bool that generates error (and it's logical wrong).


    I think it's been fixed in SVN for a while (r281) ;)