Piwigo.org

You are not logged in. (Register / Login)

Announcement

Post a reply

Write your message and submit

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

LucMorizur
2009-10-12 09:03:16

Hi Piwigo team ;

in this plugin, I am currently coding the creation of an autolog code.

plg wrote:

I like the idea of the autoid, but one step further would be even better : in the administration screen of a private category, you have form to send the category URL by email to a list of email addresses. In the email, you find something like index.php?/123&autoid=abcdef1234. If anyone follow the link, Piwigo creates a generic account with permission to see the category. What I mean is to simplify the permission management system.

The notification is something else currently for me, but already what I can do is managing a POST message to create a generic account linked to an autoid code, with a certain page to display. This way from the administration screen of a private category, the admin can create an autolog code simply by clicking on a button.

What I miss is the way to insert a button in the category management page (cat_modify.tpl offhand). I looked a little bit how Extended Descriptions inserts its help button in many administration pages, but for the moment I have not catched completely how it is done. And anyway the need for Extended Descriptions is far much more complicated than Event Cats' one, as Event Cats needs to insert only one button in only one admin page.

Can you explain me how to insert this button from Event Cats plugin management, please ? Then I need to make it submit a form with POST method so to send the category id information and the type of autolog code creation, and normally it's done.

LucMorizur
2009-10-03 00:53:41

Hi;

A presentation of the features:

first, the home page of the demonstration site, one can see some public categories, and not the private ones of course:
http://lucmorizur.free.fr

Auto id, redirection to home page (private categories authorized to this account are now reachable):
The Piwigo_EN account is generic, the link "Register" is displayed in the Identification menu block to duplicate the account.
Also, the link "Connection" is displayed too, so to allow people already having an account on this gallery, to log in and be redirected to the same page, whatever it is.

autolog=code_04FKx_for_Piwigo_EN

Auto id, redirection to an "Additionnal Pages":
The account Duplication refusée ("Duplication forbidden" in french) cannot be duplicated.
autolog=add_p_duplic_refusee&ap=3

Auto id, redirection to a category:
The account Duplication autorisée ("Duplication allowed" in french) can be duplicated. As it is not generic, the link is displayed "Duplicate".
autolog=duplic_OK&cat=15

Auto id, redirection to an image (in a private category of course):
autolog=code_04FKx_for_Piwigo_EN&cat=15&img=157

Auto id refused (code "outdated"), redirection to an "Additionnal Pages":
autolog=Code_perime_pour_Piwigo03

Auto id, redirection forced to an "Additionnal Pages" ("forced" = even though parameter "&cat=1" is given):
autolog=prior_page_pour_Piwigo03&cat=1

Auto id, redirection to a category as this category does not contain the requested image:
autolog=code_04FKx_for_Piwigo_EN&cat=15&img=1550

Auto id, redirection to home page as the requested category doesn't exist:
autolog=code_04FKx_for_Piwigo_EN&cat=150

Auto id, redirection to home page as the requested "Additionnal Pages" doesn't exist:
autolog=code_04FKx_for_Piwigo_EN&ap=40

Once identified thanks to one of these links, it is possible to "duplicate" the current account, ie create a new account, and continue to surf on the gallery with same access rights than the duplicated account, thus without having to wait that the admin has validated the account just created.

The files currently used on this test gallery are those recently posted at last commit.

LucMorizur
2009-06-17 00:21:45

Hi ;

I'm painfully trying to translate in an admin page, the modification of $conf['auto_log'], $conf['outdated_page'], $conf['prior_page'], and $conf['allow_user_registration'].

This is ridiculous as
  _ only reproducing these modifications would hardly be an admin page, as it would be very dirty and not comfortable at all ;
  _ an essential feature, now that plg gave us the whish to have it :-) , would be the button in a category managing page, processing in one click all the adjustments to perform, when creating a so-called "event" category. And this is far away from my current priority, when I'm just trying to add -- in a PWG way -- a control to set if yes or no users will be allowed to duplicate :=| !

This is the problem of reverse engineering. Well.

Anyway currently I'm persisting, as this is interesting for me. But this way only the most dirty version of the plugin will be ready in a couple of weeks. That's a pity.

In case a kind progammer can code that much faster than me (cause here this will take months, provided I manage to keep on until the end), I think the plugin should have a table with following fields :

integer   user_id      ->      the account concerned in following values
boolean duplic_OK  ->      whether this account is allowed to be duplicated or not
string     code          ->      the code used as "autolog" argument
integer   action       ->      0 : code disabled <=> account not logged in, visitor (guest) redirected to an explaining Additional Page (arg1 field)
                                         1 : code OK, without any other specification <=> account logged in, visitor (registered) redirected to gallery home page
                                         2 : code OK, category specified <=> account logged in, visitor (registered) redirected to specified category (arg1 field)
                                         3 : code OK, Additional Page specified <=> account logged in, visitor (registered) redirected to specified Additional Page (arg1 field)
                                         (n : opened to new ideas)

integer   arg1          ->       gives the identifier of the category (case action is 2), or of the Additional Page (case action is 3), the visitor must be redirected to ; or any argument needed by any new idea

A configuration variable is needed too (integer 0, 1, 2), telling whether all, none, or only specified accounts, are allowed to be duplicated. (Best : 0 : none ; 1 : all ; 2 : no account but those specified "yes" in this table ; 3 : all accounts but those specified "no" in this table.)

I think that neither the first field, user_id, neither the third one, code, should be a primary key, so that
  _ a user_id can be linked to more than one code ;
  _ no code is absolutely required to append a user_id in this table.
This way :
  _ an account can be automatically logged in following several ways, for instance for navigating through an Additional Page or not ;
  _ an account can be specified whether it is allowed to be duplicated or not, without being an account which can log in automatically.

An admin page representing this table and allowing its modification would be necessary too, of course.

:-/

Once I have managed to code my dirty admin page, I will head on such a one, and will then be able to provide an update... when PHP and MySQL are replaced by improved systems...

Many thanks for your comments. :-)

EDIT : tomorrow evening I shall first open an entry for this plugin in SVN, so that things are started from the beginning :-\ ...

Have a nice night ; talk to you soon !

EDIT : user_id was qualified string. It is not, of course ! Probably is it an integer.

EDIT : action was called status. I bloody don't know why... :o/

LucMorizur
2009-06-12 22:11:19

P@t wrote:

I think that we need an admin page for this plugin...
It's too diffiicult to use config_local file to configure it...

I don't agree : I'm able to configure it this way... ;-)

Yes I agree of course. This will be my hotel nights next week (three or four nights so far away from home, great... :-(( but at least the plugin should be improved). Will it be possible to have support ? As, if the biggest part is described in the wiki, I will probably need some details to be explained.

By the way, any idea on what is wrong with the modification I made to be able to choose accounts allowed to be duplicated ?

Many thanks for your help :-)

Luc

ddtddt
2009-06-12 18:37:07

P@t wrote:

I think that we need an admin page for this plugin...
It's too diffiicult to use config_local file to configure it...

+1

P@t
2009-06-12 17:51:35

I think that we need an admin page for this plugin...
It's too diffiicult to use config_local file to configure it...

LucMorizur
2009-06-12 11:01:27

Personal plugin Event Cats published in french only sorry in the wiki, waiting for a plain plugin normally next week.

LucMorizur
2009-06-12 01:26:37

Trying to improve duplication authorizations, I put in config_local.inc.php :

Code:

// Pour le plugin personnel Event Cats, autoriser la duplication de compte :
// 0 : aucun compte ne peut dupliquer (toute autre valeur que 1 ou 2, en fait) ;
// 1 : seuls les comptes déclarés dans $conf['duplication_allowed'] peuvent dupliquer ;
// 2 : tous les comptes peuvent dupliquer ;
$conf['allow_user_registration'] = 1;

// Pour le plugin personnel Event Cats, comptes autorisés à dupliquer :
$conf['duplication_allowed'] = array(
  'Piwigo' => true,
  'Duplication autorisée' => true,
  'Duplication refusée' => false,
);

And modified P@t's function duplicate_account_url() this way :

Code:

function duplicate_account_url()
{
  global $conf, $lang, $template;

  if ((($conf['allow_user_registration'] == 2) or
    (($conf['allow_user_registration'] == 1) and $conf['duplication_allowed'][$userid]))
    and !is_admin() and !is_a_guest())
  {
    $template->assign( 'U_REGISTER', get_root_url().'register.php');
    $lang['Create a new account'] = l10n('Duplicate account');
    $lang['Register'] = l10n('Duplicate');
  }
}

But it never works, $conf['allow_user_registration'] being on 0, or being on 1 together with logging in as "Duplication refusée" always shows link "Duplicate".
What did I do wrong ? Account "Piwigo" is adviser in this gallery, if it can help.

But first thing : go to bed...

See you not later than next Monday night :-) !

plg
2009-06-12 00:52:29

LucMorizur wrote:

I imagine that thousands of plugins is really not convenient.

My opinion: the more plugins Piwigo has, the best it is.

LucMorizur
2009-06-12 00:42:15

plg wrote:

In my opinion the feature your plugin will add deserves a plugin, I have no doubt about this.

That was my feeling too -- of course, I would say, as I was feeling this need -- but mainly I imagine that thousands of plugins is really not convenient.

Trust me: more than 3 people are interested in your plugin. How can you conclude that only 3 people are interested while you have only written about it in a forum topic. Do you think all Piwigo users read the forum each day?

Well, that's I'm doing, why other people would behave another way ?? ^^ (The last sentence does be a plain joke !)

No, of course, that's obvious that the fact that only three (five, actually) people participating to the discussion does not represent efficiently the amount of potentially interested people.

In addition to creating a plugin, I also encourage you to topic:15099

Yes, of course, this just goes together with creating the plugin.

plg
2009-06-12 00:24:20

LucMorizur wrote:

(and also "économie de plugins", you know

I'm not so sure VDigital advises to avoid creating a real plugin and use personal plugin instead. I seriously doubt about that. As soon as a feature is not specific, if you want to contribute to Piwigo and improve the project, you should publish a plugin.

Here is an example of what can be done in a personnal plugin that has no reason to go into a real plugin : send an email to a someone when a specific picture is visited. Another example : topic:14873, is too specific for a dedicated plugin.

In my opinion the feature your plugin will add deserves a plugin, I have no doubt about this.

LucMorizur wrote:

I'm not certain there will be so many users interested, as for the moment I feel we're only three, but that's someting which can change thanks to a plugin.

Trust me: more than 3 people are interested in your plugin. How can you conclude that only 3 people are interested while you have only written about it in a forum topic. Do you think all Piwigo users read the forum each day?

In addition to creating a plugin, I also encourage you to topic:15099

LucMorizur
2009-06-12 00:07:36

Until now it was a priori not so much destined to become a plain plugin, as it was only one file and very simple to add as a personal plugin (and also "économie de plugins", you know, and the fact that I had no clue in publishing a plugin). But now, with all the new ideas, and mainly all the configurations settings, requiring some administration tool, of course a real plugin will be better.

I'm working on it this night, and I will have time for that next week ; and also P@t is likely to give suggestions, so obviously something should arise. To be completely honest I'm not certain there will be so many users interested, as for the moment I feel we're only three, but that's someting which can change thanks to a plugin.

Many thanks for your suggestions.

plg
2009-06-11 23:49:17

Why don't you create a plugin? This way you can distribute it, with several revisions, a changelog for each revision. Users can install it from the plugin manager. Only many advantages.

LucMorizur
2009-06-11 22:15:24

Both ideas implemented : outdated auto log : lucmorizur.free.fr/piwigo/index.php?autolog=Code_perime_pour_Piwigo03 and auto log with "prior page" : lucmorizur.free.fr/piwigo/index.php?autolog=prior_page_pour_Piwigo03 (not sure that "prior page" is very english :-/ ... thus : it means that the visitor is logged in, but is compelled to go through a certain page (from plugin Additional Pages) first).

It works, but I must say the coding is... quite rough, let's say, as here is the funtion auto_log_user() originally from P@t :

Code:

function auto_log_user()
{
  global $conf;

  if (isset($_GET['autolog']) and isset($conf['auto_log']))
  {
    if (isset($conf['outdated'][$_GET['autolog']]))
    {
      redirect(PHPWG_ROOT_PATH.'index.php?/additional_page/'.$conf['outdated'][$_GET['autolog']]);
    }
    elseif (isset($conf['auto_log'][$_GET['autolog']]) and ($userid = get_userid($conf['auto_log'][$_GET['autolog']])))
    {
      log_user($userid, false);
      if (isset($conf['prior_page'][$_GET['autolog']]))
      {
        redirect(PHPWG_ROOT_PATH.'index.php?/additional_page/'.$conf['prior_page'][$_GET['autolog']]);
      }
      elseif (isset($_GET['cat']) and is_numeric($_GET['cat']))
      {
        redirect(PHPWG_ROOT_PATH.'index.php?/category/'.$_GET['cat']);
      }
      else
      {
        redirect(make_index_url());
      }
    }
    else
    {
      access_denied();
    }
  }
}

And here is the part of config_local.inc.php dedicated to Event Cat :

Code:

// Pour le plugin personnel Event Cat, la table des codes pour permettre l'identification automatique des comptes listés ici :
$conf['auto_log'] = array(
  'Code02_pour_Piwigo03' => 'Piwigo',
  'prior_page_pour_Piwigo03' => 'Piwigo',
);

// Pour le plugin personnel Event Cat, la table des codes périmés avec l'identifiant de la page Additional Pages correspondant :
$conf['outdated'] = array(
  'Code_perime_pour_Piwigo03' => '2',
);

// Pour le plugin personnel Event Cat, la table des codes passant d'abord par une page Additional Pages,
// avec l'identifiant correspondant :
$conf['prior_page'] = array(
  'prior_page_pour_Piwigo03' => '3',
);

// Autoriser la duplication de compte :
$conf['allow_user_registration'] = true;

I already know what I'm going to be told : this is a dirty mess... mainly because the username which must go through the "prior page" first, must be declared exactly identically in two different $conf[] variables... so it's the reason why I tag all this "tracks for new features" :-)
At last I could show examples.

Thanks for reading me :-) !

Luc

LucMorizur
2009-06-11 19:31:41

Rapidly, one more idea : a possibility to redirect someone using an autolog URL, on an Additional Page : this to be able to cancel an autolog URL, and say to the visitor using it after it is canceled, that this URL is not valid any more. The main idea being that, as this authentication is very poor concerning security, autolog URLs can be valid for a not too long time. This, I think I can code it ; anyway it is normally very simple. I think I can try that this evening.

One could even create an Additional Page being the target of an autolog URL, saying : "Hi, this autolog will be valid only 24 hours (or two weeks, or...), please <a href="identification.php">register</a> to be able to come back later.<br>Apart of that, <a href="index.php?/category/15">click here</a> to navigate to the stuff I wanted to show you".

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013