[vhffs-dev] [561] Putting 4.1 branche into trunk to have a coherent layout ( I guess there are about 100 errors) |
[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]
Revision: 561 Author: beuss Date: 2007-04-15 21:17:33 +0000 (Sun, 15 Apr 2007) Log Message: ----------- Putting 4.1 branche into trunk to have a coherent layout (I guess there are about 100 errors) Modified Paths: -------------- trunk/Makefile trunk/vhffs-api/src/Vhffs/Acl.pm trunk/vhffs-api/src/Vhffs/Conf.pm trunk/vhffs-api/src/Vhffs/Constants.pm trunk/vhffs-api/src/Vhffs/DB.pm trunk/vhffs-api/src/Vhffs/Functions.pm trunk/vhffs-api/src/Vhffs/Group.pm trunk/vhffs-api/src/Vhffs/Listengine/Intl.pm trunk/vhffs-api/src/Vhffs/Main.pm trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm trunk/vhffs-api/src/Vhffs/Note.pm trunk/vhffs-api/src/Vhffs/Object.pm trunk/vhffs-api/src/Vhffs/Panel/Admin.pm trunk/vhffs-api/src/Vhffs/Panel/Avatar.pm trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm trunk/vhffs-api/src/Vhffs/Panel/DNS.pm trunk/vhffs-api/src/Vhffs/Panel/Group.pm trunk/vhffs-api/src/Vhffs/Panel/Mail.pm trunk/vhffs-api/src/Vhffs/Panel/Mailinglist.pm trunk/vhffs-api/src/Vhffs/Panel/Main.pm trunk/vhffs-api/src/Vhffs/Panel/Menu.pm trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm trunk/vhffs-api/src/Vhffs/Panel/Repository.pm trunk/vhffs-api/src/Vhffs/Panel/Svn.pm trunk/vhffs-api/src/Vhffs/Panel/User.pm trunk/vhffs-api/src/Vhffs/Panel/Web.pm trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm trunk/vhffs-api/src/Vhffs/Robots/Group.pm trunk/vhffs-api/src/Vhffs/Robots/Mailing.pm trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm trunk/vhffs-api/src/Vhffs/Robots/Repository.pm trunk/vhffs-api/src/Vhffs/Robots/Svn.pm trunk/vhffs-api/src/Vhffs/Robots/User.pm trunk/vhffs-api/src/Vhffs/Robots/Web.pm trunk/vhffs-api/src/Vhffs/Robots.pm trunk/vhffs-api/src/Vhffs/Services/Cvs.pm trunk/vhffs-api/src/Vhffs/Services/DNS.pm trunk/vhffs-api/src/Vhffs/Services/Httpd.pm trunk/vhffs-api/src/Vhffs/Services/Mail.pm trunk/vhffs-api/src/Vhffs/Services/MailUser.pm trunk/vhffs-api/src/Vhffs/Services/Mailing.pm trunk/vhffs-api/src/Vhffs/Services/Mysql.pm trunk/vhffs-api/src/Vhffs/Services/Postgres.pm trunk/vhffs-api/src/Vhffs/Services/Repository.pm trunk/vhffs-api/src/Vhffs/Services/Svn.pm trunk/vhffs-api/src/Vhffs/Stats.pm trunk/vhffs-api/src/Vhffs/User.pm trunk/vhffs-api/src/examples/add_acl.pl trunk/vhffs-api/src/examples/add_acl_dns.pl trunk/vhffs-api/src/examples/create_box.pl trunk/vhffs-api/src/examples/create_cvs.pl trunk/vhffs-api/src/examples/create_cvs_panel.pl trunk/vhffs-api/src/examples/create_dir.pl trunk/vhffs-api/src/examples/create_dns.pl trunk/vhffs-api/src/examples/create_forward.pl trunk/vhffs-api/src/examples/create_group.pl trunk/vhffs-api/src/examples/create_group_by_panel.pl trunk/vhffs-api/src/examples/create_list.pl trunk/vhffs-api/src/examples/create_mail.pl trunk/vhffs-api/src/examples/create_mysql.pl trunk/vhffs-api/src/examples/create_mysql_panel.pl trunk/vhffs-api/src/examples/create_panel_mail.pl trunk/vhffs-api/src/examples/create_postgres.pl trunk/vhffs-api/src/examples/create_repository.pl trunk/vhffs-api/src/examples/create_user.pl trunk/vhffs-api/src/examples/create_web.pl trunk/vhffs-api/src/examples/create_web_panel.pl trunk/vhffs-api/src/examples/delbox.pl trunk/vhffs-api/src/examples/delete_acl.pl trunk/vhffs-api/src/examples/generate_password.pl trunk/vhffs-api/src/examples/get_list.pl trunk/vhffs-api/src/examples/hash_webdir.pl trunk/vhffs-api/src/examples/hashdomain.pl trunk/vhffs-api/src/examples/hashhome_example.pl trunk/vhffs-api/src/examples/hashpopuser.pl trunk/vhffs-api/src/examples/join_group.pl trunk/vhffs-api/src/examples/list_themes.pl trunk/vhffs-api/src/examples/mailuser.pl trunk/vhffs-api/src/examples/mailuser_add_box.pl trunk/vhffs-api/src/examples/modify_acl.pl trunk/vhffs-api/src/examples/modify_user.pl trunk/vhffs-api/src/examples/perm_for_user.pl trunk/vhffs-api/src/examples/print_domain.pl trunk/vhffs-api/src/examples/show_acl_per_object.pl trunk/vhffs-api/src/examples/show_dns_per_group.pl trunk/vhffs-api/src/examples/show_dns_per_user.pl trunk/vhffs-api/src/examples/show_dumper_cvs.pl trunk/vhffs-api/src/examples/show_dumper_group.pl trunk/vhffs-api/src/examples/show_dumper_object.pl trunk/vhffs-api/src/examples/show_dumper_user.pl trunk/vhffs-api/src/examples/show_groups_per_user.pl trunk/vhffs-api/src/examples/show_last_users.pl trunk/vhffs-api/src/examples/show_mail_conf.pl trunk/vhffs-api/src/examples/show_mail_per_group.pl trunk/vhffs-api/src/examples/show_members_from_list.pl trunk/vhffs-api/src/examples/stats.pl trunk/vhffs-backend/conf/vhffs.conf trunk/vhffs-backend/src/pgsql/initdb.sql trunk/vhffs-doc/config/exim4-mx1/exim4.conf trunk/vhffs-doc/config/exim4-mx1/exim4.conf.hash trunk/vhffs-intl/result/es_ES/vhffs.mo trunk/vhffs-intl/result/fr_FR/vhffs.mo trunk/vhffs-intl/src/vhffs.pot trunk/vhffs-irc/modobot.pl trunk/vhffs-jabber/vhffspipe.pl trunk/vhffs-listengine/src/archives/archives.pl trunk/vhffs-listengine/src/archives/show_msg.pl trunk/vhffs-listengine/src/listengine.pl trunk/vhffs-panel/acl/add_acl_group.pl trunk/vhffs-panel/acl/add_acl_user.pl trunk/vhffs-panel/acl/submit.pl trunk/vhffs-panel/acl/view.pl trunk/vhffs-panel/admin/broadcast.pl trunk/vhffs-panel/admin/broadcast_delete.pl trunk/vhffs-panel/admin/broadcast_list.pl trunk/vhffs-panel/admin/broadcast_submit.pl trunk/vhffs-panel/admin/broadcast_view.pl trunk/vhffs-panel/admin/cvs/edit.pl trunk/vhffs-panel/admin/cvs/edit_submit.pl trunk/vhffs-panel/admin/cvs/list.pl trunk/vhffs-panel/admin/cvs/search.pl trunk/vhffs-panel/admin/cvs/show.pl trunk/vhffs-panel/admin/dns/list.pl trunk/vhffs-panel/admin/dns/search.pl trunk/vhffs-panel/admin/group/edit.pl trunk/vhffs-panel/admin/group/edit_submit.pl trunk/vhffs-panel/admin/group/list.pl trunk/vhffs-panel/admin/group/search.pl trunk/vhffs-panel/admin/group/show.pl trunk/vhffs-panel/admin/mail/change_forward.pl trunk/vhffs-panel/admin/mail/delete_box.pl trunk/vhffs-panel/admin/mail/delete_forward.pl trunk/vhffs-panel/admin/mail/edit.pl trunk/vhffs-panel/admin/mail/list.pl trunk/vhffs-panel/admin/mail/password_box.pl trunk/vhffs-panel/admin/mail/search.pl trunk/vhffs-panel/admin/mail/show.pl trunk/vhffs-panel/admin/mailing/list.pl trunk/vhffs-panel/admin/mailing/mailing_submit.pl trunk/vhffs-panel/admin/mailing/search.pl trunk/vhffs-panel/admin/moderation.pl trunk/vhffs-panel/admin/moderation_submit.pl trunk/vhffs-panel/admin/mysql/edit.pl trunk/vhffs-panel/admin/mysql/edit_submit.pl trunk/vhffs-panel/admin/mysql/list.pl trunk/vhffs-panel/admin/mysql/search.pl trunk/vhffs-panel/admin/mysql/show.pl trunk/vhffs-panel/admin/object/delete_avatar.pl trunk/vhffs-panel/admin/object/edit.pl trunk/vhffs-panel/admin/object/edit_submit.pl trunk/vhffs-panel/admin/object/list.pl trunk/vhffs-panel/admin/object/search.pl trunk/vhffs-panel/admin/pgsql/edit.pl trunk/vhffs-panel/admin/pgsql/edit_submit.pl trunk/vhffs-panel/admin/pgsql/list.pl trunk/vhffs-panel/admin/pgsql/search.pl trunk/vhffs-panel/admin/pgsql/show.pl trunk/vhffs-panel/admin/repository/edit.pl trunk/vhffs-panel/admin/repository/edit_submit.pl trunk/vhffs-panel/admin/repository/list.pl trunk/vhffs-panel/admin/repository/search.pl trunk/vhffs-panel/admin/repository/show.pl trunk/vhffs-panel/admin/stats.pl trunk/vhffs-panel/admin/su.pl trunk/vhffs-panel/admin/svn/list.pl trunk/vhffs-panel/admin/svn/search.pl trunk/vhffs-panel/admin/user/edit.pl trunk/vhffs-panel/admin/user/edit_note.pl trunk/vhffs-panel/admin/user/edit_submit.pl trunk/vhffs-panel/admin/user/list.pl trunk/vhffs-panel/admin/user/search.pl trunk/vhffs-panel/admin/user/show.pl trunk/vhffs-panel/admin/web/edit.pl trunk/vhffs-panel/admin/web/edit_submit.pl trunk/vhffs-panel/admin/web/list.pl trunk/vhffs-panel/admin/web/search.pl trunk/vhffs-panel/admin/web/show.pl trunk/vhffs-panel/alert.pl trunk/vhffs-panel/alert_submit.pl trunk/vhffs-panel/auth.pl trunk/vhffs-panel/cvs/create.pl trunk/vhffs-panel/cvs/delete.pl trunk/vhffs-panel/cvs/prefs.pl trunk/vhffs-panel/cvs/prefs_save.pl trunk/vhffs-panel/dns/create.pl trunk/vhffs-panel/dns/delete.pl trunk/vhffs-panel/dns/dns_submit.pl trunk/vhffs-panel/dns/dns_type_submit.pl trunk/vhffs-panel/dns/prefs.pl trunk/vhffs-panel/getavatar.pl trunk/vhffs-panel/group/create.pl trunk/vhffs-panel/group/delete.pl trunk/vhffs-panel/group/join_group.pl trunk/vhffs-panel/group/prefs.pl trunk/vhffs-panel/group/prefs_save.pl trunk/vhffs-panel/group/project_submit.pl trunk/vhffs-panel/group/quota_used.pl trunk/vhffs-panel/group/remove_user_from_group.pl trunk/vhffs-panel/history.pl trunk/vhffs-panel/logout.pl trunk/vhffs-panel/lost.pl trunk/vhffs-panel/lost_ack.pl trunk/vhffs-panel/mail/add_account.pl trunk/vhffs-panel/mail/add_forward.pl trunk/vhffs-panel/mail/change_forward.pl trunk/vhffs-panel/mail/create.pl trunk/vhffs-panel/mail/delete.pl trunk/vhffs-panel/mail/delete_box.pl trunk/vhffs-panel/mail/delete_forward.pl trunk/vhffs-panel/mail/password_box.pl trunk/vhffs-panel/mail/prefs.pl trunk/vhffs-panel/mail/save_catchall.pl trunk/vhffs-panel/mail/spambox.pl trunk/vhffs-panel/mail/spamvirus.pl trunk/vhffs-panel/mail/submit.pl trunk/vhffs-panel/mailinglist/add_sub.pl trunk/vhffs-panel/mailinglist/change_right.pl trunk/vhffs-panel/mailinglist/create.pl trunk/vhffs-panel/mailinglist/del_member.pl trunk/vhffs-panel/mailinglist/delete.pl trunk/vhffs-panel/mailinglist/prefs.pl trunk/vhffs-panel/mailinglist/save_options.pl trunk/vhffs-panel/mailinglist/submit.pl trunk/vhffs-panel/mysql/create.pl trunk/vhffs-panel/mysql/delete.pl trunk/vhffs-panel/mysql/prefs.pl trunk/vhffs-panel/mysql/prefs_save.pl trunk/vhffs-panel/mysql/submit.pl trunk/vhffs-panel/object/upavatar.pl trunk/vhffs-panel/panel.pl trunk/vhffs-panel/pgsql/create.pl trunk/vhffs-panel/pgsql/delete.pl trunk/vhffs-panel/pgsql/pgsql_submit.pl trunk/vhffs-panel/pgsql/prefs.pl trunk/vhffs-panel/pgsql/prefs_save.pl trunk/vhffs-panel/public/allgroups.pl trunk/vhffs-panel/public/allwebsites.pl trunk/vhffs-panel/public/group.pl trunk/vhffs-panel/public/index.pl trunk/vhffs-panel/public/lastgroups.pl trunk/vhffs-panel/public/lastusers.pl trunk/vhffs-panel/public/rss/lastgroups.pl trunk/vhffs-panel/public/rss/lastusers.pl trunk/vhffs-panel/public/user.pl trunk/vhffs-panel/public/websearch.pl trunk/vhffs-panel/repository/create.pl trunk/vhffs-panel/repository/delete.pl trunk/vhffs-panel/repository/prefs.pl trunk/vhffs-panel/repository/prefs_save.pl trunk/vhffs-panel/repository/quota_used.pl trunk/vhffs-panel/repository/repository_submit.pl trunk/vhffs-panel/show_code.pl trunk/vhffs-panel/subscribe.pl trunk/vhffs-panel/svn/create.pl trunk/vhffs-panel/svn/delete.pl trunk/vhffs-panel/svn/prefs.pl trunk/vhffs-panel/svn/prefs_save.pl trunk/vhffs-panel/svn/svn_submit.pl trunk/vhffs-panel/templates/admin/cvs/menu.tmpl trunk/vhffs-panel/templates/admin/cvs/part-modo.tmpl trunk/vhffs-panel/templates/admin/cvs/part.tmpl trunk/vhffs-panel/templates/admin/dns/menu.tmpl trunk/vhffs-panel/templates/admin/dns/part-modo.tmpl trunk/vhffs-panel/templates/admin/dns/part.tmpl trunk/vhffs-panel/templates/admin/group/edit.tmpl trunk/vhffs-panel/templates/admin/group/menu.tmpl trunk/vhffs-panel/templates/admin/group/part-modo.tmpl trunk/vhffs-panel/templates/admin/group/part.tmpl trunk/vhffs-panel/templates/admin/mail/menu.tmpl trunk/vhffs-panel/templates/admin/mail/part-modo.tmpl trunk/vhffs-panel/templates/admin/mail/part.tmpl trunk/vhffs-panel/templates/admin/mailing/menu.tmpl trunk/vhffs-panel/templates/admin/mailing/part.tmpl trunk/vhffs-panel/templates/admin/main/general.tmpl trunk/vhffs-panel/templates/admin/main/main.tmpl trunk/vhffs-panel/templates/admin/misc/list.tmpl trunk/vhffs-panel/templates/admin/misc/mailings_part.tmpl trunk/vhffs-panel/templates/admin/misc/moderation.tmpl trunk/vhffs-panel/templates/admin/misc/moderation_part.tmpl trunk/vhffs-panel/templates/admin/misc/stats.tmpl trunk/vhffs-panel/templates/admin/mysql/menu.tmpl trunk/vhffs-panel/templates/admin/mysql/part-modo.tmpl trunk/vhffs-panel/templates/admin/mysql/part.tmpl trunk/vhffs-panel/templates/admin/object/part.tmpl trunk/vhffs-panel/templates/admin/pgsql/menu.tmpl trunk/vhffs-panel/templates/admin/pgsql/part-modo.tmpl trunk/vhffs-panel/templates/admin/pgsql/part.tmpl trunk/vhffs-panel/templates/admin/repository/menu.tmpl trunk/vhffs-panel/templates/admin/repository/part-modo.tmpl trunk/vhffs-panel/templates/admin/repository/part.tmpl trunk/vhffs-panel/templates/admin/svn/menu.tmpl trunk/vhffs-panel/templates/admin/svn/part-modo.tmpl trunk/vhffs-panel/templates/admin/svn/part.tmpl trunk/vhffs-panel/templates/admin/user/menu.tmpl trunk/vhffs-panel/templates/admin/user/part-modo.tmpl trunk/vhffs-panel/templates/admin/user/part.tmpl trunk/vhffs-panel/templates/admin/web/edit.tmpl trunk/vhffs-panel/templates/admin/web/menu.tmpl trunk/vhffs-panel/templates/admin/web/part-modo.tmpl trunk/vhffs-panel/templates/admin/web/part.tmpl trunk/vhffs-panel/templates/cvs/create.tmpl trunk/vhffs-panel/templates/cvs/menu.tmpl trunk/vhffs-panel/templates/cvs/menu_sub.tmpl trunk/vhffs-panel/templates/cvs/menu_sub_wait.tmpl trunk/vhffs-panel/templates/cvs/prefs.tmpl trunk/vhffs-panel/templates/dns/list_a_sub.tmpl trunk/vhffs-panel/templates/dns/list_cname_sub.tmpl trunk/vhffs-panel/templates/dns/list_mx_sub.tmpl trunk/vhffs-panel/templates/dns/list_ns_sub.tmpl trunk/vhffs-panel/templates/dns/menu.tmpl trunk/vhffs-panel/templates/dns/menu_sub.tmpl trunk/vhffs-panel/templates/dns/menu_sub_wait.tmpl trunk/vhffs-panel/templates/dns/prefs.tmpl trunk/vhffs-panel/templates/group/info.tmpl trunk/vhffs-panel/templates/group/menu.tmpl trunk/vhffs-panel/templates/group/menu_sub.tmpl trunk/vhffs-panel/templates/group/menu_sub_wait.tmpl trunk/vhffs-panel/templates/mail/menu.tmpl trunk/vhffs-panel/templates/mail/menu_sub.tmpl trunk/vhffs-panel/templates/mail/menu_sub_wait.tmpl trunk/vhffs-panel/templates/mailinglist/list_part.tmpl trunk/vhffs-panel/templates/mailinglist/menu.tmpl trunk/vhffs-panel/templates/mailinglist/menu_sub.tmpl trunk/vhffs-panel/templates/mailinglist/menu_sub_wait.tmpl trunk/vhffs-panel/templates/mailinglist/prefs.tmpl trunk/vhffs-panel/templates/main/auth.tmpl trunk/vhffs-panel/templates/main/panel.tmpl trunk/vhffs-panel/templates/menu/group.tmpl trunk/vhffs-panel/templates/menu/main.tmpl trunk/vhffs-panel/templates/menu/user.tmpl trunk/vhffs-panel/templates/mysql/menu.tmpl trunk/vhffs-panel/templates/mysql/menu_sub.tmpl trunk/vhffs-panel/templates/mysql/menu_sub_wait.tmpl trunk/vhffs-panel/templates/pgsql/menu.tmpl trunk/vhffs-panel/templates/pgsql/menu_sub.tmpl trunk/vhffs-panel/templates/pgsql/menu_sub_wait.tmpl trunk/vhffs-panel/templates/public/allwebsites.tmpl trunk/vhffs-panel/templates/public/group.tmpl trunk/vhffs-panel/templates/repository/menu.tmpl trunk/vhffs-panel/templates/repository/menu_sub.tmpl trunk/vhffs-panel/templates/repository/menu_sub_wait.tmpl trunk/vhffs-panel/templates/svn/menu.tmpl trunk/vhffs-panel/templates/svn/menu_sub.tmpl trunk/vhffs-panel/templates/svn/menu_sub_wait.tmpl trunk/vhffs-panel/templates/user/create.tmpl trunk/vhffs-panel/templates/user/mailuser.tmpl trunk/vhffs-panel/templates/user/mailuserspam.tmpl trunk/vhffs-panel/templates/user/mailuservirus.tmpl trunk/vhffs-panel/templates/user/prefs.tmpl trunk/vhffs-panel/templates/user/prefs_avatar.tmpl trunk/vhffs-panel/templates/web/menu.tmpl trunk/vhffs-panel/templates/web/menu_sub.tmpl trunk/vhffs-panel/templates/web/menu_sub_wait.tmpl trunk/vhffs-panel/themes/vhffs/main.css trunk/vhffs-panel/user/delete.pl trunk/vhffs-panel/user/prefs.pl trunk/vhffs-panel/web/create.pl trunk/vhffs-panel/web/delete.pl trunk/vhffs-panel/web/prefs.pl trunk/vhffs-panel/web/prefs_save.pl trunk/vhffs-panel/web/web_submit.pl trunk/vhffs-robots/src/create_cvs.pl trunk/vhffs-robots/src/create_dns.pl trunk/vhffs-robots/src/create_groups.pl trunk/vhffs-robots/src/create_homes.pl trunk/vhffs-robots/src/create_mail.pl trunk/vhffs-robots/src/create_ml.pl trunk/vhffs-robots/src/create_mysql.pl trunk/vhffs-robots/src/create_pgsql.pl trunk/vhffs-robots/src/create_repository.pl trunk/vhffs-robots/src/create_svn.pl trunk/vhffs-robots/src/create_viewvcconf.pl trunk/vhffs-robots/src/create_web.pl trunk/vhffs-robots/src/cvs_fixperms.pl trunk/vhffs-robots/src/delete_cvs.pl trunk/vhffs-robots/src/delete_dns.pl trunk/vhffs-robots/src/delete_group.pl trunk/vhffs-robots/src/delete_mail.pl trunk/vhffs-robots/src/delete_ml.pl trunk/vhffs-robots/src/delete_mysql.pl trunk/vhffs-robots/src/delete_pgsql.pl trunk/vhffs-robots/src/delete_repository.pl trunk/vhffs-robots/src/delete_svn.pl trunk/vhffs-robots/src/delete_users.pl trunk/vhffs-robots/src/delete_web.pl trunk/vhffs-robots/src/dump_mysql.pl trunk/vhffs-robots/src/fix_quota.pl trunk/vhffs-robots/src/fix_quota_repository.pl trunk/vhffs-robots/src/generate_repositorystats.pl trunk/vhffs-robots/src/generate_webstats.pl trunk/vhffs-robots/src/listengine_publicarchives.pl trunk/vhffs-robots/src/mailing.pl trunk/vhffs-robots/src/modify_mysql.pl trunk/vhffs-robots/src/modify_pgsql.pl trunk/vhffs-robots/src/refused_cvs.pl trunk/vhffs-robots/src/refused_dns.pl trunk/vhffs-robots/src/refused_groups.pl trunk/vhffs-robots/src/refused_mail.pl trunk/vhffs-robots/src/refused_ml.pl trunk/vhffs-robots/src/refused_mysql.pl trunk/vhffs-robots/src/refused_postgres.pl trunk/vhffs-robots/src/refused_repository.pl trunk/vhffs-robots/src/refused_svn.pl trunk/vhffs-robots/src/refused_web.pl trunk/vhffs-robots/src/svn_public.pl trunk/vhffs-robots/src/svn_websvn.pl trunk/vhffs-robots/src/update_quota_used.pl trunk/vhffs-robots/src/update_quota_used_repository.pl trunk/vhffs-robots/src/user_group.pl trunk/vhffs-tools/src/vhffs-blankmysql trunk/vhffs-tools/src/vhffs-checkinstall trunk/vhffs-tools/src/vhffs-dumpmysql trunk/vhffs-tools/src/vhffs-groupdel trunk/vhffs-tools/src/vhffs-groupinfo trunk/vhffs-tools/src/vhffs-moderate trunk/vhffs-tools/src/vhffs-passwd trunk/vhffs-tools/src/vhffs-quota trunk/vhffs-tools/src/vhffs-userdel trunk/vhffs-tools/src/vhffs-userinfo trunk/vhffs-tools/src/vhffs-usermod trunk/vhffs-tools/src/vhffs-webdir Added Paths: ----------- trunk/vhffs-api/src/Vhffs/Panel/Commons.pm trunk/vhffs-api/src/Vhffs/Panel/Object.pm trunk/vhffs-compat/ trunk/vhffs-intl/compile_po.sh trunk/vhffs-intl/src/es.po trunk/vhffs-intl/src/fr.po trunk/vhffs-intl/update_po.sh trunk/vhffs-panel/js/ trunk/vhffs-panel/mailinglist/save_sig.pl trunk/vhffs-panel/templates/misc/errors.tmpl trunk/vhffs-panel/templates/misc/infos.tmpl trunk/vhffs-panel/themes/vhffs/js/ trunk/vhffs-panel/themes/vhffs-ng/ trunk/vhffs-robots/misc/awstats_6.6_vhffs.patch trunk/vhffs-robots/src/dump_pgsql.pl trunk/vhffs-tests/ trunk/vhffs-tools/mans/vhffs-makeadmin.1 trunk/vhffs-tools/src/vhffs-makeadmin Removed Paths: ------------- trunk/vhffs-api/src/Vhffs/Panel/LargeFile.pm trunk/vhffs-api/src/Vhffs/Robots/DNS.pm trunk/vhffs-api/src/Vhffs/Robots/LargeFile.pm trunk/vhffs-api/src/Vhffs/Robots/Mail.pm trunk/vhffs-api/src/Vhffs/Robots/Mailinglist.pm trunk/vhffs-api/src/Vhffs/Robots/Panel.pm trunk/vhffs-api/src/Vhffs/Services/LargeFile.pm trunk/vhffs-api/src/examples/test.pl trunk/vhffs-api/src/examples/test2.pl trunk/vhffs-api/src/examples/test_conf.pl trunk/vhffs-api/src/examples/test_constants.pl trunk/vhffs-api/src/examples/test_delete.pl trunk/vhffs-api/src/examples/test_dns.pl trunk/vhffs-api/src/examples/test_fetch_info.pl trunk/vhffs-api/src/examples/test_httpd.pl trunk/vhffs-api/src/examples/test_obj.pl trunk/vhffs-api/src/examples/test_user.pl trunk/vhffs-backend/src/pgsql/alter_from4.0pre1_tocurrent.sql trunk/vhffs-intl/src/es/ trunk/vhffs-intl/src/fr/ trunk/vhffs-panel/admin/largefile/ trunk/vhffs-panel/cvs/cvs_submit.pl trunk/vhffs-panel/dns/add_a.pl trunk/vhffs-panel/dns/add_cname.pl trunk/vhffs-panel/dns/add_mx.pl trunk/vhffs-panel/dns/add_ns.pl trunk/vhffs-panel/dns/delete_a.pl trunk/vhffs-panel/dns/delete_cname.pl trunk/vhffs-panel/dns/delete_mx.pl trunk/vhffs-panel/dns/delete_ns.pl trunk/vhffs-panel/dns/modif_a.pl trunk/vhffs-panel/dns/modif_cname.pl trunk/vhffs-panel/dns/modif_mx.pl trunk/vhffs-panel/functions.js trunk/vhffs-panel/largefile/ trunk/vhffs-panel/login.pl trunk/vhffs-panel/public/largefile.pl trunk/vhffs-panel/templates/admin/largefile/ trunk/vhffs-panel/templates/largefile/ trunk/vhffs-panel/templates/public/misc/largefile-part.tmpl trunk/vhffs-panel/user/prefs_save.pl trunk/vhffs-rfc/largefile trunk/vhffs-robots/src/create_largefile.pl trunk/vhffs-robots/src/delete_largefile.pl trunk/vhffs-robots/src/move-completed-largefile.pl trunk/vhffs-robots/src/old/ trunk/vhffs-robots/src/refused_largefile.pl trunk/vhffs-tools/src/vhffs-firstadmin Property Changed: ---------------- trunk/vhffs-api/src/Vhffs/Constants.pm trunk/vhffs-intl/src/
Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/Makefile 2007-04-15 21:17:33 UTC (rev 561) @@ -2,7 +2,7 @@ CONFDIR = $(DESTDIR)/etc/vhffs DOCDIR = $(DESTDIR)/usr/share/doc/vhffs -APIDIR = $(DESTDIR)/usr/share/vhffs/api +APIDIR = $(DESTDIR)/usr/share/vhffs/api/Vhffs PANELDIR = $(DESTDIR)/usr/share/vhffs/panel TEMPLATESDIR = $(DESTDIR)/usr/share/vhffs/templates BACKENDDIR = $(DESTDIR)/usr/share/vhffs/backend @@ -16,14 +16,13 @@ MAILSDIR = $(DESTDIR)/usr/share/vhffs/mails PERL_MODULES=HTML::Template Digest::MD5 CGI Locale::gettext Config::General DBI Email::Valid Crypt::PasswdMD5 GD::Text::Wrap GD MIME::Lite XML::RSS CGI::Session Encode utf8 LockFile::Simple Mail::Internet Email::Valid Time::ParseDate Quota -DEBIAN_PACKAGES=libxml-rss-perl liblocale-gettext-perl libconfig-general-perl libhtml-template-perl libcrypt-passwdmd5-perl libgd-text-perl libmime-lite-perl libcgi-session-perl liblockfile-simple-perl libgd-gd2-perl libclass-dbi-pg-perl libclass-dbi-perl libdbd-pg-perl libemail-valid-perl libc6-dev libtime-modules-perl libquota-perl +DEBIAN_PACKAGES=gcc libxml-rss-perl liblocale-gettext-perl libconfig-general-perl libhtml-template-perl libcrypt-passwdmd5-perl libgd-text-perl libmime-lite-perl libcgi-session-perl liblockfile-simple-perl libgd-gd2-perl libclass-dbi-pg-perl libclass-dbi-perl libdbd-pg-perl libemail-valid-perl libc6-dev libtime-modules-perl libquota-perl all: help -install: install-api install-panel install-listengine install-tools install-intl install-conf install-backend install-doc install-bots install-shell install-jabber link-api +install: update-version install-api install-panel install-listengine install-tools install-intl install-conf install-backend install-doc install-bots install-shell install-jabber -install-debian: debian-deps install-api install-panel install-listengine install-tools install-intl install-conf install-backend install-doc install-bots install-shell install-jabber - if [ ! -L "/usr/lib/perl5/Vhffs" ]; then ln -s "$(DESTDIR)/usr/share/vhffs/api" "/usr/lib/perl5/Vhffs" ; fi +install-debian: update-version debian-deps install-api install-panel install-listengine install-tools install-intl install-conf install-backend install-doc install-bots install-shell install-jabber check: test-deps @@ -38,6 +37,18 @@ debian-deps: /usr/bin/apt-get install $(DEBIAN_PACKAGES) + +update-version: + @svnversion . | perl -e " \ + \$$_ = <STDIN>; \ + /^(?:.*?:)?(\d+)\w*\$$/; \ + my \$$version = \$$1; \ + \$$^I = \"\"; \ + while(<>) { \ + s/(VHFFS_VERSION.*\d+\.\d+.*?)(?:\d+)(.*)/\$$1\$$version\$$2/; \ + print; \ + }" vhffs-api/src/Vhffs/Constants.pm + test-deps: @perl -e " \ foreach ( qw( $(PERL_MODULES) ) ) { \ @@ -50,18 +61,6 @@ install-shell: build-shell add-shell -link-api: - @perl -e " \ - foreach \$$inc ( @INC ) { \ - unlink ( \$$inc . \"/Vhffs\" ) if ( -l \$$inc . \"/Vhffs\" ); \ - if ( -d \$$inc && \$$inc =~ /site_perl\$$/ ) { \ - \$$link = \$$inc . \"/Vhffs\"; \ - } \ - } \ - unlink( \$$link ) if( -f \$$link ); \ - (symlink( \"$(DESTDIR)/usr/share/vhffs/api\" , \$$link ) && print \"Link API with \$$link\n\") || \ - print \"\n\n** WARNING **\n\nUnable to create symlink for Perl modules, please link /usr/share/vhffs/api with Vhffs in a perl include directory, please contact Vhffs team if you need help\n\n\";" - build-shell: install -d -m 755 $(SHELLDIR) gcc -Wall -pedantic -o $(SHELLDIR)/tuxshell vhffs-shells/tuxshell.c @@ -89,7 +88,7 @@ install-conf: install -d -m 755 $(CONFDIR) - if [ ! -f $(CONFDIR)/vhffs.conf ]; then echo "INSTALL ORIGINAL CONFIG FILE" ; install -m 600 vhffs-backend/conf/vhffs.conf $(CONFDIR)/ ; else echo "CONFIG FILE ALREADY EXISTS" ; fi + @if [ ! -f $(CONFDIR)/vhffs.conf ]; then echo "INSTALL ORIGINAL CONFIG FILE" ; install -m 600 vhffs-backend/conf/vhffs.conf $(CONFDIR)/ ; else echo "CONFIG FILE ALREADY EXISTS" ; fi install-backend: install -d -m 755 $(BACKENDDIR) @@ -122,7 +121,7 @@ install -m 755 vhffs-tools/src/vhffs-userinfo $(TOOLSDIR)/ install -m 755 vhffs-tools/src/vhffs-usermod $(TOOLSDIR)/ install -m 755 vhffs-tools/src/vhffs-webdir $(TOOLSDIR)/ - install -m 755 vhffs-tools/src/vhffs-firstadmin $(TOOLSDIR)/ + install -m 755 vhffs-tools/src/vhffs-makeadmin $(TOOLSDIR)/ install-listengine-web: @@ -163,7 +162,6 @@ install -d -m 755 $(TEMPLATESDIR)/admin/cvs install -d -m 755 $(TEMPLATESDIR)/admin/dns install -d -m 755 $(TEMPLATESDIR)/admin/group - install -d -m 755 $(TEMPLATESDIR)/admin/largefile install -d -m 755 $(TEMPLATESDIR)/admin/repository install -d -m 755 $(TEMPLATESDIR)/admin/mail install -d -m 755 $(TEMPLATESDIR)/admin/mailing @@ -178,7 +176,6 @@ install -d -m 755 $(TEMPLATESDIR)/cvs install -d -m 755 $(TEMPLATESDIR)/dns install -d -m 755 $(TEMPLATESDIR)/group - install -d -m 755 $(TEMPLATESDIR)/largefile install -d -m 755 $(TEMPLATESDIR)/repository install -d -m 755 $(TEMPLATESDIR)/mail install -d -m 755 $(TEMPLATESDIR)/mailinglist @@ -197,7 +194,6 @@ install -m 755 vhffs-panel/templates/admin/cvs/*.tmpl $(TEMPLATESDIR)/admin/cvs/ install -m 755 vhffs-panel/templates/admin/dns/*.tmpl $(TEMPLATESDIR)/admin/dns/ install -m 755 vhffs-panel/templates/admin/group/*.tmpl $(TEMPLATESDIR)/admin/group/ - install -m 755 vhffs-panel/templates/admin/largefile/*.tmpl $(TEMPLATESDIR)/admin/largefile/ install -m 755 vhffs-panel/templates/admin/repository/*.tmpl $(TEMPLATESDIR)/admin/repository/ install -m 755 vhffs-panel/templates/admin/mail/*.tmpl $(TEMPLATESDIR)/admin/mail/ install -m 755 vhffs-panel/templates/admin/mailing/*.tmpl $(TEMPLATESDIR)/admin/mailing/ @@ -212,7 +208,6 @@ install -m 755 vhffs-panel/templates/cvs/*.tmpl $(TEMPLATESDIR)/cvs/ install -m 755 vhffs-panel/templates/dns/*.tmpl $(TEMPLATESDIR)/dns/ install -m 755 vhffs-panel/templates/group/*.tmpl $(TEMPLATESDIR)/group/ - install -m 755 vhffs-panel/templates/largefile/*.tmpl $(TEMPLATESDIR)/largefile/ install -m 755 vhffs-panel/templates/repository/*.tmpl $(TEMPLATESDIR)/repository/ install -m 755 vhffs-panel/templates/mail/*.tmpl $(TEMPLATESDIR)/mail/ install -m 755 vhffs-panel/templates/mailinglist/*.tmpl $(TEMPLATESDIR)/mailinglist/ @@ -230,12 +225,11 @@ install-panel: install-templates install -d -m 755 $(PANELDIR) install -d -m 755 $(PANELDIR)/acl - install -d -m 755 $(PANELDIR)/admin $(PANELDIR)/admin/cvs $(PANELDIR)/admin/dns $(PANELDIR)/admin/group $(PANELDIR)/admin/largefile $(PANELDIR)/admin/repository $(PANELDIR)/admin/mail $(PANELDIR)/admin/mailing $(PANELDIR)/admin/mysql $(PANELDIR)/admin/object $(PANELDIR)/admin/pgsql $(PANELDIR)/admin/svn $(PANELDIR)/admin/user $(PANELDIR)/admin/web + install -d -m 755 $(PANELDIR)/admin $(PANELDIR)/admin/cvs $(PANELDIR)/admin/dns $(PANELDIR)/admin/group $(PANELDIR)/admin/repository $(PANELDIR)/admin/mail $(PANELDIR)/admin/mailing $(PANELDIR)/admin/mysql $(PANELDIR)/admin/object $(PANELDIR)/admin/pgsql $(PANELDIR)/admin/svn $(PANELDIR)/admin/user $(PANELDIR)/admin/web install -d -m 755 $(PANELDIR)/cvs install -d -m 755 $(PANELDIR)/dns install -d -m 755 $(PANELDIR)/group install -d -m 755 $(PANELDIR)/help - install -d -m 755 $(PANELDIR)/largefile install -d -m 755 $(PANELDIR)/repository install -d -m 755 $(PANELDIR)/mail install -d -m 755 $(PANELDIR)/mailinglist @@ -248,7 +242,6 @@ install -d -m 755 $(PANELDIR)/user install -d -m 755 $(PANELDIR)/web #install files - install -m 644 vhffs-panel/*.js $(PANELDIR)/ install -m 644 vhffs-panel/*.ico $(PANELDIR)/ install -m 755 vhffs-panel/*.pl $(PANELDIR)/ install -m 755 vhffs-panel/acl/*.pl $(PANELDIR)/acl/ @@ -256,7 +249,6 @@ install -m 755 vhffs-panel/admin/cvs/*.pl $(PANELDIR)/admin/cvs/ install -m 755 vhffs-panel/admin/dns/*.pl $(PANELDIR)/admin/dns/ install -m 755 vhffs-panel/admin/group/*.pl $(PANELDIR)/admin/group/ - install -m 755 vhffs-panel/admin/largefile/*.pl $(PANELDIR)/admin/largefile/ install -m 755 vhffs-panel/admin/repository/*.pl $(PANELDIR)/admin/repository/ install -m 755 vhffs-panel/admin/mail/*.pl $(PANELDIR)/admin/mail/ install -m 755 vhffs-panel/admin/mailing/*.pl $(PANELDIR)/admin/mailing/ @@ -270,7 +262,6 @@ install -m 755 vhffs-panel/dns/*.pl $(PANELDIR)/dns/ install -m 755 vhffs-panel/group/*.pl $(PANELDIR)/group/ install -m 755 vhffs-panel/help/*.html $(PANELDIR)/help/ - install -m 755 vhffs-panel/largefile/*.pl $(PANELDIR)/largefile/ install -m 755 vhffs-panel/repository/*.pl $(PANELDIR)/repository/ install -m 755 vhffs-panel/mail/*.pl $(PANELDIR)/mail/ install -m 755 vhffs-panel/mailinglist/*.pl $(PANELDIR)/mailinglist/ @@ -283,8 +274,50 @@ install -m 755 vhffs-panel/user/*.pl $(PANELDIR)/user/ install -m 755 vhffs-panel/web/*.pl $(PANELDIR)/web/ #install themes now + install -d -m 755 $(PANELDIR)/js + install -m 644 vhffs-panel/js/*.js $(PANELDIR)/js/ #default theme install -d -m 755 $(PANELDIR)/themes/vhffs install -d -m 755 $(PANELDIR)/themes/vhffs/images + install -d -m 755 $(PANELDIR)/themes/vhffs/js install -m 644 vhffs-panel/themes/vhffs/*.css $(PANELDIR)/themes/vhffs/ install -m 644 vhffs-panel/themes/vhffs/images/*.png $(PANELDIR)/themes/vhffs/images/ + install -m 644 vhffs-panel/themes/vhffs/js/*.js $(PANELDIR)/themes/vhffs/js/ + #next gen theme + install -d -m 755 $(PANELDIR)/themes/vhffs-ng + install -d -m 755 $(PANELDIR)/themes/vhffs-ng/images + install -d -m 755 $(PANELDIR)/themes/vhffs-ng/js + install -m 644 vhffs-panel/themes/vhffs-ng/*.css $(PANELDIR)/themes/vhffs-ng/ + install -m 644 vhffs-panel/themes/vhffs-ng/images/*.png $(PANELDIR)/themes/vhffs-ng/images/ + install -m 644 vhffs-panel/themes/vhffs-ng/js/*.js $(PANELDIR)/themes/vhffs-ng/js/ + + +test: test-object test-group test-user test-stats test-svn test-cvs test-web test-dns test-mail test-ml test-mysql test-pgsql test-functions test-repos +test-object: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Object.pl");' +test-group: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Group.pl");' +test-user: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/User.pl");' +test-stats: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Stats.pl");' +test-svn: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Svn.pl");' +test-cvs: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Cvs.pl");' +test-web: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Httpd.pl");' +test-dns: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/DNS.pl");' +test-mail: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Mail.pl");' +test-ml: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Mailing.pl");' +test-mysql: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Mysql.pl");' +test-pgsql: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Postgres.pl");' +test-functions: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Functions.pl");' +test-repos: + @perl -I vhffs-tests/src/ -I vhffs-api/src/ -e 'use Test::Harness; Test::Harness::runtests("vhffs-tests/src/Services/Repository.pl");' Modified: trunk/vhffs-api/src/Vhffs/Acl.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Acl.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Acl.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -42,7 +42,7 @@ sub what_perm_for_user { - my $entity; + my $user; my $object; my $main; my $perm; @@ -51,34 +51,36 @@ my $request; my $rows; - $entity = shift; + $user = shift; $object = shift; $main = shift; - return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) ); + return -1 unless( defined $user && defined $object ); $perm = Vhffs::Constants::ACL_DENIED; - $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query = 'SELECT perm FROM vhffs_acl WHERE oid_src=? AND oid_dst=?'; + $request = $main->{'db'}->prepare( $query ); + $rows = $request->execute($user->{'object_id'}, $object->{'object_id'}); if( $rows != 0 ) { - $result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $perm = $result->[0][0]; + ($perm) = $request->fetchrow(); } else { - $query = "SELECT acl.perm FROM vhffs_acl acl, vhffs_groups groups, vhffs_user_group ug WHERE acl.oid_dst='".$object->{'object_id'} ."' AND ug.uid='".$entity->get_uid."' AND ug.gid=groups.gid AND groups.object_id=acl.oid_src"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query = 'SELECT acl.perm FROM vhffs_acl acl + INNER JOIN vhffs_groups g ON g.object_id = acl.oid_src + INNER JOIN vhffs_user_group ug ON ug.gid = g.gid + WHERE acl.oid_dst = ? AND ug.uid = ?'; + $request = $main->{'db'}->prepare( $query ); + $rows = $request->execute( $object->{'object_id'}, $user->get_uid ); if( $rows != 0 ) { - while( my @lol = $request->fetchrow_array ) + while( my ($lol) = $request->fetchrow_array ) { - $perm = $lol[0] if( $perm < $lol[0] ); + $perm = $lol if( $perm < $lol ); } } } @@ -87,7 +89,7 @@ sub what_perm_for_group { - my $entity; + my $group; my $object; my $main; my $query; @@ -95,21 +97,21 @@ my $result; my $rows; - $entity = shift; + $group = shift; $object = shift; $main = shift; - return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) ); + return -1 unless(defined $group && defined $object); - $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; + $query = 'SELECT perm FROM vhffs_acl WHERE oid_src = ? AND oid_dst = ?'; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $request = $main->{'db'}->prepare( $query ); + $rows = $request->execute( $group->{'object_id'}, $object->{'object_id'} ); if ( $rows != 0 ) { - $result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - return $result->[0][0]; + ($result) = $request->fetchrow(); + return $result; } else { @@ -123,33 +125,22 @@ { my ( $entity , $object , $perm , $main ) = @_; - return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) ); + return -1 unless(defined $entity && defined $object ); - my $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - #If the ACL already exists, we just update it - if ( $rows > 0 ) - { - $query = "UPDATE vhffs_acl SET perm='".$perm."' WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; - } - else - { - #If not, we create a new ACL in the database - my $acl_id = 1; - $query = "SELECT MAX(acl_id) FROM vhffs_acl"; - my $result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $acl_id = $result->[0][0] if ( defined $result->[0][0] ); - $acl_id++; - - $query = "INSERT INTO vhffs_acl VALUES('$acl_id' ,'".$entity->{'object_id'}."','$perm','".$object->{'object_id'}."')"; - } - $request = $main->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - - return 1; + my $query = 'UPDATE vhffs_acl SET perm = ? WHERE oid_src = ? AND oid_dst = ?'; + my $request = $main->{'db'}->prepare( $query ); + my $result = $request->execute($perm, $entity->{'object_id'}, $object->{'object_id'}) or return -1; + if($result && $result == 0) { + # If update fails for a connection error, $result would be false + # If no line are updated, $result is true but $result == 0 is true + # too ($result contains "0E0") + # No line updated, INSERT ACL + $query = 'INSERT INTO vhffs_acl(oid_src, perm, oid_dst) VALUES(?, ?, ?)'; + $request = $main->{'db'}->prepare($query); + $request->execute($entity->{'object_id'}, $perm, $object->{'object_id'}) or return -1; + + } + return 1; } @@ -158,28 +149,24 @@ { my ( $entity , $object , $main ) = @_; - return -1 if( ( $entity->fetch < 0 ) || ( $object->fetch < 0 ) ); + return -1 unless(defined $entity && defined $object ); my $query; my $request; - my $result; my $rows; - $query = "SELECT COUNT(*) FROM vhffs_acl WHERE perm IN ( '".Vhffs::Constants::ACL_MANAGEACL."', '".Vhffs::Constants::ACL_DELETE."') AND oid_dst='".$object->{'object_id'} ."'"; - $result = $main->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - return -1 if( ( ! defined $result ) || ( ! defined $result->[0][0] ) || ( $result->[0][0] <= 1 ) ); + $query = 'SELECT COUNT(*) FROM vhffs_acl WHERE perm IN (?, ?) AND oid_dst=?'; + $request = $main->{'db'}->prepare( $query ); + $request->execute(Vhffs::Constants::ACL_MANAGEACL, Vhffs::Constants::ACL_DELETE, $object->{'object_id'}) or return -1; + ($rows) = $request->fetchrow(); + # We want to have at least one person who can handle ACLs + return -1 if( $rows <= 1 ); - $query = "SELECT perm FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + # OK, there is someone to handle ACL after we delete this one => let's go + $query = 'DELETE FROM vhffs_acl WHERE oid_src = ? AND oid_dst = ?'; + $request = $main->{'db'}->prepare( $query ); + $request->execute( $entity->{'object_id'}, $object->{'object_id'}); - - if ( $rows != 0 ) - { - my $query = "DELETE FROM vhffs_acl WHERE oid_src='".$entity->{'object_id'}."' AND oid_dst='".$object->{'object_id'} ."'"; - $request = $main->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - } return 1; } @@ -187,11 +174,11 @@ sub getall_acl_for_user_per_object { my ( $obj , $main ) = @_; - return -1 if( $obj->fetch < 0 ); + return -1 unless( defined $obj ); - my $query = "SELECT users.username, perm FROM vhffs_acl acl, vhffs_users users WHERE oid_src=users.object_id AND oid_dst='".$obj->{'object_id'} ."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - return undef if( $request->execute <= 0 ); + my $query = 'SELECT u.username, acl.perm FROM vhffs_acl acl INNER JOIN vhffs_users u ON u.object_id = acl.oid_src WHERE oid_dst=?'; + my $request = $main->{'db'}->prepare( $query ); + return undef if( !$request->execute( $obj->{'object_id'} ) ); return ( $request->fetchall_hashref('username') ); } @@ -206,11 +193,11 @@ $obj = shift; $main = shift; - return -1 if( $obj->fetch < 0 ); + return -1 unless( defined $obj ); - $query = "SELECT groups.groupname, perm FROM vhffs_acl acl, vhffs_groups groups WHERE oid_src=groups.object_id AND oid_dst='".$obj->{'object_id'} ."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); - return undef if( $request->execute <= 0 ); + $query = 'SELECT g.groupname, perm FROM vhffs_acl acl INNER JOIN vhffs_groups g ON acl.oid_src = g.object_id WHERE acl.oid_dst = ?'; + $request = $main->{'db'}->prepare( $query ); + return undef if( !$request->execute($obj->{'object_id'}) ); return ( $request->fetchall_hashref('groupname') ); } Modified: trunk/vhffs-api/src/Vhffs/Conf.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Conf.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Conf.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -95,9 +95,9 @@ } -sub get_databases +sub get_database { - return $Config{"databases"}; + return $Config{"database"}; } @@ -233,14 +233,6 @@ } -sub use_largefile -{ - return -1 if( ! defined $Config{"global"}{"modules"}{'use_largefile'} ); - return 1 if( $Config{"global"}{"modules"}{'use_largefile'} eq "yes"); - return 0; -} - - sub use_repository { return -1 if( ! defined $Config{"global"}{"modules"}{'use_repository'} ); @@ -266,13 +258,6 @@ -sub use_mailling -{ - return -1 if( ! defined $Config{"global"}{"modules"}{'use_mailling'} ); - return 1 if( $Config{"global"}{"modules"}{'use_mailling'} eq "yes"); - return 0; -} - sub use_mailing { return -1 if( ! defined $Config{"global"}{"modules"}{'use_mailing'} ); @@ -429,7 +414,12 @@ return $Config{"services"}{"mysql"}{"username"}; } +sub get_mysql_mysqldump_path +{ + return $Config{"services"}{"mysql"}{"mysqldump_path"}; +} + sub get_pgsql_admin_pass { return $Config{"services"}{"postgresql"}{"password"}; @@ -445,7 +435,12 @@ return $Config{"services"}{"postgresql"}{"username"}; } +sub get_pgsql_pgdump_path +{ + return $Config{"services"}{"postgresql"}{"pgdump_path"}; +} + sub get_svn_repodir { if( defined $Config{"services"}{"subversion"}{"repo_dir"} ) @@ -548,6 +543,13 @@ return 0; } +sub get_panel_subscribe_code_encrypt_key +{ + my $key = $Config{"global"}{"panel"}{"subscribe_code_encrypt_key"}; + return "" unless( $key =~ /\w{8}/ ); + return $key; +} + sub get_panel_avatar { if( $Config{"global"}{"panel"}{"use_avatar"} ) @@ -892,22 +894,6 @@ return undef; } -sub largefile_mirrors -{ - if( defined $Config{"services"}{"largefile"}{"mirrors"}{"server"} ) - { - return( $Config{"services"}{"largefile"}{"mirrors"}{"server"} ); - } -} - -sub largefile_upload_host -{ - if( defined $Config{"services"}{"largefile"}{"upload-host"} ) - { - return( $Config{"services"}{"largefile"}{"upload-host"} ); - } -} - sub get_www_archives { if( defined $Config{"services"}{"listengine"}{"www-archives"} ) Modified: trunk/vhffs-api/src/Vhffs/Constants.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Constants.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Constants.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -7,8 +7,8 @@ use constant { - VHFFS_VERSION => "4.0.0", - VHFFS_RELEASE_NAME => "koala", + VHFFS_VERSION => '4.1-alpha (Revision: 547)', + VHFFS_RELEASE_NAME => "hippocampus", WAITING_FOR_VALIDATION => 1, VALIDATION_REFUSED => 2, @@ -37,7 +37,6 @@ HOMEDIR => "web/", WEBDIR => "web/", CVSDIR => "cvs/", - LARGEFILEDIR => "largefile/", REPOSITORYDIR => "repository/", WEB_SUFFIX => "-web", @@ -47,11 +46,35 @@ DEFAULT_LANG => "en_US", ML_RIGHT_SUB_WAITING_FOR_REPLY => 2, + ML_RIGHT_SUB_WAITING_FOR_VALIDATION => 3, ML_RIGHT_SUB => 4, ML_RIGHT_ADMIN => 10, ML_RIGHT_SUB_WAITING_FOR_DEL => 12, + ML_SUBSCRIBE_NO_APPROVAL_REQUIRED => 0, + ML_SUBSCRIBE_APPROVAL_REQUIRED => 1, + ML_SUBSCRIBE_CLOSED => 2, + ML_POSTING_OPEN_ALL => 0, + ML_POSTING_MODERATED_ALL => 1, + ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS => 2, + ML_POSTING_MEMBERS_ONLY => 3, + ML_POSTING_MEMBERS_ONLY_MODERATED => 4, + ML_POSTING_ADMINS_ONLY => 5, + MAILS_DIR => "/usr/share/vhffs/mails/", + +# Objects' types + TYPE_USER => 10, + TYPE_GROUP => 11, + TYPE_HTTPD => 20, + TYPE_REPOSITORY => 21, + TYPE_MYSQL => 30, + TYPE_PGSQL => 31, + TYPE_CVS => 40, + TYPE_SVN => 41, + TYPE_DNS => 50, + TYPE_MAIL => 60, + TYPE_ML => 61, }; 1; @@ -107,8 +130,6 @@ =head2 CVSDIR -=head2 LARGEFILEDIR - =head2 USER_NORMAL =head2 USER_ADMIN Property changes on: trunk/vhffs-api/src/Vhffs/Constants.pm ___________________________________________________________________ Name: svn:keywords + Revision Modified: trunk/vhffs-api/src/Vhffs/DB.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/DB.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/DB.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -62,18 +62,18 @@ $tmp = Vhffs::Functions::db_connect $config->{'dbread'}; return( undef ) if( ! ( defined( $tmp ) ) ); - $self->{'DB_READ'} = $tmp; + $self = $tmp; #If the database to write is not defined, we use the database to read if( ! defined $config->{'dbwrite'} ) { - $self->{'DB_WRITE'} = $self->{'DB_READ'}; + $self = $self; } else { $tmp = Vhffs::Functions::db_connect $config->{'dbwrite'}; return( undef ) if( ! ( defined( $tmp ) ) ); - $self->{'DB_WRITE'} = $tmp; + $self = $tmp; } return $self; @@ -95,9 +95,9 @@ now: - * $db->{'DB_READ'} is a DBI object for read database + * $db is a DBI object for read database - * $db->{'DB_WRITE'} is a DBI object for write database + * $db is a DBI object for write database Typical use : use Vhffs::Main; Modified: trunk/vhffs-api/src/Vhffs/Functions.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Functions.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Functions.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -44,6 +44,34 @@ my $password; srand(time ^ $$); +my @STATUS_STRINGS; +$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_VALIDATION] = 'Waiting for validation'; +$STATUS_STRINGS[Vhffs::Constants::VALIDATION_REFUSED] = 'Validation refused'; +$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_CREATION] = 'Waiting for creation'; +$STATUS_STRINGS[Vhffs::Constants::CREATING_ERROR] = 'Creation error'; +$STATUS_STRINGS[Vhffs::Constants::CREATED] = 'Created'; +$STATUS_STRINGS[Vhffs::Constants::ACTIVATED] = 'Activated'; +$STATUS_STRINGS[Vhffs::Constants::SUSPENDED] = 'Suspended'; +$STATUS_STRINGS[Vhffs::Constants::SUSPENDED_BEFORE_DELETED] = 'Suspended before deletion'; +$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_MODIFICATION] = 'Waiting for modification'; +$STATUS_STRINGS[Vhffs::Constants::MODIFICATION_ERROR] = 'Modification error'; +$STATUS_STRINGS[Vhffs::Constants::MODIFICATION_APPLIED] = 'Modification applied'; +$STATUS_STRINGS[Vhffs::Constants::TO_DELETE] = 'Will be deleted'; + + +my @TYPES_STRINGS; +$TYPES_STRINGS[Vhffs::Constants::TYPE_USER] = 'User'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_GROUP] = 'Group'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_HTTPD] = 'Webarea'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_REPOSITORY] = 'Download Repository'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_MYSQL] = 'MySQL DB'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_PGSQL] = 'PgSQL DB'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_CVS] = 'CVS Repository'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_SVN] = 'SVN Repository'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_DNS] = 'Domain Name'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_MAIL] = 'Mail Domain'; +$TYPES_STRINGS[Vhffs::Constants::TYPE_ML] = 'Mailing List'; + sub hash_mxdomain { my $domain = shift; @@ -243,6 +271,11 @@ ($backend_config) = @_; + if( ! defined $backend_config ) + { + print "Oops!: I wonder if I am blind but I cannot find the backend area in the vhffs configuration file :/, could you help me ?\n"; + exit -1; + } #Default port; @@ -255,14 +288,14 @@ $host = $backend_config->{'db_host'} if( defined( $backend_config->{'db_host'} ) ); $dbparams = "dbname=$backend_config->{'db_name'};host=$host;port=$port"; - $dbh = DBI->connect("DBI:$driver:$dbparams",$backend_config->{'db_username'}, $backend_config->{'db_password'}) || (print STDERR "Cant connect: $DBI::errstr\n" and return undef); + $dbh = DBI->connect("DBI:$driver:$dbparams",$backend_config->{'db_username'}, $backend_config->{'db_password'}) || (warn "Cant connect: $DBI::errstr\n" and return undef); return( $dbh ); } else { - print "the backend you specify in your config file is not supported in Vhffs"; + print "Oops!: The backend you specify in your config file is not supported in Vhffs\n"; exit -1; } } @@ -353,58 +386,14 @@ -sub status_string_from_status_id -{ - my $status = shift; +sub status_string_from_status_id($) { + my $status = shift; + return gettext($STATUS_STRINGS[$status] or 'Unknown'); +} - if( $status == Vhffs::Constants::WAITING_FOR_VALIDATION ) - { - return gettext("Waiting for validation"); - } - elsif( $status == Vhffs::Constants::VALIDATION_REFUSED ) - { - return gettext("Validation refused"); - } - elsif( $status == Vhffs::Constants::WAITING_FOR_CREATION ) - { - return gettext("Waiting for creation"); - } - elsif( $status == Vhffs::Constants::CREATING_ERROR ) - { - return gettext("Creating error"); - } - elsif( $status == Vhffs::Constants::CREATED ) - { - return gettext("Created"); - } - elsif( $status == Vhffs::Constants::ACTIVATED ) - { - return gettext("Activated"); - } - elsif( $status == Vhffs::Constants::SUSPENDED ) - { - return gettext("Suspended"); - } - elsif( $status == Vhffs::Constants::SUSPENDED_BEFORE_DELETED ) - { - return gettext("Suspended before deletion"); - } - elsif( $status == Vhffs::Constants::WAITING_FOR_MODIFICATION ) - { - return gettext("Waiting for modification"); - } - elsif( $status == Vhffs::Constants::MODIFICATION_ERROR ) - { - return gettext("Modification error"); - } - elsif( $status == Vhffs::Constants::MODIFICATION_APPLIED ) - { - return gettext("Modification applied"); - } - elsif( $status == Vhffs::Constants::TO_DELETE ) - { - return gettext("Will be deleted"); - } +sub type_string_from_type_id($) { + my $type = shift; + return gettext($TYPES_STRINGS[$type] or 'Unknown'); } sub mail_template @@ -417,7 +406,7 @@ $file = Vhffs::Constants::MAILS_DIR . "/" . $template; - return( -1 ) if( $user->fetch != 1 ); + return( -1 ) if( ! defined $user ); return( -1 ) if( ! -f $file ); return( -1 ) if( ! -r $file ); @@ -447,7 +436,29 @@ return( 1 ); } +=pod +=head2 check_domain_name + + die "Domain name is invalid (you can't use FQDN)\n" unless(Vhffs::Function::check_domain_name($name)); + die "Domain name is invalid (could be FQDN or not)\n" unless(Vhffs::Function::check_domain_name($name, 1)); + +Checks for domain name validity. + +=cut + +sub check_domain_name($;$) { + my $domain_name = shift; + my $fqdn = shift; + $domain_name =~ s/\.$// if($fqdn); + return (defined $domain_name && length($domain_name) >= 5 && $domain_name =~ /^(?:[a-z0-9\-]{1,63}[.])+([a-z0-9]{2,10})$/); +} + +sub check_ip($) { + my $ip = shift; + return (defined $ip && $ip =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/); +} + sub rotate_log { use File::Basename; Modified: trunk/vhffs-api/src/Vhffs/Group.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Group.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Group.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -31,142 +31,27 @@ package Vhffs::Group; -#Vhffs::Group written by sod` <dieu AT gunnm DOT org> use base qw(Vhffs::Object); use strict; use DBI; +=head1 NAME -sub new -{ - my $groupname; - my $owner; - my $this; - my $class; - my $self; - my $princ; - my $user; - my $gid; +Vhffs::Object - Handle a group in VHFFS - $class = shift; - $princ = shift; - $groupname = shift; - $owner = shift; - $gid = shift; - - $this={}; - - $groupname = get_name_by_gid( $princ , $gid ) if( ( defined $gid ) && ( $gid =~ /[\d]+/ ) ); - - return undef if( ! ( defined $groupname ) ); - return undef if( ! ( $groupname =~ /^[a-z0-9]+$/ ) ); - return undef if( length( $groupname ) < 3 ); - - $this = $class->SUPER::new( $princ , 0 , $owner ); - - - $this->{'groupname'} = $groupname if ( defined $groupname ); - $this->{'gid'} = $gid; - - bless( $this , $class ); - -} +=head1 SYNOPSIS +TODO +=head1 DESCRIPTION +TODO +=head1 METHODS +=cut -# Simply get a unix group. In other words, only the gid and the groupname are fetched -# fetch_unix is not used any more -sub fetch_unix -{ - my $request; - my $result; - my $self; - my $query; - - $self = shift; - - $request = "SELECT * FROM vhffs_groups where groupname='$self->{'groupname'}'" if ( defined $self->{'groupname'} ); -# $request = "SELECT * FROM vhffs_groups where gid='$self->{'gid'}'" if ( defined $self->{'gid'} ); - - $result = $self->{'db'}->{'DB_READ'}->prepare($request) or return -1; - $result->execute() or return -1; - - return -1 if ( $result->rows != 1 ); - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_}; - } - - return 1; -} - - - -# Simply get a complete group with intos -sub fetch -{ - my $groupname; - my $request; - my $result; - my $request2; - my $result2; - my $self; - my $query; - my $hash; - - $self = shift; - - - $request = "SELECT * FROM vhffs_groups where groupname='$self->{'groupname'}'"; - - $result = $self->{'db'}->{'DB_READ'}->prepare($request) or return -1; - my $rows = $result->execute() or return -1; - - return -1 if ( $rows == 0 ); - - - $hash = $result->fetchrow_hashref(); - - foreach ( keys %{$hash} ) - { - $self->{$_} = $hash->{$_}; - } - - - $request2 = "SELECT * FROM vhffs_groups_info where gid='$self->{'gid'}'"; - - - $result2 = $self->{'db'}->{'DB_READ'}->prepare($request2) or return -1; - $result2->execute() or return -1; - $hash = $result2->fetchrow_hashref(); - - foreach ( keys %{$hash} ) - { - #Fix DB bug, quota and quota_used is in vhffs_groups and vhffs_groups_info - next if( $_ eq "quota"); - next if( $_ eq "quota_used"); - $self->{$_} = $hash->{$_}; - } - - - return -2 if( $self->SUPER::fetch < 0 ); - - $self->{group} = $self; - - return 1; -} - - - - - - - # get all unix groups and return it as an hashref #THIS IS NOT A METHOD IT'S JUST A FUNCTION sub get_all_unix @@ -177,102 +62,86 @@ $dbh = shift; - $result = $dbh->selectall_hashref("SELECT * FROM vhffs_groups" , "gid" ) || die( "cannot fetch all groups" ); + $result = $dbh->selectall_hashref('SELECT * FROM vhffs_groups' , "gid" ) || die( "cannot fetch all groups" ); return $result; } +sub check_groupname($) { + my $groupname = shift; + return ( defined $groupname && $groupname =~ /^[a-z0-9]{3,12}$/ ); +} + +=pod -#create a new group with the name given in parameter -sub create -{ - my $self; - my $config; - my $conf; - my $result; - my $request; - my $gid; - my $owneruid; - my $query; - my $badgroups; - my $oid; - my $rows; - my $quota; +=head2 create + my $group = Vhffs::Group::create($main, $groupname, $owner_uid, $gid, $description) - $self = shift; +Create in DB and return a fully functional group. - - $conf = $self->{'main'}->get_config->get_users; +=cut - return -1 if ( ! defined $self->{'groupname'} ); - - $self->{'groupname'} =~ tr/A-Z/a-z/; - - $badgroups = $self->{'main'}->get_config->get_bad_groupname; - if( defined $badgroups ) - { - - foreach ( @{$badgroups} ) - { - return -10 if ( $_ eq $self->{"groupname"} ); +sub create { + my ($main, $groupname, $owner_uid, $gid, $description) = @_; + return undef unless check_groupname($groupname); + return undef unless defined($owner_uid); + my $badgroups = $main->get_config->get_bad_groupname; + if( defined $badgroups ) { + foreach ( @{$badgroups} ) { + return undef if ( $_ eq $groupname ); } } + my $groupconf = $main->get_config->get_users; + my $group; + my $dbh = $main->get_db_object; + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; - #default init - $self->{'gid'} = $conf->{'mingid'}; - - #first, we check if the group doesn't exists - $query ="SELECT * FROM vhffs_groups WHERE groupname= '" .$self->{'groupname'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + # Avoid an error if we're already in a transaction + # (eg. when creating user). + my $transaction_started; + if($dbh->{AutoCommit}) { + # AutoCommit is on => we're not yet in a + # transaction, let's start one + $dbh->begin_work; + $transaction_started = 1; + } else { + # We're already in a transaction, ensure that + # we don't corrupt it. + $transaction_started = 0; + } - return -1 if ( $rows > 0 ); - - #Create the related object - $oid = $self->SUPER::create; + eval { + my $parent = Vhffs::Object::create($main, $owner_uid, $description, undef, Vhffs::Constants::TYPE_GROUP); + die('Unable to create parent object') unless(defined $parent); - return -1 if ( $oid lt 0 ); + my $quota = $groupconf->{default_quota} || 10; + # Special case : sometimes, gid can be passed to create + # to avoid updates (cf Vhffs::User::create) + ($gid) = $dbh->selectrow_array('SELECT nextval(\'vhffs_groups_gid_seq\')') unless defined $gid; + + my $query = 'INSERT INTO vhffs_groups(gid, groupname, passwd, quota, quota_used, owner_uid, uid_mod, object_id) VALUES(?, ?, NULL, ?, 0, ?, ?, ?)'; + my $sth = $dbh->prepare( $query ); + $sth->execute($gid, $groupname, $quota, $owner_uid, $owner_uid, $parent->get_oid); + $dbh->commit if($transaction_started); + $group = get_by_gid($main, $gid); + }; + if($transaction_started && $@) { + warn "Unable to create group $groupname: $@\n"; + $dbh->rollback; + } - #Quota initialization - #One day, god decide that : "10Mb ? It will be enough for everyone" - # "God smoke too much herb" - $quota = 10; - $quota = $conf->{'default_quota'} if( ( defined $conf ) && ( defined $conf->{'default_quota'} ) ); - $self->{'quota'} = $quota; - $self->{'quota_used'} = $quota; + return $group; - - - # compute the gid - $self->{'gid'} = $conf->{'mingid'}; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(gid) FROM vhffs_groups"); - $gid = $result->[0][0] + 1 if( $result->[0][0] ); - $self->{'gid'} = $gid if ( ( $gid ) && ( $gid > $conf->{'mingid'}) ); - - - #finally, create the group - $query = "INSERT INTO vhffs_groups VALUES('" . $self->{'gid'} . "' , '" . $self->{'groupname'} . "' , NULL , '".$quota."' , '".$quota."' , '$oid')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ) or return -2; - $request->execute() or return -3; - - - $query = "INSERT INTO vhffs_groups_info VALUES( '" . $self->{'gid'} ."' , '".$self->{'owner_uid'}."' , '".$self->{'owner_uid'}."')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query) or return -2; - $request->execute() or return -3; - - $self->commit; - - return $self->{'gid'}; } - -sub remove_user_from_group +sub remove_user { use Vhffs::Constants; @@ -281,17 +150,14 @@ my $query; my $request; - my $rows; + my $result; - $query ="SELECT * FROM vhffs_user_group WHERE gid= '" .$self->{'gid'}."' AND uid='".$user->get_uid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; - - return -1 if ( $rows == 0 ); - - $query = "UPDATE vhffs_user_group SET state='".Vhffs::Constants::TO_DELETE."' WHERE gid= '" .$self->{'gid'}."' AND uid='".$user->get_uid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $request->execute; + $query = 'UPDATE vhffs_user_group SET state=? WHERE gid=? AND uid=?'; + $request = $self->{'db'}->prepare( $query ); + $result = $request->execute(Vhffs::Constants::TO_DELETE, $self->{'gid'}, $user->get_uid); + # execute return false if an error occurs and '0E0' (which is true but == 0) + # if 0 rows are altered + return -1 if($result == 0); return 1; @@ -307,17 +173,10 @@ # $self->{'quota'} = $self->{'main'}->get_config->get_users->{'default_quota'} if ( ! defined $self->{'quota'} ); # $self->{'quota_used'} = $self->{'quota'} if ( ! defined $self->{'quota_used'} ); - my $request_unix = "UPDATE vhffs_groups SET quota='".$self->{'quota'}."', quota_used='".$self->{'quota_used'}."' WHERE gid=".$self->{'gid'}; + my $sql = 'UPDATE vhffs_groups SET quota = ?, quota_used = ?, owner_uid = ?, uid_mod = ? WHERE gid = ?'; + my $sth = $self->{db}->prepare($sql); + $sth->execute( $self->{'quota'}, $self->{'quota_used'}, $self->{'owner_uid'}, $self->{'uid_mod'}, $self->{'gid'}) or return -1; - $self->{'uid_mod'} = $self->{'owner_uid'} if ( !defined $self->{'uid_mod'} ); - - my $request_info = "UPDATE vhffs_groups_info SET owner_uid = '".$self->{'owner_uid'}."', uid_mod = '".$self->{'uid_mod'}."' WHERE gid=".$self->{'gid'}; - my $result_unix = $self->{'db'}->{'DB_WRITE'}->prepare($request_unix); - my $result_info = $self->{'db'}->{'DB_WRITE'}->prepare($request_info); - - $result_unix->execute or return -1; - $result_info->execute or return -1; - #Exec the super method ! return -2 if( $self->SUPER::commit < 0 ); @@ -338,43 +197,48 @@ if( $config->use_web == 1 ) { - $query ="SELECT * FROM vhffs_httpd WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_httpd WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } if( $config->use_cvs == 1 ) { - $query ="SELECT * FROM vhffs_cvs WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_cvs WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } if( $config->use_svn == 1 ) { - $query ="SELECT * FROM vhffs_svn WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_svn WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } if( $config->use_mail == 1 ) { - $query ="SELECT * FROM vhffs_mxdomain WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_mxdomain WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } if( $config->use_dns == 1 ) { - $query ="SELECT * FROM vhffs_dns_global WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_dns WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } @@ -382,9 +246,10 @@ if( $config->use_postgres == 1 ) { - $query ="SELECT * FROM vhffs_pgsql WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_pgsql WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } @@ -393,9 +258,10 @@ if( $config->use_mysql == 1 ) { - $query ="SELECT * FROM vhffs_mysql WHERE owner_gid='".$self->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + $query ='SELECT COUNT(*) FROM vhffs_mysql WHERE owner_gid=?'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid ); + ($rows) = $request->fetchrow(); return 0 if( $rows != 0 ); } @@ -407,9 +273,10 @@ { my $self = shift; my $user = shift; - my $query ="SELECT * FROM vhffs_user_group WHERE gid='".$self->get_gid."' AND uid='".$user->get_uid."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + my $query ='SELECT COUNT(*) FROM vhffs_user_group WHERE gid=? AND uid=?'; + my $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->get_gid, $user->get_uid ); + my ( $rows ) = $request->fetchrow(); return 1 if( $rows == 1 ); return -1; } @@ -425,17 +292,9 @@ $self = shift; - return 2 if ( $self->fetch < 0 ); + $request = $self->{'db'}->prepare('DELETE FROM vhffs_groups WHERE gid=?'); + $request->execute($self->{'gid'}) or return -1; - - $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_groups WHERE gid='".$self->{'gid'}."'"); - $request2 = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_user_group WHERE gid='".$self->{'gid'}."'"); - $request3 = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_groups_info WHERE gid='".$self->{'gid'}."'"); - - $request->execute() or return -1; - $request2->execute() or return -2; - $request3->execute() or return -2; - $self->SUPER::delete; return 1; @@ -454,16 +313,9 @@ $self->{$field} = $value; - if( $field eq "groupname" ) - { - # VERIFY IF THE GROUP EXISTS FIX IT NOW - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_groups SET groupname=$value WHERE gid='$self->{'gid'}'"); - } - else - { - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_groups SET $field='$value' WHERE gid='$self->{'gid'}'"); - } - $request->execute() or return -1; + # We don't need a special case for groupname, uniqueness is ensured by DB (we return -1 if groupname already exists) + $request = $self->{'db'}->prepare("UPDATE vhffs_groups SET $field=? WHERE gid=?"); + $request->execute( $value, $self->{'gid'} ) or return -1; return 1; } @@ -473,11 +325,11 @@ { my( $self , $user ) = @_; - return -1 if( $user->fetch < 0 ); + return -1 if( ! defined $user ); - my $query = "INSERT INTO vhffs_user_group VALUES('" . $user->{'uid'} . "' , '" . $self->{'gid'} . "' , '".Vhffs::Constants::WAITING_FOR_CREATION."')"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ) or return -2; - $request->execute() or return -3; + my $query = 'INSERT INTO vhffs_user_group( uid, gid, state) VALUES( ?, ?, ? )'; + my $request = $self->{'db'}->prepare( $query ) or return -2; + $request->execute($user->{'uid'}, $self->{'gid'}, Vhffs::Constants::WAITING_FOR_CREATION) or return -3; return 1; @@ -532,8 +384,8 @@ { my $main = shift; my $gid = shift; - my $request = $main->{'db'}->{'DB_READ'}->prepare("SELECT groupname FROM vhffs_groups where gid='".$gid."'") or return -2; - my $rows = $request->execute(); + my $request = $main->{'db'}->prepare('SELECT groupname FROM vhffs_groups where gid= ?') or return -2; + my $rows = $request->execute($gid); if( $rows == 0 ) { @@ -541,8 +393,8 @@ } else { - my $result = $request->fetchrow_hashref(); - return( $result->{groupname} ); + my ( $result ) = $request->fetchrow(); + return( $result ); } } @@ -551,8 +403,8 @@ sub get_owner_username { my $self = shift; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_users where uid='".$self->{'owner_uid'}."'") or return -2; - my $rows = $request->execute(); + my $request = $self->{'db'}->prepare('SELECT username FROM vhffs_users where uid=?') or return -2; + my $rows = $request->execute($self->{'owner_uid'}); if( $rows == 0 ) { @@ -560,8 +412,8 @@ } else { - my $result = $request->fetchrow_hashref(); - return( $result->{username} ); + my ($result) = $request->fetchrow(); + return( $result ); } } @@ -573,8 +425,8 @@ { my( $self , $username ) = @_; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_users where username='".$username."'") or return -2; - my $rows = $request->execute; + my $request = $self->{'db'}->prepare('SELECT uid FROM vhffs_users where username=?') or return -2; + my $rows = $request->execute( $username ); if( $rows == 0 ) { @@ -607,15 +459,14 @@ my $vhffs = shift; return if ( !defined $vhffs ); - my @groups; - my $query = "SELECT groupname FROM vhffs_groups WHERE groupname NOT IN (SELECT username FROM vhffs_users) ORDER BY vhffs_groups.gid DESC LIMIT 10"; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); $request->execute; - while( my $row = $request->fetchrow_arrayref ) + my @groups; + my $query = 'SELECT g.gid FROM vhffs_groups g LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL ORDER BY g.gid DESC LIMIT 10'; + my $request = $vhffs->{'db'}->prepare( $query ); + $request->execute; + while( my ($gid) = $request->fetchrow_array ) { - my $group = new Vhffs::Group( $vhffs , $row->[0] , '401' ); - if( $group->fetch > 0 ) - { push @groups , $group; - } + my $group = Vhffs::Group::get_by_gid( $vhffs , $gid ); + push @groups , $group; } return \@groups; } @@ -626,16 +477,15 @@ use Vhffs::User; my $self = shift; - return undef if( $self->fetch < 0 ); my @users; my $gid = $self->get_gid; - my $query = "SELECT u.username FROM vhffs_users u, vhffs_user_group ug WHERE ug.gid='".$gid."' AND u.uid=ug.uid"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $request->execute; - while( my $row = $request->fetchrow_arrayref ) + my $query = 'SELECT ug.uid FROM vhffs_user_group ug WHERE ug.gid = ?'; + my $request = $self->{'db'}->prepare( $query ); + $request->execute($gid); + while( my ($uid) = $request->fetchrow_array ) { - my $user = new Vhffs::User( $self->{'main'} , $row->[0] , '401' ); - push( @users , $user ) if( $user->fetch ); + my $user = Vhffs::User::get_by_uid( $self->{'main'} , $uid ); + push( @users , $user ) if( defined $user ); } return \@users; } @@ -646,8 +496,7 @@ if( ! defined $self->{'user'} ) { - $self->{'user'} = new Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} ); - $self->{'user'}->fetch if( defined $self->{'user'} ); + $self->{'user'} = Vhffs::User::get_by_uid( $self->{'main'}, $self->{'owner_uid'} ); } return( $self->{'user'} ); @@ -660,28 +509,29 @@ my $state = shift; my $user = shift; my $name; - return undef if( $user->fetch < 0 ); + return undef if( ! defined $user ); my $db = $vhffs->get_db_object; my @result; - my $query = "SELECT groupname FROM vhffs_groups g, vhffs_object o , vhffs_user_group ug WHERE ug.gid=g.gid AND g.object_id=o.object_id AND g.groupname NOT IN (SELECT username FROM vhffs_users ) AND ug.uid=".$user->get_uid; + my $query = 'SELECT g.gid FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id INNER JOIN vhffs_user_group ug ON ug.gid=g.gid LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL AND ug.uid = '.$user->get_uid; + $query .= " AND o.state=$state " if( defined $state ); $query .= " ORDER BY g.groupname"; - my $request = $db->{'DB_READ'}->prepare( $query ); + my $request = $db->prepare( $query ); my $rows = $request->execute; return undef if( $rows <= 0 ); - my $names = $request->fetchall_arrayref; + my $gids = $request->fetchall_arrayref; my $group; - foreach $name ( @{$names} ) + foreach my $gid ( @{$gids} ) { - $group = new Vhffs::Group( $vhffs , $name->[0] , '401' ); - push( @result , $group) if( $group->fetch > 0 ); + $group = Vhffs::Group::get_by_gid( $vhffs , $gid->[0] ); + push( @result , $group) if( defined $group ); } return \@result; } @@ -695,14 +545,14 @@ my $db = $vhffs->get_db_object; my @result; - my $query = "SELECT groupname FROM vhffs_groups g, vhffs_object o WHERE g.object_id=o.object_id AND g.groupname NOT IN (SELECT username FROM vhffs_users ) "; + my $query = 'SELECT groupname FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id=o.object_id LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL '; $query .= " AND o.state=$state " if( defined $state ); $query .= " AND g.groupname LIKE '%".$name."%' " if( defined $name ); $query .= " ORDER BY g.groupname"; - my $request = $db->{'DB_READ'}->prepare( $query ); + my $request = $db->prepare( $query ); my $rows = $request->execute; return undef if( $rows <= 0 ); @@ -712,9 +562,8 @@ my $group; foreach $name ( @{$names} ) { - - $group = new Vhffs::Group( $vhffs , $name->[0] , '401' ); - push( @result , $group) if( $group->fetch > 0 ); + $group = Vhffs::Group::get_by_groupname( $vhffs , $name->[0] ); + push( @result , $group) if( defined $group ); } return \@result; } @@ -733,7 +582,7 @@ my $query = 'SELECT groupname FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id=o.object_id LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL AND g.groupname LIKE ?'; $query .= "AND o.state=$state " if( defined $state ); - my $request = $db->{'DB_READ'}->prepare( $query ); + my $request = $db->prepare( $query ); return undef if( ! $request->execute( $letter ) ); my $names = $request->fetchall_arrayref; @@ -742,11 +591,100 @@ foreach my $name ( @{$names} ) { - $group = new Vhffs::Group( $vhffs , $name->[0] , '401' ); - push( @result , $group) if( $group->fetch > 0 ); + $group = Vhffs::Group::get_by_groupname( $vhffs , $name->[0] ); + push( @result , $group) if( defined $group ); } return \@result; } +sub getall_quotalimit +{ + my $vhffs = shift; + my $limit = shift; + $limit = 10 if(! defined $limit ); + my $db = $vhffs->get_db_object; + my @result; + my $query = 'SELECT groupname FROM vhffs_groups g LEFT JOIN vhffs_users u ON g.groupname = u.username WHERE g.quota_used >= 0.9 * g.quota AND u.uid IS NULL LIMIT ?'; + + my $request = $db->prepare( $query ); + my $rows = $request->execute($limit); + + return undef if( $rows <= 0 ); + + my $names = $request->fetchall_arrayref; + + my $group; + foreach my $name ( @{$names} ) + { + $group = Vhffs::Group::get_by_groupname( $vhffs , $name->[0] ); + push( @result , $group) if( defined $group ); + } + return \@result; +} + +=pod + +=head2 get_by_gid + + my $group = Vhffs::Group::get_by_gid($main, $gid); + die('Group not found') unless(defined $group); + +Fetches the group whose gid is $gid. + +=cut + +sub get_by_gid { + my ($vhffs, $gid) = @_; + my $query = 'SELECT g.gid, o.object_id, o.owner_uid, g.uid_mod, g.groupname, g.passwd, g.quota, g.quota_used, o.date_creation, o.description, o.state FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE g.gid = ?'; + + my $dbh = $vhffs->get_db_object; + my @params = $dbh->selectrow_array($query, undef, $gid); + return undef unless(@params); + my $group = _new Vhffs::Group($vhffs, @params); + return $group; +} + +=pod + +=head2 get_by_groupname + + my $group = Vhffs::Group::get_by_groupname($main, $groupname); + die('Group not found') unless(defined $group); + +Fetches the group whose name is $groupname. + +=cut + +sub get_by_groupname { + my ($vhffs, $groupname) = @_; + my $query = 'SELECT g.gid, o.object_id, o.owner_uid, g.uid_mod, g.groupname, g.passwd, g.quota, g.quota_used, o.date_creation, o.description, o.state FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE g.groupname = ?'; + + my $dbh = $vhffs->get_db_object; + my @params = $dbh->selectrow_array($query, undef, $groupname); + return undef unless(@params); + my $group = _new Vhffs::Group($vhffs, @params); + return $group; +} + + +sub _new { + no strict 'refs'; + my ($class, $main, $gid, $oid, $owner_uid, $uid_mod, $groupname, $passwd, $quota, $quota_used, $date_creation, $description, $state) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_GROUP); + return undef unless(defined $self); + foreach (qw (gid uid_mod groupname passwd quota quota_used) ) { + eval '$self->{$_} = $'.$_; + } + return $self; +} + 1; + +__END__ + +=head1 AUTHORS + +soda <dieu AT gunnm DOT org> + +Sebastien Le Ray <beuss at tuxfamily dot org> Modified: trunk/vhffs-api/src/Vhffs/Listengine/Intl.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Listengine/Intl.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Listengine/Intl.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -29,16 +29,12 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. - - package Vhffs::Listengine::Intl; - use locale; use Locale::gettext; - sub generate_help { my $list = shift; @@ -48,8 +44,7 @@ push( @result , "\n" ); push( @result , gettext( "All commands can be sent as mail subject.\n" ) ); push( @result , gettext( "You can also send a command list in the mail body.\n" ) ); - push( @result , gettext( "All mails with commands must be sent on - YOURLIST-request\@domain.tld list.\n" ) ); + push( @result , gettext( "All mails with commands must be sent on YOURLIST-request\@domain.tld list.\n" ) ); push( @result , "\n" ); push( @result , gettext("Here are the basic listengine commands:\n") ); push( @result , gettext("help\t\t - show this help\n") ); @@ -68,31 +63,30 @@ push( @result , gettext("\t\t\t\t RIGHT can be subscriber or admin\n") ); push( @result , gettext("user info user\@domain.tld\t\t - show this user's informations\n" )); - push( @result , "\n" ); - return( \@result ); } + sub new_sub { my $list = shift; my $from = shift; - my $hash = shift; + my $pass = shift; my @result; - push( @result , sprintf( "You send a request to subscribe to the following list: %s\n" , $list->get_listname) ); - push( @result , gettext( "You must confirm your request by sending a confirmation emailn\n") ); - push( @result , sprintf( gettext( "This mail must have the following subject : \"confirm subscribe %s\"\n") , $hash ) ); + push( @result , sprintf( "You sent a request to subscribe to the following list:\n\n%s\n\n" , $list->get_listname) ); + push( @result , gettext( "You must confirm your request by sending a confirmation email\n") ); + push( @result , sprintf( gettext( "This mail must have the following subject : \"confirm subscribe %s\"\n") , $pass ) ); push( @result , "\n" ); - push( @result , gettext( "If this mail is an error and you don't ask to be a subscriber to this list, please do not answer to this mail\n" ) ); + push( @result , gettext( "If you haven't asked to be subscribed to this list,\nplease don't answer to this mail\n" ) ); push( @result , "\n" ); - return( \@result ); } + sub new_unsub { my $list = shift; @@ -100,14 +94,13 @@ my $hash = shift; my @result; - push( @result , sprintf( "You ask to be removed from the list %s\n" , $list->get_listname) ); - push( @result , gettext( "You must confirm this request by seding a email\n") ); + push( @result , sprintf( "You asked to be removed from the following list:\n\n%s\n\n" , $list->get_listname) ); + push( @result , gettext( "You must confirm your request by sending a confirmation email\n") ); push( @result , sprintf( gettext( "This mail must contains the following subject : \"confirm unsubscribe %s\"\n") , $hash ) ); - push( @result , gettext( "If this mail is an error and you don't ask to be a subscriber to this list, please do not answer to this mail\n" ) ); push( @result , "\n" ); + push( @result , gettext( "If you haven't asked to be unsubscribed from this list,\nplease don't answer to this mail\n" ) ); push( @result , "\n" ); - return( \@result ); } @@ -118,29 +111,28 @@ my $from = shift; my @result; - push( @result , sprintf( gettext( "You ask to be subscribed to the following list: %s\n" ) , $list->get_listname) ); - push( @result , sprintf( gettext( "Adress %s is already a subscriber for this list.\n") , $from ) ); - push( @result , gettext( "The state of you subscription was not changed, you are always a subscriber\n") , $hash ); + push( @result , sprintf( gettext( "You asked to be subscribed to the following list:\n\n%s\n\n" ) , $list->get_listname) ); + push( @result , sprintf( gettext( "However you are (%s) already subscribed to this list.\n") , $from ) ); push( @result , "\n" ); + push( @result , gettext( "The state of you subscription was not changed, you are still subscribed\n") , $hash ); + push( @result , "\n" ); - return( \@result ); } + sub sub_deny { my $list = shift; my $from = shift; my @result; - push( @result , sprintf( gettext( "Subscribe to the list %s is forbidden\n" ) , $list->get_listname) ); - push( @result , gettext( "Your request has been removed.\n") ); - push( @result , "\n" ); + push( @result , sprintf( gettext( "Subscription to the following list is forbidden:\n\n%s\n\nHave a nice day.\n" ) , $list->get_listname) ); - return( \@result ); } + sub confirm_sub { my $list = shift; @@ -148,42 +140,57 @@ my @result; push( @result , sprintf( gettext( "You have been successfully subscribed to the list %s\n" ) , $list->get_listname) ); - push( @result , gettext( "------\n") ); - push( @result , gettext( "You can post on the list now.") ); - push( @result , gettext( "------\n") ); - push( @result , gettext( "You can have some help on listengine, sending an email to\n") ); - push( @result , sprintf( gettext( "%s-request\@%s with subject : \"help\"\n") , $list->get_localpart , $list->get_domain ) ); + push( @result , gettext( "\n") ); + push( @result , gettext( "You may get some help on listengine by sending an email to\n") ); + push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n") , $list->get_localpart , $list->get_domain ) ); push( @result , "\n" ); + return( \@result ); +} + + +sub confirm_sub_approvalneeded +{ + my $list = shift; + my $from = shift; + my @result; + + push( @result , sprintf( gettext( "You have been successfully subscribed to the list %s\n" ) , $list->get_listname) ); + push( @result , gettext( "\n") ); + push( @result , gettext( "However this list require approval for new subscribers.\n") ); + push( @result , gettext( "You will receive an email with the decision of administrators.\n") ); + push( @result , gettext( "\n") ); + push( @result , gettext( "You may get some help on listengine by sending an email to\n") ); + push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n") , $list->get_localpart , $list->get_domain ) ); + push( @result , "\n" ); return( \@result ); } + sub confirm_unsub { my $list = shift; my $from = shift; my @result; - push( @result , sprintf( gettext( "You have been successfully removed from the list %s\n" ) , $list->get_listname) ); + push( @result , sprintf( gettext( "You have been successfully removed from the following list:\n\n%s\n" ) , $list->get_listname) ); return( \@result ); } - sub error_sub { my $list = shift; my $from = shift; my @result; - push( @result , sprintf( gettext( "An error occurs while you subscribed to the list %s \n" ) , $list->get_listname) ); + push( @result , sprintf( gettext( "An error occured during your subscription to the following list:\n\n%s\n\n" ) , $list->get_listname) ); push( @result , gettext("The confirmation code was wrong\n" )); - push( @result , gettext("Please try again\n" )); + push( @result , gettext("Please try again !\n" )); push( @result , "\n" ); - return( \@result ); } @@ -200,10 +207,10 @@ push( @result , "\n" ); - return( \@result ); } + sub error_unsub { my $list = shift; @@ -216,7 +223,6 @@ push( @result , "\n" ); - return( \@result ); } @@ -232,10 +238,10 @@ push( @result , "\n" ); - return( \@result ); } + sub unsub_success { my $list = shift; @@ -263,6 +269,7 @@ return( \@result ); } + sub lang_change_error { my $list = shift; @@ -312,6 +319,7 @@ return( \@result ); } + sub refuse_success { my $list = shift; @@ -327,6 +335,7 @@ return( \@result ); } + sub moderate_error { my $list = shift; @@ -343,12 +352,12 @@ return( \@result ); } + sub moderate_success { my $list = shift; my $hash = shift; - push( @result , sprintf( gettext( "Mail with id %s") , $hash ) ); push( @result , sprintf( gettext( "in the moderation queue of the list %s") , $list->get_listname ) ); push( @result , gettext( "was sent on the list.\n" ) ); @@ -374,7 +383,6 @@ } - sub moderate_message { my $list = shift; @@ -394,6 +402,28 @@ return( \@result ); } + +sub moderate_subscriber +{ + my $list = shift; + my $from = shift; + my @result; + + push( @result , sprintf( gettext( "A new person wants to subscribe to the following mailing list:\n\n%s\n\n" ) , $list->get_listname) ); + push( @result , sprintf( gettext( "His email address is:\n %s\n" ) , $from) ); + push( @result , $subject ); + push( @result , "\n" ); + push( @result , gettext( "To accept this subscriber, send a message to\n" ) ); + push( @result , sprintf( gettext( " %s-request\@%s\nwith the following subject :\n \"accept %s\" \n" ) , $list->get_localpart , $list->get_domain , $from) ); + push( @result , "\n" ); + push( @result , gettext( "To refuse this subscriber, send a message to\n" ) ); + push( @result , sprintf( gettext( " %s-request\@%s\nwith the following subject :\n \"refuse %s\" \n" ) , $list->get_localpart , $list->get_domain , $from) ); + push( @result , "\n" ); + + return( \@result ); +} + + sub value_month { my $value = shift; @@ -446,15 +476,8 @@ { return gettext( "December" ); } - - - - return gettext( "Unknown month" ); - + return gettext( "Unknown month" ); } - - - 1; Modified: trunk/vhffs-api/src/Vhffs/Main.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Main.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Main.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -35,7 +35,6 @@ use strict; use DBI; use Vhffs::Functions; -use Vhffs::DB; use Vhffs::Conf; use constant @@ -69,14 +68,13 @@ #Finally, backend stuff - $db_config = $config->get_databases(); - $dbh = new Vhffs::DB( $db_config ); - if( defined $dbh ) - { - $self->{'db'} = $dbh; - } - else - { + $db_config = $config->get_database(); + + $dbh = Vhffs::Functions::db_connect $db_config; + if(defined $dbh) { + $self->{'db'} = $dbh; + } else { + warn "Unable to open database connection\n"; undef $self; } @@ -113,10 +111,21 @@ sub is_valid { - my $self = shift; - return 0 if( ! ( defined( $self->get_db_object ) ) ); + my $self = shift; + return (defined $self->{db} && $self->{db}->ping() > 0); +} - return 1; +sub reconnect { + my $self = shift; + + my $db_config = $self->{config}->get_database(); + + my $dbh = Vhffs::Functions::db_connect $db_config; + if(defined $dbh) { + $self->{'db'} = $dbh; + } else { + warn "Unable to open database connection\n"; + } } 1; Modified: trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Misc/Mailings.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -48,12 +48,8 @@ return -1 if ( ! defined $vhffs ); - my $db = $vhffs->get_db_object; - - my $id = 0; - $query = 'INSERT INTO vhffs_mailings (subject,message,date,state) VALUES( ? , ? , NOW() , ? )'; - $request = $db->{'DB_WRITE'}->prepare( $query ); + $request = $vhffs->{'db'}->prepare( $query ); $request->execute($subject, $message, Vhffs::Constants::WAITING_FOR_CREATION) or return -2; return 1; @@ -71,7 +67,7 @@ $query = "SELECT * FROM vhffs_mailings "; $query.= " WHERE state='".$state."'" if( defined $state ); - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $vhffs->{'db'}->prepare( $query ); $request->execute or return undef ; return $request->fetchall_hashref('id_mailing'); @@ -85,7 +81,7 @@ my $id = shift; my $db = $vhffs->get_db_object; $query = "DELETE FROM vhffs_mailings WHERE id_mailing='".$id."'"; - $request = $db->{'DB_WRITE'}->prepare( $query ); + $request = $db->prepare( $query ); $request->execute or return -2; return 1; @@ -101,7 +97,7 @@ return undef if( ! defined $id ); $query = "SELECT * FROM vhffs_mailings WHERE id_mailing='".$id."'"; - $request = $db->{'DB_READ'}->prepare( $query ); + $request = $db->prepare( $query ); $request->execute or return -2; return $request->fetchrow_hashref() ; Modified: trunk/vhffs-api/src/Vhffs/Note.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Note.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Note.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -42,12 +42,15 @@ sub set_note { my $vhffs = shift; - my $entity = shift; + my $user = shift; my $value = shift; - my $oldvalue = get_note( $vhffs , $entity ); - my $newvalue = $value - $oldvalue; - inc_note( $vhffs , $entity , $newvalue ); + my $sql = 'UPDATE vhffs_user SET note = ? WHERE uid = ?'; + my $dbh = $user->get_db_object; + my $sth = $dbh->prepare($sql); + $sth->execute($value, $user->get_uid()); + + return 1; } @@ -55,64 +58,31 @@ sub inc_note { my $vhffs = shift; - my $entity = shift; + my $user = shift; my $increase = shift; - my $note = 0; - my $already_exists = 0; - return -1 if( $entity->fetch < 0 ); + return -1 unless( defined $user ); + my $sql = 'UPDATE vhffs_users SET note = note + ? WHERE uid = ?'; + my $sth = $vhffs->{'db'}->prepare( $sql ); + $sth->execute( $increase, $user->get_uid ); - #Fetch note if already exists - my $query = "SELECT note FROM vhffs_notes WHERE object_id='".$entity->get_oid."'"; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - if ( $rows > 0 ) - { - $already_exists = 1; - my $result = $vhffs->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $note = $result->[0][0]; - } - - #Finally compute new note - $note += $increase; - - - if( $already_exists == 1 ) - { - $query = "UPDATE vhffs_notes SET note='".$note."' WHERE object_id='".$entity->get_oid."'"; - } - else - { - $query = "INSERT INTO vhffs_notes VALUES('".$entity->get_oid."' , '".$note."')"; - } - $request = $vhffs->{'db'}->{'DB_WRITE'}->prepare( $query ); - - $request->execute; - return 1; } sub get_note { my $vhffs = shift; - my $entity = shift; - - my $query = "SELECT note FROM vhffs_notes WHERE object_id='".$entity->get_oid."'"; + my $user = shift; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + return -1 unless(defined $user); - if ( $rows > 0 ) - { - my $result = $vhffs->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - return $result->[0][0]; - } - else - { - return 0; - } - + my $query = 'SELECT note FROM vhffs_users WHERE uid = ?'; + + my $request = $vhffs->{'db'}->prepare( $query ); + $request->execute($user->get_uid); + my ($note) = $request->fetchrow(); + return ($note || 0); } 1; @@ -131,28 +101,28 @@ $vhffs = init Vhffs::Main; ... - (considers that you have a VHFFS object in $object) + (considers that you have a VHFFS user in $user) ... - print "Current note for your object : " . Vhffs::Note::get_note( $vhffs , $object ); + print "Current note for your user : " . Vhffs::Note::get_note( $vhffs , $user ); #We add 3 to the current note - Vhffs::Note::inc_note( $vhffs , $object , 3 ); + Vhffs::Note::inc_note( $vhffs , $user , 3 ); #We set the note to 0 - Vhffs::Note::set_note( $vhffs , $object , 0 ); + Vhffs::Note::set_note( $vhffs , $user, 0 ); #We decrease the note of 1 - Vhffs::Note::inc_note( $vhffs , $object , -1 ); + Vhffs::Note::inc_note( $vhffs , $user, -1 ); =head1 METHODS - get_note( $vhffs , $object ) : return the note for the given object + get_note( $vhffs , $user ) : return the note for the given object - set_note( $vhffs , $object , $value ) : set the note + set_note( $vhffs , $user , $value ) : set the note - inc_note( $vhffs , $object , $inc ) : add $inc to the current not of object $object + inc_note( $vhffs , $user , $inc ) : add $inc to the current not of object $object =head1 AUTHOR Modified: trunk/vhffs-api/src/Vhffs/Object.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Object.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Object.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -29,9 +29,28 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +=head1 SYNOPSIS +Vhffs::Object - The generic object type in VHFFS +=head1 DESCRIPTION +The Vhffs::Object type is the base of each Vhffs::Services::*, Vhffs::User +or Vhffs::Group objects. So, you never have to create an instance of Vhffs::Object, +this class is only used as a super-class for services (or user or group). + +So, the methods of Vhffs::Object can be applied to all classes which inherit of it. +You can have all the history of an object with a method, get the status +of a service, ... + +This type stored informations about state, history, owner group/user. + +=head1 METHODS + +=cut + + + package Vhffs::Object; use Vhffs::Constants; @@ -52,9 +71,8 @@ $class = ref($this) || $this; bless($self , $class ); - + return undef if ( ! defined $main ); - return undef if ( ( ! defined $id ) || ( ! defined $owner ) ); $self->{'main'} = $main; $self->{'db'} = $main->get_db_object; @@ -74,6 +92,27 @@ return $self; } +sub _new { + my ($class, $main, $oid, $owner_uid, $date_creation, $description, $state, $type) = @_; + + $self = {}; + + bless($self, $class); + + return undef unless(defined $main); + + $self->{main} = $main; + $self->{db} = $main->get_db_object; + $self->{object_id} = $oid; + $self->{owner_uid} = $owner_uid; + $self->{date_creation} = $date_creation; + $self->{description} = $description; + $self->{state} = $state; + $self->{type} = $type; + + return $self; +} + sub get_main { my $self = shift; @@ -97,30 +136,12 @@ my $request; - #First, delete all Notes pointing on this object - $query = "DELETE FROM vhffs_notes WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -2; + # Foreign key constraints are in 'ON DELETE CASCADE' mode + # we don't have to bother with foreign tables deletion. + $query = 'DELETE FROM vhffs_object WHERE object_id=?'; + $request = $self->{'db'}->prepare($query); + $request->execute( $self->{'object_id'} ) or return -1; - #Then, delete all ACL referes to this object - $query = "DELETE FROM vhffs_acl WHERE oid_dst='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -2; - - #Delete all ACL from this object - $query = "DELETE FROM vhffs_acl WHERE oid_src='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -2; - - #Delete history from this object - $query = "DELETE FROM vhffs_history WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -1; - - $query = "DELETE FROM vhffs_object WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -1; - return 1; } @@ -134,76 +155,56 @@ } } -sub create -{ - my $query; - my $request; - my $id; - my ( $self ) = @_; +=head2 create + my $object = Vhffs::Object::create($main, [$owner_uid, $description, $state, $type]) - $self->{'owner_uid'} = $user->get_uid if( defined $user ); - $self->{'owner_gid'} = $group->get_gid if( defined $group ); +Create (in database) and return a new object. - $self->set_default_state; +=over 4 - $id = 0; - $request = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(object_id) FROM vhffs_object") or return -2; - $id = $request->[0][0] if( defined $request->[0][0] ); - $id++; - $self->{'object_id'} = $id; - $request = $self->{'db'}->{'DB_WRITE'}->prepare("INSERT INTO vhffs_object VALUES ( ? , ? , NOW(), ? , ? )"); +=item C<$main>: C<Vhffs::Main> instance - $request->execute( $self->{'object_id'} , $self->{'owner_uid'} , $self->{'state'} , $self->{'description'} ) or return -2; +=item C<$owner_uid>: UID of the owner. - $self->add_history( "Object created" ); +=item C<$description>: Description of the object - return $self->{'object_id'}; -} +=item C<$state>: state of the object. Can be undef, if it is, object will be +waiting for validation or waiting for creation depending on wether +moderation is active or not. +=item C<$type>: Object's type (C<Vhffs::Constants::TYPE_*>) +=back -sub fetch -{ - my $self; - my $request; - my $result; +=cut - $self = shift; - - my $query = "SELECT * FROM vhffs_object WHERE object_id ='". $self->{'object_id'}."'" ; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - return -1 if( $rows != 1); +sub create { + my ($vhffs, $owner_uid, $description, $state, $type) = @_; + $description = '' unless (defined $description); + $state = ($vhffs->get_config->get_moderation ? Vhffs::Constants::WAITING_FOR_VALIDATION : Vhffs::Constants::WAITING_FOR_CREATION) unless defined $state; + my $sth = $vhffs->get_db_object->prepare('INSERT INTO vhffs_object(owner_uid, date_creation, state, description, type) VALUES ( ?, NOW(), ?, ?, ?)'); + $sth->execute($owner_uid, $state, $description, $type) or return undef; + my $oid = $vhffs->get_db_object->last_insert_id(undef, undef, 'vhffs_object', undef); - $result = $request->fetchrow_hashref; + my $res = get_by_oid($vhffs, $oid); - foreach ( keys %{$result} ) - { - $self->{"$_"} = $result->{"$_"} - } - - #Fix encofing of description - $self->{'description'} =~ s/\\//g; - - - return 1; + $res->add_history('Object created'); + return $res; } -sub fetch_object +sub get_owner_uid { my $self = shift; - $self->fetch(); + return $self->{'owner_uid'}; } -sub get_owner_uid +sub get_type { - my $self = shift; - return $self->{'owner_uid'}; + my $self = shift; + return $self->{type}; } - #The modify method for Vhffs::Object only tells if the API can modify some values #It protects some importants fields such as object_id sub modify @@ -225,10 +226,8 @@ my $self = shift; my $request; - $self->{description} = quotemeta $self->{description}; - - $request = "UPDATE vhffs_object SET state=?, description=?, owner_uid=? WHERE object_id=?"; - my $result = $self->{'db'}->{'DB_WRITE'}->prepare($request); + $request = 'UPDATE vhffs_object SET state=?, description=?, owner_uid=? WHERE object_id=?'; + my $result = $self->{'db'}->prepare($request); $result->execute( $self->{'state'} , $self->{'description'} , $self->{'owner_uid'} , $self->{'object_id'} );; } @@ -332,7 +331,7 @@ { my ($self , $value) = @_; $value =~ s/\?/ \?/g; - $self->{'description'} = quotemeta( $value ); + $self->{'description'} = $value ; } @@ -346,19 +345,13 @@ { my $self = shift; my $message = shift; - $message = quotemeta( $message ); + $message = $message; - my $id = 0; - my $query = "SELECT MAX(history_id) FROM vhffs_history"; - my $request = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ) or return -2; - $id = $request->[0][0] if( defined $request->[0][0] ); - $id++; + $query = 'INSERT INTO vhffs_history(object_id, date, message) VALUES(?, NOW(), ?)'; + $request = $self->{'db'}->prepare( $query ); + $request->execute( $self->{'object_id'}, $message ) or return -2; - $query = "INSERT INTO vhffs_history VALUES('".$id."','".$self->{'object_id'}."',NOW(),'".$message."')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - - return $id; + return $self->{'db'}->last_insert_id(undef, undef, 'vhffs_history', undef);; } # Returns a hashref wich contains all the history @@ -371,16 +364,12 @@ my $key; my $value; - my $query = "SELECT * FROM vhffs_history WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); + my $query = 'SELECT * FROM vhffs_history WHERE object_id=?'; + my $request = $self->{'db'}->prepare( $query ); - return undef if( $request->execute <= 0 ); + return undef if( ! $request->execute( $self->{'object_id'} ) ); $temp = $request->fetchall_hashref('history_id'); - foreach $key ( keys ( %{$temp} )) - { - $temp->{$key}{'message'} = Vhffs::Functions::stripslashes( $temp->{$key}{'message'} ); - } return $temp; } @@ -395,20 +384,30 @@ my $name = shift; my $query; + my $request; if( defined $name ) { - $query = "SELECT o.object_id, o.owner_uid, o.date_creation , o.state , o.description FROM vhffs_object o, vhffs_users u WHERE o.owner_uid=u.uid AND ( ( o.description LIKE '%".$name."%' ) OR ( o.object_id LIKE '%".$name."%' ) OR ( o.owner_uid LIKE '%".$name."%') OR ( state LIKE '%".$name."%' ) OR (u.username LIKE '%".$name."%') )"; + $name = '%'.$name.'%'; + $query = 'SELECT o.object_id, o.owner_uid, o.date_creation , o.description, o.state, o.type FROM vhffs_object o INNER JOIN vhffs_users u ON o.owner_uid = u.uid WHERE ( o.description LIKE ? ) OR ( o.object_id LIKE ? ) OR ( o.owner_uid LIKE ? ) OR ( state LIKE ? ) OR ( u.username LIKE ? ) ORDER BY object_id'; + $request = $vhffs->get_db_object->prepare( $query ) or return -1; + + return undef if ( !$request->execute( $name, $name, $name, $name, $name )); } else { - $query = "SELECT o.object_id, o.owner_uid, o.date_creation , o.state , o.description FROM vhffs_object o"; - } - my $request = $vhffs->get_db_object->{'DB_READ'}->prepare( $query ) or return -1; + $query = 'SELECT o.object_id, o.owner_uid, o.date_creation , o.description, o.state, o.type FROM vhffs_object o ORDER BY object_id'; + $request = $vhffs->get_db_object->prepare( $query ) or return -1; - return undef if ( $request->execute() <= 0); + return undef if ( !$request->execute() ); + } - return( $request->fetchall_hashref('object_id') ); + my $result; + my $rows = $request->fetchall_arrayref(); + foreach(@$rows) { + push(@$result, _new Vhffs::Object($vhffs, @$_)); + } + return $result; } sub get_group @@ -423,8 +422,8 @@ if( defined $self->{'owner_gid'} ) { use Vhffs::Group; - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef , $self->{'owner_uid'} , $self->{'owner_gid'} ); - return( $self->{'group'} ) if( defined( $self->{'group'} ) && ( $self->{'group'}->fetch > 0 ) ); + $self->{'group'} = Vhffs::Group::get_by_gid( $self->{'main'} , $self->{'owner_gid'} ); + return( $self->{'group'} ) if( defined( $self->{'group'} ) ); } } return undef; @@ -443,42 +442,44 @@ if( defined $self->{'owner_uid'} ) { use Vhffs::User; - $self->{'user'} = new Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} ); - return( $self->{'user'} ) if( defined ( $self->{'user'} ) && ( $self->{'user'}->fetch > 0 )); + $self->{'user'} = Vhffs::User::get_by_uid( $self->{'main'} , $self->{'owner_uid'} ); + return( $self->{'user'} ) if( defined ( $self->{'user'} ) ); } } return undef; } +=pod +=head2 get_by_oid -1; - -__END__ + my $obj = Vhffs::Object::get_by_oid($main, $oid); -=head1 SYNOPSIS +Fetches an object using its object ID. Returned object is +fully functional. -Vhffs::Object - The generic object type in VHFFS +=cut -=head1 DESCRIPTION +sub get_by_oid +{ + my ($vhffs, $oid) = @_; + my $query = 'SELECT owner_uid, date_creation, description, state, type FROM vhffs_object WHERE object_id =?'; + my $sth = $vhffs->get_db_object->prepare( $query ); + my $rows = $sth->execute( $oid ); -The Vhffs::Object type is the base of each Vhffs::Services::*, Vhffs::User -or Vhffs::Group objects. So, you never have to create an instance of Vhffs::Object -, this class is only use as a super-class for services (or user or group). + return undef unless $rows == 1; -So, the method of Vhffs::Object can be applied to all class which inherit of it. -Commonly, you can have all the history of an object with a method, get the status -of a service, ... + my @result = $sth->fetchrow_array(); -This type stored informations about state, history, owner group/user. + my $object = _new Vhffs::Object($vhffs, $oid, @result); -=head1 METHODS + return $object; +} -=head2 new( Vhffs::Main , 1 , '401') -Create an instance of Vhffs::Object. Typically, this method is onvoked is the new method of inherited class. It creates an object, with a fixed object-id (arg 2) and the owner from uid (arg3). -The first argument is a Vhffs::Main object. -Return undef if failed. +1; + +__END__ =head2 get_main( ) Modified: trunk/vhffs-api/src/Vhffs/Panel/Admin.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Admin.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Admin.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -66,7 +66,6 @@ my $template = new HTML::Template( filename => "$templatesdir/admin/main/main.tmpl" ); $template->param( MENU_TITLE => gettext( "Administrator Menu" ) ); - $template->param( SHOW_HIDE => gettext( "Show/Hide" ) ); my $subtemplate; #Print the General Admin/Modo Panel @@ -180,7 +179,7 @@ $template->param( ADMIN_MAIL => "" ); } - if( $vhffs->get_config->use_mailling == 1 ) + if( $vhffs->get_config->use_mailing == 1 ) { $subtemplate = new HTML::Template( filename => "$templatesdir/admin/mailing/menu.tmpl" ); $subtemplate->param( TEXT_ADMIN_MAILLING => gettext( "Mailing-lists Admin" ) ); @@ -219,19 +218,6 @@ $template->param( ADMIN_DNS => "" ); } - if( $vhffs->get_config->use_largefile == 1 ) - { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/largefile/menu.tmpl" ); - $subtemplate->param( TEXT_ADMIN_LARGEFILE => gettext( "Hosted files admin" ) ); - $subtemplate->param( TEXT_LIST_LARGEFILE => gettext( "List all hosted files" ) ); - $subtemplate->param( TEXT_SEARCH_LARGEFILE => gettext( "Search for a file" ) ); - $template->param( ADMIN_LARGEFILE => $subtemplate->output ); - } - else - { - $template->param( ADMIN_LARGEFILE => "" ); - } - if( $vhffs->get_config->use_repository == 1 ) { $subtemplate = new HTML::Template( filename => "$templatesdir/admin/repository/menu.tmpl" ); Modified: trunk/vhffs-api/src/Vhffs/Panel/Avatar.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Avatar.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Avatar.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -87,7 +87,7 @@ my $config = $vhffs->get_config; my $datadir = $config->get_datadir . "/avatar"; - return undef if( $object->fetch < 0 ); + return undef unless( defined $object ); $digest = md5_hex( $object->get_oid ); $dir = $datadir . "/" . substr( $digest , 0 , 2 ) . "/" . substr( $digest , 2 , 2 ) . "/" .substr( $digest , 4 , 2 ); Copied: trunk/vhffs-api/src/Vhffs/Panel/Commons.pm (from rev 555, branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Commons.pm) Modified: trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Confirmation.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -40,57 +40,48 @@ use strict; use diagnostics; +use Vhffs::Main; +#use Digest::MD5; + package Vhffs::Panel::Confirmation; -#Create a confirmation code. Send an arrayref which contains cid and code -sub create_code -{ - my $vhffs; - my $code; - my $request; - my $result; - my $query; - my @ret; - my $cid; - $vhffs = shift; - $code = ""; - +# Create a confirmation code. +# Returns the clear text confirmation code used for display +# and an hash used to verify correctness of the user's +# provided code with check_code +sub generate_code($) { + my $vhffs = shift; + my $ret = {}; + + my $code = ''; for (0 .. 7) { $code .= ('a'..'z', 'A'..'Z', '0'..'9')[int rand 62] ; } + $ret->{clear} = $code; +# $ret->{hash} = Digest::MD5::md5_hex($code); - $query = "INSERT INTO vhffs_confirmation (code) VALUES('".$code."')"; - $request = $vhffs->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return undef; + my $key = $vhffs->get_config->get_panel_subscribe_code_encrypt_key; + $ret->{key} = $key; - $query = "SELECT max(cid) from vhffs_confirmation"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - #Returns 0 if nothing is found (stupid) - return undef if( $request->execute == 0 ); - $result = $request->fetchrow_arrayref; - $cid = $result->[0]; - $ret[0] = $cid; - $ret[1] = $code; - return( \@ret ); + my $crypted = $code ^ $key; + $ret->{crypted} = $crypted; + $ret->{cryptedhexa} = unpack("H*", $crypted); + + return $ret; } -#Get a confirmation code according to the cid -sub get_code -{ - my $vhffs; - my $cid; - my $query; - my $request; - my $result; +sub decrypt_code($$) { + my $vhffs = shift; + my $code = shift; - $vhffs = shift; - $cid = shift; - $query = "SELECT code from vhffs_confirmation WHERE cid='".$cid."'"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - return undef if( $request->execute == 0 ); + $code = pack("H*", $code); + $code = $code ^ $vhffs->get_config->get_panel_subscribe_code_encrypt_key; + return $code; +} - $result = $request->fetchrow_arrayref; - return $result->[0]; +sub check_code($$$) { + my ( $vhffs, $clear1, $crypt) = @_; + my $clear2 = decrypt_code( $vhffs, $crypt ); + return ( $clear1 eq $clear2 ); } 1; - Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -52,52 +52,50 @@ my( $main , $query , $request); $main = shift; $query = "SELECT c.cvsroot , o.description , u.username , g.groupname , o.object_id FROM vhffs_cvs c, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=c.owner_uid AND g.gid=c.owner_gid AND o.object_id=c.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('cvsroot') ); } -sub getall_cvs +sub search { - my $main = shift; - my $name = shift; + my ($main, $name) = @_; + my $sql; + my @params; + my $cvs = []; + + if( defined $name ) { + $sql = 'SELECT c.cvsroot, g.groupname, c.object_id AS oid, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON o.object_id = c.object_id INNER JOIN vhffs_groups g ON g.gid = c.owner_gid WHERE cvsroot LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT c.cvsroot, g.groupname, c.object_id AS oid, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON o.object_id = c.object_id INNER JOIN vhffs_groups g ON g.gid = c.owner_gid'; + } + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; - my $query; - - if( defined $name ) - { - $query = "SELECT c.cvsroot, c.owner_gid, o.state FROM vhffs_cvs c, vhffs_object o WHERE o.object_id=c.object_id AND c.cvsroot LIKE '".$name."'"; - } - else - { - $query = "SELECT c.cvsroot, c.owner_gid, o.state FROM vhffs_cvs c, vhffs_object o WHERE o.object_id=c.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - - return undef if ( $request->execute() <= 0); - - return( $request->fetchall_hashref('cvsroot') ); + return undef unless($sth->execute(@params)); + + while(my $c = $sth->fetchrow_hashref('NAME_lc')) { + $c->{state} = Vhffs::Functions::status_string_from_status_id($c->{state}); + push(@$cvs, $c); + } + return $cvs; } - sub create_cvs { - my( $main , $cvsroot , $user , $group ) = @_; + my( $main, $cvsroot, $description, $user, $group ) = @_; - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return undef if( ! defined $user ); + return undef if( ! defined $group ); - my $cvs = new Vhffs::Services::Cvs( $main , $cvsroot , $user , $group ); + my $cvs = Vhffs::Services::Cvs::create($main, $cvsroot, $description, $user, $group); return undef if( ! defined $cvs); - $cvs->set_user( $user ); - $cvs->set_group( $group ); - return undef if( $cvs->create < 0 ); - return undef if ( Vhffs::Acl::add_acl( $user , $cvs , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $cvs , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Panel/DNS.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/DNS.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -51,8 +51,8 @@ { my( $main , $query , $request); $main = shift; - $query = "SELECT n.domain , o.description , u.username , g.groupname , o.object_id FROM vhffs_dns_global n, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=n.owner_uid AND g.gid=n.owner_gid AND n.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $query = "SELECT n.domain , o.description , u.username , g.groupname , o.object_id FROM vhffs_dns n, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=n.owner_uid AND g.gid=n.owner_gid AND n.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('domain') ); @@ -60,43 +60,43 @@ -sub getall_domains +sub search { - my $main = shift; - my $name = shift; + my ($main, $name) = @_; + my $sql; + my $dns = []; + my @params; - my $query; + if( defined $name ) { + $sql = 'SELECT ns.domain, ns.object_id AS oid, g.groupname, o.state FROM vhffs_dns ns INNER JOIN vhffs_object o ON o.object_id = ns.object_id INNER JOIN vhffs_groups g ON g.gid = ns.owner_gid WHERE ns.domain LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT ns.domain, ns.object_id AS oid, g.groupname, o.state FROM vhffs_dns ns INNER JOIN vhffs_object o ON o.object_id = ns.object_id INNER JOIN vhffs_groups g ON g.gid = ns.owner_gid'; + } - if( defined $name ) - { - $query = "SELECT ns.domain, ns.object_id, ns.owner_gid, o.state FROM vhffs_dns_global ns, vhffs_object o WHERE o.object_id=ns.object_id AND ns.domain LIKE '".$name."'"; - } - else - { - $query = "SELECT ns.domain, ns.object_id, ns.owner_gid, o.state FROM vhffs_dns_global ns, vhffs_object o WHERE o.object_id=ns.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare( $sql ) or return undef; - return undef if ( $request->execute() <= 0); + return undef unless($sth->execute(@params)); - return( $request->fetchall_hashref('domain') ); + while(my $d = $sth->fetchrow_hashref('NAME_lc')) { + $d->{state} = Vhffs::Functions::status_string_from_status_id($d->{state}); + push(@$dns, $d); + } + return $dns; } sub create_dns { - my ( $main , $dns_name , $user , $group ) = @_; - return undef if( $user->fetch < 0 ); - return undef if( $group->fetch < 0 ); + my ( $main , $dns_name, $description , $user , $group ) = @_; + return undef if( ! defined $user ); + return undef if( ! defined $group ); - my $dns = new Vhffs::Services::DNS( $main , $dns_name , $user , $group ); + my $dns = Vhffs::Services::DNS::create( $main , $dns_name, $description, $user , $group ); return undef if( ! defined $dns ); - $dns->set_user( $user ); - $dns->set_group( $group ); - return undef if( $dns->create < 0 ); - return undef if ( Vhffs::Acl::add_acl( $user , $dns , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $dns , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); @@ -109,11 +109,11 @@ { my ( $user , $main ) = @_ ; - return undef if ( $user->fetch < 0 ); + return undef if ( ! defined $user ); - my $query = "SELECT ns.domain, ns.object_id FROM vhffs_dns_global ns, vhffs_acl acl ,vhffs_users WHERE vhffs_users.object_id=acl.oid_src AND acl.oid_dst=ns.object_id AND vhffs_users.username='".$user->{'username'}."'"; + my $query = "SELECT ns.domain, ns.object_id FROM vhffs_dns ns, vhffs_acl acl ,vhffs_users WHERE vhffs_users.object_id=acl.oid_src AND acl.oid_dst=ns.object_id AND vhffs_users.username='".$user->{'username'}."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; return undef if ( $request->execute() <= 0); @@ -125,10 +125,10 @@ { my ( $group , $main ) =@_ ; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); - my $query = "SELECT ns.domain, ns.object_id , o.object_id, o.state FROM vhffs_dns_global ns , vhffs_object o WHERE o.object_id=ns.object_id AND ns.owner_gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $query = "SELECT ns.domain, ns.object_id , o.object_id, o.state FROM vhffs_dns ns , vhffs_object o WHERE o.object_id=ns.object_id AND ns.owner_gid='".$group->get_gid."'"; + my $request = $main->{'db'}->prepare( $query ) or return -1; return undef if ( $request->execute() <= 0); @@ -180,4 +180,155 @@ return $template->output; } +=pod + +=head2 add_a + + eval { Vhffs::Panel::DNS::add_a($dns, $redirect, $name, $ip); }; + if($@) { + print "An error occured: $@\n"; + } else { + print "A Record added\n"; + } + +Add a new A resource record to $dns. If $redirect is true, $name points +to default address defined in configuration, else, it points on $ip. + +=cut + +sub add_a { + my ($dns, $redirect, $name, $ip) = @_; + die() unless(defined $dns && defined $redirect && defined $name && defined $ip); + my $rval; + if($redirect) { + $rval = $dns->add_a($name); + } else { + $rval = $dns->add_a($name, $ip); + } + return 1 if($rval > 0); + die(gettext('Invalid prefix')."\n") if($rval == -1); + die(gettext('Prefix already exists')."\n") if($rval == -2); + die(gettext('Unable to find default redirection address, please contact administrators')."\n") if($rval == -3); + die(gettext('Invalid IP address')."\n") if($rval == -4); + die(gettext('Database error')."\n") if($rval == -5); + die(gettext('Unknown error')."\n"); +} + +sub update_a { + my ($dns, $id, $ip) = @_; + die() unless(defined $dns && defined $id && defined $ip); + my $rval = $dns->update_a($id, $ip); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Invalid IP address')."\n") if($rval == -3); + die(gettext('Database error')."\n") if($rval == -4); + die(gettext('Unknown error')."\n"); +} + +sub delete_a { + my ($dns, $id) = @_; + die() unless(defined $dns && defined $id); + my $rval = $dns->delete_a($id); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Database error')."\n") if($rval == -3); + die(gettext('Unknown error')."\n"); +} + +sub add_mx { + my ($dns, $host, $priority) = @_; + die() unless(defined $dns && defined $host && defined $priority); + my $rval = $dns->add_mx($host, $priority); + return 1 if($rval > 0); + die(gettext('Invalid hostname')."\n") if($rval == -1); + die(gettext('Invalid priority')."\n") if($rval == -2); + die(gettext('An MX record with the same name already exists for this domain')."\n") if($rval == -3); + die(gettext('Database error')."\n") if($rval == -4); + die(gettext('Unknown error')."\n"); +} + +sub update_mx { + my ($dns, $id, $host) = @_; + die() unless(defined $dns && defined $id && defined $host); + my $rval = $dns->update_mx($id, $host); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Invalid host')."\n") if($rval == -3); + die(gettext('Database error')."\n") if($rval == -4); + die(gettext('Unknown error')."\n"),; +} + +sub delete_mx { + my ($dns, $id) = @_; + die() unless(defined $dns && defined $id); + my $rval = $dns->delete_mx($id); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Database error')."\n") if($rval == -3); + die(gettext('Unknown error')."\n"); +} + +sub delete_ns { + my ($dns, $id) = @_; + die() unless(defined $dns && defined $id); + my $rval = $dns->delete_ns($id); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Database error')."\n") if($rval == -3); + die(gettext('Unknown error')."\n"); +} + +sub add_ns { + my ($dns, $host) = @_; + die() unless(defined $dns && defined $host); + my $rval = $dns->add_ns($host); + return 1 if($rval > 0); + die(gettext('Invalid hostname')."\n") if($rval == -1); + die(gettext('An NS record with the same name already exists for this domain')."\n") if($rval == -2); + die(gettext('Database error')."\n") if($rval == -3); + die(gettext('Unknown error')."\n"); +} + +sub update_cname { + my ($dns, $id, $dest) = @_; + die() unless(defined $dns && defined $id && defined $dest); + my $rval = $dns->update_cname($id, $dest); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Invalid destination')."\n") if($rval == -3); + die(gettext('Database error')."\n") if($rval == -4); + die(gettext('Unknown error')."\n"); + +} + +sub delete_cname { + my ($dns, $id) = @_; + die() unless(defined $dns && defined $id); + my $rval = $dns->delete_cname($id); + return 1 if($rval > 0); + die(gettext('Invalid record')."\n") if($rval == -1); + die(gettext('Record does not exists')."\n") if($rval == -2); + die(gettext('Database error')."\n") if($rval == -3); + die(gettext('Unknown error')."\n"); +} + +sub add_cname { + my ($dns, $name, $dest) = @_; + die() unless(defined $dns && defined $name && defined $dest); + my $rval = $dns->add_cname($name, $dest); + return 1 if($rval > 0); + die(gettext('Invalid alias')."\n") if($rval == -1); + die(gettext('Invalid destination host')."\n") if($rval == -2); + die(gettext('A CNAME or A record with the same name already exists for this domain')."\n") if($rval == -3); + die(gettext('Database error')."\n") if($rval == -4); + die(gettext('Unknown error')."\n"); +} + + 1; Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -51,32 +51,36 @@ my $groupname = shift; my $query = "SELECT u.username, g.groupname from vhffs_users u, vhffs_groups g, vhffs_user_group ug WHERE ug.gid = g.gid AND ug.uid=u.uid AND g.groupname='".$groupname."' AND ug.state='6'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + my $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('username') ); } -sub getall_groups +sub search { - my $main = shift; - my $name = shift; + my ($main, $name) = @_; + my $sql; + my @params; + my $groups = []; - my $query; - - if( defined $name ) - { - $query = "SELECT g.groupname, g.object_id, g.quota, g.quota_used, o.state FROM vhffs_groups g, vhffs_object o WHERE g.object_id=o.object_id AND g.groupname LIKE '%".$name."%'"; + if( defined $name ) { + $sql = 'SELECT g.groupname, g.object_id AS OID, o.state, u.username FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id = o.object_id INNER JOIN vhffs_users u ON u.uid = g.owner_uid WHERE g.groupname LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT g.groupname, g.object_id AS OID, o.state, u.username FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id = o.object_id INNER JOIN vhffs_users u ON u.uid = g.owner_uid WHERE g.groupname NOT IN ( SELECT username FROM vhffs_users )'; } - else - { - $query = "SELECT g.groupname, g.object_id, g.quota, g.quota_used, o.state FROM vhffs_groups g, vhffs_object o WHERE g.object_id=o.object_id AND g.groupname NOT IN ( SELECT username FROM vhffs_users )"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare( $sql ) or return undef; - return undef if ( $request->execute <= 0 ); - return( $request->fetchall_hashref('groupname') ); + return undef unless ( $sth->execute(@params) ); + while(my $g = $sth->fetchrow_hashref('NAME_lc')) { + $g->{state} = Vhffs::Functions::status_string_from_status_id($g->{state}); + push(@$groups, $g); + } + + return $groups; } @@ -85,8 +89,8 @@ { my( $main , $query , $request); $main = shift; - $query = "SELECT o.description , u.username , g.groupname , o.object_id FROM vhffs_object o , vhffs_users u , vhffs_groups g , vhffs_groups_info gi WHERE u.uid=gi.owner_uid AND gi.gid=g.gid AND u.username!=g.groupname AND g.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $query = "SELECT o.description , u.username , g.groupname , o.object_id FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id INNER JOIN vhffs_users ON u.uid = g.owner_uid WHERE u.username!=g.groupname AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('groupname') ); @@ -97,34 +101,50 @@ { my ( $user , $main ) = @_; - return undef if ( $user->fetch < 0 ); + return undef if ( ! defined $user ); my $query = "SELECT g.groupname , g.object_id, o.state FROM vhffs_groups g, vhffs_user_group ug , vhffs_object o WHERE o.object_id=g.object_id AND ug.gid=g.gid AND ug.uid='".$user->{'uid'}."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; my @retour; return undef if ( $request->execute() <= 0); return ( $request->fetchall_hashref( 'groupname' ) ); } +=head2 create_group($groupname, $user, $main) + +Create a new group with specified name and the +specified user as owner. Owner if affected to +the group and an ACL is created in order to +allow him to delete group. + +All arguments are mandatory + +=over + +=item $groupname: Name of the group + +=item $user: Vhffs::User owner of the group (must be registered +in DB). + +=item $main: Vhffs::Main instance + +=cut + sub create_group { - my( $groupname , $user , $main ) = @_; + my( $groupname , $user , $main, $description ) = @_; - return undef if( $user->fetch < 0); + my $group = Vhffs::Group::create($main, $groupname, $user->get_uid, undef, $description); - my $group = new Vhffs::Group( $main , $groupname , $user->get_uid) ; + return undef unless( defined $group ); - return -1 if( ! defined $group ); + return undef if ($group->add_user( $user ) < 0 ); - return -2 if ($group->create < 0); + return undef if ( Vhffs::Acl::add_acl( $user , $group , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); - return -3 if ($group->add_user( $user ) < 0 ); - - return -4 if ( Vhffs::Acl::add_acl( $user , $group , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); - - return 1; + return $group; } @@ -140,7 +160,6 @@ my $templatedir = $vhffs->get_config->get_templatedir; my $template = new HTML::Template( filename => $templatedir."/group/menu.tmpl" ); $template->param( TEXT_MYPROJECTS => gettext("My Projects") ); - $template->param( SHOW_HIDE => gettext("Show/Hide") ); $template->param( TEXT_CREATE => gettext("Create") ); # projects @@ -155,6 +174,8 @@ { $subtemplate = new HTML::Template( filename => $templatedir."/group/menu_sub.tmpl" ); $subtemplate->param( PROJECTNAME => $obj->get_groupname ); + $subtemplate->param( OID => $obj->get_oid ); + $subtemplate->param( HISTORY_TEXT => gettext('History') ); $output .= $subtemplate->output; } else Deleted: trunk/vhffs-api/src/Vhffs/Panel/LargeFile.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/LargeFile.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/LargeFile.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,150 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Panel::LargeFile; - -use DBI; -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; -use Vhffs::User; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Services::LargeFile; - - - -sub menu -{ - my $class = shift; - my $data = shift; - - my $vhffs = $data->{'vhffs'}; - my $session = $data->{'session'}; - my $user = $data->{'user'}; - my $group = $data->{'group'}; - my $cgi = $data->{'cgi'}; - - my $templatesdir = $vhffs->get_config->get_templatedir; - my $template = new HTML::Template( filename => "$templatesdir/largefile/menu.tmpl" ); - $template->param( TEXT_CREATE => gettext("Create") ); - $template->param( TEXT_LARGEFILE => gettext("Hosted files") ); - - my $subtemplate; - - my $objs = Vhffs::Services::LargeFile::getall( $vhffs , undef , undef , $group ); - my $obj; - my $output = ""; - if( defined $objs ) - { - foreach $obj ( @{$objs} ) - { - if( ( $obj->get_status == Vhffs::Constants::ACTIVATED ) || ( $obj->get_status == Vhffs::Constants::CREATED ) ) - { - $subtemplate = new HTML::Template( filename => "$templatesdir/largefile/menu_sub.tmpl" ); - $subtemplate->param( NAME => $obj->get_filename); - $subtemplate->param( HISTORY => gettext("History")); - $subtemplate->param( OID => $obj->get_oid ); - } - else - { - $subtemplate = new HTML::Template( filename => "$templatesdir/largefile/menu_sub_wait.tmpl" ); - $subtemplate->param( NAME => $obj->get_filename ); - $subtemplate->param( HISTORY => gettext("History")); - $subtemplate->param( REASON => Vhffs::Functions::status_string_from_status_id( $obj->get_status )); - $subtemplate->param( OID => $obj->get_oid ); - } - - - $output .= $subtemplate->output if( defined $subtemplate ); - undef( $subtemplate ); - } - } - - $template->param( SUB_LARGEFILE => $output ); - - return $template->output; -} - -sub create_largefile -{ - my $vhffs = shift; - my $filename = shift; - my $size = shift; - my $type = shift; - my $licence = shift; - my $hash = shift; - my $description = shift; - my $user = shift; - my $group = shift; - - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); - - my $file = new Vhffs::Services::LargeFile( $vhffs , $filename , $user , $group ); - - return undef if( ! defined $file ); - - $file->set_user( $user ); - $file->set_group( $group ); - return undef if( $file->fetch > 0 ); - return undef if( $file->set_licence( $licence ) < 0 ); - return undef if ( $file->set_size( $size ) < 0 ); - return undef if ( $file->set_type( $type ) < 0 ); - return undef if ( $file->set_hash( $hash ) < 0 ); - - $file->set_status( Vhffs::Constants::WAITING_FOR_VALIDATION ); - $file->set_description( $description ); - - return undef if( $file->create < 0 ); - - return undef if ( Vhffs::Acl::add_acl( $user , $file , Vhffs::Constants::ACL_DELETE , $vhffs ) < 0 ); - return undef if ( Vhffs::Acl::add_acl( $group , $file , Vhffs::Constants::ACL_VIEW , $vhffs ) < 0 ); - - return undef if( $file->fetch < 0 ); - return undef if( $file->set_licence( $licence ) < 0 ); - if( defined $hash ) - { - $file->set_hash( $hash ); - } - return undef if( $file->commit < 0 ); - - return $file; -} - - - -1; Modified: trunk/vhffs-api/src/Vhffs/Panel/Mail.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Mail.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -45,26 +45,30 @@ use Vhffs::Panel::Main; use Vhffs::Services::Mail; -sub getall_mails -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; + my $sql; + my @params; + my $mails = []; - my $query; + if( defined $name ) { + $sql = 'SELECT m.domain, m.object_id AS oid, o.state, g.groupname FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = m.owner_gid WHERE m.domain LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT m.domain, m.object_id AS oid, o.state, g.groupname FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = m.owner_gid'; + } - if( defined $name ) - { - $query = "SELECT m.domain, m.object_id, o.state, m.owner_gid FROM vhffs_mxdomain m, vhffs_object o WHERE o.object_id=m.object_id AND m.domain LIKE '%".$name."%'"; + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; + + return undef unless($sth->execute(@params)); + + while(my $m = $sth->fetchrow_hashref('NAME_lc')) { + $m->{state} = Vhffs::Functions::status_string_from_status_id($m->{state}); + push(@$mails, $m); } - else - { - $query = "SELECT m.domain, m.object_id, o.state , m.owner_gid FROM vhffs_mxdomain m, vhffs_object o WHERE o.object_id=m.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - return undef if ( $request->execute() <= 0); - - return( $request->fetchall_hashref('domain') ); + return $mails } @@ -74,7 +78,7 @@ my( $main , $query , $request); $main = shift; $query = "SELECT m.domain, o.description , u.username , g.groupname , o.object_id FROM vhffs_mxdomain m, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=m.owner_uid AND g.gid=m.owner_gid AND m.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('domain') ); @@ -87,7 +91,7 @@ my $main = shift ; my $state = shift; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); my $query; @@ -100,7 +104,7 @@ $query = "SELECT m.domain, m.object_id, o.state FROM vhffs_mxdomain m, vhffs_object o WHERE o.object_id=m.object_id AND m.owner_gid='".$group->get_gid."'"; } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; return undef if ( $request->execute() <= 0); @@ -111,16 +115,14 @@ sub create_mail { - my( $main , $domain , $user , $group ) = @_; + my( $main , $domain , $description, $user , $group ) = @_; - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return undef if( ! defined $user ); + return undef if( ! defined $group ); - my $mail = new Vhffs::Services::Mail( $main , $domain , $user , $group ); - $mail->set_user( $user ); - $mail->set_group( $group ); + my $mail = Vhffs::Services::Mail::create($main, $domain, $description, $user, $group); - return undef if ( $mail->create < 0 ); + return undef unless ( defined $mail ); return undef if ( Vhffs::Acl::add_acl( $user , $mail , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $mail , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Panel/Mailinglist.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Mailinglist.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Mailinglist.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -52,20 +52,47 @@ my( $main , $query , $request); $main = shift; $query = "SELECT l.ml_id , l.local_part , l.domain, o.description , u.username , g.groupname , o.object_id FROM vhffs_ml l, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=l.owner_uid AND g.gid=l.owner_gid AND l.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('ml_id') ); } +sub search +{ + my ($main, $name) = @_; + my $sql; + my @params; + my $mls = []; + if( defined $name ) { + $sql = 'SELECT l.local_part, l.domain, g.groupname, l.object_id AS oid, o.state FROM vhffs_ml l INNER JOIN vhffs_object o ON o.object_id = l.object_id INNER JOIN vhffs_groups g ON g.gid = l.owner_gid WHERE l.local_part LIKE ? OR l.domain LIKE ?'; + push(@params, '%'.$name.'%'); + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT l.local_part, l.domain, g.groupname, l.object_id AS oid, o.state FROM vhffs_ml l INNER JOIN vhffs_object o ON o.object_id = l.object_id INNER JOIN vhffs_groups g ON g.gid = l.owner_gid'; + } + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; + + return undef unless($sth->execute(@params)); + + while(my $m = $sth->fetchrow_hashref('NAME_lc')) { + $m->{state} = Vhffs::Functions::status_string_from_status_id($m->{state}); + push(@$mls, $m); + } + return $mls; +} + + + sub getall_list_per_group { my $group = shift; my $main = shift ; my $state = shift; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); my $query; @@ -78,7 +105,7 @@ $query = "SELECT l.ml_id, l.local_part , l.domain, l.object_id, o.state FROM vhffs_ml l, vhffs_object o WHERE o.object_id=l.object_id AND l.owner_gid='".$group->get_gid."'"; } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; return undef if ( $request->execute() <= 0); @@ -88,27 +115,18 @@ sub create_list { - my $main = shift; - my $lpart = shift; - my $domain = shift; - my $user = shift; - my $group = shift; + my ($main, $lpart, $domain, $description, $user, $group) = @_; - return -5 if( $user->fetch < 0 ); - return -5 if( $group->fetch < 0 ); + return -5 if( ! defined $user ); + return -5 if( ! defined $group ); - my $list = new Vhffs::Services::Mailing( $main , $lpart , $domain ); + my $list = Vhffs::Services::Mailing::create( $main , $lpart , $domain, $user->get_mail, $description, $user, $group ); return -1 if( ! defined $list ); - $list->set_user( $user ); - $list->set_group( $group ); - $list->set_admin( $user->get_mail ); - return -1 if ( $list->create < 0 ); - return -2 if ( Vhffs::Acl::add_acl( $user , $list , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return -3 if( Vhffs::Acl::add_acl( $group , $list , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); - return 1; + return $list; } @@ -133,32 +151,26 @@ my $mls = Vhffs::Services::Mailing::getall( $vhffs , undef , undef , $group ); my $ml; my $output = ""; - if( defined $mls ) - { - foreach $ml ( @{$mls} ) - { - if( $ml->get_status == Vhffs::Constants::ACTIVATED ) - { - $subtemplate = new HTML::Template( filename => "$templatesdir/mailinglist/menu_sub.tmpl" ); - $subtemplate->param( NAME => $ml->get_localpart . "\@" . $ml->get_domain); - $subtemplate->param( LOCAL => $ml->get_localpart ); - $subtemplate->param( DOMAIN => $ml->get_domain ); - $subtemplate->param( HISTORY => gettext("History")); - $subtemplate->param( OID => $ml->get_oid ); - } - else - { - $subtemplate = new HTML::Template( filename => "$templatesdir/mailinglist/menu_sub_wait.tmpl" ); - $subtemplate->param( NAME => $ml->get_localpart . "\@" . $ml->get_domain); - $subtemplate->param( HISTORY => gettext("History")); - $subtemplate->param( REASON => Vhffs::Functions::status_string_from_status_id( $ml->get_status )); - $subtemplate->param( OID => $ml->get_oid ); - } + foreach $ml ( @{$mls} ) { + if( $ml->get_status == Vhffs::Constants::ACTIVATED ) { + $subtemplate = new HTML::Template( filename => "$templatesdir/mailinglist/menu_sub.tmpl" ); + $subtemplate->param( NAME => $ml->get_localpart . "\@" . $ml->get_domain); + $subtemplate->param( LOCAL => $ml->get_localpart ); + $subtemplate->param( DOMAIN => $ml->get_domain ); + $subtemplate->param( HISTORY => gettext("History")); + $subtemplate->param( OID => $ml->get_oid ); + } else { + $subtemplate = new HTML::Template( filename => "$templatesdir/mailinglist/menu_sub_wait.tmpl" ); + $subtemplate->param( NAME => $ml->get_localpart . "\@" . $ml->get_domain); + $subtemplate->param( HISTORY => gettext("History")); + $subtemplate->param( REASON => Vhffs::Functions::status_string_from_status_id( $ml->get_status )); + $subtemplate->param( OID => $ml->get_oid ); + } - $output .= $subtemplate->output if( defined $subtemplate ); - undef( $subtemplate ); - } + + $output .= $subtemplate->output if( defined $subtemplate ); + undef( $subtemplate ); } $template->param( SUB_MAILINGLIST => $output ); Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -3,7 +3,7 @@ package Vhffs::Panel::Main; require Exporter; @ISA = qw(Exporter); -@EXPORT = qw( open_template display display_light ); +@EXPORT = qw( display display_light ); use POSIX qw(locale_h); use HTML::Template; @@ -18,15 +18,29 @@ use Vhffs::Group; use Vhffs::Panel::Menu; use Vhffs::Panel::User; +use Vhffs::Panel::Commons; +=pod +=head1 NAME + +Vhffs::Panel::Main - Provides acces to common VHFFS +functionnalities from Vhffs Panel. + +=head1 SYNOPSIS + +TODO + +=head1 METHODS + +=cut + sub check { my $vhffs = shift; my $templatedir = $vhffs->get_config->get_templatedir; my $template; - if( $vhffs->is_valid() == 0 ) { $template = new HTML::Template( filename => $templatedir."/main/close.tmpl" ); @@ -48,23 +62,94 @@ display_light Vhffs::Panel::Main( $template ); exit( 0 ); } + + return 0; } -sub get_theme +sub list_themes { my $vhffs = shift; - my $theme = CGI->cookie( "theme" ); + return -1 if( ! defined $vhffs ); + my @themes; + + my $dir = $vhffs->get_config->get_themesdir; + + return undef if( ! ( defined $dir ) ); + + opendir( DIR , $dir) or return -2; + + my @files = readdir( DIR ); + + foreach( @files ) + { + next if( /\./); + if( -d $dir."/".$_ ) + { + push @themes , $_; + } + } + + closedir( DIR ); + + return @themes; +} + + +sub cookie_theme +{ + my $vhffs; + my $cgi; + my $cookie; + my $theme; + + $vhffs = shift; + $cgi = shift; + + $theme = $cgi->param( "theme" ) if ( defined $cgi ); + $cookie = CGI->cookie( -name=>"theme", -value=>$theme, -expires=>'+10y' ) if ( defined $theme ); + $theme = CGI->cookie( "theme" ) if ( ! defined $theme ); $theme = $vhffs->get_config->get_default_theme() if ( ! defined $theme ); + $theme = "vhffs" if ( ! defined $theme || ! -f $vhffs->get_config->get_themesdir . "/" . $theme . "/main.css" ); - my $themetestfile = $vhffs->get_config->get_themesdir . "/" . $theme . "/main.css"; - return $theme if ( -f $themetestfile ); + return ( $theme, $cookie ); +} - $themetestfile = $vhffs->get_config->get_themesdir . "/vhffs/main.css"; - return "vhffs" if ( -f $themetestfile ); + +sub get_theme +{ + my $vhffs = shift; + my ( $theme, $cookie ) = cookie_theme( $vhffs ); + return $theme; +} + + +sub list_languages +{ + my $vhffs = shift; + return -1 if( ! defined $vhffs ); + + my @langs; - return undef; + my $dir = $vhffs->get_config->get_intldir; + return undef if( ! ( defined $dir ) ); + +# push @langs , "en_US"; + + opendir( DIR , $dir) or return @langs; + my @files = readdir( DIR ); + foreach( @files ) + { + next if( /\./); + if( -d $dir."/".$_ ) + { + push @langs , $_; + } + } + closedir( DIR ); + + return @langs; } @@ -82,19 +167,19 @@ return $txt; } + sub cookie_lang { - use CGI; my $vhffs; my $cgi; my $cookie; my $lang; $vhffs = shift; - $cgi = new CGI; + $cgi = shift; - $lang = $cgi->param( "lang" ); - $cookie = CGI->cookie( "language" => $lang ) if ( defined $lang ); + $lang = $cgi->param( "lang" ) if ( defined $cgi ); + $cookie = CGI->cookie( -name=>"language", -value=>$lang, -expires=>'+10y' ) if ( defined $lang ); $lang = CGI->cookie( "language" ) if ( ! defined $lang ); $lang = $vhffs->get_config->get_default_language() if ( ! defined $lang ); $lang = "en_US" if ( ! defined $lang ); @@ -103,72 +188,84 @@ bindtextdomain("vhffs", $vhffs->get_config->get_intldir); textdomain("vhffs"); - return $cookie; + return ( $lang, $cookie ); } + +sub get_lang +{ + my $vhffs = shift; + my ( $lang, $cookie ) = cookie_lang( $vhffs ); + return $lang; +} + + sub new { + my $class = ref($_[0]) || $_[0]; my $bad_news; my $session; my $user; my $username; my $uid; + my ( $lang, $langcookie ); + my ( $theme, $themecookie ); - # get current cgi my $cgi = new CGI; + my $vhffs = init Vhffs::Main; + if ( ! defined $vhffs ) { + print CGI->header( -type=>"text/html", -charset=>"utf-8" ), "Unable to open database connection\n"; + exit 1; + } - # Init the Vhffs Main System - my $vhffs = init Vhffs::Main; + ( $lang, $langcookie ) = cookie_lang( $vhffs , $cgi ); + ( $theme, $themecookie ) = cookie_theme( $vhffs , $cgi ); + + Vhffs::Panel::Main::check( $vhffs ); + my $config = $vhffs->get_config; my $templatedir = $vhffs->get_config->get_templatedir; + # We need to create an object now in order + # to be able to call display if something + # fails + my $this = {}; + $this->{vhffs} = $vhffs; + $this->{templatedir} = $templatedir; + $this->{cgi} = $cgi; + $this->{config} = $config; + $this->{lang} = $lang; + $this->{langcookie} = $langcookie; + $this->{theme} = $theme; + $this->{themecookie} = $themecookie; + $this->{errors} = []; + $this->{infos} = []; + bless($this, $class); + + # fetch the cookie which contain the sessions ID and the session - my $sid = CGI->cookie("session"); - if( ! defined $sid ) - { + my $sid = $cgi->cookie(CGI::Session::name()); + if( ! defined $sid ) { $bad_news = gettext("No cookie found, please accept the cookie and then please login again !"); - } - - if( ! defined $bad_news ) - { + } else { $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'}); $username = $session->param("username"); $uid = $session->param("uid"); - if(!$username || !$uid || $session->id() ne $sid) { + if(!$username || !$uid || $session->is_new()) { $bad_news = gettext("Expired session ! Please login again"); $session->delete(); - } - } - - if( ! defined $bad_news ) - { - $user = new Vhffs::User( $vhffs , $username , '401' ); - - #Try to verify if the user exist and is allowed to browse panel - #Then, set some preferences - if( ! defined $user || $user->fetch < 0 ) - { + } elsif( ! defined($user = Vhffs::User::get_by_uid($vhffs, $uid)) ) { $bad_news = gettext("User does not exist"); - } - elsif( $user->get_status != Vhffs::Constants::ACTIVATED ) - { + } elsif( $user->get_status != Vhffs::Constants::ACTIVATED ) { $bad_news = gettext("You're are not allowed to browse panel"); } - else - { - cookie_lang( $vhffs ); - } } - if( defined $bad_news ) - { - my $template = new HTML::Template( filename => $templatedir."/main/login_failed.tmpl" ); - $template->param( TEXT_LOGINFAILED => $bad_news); - $template->param( TEXT_LOGIN => gettext("Login") ); - $template->param( THEME => get_theme( $vhffs ) ); - print "Content-type: text/html\n\n" , $template->output; - return 0; + if( defined $bad_news ) { + $this->add_error($bad_news); + Vhffs::Panel::Commons::display_login($vhffs, $this); + exit(0); } @@ -178,8 +275,8 @@ my $group; $projectname = $session->param("project"); if( defined $projectname ) { - $group = new Vhffs::Group( $vhffs , $projectname , '401' ); - if( $group->fetch < 0 || $group->get_status != Vhffs::Constants::ACTIVATED || $group->is_user_in_group( $user ) != 1 ) + $group = Vhffs::Group::get_by_groupname($vhffs, $projectname); + if( (! defined($group)) || $group->get_status != Vhffs::Constants::ACTIVATED || $group->is_user_in_group( $user ) != 1 ) { $session->param("project", NULL); undef $group; @@ -187,32 +284,64 @@ } my $maintemplate = new HTML::Template( filename => $templatedir."/main/panel.tmpl" ); - $maintemplate->param( PANEL_TITLE => gettext("VHFFS Panel") ); - - my $theme = get_theme( $vhffs ); + $maintemplate->param( PANEL_TITLE => sprintf( gettext( "%s's Panel" ), $config->get_host_name ) ); $maintemplate->param( THEME => $theme ); + # Allows each theme to have its own Jscripts + my $jsglob = $config->get_themesdir()."$theme/js/*.js"; + my $jswebpath = "/themes/$theme/js/"; + my @jscripts; + push @jscripts, {SCRIPT => '/js/commons.js'}; + while(glob($jsglob)) { + use File::Basename; + push @jscripts, {SCRIPT => $jswebpath.basename( $_ )}; + } + $maintemplate->param( JSCRIPTS => \@jscripts ); - my $data = {}; - $data->{'vhffs'} = $vhffs; - $data->{'session'} = $session; - $data->{'template'} = $maintemplate; - $data->{'templatedir'} = $templatedir; - $data->{'user'} = $user; - $data->{'cgi'} = $cgi; - $data->{'config'} = $config; - $data->{'theme'} = $theme; + $this->{session} = $session; + $this->{template} = $maintemplate; + $this->{user} = $user; if( defined $group ) { - $data->{'group'} = $group; - $data->{'groupname'} = $projectname; + $this->{'group'} = $group; + $this->{'groupname'} = $projectname; } - my $menutemplate = new Vhffs::Panel::Menu($data); + my $menutemplate = new Vhffs::Panel::Menu($this); $maintemplate->param( MENU => $menutemplate->output ); - return $data; + return $this; } +sub has_errors +{ + my $self = shift; + return (@{$self->{errors}} > 0); +} + +sub set_title +{ + my ($self, $title) = @_; + $self->{template}->param( TEXT_TITLE => $title ); +} + +sub add_error +{ + my ($self, $error) = @_; + push(@{$self->{errors}}, {msg => $error}); +} + +sub add_info +{ + my ($self, $info) = @_; + push(@{$self->{infos}}, {msg => $info}); +} + +sub clear_infos +{ + my $self = shift; + $self->{infos} = []; +} + sub right_first { my ( $class , $vhffs , $session , $user ) = @_; @@ -226,23 +355,21 @@ return $template; } + sub project_info { - my ( $class , $vhffs , $session , $user ) = @_; + my ( $class , $vhffs, $group ) = @_; - my $projectname = $session->param("project"); my $temp; my $object; my $objects; - my $group; my $template; my $templatedir; my $subtemplate; $templatedir = $vhffs->get_config->get_templatedir; - $group = new Vhffs::Group( $vhffs , $projectname , '401' ); - if( ( ! defined( $group ) ) || ( $group->fetch <= 0 ) ) + if( ! defined( $group ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $template->param( MESSAGE => gettext("Group error" ) ); @@ -250,7 +377,7 @@ else { $template = new HTML::Template( filename => $templatedir."/group/info.tmpl" ); - $template->param( TEXT_TITLE => sprintf( gettext("Group %s") , $projectname )); + $template->param( TEXT_TITLE => sprintf( gettext("Group %s") , $group->get_groupname )); $template->param( GROUPNAME => $group->get_groupname ); $template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $group->get_quota_used , $group->get_quota ) ); @@ -260,7 +387,7 @@ $temp = ""; $template->param( WEBAREA => gettext("Webarea for this group") ); $objects = Vhffs::Services::Httpd::getall( $vhffs , undef , undef , $group ); - if( defined $objects ) + if( @$objects != 0 ) { foreach $object ( @{$objects} ) { @@ -436,35 +563,9 @@ } - if( $vhffs->get_config->use_largefile == 1 ) + if( $vhffs->get_config->use_repository == 1 ) { - use Vhffs::Services::LargeFile; $temp = ""; - $template->param( LARGEFILE => gettext("Hosted files for this group") ); - $objects = Vhffs::Services::LargeFile::getall( $vhffs , undef , undef , $group ); - if( defined $objects ) - { - foreach $object ( @{$objects} ) - { - $subtemplate = new HTML::Template( filename => $templatedir."/misc/group_service.tmpl" ); - $subtemplate->param( SERVICE => "largefile" ); - $subtemplate->param( VALUE => $object->get_filename ); - $subtemplate->param( TEXT => gettext("Go to admin") ); - $subtemplate->param( HISTORY => gettext("View history") ); - $subtemplate->param( OID => $object->get_oid ); - $temp .= $subtemplate->output; - } - } - else - { - $temp = gettext("No hosted files for this group"); - } - $template->param( LARGEFILE_VALUES => $temp ); - } - - if( $vhffs->get_config->use_dns == 1 ) - { - $temp = ""; $template->param( REPOSITORY => gettext("Download repositories for this group") ); $objects = Vhffs::Services::Repository::getall( $vhffs , undef , undef , $group ); if( defined $objects ) @@ -487,7 +588,7 @@ $template->param( REPOSITORY_VALUES => $temp ); } - if( $vhffs->get_config->use_repository == 1 ) + if( $vhffs->get_config->use_dns == 1 ) { $temp = ""; $template->param( DNS => gettext("Domains for this group") ); @@ -532,11 +633,11 @@ sub display { - my ( $class , $panel , $content, $cookie, $cookie2 ) = @_; + my ( $class , $panel , $content, $cookie ) = @_; + # WTF !?!? if( ref( $class ) eq 'HASH' ) { - $cookie2 = $cookie; $cookie = $content; $content = $panel; $panel = $class; @@ -544,143 +645,130 @@ my $maintemplate = $panel->{'template'}; $maintemplate->param( CENTRE => $content ); + if(@{$panel->{errors}} > 0) { + my $tmplerrors = new HTML::Template( filename => $panel->{templatedir}.'/misc/errors.tmpl' ); + $tmplerrors->param( ERRORS => $panel->{errors} ); + $maintemplate->param( ERRORS => $tmplerrors->output ); + } - if( defined $panel->{'group'} ) - { + if(@{$panel->{infos}} > 0) { + my $tmplinfos = new HTML::Template( filename => $panel->{templatedir}.'misc/infos.tmpl' ); + $tmplinfos->param( INFOS => $panel->{infos} ); + $maintemplate->param( INFOS => $tmplinfos->output ); + } + + if( defined $panel->{'group'} ) { $maintemplate->param( GROUPNAME => sprintf( gettext( "Current group: %s" ) , $panel->{'group'}->get_groupname ) ); } - if( ! defined $cookie ) - { - print CGI->header( -type=>"text/html", -charset=>"utf-8" ); - } - else - { - if( ! defined $cookie2) - { - print CGI->header( -cookie=>$cookie, -type=>"text/html", -charset=>"utf-8" ); - } - else - { - print CGI->header( -cookie=>[$cookie,$cookie2], -type=>"text/html", -charset=>"utf-8" ); - } - } + my $langcookie = ""; + $langcookie = $panel->{'langcookie'} if ( defined $panel->{'langcookie'} ); + my $themecookie = ""; + $themecookie = $panel->{'themecookie'} if ( defined $panel->{'themecookie'} ); + $cookie = "" if ( ! defined $cookie ); + print CGI->header( -cookie=>[$langcookie,$themecookie,$cookie], -type=>"text/html", -charset=>"utf-8" ); + print $maintemplate->output; - return; } -sub display_light +sub new_light { - my ( $class , $vhffs, $template, $cookie ) = @_; - - if( ! $cookie ) - { - print CGI->header( -type=>"text/html", -charset=>"utf-8" ); + my $class = ref($_[0]) || $_[0]; + my $cgi = new CGI; + my $vhffs = init Vhffs::Main; + if ( ! defined $vhffs ) { + print CGI->header( -type=>"text/html", -charset=>"utf-8" ), "Unable to open database connection\n"; + exit 1; } - else - { - print CGI->header( -cookie=>$cookie, -type=>"text/html", -charset=>"utf-8" ); - } - my $theme = get_theme( $vhffs ); - $template->param( THEME => $theme ); + my $config = $vhffs->get_config; + my $templatedir = $vhffs->get_config->get_templatedir; + my ( $lang, $langcookie ) = cookie_lang( $vhffs , $cgi ); + my ( $theme, $themecookie ) = cookie_theme( $vhffs , $cgi ); - print $template->output; + Vhffs::Panel::Main::check( $vhffs ); - return; + my $this = {}; + $this->{vhffs} = $vhffs; + $this->{templatedir} = $templatedir; + $this->{cgi} = $cgi; + $this->{config} = $config; + $this->{lang} = $lang; + $this->{langcookie} = $langcookie; + $this->{theme} = $theme; + $this->{themecookie} = $themecookie; + $this->{errors} = []; + bless($this, $class); + + return $this; } - -sub list_themes +sub display_light { - my $vhffs = shift; - return -1 if( ! defined $vhffs ); + my ( $class, $panel, $template, $cookie ) = @_; - my @themes; - - my $dir = $vhffs->get_config->get_themesdir; + #FIXME temporary hack + if(ref($class)) { + $cookie = $template; + $template = $panel; + $panel = $class; + } - return undef if( ! ( defined $dir ) ); + my $langcookie = ""; + $langcookie = $panel->{'langcookie'} if ( defined $panel->{'langcookie'} ); + my $themecookie = ""; + $themecookie = $panel->{'themecookie'} if ( defined $panel->{'themecookie'} ); + $cookie = "" if ( ! defined $cookie ); - opendir( DIR , $dir) or return -2; - - my @files = readdir( DIR ); + print CGI->header( -cookie=>[$langcookie,$themecookie,$cookie], -type=>"text/html", -charset=>"utf-8" ); - foreach( @files ) - { - next if( /\./); - if( -d $dir."/".$_ ) - { - push @themes , $_; - } - } + my $theme = get_theme( $panel->{'vhffs'} ); + $template->param( THEME => $theme ); + if(@{$panel->{errors}} > 0) { + my $tmplerrors = new HTML::Template( filename => $panel->{templatedir}."/misc/errors.tmpl" ); + $tmplerrors->param( ERRORS => $panel->{errors} ); + $template->param( ERRORS => $tmplerrors->output ); + } - closedir( DIR ); - return @themes; + print $template->output; + return; } +=pod -sub list_languages -{ - my $vhffs = shift; - return -1 if( ! defined $vhffs ); +=head2 redirect - my @langs; - - my $dir = $vhffs->get_config->get_intldir; - return undef if( ! ( defined $dir ) ); + $panel->redirect($page, $cookies); -# push @langs , "en_US"; +Issues a redirection header sending to $page +(you can specify additional cookies to be send). - opendir( DIR , $dir) or return @langs; - my @files = readdir( DIR ); - foreach( @files ) - { - next if( /\./); - if( -d $dir."/".$_ ) - { - push @langs , $_; - } - } - closedir( DIR ); +This function never returns. - return @langs; -} +B<C<$page> should be an absolute path> +B<C<$cookies>> can be a CGI::Cookie or a reference +to a CGI::Cookie array. -sub open_template -{ - my ( $arg1 , $arg2 , $arg3 , $vhffs , $path , $template , $tmp ); - $vhffs = shift; - $arg1 = shift; - $arg2 = shift; - $arg3 = shift; - $path = $vhffs->get_config->get_templatedir; - - $tmp = shift; - - if( $arg3 ) - { - $path .= "/" . $arg1 . "/" . $arg2 . "/" . $arg3 . ".tmpl"; - } - elsif( $arg2 ) - { - $path .= "/" . $arg1 . "/" . $arg2 . ".tmpl"; - } - else - { - $path .= "/" . $arg1 . ".tmpl"; - } - - $template = new HTML::Template( filename => $path , die_on_bad_params => 0 ); - - return( $template ); +=cut +sub redirect { + my ($self, $dest, $cookies) = @_; + if(defined $cookies) { + if(ref($cookies)) { + foreach(@$cookies) { + print "Set-Cookie: $_\n"; + } + } else { + print "Set-Cookie: $cookies\n"; + } + } + print CGI::redirect($dest); + exit(0); } - 1; Modified: trunk/vhffs-api/src/Vhffs/Panel/Menu.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Menu.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Menu.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -50,7 +50,6 @@ use Vhffs::Panel::DNS; use Vhffs::Panel::Mail; use Vhffs::Panel::Mailinglist; -use Vhffs::Panel::LargeFile; use Vhffs::Panel::Repository; sub new @@ -85,6 +84,7 @@ # add the User account my $usertemplate = new HTML::Template( filename => $templatedir."/menu/user.tmpl" ); + $usertemplate->param( MENU_TITLE => gettext("General") ); $usertemplate->param( TEXT_PREFS => gettext("User Preferences") ); $usertemplate->param( TEXT_HELP => gettext("Help") ); $usertemplate->param( TEXT_SUBMITBUG => gettext("Submit a bug") ); @@ -120,7 +120,6 @@ my $projecttemplate = new HTML::Template( filename => $templatedir."/menu/group.tmpl" ); $projecttemplate->param( PROJECTNAME => $projectname ); - $projecttemplate->param( SHOW_HIDE => gettext("Show/Hide") ); $projecttemplate->param( TEXT_PROJECT => gettext("Project : ") ); $projecttemplate->param( TEXT_CONFIG => gettext("Project Configuration") ); @@ -184,13 +183,6 @@ $projecttemplate->param( MAILINGLIST_MENU => $mailingmenu ); } - # Large files - if( $vhffs->get_config->use_largefile == 1 ) - { - $menu = menu Vhffs::Panel::LargeFile($data); - $projecttemplate->param( LARGEFILE_MENU => $menu ); - } - # Download repository if( $vhffs->get_config->use_repository == 1 ) { Modified: trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Mysql.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -50,57 +50,57 @@ my( $main , $query , $request); $main = shift; $query = "SELECT m.dbname , o.description , u.username , g.groupname , o.object_id FROM vhffs_mysql m, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=m.owner_uid AND g.gid=m.owner_gid AND m.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('dbname') ); } -sub getall_mysql +sub search { - my $main = shift; - my $name = shift; + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $mys = []; - if( defined $name ) - { - $query = "SELECT m.dbname, m.dbuser, m.object_id, m.owner_gid, o.state FROM vhffs_mysql m, vhffs_object o WHERE o.object_id=m.object_id AND ( ( m.dbname LIKE '".$name."' ) OR ( m.dbuser LIKE '".$name."' ) )"; - } - else - { - $query = "SELECT m.dbname, m.dbuser, m.object_id, m.owner_gid, o.state FROM vhffs_mysql m, vhffs_object o WHERE o.object_id=m.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - - return undef if ( $request->execute() <= 0); - - return( $request->fetchall_hashref('dbname') ); -} + if( defined $name ) { + $sql = 'SELECT m.dbname, m.object_id AS oid, g.groupname, o.state FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = m.owner_gid WHERE m.dbname LIKE ? OR m.dbuser LIKE ?'; + push(@params, '%'.$name.'%'); + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT m.dbname, m.object_id AS oid, g.groupname, o.state FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id INNER JOIN vhffs_groups g ON g.gid = m.owner_gid'; + } + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare( $sql) or return undef; + return undef unless($sth->execute(@params)); + while(my $m = $sth->fetchrow_hashref('NAME_lc')) { + $m->{state} = Vhffs::Functions::status_string_from_status_id($m->{state}); + push(@$mys, $m); + } -sub create_mysql -{ - my( $main , $dbname , $user , $group , $dbuser, $dbpass ) = @_; + return $mys; +} - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); - my $mysql = new Vhffs::Services::Mysql( $main , $dbname , $user , $group ); - return undef if( ! defined $mysql ); - $mysql->set_user( $user ); - $mysql->set_group( $group ); +sub create_mysql($$$$$$$) +{ + my( $main , $dbname , $user , $group , $dbuser, $dbpass, $description ) = @_; - return undef if ( $mysql->set_dbusername( $dbuser ) < 0 ); - return undef if ( $mysql->set_dbpassword( $dbpass ) < 0 ); + return undef if( ! defined $user ); + return undef if( ! defined $group ); - return undef if( $mysql->create < 0 ); + + my $mysql = Vhffs::Services::Mysql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group); + return undef unless( defined $mysql ); + return undef if ( Vhffs::Acl::add_acl( $user , $mysql , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if ( Vhffs::Acl::add_acl( $group , $mysql , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); @@ -112,11 +112,11 @@ { my ( $group , $main ) = @_; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); my $query = "SELECT m.dbname , m.object_id , o.state FROM vhffs_mysql m, vhffs_object o WHERE m.object_id=o.object_id AND m.owner_gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; my @retour; return undef if ( $request->execute() <= 0); Copied: trunk/vhffs-api/src/Vhffs/Panel/Object.pm (from rev 555, branches/vhffs_4.1/vhffs-api/src/Vhffs/Panel/Object.pm) Modified: trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Pgsql.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -47,26 +47,30 @@ use Vhffs::Services::Postgres; -sub getall_pgsql -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $pgs = []; - if( defined $name ) - { - $query = "SELECT p.dbname, p.dbuser, p.object_id, p.owner_gid, o.state FROM vhffs_pgsql p, vhffs_object o WHERE o.object_id=p.object_id AND ( ( p.dbname LIKE '".$name."' ) OR ( p.dbuser LIKE '".$name."' ) )"; - } - else - { - $query = "SELECT p.dbname, p.dbuser, p.object_id, p.owner_gid, o.state FROM vhffs_pgsql p, vhffs_object o WHERE o.object_id=p.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + if( defined $name ) { + $sql = 'SELECT p.dbname, p.object_id AS oid, g.groupname, o.state FROM vhffs_pgsql p INNER JOIN vhffs_object o ON o.object_id = p.object_id INNER JOIN vhffs_groups g ON g.gid = p.owner_gid WHERE p.dbname LIKE ? OR p.dbuser LIKE ?'; + push(@params, '%'.$name.'%', '%'.$name.'%'); + } else { + $sql = 'SELECT p.dbname, p.object_id AS oid, g.groupname, o.state FROM vhffs_pgsql p INNER JOIN vhffs_object o ON o.object_id = p.object_id INNER JOIN vhffs_groups g ON g.gid = p.owner_gid'; + } - return undef if ( $request->execute() <= 0); + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; - return( $request->fetchall_hashref('dbname') ); + return undef unless( $sth->execute(@params) ); + + while(my $p = $sth->fetchrow_hashref('NAME_lc')) { + $p->{state} = Vhffs::Functions::status_string_from_status_id($p->{state}); + push(@$pgs, $p); + } + return $pgs; } @@ -75,7 +79,7 @@ my( $main , $query , $request); $main = shift; $query = "SELECT p.dbname , o.description , u.username , g.groupname , o.object_id FROM vhffs_pgsql p, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=p.owner_uid AND g.gid=p.owner_gid AND p.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('dbname') ); @@ -87,11 +91,11 @@ { my ( $group , $main ) = @_; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); my $query = "SELECT p.dbname , p.object_id , o.state FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id=o.object_id AND p.owner_gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; my @retour; return undef if ( $request->execute() <= 0); @@ -150,22 +154,15 @@ sub create_pgsql { - my( $main , $dbname , $user , $group , $dbuser , $dbpass ) = @_; + my( $main , $dbname , $user , $group , $dbuser , $dbpass, $description ) = @_; - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return -1 if( ! defined $user ); + return -2 if( ! defined $group ); - my $pgsql = new Vhffs::Services::Postgres( $main , $dbname , $user , $group ); + my $pgsql = Vhffs::Services::Postgres::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group); return undef if( ! defined $pgsql ); - $pgsql->set_user( $user ); - $pgsql->set_group( $group ); - return undef if ( $pgsql->set_dbusername( $dbuser ) < 0 ); - return undef if ( $pgsql->set_dbpassword( $dbpass ) < 0 ); - - return undef if( $pgsql->create < 0 ); - return undef if ( Vhffs::Acl::add_acl( $user , $pgsql , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $pgsql , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Panel/Repository.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Repository.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -52,52 +52,52 @@ my( $main , $query , $request); $main = shift; $query = "SELECT r.name , o.description , u.username , g.groupname , o.object_id FROM vhffs_repository r, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=r.owner_uid AND g.gid=r.owner_gid AND o.object_id=r.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('name') ); } -sub getall_repository -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $reps = []; - if( defined $name ) - { - $query = "SELECT r.name, r.owner_gid, o.state FROM vhffs_repository r, vhffs_object o WHERE o.object_id=r.object_id AND r.name LIKE '".$name."'"; - } - else - { - $query = "SELECT r.name, r.owner_gid, o.state FROM vhffs_repository r, vhffs_object o WHERE o.object_id=r.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + if( defined $name ) { + $sql = 'SELECT r.name, g.groupname, o.state, r.object_id AS oid FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id INNER JOIN vhffs_groups g ON g.gid = r.owner_gid WHERE r.name LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT r.name, g.groupname, o.state, r.object_id AS oid FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id=r.object_id INNER JOIN vhffs_groups g ON g.gid = r.owner_gid'; + } + + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; - return undef if ( $request->execute() <= 0); + return undef unless($sth->execute(@params)); - return( $request->fetchall_hashref('name') ); + while(my $r = $sth->fetchrow_hashref('NAME_lc')) { + $r->{state} = Vhffs::Functions::status_string_from_status_id($r->{state}); + push(@$reps, $r); + } + + return $reps; } sub create_repository { - my( $main , $name , $user , $group ) = @_; + my( $main , $name , $user , $group, $description ) = @_; - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return undef unless(defined $user && defined $group); - my $repo = new Vhffs::Services::Repository( $main , $name , $user , $group ); + my $repo = Vhffs::Services::Repository::create( $main , $name , $description, $user , $group ); return undef if( ! defined $repo); - $repo->set_user( $user ); - $repo->set_group( $group ); - return undef if( $repo->create < 0 ); - return undef if ( Vhffs::Acl::add_acl( $user , $repo , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $repo , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -54,7 +54,7 @@ my( $main , $query , $request); $main = shift; $query = "SELECT s.reponame , o.description , u.username , g.groupname , o.object_id FROM vhffs_svn s, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=s.owner_uid AND g.gid=s.owner_gid AND o.object_id=s.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('reponame') ); @@ -65,11 +65,11 @@ { my ( $group , $main ) = @_; - return undef if ( $group->fetch < 0 ); + return undef unless( defined($group) ); my $query = "SELECT s.reponame , s.object_id, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id=s.object_id AND s.owner_gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; my @retour; return undef if ( $request->execute() <= 0); @@ -80,50 +80,46 @@ -sub getall_svn -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $svns = []; - if( defined $name ) - { - $query = "SELECT s.reponame, s.owner_gid, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id=s.object_id AND s.reponame LIKE '%".$name."%'"; - } - else - { - $query = "SELECT s.reponame, s.owner_gid, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id=s.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + if( defined $name ) { + $sql = 'SELECT s.reponame AS svnroot, g.groupname, o.state, s.object_id AS oid FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = s.owner_gid WHERE s.reponame LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT s.reponame AS svnroot, g.groupname, o.state, s.object_id AS oid FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = s.owner_gid'; + } - return undef if ( $request->execute() <= 0); + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; - return( $request->fetchall_hashref('reponame') ); + return undef unless($sth->execute(@params)); + + while(my $s = $sth->fetchrow_hashref('NAME_lc')) { + $s->{state} = Vhffs::Functions::status_string_from_status_id($s->{state}); + push(@$svns, $s); + } + + return $svns; } sub create_svn { - my $main = shift; - my $repo = shift; - my $user = shift; - my $group = shift; + my ($main, $repo, $description, $user, $group) = @_; - - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return -1 unless( defined $user ); + return -2 unless( defined $group ); - my $svn = new Vhffs::Services::Svn( $main , $repo , $user , $group ); + my $svn = Vhffs::Services::Svn::create( $main, $repo, $description, $user, $group ); - return -1 if( ! defined $svn ); + return -1 unless( defined $svn ); - $svn->set_user( $user ); - $svn->set_group( $group ); - - return -2 if( $svn->create < 0 ); - return ( -3 ) if ( Vhffs::Acl::add_acl( $user , $svn , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return ( -3 ) if( Vhffs::Acl::add_acl( $group , $svn , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/User.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/User.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -48,13 +48,13 @@ return if ( !defined $vhffs ); - my $query = "SELECT username FROM vhffs_users ORDER BY uid LIMIT 0,10"; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); + my $query = "SELECT uid FROM vhffs_users ORDER BY uid LIMIT 0,10"; + my $request = $vhffs->{'db'}->prepare( $query ); - while( my $hash = $request->fetchrow_hashref ) + while( my ($uid) = $request->fetchrow_array ) { - my $user = new Vhffs::Users( $vhffs , $hash->{username} , '401' ); - if( $user->fetch > 0 ) + my $user = Vhffs::User::get_by_uid( $vhffs , $uid ); + if( defined $user ) { push @users , $user; } @@ -63,28 +63,30 @@ } -sub getall_users -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $users = []; - if( ! defined $name ) - { - $query = "SELECT u.username, ui.firstname, ui.lastname , o.object_id FROM vhffs_users u, vhffs_user_info ui, vhffs_object o WHERE o.object_id=u.object_id AND u.uid=ui.uid"; + if( defined $name ) { + $sql = 'SELECT u.username, u.firstname, u.lastname , o.object_id AS oid, o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.username LIKE ? OR u.firstname LIKE ? OR u.lastname LIKE ?'; + my $p = '%'.$name.'%'; + push(@params, $p, $p, $p); + } else { + $sql = 'SELECT u.username, u.firstname, u.lastname , o.object_id AS oid, o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id'; } - else - { - $query = "SELECT u.username, ui.firstname, ui.lastname , o.object_id FROM vhffs_users u, vhffs_user_info ui, vhffs_object o WHERE o.object_id=u.object_id AND u.uid=ui.uid AND ( ( u.username LIKE '%".$name."%' ) OR (ui.firstname LIKE '%".$name."%' ) OR (ui.lastname LIKE '%".$name."%') )"; - } - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql); + return undef unless($sth->execute(@params)); - return undef if ( $request->execute <= 0 ); - return( $request->fetchall_hashref('username') ); - + while(my $u = $sth->fetchrow_hashref('NAME_lc')) { + $u->{state} = Vhffs::Functions::status_string_from_status_id($u->{state}); + push(@$users, $u); + } + return $users; } sub set_lang @@ -94,24 +96,9 @@ return -1 if ( ( ! defined $user ) || ( ! defined $lang ) ); - return -2 if( $user->fetch < 0 ); - - my $uid = $user->get_uid; - - my $query = "SELECT * FROM vhffs_panel_user_prefs WHERE uid='".$uid."'"; - my $request = $user->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - if( $rows != 0 ) - { - $query = "UPDATE vhffs_panel_user_prefs SET language='".$lang."' WHERE uid='".$uid."'"; - } - else - { - $query = "INSERT INTO vhffs_panel_user_prefs VALUES( '".$uid."' , '".$lang."' , '' )"; - } - $request = $user->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -4; + my $sql = 'UPDATE vhffs_users SET language = ? WHERE uid = ?'; + my $sth = $user->{db}->prepare($sql); + $sth->execute($lang, $user->get_uid) or return -1; } @@ -122,49 +109,17 @@ return -1 if ( ( ! defined $user ) || ( ! defined $theme ) ); - return -2 if( $user->fetch < 0 ); - - my $uid = $user->get_uid; - - my $query = "SELECT * FROM vhffs_panel_user_prefs WHERE uid='".$uid."'"; - my $request = $user->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - if( $rows != 0 ) - { - $query = "UPDATE vhffs_panel_user_prefs SET theme='".$theme."' WHERE uid='".$uid."'"; - } - else - { - $query = "INSERT INTO vhffs_panel_user_prefs VALUES( '".$uid."' , '', '".$theme."' )"; - } - $request = $user->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -4; + my $sql = 'UPDATE vhffs_users SET theme = ? WHERE uid = ?'; + my $dbh = $user->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($theme, $user->get_uid) or return -1; } sub get_lang { my $user = shift; return -1 if( ! defined $user ); - - return -2 if( $user->fetch < 0 ); - - my $uid = $user->get_uid; - - my $query = "SELECT language FROM vhffs_panel_user_prefs WHERE uid='".$uid."'"; - my $request = $user->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - if( $rows == 0 ) - { - return Vhffs::Constants::DEFAULT_LANG; - } - else - { - my $value = $request->fetchrow_arrayref; - return $value->[0]; - } - + return $user->get_lang; } @@ -172,25 +127,7 @@ { my $user = shift; return -1 if( ! defined $user ); - - return -2 if( $user->fetch < 0 ); - - my $uid = $user->get_uid; - - my $query = "SELECT theme FROM vhffs_panel_user_prefs WHERE uid='".$uid."'"; - my $request = $user->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - if( $rows == 0 ) - { - return Vhffs::Constants::DEFAULT_THEME; - } - else - { - my $value = $request->fetchrow_arrayref; - return $value->[0]; - } - + return $user->get_theme; } 1; Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -52,7 +52,7 @@ my( $main , $query , $request); $main = shift; $query = "SELECT w.servername , o.description , u.username , g.groupname , o.object_id FROM vhffs_httpd w, vhffs_object o , vhffs_users u , vhffs_groups g WHERE u.uid=w.owner_uid AND g.gid=w.owner_gid AND w.object_id=o.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ); + $request = $main->{'db'}->prepare( $query ); return undef if ( $request->execute <= 0 ); return( $request->fetchall_hashref('servername') ); @@ -63,10 +63,10 @@ { my ( $group , $main ) =@_ ; - return undef if ( $group->fetch < 0 ); + return undef unless( defined $group ); my $query = "SELECT w.servername, w.object_id, o.state FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id AND w.owner_gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $request = $main->{'db'}->prepare( $query ) or return -1; return undef if ( $request->execute() <= 0); @@ -74,43 +74,44 @@ } -sub getall_webs -{ - my $main = shift; - my $name = shift; +sub search { + my ($main, $name) = @_; - my $query; + my $sql; + my @params; + my $webs = []; - if( defined $name ) - { - $query = "SELECT w.servername, w.object_id, o.state FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id AND w.servername LIKE '".$name."'"; - } - else - { - $query = "SELECT w.servername, w.object_id, o.state FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id"; - } - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + if( defined $name ) { + $sql = 'SELECT w.servername, w.object_id AS oid, o.state, g.groupname FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = w.owner_gid WHERE w.servername LIKE ?'; + push(@params, '%'.$name.'%'); + } else { + $sql = 'SELECT w.servername, w.object_id AS oid, o.state, g.groupname FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id INNER JOIN vhffs_groups g ON g.gid = w.owner_gid'; + } - return undef if ( $request->execute() <= 0); + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql) or return undef; - return( $request->fetchall_hashref('servername') ); + return undef unless($sth->execute(@params)); + + while(my $w = $sth->fetchrow_hashref('NAME_lc')) { + $w->{state} = Vhffs::Functions::status_string_from_status_id($w->{state}); + push(@$webs, $w); + } + + return $webs; } sub create_web { - my( $main , $servername , $user , $group ) = @_; + my( $main, $servername, $description, $user, $group ) = @_; - return -1 if( $user->fetch < 0 ); - return -2 if( $group->fetch < 0 ); + return undef if( !defined $user ); + return undef if( !defined $group ); - my $web = new Vhffs::Services::Httpd( $main , $servername , $user , $group ); + my $web = Vhffs::Services::Httpd::create($main, $servername, $description, $user, $group); return undef if( ! defined $web ); - $web->set_user( $user ); - $web->set_group( $group ); - return undef if ( $web->create < 0 ); - return undef if ( Vhffs::Acl::add_acl( $user , $web , Vhffs::Constants::ACL_DELETE , $main ) < 0 ); return undef if( Vhffs::Acl::add_acl( $group , $web , Vhffs::Constants::ACL_VIEW , $main ) < 0 ); Modified: trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -36,67 +36,36 @@ use Vhffs::Constants; use Vhffs::Functions; - -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT c.cvsroot, c.object_id FROM vhffs_cvs c, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND c.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('cvsroot') ); -} - - - -sub get_all_cvs_to_create -{ - my( $main ) = @_; - - my $query = "SELECT c.cvsroot, c.object_id FROM vhffs_cvs c, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND c.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('cvsroot') ); -} - sub create_cvs { my $cvs = shift; - if( $cvs->fetch > 0 ) + return unless(defined($cvs)); + + if( create_repository( $cvs ) > 0 ) { - if( create_repository( $cvs ) > 0 ) - { - $cvs->set_status( Vhffs::Constants::ACTIVATED ); - $cvs->commit; - $cvs->add_history("Cvsroot now created !" ); - } - else - { - $cvs->add_history("Cvsroot NOT created, bots encounters errors !" ); - } + $cvs->set_status( Vhffs::Constants::ACTIVATED ); + $cvs->commit; + $cvs->add_history("Cvsroot now created !" ); } + else + { + $cvs->add_history("Cvsroot NOT created, bots encounters errors !" ); + } } sub delete_cvs { my $cvs = shift; + return unless(defined ($cvs)); + my $cvsroot = $cvs->get_cvsroot; + my $vhffs = $cvs->{'main'}; - if( $cvs->fetch > 0 ) - { - my $cvsroot = $cvs->get_cvsroot; - my $vhffs = $cvs->{'main'}; - - my $dir = $cvs->get_dir; - my $cmd = "rm -rf $dir"; - system( $cmd ); - $cvs->delete; - } + my $dir = $cvs->get_dir; + my $cmd = "rm -rf $dir"; + system( $cmd ); + $cvs->delete; } @@ -104,7 +73,7 @@ sub create_repository { my $cvs = shift; - return if( $cvs->fetch < 0 ); + return unless(defined $cvs); my $cvsroot = $cvs->get_cvsroot; my $vhffs = $cvs->{'main'}; @@ -136,17 +105,5 @@ } } -sub getall_cvs_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT c.cvsroot, c.object_id FROM vhffs_cvs c, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND c.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('cvsroot') ); -} - 1; Deleted: trunk/vhffs-api/src/Vhffs/Robots/DNS.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/DNS.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/DNS.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,70 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Robots::DNS; - -use Vhffs::Services::DNS; -use Vhffs::Constants; -use Vhffs::Functions; - -use strict; - - -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT n.domain, n.object_id FROM vhffs_dns_global n, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND n.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('domain') ); -} - - -sub get_all_domains_to_create -{ - my( $main ) = @_; - - my $query = "SELECT n.domain, n.object_id FROM vhffs_dns_global n, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND n.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('domain') ); -} - - - -1; - Modified: trunk/vhffs-api/src/Vhffs/Robots/Group.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Group.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Group.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -37,41 +37,17 @@ use Vhffs::Functions; use Vhffs::Constants; -sub get_all_groups_to_create -{ - my( $main ) = @_; - - my $query = "SELECT g.groupname,g.gid FROM vhffs_groups g, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND g.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('groupname') ); -} - -sub get_all_groups_refused -{ - my( $main ) = @_; - - my $query = "SELECT g.groupname,g.gid FROM vhffs_groups g, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND g.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('groupname') ); -} - - - sub create_groupdir { my $main = shift; my $group = shift; my $hash; - if( ( defined $group ) && ( $group->fetch > 0 ) ) + # If we have a group object, it has been fetched + # and is complete, no need to fetch it again + if( defined $group ) { - my $user = new Vhffs::User( $main , $group->get_owner_username , 401 ); + my $user = Vhffs::User::get_by_uid( $main , $group->get_owneruid ); my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main ); $group->add_history("Ok, Robots will create the directory"); Vhffs::Functions::create_dir( $hash ); @@ -97,9 +73,10 @@ my $hash; - if( ( defined $group ) && ( $group->fetch > 0 ) ) + # If group is defined, it is complete + if( defined $group ) { - my $user = new Vhffs::User( $main , $group->get_owner_username , 401 ); + my $user = Vhffs::User::get_by_uid( $main , $group->get_owneruid ); my $hash = Vhffs::Functions::hash_groupname( $group->get_groupname , $main ); if( -d $hash ) { @@ -122,7 +99,7 @@ my $main = shift; my $query = "SELECT * FROM vhffs_user_group WHERE state='".Vhffs::Constants::TO_DELETE."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; + $request = $main->{'db'}->prepare( $query ) or return -2; return undef if ( $request->execute() <= 0 ); return( $request->fetchall_hashref('gid') ); @@ -134,33 +111,20 @@ my $main = shift; my $query = "SELECT * FROM vhffs_user_group WHERE state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; + $request = $main->{'db'}->prepare( $query ) or return -2; return undef if ( $request->execute() <= 0 ); return( $request->fetchall_hashref('gid') ); } -sub getall_user_group_to_delete -{ - my $main = shift; - my $query = "SELECT * FROM vhffs_user_group WHERE state='".Vhffs::Constants::TO_DELETE."'"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('gid') ); -} - - - sub del_user { my $user = shift; my $group = shift; my $main = shift; - return -1 if( $user->fetch < 0); - return -2 if( $group->fetch < 0); + return -1 if( ! defined $user ); + return -2 if( ! defined $group ); my $path = $user->get_home . "/" . $group->get_groupname; unlink( $path ); @@ -168,7 +132,7 @@ $user->add_history("The user ".$user->get_username." leave the group"); my $query = "DELETE FROM vhffs_user_group WHERE uid='".$user->get_uid."' AND gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_WRITE'}->prepare( $query ) or return -2; + my $request = $main->{'db'}->prepare( $query ) or return -2; $request->execute; } @@ -180,8 +144,8 @@ my $group = shift; my $main = shift; - return -1 if( $user->fetch < 0); - return -1 if( $group->fetch < 0); + return -1 if( ! defined $user ); + return -1 if( ! defined $group ); my $path = $user->get_home . "/" . $group->get_groupname; @@ -190,7 +154,7 @@ $user->add_history("The user ".$user->get_username." join the group"); my $query = "UPDATE vhffs_user_group SET state='".Vhffs::Constants::ACTIVATED."' WHERE uid='".$user->get_uid."' AND gid='".$group->get_gid."'"; - my $request = $main->{'db'}->{'DB_WRITE'}->prepare( $query ) or return -2; + my $request = $main->{'db'}->prepare( $query ) or return -2; $request->execute; return 1; Deleted: trunk/vhffs-api/src/Vhffs/Robots/LargeFile.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/LargeFile.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/LargeFile.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,77 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Robots::LargeFile; - -use Vhffs::Services::LargeFile; -use Vhffs::Constants; -use Vhffs::Functions; - - -sub find_login -{ - my $file; - my $vhffs; - my $found; - my $i; - my $login; - my $query; - my $request; - my $rows; - - $vhffs = shift; - $file = shift; - - $found = 0; - $i = 1; - - while( $found == 0 ) - { - $login = $file->get_group->get_groupname . "-" . $i; - - $query = "SELECT * FROM vhffs_largefile WHERE username='$login'"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; - - $found = 1 if( $rows == 0 ); - - $i++; - } - - return $login; - -} - - - -1; - Deleted: trunk/vhffs-api/src/Vhffs/Robots/Mail.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Mail.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Mail.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,111 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Robots::Mail; - -use Vhffs::Services::Mail; -use Vhffs::Constants; -use Vhffs::Functions; - - -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT m.domain, m.object_id FROM vhffs_mxdomain m, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('domain') ); -} - - -sub get_all_mail_to_create -{ - my( $main ) = @_; - - my $query = "SELECT m.domain, m.object_id FROM vhffs_mxdomain m, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('domain') ); - -} - - -sub get_all_mail_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT m.domain, m.object_id FROM vhffs_mxdomain m, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('domain') ); - -} - - -sub delete_mail -{ - my ( $main , $domain ) = @_; - - my $mail = new Vhffs::Services::Mail( $main , $domain ); - my $retour; - if( ($retour = $mail->fetch) > 0 ) - { - $mail->add_history( "Will delete this mail domain" ); - $mail->delete; - } -} - - -sub create_mail -{ - my ( $main , $domain ) = @_; - - my $mail = new Vhffs::Services::Mail( $main , $domain ); - my $retour; - if( ($retour = $mail->fetch) > 0 ) - { - $mail->add_history( "Robots will activated this mail domain" ); - $mail->set_status( Vhffs::Constants::ACTIVATED ); - $mail->commit; - } -} - - -1; - Modified: trunk/vhffs-api/src/Vhffs/Robots/Mailing.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Mailing.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Mailing.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -40,60 +40,11 @@ my $query = "SELECT id_mailing , subject , message FROM vhffs_mailings WHERE state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; + $request = $main->{'db'}->prepare( $query ) or return -2; return undef if ( $request->execute() <= 0 ); return( $request->fetchall_hashref('id_mailing') ); } -#sub get_all_home_to_create -#{ -# my( $main ) = @_; -# -# my $query = "SELECT u.username,u.uid,u.homedir FROM vhffs_users u, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND u.object_id = o.object_id"; -# -# $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; -# return undef if ( $request->execute() <= 0 ); -# -# return( $request->fetchall_hashref('username') ); -# -#} -# -#sub create_home -#{ -# my( $main , $username , $user , $homedir , @subdirs , $path , $value ); -# -# ( $main , $username ) = @_; -# -# $user = new Vhffs::User( $main , $username , '401'); -# -# if( $user->fetch > 0 ) -# { -# $user->add_history( "Ok, robots take now the creation of the user" ); -# $homedir = $user->get_home; -# -# @subdirs = split( /\// , $homedir ); -# @subdirs = reverse @subdirs; -# -# $path = ""; -# -# while( defined ( $value = pop ( @subdirs ) ) ) -# { -# $path .= "/".$value if( $value ne '' ); -# Vhffs::Functions::create_dir( $path ); -# #return -1 if( mkdir( $path ) == false ); -# } -# chown $user->get_uid , $user->get_gid , $path ; -# -# $user->add_history( "Creation complete for user. Homedir is now created." ); -# $user->set_status( Vhffs::Constants::ACTIVATED ); -# $user->generate_password( 1 ); -# $user->commit; -# } -# -# return 1; -#} - - 1; Deleted: trunk/vhffs-api/src/Vhffs/Robots/Mailinglist.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Mailinglist.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Mailinglist.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,114 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Robots::Mailinglist; - -use Vhffs::Services::Mail; -use Vhffs::Constants; -use Vhffs::Functions; - - - -sub getall_lists -{ - my $main = shift; - - my $query = "SELECT l.ml_id, l.local_part , l.domain, l.object_id FROM vhffs_ml l, vhffs_object o WHERE l.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('ml_id') ); - -} - - -sub get_all_list_to_create -{ - my( $main ) = @_; - - my $query = "SELECT l.ml_id, l.domain, l.object_id FROM vhffs_ml l, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND l.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('ml_id') ); - -} - - -sub get_all_list_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT l.ml_id, l.domain, l.object_id FROM vhffs_ml l, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND l.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('ml_id') ); - -} - - -sub delete_list -{ - my ( $main , $lpart , $domain ) = @_; - - my $ml = new Vhffs::Services::Mailing( $main , $lpart , $domain ); - my $retour; - if( ($retour = $ml->fetch) > 0 ) - { - $ml->add_history( "Will delete this list" ); - $ml->delete; - } -} - - -sub create_list -{ - #my ( $main , $lpart , $domain ) = @_; - my $ml = shift; - - #my $ml = new Vhffs::Services::Mailing( $main , $lpart , $domain ); - my $retour; - if( ($retour = $ml->fetch) > 0 ) - { - $ml->add_history( "Robots will activated this list" ); - $ml->set_status( Vhffs::Constants::ACTIVATED ); - $ml->commit; - } -} - - -1; - Modified: trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Mysql.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -45,47 +45,6 @@ bindtextdomain("panel", "/vhffs/vhffs-panel/intl"); textdomain("panel"); - -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT m.dbname, m.object_id FROM vhffs_mysql m, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - - -sub get_all_db_to_create -{ - my( $main ) = @_; - - my $query = "SELECT m.dbname, m.object_id FROM vhffs_mysql m, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - - -sub get_all_db_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT m.dbname, m.object_id FROM vhffs_mysql m, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - - - sub delete_db { my $main = shift; @@ -93,7 +52,7 @@ my $query; - if( $db->fetch > 0 ) + if( $defined $db ) { $db->add_history( "Ok, robots takes the destruction of this database" ); my $dbi = mysql_admin_db_connect( $main ); @@ -126,27 +85,6 @@ -sub fix_password -{ - my ( $main , $dbname ) = @_; - - my $db = new Vhffs::Services::Mysql( $main , $dbname ); - my $query; - - if( $db->fetch > 0 ) - { - my $dbi = mysql_admin_db_connect( $main ); - if( $dbi != 1 ) - { - $query = "UPDATE user SET PASSWORD=PASSWORD('".$db->get_dbpassword."') WHERE user='".$db->get_dbusername."'"; - $dbi->do( $query ) or $db->add_history("Error while creating the database"); - $dbi->do( "FLUSH PRIVILEGES" ); - $dbi->disconnect; - } - } -} - - sub create_db { my $main = shift; @@ -154,7 +92,7 @@ my $query; - if( ( defined $db ) && ( $db->fetch > 0 ) ) + if( defined $db ) { $db->add_history( "Ok, robots takes the creation of this database" ); my $dbi = mysql_admin_db_connect( $main ); @@ -201,7 +139,7 @@ my $query; - if( $db->fetch > 0 ) + if( defined $db ) { $db->add_history( "Ok, will change password for this database" ); my $dbi = mysql_admin_db_connect( $main ); @@ -220,19 +158,4 @@ } } -sub get_all_db_to_update -{ - my( $main ) = @_; - - my $query = "SELECT m.dbname, m.object_id FROM vhffs_mysql m, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_MODIFICATION."' AND m.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - - - - 1; Deleted: trunk/vhffs-api/src/Vhffs/Robots/Panel.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Panel.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Panel.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,39 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -package Vhffs::Robots::Panel; - - - - -1; - Modified: trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Postgres.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -38,58 +38,6 @@ use strict; -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT p.dbname, p.object_id FROM vhffs_pgsql p, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND p.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - - -sub get_all_db_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT p.dbname, p.object_id FROM vhffs_pgsql p, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND p.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); -} - -sub get_all_db_to_create -{ - my( $main ) = @_; - - my $query = "SELECT p.dbname, p.object_id FROM vhffs_pgsql p, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND p.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); - -} - - -sub get_all_db_to_update -{ - my( $main ) = @_; - -my $query = "SELECT p.dbname, p.object_id FROM vhffs_pgsql p, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_MODIFICATION."' AND p.object_id = o.object_id"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('dbname') ); - -} - sub update_db { my $main = shift; @@ -97,7 +45,7 @@ my $db = pgsql_admin_db_connect( $main ); - if( $pg->fetch > 0 ) + if( defined $pg ) { $db->do("ALTER USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'"); $pg->set_status( Vhffs::Constants::ACTIVATED ); @@ -115,7 +63,7 @@ my $db = pgsql_admin_db_connect( $main ); - if( $pg->fetch > 0 ) + if( defined $pg ) { $db->do("CREATE DATABASE ".$pg->get_dbname ); $db->do("CREATE USER " . $pg->get_dbusername ." WITH PASSWORD '".$pg->get_dbpassword."'"); @@ -132,7 +80,7 @@ my $db = pgsql_admin_db_connect( $main ); - if( ( $pg->fetch > 0 ) && ( $pg->get_status == Vhffs::Constants::TO_DELETE ) ) + if( ( defined $pg ) && ( $pg->get_status == Vhffs::Constants::TO_DELETE ) ) { $pg->add_history("Ok, robots will erased all data"); $db->do("DROP DATABASE ".$pg->get_dbname ); Modified: trunk/vhffs-api/src/Vhffs/Robots/Repository.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Repository.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Repository.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -37,37 +37,11 @@ use Vhffs::Functions; -sub getall_refused -{ - my( $main ) = @_; - - my $query = "SELECT r.name, c.object_id FROM vhffs_repository r, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND r.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('name') ); -} - - - -sub get_all_repository_to_create -{ - my( $main ) = @_; - - my $query = "SELECT r.name, c.object_id FROM vhffs_repository r, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND r.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('name') ); -} - sub create_repository { my $repo = shift; - if( $repo->fetch > 0 ) + if( defined $repo ) { if( create_repositoryondisk( $repo ) > 0 ) { @@ -87,7 +61,7 @@ { my $repo = shift; - if( $repo->fetch > 0 ) + if( defined $repo ) { my $vhffs = $repo->{'main'}; @@ -97,8 +71,7 @@ system( $cmd ); # remove the link in group directory - my $groupname = Vhffs::Group::get_name_by_gid( $vhffs , $repo->get_ownergid ); - my $group = new Vhffs::Group( $vhffs , $groupname , 401 ); + my $group = Vhffs::Group::get_by_gid( $vhffs , $repo->get_ownergid ); Vhffs::Robots::unlink_to_group( $group, $repo->get_name.Vhffs::Constants::REPOSITORY_SUFFIX, $vhffs ); $repo->delete; @@ -110,7 +83,7 @@ sub create_repositoryondisk { my $repo = shift; - return if( $repo->fetch < 0 ); + return if( ! defined $repo ); my $name = $repo->get_name; my $vhffs = $repo->{'main'}; @@ -125,8 +98,7 @@ chown( $repo->get_owneruid , $repo->get_ownergid , $repodir ); chmod( 02775 , $repodir ); - my $groupname = Vhffs::Group::get_name_by_gid( $vhffs , $repo->get_ownergid ); - my $group = new Vhffs::Group( $vhffs , $groupname , 401 ); + my $group = Vhffs::Group::get_by_gid( $vhffs , $repo->get_ownergid ); if(Vhffs::Robots::link_to_group( $repodir, $group, $repo->get_name.Vhffs::Constants::REPOSITORY_SUFFIX, $vhffs ) < 0) { @@ -141,17 +113,5 @@ return 1; } -sub getall_repository_to_delete -{ - my( $main ) = @_; - - my $query = "SELECT r.name, c.object_id FROM vhffs_repository r, vhffs_object o WHERE o.state='".Vhffs::Constants::TO_DELETE."' AND r.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('name') ); -} - 1; Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -36,17 +36,6 @@ use Vhffs::Constants; use Vhffs::Functions; -sub getall_svn_reponame -{ - my( $main ) = @_; - - my $query = "SELECT s.reponame, s.object_id FROM vhffs_svn s, vhffs_object o WHERE s.object_id = o.object_id"; - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('reponame') ); -} - sub change_conf { my $svn = shift; @@ -101,56 +90,42 @@ my $apache_file; my $user_file; - if( ( defined $svn ) && ( $svn->fetch > 0 ) ) + if( defined $svn ) { $dir = $svn->get_dir; if( $svn->get_status == Vhffs::Constants::WAITING_FOR_CREATION ) { - my $ok = 1; + my $ok = 1; - if( ! -e $dir ) - { - Vhffs::Functions::create_dir( $dir ) if( ! -d $dir ); - $svn->add_history("Ok, robots find the empty directory and will create subversion repository"); - system("svnadmin create --fs-type fsfs $dir"); - Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 ); - Vhffs::Functions::change_owner_recur( $dir , $svn->get_owneruid , $svn->get_ownergid ); - change_conf( $svn ); - $svn->add_history("The Robots created the subversion repository"); - } - else - { - $ok = 0; - #TODO support syslog - $svn->set_status( Vhffs::Constants::CREATING_ERROR ); - $svn->commit(); - $svn->add_history("Error, directory of this subversion already exists ! Administrators must fix the problem"); - } - - - - if( $ok == 1 ) - { - $svn->set_status( Vhffs::Constants::ACTIVATED ); + if( ! -e $dir ) { + Vhffs::Functions::create_dir( $dir ) if( ! -d $dir ); + $svn->add_history("Ok, robots find the empty directory and will create subversion repository"); + system("svnadmin create --fs-type fsfs $dir"); + Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 ); + Vhffs::Functions::change_owner_recur( $dir , $svn->get_owneruid , $svn->get_ownergid ); + change_conf( $svn ); + $svn->add_history("The Robots created the subversion repository"); + } else { + $ok = 0; + #TODO support syslog + $svn->set_status( Vhffs::Constants::CREATING_ERROR ); + $svn->commit(); + $svn->add_history("Error, directory of this subversion already exists ! Administrators must fix the problem"); + } + if( $ok == 1 ) { + $svn->set_status( Vhffs::Constants::ACTIVATED ); - if( $svn->commit < 0 ) - { - $svn->add_history( "Cannot commit changes on the object ! "); - } - else - { - $svn->add_history( "Subversion repository is now active"); - } - } - else - { - $svn->add_history("Object is not created, problem while creating it"); - } - } + if( $svn->commit < 0 ) { + $svn->add_history( "Cannot commit changes on the object ! "); + } else { + $svn->add_history( "Subversion repository is now active"); + } + } else { + $svn->add_history("Object is not created, problem while creating it"); + } + } } - - } @@ -164,14 +139,11 @@ my $dir; my $dir2; - if( $svn->fetch > 0 ) - { + if( defined $svn ) { $dir = $svn->get_dir; system("rm -rf $dir 2>/dev/null"); $svn->delete; - } - else - { + } else { return -1; } Modified: trunk/vhffs-api/src/Vhffs/Robots/User.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/User.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/User.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -35,35 +35,10 @@ use Vhffs::User; use Vhffs::Constants; -sub getall_active_users -{ - my $main = shift; - - my $query = "SELECT u.username,u.uid FROM vhffs_users u, vhffs_object o WHERE o.state='".Vhffs::Constants::ACTIVATED."' AND u.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('username') ); -} - -sub get_all_home_to_create -{ - my( $main ) = @_; - - my $query = "SELECT u.username,u.uid,u.homedir FROM vhffs_users u, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND u.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('username') ); - -} - sub create { my $user = shift; - return if( $user->fetch < 0); + return if( ! defined $user ); create_home( $user->{'main'} , $user->get_username ); } @@ -72,12 +47,10 @@ { my $vhffs = shift; my $user = shift; - return if( $user->fetch < 0 ); + return if( ! defined $user ); delete_home( $vhffs , $user ); } - - sub delete_home { my( $main , $user , $homedir , $cmd ); @@ -85,7 +58,7 @@ $main = shift; $user = shift; - if( $user->fetch > 0 ) + if( defined $user ) { $user->add_history( "Ok, robots takes now the destruction of this user" ); $homedir = $user->get_home; @@ -107,7 +80,7 @@ $main = shift; $user = shift; - if( $user->fetch > 0 ) + if( defined $user ) { $user->add_history( "Ok, robots take now the creation of the user" ); $homedir = $user->get_home; Modified: trunk/vhffs-api/src/Vhffs/Robots/Web.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots/Web.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots/Web.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -37,33 +37,6 @@ use Vhffs::Functions; use Vhffs::Robots; -sub get_all_web_refused -{ - my( $main ) = @_; - - my $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE o.state='".Vhffs::Constants::VALIDATION_REFUSED."' AND w.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('servername') ); - -} - - - -sub get_all_web_to_create -{ - my( $main ) = @_; - - my $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE o.state='".Vhffs::Constants::WAITING_FOR_CREATION."' AND w.object_id = o.object_id"; - - $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - return undef if ( $request->execute() <= 0 ); - - return( $request->fetchall_hashref('servername') ); -} - sub create_web { use Vhffs::Group; @@ -71,7 +44,7 @@ my $main = shift; my $web = shift; - if( ( defined $web ) && ( $web->fetch > 0 ) ) + if( defined $web ) { $web->add_history( "Ok, the robot take the creation of this object. Web directory will be created"); my $webdir = $main->get_config->get_datadir . "/" . Vhffs::Constants::WEBDIR . "/" . Vhffs::Functions::hash_webdir( $web->get_servername ); @@ -89,8 +62,7 @@ chown( $web->get_owneruid , $web->get_ownergid , $webdir . "/tmp" ); chmod( 02775 , $webdir . "/tmp" ); - my $groupname = Vhffs::Group::get_name_by_gid( $main , $web->get_ownergid ); - my $group = new Vhffs::Group( $main , $groupname , 401 ); + my $group = Vhffs::Group::get_by_gid( $main , $web->get_ownergid ); if(Vhffs::Robots::link_to_group( $webdir,$group,$web->get_servername.Vhffs::Constants::WEB_SUFFIX,$main) < 0) { $web->add_history( "Can't link the webdirectory to the specified group"); @@ -115,7 +87,7 @@ my $dir; - if( $web->fetch > 0 ) + if(defined $web) { $web->add_history( "Ok, the robot will delete this object. Web directory will be removed"); my $hash = Vhffs::Functions::hash_webdir( $web->get_servername ); @@ -127,21 +99,15 @@ my $group = $web->get_group; if(Vhffs::Robots::unlink_to_group( $group,$web->get_servername.Vhffs::Constants::WEB_SUFFIX,$main) < 0) { - $web->add_history( "Can't unlink the webdirectory to the specified group"); + $web->add_history( "Can't unlink the webdirectory from the specified group"); } else { - $web->add_history( "Webdir is now unlinked to the group directory"); + $web->add_history( "Webdir is now unlinked from the group directory"); } + system("rm -rf '$webdir' 2> /dev/null"); - $dir = $webdir . "/htdocs"; - system("rm -rf $dir 2>/dev/null"); - $dir = $webdir . "/php-include"; - system("rm -rf $dir 2>/dev/null"); - $dir = $webdir . "/tmp"; - system("rm -rf $dir 2>/dev/null"); - $web->add_history( "Webdir is now erased."); $web->delete; } Modified: trunk/vhffs-api/src/Vhffs/Robots.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Robots.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Robots.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -120,7 +120,7 @@ my $linkname = shift; my $main = shift; - return -1 if( $group->fetch < 0 ); + return -1 unless( defined $group ); my $path = Vhffs::Functions::hash_groupname( $group->get_groupname , $main )."/".$linkname; @@ -136,7 +136,7 @@ my $linkname = shift; my $main = shift; - return -1 if( $group->fetch < 0 ); + return -1 unless( defined $group ); my $path = Vhffs::Functions::hash_groupname( $group->get_groupname , $main )."/".$linkname; Modified: trunk/vhffs-api/src/Vhffs/Services/Cvs.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Cvs.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Cvs.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -29,13 +29,20 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +=pod +=head1 NAME -# This file is a part of VHFFS4 Hosting Platform -# Please respect the licence of this file and the whole software +Vhffs::Services::Cvs - Handle CVS service in VHFFS -# Author: soda < dieu at gunnm dot org> +=head1 SYNOPSIS +TODO + +=head1 METHODS + +=cut + package Vhffs::Services::Cvs; use base qw(Vhffs::Object); @@ -43,134 +50,84 @@ use strict; use DBI; +=pod +=head2 check_cvsroot -sub new -{ - my $main; - my $cvsroot; - my $this; - my $self; - my $class; - my $user; - my $group; - - #( $class , $main , $cvsroot , $user , $group ) = @_; - - $class = shift; - $main = shift; - $cvsroot = shift; - $user = shift; - $group = shift; - - $this = {}; - - $this = $class->SUPER::new( $main , 1 , '401' ); - - #We return an undefined value if the user or the CVSROOT are not correct - return undef if( ! defined ( $cvsroot ) ); - return undef if( ! ( $cvsroot =~ /[a-z0-9]+/) ); - - $this->{'cvsroot'} = $cvsroot; - $this->{'user'} = $user if( defined $user ); - $this->{'group'} = $group if( defined $group ); - - bless( $this , $class ); + die("Invalid CVS root\n") unless(Vhffs::Services::Cvs::check_cvsroot($cvsroot)); - return $this; +Checks whether a cvsroot is valid or not. + +=cut + +sub check_cvsroot($) { + my $cvsroot = shift; + return (defined($cvsroot) && ($cvsroot =~ /^[a-z0-9]+$/)); } sub delete { my $self = shift; - $self->fetch; my $query = "DELETE FROM vhffs_cvs WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -1 if( $self->SUPER::delete < 0 ); return 1; } -sub create -{ - my $self = shift; +=pod - return -2 if ( $self->{'user'}->fetch < 0 ); - return -3 if ( $self->{'group'}->fetch < 0 ); - - $self->{'owner_uid'} = $self->{'user'}->get_uid; - $self->{'owner_gid'} = $self->{'group'}->get_gid; +=head2 create - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_cvs WHERE cvsroot='" . $self->{'cvsroot'} . "'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); + my $cvs = Vhffs::Services::Cvs::create($main, $cvsroot, $description, $user, $group); + die("Unable to create cvs\n") unless($cvs); - my $oid = $self->SUPER::create(); - if ( $oid lt 0 ) - { - return( -1 ); - } - else - { - $self->{'object_id'} = $oid; - } +Creates a new CVS service in database and returns the corresponding fully functional object. +=cut - #Get the max cvs_id and compute the new cvs_id - my $cvs_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(cvs_id) FROM vhffs_cvs"); - $cvs_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $cvs_id++; +sub create +{ + my ($main, $cvsroot, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(check_cvsroot($cvsroot)); + my $cvs; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; + eval { - #Finally, create the object - my $text = "INSERT INTO vhffs_cvs VALUES( '".$cvs_id."' , '".$self->{'cvsroot'} . "','".$self->{'user'}->get_uid."','".$self->{'group'}->get_gid."' , 'TRUE' , '".$self->{'object_id'}."' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $text ); - $request->execute or return -2; + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_CVS); - return $cvs_id; -} + die('Unable to create parent object') unless(defined($parent)); + my $sql = 'INSERT INTO vhffs_cvs(cvsroot, owner_uid, owner_gid, public, object_id) VALUES (?, ?, ?, TRUE, ?)'; + my $sth = $dbh->prepare($sql); + $sth->execute($cvsroot, $user->get_uid, $group->get_gid, $parent->get_oid); -sub fetch -{ - my $self = shift; - - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_cvs where cvsroot='".$self->{'cvsroot'}."'") or return -1; - - my $rows = $request->execute() or return -3; - - return -1 if( $rows <= 0 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} + $dbh->commit; + $cvs = get_by_cvsroot($main, $cvsroot); + }; + + if($@) { + warn "Error creating cvs service: $@\n"; + $dbh->rollback; } + return $cvs; - - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef ,$self->{'owner_uid'} , $self->{'owner_gid'} ); - return -1 if( $self->{'group'}->fetch < 0 ); - - - $self->SUPER::fetch; - - return 1; } - - sub commit { my $self = shift; my $query = "UPDATE vhffs_cvs SET cvsroot='".$self->{'cvsroot'}."', public='".$self->{'public'}."' WHERE cvs_id='".$self->{'cvs_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -2 if( $self->SUPER::commit < 0 ); @@ -206,54 +163,16 @@ } } - -sub getall -{ - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; - - my $query; - my $request; - - my $objs; - my $result; - my $tmp; - - $query = "SELECT c.cvsroot, c.object_id FROM vhffs_cvs c, vhffs_object o WHERE c.object_id = o.object_id"; - $query.= " AND o.state='".$state."'" if( defined $state ); - $query.= " AND c.cvsroot LIKE '%".$name."%'" if( defined $name ); - $query.= " AND c.owner_gid='".$group->get_gid."'" if( defined $group ); - $query .= " ORDER BY c.cvsroot"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - return undef if( $rows == 0); - - while( $result = $request->fetchrow_hashref ) - { - - $tmp = new Vhffs::Services::Cvs( $vhffs , $result->{'cvsroot'} ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } - } - return $objs; -} - - sub set_user { my ( $self , $user ) = @_; - $self->{'user'} = $user; + $self->{'owner_uid'} = $user->get_uid() if(defined $user && defined $self); } sub set_group { my ( $self , $group ) = @_; - $self->{'group'} = $group; + $self->{'owner_gid'} = $group->get_gid() if(defined $group && defined $self); } sub get_cvsroot @@ -296,27 +215,86 @@ return( $self->{'main'}->get_config->get_datadir . "/cvs/cvsroot/" . $self->get_group->get_groupname . "/" . $self->get_cvsroot ); } +sub get_by_cvsroot { + my($main, $cvsroot) = @_; + my $sql = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, c.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE c.cvsroot = ?'; + my $dbh = $main->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $cvsroot)); + return _new Vhffs::Services::Cvs($main, @params); +} + +sub _new { + my ($class, $main, $cvs_id, $cvsroot, $owner_uid, $owner_gid, $public, $oid, $date_creation, $description, $state) = @_; + + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_CVS); + return undef unless(defined $self); + + $self->{cvsroot} = $cvsroot; + $self->{cvs_id} = $cvs_id; + $self->{owner_gid} = $owner_gid; + $self->{public} = $public; + return $self; +} + +sub getall +{ + my ($vhffs, $state, $name, $group) = @_; + + my $query; + my $request; + my @params; + + my $objs = []; + my $result; + my $tmp; + + $query = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id'; + if(defined $state) { + $query .= ' AND o.state=?'; + push(@params, $state); + } + if(defined $name) { + $query .= ' AND c.cvsroot LIKE ?'; + push(@params, '%'.$name.'%'); + } + + if(defined $group) { + $query .= ' AND c.owner_gid=?'; + push(@params, $group->get_gid); + } + $query .= " ORDER BY c.cvsroot"; + $request = $vhffs->{'db'}->prepare( $query ); + my $rows = $request->execute(@params); + + return undef if( ! $rows ); + + while( $result = $request->fetchrow_arrayref ) + { + $tmp = _new Vhffs::Services::Cvs( $vhffs, @{$result} ) ; + push @{$objs} , $tmp; + } + return $objs; +} + sub getall_per_group { - my $main = shift; - my $group = shift; + my ($main, $group) = @_; my @result; my $cvsroot; - return undef if ( $group->fetch < 0 ); + return undef if ( ! defined $group ); - my $query = "SELECT c.cvsroot , c.object_id, o.state FROM vhffs_cvs c, vhffs_object o WHERE o.object_id=c.object_id AND c.owner_gid='".$group->get_gid."'"; - - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $query = 'SELECT c.cvs_id, c.cvsroot, c.owner_uid, c.owner_gid, c.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_cvs c INNER JOIN vhffs_object o ON c.object_id = o.object_id WHERE c.owner_gid=? ORDER BY c.cvsroot'; + my $request = $main->{'db'}->prepare( $query ) or return -1; + - return undef if ( $request->execute() <= 0); + return undef if ( ! $request->execute($group->get_gid) ); - my $repos = $request->fetchall_hashref( 'cvsroot' ); - foreach $cvsroot ( %{$repos} ) + while( my $repos = $request->fetchrow_arrayref() ) { - my $cvs = new Vhffs::Services::Cvs( $main , $cvsroot ); - push( @result , $cvs ) if( $cvs->fetch > 0 ); + push(@result, _new Vhffs::Services::Cvs($main, @{$repos})) } @@ -324,7 +302,10 @@ } +1; +__END__ +=head1 AUTHORS +soda < dieu at gunnm dot org> - -1; +Sebastien Le Ray < beuss at tuxfamily dot org > Modified: trunk/vhffs-api/src/Vhffs/Services/DNS.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/DNS.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/DNS.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -29,184 +29,147 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +=pod -# Vhffs::Services::DNS -# This file is a part of VHFFS4 program. It is used to manage domain name server (DNS) -# Please respect the licence of this program. +=head1 NAME -# Author: soda < dieu at gunnm dot org > +Vhffs::Services::DNS - Handles domain name related stuff in VHFFS -package Vhffs::Services::DNS; +=head1 SYNOPSIS -use base qw(Vhffs::Object); -use strict; -use DBI; +TODO +=head1 METHODS +=cut -sub new -{ - my $this; - my $self; - - my $class = shift; - my $main = shift; - my $domain = shift; - my $user = shift; - my $group = shift; - - $this = {}; - - return undef if( ! ($domain =~ /^([a-z0-9\-]+\.)+[a-z]{2,4}$/ ) ); - - $this = $class->SUPER::new( $main , 1 , '401' ); - - $this->{'domain'} = $domain if ( defined $domain ); - $this->{'owner_uid'} = $user->get_uid if ( defined $user ); - $this->{'owner_gid'} = $group->get_gid if ( defined $group ); - $this->{'user'} = $user; - $this->{'group'} = $group; - - - bless( $this , $class ); - - return $this; -} +package Vhffs::Services::DNS; +use base qw(Vhffs::Object); +use strict; +use DBI; # Returns an array with ALL the DNS # If ionly a ref of a Vhffs::Main instance if given, it returns ALL DNS objects # If a state (of Vhffs::Constants) is given more, it returns all DNS objects which have this state sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $domains = []; + my @params; + my $sql = 'SELECT d.domain FROM vhffs_dns d, vhffs_object o WHERE o.object_id = d.object_id'; + if(defined $state) { + $sql .= ' AND o.state = ?'; + push @params, $state; + } + if(defined $name) { + $sql .= ' AND d.domain LIKE ?'; + push @params, '%'.$name.'%'; + } + if(defined $group) { + $sql .= ' AND d.owner_gid = ?'; + push @params, $group->get_gid; + } + $sql .= ' ORDER BY d.domain'; - my $objs; - my $result; - my $tmp; + my $dbh = $vhffs->get_db_object(); + my $sth = $dbh->prepare($sql); + $sth->execute(@params); + while(my @d = $sth->fetchrow_array) { + push @$domains, get_by_domainname($vhffs, $d[0]); + } - $query = "SELECT n.domain, n.object_id FROM vhffs_dns_global n, vhffs_object o WHERE n.object_id = o.object_id"; - $query.= " AND o.state='".$state."'" if( defined $state ); - $query.= " AND n.domain LIKE '%".$name."%'" if( defined $name ); - $query.= " AND n.owner_gid='".$group->get_gid."'" if( defined $group ); + return $domains; +} - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; +=pod - return undef if( $rows <= 0); - - while( $result = $request->fetchrow_hashref() ) - { - $tmp = new Vhffs::Services::DNS( $vhffs , $result->{'domain'} ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } - } - return $objs; -} +=head2 create + my $dns = Vhffs::Services::DNS::create($main, $domain, $description, $user, $group); + die('Unable to create DNS') unless(defined $dns); +Create a new DNS in database and returns the corresponding object. +If the init section of the VHFFS config is filled, use it to add initial A, MX and NS records. +=cut -#Create the object in VHFFS database sub create { - my $self = shift; - my $conf = $self->{'main'}->get_config->get_service("dns"); - - return -1 if ( ! defined $conf ); - + my($main, $domain, $description, $user, $group) = @_; - #Check if the DNS object already exists - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_global WHERE domain='" . $self->{'domain'} . "'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); - - my $oid = $self->SUPER::create(); - return -1 if ( $oid lt 0 ); - - - #Exit is the no user and no group are linked to this object - return -3 if ( ( $self->{'user'}->fetch < 0 ) || ( $self->{'group'}->fetch < 0 ) ); - + my $conf = $main->get_config->get_service("dns"); + return undef if ( ! defined $conf ); - #Get the max dns_id and compute the new dns_id - my $dns_id = 1; - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_global where domain='".$self->{'domain'}."'") or return -1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(dns_id) FROM vhffs_dns_global"); - $dns_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $dns_id++; - $self->{'dns_id'} = $dns_id; - - - #Finally, create the object - my $text = "INSERT INTO vhffs_dns_global VALUES( '".$dns_id."' , '".$self->{'domain'}."', '".$self->{'group'}->get_gid."' , '".$self->{'user'}->get_uid."' , '".$oid."' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $text ); - $request->execute or return -2; - $self->{SOA}->{origin} = $self->{domain} . "."; - $self->commit; - - - # Final, create some defaults values defined in the conf file - # Those values are defined in the config file in the <services> <dns> .... </dns> </services> - my $ip; - my $name; - my $prio; - - if( defined $conf->{init} ) - { - my $init = $conf->{init}; - if( defined $init->{a} ) - { - foreach( keys %{$init->{a}} ) - { - $name = $_; - $ip = $init->{a}{$_}; - if( $name eq "default" ) - { - $self->add_a( "" , $ip ); - } - else - { - $self->add_a( $name , $ip ); - } - } - } - if( defined $init->{mx} ) - { - foreach( keys %{$init->{mx}} ) - { - $prio = $_; - $ip = $init->{mx}{$_}; - $self->add_mx( $ip , $prio ); - } - } - - if( defined $init->{ns} ) - { - foreach( keys %{$init->{ns}} ) - { - $name = $_; - $self->add_ns( $name ); - } - } - + return undef unless(defined($user) && defined($group)); + return undef unless(Vhffs::Functions::check_domain_name($domain)); + + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; + my $self; + + eval { + + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_DNS); + + die('Unable to create parent object') unless(defined $parent); + + my $sql = 'INSERT INTO vhffs_dns (domain, owner_uid, owner_gid, object_id, ns, mbox, serial, refresh, retry, expire, minimum, ttl) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; + my ($day, $month, $year); + (undef,undef,undef,$day,$month,$year) = localtime(time); + my $serial = sprintf('%.4u%.2u%.2u01',$year+1900,$month+1,$day); + + my $sth = $dbh->prepare($sql); + + $sth->execute($domain, $user->get_uid, $group->get_gid, $parent->get_oid, $conf->{default_ns1}, $conf->{default_mbox}, $serial, + $conf->{default_refresh}, $conf->{default_retry}, $conf->{default_expire}, $conf->{default_minimum}, $conf->{default_minimum}); + + $dbh->commit; + $self = get_by_domainname($main, $domain); + }; + + # Something went wrong, let's cancel everything + if($@) { + warn "Error creating domain $domain: $@\n"; + $dbh->rollback; + return undef; } - - return $dns_id; -} + # Fill in default information defined in configuration. + if( defined $conf->{init} ) { + my ($ip, $name, $prio); + my $init = $conf->{init}; + if( defined $init->{a} ) { + foreach( keys %{$init->{a}} ) { + $name = $_; + $ip = $init->{a}{$_}; + $self->add_a( $name , $ip ); + } + } + if( defined $init->{mx} ) { + foreach( keys %{$init->{mx}} ) { + $prio = $_; + $ip = $init->{mx}{$_}; + $self->add_mx( $ip , $prio ); + } + } + if( defined $init->{ns} ) { + foreach( keys %{$init->{ns}} ) { + $name = $_; + $self->add_ns( $name ); + } + } + } + return $self; +} + # Delete this object from VHFFS database sub delete { @@ -214,23 +177,14 @@ my $query; my $request; - return -1 if( $self->fetch < 0); - - # Destroy the SOA part - $query = "DELETE FROM vhffs_dns_soa WHERE id='".$self->{'dns_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -1; - - # Destroy the RR part (A, NS, PTR, ...) $query = "DELETE FROM vhffs_dns_rr WHERE zone='".$self->{'dns_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $request = $self->{'db'}->prepare($query); $request->execute or return -1; - # Destroy the main part of the DNS - $query = "DELETE FROM vhffs_dns_global WHERE dns_id='".$self->{'dns_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $query = "DELETE FROM vhffs_dns WHERE dns_id='".$self->{'dns_id'}."'"; + $request = $self->{'db'}->prepare($query); $request->execute or return -1; #Destroy the generic object @@ -239,280 +193,234 @@ return 1; } +=pod -#Get all data about this httpd object in the databse -sub fetch +=head2 get_by_domainname + + my $dns = Vhffs::Services::DNS::get_by_domainname($main, $domainname); + die('Domain not found') unless(defined $dns); + +Fetches the DNS object whose domainname is $domainname. Returned object is fully +functionnal. A, NS, CNAME, I<etc.> records are filled and accessible using +C<$dns->get_xxx_type>. + +=cut + +sub get_by_domainname($$) { - my $self = shift; - my $name; - my $key; + my ($main, $name) = @_; - - #First, get informations in the dns database, in dns_global - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_global where domain='".$self->{'domain'}."'") or return -1; - my $rows = $request->execute() or return -3; - return -1 if ( $rows == 0 ); - - - my $result = $request->fetchrow_hashref(); - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - #Second, get the SOA part - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_soa where id='".$self->{'dns_id'}."'"); - $request->execute(); - $result = $request->fetchrow_hashref(); - - foreach ( keys %{$result} ) - { - $self->{SOA}->{$_} = $result->{$_} - } - - - #Get the A TYPE - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_rr where zone='".$self->{'dns_id'}."' AND type='A'") or return -1; - $request->execute() or return -3; - while( $result = $request->fetchrow_hashref()) - { - if( $result->{name} eq "" ) - { - $name = "default"; - } - else - { - $name = $result->{name}; - } - - foreach( keys %{$result} ) - { - $self->{A}->{$name}->{$_} = $result->{$_} if ( $_ ne "name" ); - } - } - - - - #Get the NS ZONE - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_rr where zone='".$self->{'dns_id'}."' AND type='NS'") or return -1; - $request->execute() or return -3; - while( $result = $request->fetchrow_hashref()) - { - $key = $result->{data}; - - foreach( keys %{$result} ) - { - $self->{NS}->{$key}->{$_} = $result->{$_}; - } - } - - - - - #Get the CNAME TYPE - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_rr where zone='".$self->{'dns_id'}."' AND type='CNAME'") or return -1; - $request->execute() or return -3; - while( $result = $request->fetchrow_hashref()) - { - if( $result->{name} eq "" ) - { - $name = "default"; - } - else - { - $name = $result->{name}; - } - - foreach( keys %{$result} ) - { - $self->{CNAME}->{$name}->{$_} = $result->{$_} if ( $_ ne "name" ); - } - } - - - - - #Get the MX TYPE - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_rr where zone='".$self->{'dns_id'}."' AND type='MX'") or return -1; - $self->{MX} = undef if ( $request->execute() <= 0 ); - while( $result = $request->fetchrow_hashref()) - { - $key = $result->{aux}; - - foreach( keys %{$result} ) - { - $self->{MX}->{$key}->{$_} = $result->{$_} if ( $_ ne "aux" ); - } - } - - - $self->SUPER::fetch; - $self->SUPER::fetch; + my $sql = 'SELECT d.dns_id, d.domain, d.owner_gid, d.ns, d.mbox, d.serial, d.refresh, d.retry, d.expire, d.minimum, d.ttl, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_dns d INNER JOIN vhffs_object o ON o.object_id = d.object_id WHERE d.domain = ?'; + + my $dbh = $main->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $name)); + my $dns_id = $params[0]; + + # Fetches A records + $sql = 'SELECT id, zone, (CASE WHEN name = \'\' THEN \'default\' ELSE name END) AS name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = \'A\''; + my $sth = $dbh->prepare($sql); + $sth->execute($dns_id); + my $a = $sth->fetchall_hashref('id'); + push @params, $a; + + # Fetches NS records + $sql = 'SELECT id, zone, name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?'; + $sth = $dbh->prepare($sql); + $sth->execute($dns_id, 'NS'); + my $ns = $sth->fetchall_hashref('id'); + push @params, $ns; + + # Fetches CNAME records + $sql = 'SELECT id, zone, (CASE WHEN name = \'\' THEN \'default\' ELSE name END) AS name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?'; + $sth = $dbh->prepare($sql); + $sth->execute($dns_id, 'CNAME'); + my $cname = $sth->fetchall_hashref('id'); + push @params, $cname; + + # Fetches MX records + $sql = 'SELECT id, zone, name, type, data, aux, ttl FROM vhffs_dns_rr WHERE zone = ? AND type = ?'; + $sth = $dbh->prepare($sql); + $sth->execute($dns_id, 'MX'); + my $mx = $sth->fetchall_hashref('id'); + push @params, $mx; + + return _new Vhffs::Services::DNS($main, @params); } -sub get_max_rrid +sub _new { - my ( $self ) = @_; + my ($class, $main, $dns_id, $domain, $owner_gid, $ns, $mbox, $serial, $refresh, $retry, $expire, $minimum, $ttl, $oid, $owner_uid, $date_creation, $state, $description, $a, $nsr, $cname, $mx) = @_; - my $id = 1; - my $request = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(id) FROM vhffs_dns_rr"); - $id = $request->[0][0] if ( defined $request->[0][0] ); - $id++; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_DNS); - return $id; + $self->{dns_id} = $dns_id; + $self->{domain} = $domain; + $self->{owner_gid} = $owner_gid; + $self->{ns} = $ns; + $self->{mbox} = $mbox; + $self->{serial} = $serial; + $self->{refresh} = $refresh; + $self->{retry} = $retry; + $self->{expire} = $expire; + $self->{minimum} = $minimum; + $self->{ttl} = $ttl; + $self->{A} = $a; + $self->{NS} = $nsr; + $self->{CNAME} = $cname; + $self->{MX} = $mx; + + return $self; } - # This function returns -1 if a name already exists. # For example, if soda.gunnm.org already exists in the dns_rr table, we return -1. Otherwise, 0. sub name_exists { my ( $self , $name ) = @_; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_rr WHERE name='".$name."' AND zone='".$self->{'dns_id'}."' AND TYPE IN ( 'A' , 'CNAME')"); - my $rows = $request->execute; - return 1 if ( $rows != 0 ); - - return 0; + my $dbh = $self->get_main->get_db_object(); + my $sql = 'SELECT id FROM vhffs_dns_rr WHERE name = ? AND zone = ? AND type IN(\'A\', \'CNAME\') LIMIT 1'; + return ($dbh->do($sql, undef, $name, $self->{dns_id}) != 0); } sub delete_cname { - my $self = shift; - my $name = shift; + my ($self, $id) = @_; - return -1 if( ! ($name =~ /^[a-z0-9\.\-]*$/ ) ); - $name = "" if( $name eq "default" ); + return -1 unless($id =~ /^\d+$/ ); + my $rr = $self->{CNAME}{$id}; + return -2 unless(defined $rr); - my $query = "DELETE FROM vhffs_dns_rr WHERE type='CNAME' AND zone='".$self->{'dns_id'}."' AND name='".$name."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $dbh = $self->get_main()->get_db_object(); + my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'CNAME\' AND zone = ?'; + $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3; + $self->add_history('Deleted CNAME record '.$rr->{name}); + delete $self->{CNAME}{$id}; + #Update SOA - $self->commit; - $self->add_history("Delete the $name CNAME"); - + $self->update_serial(); return 1; } - sub delete_ns { - my $self = shift; - my $ip = shift; + my ($self, $id) = @_; - return -1 if( ! ($ip =~ /^[a-z0-9\.\-]+$/ ) ); + return -1 unless( $id =~ /^\d+$/ ); + my $rr = $self->{NS}{$id}; + return -2 unless(defined $rr); - my $query = "DELETE FROM vhffs_dns_rr WHERE type='NS' AND zone='".$self->{'dns_id'}."' AND data='".$ip."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $dbh = $self->get_main->get_db_object(); + my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'NS\' AND zone = ?'; + $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3; - $self->add_history("Delete the ns $ip"); + $self->add_history('Deleted NS record '.$rr->{data}); + + delete $self->{NS}{$id}; - #Update SOA - $self->commit; + $self->update_serial(); return 1; } - - - sub delete_mx { - my $self = shift; - my $aux = shift; + my ($self, $id) = @_; - return -1 if( ! ($aux =~ /^[a-z0-9\.\-]+$/ ) ); + return -1 unless( $id =~ /^\d+$/ ); + my $rr = $self->{MX}{$id}; + return -2 unless(defined $rr); - my $query = "DELETE FROM vhffs_dns_rr WHERE type='MX' AND zone='".$self->{'dns_id'}."' AND aux='".$aux."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $dbh = $self->get_main->get_db_object(); + my $sql = 'DELETE FROM vhffs_dns_rr WHERE id = ? AND type = \'MX\' AND zone = ?'; + $dbh->do($sql, undef, $id, $self->{dns_id}) or return -3; - $self->add_history("Delete the mx with priority $aux"); - - #Update SOA - $self->commit; + $self->add_history('Deleted the MX record '.$rr->{name}.' (priority: '.$rr->{aux}.')'); + + delete $self->{MX}{$id}; + + $self->update_serial(); return 1; } sub delete_a { - my $self = shift; - my $name = shift; + my ($self, $id) = @_; - return -1 if( ! ($name =~ /^(?:[a-z0-9\-]*|\*)$/ ) ); - $name = "" if( $name eq "default" ); + return -1 unless($id =~ /^\d+$/ ); + return -2 unless(defined $self->{A}{$id}); - my $query = "DELETE FROM vhffs_dns_rr WHERE type='A' AND zone='".$self->{'dns_id'}."' AND name='".$name."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $dbh = $self->get_main->get_db_object(); + my $sql = 'DELETE FROM vhffs_dns_rr WHERE type = \'A\' AND zone = ? AND id = ?'; + $dbh->do($sql, undef, $self->{dns_id}, $id) or return -3; - $self->add_history("Delete $name FROM domain"); + $self->add_history('Deleted A record '.$self->{A}{$id}{name}); + delete $self->{A}{$id}; - #Update SOA - $self->commit; + $self->update_serial(); return 1; } sub update_a { - my ( $self , $name , $ip ) = @_; + my ( $self , $id, $ip ) = @_; - my $id = $self->get_max_rrid(); - return -1 if( ! ($ip =~ /^[a-z0-9\.\-]+$/ ) ); - return -1 if( ! ($name =~ /^(?:[a-z0-9\-]*|\*)$/ ) ); - $name = "" if( $name eq "default" ); + return -1 unless($id =~ /^\d+$/ ); + my $rr = $self->{A}{$id}; + return -2 unless(defined $rr); + return -3 unless( Vhffs::Functions::check_ip($ip) ); - my $query = "UPDATE vhffs_dns_rr SET data='".$ip."' WHERE name='".$name."' AND zone='".$self->{'dns_id'}."' AND TYPE='A'"; - my $request2 = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request2->execute or return -2; + my $dbh = $self->get_main()->get_db_object(); + my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND zone = ? AND type = \'A\''; + $dbh->do($sql, undef, $ip, $id, $self->{dns_id}) or return -4; - #Update SOA - $self->commit; - $self->add_history("Update A TYPE $name poiting now on $ip"); + $rr->{data} = $ip; + + $self->add_history('Updated A record '.$rr->{name}." pointing now on $ip"); + + $self->update_serial(); return 1; } sub add_ns { - my $self = shift; - my $ip = shift; - my $ttl = shift; + my ($self, $host, $ttl) = @_; $ttl = 900 if ( ! defined $ttl ); - return -1 if( ! ($ip =~ /^[a-z0-9\-\.]+$/ ) ); + return -1 unless(Vhffs::Functions::check_domain_name($host)); -# return -1 if ( $self->name_exists( $name ) != 0 ); + $host .= '.' unless($host =~ /\.$/ ); - return -1 if( ! defined $ip); - $ip .= "." if(! ($ip =~ /.+\.$/ ) ); + my $sql = 'SELECT * FROM vhffs_dns_rr WHERE type=\'NS\' AND data=? AND zone=?'; + my $dbh = $self->get_main->get_db_object(); + return -2 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0); - my $query; - my $request; - my $rows; + $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, \'\', \'NS\', ?, 0, ?)'; + $dbh->do($sql, undef, $self->{dns_id}, $host, $ttl) or return -3; - $query = "SELECT * FROM vhffs_dns_rr WHERE type='NS' AND data='".$ip."' AND zone='".$self->{'dns_id'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef); - return -1 if( $rows != 0 ); - my $id = $self->get_max_rrid(); + my $ns = {id => $id, + zone => $self->{dns_id}, + name => '', + type => 'NS', + data => $host, + aux => 0, + ttl => $ttl + }; + $self->{NS}{$id} = $ns; - $query = "INSERT INTO vhffs_dns_rr VALUES( '".$id."' , '".$self->{'dns_id'}."', '' , 'NS' , '".$ip."' , '0' , '$ttl' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - #Update SOA - $self->commit; + $self->update_serial; - $self->add_history("Add a NS TYPE with $ip"); - return 1; + $self->add_history("Added a NS record ($host)"); + return $id; } @@ -523,164 +431,172 @@ my ( $self , $name , $ip , $ttl ) = @_; $ttl = 900 if ( ! defined $ttl ); - $name = "" if( $name eq "default" ); - return -1 if ( $self->name_exists( $name ) != 0 ); - return -1 if( ! ($name =~ /^(?:[a-z0-9\-]*|\*)$/ ) ); + return -1 if( ! ($name =~ /^(?:[a-z0-9\-]+|\*)$/ ) ); + $name = '' if( $name eq 'default' ); + return -2 if ( $self->name_exists( $name ) != 0 ); - if( ! defined $ip ) - { - my $config = $self->{'main'}->get_config; - if( defined $config->get_default_a ) - { - $ip = $config->get_default_a; - } - else - { - return -1; - } + if( ! defined $ip ) { + my $config = $self->{'main'}->get_config; + if( defined $config->get_default_a ) { + $ip = $config->get_default_a; + } else { + return -3; + } } - return -1 if( ! ($ip =~ /^[a-z0-9\.\-]+$/ ) ); - - my $id = $self->get_max_rrid(); + return -4 unless( Vhffs::Functions::check_ip($ip) ); - my $query; - my $request; - my $rows; + my $dbh = $self->get_main()->get_db_object(); + my $sql = 'INSERT INTO vhffs_dns_rr (zone, name, type, data, aux, ttl) VALUES(?, ?, \'A\', ?, 0, ?)'; + $dbh->do($sql, undef, $self->{dns_id}, $name, $ip, $ttl) or return -5; + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef); + $name = 'default' if($name eq ''); + my $a = {id => $id, + zone => $self->{dns_id}, + name => $name, + type => 'A', + data => $ip, + aux => 0, + ttl => $ttl + }; + $self->{A}{$id} = $a; - $query = "INSERT INTO vhffs_dns_rr VALUES( '"."$id"."' , '".$self->{'dns_id'}."', '".$name."' , 'A' , '".$ip."' , '0' , '$ttl' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - #Update SOA - $self->commit; + $self->update_serial(); - $self->add_history("Add a A TYPE with name $name poiting on $ip"); - return 1; + $self->add_history("Added a A TYPE with name $name pointing on $ip"); + return $id; } +=pod +=head2 update_mx + $dns->update_mx($rr_id, $host); +Replace address for MX record C<$rr_id>. + +=cut + sub update_mx { -# my ( $self , $name , $ip , $aux , $ttl ) = @_; - my $self = shift; -# my $name = shift; - my $data = shift; - my $aux = shift; + my ($self, $id, $host) = @_; + + return -1 unless($id =~ /^\d+$/); + my $rr = $self->{MX}{$id}; + return -2 unless(defined $rr); + return -3 unless(Vhffs::Functions::check_domain_name($host, 1)); - my $query = "UPDATE vhffs_dns_rr SET data='".$data."' WHERE zone='".$self->{'dns_id'}."' AND aux='".$aux."' AND type='MX'"; - my $request2 = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND zone = ? AND type=\'MX\''; + my $dbh = $self->get_main()->get_db_object(); - $self->add_history("Change the MX for priority $aux : $data"); - #Update SOA - $self->commit; - - $request2->execute or return -2; + $host .= '.' unless($host =~ /\.$/); + + $dbh->do($sql, undef, $host, $id, $self->{dns_id}) or return -4; + + $rr->{data} = $host; + + $self->add_history('Changed the MX for priority '.$rr->{aux}.": $host"); + + $self->update_serial(); } sub add_mx { - my $self = shift; - my $ip = shift; - my $aux = shift; - my $ttl = shift; + my ($self, $host, $aux, $ttl) = @_; $ttl = 900 if ( ! defined $ttl ); $aux = 10 if ( !defined $aux ); + + return -1 unless( Vhffs::Functions::check_domain_name($host, 1) ); + return -2 unless( $aux =~ /^\d+$/ ); - return -1 if( ! ($ip =~ /^[a-z0-9\.\-]+$/ ) ); + $host .= '.' unless($host =~ /\.$/); - my $query; - my $request; - my $rows; + my $sql = 'SELECT id FROM vhffs_dns_rr WHERE type=\'MX\' AND data=? AND zone=?'; + my $dbh = $self->get_main()->get_db_object(); + return -3 if($dbh->do($sql, undef, $host, $self->{dns_id}) != 0); - $ip .= "."; - $query = "SELECT * FROM vhffs_dns_rr WHERE type='MX' AND data='".$ip."' AND zone='".$self->{'dns_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $rows = $request->execute; - return -1 if( $rows != 0 ); + $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, \'\', \'MX\', ?, ?, ?)'; + $dbh->do($sql, undef, $self->{dns_id}, $host, $aux, $ttl) or return -4; + + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef); + my $mx = {id => $id, + zone => $self->{dns_id}, + name => '', + type => 'MX', + data => $host, + aux => $aux, + ttl => $ttl + }; + $self->{MX}->{$id} = $mx; - my $id = $self->get_max_rrid(); - - - $query = "INSERT INTO vhffs_dns_rr VALUES( '"."$id"."' , '".$self->{'dns_id'}."', '' , 'MX' , '".$ip."' , '$aux' , '$ttl' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - - $self->add_history("Add an MX in the domain with priority $aux on $ip"); - #Update SOA - $self->commit; + $self->add_history("Added an MX record, host : $host - priority : $aux"); - $request->execute or return -2; + $self->update_serial(); + return $id; } sub update_cname { - my $self = shift; - my $name = shift; - my $ip = shift; + my ($self, $id, $dest) = @_; - return -1 if( ! ($name =~ /^[a-z0-9\.\-]*$/ ) ); - return -1 if( ! ($ip =~ /^[a-z0-9\.\-]+$/ ) ); + return -1 unless($id =~ /^\d+$/ ); + my $rr = $self->{CNAME}{$id}; + return -2 unless(defined $rr); + return -3 unless(Vhffs::Functions::check_domain_name($dest, 1)); - $ip.="."; - my $query = "UPDATE vhffs_dns_rr SET data='".$ip."' WHERE TYPE='CNAME' AND zone='".$self->{'dns_id'}."' AND name='".$name."'"; - my $request2 = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + $dest .='.' unless($dest =~ /\.$/); + my $dbh = $self->get_main()->get_db_object(); + my $sql = 'UPDATE vhffs_dns_rr SET data = ? WHERE id = ? AND type = \'CNAME\' AND zone = ?'; + $dbh->do($sql, undef, $dest, $id, $self->{dns_id})or return -4; - $self->add_history("Update CNAME $name pointing now on $ip"); - #Update SOA - $self->commit; - - $request2->execute or return -2; + $rr->{data} = $dest; + + $self->add_history('Updated CNAME '.$rr->{data}." pointing now on $dest"); + $self->update_serial(); } sub add_cname { - my $self = shift; - my $name = shift; - my $ip = shift; - my $ttl = shift; - + my ($self, $name, $dest, $ttl) = @_; + $ttl = 900 if ( ! defined $ttl ); + return -1 unless($name =~ /^[a-z0-9\-]+$/ ); + return -2 unless(Vhffs::Functions::check_domain_name($dest, 1)); + $name = '' if( $name eq 'default' ); + return -3 if ( $self->name_exists( $name ) != 0 ); - - $name = "" if( $name eq "default" ); - return -1 if( ! ($name =~ /^[a-z0-9\-]*$/ ) ); - return -1 if( ! ($ip =~ /[a-z0-9\.\-]+/ ) ); - - return -1 if ( $self->name_exists( $name ) != 0 ); - - # Add a '.' the the submitted name. Otherwise, if the user submit tata.toto.com IN CNAME foo.com # MyDNS will understand tata.toto.com IN CNAME foo.com.toto.com - $ip.="."; + $dest .= '.' unless($dest =~ /\.$/); - my $id = $self->get_max_rrid(); + my $dbh = $self->get_main()->get_db_object(); - my $query = "INSERT INTO vhffs_dns_rr VALUES( '"."$id"."' , '".$self->{'dns_id'}."', '".$name."' , 'CNAME' , '".$ip."' , '0' , '$ttl' )"; - my $request2 = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $sql = 'INSERT INTO vhffs_dns_rr(zone, name, type, data, aux, ttl) VALUES(?, ?, \'CNAME\', ?, 0, ?)'; + $dbh->do($sql, undef, $self->{dns_id}, $name, $dest, $ttl) or return -4; + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_dns_rr', undef); - $self->add_history("Add a CNAME $name pointing on $ip"); + $name = 'default' if($name eq ''); + my $cname = {id => $id, + zone => $self->{dns_id}, + name => $name, + type => 'CNAME', + data => $dest, + aux => 0, + ttl => $ttl}; - #Update SOA - $self->commit; - - $request2->execute or return -2; -} + $self->{CNAME}{$id} = $cname; -# Simply activate a domain. This is only an option for MyDNS -sub activate -{ - my $self = shift; - $self->{SOA}->{'active'} = 1; + $self->add_history("Added a CNAME record ($name -> $dest)"); + + $self->update_serial(); + return $id; } - - # Submit changes to the backend sub commit { @@ -696,90 +612,62 @@ return -1 if ( ! defined $self->{'dns_id'} ); #Set some defaults values if not defined - $self->{SOA}->{'origin'} = $self->{'domain'} if( ! defined $self->{SOA}->{'origin'} ); - $self->{SOA}->{'ttl'} = $conf->{default_ttl} if( ! defined $self->{SOA}->{'ttl'} ); - $self->{SOA}->{'ns'} = $conf->{default_ns1} if( ! defined $self->{SOA}->{'ns'} ); - $self->{SOA}->{'mbox'} = $conf->{default_mbox} if( ! defined $self->{SOA}->{'mbox'} ); - $self->{SOA}->{'serial'} = $conf->{default_serial} if( ! defined $self->{SOA}->{'serial'} ); - $self->{SOA}->{'refresh'} = $conf->{default_refresh} if( ! defined $self->{SOA}->{'refresh'} ); - $self->{SOA}->{'retry'} = $conf->{default_retry} if( ! defined $self->{SOA}->{'retry'} ); - $self->{SOA}->{'expire'} = $conf->{default_expire} if( ! defined $self->{SOA}->{'expire'} ); - $self->{SOA}->{'minimum'} = $conf->{default_minimum} if( ! defined $self->{SOA}->{'minimum'} ); - $self->{SOA}->{'active'} = 0 if( ! defined $self->{SOA}->{'active'} ); + $self->{'ttl'} = $conf->{default_ttl} if( ! defined $self->{'ttl'} ); + $self->{'ns'} = $conf->{default_ns1} if( ! defined $self->{'ns'} ); + $self->{'mbox'} = $conf->{default_mbox} if( ! defined $self->{'mbox'} ); + $self->{'serial'} = $conf->{default_serial} if( ! defined $self->{'serial'} ); + $self->{'refresh'} = $conf->{default_refresh} if( ! defined $self->{'refresh'} ); + $self->{'retry'} = $conf->{default_retry} if( ! defined $self->{'retry'} ); + $self->{'expire'} = $conf->{default_expire} if( ! defined $self->{'expire'} ); + $self->{'minimum'} = $conf->{default_minimum} if( ! defined $self->{'minimum'} ); #Convert the mail to the mailbox domain for DNS files - $self->{SOA}->{'mbox'} =~ s/\@/\./; + $self->{'mbox'} =~ s/\@/\./; #Update the serial to refresh the domain - my ($second,$minutes,$hours,$day,$month,$year) = localtime(time); - my $newserial = sprintf('%.4u%.2u%.2u',$year+1900,$month+1,$day); - - if( $self->{SOA}->{serial} =~ /^$newserial/ || $self->{SOA}->{serial} > $newserial.'01' ) - { - $self->{SOA}->{serial}++; - } - else - { - $self->{SOA}->{serial} = $newserial.'01'; - } + $self->{serial} = $self->get_next_serial(); #First, commit the SOA - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_dns_soa WHERE id='" . $self->{'dns_id'} . "'"); - my $rows = $request->execute; - if ( $rows != 0 ) - { - $query = "UPDATE vhffs_dns_soa SET origin='".$self->{SOA}->{'origin'}."', ns='".$self->{SOA}->{'ns'}."', mbox='".$self->{SOA}->{'mbox'}."', serial='".$self->{SOA}->{'serial'}."', refresh='".$self->{SOA}->{'refresh'}."', retry='".$self->{SOA}->{'retry'}."', expire='".$self->{SOA}->{'expire'}."', minimum='".$self->{SOA}->{'minimum'}."', ttl='".$self->{SOA}->{'ttl'}."', active='".$self->{SOA}->{'active'}."' WHERE id=$self->{'dns_id'}"; - } - else - { - $query = "INSERT INTO vhffs_dns_soa VALUES ( '$self->{dns_id}' , '$self->{SOA}->{origin}' , '$self->{SOA}->{ns}' , '$self->{SOA}->{mbox}' , '$self->{SOA}->{serial}' , '$self->{SOA}->{refresh}' , '$self->{SOA}->{retry}' , '$self->{SOA}->{expire}' , '$self->{SOA}->{minimum}' , '$self->{SOA}->{ttl}' , '$self->{SOA}->{active}' )"; - } - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + $query = "UPDATE vhffs_dns SET ns='".$self->{'ns'}."', mbox='".$self->{'mbox'}."', serial='".$self->{'serial'}."', refresh='".$self->{'refresh'}."', retry='".$self->{'retry'}."', expire='".$self->{'expire'}."', minimum='".$self->{'minimum'}."', ttl='".$self->{'ttl'}."' WHERE dns_id=$self->{'dns_id'}"; + my $request = $self->{'db'}->prepare( $query ); $request->execute or return -2; - - if( defined $self->{CNAME} ) - { - foreach (keys %{$self->{CNAME}} ) - { - } - } - - if( defined $self->{A} ) - { - foreach (keys %{$self->{A}} ) - { - } - } - - - if( defined $self->{NS} ) - { - foreach (keys %{$self->{NS}} ) - { - } - } - - - if( defined $self->{MX} ) - { - foreach (keys %{$self->{MX}} ) - { - } - } - - # Commit the object part $self->SUPER::commit; } +sub get_next_serial +{ + my $self = shift; + my ($second,$minutes,$hours,$day,$month,$year) = localtime(time); + my $newserial = sprintf('%.4u%.2u%.2u',$year+1900,$month+1,$day); + if( $self->{serial} =~ /^$newserial/ || $self->{serial} > $newserial.'01' ) { + return ($self->{serial} + 1); + } else { + return $newserial.'01'; + } +} +sub update_serial { + my $self = shift; + my $dbh = $self->get_main()->get_db_object(); + my $sql = 'UPDATE vhffs_dns SET serial = ? WHERE dns_id = ?'; + $self->{serial} = $self->get_next_serial(); + $dbh->do($sql, undef, $self->{serial}, $self->{dns_id}); +} + ######################################## # ACCESSORS ######################################## +sub get_dns_id +{ + my $self = shift; + return $self->{dns_id}; +} + sub get_mx_type { my $self = shift; @@ -807,49 +695,49 @@ sub get_soa_ns { my $self = shift; - return $self->{SOA}->{'ns'}; + return $self->{'ns'}; } sub get_soa_mbox { my $self = shift; - return $self->{SOA}->{'mbox'}; + return $self->{'mbox'}; } sub get_soa_serial { my $self = shift; - return $self->{SOA}->{'serial'}; + return $self->{'serial'}; } sub get_soa_refresh { my $self = shift; - return $self->{SOA}->{'refresh'}; + return $self->{'refresh'}; } sub get_soa_retry { my $self = shift; - return $self->{SOA}->{'retry'}; + return $self->{'retry'}; } sub get_soa_expire { my $self = shift; - return $self->{SOA}->{'expire'}; + return $self->{'expire'}; } sub get_soa_minimum { my $self = shift; - return $self->{SOA}->{'minimum'}; + return $self->{'minimum'}; } sub get_soa_ttl { my $self = shift; - return $self->{SOA}->{'ttl'}; + return $self->{'ttl'}; } @@ -866,7 +754,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'ns'} = $value; + $self->{'ns'} = $value; } sub set_soa_mbox @@ -874,7 +762,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'mbox'} = $value; + $self->{'mbox'} = $value; } sub set_soa_serial @@ -882,7 +770,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'serial'} = $value; + $self->{'serial'} = $value; } sub set_soa_refresh @@ -890,7 +778,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'refresh'} = $value; + $self->{'refresh'} = $value; } sub set_soa_retry @@ -898,7 +786,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'retry'} = $value; + $self->{'retry'} = $value; } @@ -921,7 +809,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'expire'} = $value; + $self->{'expire'} = $value; } sub set_soa_minimum @@ -929,7 +817,7 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'minimum'} = $value; + $self->{'minimum'} = $value; } sub set_soa_ttl @@ -937,16 +825,9 @@ my $self = shift; my $value = shift; - $self->{SOA}->{'ttl'} = $value; + $self->{'ttl'} = $value; } -sub set_soa_active -{ - my $self = shift; - - $self->{SOA}->{'active'} = "Y"; -} - sub set_user { my $self = shift; @@ -972,3 +853,10 @@ 1; +__END__ + +=head1 AUTHORS + +soda < dieu at gunnm dot org > + +Sebastien Le Ray < beuss at tuxfamily dot org> Modified: trunk/vhffs-api/src/Vhffs/Services/Httpd.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Httpd.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Httpd.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -32,140 +32,81 @@ # This file is a part of VHFFS4 -# It is used to manage Web Area in VHFFS hosting platform # Please respect the licence of this file, and the whole VHFFS software. -# Author: soda < dieu at gunnm dot org> +=pod -package Vhffs::Services::Httpd; +=head1 NAME -use base qw(Vhffs::Object); -use strict; -use DBI; +Vhffs::Services::Httpd - Handle Web Area in VHFFS hosting platform. +=head1 SYNOPSIS +TODO -sub new -{ - my $main; - my $servername; - my $this; - my $self; - my $class; - my $user; - my $group; +=head1 METHODS - ( $class , $main , $servername , $user , $group ) = @_; - - $this = {}; +=cut - #return undef if( $user->fetch < 0); - $this = $class->SUPER::new( $main , 1 , '401' ); - - return undef if( ! ($servername =~ /^[a-z0-9](([a-z0-9]\-{0,1})+\.)+[a-z]{2,4}$/ ) ); - return undef if( $servername =~ /\.\./ ); - - $this->{'servername'} = $servername if ( defined $servername ); +package Vhffs::Services::Httpd; - # $this->{'owner_uid'} = $user->{'uid'} if ( defined $user->{'uid'} ); - $this->{'user'} = $user; - $this->{'group'} = $group; +use Vhffs::Functions; +use base qw(Vhffs::Object); +use strict; +use DBI; - bless( $this , $class ); +=pod - return $this; -} +=head2 create -sub delete -{ - my $self = shift; - my $query = "DELETE FROM vhffs_httpd WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -1; - - return -2 if( $self->SUPER::delete < 0 ); + my $httpd = Vhffs::Services::Httpd::create($main, $servername, $description, $user, $group); + die("Unable to create webarea $servername\n") unless(defined $httpd); - return 1; -} +Creates a new webarea in database and returns the corresponding fully functional object. +=cut sub create { - my $self = shift; + my ($main, $servername, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(Vhffs::Functions::check_domain_name($servername)); - return -1 if( $self->{'user'}->fetch < 0 ); - return -1 if( $self->{'group'}->fetch < 0 ); + my $web; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - $self->{'owner_uid'} = $self->{'user'}->get_uid; - $self->{'owner_gid'} = $self->{'group'}->get_gid; + eval { + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_HTTPD); + + die('Unable to create parent object') unless(defined($parent)); + my $sql = 'INSERT INTO vhffs_httpd(servername, crawl, owner_http, owner_rev, owner_uid, owner_gid, trafic, alert_state, alert_limit, object_id) VALUES(?, 1, ?, ?, ?, ?, 0, 0, 0, ?)'; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_httpd WHERE servername='" . $self->{'servername'} . "'"); - my $rows = $request->execute; - return -2 if ( $rows != 0 ); - my $oid = $self->SUPER::create(); - return -3 if ( $oid lt 0 ); + my $sth = $dbh->prepare($sql); + $sth->execute($servername, $user->get_uid, $user->get_uid, $user->get_uid, $group->get_gid, $parent->get_oid); - #Get the mac httpd_id and compute the new httpd_id - my $httpd_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(httpd_id) FROM vhffs_httpd"); - $httpd_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $httpd_id++; + $dbh->commit; + $web = get_by_servername($main, $servername); + }; - - #Finally, create the object - my $query = "INSERT INTO vhffs_httpd VALUES( '".$httpd_id."' , '".$self->{'servername'} . "', '1' , '".$self->{'owner_uid'}."' , '".$self->{'owner_uid'}."' , '".$self->{'owner_uid'}."' , '".$self->{'group'}->get_gid."', '0' , '0' , '0' , $oid )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - - return $httpd_id; + if($@) { + warn "Unable to create webarea $servername: $@\n"; + $dbh->rollback; + } + return $web; } - -#Get all data about this httpd object in the databse -sub fetch +sub commit { my $self = shift; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_httpd where servername='".$self->{'servername'}."'") or return -1; - my $rows = $request->execute() or return -3; + my $sql = 'UPDATE vhffs_httpd SET crawl = ?, trafic = ?, alert_limit = ? WHERE servername = ?'; + $self->{'db'}->do($sql, undef, $self->{crawl}, $self->{trafic}, $self->{alert_limit}, $self->{servername}); - return -1 if( $rows <= 0 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - $self->SUPER::fetch; - - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef , $self->{'owner_uid'} , $self->{'owner_gid'} ); - return -1 if( $self->{'group'}->fetch < 0 ); - - $self->{'user'} = new Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} ); - return -1 if( $self->{'user'}->fetch < 0 ); - - return 1; -} - - - -sub commit -{ - my $self = shift; - - $self->{'crawl'} = 0 if( ! defined $self->{'crawl'} ); - $self->{'trafic'} = 1 if( ! defined $self->{'trafic'} ); - - my $query = "UPDATE vhffs_httpd SET crawl='".$self->{'crawl'}."', trafic= '".$self->{'trafic'}."' WHERE servername='".$self->{'servername'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - - $self->SUPER::commit; } @@ -262,37 +203,75 @@ sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $sql; + my @params; + my $sth; - my $objs; + my $objs = []; my $result; my $tmp; - $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE w.object_id = o.object_id"; - $query .= " AND o.state='".$state."'" if( defined $state ); - $query .= " AND w.servername LIKE '%".$name."%'" if( defined $name ); - $query .= " AND w.owner_gid='".$group->get_gid."'" if( defined $group ); + $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id'; + if(defined $state) { + $sql .= ' AND o.state = ?'; + push(@params, $state); + } + if(defined($name)) { + $sql .= ' AND h.servername LIKE ?'; + push(@params, '%'.$name.'%'); + } + if(defined($group)) { + $sql .= ' AND h.owner_gid = ?'; + push(@params, $group->get_gid); + } + $sql .= " ORDER BY servername"; + $sth = $vhffs->get_db_object->prepare( $sql ); + my $rows = $sth->execute(@params); - - $query .= " ORDER BY servername"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + return undef unless($rows); - return undef if( $rows == 0); + while( $result = $sth->fetchrow_arrayref ) + { + push @{$objs}, _new Vhffs::Services::Httpd($vhffs, @{$result}); + } + return $objs; +} - while( $result = $request->fetchrow_hashref ) +sub getall_by_letter +{ + my ($vhffs, $letter, $state) = @_; + + return getall($vhffs, $state) if ( ! defined $letter ); + + $letter .= '%'; + + my $sql; + my @params; + my $sth; + + my $objs = []; + my $result; + + $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername LIKE ?'; + + push(@params, $letter); + + if(defined $state) { + $sql .= 'AND o.state = ?'; + push(@params, $state); + } + $sql .= 'ORDER BY servername'; + + $sth = $vhffs->get_db_object->prepare( $sql ); + my $rows = $sth->execute(@params); + + return undef unless($rows); + + while( $result = $sth->fetchrow_arrayref ) { - $tmp = new Vhffs::Services::Httpd( $vhffs , $result->{'servername'} ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } + push @{$objs}, _new Vhffs::Services::Httpd($vhffs, @{$result}); } return $objs; } @@ -300,39 +279,34 @@ sub search { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $query; - my $request; + my ($vhffs, $state, $name) = @_; + my $sql; + my $sth; + my @params; + my $objs; my $result; - my $tmp; - if( ( defined $state ) && ( $state < Vhffs::Constants::TO_DELETE ) ) - { - $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE o.state='".$state."' AND w.object_id = o.object_id AND ( o.description LIKE '%$name%' OR w.servername LIKE '%name%' )"; + $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id'; + + if( ( defined $state ) && ( $state < Vhffs::Constants::TO_DELETE ) ) { + $sql .= 'WHERE o.state= ? AND ( o.description LIKE ? OR w.servername LIKE ? )'; + push(@params, $state); + push(@params, '%'.$name.'%'); + push(@params, '%'.$name.'%'); } - else - { - $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE w.object_id = o.object_id"; - } - $query .= " ORDER BY servername"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + + $sql .= " ORDER BY servername"; + $sth = $vhffs->get_db_object()->prepare( $sql ); - return undef if( $rows == 0); + my $rows = $sth->execute(@params); -# $result = $request->fetchall_hashref( 'servername' ); + return undef unless($rows); - while( $result = $request->fetchrow_hashref ) + while( $result = $sth->fetchrow_arrayref ) { - $tmp = new Vhffs::Services::Httpd( $vhffs , $result->{'servername'} ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } + push @{$objs}, _new Vhffs::Services::Httpd($vhffs, @{$result}); } return $objs; } @@ -340,38 +314,87 @@ sub getall_by_group { - my $vhffs = shift; - my $group = shift; + my ($vhffs, $group) = @_; - my $query; - my $request; + my $sql; + my $sth; - my $objs; + my $objs = []; my $result; my $tmp; - - $query = "SELECT w.servername, w.object_id FROM vhffs_httpd w, vhffs_object o WHERE w.object_id = o.object_id AND w.owner_gid='".$group->get_gid."'"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id AND h.owner_gid = ? ORDER BY servername'; - return undef if( $rows == 0); - $result = $request->fetchall_hashref( 'servername' ); + $sth = $vhffs->get_db_object()->prepare( $sql ); - foreach( keys %{$result} ) + my $rows = $sth->execute($group->get_gid()); + + return undef unless($rows); + + while( $result = $sth->fetchrow_arrayref ) { - $tmp = new Vhffs::Services::Httpd( $vhffs , $_ ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } + push @{$objs}, _new Vhffs::Services::Httpd($vhffs, @{$result}); } return $objs; } +=pod +=head2 get_by_servername + my $httpd = Vhffs::Services::Httpd::get_by_servername($main, $servername); + die("Webarea $servername not found\n") unless(defined $httpd); +Fetches the webarea whose address is $servername. + +=cut + +sub get_by_servername { + my ($main, $servername) = @_; + my $sql = 'SELECT h.httpd_id, h.servername, h.crawl, h.owner_http, h.owner_rev, h.owner_uid, h.owner_gid, h.trafic, h.alert_state, h.alert_limit, h.object_id, o.date_creation, o.description, o.state FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE h.servername = ?'; + + my $dbh = $main->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $servername)); + + return _new Vhffs::Services::Httpd($main, @params); +} + +# Return a reference on an array, each fiel is a hash with two fields +# letter and count (count is the number of websites starting with letter). +# 0 site letters aren't stored. +sub get_used_letters { + my $main = shift; + my $state = shift; + $state = Vhffs::Constants::ACTIVATED unless(defined $state); + my $sql = 'SELECT substr(servername, 1, 1) as letter, COUNT(*) as count FROM vhffs_httpd h INNER JOIN vhffs_object o ON o.object_id = h.object_id WHERE state = ? GROUP BY substr(servername, 1, 1) ORDER BY substr(servername, 1, 1)'; + my $dbh = $main->get_db_object; + return $dbh->selectall_arrayref($sql, { Slice => {} }, $state); + +} + +sub _new { + my ($class, $main, $httpd_id, $servername, $crawl, $owner_http, $owner_rev, $owner_uid, $owner_gid, $trafic, $alert_state, $alert_limit, $oid, $date_creation, $description, $state) = @_; + + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_HTTPD); + return undef unless(defined($self)); + + foreach (qw(httpd_id servername crawl owner_http owner_rev owner_gid trafic alert_state alert_limit)) { + no strict 'refs'; + eval '$self->{$_} = $'.$_; + } + return $self; +} + + 1; + +__END__ + +=head1 AUTHORS + +soda < dieu at gunnm dot org > + +Sebastien Le Ray < beuss at tuxfamily dot org > Deleted: trunk/vhffs-api/src/Vhffs/Services/LargeFile.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/LargeFile.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/LargeFile.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -1,564 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - - -# This file is a part of VHFFS4 Hosting Platform -# Please respect the licence of this file and the whole software - -# Author: soda < dieu at gunnm dot org> - -package Vhffs::Services::LargeFile; - -use base qw(Vhffs::Object); -use Vhffs::Group; -use Vhffs::Functions; -use strict; -use DBI; - - - -#Create a new LargeFile object -#needs to get filename, and user/group related-object -sub new -{ - my $main; - my $filename; - my $this; - my $self; - my $class; - my $user; - my $group; - - $class = shift; - $main = shift; - $filename = shift; - $user = shift; - $group = shift; - - $this = {}; - - $this = $class->SUPER::new( $main , 1 , '401' ); - - #We return an undefined value if the user or the SVNROOT are not correct - return undef if( ! defined ( $filename ) ); - return undef if( length( $filename ) < 3 ); - return undef if( ! ( $filename =~ /^[\w\d\-\_\.]+$/ ) ); - return undef if( ( ! defined $group ) || ( $group->fetch < 1 ) ); - - - $this->{'user'} = $user; - $this->{'group'} = $group; - $this->{'filename'} = $filename; - - bless( $this , $class ); - - return $this; -} - - -#Delete largefile entry in database -#Returns negative value if error happen -#Returns positive value if success -sub delete -{ - my $self = shift; - my $query; - my $request; - - return -1 if( $self->fetch < 0 ); - - $query = "DELETE FROM vhffs_largefile WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $request->execute or return -1; - - return -1 if( $self->SUPER::delete < 0 ); - return 1; -} - - - -#Create a largefile entry on the database -#Needs : -# - a valid largefile object -# - a valid size -# - a valid type -sub create -{ - my $self = shift; - my $oid; - my $request; - my $handle; - - #Ok, see if user and group are valid on the database - return -2 if ( $self->{'user'}->fetch < 0 ); - return -3 if ( $self->{'group'}->fetch < 0 ); - - - $self->{'owner_uid'} = $self->{'user'}->get_uid; - - - #Create the main VHFFS object in the database - #The new Largefile object will inherit this object - $oid = $self->SUPER::create(); - if ( $oid lt 0 ) - { - return( -1 ); - } - else - { - $self->{'object_id'} = $oid; - } - - #Finally, create the object - $request = "INSERT INTO vhffs_largefile (filename,size,type,creating_date,owner_uid,owner_gid,object_id) - VALUES( ? , ? , ? , NOW() , ? , ? , ? )"; - $handle = $self->{'db'}->{'DB_WRITE'}->prepare( $request ); - $handle->execute( $self->{'filename'} , $self->{'size'} , $self->{'type'} , $self->{'user'}->get_uid , $self->{'group'}->get_gid , $self->{'object_id'} ) or return( -2 ); - - return 1; -} - - -#Get object informations from database. -#The group MUST be valid to work -#Return positive value if success -#Negative value if fails -sub fetch -{ - my $self = shift; - my ( $query , $handle , $rows , $result , $request); - - $query = "SELECT * FROM vhffs_largefile WHERE filename ='".$self->{'filename'}."' AND owner_gid='".$self->{'group'}->get_gid."'"; - $handle = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - - $rows = $handle->execute() or return -3; - - return -2 if( $rows <= 0 ); - $result = $handle->fetchrow_hashref(); - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef , $self->{'owner_uid'} , $self->{'owner_gid'} ); - return -1 if( $self->{'group'}->fetch < 0 ); - - $self->{'user'} = new Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} ); - return -1 if( $self->{'user'}->fetch < 0 ); - - return -4 if( $self->SUPER::fetch < 0 ); - - return 1; -} - - -#When invoking commit METHOD, MUST USE before fetch() method on object -#Returns - negative value if fails (-2 if the error belongs to parent object) -# - positive value if surccess -sub commit -{ - my $self = shift; - my ( $query , $handle ); - - $self->{'licence'} = "unknown licence" if( ! defined $self->{'licence'} ); - $self->{'password'} = "" if( ! defined $self->{'password'} ); - $self->{'hash'} = "" if( ! defined $self->{'hash'} ); - $self->{'size'} = "unknown type" if( ! defined $self->{'type'} ); - $self->{'username'} = "" if( ! defined $self->{'username'} ); - $self->{'end_date'} = "NULL" if( ! defined $self->{'end_date'} ); - - $query = "UPDATE vhffs_largefile SET - size = ? , - licence = ? , - username = ? , - password = ? , - hash = ? - WHERE file_id= ? "; - - $handle = $self->{'db'}->{'DB_WRITE'}->prepare($query); - $handle->execute( $self->{'size'} , $self->{'licence'} , $self->{'username'} , $self->{'password'} , $self->{'hash'} , $self->{'file_id'} ) or return -1; - - return -2 if( $self->SUPER::commit < 0 ); - - return 1; -} - -sub get_title -{ - my $self = shift; - return( $self->{'filename'} ); -} - -sub get_filename -{ - my $self = shift; - return( $self->{'filename'} ); -} - -sub set_licence -{ - my $self = shift; - my $licence = shift; - $self->{'licence'} = quotemeta( $licence ); - - return 1; -} - -sub get_licence -{ - my $self = shift; - - return( Vhffs::Functions::stripslashes( $self->{'licence'} ) ); -} - -sub set_size -{ - my $self = shift; - my $size = shift; - - return -1 if( ! defined ( $size =~ /^[\d]+$/ ) ); - - $self->{'size'} = $size; - - return 1; -} - -sub get_size -{ - my $self = shift; - return( $self->{'size'} ); -} - -sub set_type -{ - my $self = shift; - my $type = shift; - - return -1 if( ! defined ( $type =~ /^[a-zA-Z0-9\.]*$]/ ) ); - - $self->{'type'} = $type; - return 1; -} - -sub get_type -{ - my $self = shift; - return( $self->{'type'} ); -} - -sub get_creating_date -{ - my $self = shift; - return( $self->{'creating_date'} ); -} - -sub get_end_date -{ - my $self = shift; - return $self->{'end_date'}; -} - -sub set_end_date -{ - my $self = shift; - #####FIXME - return 1; -} - -sub get_username -{ - my $self = shift; - return( $self->{'username'} ); -} - -sub set_username -{ - my $self = shift; - my $username = shift; - - return -1 if( ! ( $username =~ /^[a-zA-Z0-9\-]+$/ ) ); - - $self->{'username'} = $username; - return 1; -} - -sub get_password -{ - my $self = shift; - return( $self->{'password'} ); -} - -sub set_password -{ - use Vhffs::Functions; - my $self = shift; - my $password = shift; - - $self->{'password'} = Vhffs::Functions::password_encrypt( $password ); - return 1; -} - -sub set_hash -{ - my $self = shift; - my $hash = shift; - - return 1 if( ! defined $hash ); - return -2 if( ! defined ( $hash =~ /[a-zA-Z0-9\d\s\-]*/ ) ); - - $self->{'hash'} = $hash; - return 1; -} - -sub get_hash -{ - my $self = shift; - return( $self->{'hash'} ); -} - - -sub get_owneruid -{ - my( $self ) = @_; - return $self->{'owner_uid'}; -} - -sub get_ownergid -{ - my $self = shift; - return $self->{'owner_gid'}; -} - -sub getall -{ - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; - - my $query; - my $request; - - my $objs; - my $result; - my $tmp; - - - $query = "SELECT * FROM vhffs_largefile lf, vhffs_object o WHERE lf.object_id = o.object_id "; - $query.= " AND o.state='".$state."'" if( defined $state); - $query.= " AND lf.owner_gid='".$group->get_gid."'" if( defined $group); - $query.= " AND lf.filename LIKE '%".$name."%'" if( defined $name); - $query .= " ORDER BY lf.filename"; - - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - - my $rows = $request->execute; - - return undef if( $rows == 0); - - while( $result = $request->fetchrow_hashref ) - { - $group = new Vhffs::Group( $vhffs , undef , $result->{'owner_uid'} , $result->{'owner_gid'} ); - - $tmp = new Vhffs::Services::LargeFile( $vhffs , $result->{'filename'} , undef , $group ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } - } - return $objs; -} - - - -sub getall_by_group -{ - my $vhffs = shift; - my $group = shift; - - my $query; - my $request; - - my $objs; - my $result; - my $tmp; - - return undef if( $group->fetch < 1 ); - - $query = "SELECT lf.filename, lf.object_id FROM vhffs_largefile lf, vhffs_object o WHERE lf.object_id = o.object_id AND lf.owner_gid='".$group->get_gid."'"; - - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - return undef if( $rows == 0); - - $result = $request->fetchall_hashref( 'filename' ); - - foreach( keys %{$result} ) - { - $tmp = new Vhffs::Services::LargeFile( $vhffs , $_ , undef , $group); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } - } - return $objs; -} - - - - -sub set_user -{ - my ( $self , $user ) = @_; - $self->{'user'} = $user; -} - -sub set_group -{ - my ( $self , $group ) = @_; - $self->{'group'} = $group; -} - - -1; - -__END__ - -=head1 NAME -Vhffs::LargeFile - Manage hosted files in VHFFS - -=head1 SYNOPSIS - - use Vhffs::Main; - use Vhffs::User; - use Vhffs::Group; - use Vhffs::LargeFile; - - $vhffs = init Vhffs::Main; - my $user = new Vhffs::User( $vhffs , 'myuser' , '401' ); - my $group = new Vhffs::Group( $vhffs , 'mygroup' , '401' ); - my $file = new Vhffs::LargeFile( $vhffs , 'filename' , $user , $group ); - - if( $file->fetch < 0 ) - { - print "This file does not exist for this group or error in parameters"; - exit 1; - } - if( $file->create > 0 ) - { - print "File is now created"; - } - -=head1 DESCRIPTION - -Manage hosted files in VHFFS platform. Methods returns negative -values if error or positive value (most of case 1). -The object contains at least type and filename. After, you can add -licence or size informations. - -The username and password properties are present only if the -administrator want use an FTP server for each files. For example, for -uploading each files, the user need an FTP access and the account is present -in each files description. - -=head1 METHODS - -new( Vhffs::Main , "filename" , Vhffs::User , Vhffs::Group ) - -delete() - -create() - -fetch() - -commit() - -get_title() - -get_filename() - -get_licence() - -set_licence( "mylicence" ) - -set_size( "100" ) - -get_size() - -set_type( "mytype" ) - -get_type( ) - -get_creating_date() - -get_end_date() - -set_end_date( "date" ) - -get_username() - -set_username( "myusername" ) - -get_password() - -set_password( "mypassword" ) - -set_hash() - -get_hash() - -get_owneruid() - -get_ownergid() - -getall( Vhffs::Main , $state( in Vhffs::Constants) , "filename" , Vhffs::Group ) - -getall_by_group( Vhffs::Main , Vhffs::Group ) - -set_user( Vhffs::User ) - -set_group( Vhffs::Group ) - -=head1 SEE ALSO - -Vhffs::Main, Vhffs::Conf - -=head1 AUTHOR - - Julien Delange < dieu at gunnm dot org> - -=head1 COPYRIGHT - (c) Julien Delange - Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -35,50 +35,22 @@ # Author : soda < dieu at gunnm dot org > -package Vhffs::Services::Mail; +=pod -use base qw(Vhffs::Object); -use strict; -use DBI; +=head1 SYNOPSYS +Vhffs::Services::Mail - Handle mail domains in VHFFS. -# Create a new instance of the current class -sub new -{ - my $main; - my $domain; - my $this; - my $self; - my $class; - my $user; - my $group; +=head2 METHODS - ( $class , $main , $domain , $user , $group ) = @_; - - $this = {}; - - #If the domain is not specified by argument, return an undef instance - return undef if ( ! defined $domain ); - - #return undef if( $user->fetch < 0); - $this = $class->SUPER::new( $main , 1 , '401' ); - - return undef if( ! ( $domain =~ /^[a-zA-Z0-9\-\.]+$/) ); - return undef if( length( $domain ) < 5 ); - - $this->{'domain'} = $domain if ( defined $domain ); - - # $this->{'owner_uid'} = $user->{'uid'} if ( defined $user->{'uid'} ); - $this->{'user'} = $user; - $this->{'group'} = $group; +=cut - $this->{'boxes'} = {}; - - bless( $this , $class ); - - return $this; -} +package Vhffs::Services::Mail; +use base qw(Vhffs::Object); +use strict; +use DBI; + sub delete { my $self = shift; @@ -87,15 +59,15 @@ $query = "DELETE FROM vhffs_mxdomain WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $request = $self->{'db'}->prepare($query); $request->execute or return -1; $query = "DELETE FROM vhffs_boxes WHERE domain='".$self->{'domain'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $request = $self->{'db'}->prepare($query); $request->execute or return -1; $query = "DELETE FROM vhffs_forward WHERE domain='".$self->{'domain'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $request = $self->{'db'}->prepare($query); $request->execute or return -1; @@ -107,124 +79,49 @@ return 1; } +=pod +=head2 create -# Create the object in the database -sub create -{ - my $self = shift; + my $mail = Vhffs::Services::Mail::create($main, $domain, $description, $user, $group); - # If user or group^does not exists in the VHFFS database, we return -1, the object is not created - return -1 if( $self->{'user'}->fetch < 0 ); - return -1 if( $self->{'group'}->fetch < 0 ); +Create a new domain mail in database and return corresponding object. - $self->{'owner_uid'} = $self->{'user'}->get_uid(); +=cut - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_mxdomain WHERE domain='" . $self->{'domain'} . "'"); - my $rows = $request->execute; - return -2 if ( $rows != 0 ); +sub create { + my ($main, $domain, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(Vhffs::Functions::check_domain_name($domain)); - my $oid = $self->SUPER::create(); - return -3 if ( $oid lt 0 ); + my $mail; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - #Get the max mx_id and compute the new mx_id - my $mx_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(mxdomain_id) FROM vhffs_mxdomain"); - $mx_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $mx_id++; + eval { + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_MAIL); - my $domainhash = Vhffs::Functions::hash_mxdomain( $self->{'domain'} ); + die('Unable to create parent object') unless(defined $parent); - #Finally, create the object in the database - my $query = "INSERT INTO vhffs_mxdomain VALUES( '".$mx_id."' , '".$self->{'domain'} . "', 'exim' , '".$domainhash."' , '0' , '' , '".$self->{'user'}->get_uid."' , '".$self->{'group'}->get_gid."', '$oid' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $sql = 'INSERT INTO vhffs_mxdomain(domain, unix_user, boxes_path, max_popbox, catchall, owner_uid, owner_gid, object_id) VALUES(?, \'exim\', ?, 0, \'\', ?, ?, ?)'; + my $domain_hash = Vhffs::Functions::hash_mxdomain($domain); + my $sth = $dbh->prepare($sql); + $sth->execute($domain, $domain_hash, $user->get_uid(), $group->get_gid, $parent->get_oid); - return $mx_id; -} + $dbh->commit; + $mail = get_by_mxdomain($main, $domain); + }; - -# Get all data about this mail object in the databse -# Informations about the mail domain is stored in $ref-> -# Inforations about forwards are stored in $ref->{'forward'} -# Informations about mailboxes are stored in $ref->{'boxes'} -sub fetch -{ - my $self = shift; - - my ($request , $result , $name , $request2 , $result2 , $names); - - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_mxdomain where domain='".$self->{'domain'}."'") or return -1; - return -3 if( $request->execute() <= 0 ); - $result = $request->fetchrow_hashref(); - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} + if($@) { + warn "Unable to create mail domain $domain: $@\n"; + $dbh->rollback; } - - #Fetch the object part( SUPER class) - return -2 if ($self->SUPER::fetch < 0 ); - - ########################### - #Get all Boxes - ########################### - #So, we will have : - # - $ref->{'boxes'}{$local_part}{'domain'} - # - $ref->{'boxes'}{$local_part}{'local_part'} - # - $ref->{'boxes'}{$local_part}{'domain_hash'} - # - $ref->{'boxes'}{$local_part}{'password_hash'} - # - $ref->{'boxes'}{$local_part}{'mbox_name'} - # - $ref->{'boxes'}{$local_part}{'password'} - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_boxes where domain='".$self->{'domain'}."'") or return -1; - $request->execute() or return -3; - $result = $request->fetchall_hashref('local_part'); - $self->{'boxes'} = {}; - foreach $name ( keys %{$result} ) - { - foreach( keys %{$result->{$name}} ) - { - $self->{'boxes'}{$name}{$_} = $result->{$name}{$_}; - } - $self->{'boxes'}{$name}{'password'} = $self->{'boxes'}{$name}{'password_hash'}; - $self->{'boxes'}{$name}{'changed'} = 0; - $self->{'boxes'}{$name}{'nospam'} = 1 if( $self->{'boxes'}{$name}{'nospam'} eq 't' ); - $self->{'boxes'}{$name}{'novirus'} = 1 if( $self->{'boxes'}{$name}{'novirus'} eq 't' ); - - } - ######### End of boxes fetching ######## - - - - - ###################### - #Get All forwarders - ###################### - #So, we will have : - # - $ref->{'forward'}{$local_part}{'domain'} - # - $ref->{'forward'}{$local_part}{'local_part'} - # - $ref->{'forward'}{$local_part}{'remote_name'} - # - $ref->{'forward'}{$local_part}{'password'} - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_forward where domain='".$self->{'domain'}."'") or return -1; - $request->execute() or return -3; - $result = $request->fetchall_hashref('local_part'); - - $self->{'forward'} = {}; - foreach $name ( keys %{$result} ) - { - foreach( keys %{$result->{$name}} ) - { - $self->{'forward'}{$name}{$_} = $result->{$name}{$_}; - } - $self->{'forward'}{$name}{'changed'} = 0; - } - ######### End of forward fetching ###### - - return 1; + return $mail; } - # Commit all changes of the current instance in the database sub commit { @@ -237,71 +134,9 @@ $self->{'catchall'} = "" if( ! defined $self->{'catchall'} ); $query = "UPDATE vhffs_mxdomain SET catchall='".$self->{'catchall'}."' WHERE domain='".$self->{'domain'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + $request = $self->{'db'}->prepare( $query ); $request->execute; - #COMMIT THE BOX PART - foreach $name ( keys %{$self->{'boxes'}} ) - { - next if( ( defined $self->{'boxes'}{$name}{'changed'} ) && ( $self->{'boxes'}{$name}{'changed'} == 0 ) ); - - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_boxes WHERE domain='" . $self->{'domain'} . "' AND local_part='".$name."'"); - $rows = $request->execute; - - #If boxes does not have nospam or novirus attribute - #so, we set t to 0 - # This will create the attribute and initialize it - $self->{'boxes'}{$name}{'novirus'} = 0 if( ! defined( $self->{'boxes'}{$name}{'novirus'} )); - $self->{'boxes'}{$name}{'nospam'} = 0 if( ! defined( $self->{'boxes'}{$name}{'nospam'} )); - - if( $rows == 0 ) #PopBox NOT created, we must create it - { - my $domainhash = Vhffs::Functions::hash_mxdomain( $self->{'domain'} ); - my $userhash = Vhffs::Functions::hash_popuser( $name ); - my $passwordhash = ""; - - $query = "INSERT INTO vhffs_boxes(domain,local_part,domain_hash,password_hash,mbox_name,password,nospam,novirus) VALUES('". $self->{'domain'} ."' , '". $name ."' , '". $domainhash ."' , '".$self->{'boxes'}{$name}{'password'}."' , '".$userhash."' , '' ,'".$self->{'boxes'}{$name}{'nospam'}."' , '".$self->{'boxes'}{$name}{'novirus'}."')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - } - else #Popbox already created - { - - $query = "UPDATE vhffs_boxes SET nospam='".$self->{'boxes'}{$name}{'nospam'}."', novirus='".$self->{'boxes'}{$name}{'novirus'}."', password_hash='".$self->{'boxes'}{$name}{'password'}."' WHERE local_part='".$self->{'boxes'}{$name}{'local_part'}."' AND domain='".$self->{'domain'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - } - } - - - #COMMIT THE FORWARD PART - foreach $name ( keys %{$self->{'forward'}} ) - { - next if( ( defined $self->{'forward'}{$name}{'changed'} ) && ( $self->{'forward'}{$name}{'changed'} == 0 ) ); -# next if( ! defined $self->{'forward'}{$name}{'remote'} ); - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_forward WHERE domain='" . $self->{'domain'} . "' AND local_part='".$name."'"); - $rows = $request->execute; - - if( $rows == 0 ) #PopBox NOT created, we must create it - { - $password = ""; -# $query = "INSERT INTO vhffs_forward VALUES('". $self->{'domain'} ."' , '". $name ."' , '". $self->{'forward'}{$name}{'remote_name'} ."' , '".$self->{'forward'}{$name}{'password'}."')"; - $query = "INSERT INTO vhffs_forward VALUES('". $self->{'domain'} ."' , '". $name ."' , '". $self->{'forward'}{$name}{'remote_name'} ."' , '4pr1lsUx')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - } - else #Popbox already created - { - $query = "UPDATE vhffs_forward SET remote_name='".$self->{'forward'}{$name}{'remote_name'}."' WHERE local_part='".$self->{'forward'}{$name}{'local_part'}."' AND domain='".$self->{'domain'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - } - } - - - - - return -3 if( $self->SUPER::commit < 0 ); return 1; @@ -313,9 +148,14 @@ my $local_part = shift; my $destination = shift; + return -1 unless( defined($self->{foward}{$local_part}) && defined($local_part) && defined($destination) && Vhffs::Functions::valid_mail( $destination ) ); + my $sql = 'UPDATE vhffs_forward SET remote_name = ? WHERE local_part = ? AND domain = ?'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($destination, $local_part, $self->{domain}) or return -1; + $self->{'forward'}{$local_part}{'remote_name'} = $destination; - $self->{'forward'}{$local_part}{'changed'} = 1; return 1; } @@ -326,12 +166,17 @@ my $local_part = shift; my $password = shift; - return -1 if( ! defined $self->{'boxes'}{$local_part} ); - return -1 if( ! ( $password =~ /^[a-zA-Z0-9\_\-]+$/ ) ); + return -1 unless( defined( $self->{'boxes'}{$local_part} ) && ( $password =~ /^[a-zA-Z0-9\_\-]+$/ ) ); - $self->{'boxes'}{$local_part}{'password'} = crypt_pwd( $password ); - $self->{'boxes'}{$local_part}{'changed'} = 1; + $password = crypt_pwd( $password ); + $self->{'boxes'}{$local_part}{'password'} = $password; + + my $sql = 'UPDATE vhffs_boxes SET password = ? WHERE local_part = ? AND domain = ?'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($password, $local_part, $self->{domain}) or return -1; + return 1; } @@ -345,13 +190,19 @@ return -1 if( ! defined $self->{'boxes'}{$local_part} ); - if( ! defined( $self->{'boxes'}{$local_part}{'nospam'} ) ) - { - $self->{'boxes'}{$local_part}{'nospam'} = 0; - } + my $nospam = $self->{boxes}{$local_part}{nospam}; + if( defined( $nospam ) ) { + $nospam = ( $nospam + 1 ) % 2; + } else { + $nospam = 1; + } + $self->{boxes}{$local_part}{nospam} = $nospam; - $self->{'boxes'}{$local_part}{'nospam'} = ( ( $self->{'boxes'}{$local_part}{'nospam'} + 1 ) % 2 ); - $self->{'boxes'}{$local_part}{'changed'} = 1; + my $sql = 'UPDATE vhffs_boxes SET nospam = ? WHERE domain = ? AND local_part = ?'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($nospam, $self->{domain}, $local_part) or return -1; + return 1; } @@ -364,54 +215,91 @@ return -1 if( ! defined $self->{'boxes'}{$local_part} ); - if( ! defined( $self->{'boxes'}{$local_part}{'novirus'} ) ) - { - $self->{'boxes'}{$local_part}{'novirus'} = 0; - } + my $novirus = $self->{boxes}{$local_part}{novirus}; + if(defined $novirus) { + $novirus = ($novirus + 1) % 2; + } else { + $novirus = 1; + } - $self->{'boxes'}{$local_part}{'novirus'} = ( ( $self->{'boxes'}{$local_part}{'novirus'} + 1 ) % 2 ); - $self->{'boxes'}{$local_part}{'changed'} = 1; + $self->{'boxes'}{$local_part}{'novirus'} = $novirus; + + my $sql = 'UPDATE vhffs_boxes SET novirus = ? WHERE domain = ? AND local_part = ?'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($novirus, $self->{domain}, $local_part) or return -1; + return 1; } +=pod +=head2 addforward + die("Unable to add forward $local_part\n") unless($mail->addforward($local_part, $remote_address) > 0); + +Add a forward from $local_part@$mail->get_domain to $remote_address. + +=cut + sub addforward { my $self = shift; my $name = shift; my $remote = shift; - return -1 if( ( ! defined $name ) || ( ! defined $remote ) ); - return -1 if( ! ( $name =~ /^[a-z0-9\_\-\.]+$/ ) ); - return -1 if( Vhffs::Functions::valid_mail( $remote ) != 1 ); - + return -1 unless(defined($name) && defined($remote) && $name =~ /^[a-z0-9\_\-\.]+$/ && Vhffs::Functions::valid_mail( $remote ) ); return -2 if( ( defined ( $self->{'forward'}{$name} ) ) || ( defined( $self->{'boxes'}{$name} ) ) ); + my $sql = 'INSERT INTO vhffs_forward(domain, local_part, remote_name, password) VALUES(?, ?, ?, \'4pr1lsUx\')'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($self->{domain}, $name, $remote) or return -1; + $self->{'forward'}{$name}{'local_part'} = $name; $self->{'forward'}{$name}{'domain'} = $self->{'domain'}; $self->{'forward'}{$name}{'remote_name'} = $remote; - #self->{'forward'}{$name}{'changed'} = 1; + $self->{forward}{$name}{password} = '4pr1lsUx'; return 1; } +=pod +=head2 addbox + + die("Unable to create box\n") unless($mail->addbox($local_part, $password)); + +Add a new mailbox to the mail domain. + +=cut + sub addbox { my $self = shift; my $name = shift; my $password = shift; - return -1 if( ( ! defined $password ) || ( ! defined $name ) ); - return -1 if( ! ( $name =~ /^[a-z0-9\_\-]+$/ ) ); - return -1 if( ! ( $password =~ /^[a-zA-Z0-9\_\-]+$/ ) ); - return -2 if( ( defined ( $self->{'boxes'}{$name} ) ) || ( defined( $self->{'forward'}{$name} ) ) ); + return -1 unless(defined($password) && defined($name) && $name =~ /^[a-z0-9\_\-]+$/ && $password =~ /^[a-zA-Z0-9\_\-]+$/); + return -2 if( ( defined ( $self->{'boxes'}{$name} ) ) || ( defined( $self->{'forward'}{$name} ) ) ); + $password = crypt_pwd( $password ); + my $domainhash = Vhffs::Functions::hash_mxdomain($self->{domain}); + my $userhash = Vhffs::Functions::hash_popuser( $name ); $self->{'boxes'}{$name}{'local_part'} = $name; - $self->{'boxes'}{$name}{'password'} = crypt_pwd( $password ); + $self->{'boxes'}{$name}{'password'} = $password; $self->{'boxes'}{$name}{'domain'} = $self->{'domain'}; + $self->{boxes}{$name}{domain_hash} = $domainhash; + $self->{boxes}{$name}{password_hash} = $password; + $self->{boxes}{$name}{novirus} = 0; + $self->{boxes}{$name}{nospam} = 0; + $self->{boxes}{$name}{mbox_name} = $userhash; + my $sql = 'INSERT INTO vhffs_boxes(domain, local_part, domain_hash, password_hash, mbox_name, password, nospam, novirus) VALUES(?, ?, ?, ?, ?, \'\', FALSE, FALSE)'; + my $dbh = $self->{db}; + my $sth = $dbh->prepare($sql); + $sth->execute($self->{domain}, $name, $domainhash, $password, $userhash) or return -3; + return 1; } @@ -420,13 +308,12 @@ my $self = shift; my $name = shift; - return -1 if( ! defined $name ); - return -1 if( ! ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); + return -1 unless( defined $name && ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); undef $self->{boxes}{$name}; my $query = "DELETE FROM vhffs_boxes WHERE local_part='".$name."' AND domain='".$self->{'domain'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $request = $self->{'db'}->prepare( $query ); $request->execute; } @@ -437,13 +324,11 @@ my $self = shift; my $name = shift; - return -1 if( ! defined $name ); - + return -1 unless( defined $name && ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); undef $self->{forward}{$name}; - return -1 if( ! ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); my $query = "DELETE FROM vhffs_forward WHERE local_part='".$name."' AND domain='".$self->{'domain'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $request = $self->{'db'}->prepare( $query ); $request->execute; } @@ -470,7 +355,7 @@ my $self = shift; my $name = shift; return -1 if( ! ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_forward where domain='".$self->{'domain'}."' AND local_part='".$name."'") or return -1; + my $request = $self->{'db'}->prepare("SELECT * FROM vhffs_forward where domain='".$self->{'domain'}."' AND local_part='".$name."'") or return -1; return 1 if( $request->execute() > 0 ); return 0; } @@ -480,16 +365,13 @@ my $self = shift; my $name = shift; return -1 if( ! ( $name =~ /^[a-zA-Z0-9\_\-]+$/ ) ); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_boxes where domain='".$self->{'domain'}."' AND local_part='".$name."'") or return -1; + my $request = $self->{'db'}->prepare("SELECT * FROM vhffs_boxes where domain='".$self->{'domain'}."' AND local_part='".$name."'") or return -1; return 1 if( $request->execute() > 0 ); return 0; } +#Following function is needed by courier to fetch accounts - - -#Following functions is needed by courier to fetch accounts - sub crypt_pwd { my $clear = shift; @@ -571,8 +453,8 @@ sub get_unixuser { - my( $self , $value ) = @_; - $self->{'unix_user'} = $value; + my $self = shift; + return $self->{'unix_user'}; } sub set_catchall @@ -612,33 +494,92 @@ } +=pod + +=head2 get_by_mxdomain + + my $mail = Vhffs::Services::get_by_mxdomain($main, $domain); + die("Mail domain $domain not found\n") unless(defined $mail); + +Fetches the mail services whose domainname is $domain. + +=cut + +sub get_by_mxdomain { + my ($main, $domain) = @_; + + my $sql = 'SELECT m.mxdomain_id, m.owner_gid, m.domain, m.unix_user, m.boxes_path, m.max_popbox, m.catchall, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mxdomain m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE domain = ?'; + my $dbh = $main->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $domain)); + + # We now need the boxes and forwards + $sql = 'SELECT domain, local_part, domain_hash, password_hash, mbox_name, password_hash AS password, nospam, novirus FROM vhffs_boxes WHERE domain = ?'; + my $sth = $dbh->prepare($sql); + $sth->execute($domain); + my $boxes = $sth->fetchall_hashref('local_part'); + + $sql = 'SELECT domain, local_part, remote_name, password FROM vhffs_forward WHERE domain = ?'; + $sth = $dbh->prepare($sql); + $sth->execute($domain); + my $forwards = $sth->fetchall_hashref('local_part'); + + + return _new Vhffs::Services::Mail($main, @params, $boxes, $forwards); + +} + +sub _new { + my ($class, $main, $mxdomain_id, $owner_gid, $domain, $unix_user, $boxes_path, $max_popbox, $catchall, $oid, $owner_uid, $date_creation, $state, $description, $boxes, $forwards) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_MAIL); + return undef unless defined($self); + + $self->{mxdomain_id} = $mxdomain_id; + $self->{owner_gid} = $owner_gid; + $self->{domain} = $domain; + $self->{unix_user} = $unix_user; + $self->{boxes_path} = $boxes_path; + $self->{max_popbox} = $max_popbox; + $self->{catchall} = $catchall; + $self->{boxes} = $boxes; + $self->{forward} = $forwards; + + return $self; +} + sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; + my $sql; my $request; + my @params; - my $objs; + my $objs = []; my $result; my $tmp; - $query = "SELECT m.domain FROM vhffs_mxdomain m, vhffs_object o WHERE m.object_id = o.object_id"; - $query .= " AND o.state='".$state."'" if( defined $state ); - $query .= " AND m.domain LIKE '%".$name."%'" if( defined $name ); - $query .= " AND m.owner_gid='".$group->get_gid."'" if( defined $group ); - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + $sql = 'SELECT m.domain FROM vhffs_mxdomain m, vhffs_object o WHERE m.object_id = o.object_id'; + if(defined $state) { + $sql .= ' AND o.state=?'; + push(@params, $state); + } + if(defined $name) { + $sql .= ' AND m.domain LIKE ?'; + push(@params, '%'.$name.'%'); + } + if(defined $group) { + $sql .= ' AND m.owner_gid= ?'; + push(@params, $group->get_gid); + } + $request = $vhffs->{'db'}->prepare( $sql ); + my $rows = $request->execute(@params); - return undef if( $rows <= 0); + return undef if( !$rows ); while( $result = $request->fetchrow_hashref() ) { - $tmp = new Vhffs::Services::Mail( $vhffs , $result->{'domain'} ); - push( @{$objs} , $tmp ) if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) + push( @$objs, Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $result->{domain} ) ); } return $objs; } Modified: trunk/vhffs-api/src/Vhffs/Services/MailUser.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/MailUser.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/MailUser.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -54,7 +54,6 @@ package Vhffs::Services::MailUser; -use base qw(Vhffs::Object); use strict; use DBI; use Vhffs::User; @@ -69,60 +68,28 @@ my $this = {}; - # Instance it as a main object to have links with the database - $this = $class->SUPER::new( $vhffs , 1 , '401' ); + my $config = $vhffs->get_config->get_service('mailuser'); + return -1 unless( defined $config && (defined $config->{activate} && $config->{activate} eq 'yes' ) ); + $this->{main} = $vhffs; + $this->{config} = $config; - my $config = $vhffs->get_config->get_service( "mailuser"); - return -1 if( ! defined $config ); - return -1 if( ( ! defined $config->{activate} ) || ( $config->{activate} ne "yes" ) ); + return -1 unless( defined $user ); + $this->{part} = $user->get_username; - if( $user->fetch < 0 ) - { - return -1; - } - else - { - $this->{part} = $user->get_username; - } + return -2 unless( defined $config->{domain} ); + $this->{domain} = $config->{domain}; - if( defined $config->{domain} ) - { - $this->{domain} = $config->{domain}; - } - else - { - return -2; - } + # Fetches the owner of the mail domain + return -3 unless( defined $config->{user} ); + my $wuser = Vhffs::User::get_by_username( $vhffs , $config->{user} ); + return -4 unless( defined $wuser ); + $this->{wuser} = $wuser; - if( defined $config->{user} ) - { - my $wuser = new Vhffs::User( $vhffs , $config->{user} , '401' ); - if( $wuser->fetch ) - { - $this->{wuser} = $wuser; - } - else - { - return -4; - } - } - else - { - return -3; - } + # Fetches the mail domain defined in config + my $mail_service = Vhffs::Services::Mail::get_by_mxdomain($vhffs, $this->{domain}); + return -5 unless(defined $mail_service); + $this->{mail_service} = $mail_service; - my $object = new Vhffs::Services::Mail( $vhffs, $this->{domain} , $this->{wuser} , undef ); - - if( $object->fetch < 0 ) - { - return -5; - } - else - { - $this->{object} = $object; - } - - bless( $this , $class ); return $this; @@ -131,57 +98,54 @@ sub available { my $self = shift; - my $config = $self->{main}->get_config->get_service( "mailuser"); - my $user = new Vhffs::User( $self->{main} , $self->{part} , '401' ); - return 0 if( $user->fetch < 0 ); - return 1 if( ( ! defined $config->{groupneeded} ) || ( $config->{groupneeded} ne "yes" ) || ( $user->have_activegroups > 0 ) ); + my $user = Vhffs::User::get_by_username( $self->{main} , $self->{part} ); + return 0 unless( defined $user ); + return 1 if( ( ! defined $self->{config}->{groupneeded} ) || ( $self->{config}->{groupneeded} ne "yes" ) || ( $user->have_activegroups > 0 ) ); return 0; } sub exists { my $self = shift; - return $self->{object}->exists( $self->{part} ); + return $self->{mail_service}->exists( $self->{part} ); } sub exists_forward { my $self = shift; - return $self->{object}->exists_forward( $self->{part} ); + return $self->{mail_service}->exists_forward( $self->{part} ); } sub exists_box { my $self = shift; - return $self->{object}->exists_box( $self->{part} ); + return $self->{mail_service}->exists_box( $self->{part} ); } sub use_nospam { my $self = shift; - return $self->{object}->use_nospam( $self->{part} ); + return $self->{mail_service}->use_nospam( $self->{part} ); } sub use_novirus { my $self = shift; - return $self->{object}->use_novirus( $self->{part} ); + return $self->{mail_service}->use_novirus( $self->{part} ); } sub change_spam_status { my $self = shift; - $self->{object}->change_spam_status( $self->{part} ); - return -2 if( $self->{object}->commit < 0 ); + $self->{mail_service}->change_spam_status( $self->{part} ); return 1; } sub change_virus_status { my $self = shift; - $self->{object}->change_virus_status( $self->{part} ); - return -2 if( $self->{object}->commit < 0 ); + $self->{mail_service}->change_virus_status( $self->{part} ); return 1; } @@ -193,24 +157,22 @@ if( $self->exists_box == 1 ) { - $self->{object}->delbox( $self->{part} ); - $self->{object}->fetch; + $self->{mail_service}->delbox( $self->{part} ); } - return -1 if ( $self->{object}->addforward( $self->{part} , $remote ) < 0); - return -2 if( $self->{object}->commit < 0 ); + return -1 if ( $self->{mail_service}->addforward( $self->{part} , $remote ) < 0); } sub delforward { my $self = shift; - $self->{object}->delforward( $self->{part} ); + $self->{mail_service}->delforward( $self->{part} ); } sub delbox { my $self = shift; - $self->{object}->delbox( $self->{part} ); + $self->{mail_service}->delbox( $self->{part} ); } sub addbox @@ -221,12 +183,10 @@ if( $self->exists_forward == 1 ) { - $self->{object}->delforward( $self->{part} ); - $self->{object}->fetch; + $self->{mail_service}->delforward( $self->{part} ); } - return -1 if( $self->{object}->addbox( $self->{part} , $password ) < 0); - return -2 if( $self->{object}->commit < 0 ); + return -1 if( $self->{mail_service}->addbox( $self->{part} , $password ) < 0); } Modified: trunk/vhffs-api/src/Vhffs/Services/Mailing.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Mailing.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Mailing.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -33,188 +33,136 @@ # This file is a part of VHFFS4 software, a hosting platform suite # Please respect the licence of this file and whole program -# Author : soda < god at gunnm dot org > +=pod -package Vhffs::Services::Mailing; +=head1 NAME -use base qw(Vhffs::Object); -use strict; -use DBI; +Vhffs::Services::Mailing - Handle mailing lists in VHFFS. +=head1 SYNOPSIS -# Create a new instance of the current class -sub new -{ - my $main; - my $domain; - my $this; - my $self; - my $class; - my $user; - my $group; - my $local; +TODO - #( $class , $main , $domain , $user , $group ) = @_; - - $class = shift; - $main = shift; - $local = shift; - $domain = shift; - $user = shift; - $group = shift; +=head1 METHODS - $this = {}; +=cut - #If the domain is not specified by argument, return an undef instance - return undef if ( ! defined $domain ); - return undef if ( ! defined $local ); +package Vhffs::Services::Mailing; - #return undef if( $user->fetch < 0); - $this = $class->SUPER::new( $main , 1 , '401' ); - +use base qw(Vhffs::Object); +use strict; +use DBI; - return undef if( ! ( $local =~ /^[a-zA-Z0-9\-\.]+$/ ) ); - return undef if( ! ( $domain =~ /^[a-zA-Z0-9\-\.]+$/ ) ); - $this->{'domain'} = $domain if ( defined $domain ); - $this->{'local_part'} = $local if ( defined $local ); +=pod +=head2 create - $this->{'user'} = $user if( defined $user ); - $this->{'group'} = $group if( defined $group); + my $ml = Vhffs::Services::Mailing::create($local, $domain, $admin, $description, $user, $group); + die('Unable to create list') unless defined $ml; - bless( $this , $class ); +Creates a new mailing list in database and returns the corresponding fully functional object. - return $this; -} - - -# Create the object in the database +=cut sub create { - my $self = shift; - my $query; - my $request; - my $rows; + my ($main, $local, $domain, $admin, $description, $user, $group) = @_; + + return undef unless(defined $user && defined $group); + return undef unless($local =~ /^[a-z0-9\_\-]+$/); + return undef unless(Vhffs::Functions::check_domain_name($domain)); + $admin = $user->get_mail() unless(defined $admin); - $self->{'admin'} = "nobody\@nobody.com" if( ! defined $self->{admin} ); + my $ml; - return -1 if( ! defined $self->{'user'} ); - return -1 if( ! defined $self->{'group'} ); + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - # If user or group^does not exists in the VHFFS database, we return -1, the object is not created - return -1 if( $self->{'user'}->fetch < 0 ); - return -1 if( $self->{'group'}->fetch < 0 ); + eval { + my $sql = 'SELECT mxdomain_id FROM vhffs_mxdomain WHERE domain = ? AND owner_gid = ?'; + die('Mail domain not found') unless($domain eq $main->get_config()->get_service("mailing")->{'default_domain'} || + $dbh->do($sql, undef, $domain, $group->get_gid) > 0); - $query = "SELECT * FROM vhffs_ml where domain='".$self->{'domain'}."' AND local_part='".$self->{'local_part'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - $rows = $request->execute() or return -3; - return -1 if( $rows >= 1 ); - - $self->{'owner_uid'} = $self->{'user'}->get_uid; - $self->{'owner_gid'} = $self->{'group'}->get_gid; - - if( $self->{'domain'} ne $self->{'main'}->get_config->get_service("mailing")->{'default_domain'} ) - { - $query = "SELECT * FROM vhffs_mxdomain WHERE domain='".$self->{domain}."' AND owner_gid='".$self->{'group'}->get_gid."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - $rows = $request->execute; - return -4 if ( $rows != 1 ); - } + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_ML); + die('Unable to create parent object') unless(defined $parent); - my $oid = $self->SUPER::create(); - return -3 if ( $oid lt 0 ); + # open sub, post members only + $sql = 'INSERT INTO vhffs_ml(local_part, domain, prefix, owner_uid, owner_gid, object_id, admin, open_archive, reply_to, sub_ctrl, post_ctrl) VALUES(?, ?, ?, ?, ?, ?, ?, FALSE, TRUE, ?, ? )'; + my $sth = $dbh->prepare($sql); + $sth->execute($local, $domain, $local, $user->get_uid, $group->get_gid, $parent->get_oid, $admin, Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED, Vhffs::Constants::ML_POSTING_MEMBERS_ONLY); + $dbh->commit; + $ml = get_by_mladdress($main, $local, $domain); + }; - #Get the max mx_id and compute the new mx_id - my $ml_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(ml_id) FROM vhffs_ml"); - $ml_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $ml_id++; - - #Finally, create the object in the database - $query = "INSERT INTO vhffs_ml VALUES( '".$ml_id."' , '".$self->{'local_part'} . "', '".$self->{'domain'}."' , '".$self->{'local_part'} . "' , '".$self->{'user'}->get_uid."' , '".$self->{'group'}->get_gid."', '$oid' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + if($@) { + warn "Unable to create mailing list $local\@$domain: $@\n"; + $dbh->rollback; + } + return $ml; - $query = "INSERT INTO vhffs_ml_prefs VALUES( '".$ml_id."' , '".$self->{'admin'} . "' , '0' , '0' , '1' , '1' , '0' , '' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - - return $ml_id; } +=pod -# Get all data about this mail object in the databse -# Informations about the mail domain is stored in $ref-> -# Inforations about forwards are stored in $ref->{'forward'} -# Informations about mailboxes are stored in $ref->{'boxes'} -sub fetch -{ - my $self = shift; +=head2 get_by_mladdress - my ($request , $result , $request2 , $result2 , $query ); - my $rows; - $query = "SELECT * FROM vhffs_ml where domain='".$self->{'domain'}."' AND local_part='".$self->{'local_part'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - $rows = $request->execute() or return -3; - return -1 if( $rows == 0 ); - $result = $request->fetchrow_hashref(); + my $ml = Vhffs::Services::Mailing::get_by_mladdress($main, $local_part, $domain); + die("Mailing list $localpart\@$domain not found\n") unless(defined $ml); - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } +Fetches the mailing list $local_part@$domain. - #Fetch the object part( SUPER class) - return -2 if ($self->SUPER::fetch < 0 ); +=cut +sub get_by_mladdress { + my ($main, $local, $domain) = @_; + + my $dbh = $main->get_db_object(); + my $sql = 'SELECT ml.ml_id, ml.local_part, ml.domain, ml.prefix, ml.owner_gid, ml.admin, ml.open_archive, ml.reply_to, ml.sub_ctrl, ml.post_ctrl, ml.signature, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_ml ml INNER JOIN vhffs_object o ON o.object_id = ml.object_id WHERE domain = ? and local_part = ?'; + my $sth = $dbh->prepare($sql); + return undef unless ($sth->execute($domain, $local) > 0); + my @params = $sth->fetchrow_array; - $query = "SELECT * FROM vhffs_ml_prefs where ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - $request->execute() or return -3; - $result = $request->fetchrow_hashref(); + $sql = 'SELECT sub_id, member, perm, hash, ml_id, language FROM vhffs_ml_subscribers WHERE ml_id = ?'; + $sth = $dbh->prepare($sql); + $sth->execute($params[0]); + my $subs = $sth->fetchall_hashref('member'); + push @params, $subs; + return _new Vhffs::Services::Mailing($main, @params); +} - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } +sub _new { + my ($class, $main, $ml_id, $local_part, $domain, $prefix, $owner_gid, $admin, $open_archive, $reply_to, $sub_ctrl, $post_ctrl, $signature, $oid, $owner_uid, $date_creation, $state, $description, $subs) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_ML); + return undef unless defined($self); - $query = "SELECT * FROM vhffs_ml_subscribers where ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - $request->execute() or return -3; - $result = $request->fetchall_hashref('member'); - my $v; - foreach ( keys %{$result} ) - { - foreach $v ( keys %{$result->{$_}} ) - { - $self->{subs}{$_}{$v} = $result->{$_}{$v}; - } - } + $self->{ml_id} = $ml_id; + $self->{local_part} = $local_part; + $self->{domain} = $domain, + $self->{prefix} = $prefix; + $self->{owner_gid} = $owner_gid; + $self->{admin} = $admin; + $self->{open_archive} = $open_archive; + $self->{reply_to} = $reply_to; + $self->{sub_ctrl} = $sub_ctrl; + $self->{post_ctrl} = $post_ctrl; + $self->{signature} = $signature; + $self->{subs} = $subs; - return 1; + return $self; } - # Commit all changes of the current instance in the database sub commit { my $self = shift; - my( $request , $result , $rows , $query , $name , $password); + my $sql = 'UPDATE vhffs_ml SET prefix = ?, admin = ?, open_archive = ?, reply_to = ?, sub_ctrl = ?, post_ctrl = ?, signature = ? WHERE ml_id = ?'; + my $dbh = $self->get_main->get_db_object(); + $dbh->do($sql, undef, $self->{prefix}, $self->{admin}, $self->{open_archive}, $self->{reply_to}, $self->{sub_ctrl}, $self->{post_ctrl}, $self->{signature}, $self->{ml_id}); -# $self->{'catchall'} = "" if( ! defined $self->{'catchall'} ); - - $query = "UPDATE vhffs_ml SET prefix='".$self->{'prefix'}."' WHERE ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - - $query = "UPDATE vhffs_ml_prefs SET admin='".$self->{'admin'}."' , open_post='".$self->{'open_post'}."', open_archive='".$self->{'open_archive'}."' , reply_to='".$self->{'reply_to'}. "', moderated='".$self->{moderated}."' , open_sub='".$self->{'open_sub'}."' WHERE ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute; - - return -3 if( $self->SUPER::commit < 0 ); return 1; @@ -222,17 +170,13 @@ sub change_right_for_sub { - my $self = shift; - my $subscriber = shift; - my $right = shift; + my ($self, $subscriber, $right) = @_; - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); - return -1 if( ! ( $right =~ /^[0-9]+$/ ) ); - - my $query = "UPDATE vhffs_ml_subscribers SET perm='".$right."' WHERE ml_id='".$self->{'ml_id'}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; - + my $sql = 'UPDATE vhffs_ml_subscribers SET perm = ? WHERE ml_id = ? AND member = ?'; + my $dbh = $self->get_main->get_db_object(); + # FIXME compatibility hack, we should return a boolean + return -1 unless($dbh->do($sql, undef, $right, $self->{ml_id}, $subscriber) > 0); + $self->{subs}->{$subscriber}->{perm} = $right; return 1; } @@ -249,20 +193,20 @@ return -2 if( $subscriber =~ /.*\s.*/ ); return -1 if( ! ( $right =~ /^[\d]+$/ ) ); - my $query = "SELECT * FROM vhffs_ml_subscribers WHERE ml_id='".$self->{ml_id}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); + my $sql = 'INSERT INTO vhffs_ml_subscribers (member, perm, hash, ml_id, language) VALUES (?, ?, NULL, ?, NULL)'; + my $dbh = $self->get_main->get_db_object(); + $dbh->do($sql, undef, $subscriber, $right, $self->{ml_id}) or return -2; - my $sid = 1; - $query = "SELECT MAX(sub_id) FROM vhffs_ml_subscribers"; - my $resultsid = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $sid = $resultsid->[0][0] if ( defined $resultsid->[0][0] ); - $sid++; + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_ml_subscribers', undef); - $query = "INSERT INTO vhffs_ml_subscribers VALUES( '".$sid."' , '".$subscriber."' , '".$right."' , '1' , 'nohash' , '".$self->{'ml_id'}."')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + $self->{subs}->{$subscriber} = { + sub_id => $id, + member => $subscriber, + perm => $right, + hash => undef, + ml_id => $self->{ml_id}, + language => undef + }; return 1; } @@ -272,33 +216,32 @@ #add a subscriber, return undef if already exists sub add_sub_with_reply { - use Digest::MD5; my $self = shift; my $subscriber = shift; - my $hash; return undef if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); + return undef if( $subscriber =~ /.*<.*/ ); + return undef if( $subscriber =~ /.*>.*/ ); + return undef if( $subscriber =~ /.*\s.*/ ); - #check if sub already exists - my $query = "SELECT * FROM vhffs_ml_subscribers WHERE ml_id='".$self->{ml_id}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - return undef if ( $rows != 0 ); + my $pass = Vhffs::Functions::generate_random_password; - my $sid = 1; - $query = "SELECT MAX(sub_id) FROM vhffs_ml_subscribers"; - my $resultsid = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $sid = $resultsid->[0][0] if ( defined $resultsid->[0][0] ); - $sid++; + my $sql = 'INSERT INTO vhffs_ml_subscribers(member, perm, hash, ml_id, language) VALUES(?, ?, ?, ?, NULL)'; + my $dbh = $self->get_main->get_db_object(); + $dbh->do($sql, undef, $subscriber, Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY, $pass, $self->{ml_id}) or return undef; + my $id = $dbh->last_insert_id(undef, undef, 'vhffs_ml_subscribers', undef); - $hash = Digest::MD5::md5_hex( Vhffs::Functions::generate_random_password ); - - $query = "INSERT INTO vhffs_ml_subscribers VALUES( '".$sid."' , '".$subscriber."' , '".Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY."' , '1' , '".$hash."' , '".$self->{'ml_id'}."')"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + $self->{subs}->{$subscriber} = { + sub_id => $id, + member => $subscriber, + perm => Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY, + hash => $pass, + ml_id => $self->{ml_id}, + language => undef + }; - return $hash; + return $pass; } @@ -308,55 +251,47 @@ my $self = shift; my $subscriber = shift; - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); + my $sql = 'DELETE FROM vhffs_ml_subscribers WHERE ml_id = ? AND member = ?'; + # FIXME we should return a boolean + return -1 unless($self->get_main->get_db_object->do($sql, undef, $self->{ml_id}, $subscriber) > 0); - - return -2 if ( $self->sub_exists( $subscriber ) != 1); - - - my $query = "DELETE FROM vhffs_ml_subscribers WHERE ml_id='".$self->{'ml_id'}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - + delete $self->{subs}->{$subscriber}; return 1; } +# FIXME useless sub change_state_for_sub { + return change_right_for_sub(@_); +} + +sub set_randompass +{ my $self = shift; my $subscriber = shift; - my $right = shift; + my $pass = Vhffs::Functions::generate_random_password; - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); - - return -2 if ( $self->sub_exists( $subscriber ) != 1); - - my $query = "UPDATE vhffs_ml_subscribers SET perm='".$right."' WHERE ml_id='".$self->{'ml_id'}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - - return 1; + my $sql = 'UPDATE vhffs_ml_subscribers SET hash = ? WHERE ml_id = ? AND member = ?'; + return undef unless($self->get_main->get_db_object->do($sql, undef, $pass, $self->{ml_id}, $subscriber) > 0); + + $self->{subs}->{$subscriber}->{hash} = $pass; + return $pass; } + sub clear_hash { my $self = shift; my $subscriber = shift; - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); - - return -2 if ( $self->sub_exists( $subscriber ) != 1); - - my $query = "UPDATE vhffs_ml_subscribers SET hash=' ' WHERE ml_id='".$self->{'ml_id'}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - + my $sql = 'UPDATE vhffs_ml_subscribers SET hash = NULL WHERE ml_id = ? AND member = ?'; + # FIXME we should return a boolean + return -1 unless($self->get_main->get_db_object->do($sql, undef, $self->{ml_id}, $subscriber) > 0); + + $self->{subs}->{$subscriber}->{hash} = undef; return 1; } - - - sub del_sub_with_reply { use Digest::MD5; @@ -364,160 +299,82 @@ my $self = shift; my $subscriber = shift; - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); - - - return -2 if ( $self->sub_exists( $subscriber ) != 1); - - return -3 if( ( $self->get_members->{$subscriber}{perm} != Vhffs::Constants::ML_RIGHT_SUB ) && ( $self->get_members->{$subscriber}{perm} != Vhffs::Constants::ML_RIGHT_ADMIN ) ); my $hash = Digest::MD5::md5_hex( Vhffs::Functions::generate_random_password ); - my $query = "UPDATE vhffs_ml_subscribers SET perm='".Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_DEL."', hash='".$hash."' WHERE ml_id='".$self->{'ml_id'}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; + my $sql = 'UPDATE vhffs_ml_subscribers SET perm = ?, hash = ? WHERE ml_id = ? AND member = ? AND perm IN (?, ?)'; + # FIXME we should return a boolean + return undef unless($self->get_main->get_db_object->do($sql, undef, Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_DEL, $hash, $self->{ml_id}, $subscriber, Vhffs::Constants::ML_RIGHT_SUB, Vhffs::Constants::ML_RIGHT_ADMIN) > 0); + + $self->{subs}->{$subscriber}->{hash} = $hash; + $self->{subs}->{$subscriber}->{perm} = Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_DEL; return $hash; } -sub sub_exists -{ - my $self = shift; - my $subscriber = shift; +# No need for delete method, foreign keys do the job +#sub delete +#{ +#} - return -1 if( Vhffs::Functions::valid_mail( $subscriber ) != 1 ); - - my $query = "SELECT * FROM vhffs_ml_subscribers WHERE ml_id='".$self->{ml_id}."' AND member='".$subscriber."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - return -1 if ( $rows == 0 ); - return 1; -} - - -sub delete +sub get_language_for_sub { - my $self = shift; - my $query; - my $request; + my ($main, $sub) = @_; - $query = "DELETE FROM vhffs_ml_subscribers WHERE ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - - $query = "DELETE FROM vhffs_ml_prefs WHERE ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - - - $query = "DELETE FROM vhffs_ml WHERE ml_id='".$self->{'ml_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - - $self->SUPER::delete; - - return 1; + my $sql = 'SELECT language FROM vhffs_ml_subscribers WHERE member = ?'; + my $lang = $main->get_db_object->selectrow_array($sql, undef, $sub); + return $lang; } - -sub get_lang_for_sub +sub set_language_for_sub { - my $vhffs = shift; - my $sub = shift; - my $query; - my $request; + my ($main, $sub, $language) = @_; - - $query = "SELECT lang FROM vhffs_ml_lang WHERE member='".$sub."'"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - return undef if ( $request->execute <= 0 ); - - my $result = $request->fetchrow_arrayref; - return $result->[0]; + $language = 'en_US' unless( $language =~ /^\w+$/ ); + my $sql = 'UPDATE vhffs_ml_subscribers SET language = ? WHERE member = ?'; + $main->get_db_object->do($sql, undef, $language, $sub) or return -1; } - -sub set_lang_for_sub -{ - my $vhffs = shift; - my $sub = shift; - my $lang = shift; - my $query, - my $request; - - if( $lang =~ /^fr$|^fr_FR$|^french$/ ) - { - $lang = "fr_FR"; - } - elsif( $lang =~ /^es$|^es_ES$|^spanish$/ ) - { - $lang = "es_ES"; - } - else - { - $lang = "en_US"; - } - - $query = "SELECT * FROM vhffs_ml_lang WHERE member='".$sub."'"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - if ( $request->execute <= 0 ) - { - $query = "INSERT INTO vhffs_ml_lang VALUES( '".$sub."' , '".$lang."' )"; - } - else - { - $query = "UPDATE vhffs_ml_lang SET lang='".$lang."' WHERE member='".$sub."'"; - } - - $request = $vhffs->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -1; - -} - sub get_localpart { my $self = shift; return $self->{'local_part'}; } - -sub get_open_archive +sub get_signature { my $self = shift; - return $self->{'open_archive'}; + return $self->{signature}; } -sub get_open_post +sub set_signature { - my $self = shift; - return $self->{'open_post'}; + my ($self, $sig) = @_; + $sig =~ s/\r\n/\n/; + $self->{signature} = $sig; } -sub get_open_sub +sub get_open_archive { my $self = shift; - return $self->{'open_sub'}; + return $self->{'open_archive'}; } - - -sub get_replyto +sub get_sub_ctrl { my $self = shift; - return $self->{'reply_to'}; + return $self->{'sub_ctrl'}; } - -sub get_url +sub get_post_ctrl { my $self = shift; - return $self->{'url'}; + return $self->{'post_ctrl'}; } - -sub get_moderated +sub get_replyto { my $self = shift; - return $self->{'moderated'}; + return $self->{'reply_to'}; } sub get_admin @@ -526,14 +383,12 @@ return $self->{'admin'}; } - sub get_domain { my $self = shift; return $self->{'domain'}; } - sub get_prefix { my $self = shift; @@ -546,7 +401,6 @@ return $self->{subs}; } - sub set_replytolist { my $self; @@ -562,32 +416,30 @@ return 1; } - -sub set_moderated +sub set_open_archive { my( $self , $value ) = @_; - $self->{'moderated'} = $value; + $self->{'open_archive'} = $value; } -sub set_open_post +sub set_sub_ctrl { - my( $self , $value ) = @_; - $self->{'open_post'} = $value; + my( $self , $value ) = @_; + return -1 unless ( $value =~ /\d+/ ); + return -1 if( $value < Vhffs::Constants::ML_SUBSCRIBE_NO_APPROVAL_REQUIRED || $value > Vhffs::Constants::ML_SUBSCRIBE_CLOSED ); + $self->{'sub_ctrl'} = $value; + return 0; } - -sub set_open_archive +sub set_post_ctrl { - my( $self , $value ) = @_; - $self->{'open_archive'} = $value; + my( $self , $value ) = @_; + return -1 unless ( $value =~ /\d+/ ); + return -1 if ( $value < Vhffs::Constants::ML_POSTING_OPEN_ALL || $value > Vhffs::Constants::ML_POSTING_ADMINS_ONLY ); + $self->{'post_ctrl'} = $value; + return 0; } -sub set_open_sub -{ - my( $self , $value ) = @_; - $self->{'open_sub'} = $value; -} - sub set_admin { my $self = shift; @@ -599,7 +451,7 @@ { my( $self , $value ) = @_; - $self->{'prefix'} = quotemeta $value; + $self->{'prefix'} = $value; } sub set_user @@ -622,69 +474,53 @@ sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; - my $domain = shift; + my ($vhffs, $state, $name, $group, $domain) = @_; - my $query; return undef if( ! defined $vhffs ); - $query = "SELECT * FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id"; - $query .= " AND o.state='".$state."'" if( defined $state ); - $query .= " AND ml.owner_gid='".$group->get_gid."'" if( defined $group ); - $query .= " AND ( ( local_part LIKE '%".$name."%' ) OR (domain LIKE '%".$name."%' ) )" if( defined $name ); - $query .= " AND ( domain='".$domain."')" if( defined $domain ); + my $mls = []; + my @params; + my $sql = 'SELECT local_part, domain FROM vhffs_ml ml, vhffs_object o WHERE o.object_id = ml.object_id'; - my $request = $vhffs->get_db_object->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute() or return -3; - return undef if( $rows <= 0 ); - my $result = $request->fetchall_hashref('ml_id'); - my $object; - my @plop; + if(defined $state) { + $sql .= ' AND o.state = ?'; + push @params, $state; + } + if(defined $group) { + $sql .= ' AND ml.owner_gid = ?'; + push @params, $group->get_gid; + } + if(defined $name) { + $sql .= ' AND ( local_part LIKE ? OR domain LIKE ?)'; + push @params, '%'.$name.'%', '%'.$name.'%'; + } + if(defined $domain) { + $sql .= ' AND domain = ?'; + push @params, $domain; + } + $sql .= ' ORDER BY local_part, domain'; - - foreach( keys %{$result} ) - { - $object = new Vhffs::Services::Mailing( $vhffs , $result->{$_}{local_part} , $result->{$_}{domain} ); - push( @plop , $object ) if( ( defined $object ) && ( $object->fetch > 0 ) ); - } + my $dbh = $vhffs->get_db_object; + my $sth = $dbh->prepare($sql); + $sth->execute(@params) or return -3; - return( \@plop ); + while(my @ml = $sth->fetchrow_array) { + push @$mls, get_by_mladdress($vhffs, @ml); + } + return $mls; } #Returns all the lists for a group +# FIXME useless sub getall_by_group { my $vhffs = shift; my $group = shift; - my $query; - return undef if( ! defined $vhffs ); - - $query = "SELECT * FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id"; - $query .= " AND ml.owner_gid='".$group->get_gid."'" if( defined $group ); - - my $request = $vhffs->get_db_object->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute() or return -3; - return undef if( $rows <= 0 ); - my $result = $request->fetchall_hashref('ml_id'); - my $object; - my @plop; - - - - foreach( keys %{$result} ) - { - $object = new Vhffs::Services::Mailing( $vhffs , $result->{$_}{local_part} , $result->{$_}{domain} ); - push( @plop , $object ) if( ( defined $object ) && ( $object->fetch > 0 ) ); - } - - return( \@plop ); + return getall($vhffs, undef, undef, $group); } @@ -714,3 +550,11 @@ } 1; + +__END__ + +=head1 AUTHORS + +Julien Delange < god at gunnm dot org > +Sebastien Le Ray < beuss at tuxfamily dot org > +Sylvain Rochet < gradator at gradator dot net > Modified: trunk/vhffs-api/src/Vhffs/Services/Mysql.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Mysql.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Mysql.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -33,42 +33,38 @@ # This file is a part of VHFFS4 platofmrm # Please respect the licence -# Author: soda < dieu at gunnm dot org> +=pod +=head1 NAME -package Vhffs::Services::Mysql; +Vhffs::Services::Mysql - Handle MySQL databases on VHFFS plaform. -use base qw(Vhffs::Object); -use strict; -use DBI; +=head1 SYNOPSIS +TODO -sub new -{ - my $main; - my $dbname; - my $this; - my $self; - my $class; - my $user; +=head1 METHODS - ( $class , $main , $dbname , $user ) = @_; +=cut - $this = {}; +package Vhffs::Services::Mysql; +use base qw(Vhffs::Object); +use strict; +use DBI; - $this = $class->SUPER::new( $main , 1 , '401' ); +sub check_dbname($) { + my $dbname = shift; + return ($dbname =~ /^[a-z0-9][a-z0-9\_]{1,30}[a-z0-9]$/ ); +} - return undef if( ! ( $dbname =~ /^[a-z0-9][a-z0-9\_]+[a-z0-9]$/ ) ); - return undef if( length( $dbname ) > 32 ); +sub check_dbuser($) { + return check_dbname($_[0]); +} - $this->{'dbname'} = $dbname if ( defined $dbname ); - $this->{'dbuser'} = $dbname if ( defined $dbname ); - - - bless( $this , $class ); - - return $this; +sub check_dbpass($) { + my $dbpass = shift; + return ($dbpass =~ /^[a-zA-Z0-9]{3,}$/ ); } sub delete @@ -76,7 +72,7 @@ my $self = shift; my $query = "DELETE FROM vhffs_mysql WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -2 if( $self->SUPER::delete < 0 ); @@ -85,72 +81,56 @@ } +=pod -sub create -{ - my $self = shift; +=head2 create - return -1 if ( $self->{'user'}->fetch < 0 ); - return -1 if ( $self->{'group'}->fetch < 0 ); + my $mysql = Vhffs::Services::Mysql::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group); + die("Unable to create MySQL service $dbname\n") unless(defined $mysql); - $self->{'owner_uid'} = $self->{'user'}->get_uid; +Creates a new MySQL service in VHFFS database and returns the fully functional object. - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_mysql WHERE dbname='" . $self->{'dbname'} . "'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); +=cut - my $oid = $self->SUPER::create(); - return -1 if ( $oid lt 0 ); +sub create { + my ($main, $dbname, $dbuser, $dbpass, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(check_dbname($dbname) && check_dbpass($dbpass) && check_dbuser($dbuser)); - $self->{'object_id'} = $oid; + my $mysql; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; -# return -2 if ( ( ! defined $self->{'dbuser'} ) || ( ! defined $self->{'dbpass'} ) ); - return -2 if ( ( ! defined $self->{'dbpass'} ) ); + eval { - #Get the mac httpd_id and compute the new httpd_id - my $mysql_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(mysql_id) FROM vhffs_mysql"); - $mysql_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $mysql_id++; + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_MYSQL); + die('Unable to create parent object') unless defined ($parent); - #Finally, create the object - my $query = "INSERT INTO vhffs_mysql VALUES( '".$mysql_id."' , '".$self->{'dbname'}."', '".$self->{'dbuser'}."' , '".$self->{'owner_uid'}."' , '".$self->{'group'}->get_gid."' , '".$self->{'dbpass'}."' , '$oid' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + my $sql = 'INSERT INTO vhffs_mysql(dbname, dbuser, dbpass, owner_uid, owner_gid, object_id) VALUES(?, ?, ?, ?, ?, ?)'; + my $sth = $dbh->prepare($sql); + $sth->execute($dbname, $dbuser, $dbpass, $user->get_uid, $group->get_gid, $parent->get_oid); - return $mysql_id; -} + $dbh->commit; + $mysql = get_by_dbname($main, $dbname); + }; + if($@) { + warn "Unable to create MySQL db $dbname: $@\n"; + $dbh->rollback; + } -#Get all data about this httpd object in the databse -sub fetch -{ - my $self = shift; + return $mysql; - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_mysql where dbname='".$self->{'dbname'}."'") or return -1; - my $rows = $request->execute(); - - return -1 if( $rows != 1 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - $self->SUPER::fetch; } - - sub commit { my $self = shift; my $query = "UPDATE vhffs_mysql SET owner_uid='".$self->{'owner_uid'}."', dbpass='".$self->{'dbpass'}."' WHERE dbname='".$self->{'dbname'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $request = $self->{'db'}->prepare( $query ); $request->execute; @@ -199,7 +179,7 @@ { my $self = shift; - my $request = $self->{'db'}->{'DB_READ'}->prepare("UPDATE vhffs_mysql SET dbpass='blanked' WHERE dbname='".$self->get_dbname."'") or return -1; + my $request = $self->{'db'}->prepare("UPDATE vhffs_mysql SET dbpass='blanked' WHERE dbname='".$self->get_dbname."'") or return -1; $request->execute(); return 1; } @@ -210,7 +190,7 @@ return 1 if( $value eq $self->{'dbuser'}); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_mysql where dbuser='".$value."'") or return -1; + my $request = $self->{'db'}->prepare("SELECT * FROM vhffs_mysql where dbuser='".$value."'") or return -1; my $rows = $request->execute(); return -1 if( $rows >= 1 ); @@ -239,40 +219,81 @@ $self->{'user'} = $user; } +sub _new { + my ($class, $main, $mysql_id, $owner_gid, $dbname, $dbuser, $dbpass, $oid, $owner_uid, $date_creation, $state, $description) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_MYSQL); + return undef unless(defined $self); + + $self->{mysql_id} = $mysql_id; + $self->{owner_gid} = $owner_gid; + $self->{dbname} = $dbname; + $self->{dbuser} = $dbuser; + $self->{dbpass} = $dbpass; + return $self; +} + +=pod + +=head2 get_by_dbname + + my $mysql = Vhffs::Services::Mysql::get_by_dbname($main, $dbname); + die("MySQL service $dbname not found\n") unless(defined $mysql); + +Fetches the MySQL service $dbname. + +=cut + +sub get_by_dbname($$) { + my ($vhffs, $dbname) = @_; + + my $sql = q{SELECT m.mysql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?}; + my $dbh = $vhffs->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $dbname)); + + return _new Vhffs::Services::Mysql($vhffs, @params); +} + sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $mysql = []; + my @params; + + my $sql = 'SELECT m.mysql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_mysql m, vhffs_object o WHERE m.object_id = o.object_id'; - my @objs; - my $result; - my $tmp; + if(defined $state) { + $sql .= ' AND o.state = ?'; + push(@params, $state); + } + if(defined $name) { + $sql .= ' AND m.dbname LIKE ?'; + push(@params, '%'.$name.'%'); + } + if(defined $group) { + $sql .= ' AND m.owner_gid = ?'; + push(@params, $group->get_gid); + } - $query = "SELECT dbname, dbuser FROM vhffs_mysql m, vhffs_object o WHERE o.object_id=m.object_id"; - $query.= " AND o.state='".$state."'" if( defined $state ); - $query.= " AND m.dbname LIKE '%".$name."%'" if( defined $name ); - $query.= " AND m.owner_gid='".$group->get_gid."'" if( defined $group ); - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + my $dbh = $vhffs->get_db_object(); + my $sth = $dbh->prepare($sql); - return undef if( $rows == 0); - $result = $request->fetchall_hashref('dbname'); - foreach( keys %{$result} ) - { - $tmp = new Vhffs::Services::Mysql( $vhffs , $_ ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @objs , $tmp; - } + return undef unless($sth->execute(@params)); + + while(my $row = $sth->fetchrow_arrayref()) { + push(@$mysql, _new Vhffs::Services::Mysql($vhffs, @$row)); } - return \@objs; + return $mysql; } 1; +__END__ + +=head1 AUTHORS + +soda < dieu at gunnm dot org> + +Sebastien Le Ray < beuss at tuxfamily dot org > Modified: trunk/vhffs-api/src/Vhffs/Services/Postgres.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Postgres.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Postgres.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -31,54 +31,74 @@ # This file is a part of VHFFS4 platofmrm -# Please respect the licence -# Author: soda < dieu at gunnm dot org> +=pod +=head1 NAME +Vhffs::Services::Postgres - Handle PostgreSQL databases in VHFFS. + +=head1 SYNOPSIS + +TODO + +=head1 METHODS + +=cut + package Vhffs::Services::Postgres; use base qw(Vhffs::Object); use strict; use DBI; +=pod +=head2 check_dbname -sub new -{ - my $main; - my $dbname; - my $this; - my $self; - my $class; - my $user; - my $group; + die('Bad DB name') unless(Vhffs::Services::Postgres::check_dbname($dbname)); - #( $class , $main , $dbname , $user ) = @_; +Indicates wether a DB name is valid or not (3 to 32 alphanumeric chars, underscore +allowed except at begining and end). - $class = shift; - $main = shift; - $dbname = shift; - $user = shift; - $group = shift; +=cut - $this = {}; - -# return undef if( $dbname =~ /^[\w\d\_\-]+$/ ); +sub check_dbname($) { + my $dbname = shift; + return ( $dbname =~ /^[a-z0-9][a-z0-9\_]{1,30}[a-z0-9]$/ ); +} - return undef if( ! ( $dbname =~ /^[a-z0-9][a-z0-9\_]+[a-z0-9]$/ ) ); - return undef if( length( $dbname ) > 32 ); +=pod - $this = $class->SUPER::new( $main , 1 , '401' ); +=head2 check_dbuser - $this->{'dbname'} = $dbname if ( defined $dbname ); - $this->{'dbuser'} = ""; - $this->{'user'} = $user if ( defined $user ); - $this->{'group'} = $group if ( defined $group ); + die('Bad DB username') unless(Vhffs::Services::Postgres::check_dbuser($user)); + +Indicates wether a DB user name is valid or not (3 to 32 lowercase alphanumeric chars, underscore +allowed except at begining and end). + +=cut + +sub check_dbuser($) { + return check_dbname($_[0]); +} + + +=pod + +=head2 check_dbuser + + die('Bad DB pass') unless(Vhffs::Services::Postgres::check_dbpass($pass)); + +Indicates wether a DB password is valid or not (at least one alphanumeric +char). + +=cut - bless( $this , $class ); - return $this; +sub check_dbpass($) { + my $dbpass = shift; + return ( $dbpass =~ /^[a-zA-Z0-9]+$/); } sub delete @@ -86,81 +106,63 @@ my $self = shift; my $query = "DELETE FROM vhffs_pgsql WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -2 if( $self->SUPER::delete < 0 ); return 1; } +=pod -sub create -{ - my $self = shift; +=head2 create - return -1 if( $self->{'user'}->fetch < 0 ); - return -1 if ( $self->{'group'}->fetch < 0 ); - $self->{'owner_gid'} = $self->{'group'}->get_gid; - $self->{'owner_uid'} = $self->{'user'}->get_uid; + my $psql = Vhffs::Services::Postgres::create($main, $dbname, $dbuser, $dbpass, $description, $user, $group); + die("Unable to create Postgre Service\n") unless(defined $psql); +Create a new Postgres services and return the corresponding fully functional object. - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_pgsql WHERE dbname='" . $self->{'dbname'} . "'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); +=cut - my $oid = $self->SUPER::create(); - return -1 if ( $oid lt 0 ); +sub create { + my ($main, $dbname, $dbuser, $dbpass, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(check_dbname($dbname) && check_dbpass($dbpass) && check_dbuser($dbuser)); + my $pg; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - $self->{'object_id'} = $oid; + eval { - return -2 if ( ( ! defined $self->{'dbuser'} ) || ( ! defined $self->{'dbpass'} ) ); + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_PGSQL); + die('Unable to create parent object') unless defined ($parent); - #Get the mac httpd_id and compute the new httpd_id - my $pgsql_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(pgsql_id) FROM vhffs_pgsql"); - $pgsql_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $pgsql_id++; + my $sql = 'INSERT INTO vhffs_pgsql(dbname, dbuser, dbpass, owner_uid, owner_gid, object_id) VALUES(?, ?, ?, ?, ?, ?)'; + my $sth = $dbh->prepare($sql); + $sth->execute($dbname, $dbuser, $dbpass, $user->get_uid, $group->get_gid, $parent->get_oid); + $dbh->commit; + $pg = get_by_dbname($main, $dbname); + }; - #Finally, create the object - my $query = "INSERT INTO vhffs_pgsql VALUES( '".$pgsql_id."' , '".$self->{'dbname'} . "', '".$self->{'dbuser'}."' , '".$self->{'dbpass'}."' , '".$self->{'owner_uid'}."', '".$self->{'owner_gid'}."' , '$oid' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); - $request->execute or return -2; + if($@) { + warn "Unable to create PostgreSQL database $dbname: $@\n"; + $dbh->rollback; + } - return $pgsql_id; -} + return $pg; - -#Get all data about this httpd object in the databse -sub fetch -{ - my $self = shift; - - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_pgsql where dbname='".$self->{'dbname'}."'") or return -1; - my $rows = $request->execute(); - - return -1 if( $rows != 1 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - $self->SUPER::fetch; } - - sub commit { my $self = shift; my $query = "UPDATE vhffs_pgsql SET owner_uid='".$self->{'owner_uid'}."', dbuser= '".$self->{'dbuser'}."', dbpass='".$self->{'dbpass'}."' WHERE dbname='".$self->{'dbname'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare( $query ); + my $request = $self->{'db'}->prepare( $query ); $request->execute; @@ -173,16 +175,12 @@ return $self->{'owner_gid'}; } - sub get_owneruid { my $self = shift; return $self->{'owner_uid'}; } - - - sub get_dbusername { my $self = shift; @@ -195,7 +193,6 @@ return $self->{'dbname'}; } - sub get_title { my $self = shift; @@ -208,19 +205,14 @@ return $self->{'dbpass'}; } - - sub set_dbusername { my ($self , $value) = @_; return 1 if( $value eq $self->{'dbuser'}); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_pgsql where dbuser='".$value."'") or return -1; - my $rows = $request->execute(); + return -1 if(! check_dbuser($value)); - return -1 if( $rows >= 1 ); - $self->{'dbuser'} = $value; return 1; } @@ -251,45 +243,79 @@ { my $self = shift; - my $request = $self->{'db'}->{'DB_READ'}->prepare("UPDATE vhffs_pgsql SET dbpass='blanked' WHERE dbname='".$self->get_dbname."'") or return -1; + my $request = $self->{'db'}->prepare("UPDATE vhffs_pgsql SET dbpass='blanked' WHERE dbname='".$self->get_dbname."'") or return -1; $request->execute(); return 1; } +sub _new { + my ($class, $main, $pgsql_id, $owner_gid, $dbname, $dbuser, $dbpass, $oid, $owner_uid, $date_creation, $state, $description) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_PGSQL); + return undef unless(defined $self); + + $self->{pgsql_id} = $pgsql_id; + $self->{owner_gid} = $owner_gid; + $self->{dbname} = $dbname; + $self->{dbuser} = $dbuser; + $self->{dbpass} = $dbpass; + return $self; +} + +=pod + +=head2 get_by_dbname + + my $pg = Vhffs::Services::Postgres::get_by_dbname($main, $dbname); + die("No database with this name") unless(defined $pg); + +Fetches the pg database whose name is C<$dbname>. + +=cut + +sub get_by_dbname($$) { + my ($vhffs, $dbname) = @_; + + my $sql = q{SELECT m.pgsql_id, m.owner_gid, m.dbname, m.dbuser, m.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql m INNER JOIN vhffs_object o ON o.object_id = m.object_id WHERE m.dbname = ?}; + my $dbh = $vhffs->get_db_object(); + my @params; + return undef unless(@params = $dbh->selectrow_array($sql, undef, $dbname)); + + return _new Vhffs::Services::Postgres($vhffs, @params); + +} + sub getall -{ - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; +{ + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $postgres = []; + my @params; - my @objs; - my $result; - my $tmp; + my $sql = 'SELECT p.pgsql_id, p.owner_gid, p.dbname, p.dbuser, p.dbpass, o.object_id, o.owner_uid, o.date_creation, o.state, o.description FROM vhffs_pgsql p, vhffs_object o WHERE p.object_id = o.object_id'; - $query = "SELECT dbname FROM vhffs_pgsql p, vhffs_object o WHERE o.object_id=p.object_id"; - $query .= " AND o.state='".$state."'" if( defined $state ); - $query .= " AND p.dbname LIKE '%".$name."%'" if( defined $name ); - $query .= " AND p.owner_gid='".$group->get_gid."'" if( defined $group ); + if(defined $state) { + $sql .= ' AND o.state = ?'; + push(@params, $state); + } + if(defined $name) { + $sql .= ' AND p.dbname LIKE ?'; + push(@params, '%'.$name.'%'); + } + if(defined $group) { + $sql .= ' AND p.owner_gid = ?'; + push(@params, $group->get_gid); + } - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + my $dbh = $vhffs->get_db_object(); + my $sth = $dbh->prepare($sql); - return undef if( $rows <= 0); - $result = $request->fetchall_hashref('dbname'); - foreach( keys %{$result} ) - { - $tmp = new Vhffs::Services::Postgres( $vhffs , $_ ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @objs , $tmp; - } + return undef unless($sth->execute(@params)); + + while(my $row = $sth->fetchrow_arrayref()) { + push(@$postgres, _new Vhffs::Services::Postgres($vhffs, @$row)); } - return \@objs; + + return $postgres; } - 1; Modified: trunk/vhffs-api/src/Vhffs/Services/Repository.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Repository.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Repository.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -32,146 +32,144 @@ # This file is a part of VHFFS4 Hosting Platform # Please respect the licence of this file and the whole software -# Author: Sylvain Rochet < gradator at gradator dot net > -package Vhffs::Services::Repository; +=pod -use base qw(Vhffs::Object); -use Vhffs::Group; -use strict; -use DBI; +=head1 NAME +Vhffs::Services::Repository - Handle download repositories in VHFFS +=head1 SYNOPSIS -sub new -{ - my $main; - my $name; - my $this; - my $self; - my $class; - my $user; - my $group; +TODO - $class = shift; - $main = shift; - $name = shift; - $user = shift; - $group = shift; +=head1 METHODS - $this = {}; +=cut - $this = $class->SUPER::new( $main , 1 , '401' ); +package Vhffs::Services::Repository; - #We return an undefined value if the user or the NAME are not correct - return undef if( ! defined ( $name ) ); - return undef if( ! ( $name =~ /[a-z0-9]+/) ); +use base qw(Vhffs::Object); +use Vhffs::Group; +use strict; +use DBI; - $this->{'name'} = $name; - $this->{'user'} = $user if( defined $user ); - $this->{'group'} = $group if( defined $group ); - - bless( $this , $class ); - - return $this; +sub check_name($) +{ + my $name = shift; + return ($name =~ /^[a-z0-9]+$/); } sub delete { my $self = shift; - $self->fetch; + return unless(defined $self); my $query = "DELETE FROM vhffs_repository WHERE object_id='".$self->{'object_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -1 if( $self->SUPER::delete < 0 ); return 1; } -sub create +=pod + +=head2 create + + my $repo = Vhffs::Services::Repository::create($main, $rname, $description, $user, $group); + die('Unable to create repository) unless(defined $repo); + +Creates a new download repository in database and return the corresponding +fully functional object. + +=cut + +sub create { - my $self = shift; - my $conf; - my $quota; + my ($main, $rname, $description, $user, $group) = @_; - return -2 if ( $self->{'user'}->fetch < 0 ); - return -3 if ( $self->{'group'}->fetch < 0 ); - - $self->{'owner_uid'} = $self->{'user'}->get_uid; - $self->{'owner_gid'} = $self->{'group'}->get_gid; + return undef unless(defined($user) && defined($group)); + return undef unless(check_name($rname)); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_repository WHERE name='" . $self->{'name'} . "'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); + my $repo; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - my $oid = $self->SUPER::create(); - if ( $oid lt 0 ) - { - return( -1 ); - } - else - { - $self->{'object_id'} = $oid; - } + eval { + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_REPOSITORY); + die('Unable to create parent object') unless(defined $parent); + my $sql = 'INSERT INTO vhffs_repository(name, owner_uid, owner_gid, quota, quota_used, object_id) VALUES(?, ?, ?, ?, 0, ?)'; - #Get the max repository_id and compute the new repository_id - my $repository_id = 1; - my $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(repository_id) FROM vhffs_repository"); - $repository_id = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $repository_id++; + #Quota + my $config = $main->get_config()->get_service('repository'); + my $quota = $config->{'default_quota'} if defined($config); + $quota = 100 unless defined($quota); - #Quota - $conf = $self->{'main'}->get_config->get_service("repository"); - $quota = 100; - $quota = $conf->{'default_quota'} if( ( defined $conf ) && ( defined $conf->{'default_quota'} ) ); + my $sth = $dbh->prepare($sql); + $sth->execute($rname, $user->get_uid, $group->get_gid, $quota, $parent->get_oid); - #Finally, create the object - my $text = "INSERT INTO vhffs_repository VALUES( '".$repository_id."' , '".$self->{'name'} . "','".$self->{'user'}->get_uid."','".$self->{'group'}->get_gid."' , '".$quota."' , '0' , '".$self->{'object_id'}."' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $text ); - $request->execute or return -2; + $dbh->commit; + $repo = get_by_reponame($main, $rname); + }; - return $repository_id; + if($@) { + warn "Unable to create repository $rname: $@\n"; + $dbh->rollback; + } + + return $repo; } +=pod -sub fetch -{ - my $self = shift; - - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_repository where name='".$self->{'name'}."'") or return -1; - - my $rows = $request->execute() or return -3; - - return -1 if( $rows <= 0 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } +=head2 get_by_reponame - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef ,$self->{'owner_uid'} , $self->{'owner_gid'} ); - return -1 if( $self->{'group'}->fetch < 0 ); + my $repo = Vhffs::Services::Repository::get_by_reponame($main, $name); + die('Repository not found') unless(defined $repo); +Fetches an existing repository. - $self->SUPER::fetch; - - return 1; +=cut + +sub get_by_reponame($$) { + my ($main, $name) = @_; + + my @params; + + my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE r.name = ?'; + + my $dbh = $main->get_db_object(); + return undef unless(@params = $dbh->selectrow_array($sql, undef, $name)); + + return _new Vhffs::Services::Repository($main, @params); } +sub _new { + my ($class, $main, $repository_id, $name, $owner_uid, $owner_gid, $quota, $quota_used, $oid, $date_creation, $description, $state) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_REPOSITORY); + return undef unless(defined $self); + $self->{repository_id} = $repository_id; + $self->{name} = $name; + $self->{owner_gid} = $owner_gid; + $self->{quota} = $quota; + $self->{quota_used} = $quota_used; + + return $self; +} + sub commit { my $self = shift; my $query = "UPDATE vhffs_repository SET name='".$self->{'name'}."', quota='".$self->{'quota'}."', quota_used='".$self->{'quota_used'}."' WHERE repository_id='".$self->{'repository_id'}."'"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -2 if( $self->SUPER::commit < 0 ); @@ -181,38 +179,35 @@ sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $repos = []; + my @params; - my $objs; - my $result; - my $tmp; + my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r, vhffs_object o WHERE r.object_id = o.object_id'; + if(defined($state)) { + $sql .= ' AND o.state = ?'; + push(@params, $state); + } + if(defined $name) { + $sql .= ' AND r.name = ?'; + push(@params, $name); + } + if(defined($group)) { + $sql .= ' AND r.owner_gid = ?'; + push(@params, $group->get_gid); + } + $sql .= ' ORDER BY r.name'; + + my $dbh = $vhffs->get_db_object(); - $query = "SELECT r.name, r.object_id FROM vhffs_repository r, vhffs_object o WHERE r.object_id = o.object_id"; - $query.= " AND o.state='".$state."'" if( defined $state ); - $query.= " AND r.name LIKE '%".$name."%'" if( defined $name ); - $query.= " AND r.owner_gid='".$group->get_gid."'" if( defined $group ); - $query .= " ORDER BY r.name"; - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + my $sth = $dbh->prepare($sql); + $sth->execute(@params) or return undef; - return undef if( $rows == 0); - - while( $result = $request->fetchrow_hashref ) - { - - $tmp = new Vhffs::Services::Repository( $vhffs , $result->{'name'} ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } - } - return $objs; + while(my $r = $sth->fetchrow_arrayref()) { + push(@$repos, _new Vhffs::Services::Repository($vhffs, @$r)); + } + return $repos; } @@ -295,30 +290,32 @@ sub getall_per_group { - my $main = shift; - my $group = shift; + my ($main, $group) = @_; my @result; - my $repos; - return undef if ( $group->fetch < 0 ); + my $repos = []; + return undef if ( ! defined $group ); - my $query = "SELECT r.name , r.object_id, o.state FROM vhffs_repository r, vhffs_object o WHERE o.object_id=r.object_id AND r.owner_gid='".$group->get_gid."'"; + my $sql = 'SELECT r.repository_id, r.name, r.owner_uid, r.owner_gid, r.quota, r.quota_used, o.object_id, o.date_creation, o.description, o.state FROM vhffs_repository r INNER JOIN vhffs_object o ON o.object_id = r.object_id WHERE r.owner_gid = ?'; - my $request = $main->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; + my $dbh = $main->get_db_object(); + my $sth = $dbh->prepare($sql); + $sth->execute($group->get_gid) or return undef; + while(my $r = $sth->fetchrow_arrayref()) { + push(@$repos, _new Vhffs::Services::Repository($main, @$r)); + } + return $repos; +} - return undef if ( $request->execute() <= 0); - my $reposs = $request->fetchall_hashref( 'name' ); - foreach $repos ( %{$reposs} ) - { - my $repo = new Vhffs::Services::Repository( $main , $repos ); - push( @result , $repo ) if( $repo->fetch > 0 ); - } - return \@result; -} +1; +__END__ +=head1 AUTHORS -1; +Sylvain Rochet < gradator at gradator dot net > + +Sebastien Le Ray < beuss at tuxfamily dot net > Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -43,42 +43,9 @@ use strict; use DBI; - - -sub new -{ - my $main; - my $reponame; - my $this; - my $self; - my $class; - my $user; - my $group; - - $class = shift; - $main = shift; - $reponame = shift; - $user = shift; - $group = shift; - - $this = {}; - - $this = $class->SUPER::new( $main , 1 , '401' ); - - #We return an undefined value if the user or the SVNROOT are not correct - return undef if( ! defined ( $reponame ) ); - return undef if( length( $reponame ) < 3 ); - return undef if( ! ( $reponame =~ /^[a-z0-9]+$/ ) ); - - - $this->{'user'} = $user; - $this->{'group'} = $group; - $this->{'reponame'} = $reponame; - $this->{'public'} = 1; - - bless( $this , $class ); - - return $this; +sub check_name($) { + my $name = shift; + return ($name =~ /^[a-z0-9]{3,64}$/); } sub delete @@ -88,100 +55,82 @@ my $request; $query = "DELETE FROM vhffs_svn WHERE object_id='".$self->{'object_id'}."'"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + $request = $self->{'db'}->prepare($query); $request->execute or return -1; return -1 if( $self->SUPER::delete < 0 ); } - - sub create { - my $self = shift; - - - return -2 if ( !defined $self->{'user'} || $self->{'user'}->fetch < 0 ); - return -3 if ( !defined $self->{'group'} || $self->{'group'}->fetch < 0 ); + my ($main, $rname, $description, $user, $group) = @_; + return undef unless(defined($user) && defined($group)); + return undef unless(check_name($rname)); - my $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_svn WHERE reponame='" . $self->{'reponame'} ."' AND owner_gid='".$self->{'group'}->get_gid."'"); - my $rows = $request->execute; - return -1 if ( $rows != 0 ); + my $svn; + my $dbh = $main->get_db_object(); + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + $dbh->begin_work; - $self->{'owner_uid'} = $self->{'user'}->get_uid; - - my $oid = $self->SUPER::create(); - if ( $oid lt 0 ) - { - return( -1 ); - } - else - { - $self->{'object_id'} = $oid; - } - - - #Finally, create the object - my $text = "INSERT INTO vhffs_svn (reponame,owner_uid,owner_gid,public,object_id) VALUES( '".$self->{'reponame'} . "','".$self->{'user'}->get_uid."','".$self->{'group'}->get_gid."' , '1' , '".$self->{'object_id'}."' )"; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( $text ); - $request->execute or return -2; - - return 1; -} + eval { + my $parent = Vhffs::Object::create($main, $user->get_uid, $description, undef, Vhffs::Constants::TYPE_SVN); + die('Unable to create parent object') unless(defined $parent); -sub fetch -{ - my $self = shift; - + my $sql = 'INSERT INTO vhffs_svn(reponame, owner_uid, owner_gid, public, object_id) VALUES(?, ?, ?, 1, ?)'; + my $sth = $dbh->prepare($sql); + $sth->execute($rname, $user->get_uid, $group->get_gid, $parent->get_oid) or return undef; - my $query = "SELECT * FROM vhffs_svn where reponame='".$self->{'reponame'}."' AND owner_gid='".$self->{'group'}->get_gid."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -1; - - my $rows = $request->execute() or return -3; + $dbh->commit; + $svn = get_by_reponame($main, $rname); + }; - return -2 if( $rows <= 0 ); - - my $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} + if($@) { + warn "Unable to create svn repository $rname: $@\n"; + $dbh->rollback; } - - - $self->{'group'} = new Vhffs::Group( $self->{'main'} , undef , $self->{'owner_uid'} , $self->{'owner_gid'} ); - return -1 if( $self->{'group'}->fetch < 0 ); - - $self->{'user'} = new Vhffs::User( $self->{'main'} , undef , $self->{'owner_uid'} ); - return -1 if( $self->{'user'}->fetch < 0 ); - - - $self->SUPER::fetch; - - return 1; + + return $svn; } +sub get_by_reponame($$) { + my ($main, $reponame) = @_; + my @params; + my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?'; -sub get_users -{ - my $self = shift; - - return( $self->{'users'} ); + my $dbh = $main->get_db_object(); + + return undef unless(@params = $dbh->selectrow_array($sql, undef, $reponame)); + + return _new Vhffs::Services::Svn($main, @params); + } +sub _new +{ + my ($class, $main, $svn_id, $reponame, $owner_uid, $owner_gid, $public, $oid, $date_creation, $description, $state) = @_; + my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_SVN); + return undef unless(defined $self); + $self->{svn_id} = $svn_id; + $self->{reponame} = $reponame; + $self->{owner_gid} = $owner_gid; + $self->{public} = $public; + + return $self; +} + sub commit { my $self = shift; my $query = "UPDATE vhffs_svn SET public= '".$self->{'public'}."' WHERE svn_id=$self->{'svn_id'}"; - my $request = $self->{'db'}->{'DB_WRITE'}->prepare($query); + my $request = $self->{'db'}->prepare($query); $request->execute; $self->SUPER::commit; @@ -256,77 +205,61 @@ sub getall { - my $vhffs = shift; - my $state = shift; - my $name = shift; - my $group = shift; + my ($vhffs, $state, $name, $group) = @_; - my $query; - my $request; + my $svn = []; + my @params; - my $objs; - my $result; - my $tmp; - - - $query = "SELECT * FROM vhffs_svn s, vhffs_object o WHERE s.object_id = o.object_id "; - $query.= " AND o.state='".$state."'" if( defined $state); - $query.= " AND s.owner_gid='".$group->get_gid."'" if( defined $group); - $query.= " AND s.reponame LIKE '%".$name."%'" if( defined $name); - $query .= " ORDER BY reponame"; - - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); + my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s, vhffs_object o WHERE o.object_id = s.object_id'; - my $rows = $request->execute; - - return undef if( $rows == 0); - while( $result = $request->fetchrow_hashref ) - { - my $group = new Vhffs::Group( $vhffs , undef , $result->{'owner_uid'} , $result->{'owner_gid'} ); + if(defined $state) { + $sql .= ' AND o.state = ?'; + push(@params, $state); + } + if(defined $name) { + $sql .= ' AND s.name = ?'; + push(@params, $name); + } + if(defined($group)) { + $sql .= ' AND s.owner_gid = ?'; + push(@params, $group->get_gid); + } + $sql .= ' ORDER BY s.reponame'; - $tmp = new Vhffs::Services::Svn( $vhffs , $result->{'reponame'} , undef , $group ); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } + my $dbh = $vhffs->get_db_object(); + + my $sth = $dbh->prepare($sql); + $sth->execute(@params) or die($sql) ; #return undef; + + while(my $s = $sth->fetchrow_arrayref()) { + push(@$svn, _new Vhffs::Services::Svn($vhffs, @$s)); } - return $objs; + return $svn; } sub getall_by_group { - my $vhffs = shift; - my $group = shift; + my ($vhffs, $group) = @_; - my $query; - my $request; + my $svn = []; + my @params; - my $objs; - my $result; - my $tmp; + return undef unless( defined $group ); - return undef if( $group->fetch < 1 ); - - $query = "SELECT s.reponame, s.object_id FROM vhffs_svn s, vhffs_object o WHERE s.object_id = o.object_id AND s.owner_gid='".$group->get_gid."'"; - - $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; + my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER + JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.owner_gid = ? ORDER BY s.reponame'; - return undef if( $rows == 0); + my $dbh = $vhffs->get_db_object(); - $result = $request->fetchall_hashref( 'reponame' ); + my $sth = $dbh->prepare($sql); + $sth->execute($group->get_gid) or return undef; - foreach( keys %{$result} ) - { - $tmp = new Vhffs::Services::Svn( $vhffs , $_ , undef , $group); - if( ( defined ( $tmp ) ) && ( $tmp->fetch > 0 ) ) - { - push @{$objs} , $tmp; - } + while(my $s = $sth->fetchrow_arrayref()) { + push(@$svn, _new Vhffs::Services::Svn($vhffs, @$s)); } - return $objs; + return $svn; } Modified: trunk/vhffs-api/src/Vhffs/Stats.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/Stats.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/Stats.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -30,235 +30,164 @@ # POSSIBILITY OF SUCH DAMAGE. -#Vhffs::ACL written by sod` <dieu AT gunnm DOT org> +=pod -# This software is free software, please read LICENCE file -package Vhffs::Stats; +=head1 NAME -#General perl modules -use base qw(Vhffs::Object); -use strict; +Vhffs:Stats - Provide statistics on Vhffs Platform -#Vhffs specific modules -use Vhffs::Constants; +=head1 SYNOPSIS + my $main = init Vhffs::Main(...); -sub new -{ - my $this; - my $self; + my $stats = new Vhffs::Stats($main); + my $lstcount = $stats->get_lists_in_moderation; - my ( $class , $main ) = @_; - - $this = {}; + # Add some lists here... + # ... - - $this->{'main'} = $main; - $this->{'db'} = $main->get_db_object; - bless( $this , $class ); -} + $stats->refresh(); # Flush cache + my $newlstcount = $stats->get_lists_in_moderation; -sub fetch -{ - my ( $self , $query , $request , $result ); - $self = shift; +=head1 METHODS - $query = "SELECT COUNT(*) FROM vhffs_users"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'users'}{'total'} = $result->[0][0] if ( defined $result->[0][0] ); +=cut - $query = "SELECT COUNT(*) FROM vhffs_users WHERE admin='".Vhffs::Constants::USER_ADMIN."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'users'}{'total_admin'} = $result->[0][0] if ( defined $result->[0][0] ); +package Vhffs::Stats; - $query = "SELECT COUNT(*) FROM vhffs_users WHERE admin='".Vhffs::Constants::USER_MODERATOR."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'users'}{'total_moderator'} = $result->[0][0] if ( defined $result->[0][0] ); +use strict; +use base qw(Vhffs::Object); +use Vhffs::Constants; - $query = "SELECT COUNT(*) FROM vhffs_groups g WHERE g.groupname NOT IN ( SELECT username FROM vhffs_users )"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'groups'}{'total'} = $result->[0][0] if ( defined $result->[0][0] ); +=pod - $query = "SELECT COUNT(*) FROM vhffs_groups g, vhffs_object o WHERE o.object_id=g.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."' AND g.groupname NOT IN (SELECT username FROM vhffs_users)"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'groups'}{'waited_moderation'} = $result->[0][0] if ( defined $result->[0][0] ); +=head2 new + my $stats = new Vhffs::Stats($main); - $query = "SELECT COUNT(*) FROM vhffs_groups g, vhffs_object o WHERE o.object_id=g.object_id AND o.state='".Vhffs::Constants::ACTIVATED."' AND g.groupname NOT IN (SELECT username FROM vhffs_users)"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'groups'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); +Creates a new Vhffs::Stats instance. C<$main> is +the C<Vhffs::Main> instance used to get database +connection. +=cut +sub new +{ + my ( $class , $main ) = @_; + + my $this = {}; - $query = "SELECT COUNT(*) FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'web'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'web'}{'waited'} = $result->[0][0] if ( defined $result->[0][0] ); - $self->{'web'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - $query = "SELECT COUNT(*) FROM vhffs_httpd w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'web'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); + $this->{'main'} = $main; + $this->{'db'} = $main->get_db_object; + bless( $this , $class ); +} +=pod - $query = "SELECT COUNT(*) FROM vhffs_cvs w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'cvs'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); +=head2 refresh - $query = "SELECT COUNT(*) FROM vhffs_cvs w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'cvs'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_cvs w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'cvs'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); + $stats->refresh(); +When you call a C<get_xxxx> method, data +are fetched from database and cached. If you +want to flush the cache, call C<refresh>. - ### DNS Stats - $query = "SELECT COUNT(*) FROM vhffs_dns_global w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'dns'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); +There are very few cases where this method should +be used. - $query = "SELECT COUNT(*) FROM vhffs_dns_global w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'dns'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_dns_global w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'dns'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +=cut +sub refresh { + my $self = shift; + foreach(keys(%{$self})) { + next if($_ eq 'main' || $_ eq 'db'); + delete $self->{$_} + } +} - ###Stats for mail - $query = "SELECT COUNT(*) FROM vhffs_mxdomain w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mail'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); +=pod - $query = "SELECT COUNT(*) FROM vhffs_mxdomain w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mail'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_mxdomain w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mail'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +=head2 get_lists_totalsubs - $query = "SELECT COUNT(*) FROM vhffs_boxes"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mail'}{'total_boxes'} = $result->[0][0] if ( defined $result->[0][0] ); + my $count = $stats->get_lists_totalsubs(); - $query = "SELECT COUNT(*) FROM vhffs_forward"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mail'}{'total_forwards'} = $result->[0][0] if ( defined $result->[0][0] ); +Returns the count of mailing list subscribers on +the platform. +=cut - ### Stats for MySQL - $query = "SELECT COUNT(*) FROM vhffs_mysql w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mysql'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); +sub get_lists_totalsubs +{ + my $self = shift; + unless(defined $self->{lists}{totalsubs}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_ml_subscribers'; + ($self->{lists}{totalsubs}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{lists}{totalsubs}; +} - $query = "SELECT COUNT(*) FROM vhffs_mxdomain w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mysql'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_mxdomain w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'mysql'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +=pod +=head2 get_lists_in_moderation - ### Stats for Pgsql - $query = "SELECT COUNT(*) FROM vhffs_pgsql w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'pgsql'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); + my $count = $stats->get_lists_in_moderation(); - $query = "SELECT COUNT(*) FROM vhffs_pgsql w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'pgsql'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_pgsql w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'pgsql'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +Returns the count of mailing lists waiting for +moderation. - $query = "SELECT COUNT(*) FROM vhffs_svn w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'svn'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_svn w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'svn'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_svn w, vhffs_object o WHERE o.object_id=w.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'svn'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +=cut - $query = "SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'lists'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'lists'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'lists'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); +sub get_lists_in_moderation +{ + my $self = shift; + unless(defined $self->{lists}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state='.Vhffs::Constants::WAITING_FOR_VALIDATION; + ($self->{lists}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{lists}{awaiting_validation}; +} - $query = "SELECT COUNT(*) FROM vhffs_ml"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'lists'}{'total'} = $result->[0][0] if ( defined $result->[0][0] ); +=pod - $query = "SELECT COUNT(*) FROM vhffs_ml_subscribers"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'lists'}{'totalsubs'} = $result->[0][0] if ( defined $result->[0][0] ); - +=head2 get_lists_in_activated - $query = "SELECT COUNT(*) FROM vhffs_largefile lf, vhffs_object o WHERE o.object_id=lf.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'largefile'}{'activated'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_largefile lf , vhffs_object o WHERE o.object_id=ls.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_VALIDATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'largefile'}{'waited_validation'} = $result->[0][0] if ( defined $result->[0][0] ); - - $query = "SELECT COUNT(*) FROM vhffs_largefile lf , vhffs_object o WHERE o.object_id=lf.object_id AND o.state='".Vhffs::Constants::WAITING_FOR_CREATION."'"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'largefile'}{'waited_creation'} = $result->[0][0] if ( defined $result->[0][0] ); + my $count = $stats->get_lists_activated(); +Returns the count of mailing lists currently activated. - $query = "SELECT COUNT(*) FROM vhffs_largefile lf , vhffs_object o WHERE o.object_id=lf.object_id"; - $result = $self->{'db'}->{'DB_READ'}->selectall_arrayref( $query ); - $self->{'largefile'}{'total'} = $result->[0][0] if ( defined $result->[0][0] ); +=cut - return 1; -} - -sub get_lists_totalsubs +sub get_lists_activated { my $self = shift; - return $self->{'lists'}{'totalsubs'}; + unless(defined $self->{lists}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_ml ml, vhffs_object o WHERE o.object_id=ml.object_id AND o.state = ?'; + ($self->{lists}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{lists}{activated}; } +=pod +=head2 get_lists_total -sub get_lists_in_moderation -{ - my $self = shift; - return $self->{'lists'}{'waited_validation'}; -} + my $count = $stats->get_lists_total(); -sub get_lists_activated -{ - my $self = shift; - return $self->{'lists'}{'activated'}; -} +Returns the total count of mailing lists (activated or not). +=cut + sub get_lists_total { my $self = shift; - return $self->{'lists'}{'total'}; + unless(defined $self->{lists}{total}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_ml'; + ($self->{lists}{total}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{lists}{total}; } @@ -266,26 +195,42 @@ sub get_web_in_moderation { my $self = shift; - return $self->{'web'}{'waited'}; + unless(defined $self->{web}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{web}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{web}{awaiting_validation}; } sub get_web_activated { my $self = shift; - return $self->{'web'}{'activated'}; + unless(defined $self->{web}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{web}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{web}{activated}; } sub get_user_total { my $self = shift; - return $self->{'users'}{'total'}; + unless(defined $self->{users}{total}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_users'; + ($self->{users}{total}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{users}{total}; } sub get_user_total_admin { my $self = shift; + unless(defined $self->{users}{total_admin}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?'; + ($self->{users}{total_admin}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_ADMIN )}; + } return $self->{'users'}{'total_admin'}; } @@ -293,137 +238,193 @@ sub get_user_total_moderator { my $self = shift; - return $self->{'users'}{'total_moderator'}; + unless(defined $self->{users}{total_moderator}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_users WHERE admin=?'; + ($self->{users}{total_moderator}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::USER_MODERATOR )}; + } + return $self->{users}{total_moderator}; } - sub get_dns_in_moderation { my $self = shift; - return $self->{'dns'}{'waited_validation'}; + unless(defined $self->{dns}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?'; + ($self->{dns}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{dns}{awaiting_validation}; } sub get_dns_activated { my $self = shift; - return $self->{'dns'}{'activated'}; + unless(defined $self->{dns}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_dns w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?'; + ($self->{dns}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{dns}{activated}; } sub get_mail_in_moderation { my $self = shift; - return $self->{'mail'}{'waited_validation'}; + unless(defined $self->{mail}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{mail}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{mail}{awaiting_validation}; } sub get_mail_activated { my $self = shift; - return $self->{'mail'}{'activated'}; + unless(defined $self->{mail}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_mxdomain w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{mail}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{mail}{activated}; } sub get_mail_total_boxes { my $self = shift; - return $self->{'mail'}{'total_boxes'}; + unless(defined $self->{mail}{total_boxes}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_boxes'; + ($self->{mail}{total_boxes}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{mail}{total_boxes}; } sub get_mail_total_forwards { my $self = shift; - return $self->{'mail'}{'total_forwards'}; + unless(defined $self->{mail}{total_forwards}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_forward'; + ($self->{'mail'}{'total_forwards'}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{mail}{total_forwards}; } - sub get_cvs_in_moderation { my $self = shift; - return $self->{'cvs'}{'waited_validation'}; + unless(defined $self->{cvs}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?'; + ($self->{cvs}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{cvs}{awaiting_validation}; } sub get_cvs_activated { my $self = shift; - return $self->{'cvs'}{'activated'}; + unless(defined $self->{cvs}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_cvs w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state=?'; + ($self->{cvs}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{cvs}{activated}; } sub get_svn_in_moderation { my $self = shift; - return $self->{'svn'}{'waited_validation'}; -} + unless(defined $self->{svn}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{svn}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; - -sub get_largefile_in_moderation -{ - my $self = shift; - return $self->{'largefile'}{'waited_validation'}; + } + return $self->{svn}{awaiting_validation}; } -sub get_largefile_total -{ - my $self = shift; - return $self->{'largefile'}{'total'}; -} sub get_svn_activated { my $self = shift; - return $self->{'svn'}{'activated'}; + unless(defined $self->{svn}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_svn w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state='.Vhffs::Constants::ACTIVATED; + ($self->{'svn'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{svn}{activated}; } -sub get_largefile_activated -{ - my $self = shift; - return $self->{'largefile'}{'activated'}; -} - sub get_mysql_in_moderation { my $self = shift; - return $self->{'mysql'}{'waited_validation'}; + unless(defined $self->{mysql}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{mysql}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{mysql}{awaiting_validation}; } sub get_mysql_activated { my $self = shift; - return $self->{'mysql'}{'activated'}; + unless(defined $self->{mysql}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_mysql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{'mysql'}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{mysql}{activated}; } sub get_pgsql_in_moderation { my $self = shift; - return $self->{'pgsql'}{'waited_validation'}; + unless(defined $self->{pgsql}{awaiting_validation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{pgsql}{awaiting_validation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + + } + return $self->{pgsql}{awaiting_validation}; } sub get_pgsql_activated { my $self = shift; - return $self->{'pgsql'}{'activated'}; + unless(defined $self->{pgsql}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_pgsql w INNER JOIN vhffs_object o ON o.object_id=w.object_id WHERE o.state = ?'; + ($self->{pgsql}{activated}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::ACTIVATED )}; + } + return $self->{pgsql}{activated}; } sub get_groups_in_moderation { my $self = shift; - return $self->{'groups'}{'waited_moderation'}; + unless(defined $self->{groups}{awaiting_moderation}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state = ? AND u.username IS NULL'; + ($self->{groups}{awaiting_moderation}) = @{$self->{db}->selectrow_arrayref( $sql, undef, Vhffs::Constants::WAITING_FOR_VALIDATION )}; + } + return $self->{groups}{awaiting_moderation}; } sub get_groups_activated { my $self = shift; - return $self->{'groups'}{'activated'}; + unless(defined $self->{groups}{activated}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id=g.object_id LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE o.state='.Vhffs::Constants::ACTIVATED.' AND u.username IS NULL'; + ($self->{groups}{activated}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{groups}{activated}; } sub get_groups_total { my $self = shift; - return $self->{'groups'}{'total'}; + unless(defined $self->{groups}{total}) { + my $sql = 'SELECT COUNT(*) FROM vhffs_groups g LEFT JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL'; + ($self->{groups}{total}) = @{$self->{db}->selectrow_arrayref( $sql )}; + } + return $self->{groups}{total}; } 1; + + Modified: trunk/vhffs-api/src/Vhffs/User.pm =================================================================== --- trunk/vhffs-api/src/Vhffs/User.pm 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/Vhffs/User.pm 2007-04-15 21:17:33 UTC (rev 561) @@ -34,152 +34,100 @@ package Vhffs::User; #Vhffs::User written by sod` <dieu AT gunnm DOT org> - #Vhffs::User implements Unix authentification as an module of Vhffs. #You can manage user with Unix. #libnss-postgresql must be used with it to have an account on a machine with the database +=pod -use base qw(Vhffs::Object); -use strict; -use DBI; -use Vhffs::Group; -use Vhffs::Functions; +=head1 NAME +Vhffs::User - Vhffs Interface to handle *NIX users +=head1 SYNOPSIS -sub new -{ - my $main; - my $uid; - my $name; - my $this; - my $self; - my $class; - - $class = shift; - $main = shift; - $name = shift; - $uid = shift; + use Vhffs::Main; + $vhffs = init Vhffs::Main; + $user = Vhffs::User::get_by_username( $vhffs , "myuser" ); + if( defined $user ) + { + print "User exists\n"; + } + else + { + print "User does not exists\n"; + } + ... + $user = Vhffs::User::create( $vhffs, 'myuser', 'apassword', 0, 'myuser@xxxxxxxxx'); + if( defined $user ) + { + print "User created"; + } + else + { + print "User error\n"; + } + ... + print "Username: $user->get_username"; + ... + if( $user->commit > 0 ) + { + print "Update user status : succesfull\n"; + } +=head1 METHODS - $this = {}; - - if( ! defined( $name ) ) - { - $name = get_name_by_uid( $main , $uid ); - } +=cut - return undef if( ! defined $name ); - return undef if( length( $name ) < 3 ); - return undef if( length( $name ) > 12 ); - return undef if( ! ( $name =~ /^[a-z0-9]+$/ ) ); - - $this = $class->SUPER::new( $main , 1 , $uid ); - $this->{'username'} = $name; - $this->{'uid'} = $uid if ( defined $uid ); - $this->{'group'} = new Vhffs::Group( $main , $name , $uid ); - $this->{'admin'} = 0; - - bless( $this , $class ); -} +use base qw(Vhffs::Object); +use strict; +use DBI; +use Vhffs::Group; +use Vhffs::Functions; - -sub exists -{ - my $self; - my $request; - - $self = shift; - - $request = $self->{'db'}->{'DB_WRITE'}->prepare("SELECT * FROM vhffs_users WHERE username = $self->{'username'}" ) or return -1; - - return -2 if ( ! defined $request->execute() ); - - return 1; +sub _new { + my ($class, $main, $uid, $gid, $oid, $username, $passwd, $homedir, $shell, $admin, $firstname, $lastname, $address, $zipcode, $city, $country, $mail, $gpg_key, $note, $language, $theme, $date_creation, $description, $state) = @_; + my $self = $class->SUPER::_new($main, $oid, $uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_USER); + return undef unless(defined $self); + $self->{uid} = $uid; + $self->{gid} = $gid; + $self->{username} = $username; + $self->{passwd} = $passwd; + $self->{homedir} = $homedir; + $self->{shell} = $shell; + $self->{admin} = $admin; + $self->{firstname} = $firstname; + $self->{lastname} = $lastname; + $self->{address} = $address; + $self->{zipcode} = $zipcode; + $self->{city} = $city; + $self->{country} = $country; + $self->{mail} = $mail; + $self->{gpg_key} = $gpg_key; + $self->{note} = $note; + $self->{language} = $language; + $self->{theme} = $theme; + return $self; } +=pod +=head2 exists -# get unix informations for a user : uid, gid, username, status, homedir, ... -sub fetch_unix -{ - my $request; - my $result; - my $query; - my $gid; - my $self; - my %hash; - my $rows; + print "User $username already exists\n" if(Vhffs::User::exists($username)); - $self = shift; +Indicates wether an username is already taken. - $query = "SELECT * FROM vhffs_users where uid='".$self->{'uid'}."'" if( defined $self->{'uid'} ); - $query = "SELECT * FROM vhffs_users where username='".$self->{'username'}."'" if( defined $self->{'username'} ); - - - $request = $self->{'db'}->{'DB_READ'}->prepare( $query ) or return -2; - - $rows = $request->execute() or return -2; +=cut - if ( $rows > 0 ) - { - $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{"$_"} = $result->{$_} - } - return 1; - } - else - { - return -1; - } - -} - - -# get a complete user -# it fetch informations in the vhffs_users table and vhffs_user_info -sub fetch +sub exists { - my $self; - my $request; - my $result; - my $ret; + my ($main, $username) = @_; - $self = shift; - - return $ret if( ( $ret = $self->fetch_unix() ) < 0 ); - - $request = $self->{'db'}->{'DB_READ'}->prepare("SELECT * FROM vhffs_user_info where uid=$self->{'uid'}") or return -2; - - $request->execute() or return -2; - - $result = $request->fetchrow_hashref(); - - - foreach ( keys %{$result} ) - { - $self->{$_} = $result->{$_} - } - - $self->{'group'}->fetch; - - my $v; - foreach $v qw(firtname lastname address zipcode city country) - { - $self->{$v} =~ s/[\\]*//g if( defined $self->{$v} ); - } - - $self->SUPER::fetch; - return 1; + return ($main->get_db_object()->do('SELECT uid FROM vhffs_users WHERE username = ?', undef, $username) > 0); } - #add a user to a group sub add_group { @@ -190,112 +138,115 @@ $self = shift; $group = shift; - return -1 if ( $group->fetch < 0 ) ; + return -1 if ( !defined $group ) ; - $request = $self->{'db'}->{'DB_WRITE'}->prepare("INSERT INTO vhffs_user_group VALUES( $self->get_uid , $group->get_gid )"); + $request = $self->{'db'}->prepare('INSERT INTO vhffs_user_group VALUES( ?, ? )') or return -2; - $request->execute() or return -2; + $request->execute($self->get_uid, $self->get_gid) or return -2; return 1; } +=pod -#create a new user with username and password -sub create -{ - my $self; - my $config; - my $conf; - my $group; - my $resultuid; - my $uid; - my $gid; - my $request; - my $query; - my $rows; - my $badusers; - my $homedir; +=head2 check_username - ( $self ) = @_ ; - - - $conf = $self->{'main'}->get_config->get_users; - $badusers = $self->{'main'}->get_config->get_bad_username; + print 'Username valid' if(Vhffs::User::check_username($username)); - if( defined $badusers ) - { +returns false if username is not valid (length not between 3 and 12, name not +composed of alphanumeric chars) - foreach ( @{$badusers} ) - { - return -10 if ( $_ eq $self->{"username"} ); - } - } +=cut + +sub check_username($) { + my $username = shift; + return ( defined($username) && ($username =~ /^[a-z0-9]{3,12}$/) ); - - $self->{'username'} =~ tr/A-Z/a-z/; +} +=pod - #verify if a user already exists - $request = $self->{'db'}->{'DB_WRITE'}->prepare("SELECT * FROM vhffs_users WHERE username='" . $self->{'username'} . "'"); - $rows = $request->execute; - return -1 if ( $rows != 0 ); +=head2 create - #verify if a group with the name of the user already exists - $request = $self->{'db'}->{'DB_WRITE'}->prepare("SELECT * FROM vhffs_groups WHERE groupname='" . $self->{'username'} . "'"); - $rows = $request->execute; - return -1 if ( $rows != 0 ); + my $u = Vhffs::User::create($main, $username, $password, $admin, + $mail, $firstname, $lastname, $city, $zipcode, + $country, $address, $gpg_key); - #compute the UID, set the minuid if not found - $uid = $conf->{'minuid'}; - $resultuid = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(uid) , MAX(gid) FROM vhffs_users"); - $uid = $resultuid->[0][0] if ( defined $resultuid->[0][0] ); - $uid++; +Create in DB and return a fully functional user. - $self->{'uid'} = $uid; - $self->{'owner_uid'} = $uid; - - my $oid = $self->SUPER::create(); - return -1 if ( $oid lt 0 ); - - $self->{'admin'} = 0 if ( ! defined $self->{'admin'} ); - - # get UID and GID for the current user. If gid is not given in parameters, we take the max of gid and create a group with the username - - $homedir = Vhffs::Functions::hash_homename( $self->{'username'} , $self->{'main'} ); +=cut - $request = $self->{'db'}->{'DB_WRITE'}->prepare("INSERT INTO vhffs_users VALUES('" . $self->{'uid'} ."' , '3' , '$self->{'username'}' , '".$conf->{'shell'}."' , '' , '$homedir' , '".$self->{'admin'}."' , '$oid')"); +sub create { + my ( $main, $username, $password, $admin, $mail, $firstname, $lastname, $city, $zipcode, $country, $address, $gpg_key ) = @_; + return undef unless check_username($username); - $request->execute() or return -2; - + my $userconf = $main->get_config->get_users; + my $badusers = $main->get_config->get_bad_username; + my $user; - $request = $self->{'db'}->{'DB_WRITE'}->prepare( "INSERT INTO vhffs_user_info VALUES( '". $self->{'uid'} ."' , now() , NULL , NULL , NULL , NULL , NULL, NULL, NULL , NULL)" ); - $request->execute or return -2; + foreach ( @{$badusers} ) { + return undef if ( $_ eq $username ); + } - - - #Now, create the GID - $self->{'group'} = new Vhffs::Group( $self->{'main'} , $self->{'username'} , $self->{'uid'} ); - $gid = $self->{'group'}->create; - return -1 if ( $gid < 0 ); - $self->{'group'}->set_status( Vhffs::Constants::ACTIVATED ); - $self->{'group'}->commit; - $self->{'gid'} = $gid; + my $dbh = $main->get_db_object; + # Localize RaiseError so it get restored after we finish + # With this enabled, DBI automagically call die if a + # query goes wrong. + local $dbh->{RaiseError} = 1; + $dbh->begin_work; + eval { + # object(owner_uid) references user(uid) and user(object_id) object(object_id) + # so we have to tell pg that constraints shouldn't be checked before the end + # of transaction + $dbh->do('SET CONSTRAINTS ALL DEFERRED'); + + my ($uid) = $dbh->selectrow_array('SELECT nextval(\'vhffs_users_uid_seq\')'); + my ($gid) = $dbh->selectrow_array('SELECT nextval(\'vhffs_groups_gid_seq\')'); + + # Create corresponding object + my $parent = Vhffs::Object::create($main, $uid, '', undef, Vhffs::Constants::TYPE_USER); + die('Error creating parent') unless (defined $parent); + # Insert base information + $admin = 0 unless (defined $admin); + my $homedir = Vhffs::Functions::hash_homename( $username , $main ); + $firstname = $userconf->{'default_firstname'} unless ( defined $firstname ); + $lastname = $userconf->{'default_lastname'} unless ( defined $lastname ); + $address = $userconf->{'default_address'} unless ( defined $address ); + $zipcode = $userconf->{'default_zipcode'} unless ( defined $zipcode ); + $city = $userconf->{'default_city'} unless ( defined $city ); + $mail = $userconf->{'default_mail'} unless ( defined $mail ); + $gpg_key = " " unless ( defined $gpg_key && $gpg_key ne "" ); + $country = $userconf->{'default_country'} unless ( defined $country ); - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_users SET gid = '" . $self->{'gid'} . "' WHERE username='" . $self->{'username'}."'") or return -2; - $request->execute or return -3; + my $sth = $dbh->prepare('INSERT INTO vhffs_users (uid, gid, username, shell, passwd, homedir, admin, firstname, lastname, address, zipcode, city, country, mail, gpg_key, note, language, theme, object_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?)'); + $sth->execute($uid, $gid, $username, $userconf->{'shell'}, Vhffs::Functions::password_encrypt($password), $homedir, $admin, $firstname, $lastname, $address, $zipcode, $city, $country, $mail, $gpg_key, Vhffs::Constants::DEFAULT_LANG, Vhffs::Constants::DEFAULT_THEME, $parent->get_oid); + + my $group = Vhffs::Group::create($main, $username, $uid, $gid); + die('Error creating group') unless (defined $group); + $group->set_status(Vhffs::Constants::ACTIVATED); + $group->commit; - $self->commit; - - return $self->{'uid'}; -} + $dbh->commit; + $user = get_by_uid($main, $uid); + }; + if($@) { + warn "Error creating user : $@\n"; + $dbh->rollback; + undef $user; + } + return $user; +} - #modify a user -#use as this : modify_user($db->{'DB_WRITE'} , username , field , value); -#Example : modify_user($db->{'DB_WRITE'} , "soda" , "shell" , "/bin/bash"); +#use as this : modify_user($db , username , field , value); +#Example : modify_user($db , "soda" , "shell" , "/bin/bash"); +# +# DEPRECATED WILL BE REMOVED use set_xxx instead +# +# sub modify { my $field; @@ -309,20 +260,14 @@ return -2 if( $field eq "username" ); - # if the field is username, shell, passwd or homedir, we will modify the vhffs_users table - # if not, we modify vhffs_user_info table if ( $field eq "passwd" ) { - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_users SET passwd=" + Vhffs::Main::password_encrypt $value + " WHERE uid='$self->{'uid'}'") or return -3; + $request = $self->{'db'}->prepare("UPDATE vhffs_users SET passwd='" + Vhffs::Main::password_encrypt $value + "' WHERE uid='$self->{'uid'}'") or return -3; } - elsif( $field =~ /shell|status|homedir/ ) - { - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_users SET $field='$value' WHERE uid='$self->{'uid'}'") or return -3; - } else { - $request = $self->{'db'}->{'DB_WRITE'}->prepare("UPDATE vhffs_user_info SET $field='$value' WHERE uid='$self->{'uid'}'") or return -3; + $request = $self->{'db'}->prepare("UPDATE vhffs_users SET $field='$value' WHERE uid='$self->{'uid'}'") or return -3; } $request->execute() or return -4; @@ -349,26 +294,14 @@ $self->{'gpg_key'} = " " if( ( ! defined $self->{'gpg_key'} ) || ( $self->{'gpg_key'} eq "" ) ); $self->{'country'} = $self->{'main'}->get_config->get_users->{'default_country'} if ( !defined $self->{'country'} ); - my $v; - foreach $v qw(firstname lastname address zipcode city country) - { - $self->{$v} = quotemeta ( $self->{$v} ); - } - - my $request_info = "UPDATE vhffs_user_info SET firstname='".$self->{'firstname'} ."', lastname='".$self->{'lastname'}."', address='".$self->{'address'}."', zipcode='".$self->{'zipcode'}."', country='".$self->{'country'}."', mail='".$self->{'mail'}."', city='".$self->{'city'}."', gpg_key='".$self->{'gpg_key'}."' WHERE uid='".$self->{'uid'}."'"; - -# print $request_info; - - my $request_unix = "UPDATE vhffs_users SET shell='".$self->{'shell'}."', passwd='".$self->{'passwd'}."', admin=".$self->{'admin'}." WHERE uid=".$self->{'uid'}; - - return -1 if( $self->SUPER::commit < 0 ); - my $result_unix = $self->{'db'}->{'DB_WRITE'}->prepare($request_unix) or return -1; - $result_unix->execute or return -4; - my $result_info = $self->{'db'}->{'DB_WRITE'}->prepare($request_info) or return -2; - $result_info->execute or return -3; - + my $sql = 'UPDATE vhffs_users SET shell = ?, passwd = ?, admin = ?, firstname = ?, lastname = ?, address = ?, zipcode = ?, country = ?, mail = ?, city = ?, gpg_key = ? WHERE uid = ?'; + my $sth = $self->{db}->prepare($sql) or return -1; + $sth->execute($self->{'shell'}, $self->{'passwd'}, $self->{'admin'}, + $self->{'firstname'}, $self->{'lastname'}, $self->{'address'}, $self->{'zipcode'}, + $self->{'country'}, $self->{'mail'}, $self->{'city'}, $self->{'gpg_key'}, $self->{'uid'}) or return -3; + return 1; } @@ -383,8 +316,6 @@ $self = shift; - return -1 if ($self->fetch < 0 ); - return -1 if ( ! defined $self->{'username'} ); return -1 if ( ! defined $self->{'uid'} ); return -2 if ( $self->{'group'}->delete < 0 ); @@ -403,26 +334,13 @@ } } - $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_panel_user_prefs WHERE uid='".$self->{'uid'}."'"); - $request->execute() or return -2; - - $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_users WHERE uid='".$self->{'uid'}."'"); - $request->execute() or return -1; - - $request = $self->{'db'}->{'DB_WRITE'}->prepare("DELETE FROM vhffs_user_group WHERE uid='".$self->{'uid'}."'"); - $request->execute() or return -2; - - - $self->SUPER::delete; - - return 1; + # User references corresponding object with an ON DELETE cascade foreign key + # so we don't even need to delete user + # rows that reference this user will be deleted by foreign keys constraints + return $self->SUPER::delete; } - - - - sub uid_exists { my ( $dbh , $uid ) = @_; @@ -430,11 +348,11 @@ return -1 if ( !defined $uid); - $request = $dbh->prepare("SELECT * FROM vhffs_users WHERE uid= '$uid'"); - $request->execute; + $request = $dbh->prepare('SELECT COUNT(*) FROM vhffs_users WHERE uid=?'); + $request->execute($uid); - return -1 if ( $request->rows != 1 ); - + my ($result) = $request->fetchrow_array(); + return $result; } @@ -598,30 +516,23 @@ sub get_lang { my $self = shift; - - my $query = "SELECT language FROM vhffs_panel_user_prefs WHERE uid='".$self->get_uid."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - my $rows = $request->execute; - - if( $rows == 0 ) - { - return Vhffs::Constants::DEFAULT_LANG; - } - else - { - my $value = $request->fetchrow_arrayref; - return $value->[0]; - } + my $request; + return $self->{language}; } - sub get_mail { my $self = shift; return $self->{'mail'}; } +sub get_theme +{ + my $self = shift; + return $self->{theme}; +} + sub get_address { my $self = shift; @@ -645,7 +556,7 @@ { my $self = shift; my $value = shift; - $self->{'shell'} = quotemeta $value; + $self->{'shell'} = $value; } @@ -653,21 +564,21 @@ { my $self = shift; my $value = shift; - $self->{'firstname'} = quotemeta $value; + $self->{'firstname'} = $value; } sub set_lastname { my $self = shift; my $value = shift; - $self->{'lastname'} = quotemeta $value; + $self->{'lastname'} = $value; } sub set_city { my $self = shift; my $value = shift; - $self->{'city'} = quotemeta $value; + $self->{'city'} = $value; } @@ -683,14 +594,14 @@ { my $self = shift; my $value = shift; - $self->{'country'} = quotemeta $value; + $self->{'country'} = $value; } sub set_address { my $self = shift; my $value = shift; - $self->{'address'} = quotemeta $value; + $self->{'address'} = $value; } sub set_mail @@ -772,9 +683,9 @@ sub get_name_by_uid { my $main = shift; - my $gid = shift; - my $request = $main->{'db'}->{'DB_READ'}->prepare("SELECT username FROM vhffs_users where uid='".$gid."'") or return -2; - my $rows = $request->execute(); + my $uid = shift; + my $request = $main->{'db'}->prepare('SELECT username FROM vhffs_users where uid=?') or return -2; + my $rows = $request->execute($uid); if( $rows == 0 ) { @@ -782,8 +693,8 @@ } else { - my $result = $request->fetchrow_hashref(); - return( $result->{username} ); + my ($result) = $request->fetchrow_array(); + return $result; } } @@ -794,21 +705,26 @@ my $state = shift ; my $name = shift ; my @users; + my @params; return if( ! defined $vhffs ); my $query; - $query = "SELECT username FROM vhffs_users vu , vhffs_user_info vi, vhffs_object o WHERE vu.uid=vi.uid AND o.object_id=vu.object_id "; - $query.= " AND ( vu.username LIKE '%".$name."%' OR vi.firstname LIKE '%".$name."%' OR vi.lastname LIKE '%".$name."%' )" if( defined $name ); - $query.= " AND o.state='".$state."'" if( defined $state ); + $query = 'SELECT username FROM vhffs_users vu INNER JOIN vhffs_object o ON o.object_id = vu.object_id WHERE o.object_id=vu.object_id '; + if(defined $name) { + $name = "\%$name\%"; + $query.= ' AND ( vu.username LIKE ? OR vu.firstname LIKE ? OR vu.lastname LIKE ? )'; + push @params, $name, $name, $name; + } + (push(@params, $state), $query.= ' AND o.state=?') if( defined $state ); $query.="ORDER BY username"; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); - $request->execute; - while( my $row = $request->fetchrow_arrayref ) + my $request = $vhffs->{'db'}->prepare( $query ); + $request->execute(@params); + while( my ($name) = $request->fetchrow_array ) { - my $user = new Vhffs::User( $vhffs , $row->[0] , '401' ); - if( ( defined $user ) && ( $user->fetch > 0 ) ) + my $user = Vhffs::User::get_by_username( $vhffs , $name ); + if( defined $user ) { push @users , $user; } @@ -825,13 +741,13 @@ return if ( !defined $vhffs ); - my $query = "SELECT username FROM vhffs_users ORDER BY uid DESC LIMIT 10"; - my $request = $vhffs->{'db'}->{'DB_READ'}->prepare( $query ); + my $query = 'SELECT uid FROM vhffs_users ORDER BY uid DESC LIMIT 10'; + my $request = $vhffs->{'db'}->prepare( $query ); $request->execute; - while( my $row = $request->fetchrow_arrayref ) + while( my ($uid) = $request->fetchrow_array ) { - my $user = new Vhffs::User( $vhffs , $row->[0] , '401' ); - if( $user->fetch > 0 ) + my $user = Vhffs::User::get_by_uid( $vhffs , $uid ); + if( defined $user ) { push @users , $user; } @@ -845,16 +761,15 @@ { my $self = shift; - return undef if( $self->fetch < 0 ); my @groups; my $uid = $self->get_uid; - my $query = "SELECT g.groupname FROM vhffs_groups g, vhffs_user_group ug WHERE ug.uid='".$uid."' AND g.gid=ug.gid ORDER BY g.groupname"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - return undef if( $request->execute <= 0 ); - while( my $row = $request->fetchrow_arrayref ) + my $query = 'SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid WHERE ug.uid=? ORDER BY g.groupname'; + my $request = $self->{'db'}->prepare( $query ); + return undef if( ! $request->execute($uid) ); + while( my ($groupname) = $request->fetchrow_array ) { - my $group = new Vhffs::Group( $self->{'main'} , $row->[0] , '401' ); - push( @groups , $group ) if( $group->fetch ); + my $group = Vhffs::Group::get_by_groupname( $self->{'main'} , $groupname ); + push( @groups , $group ) if( defined($group) ); } return \@groups; } @@ -864,161 +779,61 @@ { my $self = shift; - return -1 if( $self->fetch < 0 ); my $uid = $self->get_uid; - my $query = "SELECT COUNT(g.groupname) FROM vhffs_groups g, vhffs_user_group ug, vhffs_object o WHERE ug.uid='".$uid."' AND g.gid=ug.gid AND o.object_id=g.object_id AND o.state='".Vhffs::Constants::ACTIVATED."'"; - my $request = $self->{'db'}->{'DB_READ'}->prepare( $query ); - return -1 if( $request->execute <= 0 ); + my $query = 'SELECT COUNT(g.groupname) FROM vhffs_groups g, vhffs_user_group ug, vhffs_object o WHERE ug.uid=? AND g.gid=ug.gid AND o.object_id=g.object_id AND o.state='.Vhffs::Constants::ACTIVATED; + my $request = $self->{'db'}->prepare( $query ); + return -1 if( !$request->execute($uid) ); my $row = $request->fetchrow_arrayref; return -1 if ( ! defined $row ); return $row->[0]; } -1; +sub get_by_uid { + my ($main, $uid) = @_; + my $query = 'SELECT u.uid, u.gid, u.object_id, u.username, u.passwd, u.homedir, u.shell, u.admin, u.firstname, u.lastname, u.address, u.zipcode, u.city, u.country, u.mail, u.gpg_key, u.note, u.language, u.theme, o.date_creation, o.description, o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.uid = ?'; + my $dbh = $main->get_db_object; + my @params = $dbh->selectrow_array($query, undef, $uid); + return undef unless(@params); + my $user = _new Vhffs::User($main, @params); + $user->{group} = Vhffs::Group::get_by_gid($main, $user->get_gid); + return $user; +} -__END__ +=pod -=head1 NAME +=head2 get_by_username -Vhffs::User - Vhffs Interface to handle *NIX users + my $user = Vhffs::User::get_by_username($main, $username); + die('User not found') unless defined($user); -=head1 SYNOPSIS +Fetches an user using its username. Returned user is fully functional. - use Vhffs::Main; - $vhffs = init Vhffs::Main; - $user = new Vhffs::User( $vhffs , "myuser" , 401 ); - if( $user->fetch > 0 ) - { - print "User exists\n"; - } - else - { - print "User does not exists\n"; - } - ... - if( $user->create > 0 ) - { - print "User created"; - } - else - { - print "User error\n"; - } - ... - print "Username: $user->get_username"; - ... - if( $user->commit > 0 ) - { - print "Update user status : succesfull\n"; - } +=cut -=head1 METHODS +sub get_by_username { + my ($main, $username) = @_; + my $query = 'SELECT u.uid, u.gid, u.object_id, u.username, u.passwd, u.homedir, u.shell, u.admin, u.firstname, u.lastname, u.address, u.zipcode, u.city, u.country, u.mail, u.gpg_key, u.note, u.language, u.theme, o.date_creation, o.description, o.state FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id = u.object_id WHERE u.username = ?'; + my $dbh = $main->get_db_object; + my @params = $dbh->selectrow_array($query, undef, $username); + return undef unless(@params); + my $user = _new Vhffs::User($main, @params); + $user->{group} = Vhffs::Group::get_by_gid($main, $user->get_gid); + return $user; -For each method, returns 1 if success, 0 otherwise. If the method should returns a reference, returns undef if fails. +} -new( Vhffs::Main , "username" , "uid" ) : instanciate a new user +1; -exists( ) : return 1 if the user exists, 0 otherwise +__END__ -fetch( ) : fetch informations for this user from the database. You have to call fetch before working on the user - -get_all_unix_users( ) - static method : returns a hashref with all unix users. Hashkey is the username - -get_all_users( ) - static method : returns a hashref with all users. Hashkey is the username - -add_group( Vhffs::Group ) : add a user in a group. Returns 1 if success, 0 otherwise - -create( ) : create the user. Returns 1 if success, 0 otherwise - -commit( ) : commit changes on the current instance on the database - -delete( ) : delete the user from the platform - -send_mail( $subject , $content ) : send a mail to the user. The subject of the mail is the first argument, the second if the content of the mail - -generate_password( ) : generate a new password for this user. Returns the password. - -get_username( ) - -get_firstname( ) - -get_lastname( ) - -get_city( ) - -get_country( ) - -get_gpg( ) - -get_zipcode( ) - -get_home( ) - -get_password( ) : returns the encrypted password - -set_password( $clear ) : set a new password. New password is given in the argument - -get_uid( ) - -get_gid( ) - -get_lang( ) - -get_mail( ) - -get_group( ) - -get_address( ) - -get_shell( ) - -set_username( $name ) - -set_firstname( $firstname ) - -set_lastname( $lastname ) - -set_city( $city ) - -set_country( $country ) - -set_gpg( $gpg ) - -set_zipcode( $zc ) - -set_admin( 1 or 0 ) - -set_mail( $mail ) - -set_address( ) - -set_shell( ) - -is_admin( ) : returns 1 if the user is admin 0 otherwise - -is_moderator( ) : returns 1 if the user is moderator 0 otherwise - -get_name_by_uid( $uid ) : returns the name that correspond to the uid given in parameter. Return "nobody" if no user own this uid - -getall( Vhffs::Main , $state , $name ) - -get_last_users( ) : returns an array with the last 10 users - -get_groups( ) : returns a arrayred with the groups of the user - -have_groups( ) : returns 0 if user don't have groups, else returns the number of groups, returns < 0 if an error occured - - - - - - =head1 SEE ALSO Vhffs::Group , Vhffs::Main , Vhffs::Constants -=head1 AUTHOR +=head1 AUTHORS Julien Delange <julien at tuxfamily dot org> + +Sebastien Le Ray <beuss at tuxfamily dot org> Modified: trunk/vhffs-api/src/examples/add_acl.pl =================================================================== --- trunk/vhffs-api/src/examples/add_acl.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/add_acl.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,31 +3,23 @@ use strict; -use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::Httpd; use Vhffs::Acl; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername username level\n") if(@ARGV != 3); +my ($servername, $username, $level) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -my $httpd = new Vhffs::Services::Httpd( $princ , "proutlol2.com" , $user ); +my $httpd = Vhffs::Services::Httpd::get_by_servername($princ, $servername); +die("Webarea $servername not found\n") unless(defined $httpd); -Vhffs::Acl::add_acl( $user , $httpd , 3 , $princ ); +Vhffs::Acl::add_acl( $user, $httpd, $level, $princ ); Modified: trunk/vhffs-api/src/examples/add_acl_dns.pl =================================================================== --- trunk/vhffs-api/src/examples/add_acl_dns.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/add_acl_dns.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,32 +4,24 @@ use strict; use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::DNS; use Vhffs::Acl; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $group; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 domain user level\n") unless(@ARGV == 3); +my ($domain, $username, $level) = @ARGV; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; -$group = new Vhffs::Group( $princ , "sodalol" , 401) ; +my $dns = Vhffs::Services::DNS::get_by_domainname($princ , $domain); +die("Domain $domain not found\n") unless(defined $dns); -my $httpd = new Vhffs::Services::DNS ($princ , "prout.com" , $user , $group); +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -Vhffs::Acl::add_acl( $user , $httpd , 3 , $princ->get_db_object ); +Vhffs::Acl::add_acl($user, $dns, $level, $princ); +print "User $username has now access level $level domain $domain\n"; Modified: trunk/vhffs-api/src/examples/create_box.pl =================================================================== --- trunk/vhffs-api/src/examples/create_box.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_box.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,66 +4,18 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::Mail; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 mail_domain local_part password\n") unless(@ARGV == 3); +my ($domain, $local, $pass) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $mail = Vhffs::Services::Mail::get_by_mxdomain($princ, $domain); +die("Mail domain $domain not found\n") unless(defined $mail); -my $mail = new Vhffs::Services::Mail( $princ , $ARGV[0] , $user , $group); - -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} - - -if( $mail->fetch < 0 ) -{ - print "can't fetch mail object"; - exit 0; -} - -if( $mail->addbox("soda" , "prout") < 0 ) -{ - print "can't add this part to the mail object"; - exit 0; -} - - -my $retour = $mail->commit; - -if( $retour < 0 ) -{ - print "ERROR while create box, returns $retour \n"; -} -else -{ - print "Successfully create box : $retour \n"; -} - - -use Data::Dumper; - +die("Unable to create box $local\@$domain\n") if( $mail->addbox($local, $pass) < 0 ); +print "Box $local\@$domain successfully created\n"; Modified: trunk/vhffs-api/src/examples/create_cvs.pl =================================================================== --- trunk/vhffs-api/src/examples/create_cvs.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_cvs.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -32,12 +33,11 @@ } -$user = new Vhffs::User( $princ , "soda" , 401) ; -$group = new Vhffs::Group( $princ , "soda" , 401) ; +$user = Vhffs::User::get_by_username( $princ, 'soda' ); +$group = Vhffs::Group::get_by_groupname( $princ, 'soda' ); +my $cvs = Vhffs::Services::Cvs::create( $princ , "$ARGV[0]" , 'Sample cvs repo', $user , $group ); -my $cvs = new Vhffs::Services::Cvs( $princ , "$ARGV[0]" , $user , $group ); - if( defined $cvs ) { print "object created\n"; @@ -48,20 +48,4 @@ exit; } -if( $cvs->create > 0) -{ - print "Successfully create cvs object in the database\n"; -} -else -{ - print "ERROR while create cvs object in the database\n"; - exit( 0 ); -} - -if ( $cvs->fetch < 0 ) -{ - print "error while fetching informations in the database"; -} -$cvs->commit; - print Dumper $cvs; Modified: trunk/vhffs-api/src/examples/create_cvs_panel.pl =================================================================== --- trunk/vhffs-api/src/examples/create_cvs_panel.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_cvs_panel.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,49 +3,24 @@ use strict; -use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Panel::Cvs; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 cvsroot description owner_username owner_groupname\n") unless(@ARGV == 4); -if( $#ARGV != 0 ) -{ - print "Error ! Exec this script as it : create_cvs cvsroot"; - print "Example : create_cvs moncvs"; - exit( 0 ); -} +my ($cvsroot, $description, $username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "soda" , 401) ; -$group = new Vhffs::Group( $princ , "soda" , 401) ; +my $cvs = Vhffs::Panel::Cvs::create_cvs( $princ, $cvsroot, $description, $user, $group ); - -my $cvs = Vhffs::Panel::Cvs::create_cvs( $princ , "$ARGV[0]" , $user , $group ); - - -if( $cvs > 0) -{ - print "Successfully create cvs object in the database\n"; -} -else -{ - print "ERROR while create cvs object in the database\n"; - exit( 0 ); -} - +die("Unable to create cvs $cvsroot\n") unless(defined $cvs); +print "CVS $cvsroot created\n"; Modified: trunk/vhffs-api/src/examples/create_dir.pl =================================================================== --- trunk/vhffs-api/src/examples/create_dir.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_dir.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Functions; print Vhffs::Functions::create_dir( "/data/prout/zozoo/pezojfzpje" ); Modified: trunk/vhffs-api/src/examples/create_dns.pl =================================================================== --- trunk/vhffs-api/src/examples/create_dns.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_dns.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,62 +12,25 @@ use Vhffs::Object; use Vhffs::Services::DNS; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage $0 domain_name, description, user, group") unless(@ARGV == 4); -if( $#ARGV != 0 ) -{ - print "Error ! Exec this script as it : create_dns domain"; - print "Example : create_dns prout.com"; -} +my ($domain, $description, $username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "sod" , 401) ; -$group = new Vhffs::Group( $princ , "prout" , 401) ; +my $dns = Vhffs::Services::DNS::create( $princ , $domain, $description, $user , $group ); - -my $dns = new Vhffs::Services::DNS( $princ , "$ARGV[0]" , $user , $group ); - if( defined $dns ) { - print "object created\n"; + print "Domain $domain successfully created\n"; } else { - print "object error\n"; - exit; + die("Unable to create object, check syntax and uniqueness\n"); } -my $retour; - -if( ( $retour = $dns->create ) > 0) -{ - print "Successfully create dns object in the database\n"; -} -else -{ - print "ERROR while create dns object in the database $retour\n"; -} - -if ( $dns->fetch < 0 ) -{ - print "error while fetching informations in the database"; -} -else -{ - print "fetch reussi\n"; -$dns->commit; - -$dns->add_a("prou" , "900.10.10.3"); -$dns->add_mx("mx.".$ARGV[0]); -} Modified: trunk/vhffs-api/src/examples/create_forward.pl =================================================================== --- trunk/vhffs-api/src/examples/create_forward.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_forward.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,66 +4,24 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::Mail; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 mxdomain localpart remote_address\n") unless(@ARGV == 3); +my ($domain, $local, $remote) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $mail = Vhffs::Services::Mail::get_by_mxdomain($princ, $domain); -my $mail = new Vhffs::Services::Mail( $princ , $ARGV[0] , $user , $group); +die("Mail domain $domain not found\n") unless(defined $mail); -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} - -if( $mail->fetch < 0 ) +if( $mail->addforward($local, $remote) < 0 ) { - print "can't fetch mail object"; - exit 0; + die "Unable to add forward $local\@". $mail->get_domain ." -> $remote\n"; } -if( $mail->addforward("soda2" , "prout" , "julien\@gunnm.org") < 0 ) -{ - print "can't add this part to the mail object"; - exit 0; -} - - -my $retour = $mail->commit; - -if( $retour < 0 ) -{ - print "ERROR while create box, returns $retour \n"; -} -else -{ - print "Successfully create box : $retour \n"; -} - - -use Data::Dumper; - +print "Forward created\n"; Modified: trunk/vhffs-api/src/examples/create_group.pl =================================================================== --- trunk/vhffs-api/src/examples/create_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,66 +3,32 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Object; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 groupname owner_username description\n") unless(@ARGV == 3); -if( $#ARGV != 0 ) -{ - print "Error ! Create a new group with : create_group groupname"; - print "Example : create_group soda"; -} +my ($groupname, $username, $description) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); -print "Creation du group $ARGV[0]\n"; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; +my $group = Vhffs::Group::create($princ, $groupname, $user->get_uid, undef, $description) ; -if( $user->fetch <= 0 ) +if( !defined $group ) { - print "Erreur, l'utilisateur pour creer le groupe n'existe pas !"; - + die "Unable to create group $groupname\n"; } - -my $group = new Vhffs::Group( $princ , $ARGV[0] , $user->get_uid) ; -#on fetche l'utilisateur -my $retour; -$retour = $group->fetch; -if ( $retour > 0 ) -{ - print "Ce groupe existe deja\n"; - exit 0; -} - - -#on le cree dans la base -my $gid = $group->create; -if( $gid lt 0 ) -{ - print "Impossible de creer ce groupe, code retour $gid \n"; - exit 0; -} else { - $user->commit; - - print "Utilisateur cree avec comme gid $gid !\n"; + print "Group $groupname created!\n"; } $group->add_user( $user ); - -exit; Modified: trunk/vhffs-api/src/examples/create_group_by_panel.pl =================================================================== --- trunk/vhffs-api/src/examples/create_group_by_panel.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_group_by_panel.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,49 +3,23 @@ use strict; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 groupname owner_username decription\n") unless(@ARGV == 3); -if( $#ARGV != 0 ) -{ - print "Error ! Create a new group with : create_group groupname"; - print "Example : create_group soda"; -} +my ($groupname, $username, $description) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -print "Creation du group $ARGV[0]\n"; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; - #add this group in database -my $retour = Vhffs::Panel::Group::create_group( $ARGV[0] , $user , $princ ); -if( $retour lt 0 ) -{ - print "Impossible de creer ce groupe\n"; - exit 0; -} -else -{ +my $group = Vhffs::Panel::Group::create_group( $groupname, $user , $princ, $description ); +die("Unable to create group $groupname\n") unless(defined $group); - print "Groupe cree !\n"; -} - - - -exit; +print("Group $groupname created\n"); Modified: trunk/vhffs-api/src/examples/create_list.pl =================================================================== --- trunk/vhffs-api/src/examples/create_list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -12,45 +13,25 @@ use Vhffs::Services::Mail; use Vhffs::Services::Mailing; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 local_part domain admin_email description owner_username owner_groupname\n") unless(@ARGV == 6); +my ($local, $domain, $admin, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "prout" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -my $mail = new Vhffs::Services::Mailing( $princ , "bla3" , "prout.com" , $user , $group); +my $mail = Vhffs::Services::Mailing::create($princ, $local, $domain, $admin, $description, $user, $group); if( defined $mail ) { - print "object created\n"; + print "Mailing list $local\@$domain created\n"; } else { - print "object error\n"; - exit; + die("Unable to create mailing list $local\@$domain, please check syntax and uniqueness\n"); } -my $retour = $mail->create; - -if( $retour < 0 ) -{ - print "ERROR while create mail object in the database, returns $retour \n"; -} -else -{ - print "Successfully create mail object in the database : $retour \n"; -} - - -use Data::Dumper; - Modified: trunk/vhffs-api/src/examples/create_mail.pl =================================================================== --- trunk/vhffs-api/src/examples/create_mail.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_mail.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,45 +12,25 @@ use Vhffs::Object; use Vhffs::Services::Mail; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage $0 domain description owner_username owner_groupname") if(@ARGV != 4); +my ($domain, $description, $username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $mail = Vhffs::Services::Mail::create( $princ , $domain, $description, $user , $group); -my $mail = new Vhffs::Services::Mail( $princ , $ARGV[0] , $user , $group); - if( defined $mail ) { - print "object created\n"; + print "Mail domain $domain created\n"; } else { - print "object error\n"; + print "Error creating domain (check syntax and uniqueness)\n"; exit; } -my $retour = $mail->create; - -if( $retour < 0 ) -{ - print "ERROR while create mail object in the database, returns $retour \n"; -} -else -{ - print "Successfully create mail object in the database : $retour \n"; -} - - -use Data::Dumper; - Modified: trunk/vhffs-api/src/examples/create_mysql.pl =================================================================== --- trunk/vhffs-api/src/examples/create_mysql.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_mysql.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,64 +12,26 @@ use Vhffs::Object; use Vhffs::Services::Mysql; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 dbname dbuser dbpass description owner_username owner_groupname\n") unless(@ARGV == 6); -if( $#ARGV != 2 ) -{ - print "Error ! Exec this script as it : create_mysql base user pass"; - print "Example : create_mysql soda prout"; -} +my ($dbname, $dbuser, $dbpass, $description, $username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $sql = Vhffs::Services::Mysql::create($princ , $dbname, $dbuser, $dbpass, $description, $user, $group); -my $sql = new Vhffs::Services::Mysql( $princ , "$ARGV[0]" , $user); - if( defined $sql ) { - print "object created\n"; + print "Mysql service $dbname created\n"; } else { - print "object error\n"; - exit; + die("Unable to create MySQL service $dbname\n"); } -if( $sql->set_dbusername( $ARGV[1] ) < 0 ) -{ - print "L'utilisateur Mysql desire est deja pris !"; - exit 0; -} -$sql->set_dbpassword( $ARGV[2] ); - -$sql->set_group( $group ); - -if( $sql->create > 0) -{ - - print "Successfully create sql object in the database\n"; -} -else -{ - print "ERROR while create sql object in the database\n"; -} - -if ( $sql->fetch < 0 ) -{ - print "error while fetching informations in the database"; -} -$sql->commit; - - Modified: trunk/vhffs-api/src/examples/create_mysql_panel.pl =================================================================== --- trunk/vhffs-api/src/examples/create_mysql_panel.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_mysql_panel.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,46 +3,25 @@ use strict; -use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Mysql; use Vhffs::Panel::Mysql; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; -if( $#ARGV != 2 ) -{ - print "Error ! Exec this script as it : create_mysql base user pass"; - print "Example : create_mysql soda prout"; -} +die("Usage: $0 dbname dbuser dbpass description owner_username owner_groupname\n") unless(@ARGV == 6); +my ($dbname, $dbuser, $dbpass, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); +my $mysql = Vhffs::Panel::Mysql::create_mysql( $princ, $dbname, $user, $group, $dbuser, $dbpass, $description ); -my $sql = Vhffs::Panel::Mysql::create_mysql( $princ , "$ARGV[0]" , $user,$group,$ARGV[1],$ARGV[2]); - -if( defined $sql ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} +die("Unable to create mysql service $dbname\n") unless(defined $mysql); +print("MySQL service created\n"); Modified: trunk/vhffs-api/src/examples/create_panel_mail.pl =================================================================== --- trunk/vhffs-api/src/examples/create_panel_mail.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_panel_mail.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,44 +4,24 @@ use strict; use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Mail; use Vhffs::Panel::Mail; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 domain description owner_username owner_groupname\n") unless(@ARGV == 4); +my ($domain, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -my $mail = Vhffs::Panel::Mail::create_mail( $princ , $ARGV[0] , $user , $group); +my $mail = Vhffs::Panel::Mail::create_mail( $princ, $domain, $description, $user, $group); -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} - - -use Data::Dumper; - -print $mail; - +die("Unable to create mail domain $domain\n") unless(defined $mail); +print("Mail domain $domain created\n"); Modified: trunk/vhffs-api/src/examples/create_postgres.pl =================================================================== --- trunk/vhffs-api/src/examples/create_postgres.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_postgres.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,66 +12,27 @@ use Vhffs::Object; use Vhffs::Services::Postgres; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; -if( $#ARGV != 2 ) -{ - print "Error ! Exec this script as it : create_postgres base user pass"; - print "Example : create_mysql soda prout"; -} +die("Usage: $0 dbname dbuser dbpass description user group\n") unless(@ARGV == 6); +my ($dbname, $dbuser, $dbpass, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "sodaproject" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -print "gros con" if ( $group->fetch < 0 ); +my $sql = Vhffs::Services::Postgres::create( $princ , $dbname, $dbuser, $dbpass, $description, $user, $group); -my $sql = new Vhffs::Services::Postgres( $princ , "$ARGV[0]" , $user , $group); - if( defined $sql ) { - print "object created\n"; + print "Postgres Service $dbname created\n"; } else { - print "object error\n"; - exit; + die("Unable to create $dbname, check syntax and uniqueness\n"); } -if( $sql->set_dbusername( $ARGV[1] ) < 0 ) -{ - print "L'utilisateur Mysql desire est deja pris !"; - exit 0; -} -$sql->set_dbpassword( $ARGV[2] ); -$sql->set_user( $user ); -$sql->set_group( $group ); - -if( $sql->create > 0) -{ - - print "Successfully create sql object in the database\n"; -} -else -{ - print "ERROR while create sql object in the database\n"; -} - -if ( $sql->fetch < 0 ) -{ - print "error while fetching informations in the database"; -} -$sql->commit; - - Modified: trunk/vhffs-api/src/examples/create_repository.pl =================================================================== --- trunk/vhffs-api/src/examples/create_repository.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_repository.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,59 +12,26 @@ use Vhffs::Object; use Vhffs::Services::Repository; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 reponame description username groupname\n") unless(@ARGV == 4); -if( $#ARGV != 0 ) -{ - print "Error ! Exec this script as it : create_repository name\nExample : create_repository mypr0n\n"; - exit( 0 ); -} +my ($reponame, $description, $username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "gradator" , 401) ; -$group = new Vhffs::Group( $princ , "gradator" , 401) ; +my $repo = Vhffs::Services::Repository::create($princ, $reponame, $description, $user, $group ); - -my $repo = new Vhffs::Services::Repository( $princ , "$ARGV[0]" , $user , $group ); - if( defined $repo ) { - print "object created\n"; + print "Repository $reponame created\n"; } else { - print "object error\n"; + print "Unable to create $reponame, check syntax and uniqueness\n"; exit; } -if( $repo->create > 0) -{ - print "Successfully created repository object in the database\n"; -} -else -{ - print "ERROR while creating repository object in the database\n"; - exit( 0 ); -} - -print "plop\n"; - -if ( $repo->fetch < 0 ) -{ - print "Error while fetching informations in the database"; -} - -$repo->commit; - -print Dumper $repo; Modified: trunk/vhffs-api/src/examples/create_user.pl =================================================================== --- trunk/vhffs-api/src/examples/create_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,72 +3,30 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Object; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username password\n") unless(@ARGV == 2); -if( $#ARGV != 0 ) -{ - print "Error ! Create a new user with : create_user username"; - print "Example : create_user soda"; -} +my ($username, $password) = @ARGV; +die("User $username already exists\n") if(Vhffs::User::exists($princ, $username)); -print "Creation du user $ARGV[0]\n"; -$user = new Vhffs::User( $princ , "$ARGV[0]" , 401) ; +my $user = Vhffs::User::create($princ, $username, $password); - -#on fetche l'utilisateur -my $retour; -$retour = $user->fetch; -if ( $retour > 0 ) +if( !defined $user ) { - print "Cet utilisateur existe deja\n"; - exit 0; + die "Unable to create user $username\n"; } - - -#on le cree dans la base -my $uid = $user->create; -if( $uid lt 0 ) -{ - print "Impossible de creer cet utilisateur, code retour $uid \n"; - exit 0; -} else { - $user->set_password("default"); - - $user->commit; - - print "Utilisateur cree avec comme uid $uid !\n"; + print "User $username created!\n"; } -$user->set_shell("/usr/bin/lol"); -$user->set_firstname("Julien"); -$user->set_lastname("Delange"); -$user->set_city("Le Neubourg"); -$user->set_zipcode("27110"); -$user->set_country("France"); -$user->set_address("10 Rue des chiens"); -$user->set_gpgkey("gpg_key"); - -$user->commit; - -$user->fetch; - exit; Modified: trunk/vhffs-api/src/examples/create_web.pl =================================================================== --- trunk/vhffs-api/src/examples/create_web.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_web.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -11,45 +12,24 @@ use Vhffs::Object; use Vhffs::Services::Httpd; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername description owner_username owner_groupname\n") unless(@ARGV == 4); +my($servername, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -my $httpd = new Vhffs::Services::Httpd( $princ , $ARGV[0] , $user , $group); +my $httpd = Vhffs::Services::Httpd::create($princ, $servername, $description, $user, $group); if( defined $httpd ) { - print "object created\n"; + print "Webarea $servername created\n"; } else { - print "object error\n"; - exit; + die "Unable to create webarea $servername\n"; } - -my $retour = $httpd->create; - -if( $retour < 0 ) -{ - print "Successfully create httpd object in the database\n"; -} -else -{ - print "ERROR while create httpd object in the database, returns $retour \n"; -} - - -use Data::Dumper; - Modified: trunk/vhffs-api/src/examples/create_web_panel.pl =================================================================== --- trunk/vhffs-api/src/examples/create_web_panel.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/create_web_panel.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,43 +3,22 @@ use strict; -use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Httpd; use Vhffs::Panel::Web; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername description owner_username owner_groupname\n") unless(@ARGV == 4); +my ($servername, $description, $username, $groupname) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -my $retour = Vhffs::Panel::Web::create_web( $princ , $ARGV[0] , $user , $group); - - -if( (!defined $retour ) || ( $retour < 0 ) ) -{ - print "ERROR while create httpd object in the database, returns $retour \n"; -} -else -{ - print "Successfully create httpd object in the database\n"; -} - - -use Data::Dumper; - +die("Unable to create webarea $servername\n") unless(defined Vhffs::Panel::Web::create_web($princ, $servername, $description, $user, $group)); +print("Webarea $servername created\n"); Modified: trunk/vhffs-api/src/examples/delbox.pl =================================================================== --- trunk/vhffs-api/src/examples/delbox.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/delbox.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -2,58 +2,24 @@ use strict; +use lib "/usr/share/vhffs/api/"; -use Data::Dumper; use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::Mail; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 mail_domain box\n") unless(@ARGV == 2); +my ($domain, $box) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "soda" , 401) ; +my $mail = Vhffs::Services::Mail::get_by_mxdomain($princ , $domain); -my $mail = new Vhffs::Services::Mail( $princ , $ARGV[0] , $user , $group); +die("Domain $domain not found\n") unless(defined $mail); -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} +die("Unable to delete box $box\@".$mail->get_domain."\n") if( $mail->delbox($box) < 0 ); +print "Box $box\@".$mail->get_domain." deleted\n"; -if( $mail->fetch < 0 ) -{ - print "can't fetch mail object"; - exit 0; -} -if( $mail->delbox("soda") < 0 ) -{ - print "can't del this part to the mail object"; - exit 0; -} -else -{ - print "sucessfull delete"; -} - - Modified: trunk/vhffs-api/src/examples/delete_acl.pl =================================================================== --- trunk/vhffs-api/src/examples/delete_acl.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/delete_acl.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -12,22 +13,18 @@ use Vhffs::Services::Httpd; use Vhffs::Acl; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername username\n") if(@ARGV != 2); +my ($servername, $username) = @ARGV; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -my $httpd = new Vhffs::Services::Httpd( $princ , "proutlol2.com" , $user ); +my $httpd = Vhffs::Services::Httpd::get_by_servername($princ, $servername); +die("Webarea $servername not found\n") unless(defined $httpd); -Vhffs::Acl::del_acl( $user , $httpd , $princ->get_db_object ); +die("Unable to delete ACL\n") unless(Vhffs::Acl::del_acl( $user , $httpd , $princ) > 0); +print "User $username has no longer access to webarea $servername\n"; Modified: trunk/vhffs-api/src/examples/generate_password.pl =================================================================== --- trunk/vhffs-api/src/examples/generate_password.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/generate_password.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,43 +3,18 @@ use strict; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username\n") unless(@ARGV == 1); -if( $#ARGV != 0 ) -{ - print "Error ! Change the password with : generate_password username"; - print "Example : generate_password soda"; -} +my ($username) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -print "changement du pass pour le user $ARGV[0]\n"; -$user = new Vhffs::User( $princ , "$ARGV[0]" , 401) ; - - -#on fetche l'utilisateur -my $retour; -$retour = $user->fetch; -if ( $retour > 0 ) -{ - - $user->generate_password; - exit 0; -} - -exit; +my $pwd = $user->generate_password; +print "New password for $username : $pwd\n"; Modified: trunk/vhffs-api/src/examples/get_list.pl =================================================================== --- trunk/vhffs-api/src/examples/get_list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/get_list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,49 +3,22 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Mail; use Vhffs::Services::Mailing; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 mladdress\n") unless(@ARGV == 1); +my ($address) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "prout" , 401) ; +my ($local, $domain) = split(/@/, $address); +die("$address is not a valid email address\n") unless(defined $local && defined $domain); -my $mail = new Vhffs::Services::Mailing( $princ , "bli4" , "prout.com" , $user , $group); +my $ml = Vhffs::Services::Mailing::get_by_mladdress($princ, $local, $domain); +die("Mailing list $address not found\n") unless(defined $ml); -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} +print Dumper $ml; - -if( $mail->fetch < 0 ) -{ - print "error while fetching\n"; -} - -use Data::Dumper; -print Dumper $mail; - Modified: trunk/vhffs-api/src/examples/hash_webdir.pl =================================================================== --- trunk/vhffs-api/src/examples/hash_webdir.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/hash_webdir.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Functions; print Vhffs::Functions::hash_webdir( "zozo.tata.com" ); Modified: trunk/vhffs-api/src/examples/hashdomain.pl =================================================================== --- trunk/vhffs-api/src/examples/hashdomain.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/hashdomain.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Functions; print Vhffs::Functions::hash_mxdomain("tuxfamily.org"); Modified: trunk/vhffs-api/src/examples/hashhome_example.pl =================================================================== --- trunk/vhffs-api/src/examples/hashhome_example.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/hashhome_example.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Functions; use Vhffs::Main; use Data::Dumper; Modified: trunk/vhffs-api/src/examples/hashpopuser.pl =================================================================== --- trunk/vhffs-api/src/examples/hashpopuser.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/hashpopuser.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Functions; print Vhffs::Functions::hash_popuser("soda"); Modified: trunk/vhffs-api/src/examples/join_group.pl =================================================================== --- trunk/vhffs-api/src/examples/join_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/join_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,46 +3,20 @@ use strict; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username groupname\n") unless(@ARGV == 2); -if( $#ARGV != 0 ) -{ - print "Error ! Join a group with : join_group groupname"; - print "Example : join_group group"; -} +my ($username, $groupname) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group not found\n") unless(defined $group); -$user = new Vhffs::User( $princ , "sodalol" , 401) ; - -my $group = Vhffs::Panel::Group::create_group( $ARGV[0] , $user , $princ ); - -if( ! defined $group) -{ - print "can't add to this group"; -} -else -{ - $group->set_description( "blablabla" ); - $group->commit; - print "Sucessfully add to this group"; -} - - -exit; +die("Unable to add $username to group $groupname\n") unless($group->add_user($user) > 0); Modified: trunk/vhffs-api/src/examples/list_themes.pl =================================================================== --- trunk/vhffs-api/src/examples/list_themes.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/list_themes.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Panel::Main; use Vhffs::Main; use Data::Dumper; Modified: trunk/vhffs-api/src/examples/mailuser.pl =================================================================== --- trunk/vhffs-api/src/examples/mailuser.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/mailuser.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -13,39 +14,27 @@ use Vhffs::Services::MailUser; use Vhffs::Panel::Mail; -my $config; -my $mysql_config; -my $services_config; -my $group; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username\n") unless(@ARGV == 1); -my $user = new Vhffs::User( $princ , "gradator" , '401' ); +my ($username) = @ARGV; + +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); + my $mu = init Vhffs::Services::MailUser( $princ , $user ); +die("Configuration error\n") if(!ref($mu)); -if( $mu->exists_forward == 1 ) -{ - print "Cet utilisateur a un forward sur le domaine\n"; +if( $mu->exists_forward == 1 ) { + print "User has a forward on this domain\n"; +} else { + print "User doesn't have forward\n"; } -else -{ - print "Cet utilisateur n'a aucun forward\n"; -} -if( $mu->exists_box == 1 ) -{ - print "Cet utilisateur a une box\n"; +if( $mu->exists_box == 1 ) { + print "User has a box\n"; +} else { + print "User doesn't have a box\n"; } -else -{ - print "Cet utilisateur n'a pas de box\n"; -} - - -#print Dumper $mu->{object}; Modified: trunk/vhffs-api/src/examples/mailuser_add_box.pl =================================================================== --- trunk/vhffs-api/src/examples/mailuser_add_box.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/mailuser_add_box.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -13,29 +14,16 @@ use Vhffs::Services::MailUser; use Vhffs::Panel::Mail; -my $config; -my $mysql_config; -my $services_config; -my $group; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username password\n") unless(@ARGV == 2); -my $user = new Vhffs::User( $princ , "gradator" , '401' ); -my $mu = init Vhffs::Services::MailUser( $princ , $user ); +my ($username, $password) = @ARGV; -if( ( my $retour = $mu->addforward( "soda\@free.fr" ) ) < 0 ) -{ - print "erreur $retour"; -} -else -{ - print "success\n"; -} +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +my $mu = init Vhffs::Services::MailUser( $princ , $user ); -#print Dumper $mu; +die("Unable to create box $username\@".$mu->{domain}."\n") unless($mu->addbox( $password ) > 0); +print "Box $username\@".$mu->{domain}." created\n"; Modified: trunk/vhffs-api/src/examples/modify_acl.pl =================================================================== --- trunk/vhffs-api/src/examples/modify_acl.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/modify_acl.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,31 +3,23 @@ use strict; -use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::Httpd; use Vhffs::Acl; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername username newlevel\n") unless(@ARGV == 3); +my ($servername, $username, $level) = @ARGV; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -my $httpd = new Vhffs::Services::Httpd( $princ , "proutlol2.com" , $user ); +my $httpd = Vhffs::Services::Httpd::get_by_servername($princ, $servername); +die("Webarea $servername not found\n") unless(defined $httpd); -Vhffs::Acl::add_acl( $user , $httpd , 2 , $princ->get_db_object ); +Vhffs::Acl::add_acl($user, $httpd , $level, $princ); Modified: trunk/vhffs-api/src/examples/modify_user.pl =================================================================== --- trunk/vhffs-api/src/examples/modify_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/modify_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -3,46 +3,21 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username new_firstname\n") unless(@ARGV == 2); +my ($username, $firstname) = @ARGV; -$user = new Vhffs::User( $princ , "sod" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User not found\n") unless(defined $user); +$user->set_firstname($firstname); +die("Unable to change firstname for user $username\n") unless($user->commit > 0); +print("User updated\n"); -#on fetche l'utilisateur -my $retour; -$retour = $user->fetch; -if ( $retour > 0 ) -{ - print "Cet utilisateur existe bien\n"; -} - - -#on le cree dans la base -$user->set_firstname("prout"); - -if( $user->commit < 0 ) -{ - print "unchanged"; -} -else -{ - print "unchanged"; -} - Modified: trunk/vhffs-api/src/examples/perm_for_user.pl =================================================================== --- trunk/vhffs-api/src/examples/perm_for_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/perm_for_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,7 +1,7 @@ #!/usr/bin/perl use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -10,27 +10,18 @@ use Vhffs::Services::Httpd; use Vhffs::Acl; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 servername username\n") unless(@ARGV == 2); +my ($servername, $username) = @ARGV; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -$user = new Vhffs::User( $princ , $ARGV[0] , 401) ; +my $httpd = Vhffs::Services::Httpd::get_by_servername($princ, $servername); +die("Webarea $servername not found\n") unless(defined $httpd); -my $sql = new Vhffs::Services::Httpd( $princ , "prout.com", $user ); - -print "Error while fetching mysql object" if( $sql->fetch < 0 ); -print "Error while fetching user object" if( $user->fetch < 0 ); - -print "permission"; -print Vhffs::Acl::what_perm_for_user($user , $sql , $princ); +print "Permission: "; +print Vhffs::Acl::what_perm_for_user($user, $httpd, $princ); print "\n"; Modified: trunk/vhffs-api/src/examples/print_domain.pl =================================================================== --- trunk/vhffs-api/src/examples/print_domain.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/print_domain.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,47 +4,18 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Services::DNS; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 domainname\n") unless(@ARGV == 1); +my ($domainname) = @ARGV; +my $dns = Vhffs::Services::DNS::get_by_domainname($princ, $domainname); -if( $#ARGV != 0 ) -{ - print "Error ! Exec this script as it : print_domain domain"; - print "Example : print_domain prout.com"; -} +die("Domain name not found\n") unless(defined $dns); -$user = new Vhffs::User( $princ , "sodalol" , 401) ; -$group = new Vhffs::Group( $princ , "sodalol" , 401) ; - -my $dns = new Vhffs::Services::DNS( $princ , $ARGV[0] , $user , $group ); - -if( ! defined $dns ) -{ - print "Error while creating the object"; - exit 0; -} - -$dns->fetch; - -use Data::Dumper; - print Dumper $dns; Modified: trunk/vhffs-api/src/examples/show_acl_per_object.pl =================================================================== --- trunk/vhffs-api/src/examples/show_acl_per_object.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_acl_per_object.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,40 +1,28 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ +#!/usr/bin/perl -I/vhffs/vhffs-api/src/ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; -use Vhffs::Object; use Vhffs::Acl; -use Vhffs::Services::Httpd; use Vhffs::Services::Mysql; -use Vhffs::Panel::DNS; -my $config; -my $mysql_config; -my $services_config; -my $group; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; +die("Usage: $0 dbname\n\tShows ACL for MySQL service dbname\n") unless(@ARGV == 1); -$user = new Vhffs::User( $princ , "soda" , 401) ; -$group = new Vhffs::Group( $princ , "sodaproject" , 401) ; +my ($dbname) = @ARGV; -my $sql = new Vhffs::Services::Mysql( $princ , $ARGV[0] , $user , $group ); +my $sql = Vhffs::Services::Mysql::get_by_dbname($princ, $dbname); -my $lol = Vhffs::Acl::getall_acl_for_user_per_object( $sql , $princ ); +die("MySQL service $dbname not found\n") unless(defined $sql); -print Dumper $lol; +my $acl = Vhffs::Acl::getall_acl_for_user_per_object( $sql , $princ ); -$lol = Vhffs::Acl::getall_acl_for_group_per_object( $sql , $princ ); +print Dumper $acl; -print Dumper $lol; +$acl = Vhffs::Acl::getall_acl_for_group_per_object( $sql , $princ ); + +print Dumper $acl; Modified: trunk/vhffs-api/src/examples/show_dns_per_group.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dns_per_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dns_per_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,33 +4,19 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; +use lib "/usr/share/vhffs/api/"; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Acl; -use Vhffs::Services::Httpd; use Vhffs::Panel::DNS; -my $config; -my $mysql_config; -my $services_config; -my $group; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 groupname\n") unless(@ARGV == 1); +my ($groupname) = @ARGV; -$group = new Vhffs::Group( $princ , "sodaproject" , 401) ; +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group $groupname not found\n") unless(defined $group); -my $lol = Vhffs::Panel::DNS::getall_dns_per_group( $group , $princ ); +print Dumper(Vhffs::Panel::DNS::getall_dns_per_group( $group , $princ )); -foreach( keys ( %{$lol} ) ) -{ - print $_ ."etat :". $lol->{$_}{'state'}; -} Modified: trunk/vhffs-api/src/examples/show_dns_per_user.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dns_per_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dns_per_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,28 +4,18 @@ use strict; use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Httpd; -use Vhffs::Acl; use Vhffs::Panel::DNS; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username\n") unless(@ARGV == 1); +my ($username) = @ARGV; -$user = new Vhffs::User( $princ , "sodalol" , 401) ; +my $user = Vhffs::User::get_by_username( $princ, $username ); +die("User $username not found\n") unless(defined $user); -print Dumper Vhffs::Panel::DNS::getall_dns_per_user( $user , $princ ); +print Dumper( Vhffs::Panel::DNS::getall_dns_per_user( $user , $princ )); Modified: trunk/vhffs-api/src/examples/show_dumper_cvs.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dumper_cvs.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dumper_cvs.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -26,11 +27,8 @@ $config = $princ->get_config; -my $user = new Vhffs::User( $princ , "soda" , '401'); -my $cvs = new Vhffs::Services::Cvs( $princ , $ARGV[0] , $user ) ; +my $cvs = Vhffs::Services::Cvs::get_by_cvsroot( $princ , $ARGV[0] ) ; -$cvs->fetch; - print Dumper $cvs; print $cvs->get_description; Modified: trunk/vhffs-api/src/examples/show_dumper_group.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dumper_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dumper_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,33 +4,17 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; +use lib "/usr/share/vhffs/api/"; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Acl; -use Vhffs::Services::Httpd; -use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 groupname\n") unless(@ARGV == 1); +my ($groupname) = @ARGV; -my $group = new Vhffs::Group( $princ , $ARGV[0] , 401) ; +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group $groupname not found\n") unless(defined $group); -$group->Vhffs::Group::fetch; - -print Dumper $group; - -print $group->get_description; - +print Dumper($group); Modified: trunk/vhffs-api/src/examples/show_dumper_object.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dumper_object.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dumper_object.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; @@ -13,24 +14,13 @@ use Vhffs::Services::Httpd; use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 objectID\n") unless(@ARGV == 1); +my ($oid) = @ARGV; -my $obj = new Vhffs::Object( $princ , $ARGV[0] , 401) ; +my $obj = Vhffs::Object::get_by_oid($princ, $oid); +die("Object #$oid not found\n") unless(defined $obj); -$obj->fetch; - print Dumper $obj; - -print $obj->get_description; - Modified: trunk/vhffs-api/src/examples/show_dumper_user.pl =================================================================== --- trunk/vhffs-api/src/examples/show_dumper_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_dumper_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,33 +4,18 @@ use strict; use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Acl; -use Vhffs::Services::Httpd; -use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username\n") unless(@ARGV == 1); +my ($username) = @ARGV; -$user = new Vhffs::User( $princ , $ARGV[0] , 401) ; +my $user = Vhffs::User::get_by_username( $princ, $username ); +die("User $username not found\n") unless(defined $user); -$user->fetch; - print Dumper $user; -print $user->get_description; - Modified: trunk/vhffs-api/src/examples/show_groups_per_user.pl =================================================================== --- trunk/vhffs-api/src/examples/show_groups_per_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_groups_per_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,33 +4,21 @@ use strict; use Data::Dumper; -use Vhffs::Conf; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; -use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Acl; -use Vhffs::Services::Httpd; use Vhffs::Panel::Group; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 username\n") unless(@ARGV == 1); +my ($username) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; +my $user = Vhffs::User::get_by_username($princ, $username); +die("User $username not found\n") unless(defined $user); -my $lol = Vhffs::Panel::Group::getall_groups_per_user( $user , $princ ); +my $groups = Vhffs::Panel::Group::getall_groups_per_user( $user , $princ ); -foreach( keys ( %{$lol} ) ) -{ - print $_; -} +print Dumper($groups); + Modified: trunk/vhffs-api/src/examples/show_last_users.pl =================================================================== --- trunk/vhffs-api/src/examples/show_last_users.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_last_users.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,6 +4,7 @@ use strict; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; Modified: trunk/vhffs-api/src/examples/show_mail_conf.pl =================================================================== --- trunk/vhffs-api/src/examples/show_mail_conf.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_mail_conf.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,5 +1,6 @@ #!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ +use lib "/usr/share/vhffs/api/"; use Vhffs::Conf; use Vhffs::User; use Vhffs::Group; Modified: trunk/vhffs-api/src/examples/show_mail_per_group.pl =================================================================== --- trunk/vhffs-api/src/examples/show_mail_per_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_mail_per_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,31 +4,18 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; +use lib "/usr/share/vhffs/api/"; use Vhffs::Group; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Acl; -use Vhffs::Services::Httpd; use Vhffs::Panel::Mail; -my $config; -my $mysql_config; -my $services_config; -my $group; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 groupname\n") unless(@ARGV == 1); +my ($groupname) = @ARGV; -$group = new Vhffs::Group( $princ , "sodaproject" , 401) ; +my $group = Vhffs::Group::get_by_groupname($princ, $groupname); +die("Group $groupname not found\n") unless(defined $group); -my $lol = Vhffs::Panel::Mail::getall_mail_per_group( $group , $princ ); - - -print Dumper $lol; +print Dumper(Vhffs::Panel::Mail::getall_mail_per_group( $group , $princ )); Modified: trunk/vhffs-api/src/examples/show_members_from_list.pl =================================================================== --- trunk/vhffs-api/src/examples/show_members_from_list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/show_members_from_list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -4,57 +4,22 @@ use strict; use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Mail; use Vhffs::Services::Mailing; -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - my $princ = init Vhffs::Main; -$config = $princ->get_config; +die("Usage: $0 mladdress\n") unless(@ARGV == 1); +my ($address) = @ARGV; -$user = new Vhffs::User( $princ , "soda" , 401) ; -my $group = new Vhffs::Group( $princ , "prout" , 401) ; +my ($local, $domain) = split(/@/, $address); +die("$address is not a valid email address\n") unless(defined $local && defined $domain); -my $mail = new Vhffs::Services::Mailing( $princ , "maliste" , "prout.com" , $user , $group); +my $ml = Vhffs::Services::Mailing::get_by_mladdress($princ, $local, $domain); +die("Mailing list $address not found\n") unless(defined $ml); -if( defined $mail ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} +my $subs = $ml->get_members; -my $retour = $mail->fetch; - -if( $retour < 0 ) -{ - print "fetch error"; -} -else -{ - print "fetch success"; -} - -my $subs = $mail->get_members; - - - -use Data::Dumper; - print Dumper $subs; Modified: trunk/vhffs-api/src/examples/stats.pl =================================================================== --- trunk/vhffs-api/src/examples/stats.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/stats.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,14 +1,12 @@ #!/usr/bin/perl +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::Stats; my $vhffs = init Vhffs::Main; my $stats = new Vhffs::Stats( $vhffs ); - -$stats->fetch; - print "Users total : "; print $stats->get_user_total; print "\n"; Deleted: trunk/vhffs-api/src/examples/test.pl =================================================================== --- trunk/vhffs-api/src/examples/test.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,60 +0,0 @@ -#!/usr/bin/perl -w -I. /vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; - - - -my $princ = init Vhffs::Main; - -$dbh = $princ->get_db_object; -$config = $princ->get_config; - - -$user = new Vhffs::User( $dbh , "prout" ) ; - -#on fetche l'utilisateur -if ( $user->get < 0 ) -{ - print "ce user n'existe pas\n"; -} -else -{ - print "ce user existe\n"; - $user->delete; - print "user supprime\n"; -} - -#on le cree dans la base -if( $user->create( $princ->get_config ) < 0 ) -{ - print "impossible de creer ce user\n"; -} -else -{ - print "user cree !\n"; -} - - -#on le supprimer -#if( $user->delete < 0 ) -#{ -# print "probleme lors de la suppression"; -#} -#else -#{ -# print "utilisateur supprime"; -#} Deleted: trunk/vhffs-api/src/examples/test2.pl =================================================================== --- trunk/vhffs-api/src/examples/test2.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test2.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,7 +0,0 @@ -#!/usr/bin/perl - -use Vhffs::Constants; - -my $lol="ACL_VIEW"; - -print ${Vhffs::Constants::$lol}; Deleted: trunk/vhffs-api/src/examples/test_conf.pl =================================================================== --- trunk/vhffs-api/src/examples/test_conf.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_conf.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,29 +0,0 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::DNS; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - -my $princ = init Vhffs::Main; - - -my $lol = $princ->get_config->get_service( "dns" ); - -use Data::Dumper; -print Dumper $lol; Deleted: trunk/vhffs-api/src/examples/test_constants.pl =================================================================== --- trunk/vhffs-api/src/examples/test_constants.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_constants.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,11 +0,0 @@ -#!/usr/bin/perl - -use Vhffs::Constants; -use strict; -print "constante :"; - - -print Vhffs::Constants::ACTIVATED ; - -print - Deleted: trunk/vhffs-api/src/examples/test_delete.pl =================================================================== --- trunk/vhffs-api/src/examples/test_delete.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_delete.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,41 +0,0 @@ -#!/usr/bin/perl -w -I/home/soda/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - -my $princ = init Vhffs::Main; - -$config = $princ->get_config; - - - -#on le cree dans la base -$user = new Vhffs::User( $princ , "prefzpojzepfojout" , 401) ; - - - -#on le supprimer -my $retour = $user->delete; -if( $retour < 0 ) -{ - print "probleme lors de la suppression : $retour \n"; -} -else -{ - print "utilisateur supprime\n"; -} Deleted: trunk/vhffs-api/src/examples/test_dns.pl =================================================================== --- trunk/vhffs-api/src/examples/test_dns.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_dns.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,59 +0,0 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::DNS; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; -my $group; - -my $princ = init Vhffs::Main; - -$config = $princ->get_config; - - -$user = new Vhffs::User( $princ , "sodalol" , 401) ; -$group = new Vhffs::Group( $princ , "sodalol" , 401) ; - - -my $dns = new Vhffs::Services::DNS( $princ , "proutlol4.com" , $user , $group ); - -if( defined $dns ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} - -if( $dns->create > 0) -{ - print "Successfully create dns object in the database\n"; -} -else -{ - print "ERROR while create dns object in the database\n"; -} - -$dns->commit; - -$dns->add_a("prou" , "900.10.10.3"); - -use Data::Dumper; - -print Dumper $dns; Deleted: trunk/vhffs-api/src/examples/test_fetch_info.pl =================================================================== --- trunk/vhffs-api/src/examples/test_fetch_info.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_fetch_info.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,55 +0,0 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - -my $princ = init Vhffs::Main; - -$config = $princ->get_config; - - -print "login du user\n"; -$user = new Vhffs::User( $princ , "toto" , 401 ) ; - - -#on fetche l'utilisateur -my $retour; -print "fetch du user\n"; -$retour = $user->fetch; -if ( $retour< 0 ) -{ - print "ce user n'existe pas : $retour \n"; -} -else -{ - print "ce user existe\n"; - print "username : " . $user->get_username . "\n" ; - print "name : " . $user->get_firstname . "\n" ; -} - - - -exit; - $user->set_mail( "MAIL" ); - $user->set_firstname( "FIRSTNAME" ); - $user->set_lasttname( "LASTNAME" ); - $user->set_city( "CITY" ); - $user->set_zipcode( "ZIPCODE" ); - $user->set_country( "COUNTRY" ); - $user->set_address( "ADDRESS" ); - Deleted: trunk/vhffs-api/src/examples/test_httpd.pl =================================================================== --- trunk/vhffs-api/src/examples/test_httpd.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_httpd.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,54 +0,0 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; -use Vhffs::Services::Httpd; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - -my $princ = init Vhffs::Main; - -$config = $princ->get_config; - - -$user = new Vhffs::User( $princ , "soda" , 401) ; - -my $httpd = new Vhffs::Services::Httpd( $princ , "proutlol2.com" , $user ); - -if( defined $httpd ) -{ - print "object created\n"; -} -else -{ - print "object error\n"; - exit; -} - -if( $httpd->create > 0) -{ - print "Successfully create httpd object in the database\n"; -} -else -{ - print "ERROR while create httpd object in the database\n"; -} - -$httpd->fetch; - -use Data::Dumper; - -print Dumper $httpd; Deleted: trunk/vhffs-api/src/examples/test_obj.pl =================================================================== --- trunk/vhffs-api/src/examples/test_obj.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_obj.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,39 +0,0 @@ -#!/usr/bin/perl - -use Vhffs::Object; -use Vhffs::Conf; -use Vhffs::Main; -use Vhffs::User; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; - -my $princ = init Vhffs::Main; - -$dbh = $princ->get_db_object; -$config = $princ->get_config; - - -my $test = new Vhffs::Object( $dbh , 30 , 10); - -$user = new Vhffs::User($dbh,"soda2"); -$user->get; - - - -print "object error" if ( ! defined $test ); -my $r = $test->create; -if ( $r < 0) -{ - print "erreur : $r"; -} -else -{ - print "ok ..."; -} - -$test->get; Deleted: trunk/vhffs-api/src/examples/test_user.pl =================================================================== --- trunk/vhffs-api/src/examples/test_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-api/src/examples/test_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,85 +0,0 @@ -#!/usr/bin/perl -w -I/vhffs/vhffs-api/src/ - - -use strict; - -use Data::Dumper; -use Vhffs::Conf; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Object; - -my $config; -my $mysql_config; -my $services_config; -my $user; -my $dbh; -my $backend; -my %infos; - -my $princ = init Vhffs::Main; - -$config = $princ->get_config; - - -print "new du user\n"; -$user = new Vhffs::User( $princ , "soda" , 401) ; - - -#on fetche l'utilisateur -my $retour; -print "fetch du user\n"; -$retour = $user->fetch; -if ( $retour< 0 ) -{ - print "ce user n'existe pas : $retour \n"; - $user->create; -} -else -{ - print "ce user existe\n"; - print "username : " . $user->get_username . "\n" ; - $user->delete; -} - -exit; - - -print "creation du user\n"; - -#on le cree dans la base -$user = new Vhffs::User( $princ , "proutlolzizi2" , 401) ; -my $uid = $user->create; -if( $uid < 0 ) -{ - print "impossible de creer ce user : $uid \n"; -} -else -{ - $user->set_password("lol"); - - $user->commit; - - print "user cree avec uid $uid !\n"; -} - -$user->set_shell("/usr/bin/lol"); - -$user->commit; - -$user->fetch; - -exit; - -# -#on le supprimer -$retour = $user->delete; -if( $retour < 0 ) -{ - print "probleme lors de la suppression : $retour \n"; -} -else -{ - print "utilisateur supprime\n"; -} Modified: trunk/vhffs-backend/conf/vhffs.conf =================================================================== --- trunk/vhffs-backend/conf/vhffs.conf 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-backend/conf/vhffs.conf 2007-04-15 21:17:33 UTC (rev 561) @@ -55,10 +55,8 @@ use_svn = no use_postgres = no use_dns = no - use_mailling = no use_mailing = no use_mailuser = no - use_largefile = no use_repository = no </modules> @@ -81,6 +79,9 @@ #Is the panel open or not ? open = yes + #Key to crypt the confirmation code, it must be 8 characters long + subscribe_code_encrypt_key = AbCdEfGh + #Use the public section of VHFFS use_public = yes @@ -112,8 +113,7 @@ ################################################# # Backend configuration ################################################# -<databases> - <dbread> +<database> driver = pg #Database to use db_name=vhffs @@ -125,32 +125,15 @@ db_host=localhost #Database port db_port = 5432 - </dbread> +</database> - <dbwrite> - driver = pg - #Database to use - db_name=vhffs - #Read Write User Name - db_username=vhffs - #Password - db_password=vhffs - #DataBase Server - db_host=localhost - #Database port - db_port = 5432 - </dbwrite> -</databases> - - ################################################ # USERS AND GROUPS ################################################ #the default configuration for users <users> minuid = 10000 - homedir = /home/ shell = /usr/bin/tuxshell mingid = 10000 default_quota = 50 @@ -246,8 +229,8 @@ 20 = mx2.hoster.org </mx> <ns> - ns1.tf.o - zefz + ns1.hoster.org + ns2.hoster.org </ns> </init> </dns> @@ -267,11 +250,13 @@ host = localhost username = root password = vhffs + mysqldump_path = /usr/bin/mysqldump </mysql> <postgresql> host = localhost username = vhffs password = zepojf + pgdump_path = /usr/bin/pg_dump </postgresql> <subversion> svnweb_url = "http://svnweb.hoster" @@ -319,27 +304,6 @@ </listengine> - #Configuration of largefile (not complete, please do not use it) - <largefile> - upload-host = "largefile.myhost" - <mirrors> - <server> - name = "MIRROR1" - country = fr - logo = http://blabla - url = http://mirror1/download/myservice/ - link = http://mirror1.com - </server> - <server> - name = "MIRROR2" - country = en - logo = http://blibli - url = http://download.mirror2.net/mirror/ - link = http://mirror2.net - </server> - </mirrors> - </largefile> - #Configuration of download repository <repository> # Prefix of URL displayed in the panel Deleted: trunk/vhffs-backend/src/pgsql/alter_from4.0pre1_tocurrent.sql =================================================================== --- trunk/vhffs-backend/src/pgsql/alter_from4.0pre1_tocurrent.sql 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-backend/src/pgsql/alter_from4.0pre1_tocurrent.sql 2007-04-15 21:17:33 UTC (rev 561) @@ -1,52 +0,0 @@ -/* -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -*/ - -CREATE TABLE vhffs_repository -( - repository_id serial, - name varchar NOT NULL, - owner_uid int4 NOT NULL, - owner_gid int4 NOT NULL, - quota int4 NOT NULL, - quota_used int4 NOT NULL DEFAULT 0, - object_id int4 NOT NULL, - CONSTRAINT vhffs_repository_pkey PRIMARY KEY (repository_id) -) WITH OIDS; - -ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE; -ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid) ON DELETE CASCADE; -ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; - -CREATE VIEW vhffs_forum AS -SELECT users.username, users.passwd, user_info.firstname, user_info.lastname, user_info.mail, user_info.date_creation, object.state -FROM vhffs_users users, vhffs_user_info user_info, vhffs_object object -WHERE user_info.uid=users.uid AND object.object_id=users.object_id; Modified: trunk/vhffs-backend/src/pgsql/initdb.sql =================================================================== --- trunk/vhffs-backend/src/pgsql/initdb.sql 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-backend/src/pgsql/initdb.sql 2007-04-15 21:17:33 UTC (rev 561) @@ -33,10 +33,11 @@ CREATE TABLE vhffs_object ( object_id serial, - owner_uid int4 NOT NULL, + owner_uid int4, date_creation timestamp, - state varchar NOT NULL, + state int4 NOT NULL, description TEXT, + type int4 DEFAULT 0, CONSTRAINT vhffs_object_pkey PRIMARY KEY (object_id) ) WITH OIDS; @@ -58,22 +59,40 @@ quota int4 NOT NULL, quota_used int4 NOT NULL DEFAULT 0, object_id int4 NOT NULL, + owner_uid int4, + uid_mod int4, CONSTRAINT vhffs_groups_pkey PRIMARY KEY (gid) ) WITH OIDS; +SELECT setval('vhffs_groups_gid_seq', 10000); + CREATE TABLE vhffs_users ( uid serial, - gid int4 NOT NULL, + gid int4, username varchar(50) NOT NULL DEFAULT ' ', shell varchar(20) NOT NULL DEFAULT ' ', passwd varchar(40) NOT NULL DEFAULT ' ', homedir varchar(40) NOT NULL DEFAULT ' ', admin int4 NOT NULL, object_id int4 NOT NULL, + date_creation timestamp, + firstname varchar(250), + lastname varchar(250), + address text, + zipcode varchar(16), + city varchar(250), + country varchar(250), + mail varchar(200), + gpg_key varchar(250), + note int4 DEFAULT '0', + language varchar(16), + theme varchar(250), CONSTRAINT vhffs_users_pkey PRIMARY KEY (uid) ) WITH OIDS; +SELECT setval('vhffs_users_uid_seq', 10000) ; + CREATE TABLE vhffs_boxes ( domain varchar, @@ -87,17 +106,6 @@ CONSTRAINT vhffs_boxes_pkey PRIMARY KEY (domain,local_part) ) WITH OIDS; - -CREATE TABLE vhffs_confirmation -( - cid SERIAL, - code varchar(10), - CONSTRAINT vhffs_confirmation_pkey PRIMARY KEY (cid) -) WITH OIDS; - - - - CREATE TABLE vhffs_cvs ( cvs_id serial, @@ -109,14 +117,22 @@ CONSTRAINT vhffs_cvs_pkey PRIMARY KEY (cvs_id) ) WITH OIDS; -CREATE TABLE vhffs_dns_global +CREATE TABLE vhffs_dns ( dns_id serial, domain varchar(255) NOT NULL, owner_gid int4, owner_uid int4, object_id int4, - CONSTRAINT vhffs_dns_pkey4 PRIMARY KEY ( dns_id ) + ns varchar(255) NOT NULL, + mbox varchar(255) NOT NULL, + serial INTEGER NOT NULL DEFAULT 1, + refresh INTEGER NOT NULL DEFAULT 28800, + retry INTEGER NOT NULL DEFAULT 7200, + expire INTEGER NOT NULL DEFAULT 604800, + minimum INTEGER NOT NULL DEFAULT 86400, + ttl INTEGER NOT NULL DEFAULT 86400, + CONSTRAINT vhffs_dns_pkey4 PRIMARY KEY (dns_id) ) WITH OIDS; CREATE TABLE vhffs_dns_rr ( @@ -130,22 +146,6 @@ CONSTRAINT vhffs_dns_rr_pkey PRIMARY KEY (id) ) WITH OIDS; -CREATE TABLE vhffs_dns_soa -( - id serial, - origin varchar(255) NOT NULL, - ns varchar(255) NOT NULL, - mbox varchar(255) NOT NULL, - serial INTEGER NOT NULL DEFAULT 1, - refresh INTEGER NOT NULL DEFAULT 28800, - retry INTEGER NOT NULL DEFAULT 7200, - expire INTEGER NOT NULL DEFAULT 604800, - minimum INTEGER NOT NULL DEFAULT 86400, - ttl INTEGER NOT NULL DEFAULT 86400, - active INTEGER, - CONSTRAINT vhffs_dns_soa_pkey PRIMARY KEY (id) -) WITH OIDS; - CREATE TABLE vhffs_forward ( domain varchar NOT NULL, @@ -155,14 +155,6 @@ CONSTRAINT vhffs_forward_pkey PRIMARY KEY (domain , local_part) ) WITH OIDS; -CREATE TABLE vhffs_groups_info -( - gid int4 NOT NULL, - owner_uid int4, - uid_mod int4, - CONSTRAINT vhffs_groups_info_pkey PRIMARY KEY (gid) -) WITH OIDS; - CREATE TABLE vhffs_httpd ( httpd_id serial, @@ -179,29 +171,6 @@ CONSTRAINT vhffs_httpd_pkey PRIMARY KEY (httpd_id) ) WITH OIDS; -CREATE TABLE vhffs_largefile -( - file_id SERIAL, - filename varchar NOT NULL, - size int4 NOT NULL, - type varchar NOT NULL, - licence varchar, - hash varchar, - creating_date DATE, - last_check DATE, - end_date DATE, - username varchar, - password varchar, - home varchar, - ncheck int4 DEFAULT '0', - virtual_uid int4, - virtual_gid int4, - owner_uid int4, - owner_gid int4, - object_id int4, - CONSTRAINT vhffs_largefile_pkey PRIMARY KEY( filename , owner_gid) -) WITH OIDS; - CREATE TABLE vhffs_repository ( repository_id serial, @@ -228,7 +197,7 @@ CREATE TABLE vhffs_mxdomain ( mxdomain_id serial, - domain varchar UNIQUE, + domain varchar, unix_user varchar NOT NULL, boxes_path varchar NOT NULL, max_popbox int4 NOT NULL, @@ -242,46 +211,32 @@ CREATE TABLE vhffs_ml ( ml_id serial, - local_part VARCHAR NOT NULL, - domain VARCHAR REFERENCES vhffs_mxdomain( domain ), - prefix VARCHAR , + local_part varchar(256) NOT NULL, + domain varchar(256), + prefix varchar(32), owner_uid int4, owner_gid int4, object_id int4, + admin varchar(250) NOT NULL, + sub_ctrl int4, + post_ctrl int4, + reply_to boolean, + open_archive boolean, + signature varchar(250), CONSTRAINT vhffs_ml_pkey PRIMARY KEY (ml_id) ) WITH OIDS; -CREATE TABLE vhffs_ml_prefs -( - ml_id int4 REFERENCES vhffs_ml( ml_id ) PRIMARY KEY, - admin VARCHAR NOT NULL, - open_post int4 NOT NULL, - open_archive int4 NOT NULL, - open_sub int4 NOT NULL, - reply_to int4, - moderated int4 NOT NULL, - url VARCHAR -) WITH OIDS; - CREATE TABLE vhffs_ml_subscribers ( sub_id serial, - member VARCHAR NOT NULL, + member varchar(256) NOT NULL, perm int4 NOT NULL, - active int4 NOT NULL, - hash varchar NOT NULL, + hash varchar, ml_id int4 NOT NULL, + language varchar(16), CONSTRAINT vhffs_ml_subscribers_pkey PRIMARY KEY (sub_id) ) WITH OIDS; -CREATE TABLE vhffs_ml_lang -( -/* TODO use an int4 and link it to vhffs_ml_subscribers(sub_id) */ - member VARCHAR NOT NULL, - lang VARCHAR NOT NULL, - CONSTRAINT vhffs_ml_lang_pkey PRIMARY KEY (member) -) WITH OIDS; - CREATE TABLE vhffs_mysql ( mysql_id serial, @@ -294,13 +249,6 @@ CONSTRAINT vhffs_mysql_pkey PRIMARY KEY (mysql_id) ) WITH OIDS; -CREATE TABLE vhffs_notes -( - object_id int4 NOT NULL, - note int4 DEFAULT '0', - CONSTRAINT vhffs_notes_pkey PRIMARY KEY(object_id) -) WITH OIDS; - CREATE TABLE vhffs_history ( history_id serial, @@ -310,20 +258,12 @@ CONSTRAINT vhffs_history_pkey PRIMARY KEY (history_id) ) WITH OIDS; -CREATE TABLE vhffs_panel_user_prefs -( - uid int4, - language varchar, - theme varchar, - CONSTRAINT vhffs_panel_user_prefs_pkey PRIMARY KEY (uid) -) WITH OIDS; - CREATE TABLE vhffs_pgsql ( pgsql_id serial, dbname varchar(200) NOT NULL, - dbuser VARCHAR(16) NOT NULL, - dbpass VARCHAR(32) NOT NULL, + dbuser varchar(16) NOT NULL, + dbpass varchar(32) NOT NULL, owner_uid int4, owner_gid int4, object_id int4, @@ -349,22 +289,28 @@ CONSTRAINT vhffs_user_group_pkey PRIMARY KEY (uid,gid) )WITH OIDS; -CREATE TABLE vhffs_user_info -( - uid int4 NOT NULL, - date_creation timestamp, - firstname varchar(250), - lastname varchar(250), - address text, - zipcode int4, - city varchar(250), - country varchar(250), - mail varchar(200), - gpg_key varchar(250), - CONSTRAINT vhffs_user_info_pkey PRIMARY KEY (uid) -) WITH OIDS; +/****** Indexes and unique constraints *******/ +ALTER TABLE vhffs_users ADD CONSTRAINT vhffs_users_unique_username UNIQUE (username); +ALTER TABLE vhffs_groups ADD CONSTRAINT vhffs_groups_unique_groupname UNIQUE (groupname); +ALTER TABLE vhffs_cvs ADD CONSTRAINT vhffs_cvs_unique_cvsroot UNIQUE (cvsroot); +ALTER TABLE vhffs_httpd ADD CONSTRAINT vhffs_httpd_unique_servername UNIQUE (servername); +ALTER TABLE vhffs_mxdomain ADD CONSTRAINT vhffs_mxdomain_unique_domainname UNIQUE (domain); +ALTER TABLE vhffs_mysql ADD CONSTRAINT vhffs_mysql_unique_dbname UNIQUE (dbname); +ALTER TABLE vhffs_mysql ADD CONSTRAINT vhffs_mysql_unique_dbuser UNIQUE (dbuser); +ALTER TABLE vhffs_pgsql ADD CONSTRAINT vhffs_pgsql_unique_dbname UNIQUE (dbname); +ALTER TABLE vhffs_pgsql ADD CONSTRAINT vhffs_pgsql_unique_dbuser UNIQUE (dbuser); +ALTER TABLE vhffs_repository ADD CONSTRAINT vhffs_repository_unique_name UNIQUE (name); +ALTER TABLE vhffs_svn ADD CONSTRAINT vhffs_svn_unique_reponame UNIQUE (reponame); +ALTER TABLE vhffs_dns ADD CONSTRAINT vhffs_dns_unique_domain UNIQUE (domain); +ALTER TABLE vhffs_ml ADD CONSTRAINT vhffs_ml_unique_address UNIQUE (local_part, domain); +ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT vhffs_ml_subscribers_member_list UNIQUE (ml_id, member); +-- This index drastically improves performances on get_used_letters +CREATE INDEX idx_vhffs_httpd_servername_firstletter ON vhffs_httpd(substr(servername, 1, 1)); +-- state is massively used in WHERE clause, this index improves overall performances +CREATE INDEX idx_vhffs_object_state ON vhffs_object(state); + /****** Non primary key constraints. Defining foreign keys here allow to create tables in any order. *******/ @@ -373,6 +319,7 @@ ALTER TABLE vhffs_acl ADD CONSTRAINT fk_vhffs_acl_vhffs_object_src FOREIGN KEY (oid_src) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; ALTER TABLE vhffs_groups ADD CONSTRAINT fk_vhffs_group_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; +ALTER TABLE vhffs_groups ADD CONSTRAINT fk_vhffs_group_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users (uid); ALTER TABLE vhffs_users ADD CONSTRAINT fk_vhffs_users_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object (object_id) ON DELETE CASCADE; @@ -380,23 +327,16 @@ ALTER TABLE vhffs_cvs ADD CONSTRAINT fk_vhffs_cvs_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_cvs ADD CONSTRAINT fk_vhffs_cvs_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); -ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); -ALTER TABLE vhffs_dns_global ADD CONSTRAINT fk_vhffs_dns_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; +ALTER TABLE vhffs_dns ADD CONSTRAINT fk_vhffs_dns_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); +ALTER TABLE vhffs_dns ADD CONSTRAINT fk_vhffs_dns_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); +ALTER TABLE vhffs_dns ADD CONSTRAINT fk_vhffs_dns_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_dns_rr ADD CONSTRAINT fk_vhffs_dns_rr_vhffs_dns FOREIGN KEY (zone) REFERENCES vhffs_dns_global(dns_id) ON DELETE CASCADE; +ALTER TABLE vhffs_dns_rr ADD CONSTRAINT fk_vhffs_dns_rr_vhffs_dns FOREIGN KEY (zone) REFERENCES vhffs_dns(dns_id) ON DELETE CASCADE; ALTER TABLE vhffs_dns_rr ADD CONSTRAINT fk_vhffs_dns_rr_chk_type CHECK (type='A' OR type='AAAA' OR type='CNAME' OR type='HINFO' OR type='MX' OR type='NS' OR type='PTR' OR type='RP' OR type='SRV' OR type='TXT'); -ALTER TABLE vhffs_groups_info ADD CONSTRAINT fk_vhffs_groups_info_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid); -ALTER TABLE vhffs_groups_info ADD CONSTRAINT fk_vhffs_groups_info_vhffs_users FOREIGN KEY (uid_mod) REFERENCES vhffs_users (uid); - ALTER TABLE vhffs_httpd ADD CONSTRAINT fk_vhffs_httpd_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); ALTER TABLE vhffs_httpd ADD CONSTRAINT fk_vhffs_httpd_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); -ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); -ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); -ALTER TABLE vhffs_largefile ADD CONSTRAINT fk_vhffs_largefile_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; - ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_repository ADD CONSTRAINT fk_vhffs_vhffs_repository_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; @@ -409,18 +349,14 @@ ALTER TABLE vhffs_ml ADD CONSTRAINT fk_vhffs_ml_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_ml ADD CONSTRAINT fk_vhffs_ml_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT fk_vhffs_ml_subscribers_vhffs_ml FOREIGN KEY (ml_id) REFERENCES vhffs_ml(ml_id); +ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT fk_vhffs_ml_subscribers_vhffs_ml FOREIGN KEY (ml_id) REFERENCES vhffs_ml(ml_id) ON DELETE CASCADE; ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_mysql ADD CONSTRAINT fk_vhffs_mysql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_notes ADD CONSTRAINT fk_vhffs_notes FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; - ALTER TABLE vhffs_history ADD CONSTRAINT fk_vhffs_history_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_user_info ADD CONSTRAINT fk_vhffs_user_info_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE; - ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_users FOREIGN KEY (owner_uid) REFERENCES vhffs_users(uid); ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_pgsql ADD CONSTRAINT fk_vhffs_pgsql_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; @@ -429,12 +365,10 @@ ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_groups FOREIGN KEY (owner_gid) REFERENCES vhffs_groups(gid); ALTER TABLE vhffs_svn ADD CONSTRAINT fk_vhffs_svn_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE; -ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON UPDATE CASCADE ON DELETE CASCADE; -ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON DELETE CASCADE; +ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_groups FOREIGN KEY (gid) REFERENCES vhffs_groups (gid) ON DELETE CASCADE; -ALTER TABLE vhffs_panel_user_prefs ADD CONSTRAINT fk_vhffs_panel_user_prefs_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users(uid) ON DELETE CASCADE; - CREATE VIEW vhffs_passwd AS SELECT uid, gid, username, shell, '*'::character varying AS passwd, homedir FROM vhffs_users; @@ -444,6 +378,10 @@ FROM vhffs_users; CREATE VIEW vhffs_forum AS -SELECT users.username, users.passwd, user_info.firstname, user_info.lastname, user_info.mail, user_info.date_creation, object.state -FROM vhffs_users users, vhffs_user_info user_info, vhffs_object object -WHERE user_info.uid=users.uid AND object.object_id=users.object_id; +SELECT users.username, users.passwd, users.firstname, users.lastname, users.mail, users.date_creation, object.state +FROM vhffs_users users, vhffs_object object +WHERE object.object_id=users.object_id; + +CREATE VIEW vhffs_dns_soa AS +SELECT dns.dns_id AS id, dns.domain || '.' AS origin , dns.ns, dns.mbox, dns.serial, dns.refresh, dns.retry, dns.expire, dns.minimum, dns.ttl, (o.state = 6) AS active +FROM vhffs_dns dns, vhffs_object o WHERE o.object_id=dns.object_id; Copied: trunk/vhffs-compat (from rev 555, branches/vhffs_4.1/vhffs-compat) Modified: trunk/vhffs-doc/config/exim4-mx1/exim4.conf =================================================================== --- trunk/vhffs-doc/config/exim4-mx1/exim4.conf 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-doc/config/exim4-mx1/exim4.conf 2007-04-15 21:17:33 UTC (rev 561) @@ -6,7 +6,7 @@ PGSQL_VIRTUAL_FORWARD_DATA = ${lookup pgsql{select remote_name from vhffs_forward, vhffs_mxdomain where local_part = '$local_part' and vhffs_forward.domain = vhffs_mxdomain.domain and vhffs_mxdomain.domain = '$domain'}} PGSQL_ML_EXIST = ${lookup pgsql{select domain from vhffs_ml where local_part='$local_part' and domain='$domain'}} PGSQL_VIRTUAL_CATCHALL = ${lookup pgsql{select catchall from vhffs_mxdomain where domain = '$domain' and catchall != ''}} -PGSQL_GET_TX_USER = ${lookup pgsql{select vhffs_user_info.mail from vhffs_user_info, vhffs_users where vhffs_users.uid=vhffs_user_info.uid and vhffs_users.username='$local_part' and 'tuxfamily.org'='$domain'}} +PGSQL_GET_TX_USER = ${lookup pgsql{select mail from vhffs_users where username='$local_part' and 'tuxfamily.org'='$domain'}} #PGSQL_VIRTUAL_LOCAL_QUOTA = ${lookup pgsql{select quota from popbox where local_part = "$local_part" and domaine = "$domain"}} #PGSQL_VIRTUAL_LOCAL_QFILE = ${lookup pgsql{select quota_f from popbox where local_part = "$local_part" and domain = "$domain"}} #PGSQL_VIRTUAL_LOCAL_Q_WARN = ${lookup pgsql{select quota_warn from popbox where local_part = "$local_part" and domain = "$domain"}} Modified: trunk/vhffs-doc/config/exim4-mx1/exim4.conf.hash =================================================================== --- trunk/vhffs-doc/config/exim4-mx1/exim4.conf.hash 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-doc/config/exim4-mx1/exim4.conf.hash 2007-04-15 21:17:33 UTC (rev 561) @@ -6,7 +6,7 @@ PGSQL_VIRTUAL_FORWARD_DATA = ${lookup pgsql{select remote_name from vhffs_forward, vhffs_mxdomain where local_part = '$local_part' and vhffs_forward.domain = vhffs_mxdomain.domain and vhffs_mxdomain.domain = '$domain'}} PGSQL_ML_EXIST = ${lookup pgsql{select domain from mail_list where listname = '$local_part' and domain = '$domain'}} PGSQL_VIRTUAL_CATCHALL = ${lookup pgsql{select catchall from vhffs_mxdomain where domain = '$domain' and catchall != ''}} -PGSQL_GET_TX_USER = ${lookup pgsql{select vhffs_user_info.mail from vhffs_user_info, vhffs_users where vhffs_users.uid=vhffs_user_info.uid and vhffs_users.username='$local_part' and 'tuxfamily.org'='$domain'}} +PGSQL_GET_TX_USER = ${lookup pgsql{select mail from vhffs_users where username='$local_part' and 'tuxfamily.org'='$domain'}} #PGSQL_VIRTUAL_LOCAL_QUOTA = ${lookup pgsql{select quota from popbox where local_part = "$local_part" and domaine = "$domain"}} #PGSQL_VIRTUAL_LOCAL_QFILE = ${lookup pgsql{select quota_f from popbox where local_part = "$local_part" and domain = "$domain"}} #PGSQL_VIRTUAL_LOCAL_Q_WARN = ${lookup pgsql{select quota_warn from popbox where local_part = "$local_part" and domain = "$domain"}} Copied: trunk/vhffs-intl/compile_po.sh (from rev 555, branches/vhffs_4.1/vhffs-intl/compile_po.sh) Modified: trunk/vhffs-intl/result/es_ES/vhffs.mo =================================================================== (Binary files differ) Modified: trunk/vhffs-intl/result/fr_FR/vhffs.mo =================================================================== (Binary files differ) Property changes on: trunk/vhffs-intl/src ___________________________________________________________________ Name: svn:ignore + fr.po.old es.po.old Copied: trunk/vhffs-intl/src/es.po (from rev 555, branches/vhffs_4.1/vhffs-intl/src/es.po) Copied: trunk/vhffs-intl/src/fr.po (from rev 555, branches/vhffs_4.1/vhffs-intl/src/fr.po) Modified: trunk/vhffs-intl/src/vhffs.pot =================================================================== --- trunk/vhffs-intl/src/vhffs.pot 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-intl/src/vhffs.pot 2007-04-15 21:17:33 UTC (rev 561) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-06-07 16:01+0200\n" +"POT-Creation-Date: 2007-03-25 19:16+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@xxxxxx>\n" @@ -16,1647 +16,1654 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:38 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:68 msgid "\t\t\t\t RIGHT can be subscriber or admin\n" msgstr "" -#: ../vhffs-panel/public/index.pl:32 +#: ../vhffs-panel/admin/moderation_submit.pl:105 ../vhffs-irc/modobot.pl:397 +msgid "" +" was accepted\n" +"Please wait while we are creating your object\n" +msgstr "" + +#: ../vhffs-panel/public/index.pl:61 #, perl-format msgid "%s public area" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:125 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:269 #, perl-format +msgid "%s's Panel" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:155 +#, perl-format msgid "%s-request@%s with subject : \"help\"\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:121 -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:123 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:151 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:153 msgid "------\n" msgstr "" -#: ../vhffs-panel/web/create.pl:38 +#: ../vhffs-panel/web/create.pl:69 msgid "<new site>." msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:356 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:386 #, perl-format msgid "A mail to moderate is on the list %s.\n" msgstr "" -#: ../vhffs-panel/acl/view.pl:116 +#: ../vhffs-panel/acl/view.pl:148 msgid "ACL Administration for : " msgstr "" -#: ../vhffs-panel/acl/view.pl:135 +#: ../vhffs-panel/acl/view.pl:167 msgid "ACL level" msgstr "" -#: ../vhffs-panel/acl/add_acl_user.pl:79 -#: ../vhffs-panel/acl/add_acl_group.pl:79 +#: ../vhffs-panel/acl/add_acl_group.pl:106 +#: ../vhffs-panel/acl/add_acl_user.pl:106 msgid "ACL successfully added" msgstr "" -#: ../vhffs-panel/acl/submit.pl:81 +#: ../vhffs-panel/acl/submit.pl:108 msgid "ACL successfully deleted" msgstr "" -#: ../vhffs-panel/acl/submit.pl:92 +#: ../vhffs-panel/acl/submit.pl:119 msgid "ACL successfully modified" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:84 -#: ../vhffs-panel/admin/moderation.pl:126 -#: ../vhffs-panel/admin/moderation.pl:167 -#: ../vhffs-panel/admin/moderation.pl:211 -#: ../vhffs-panel/admin/moderation.pl:254 -#: ../vhffs-panel/admin/moderation.pl:299 -#: ../vhffs-panel/admin/moderation.pl:344 -#: ../vhffs-panel/admin/moderation.pl:387 -#: ../vhffs-panel/admin/moderation.pl:429 -#: ../vhffs-panel/admin/moderation.pl:470 +#: ../vhffs-panel/admin/moderation.pl:115 +#: ../vhffs-panel/admin/moderation.pl:157 +#: ../vhffs-panel/admin/moderation.pl:198 +#: ../vhffs-panel/admin/moderation.pl:242 +#: ../vhffs-panel/admin/moderation.pl:285 +#: ../vhffs-panel/admin/moderation.pl:330 +#: ../vhffs-panel/admin/moderation.pl:375 +#: ../vhffs-panel/admin/moderation.pl:418 +#: ../vhffs-panel/admin/moderation.pl:460 +#: ../vhffs-panel/admin/moderation.pl:502 msgid "Accept" msgstr "" -#: ../vhffs-panel/logout.pl:31 ../vhffs-panel/auth.pl:34 +#: ../vhffs-panel/logout.pl:60 ../vhffs-panel/auth.pl:60 msgid "Access to panel" msgstr "" -#: ../vhffs-panel/mail/delete_box.pl:82 +#: ../vhffs-panel/mail/delete_box.pl:105 msgid "Account successfully deleted" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:75 +#: ../vhffs-panel/mail/prefs.pl:106 msgid "Accounts" msgstr "" -#: ../vhffs-panel/user/prefs.pl:138 +#: ../vhffs-panel/user/prefs.pl:175 #, perl-format msgid "Activate %s@%s email" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:348 -#: ../vhffs-panel/admin/mail/edit.pl:129 ../vhffs-panel/admin/dns/list.pl:80 -#: ../vhffs-panel/admin/pgsql/edit.pl:88 ../vhffs-panel/admin/pgsql/list.pl:82 -#: ../vhffs-panel/admin/cvs/edit.pl:97 ../vhffs-panel/admin/group/edit.pl:90 -#: ../vhffs-panel/admin/mysql/edit.pl:88 ../vhffs-panel/admin/mysql/list.pl:82 -#: ../vhffs-panel/admin/object/edit.pl:88 -#: ../vhffs-panel/admin/object/list.pl:77 ../vhffs-panel/admin/web/edit.pl:101 -#: ../vhffs-panel/admin/user/edit.pl:112 +#: ../vhffs-panel/admin/user/edit.pl:143 +#: ../vhffs-panel/admin/pgsql/edit.pl:119 +#: ../vhffs-panel/admin/group/edit.pl:119 +#: ../vhffs-panel/admin/repository/edit.pl:119 +#: ../vhffs-panel/admin/object/edit.pl:119 +#: ../vhffs-panel/admin/web/edit.pl:132 ../vhffs-panel/admin/mysql/edit.pl:120 +#: ../vhffs-panel/admin/cvs/edit.pl:128 ../vhffs-panel/admin/mail/edit.pl:160 msgid "Activated" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:112 ../vhffs-panel/mailinglist/prefs.pl:96 +#: ../vhffs-panel/mailinglist/prefs.pl:131 ../vhffs-panel/dns/prefs.pl:143 msgid "Add !" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:125 +#: ../vhffs-panel/dns/prefs.pl:156 msgid "Add a CNAME field to your domain" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:117 +#: ../vhffs-panel/dns/prefs.pl:148 msgid "Add a MX field to your domain" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:133 +#: ../vhffs-panel/dns/prefs.pl:164 msgid "Add a NS field to your domain" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:86 ../vhffs-panel/mail/prefs.pl:96 +#: ../vhffs-panel/mail/prefs.pl:117 ../vhffs-panel/mail/prefs.pl:127 msgid "Add a forward on this domain" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:94 +#: ../vhffs-panel/mailinglist/prefs.pl:129 msgid "Add a member" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:95 +#: ../vhffs-panel/mail/prefs.pl:126 msgid "Add a popbox to this domain" msgstr "" -#: ../vhffs-panel/group/prefs.pl:74 +#: ../vhffs-panel/group/prefs.pl:105 msgid "Add a user in this group" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:87 +#: ../vhffs-panel/dns/prefs.pl:118 msgid "Add an A record" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:77 +#: ../vhffs-panel/mail/prefs.pl:108 msgid "Add an account" msgstr "" -#: ../vhffs-panel/group/prefs.pl:75 +#: ../vhffs-panel/group/prefs.pl:106 msgid "Add this user !" msgstr "" -#: ../vhffs-panel/group/join_group.pl:83 +#: ../vhffs-panel/group/join_group.pl:110 msgid "Add this user to this group" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:73 ../vhffs-panel/admin/user/show.pl:73 -#: ../vhffs-panel/user/prefs.pl:53 ../vhffs-panel/subscribe.pl:43 +#: ../vhffs-panel/subscribe.pl:205 ../vhffs-panel/user/prefs.pl:84 +#: ../vhffs-panel/admin/user/edit.pl:104 ../vhffs-panel/admin/user/show.pl:104 msgid "Address" msgstr "" -#: ../vhffs-panel/web/prefs.pl:64 +#: ../vhffs-panel/web/prefs.pl:95 msgid "Address (Servername)" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:146 -#: ../vhffs-panel/admin/user/edit.pl:70 ../vhffs-panel/admin/user/edit.pl:100 -#: ../vhffs-panel/admin/user/show.pl:70 ../vhffs-panel/admin/user/show.pl:105 +#: ../vhffs-panel/mailinglist/prefs.pl:181 +#: ../vhffs-panel/admin/user/edit.pl:101 ../vhffs-panel/admin/user/edit.pl:131 +#: ../vhffs-panel/admin/user/show.pl:101 ../vhffs-panel/admin/user/show.pl:136 msgid "Admin" msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:68 +#: ../vhffs-panel/cvs/prefs.pl:99 msgid "Admin CVS Repository" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:79 +#: ../vhffs-panel/dns/prefs.pl:110 msgid "Admin DNS" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:92 ../vhffs-panel/web/prefs.pl:91 -#: ../vhffs-panel/mail/prefs.pl:106 +#: ../vhffs-panel/repository/prefs.pl:96 +msgid "Admin Download repository" +msgstr "" + +#: ../vhffs-panel/dns/prefs.pl:123 ../vhffs-panel/web/prefs.pl:122 +#: ../vhffs-panel/mail/prefs.pl:137 msgid "Admin Rights on this object (ACL)" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:83 +#: ../vhffs-panel/svn/prefs.pl:113 msgid "Admin Subversion Repository" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:40 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:73 msgid "Admin account : " msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:76 +#: ../vhffs-panel/mailinglist/prefs.pl:107 msgid "Administration for list " msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:38 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:68 msgid "Administrator Menu" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:92 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:122 #, perl-format msgid "Adress %s is already a subscriber for this list.\n" msgstr "" -#: ../vhffs-panel/web/create.pl:43 +#: ../vhffs-panel/web/create.pl:74 msgid "Adress (ServerName directive)" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:66 ../vhffs-panel/admin/web/show.pl:65 +#: ../vhffs-panel/admin/web/edit.pl:97 ../vhffs-panel/admin/web/show.pl:96 msgid "Alert Limit" msgstr "" -#: ../vhffs-panel/alert_submit.pl:42 +#: ../vhffs-panel/alert_submit.pl:73 msgid "Alert on Vhffs platform" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:67 ../vhffs-panel/admin/web/show.pl:66 +#: ../vhffs-panel/admin/web/edit.pl:98 ../vhffs-panel/admin/web/show.pl:97 msgid "Alert state" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:83 +#: ../vhffs-panel/public/allwebsites.pl:71 +#: ../vhffs-panel/public/allgroups.pl:67 +msgid "All" +msgstr "" + +#: ../vhffs-panel/dns/prefs.pl:114 msgid "All A TYPE for you domain name" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:124 +#: ../vhffs-panel/dns/prefs.pl:155 msgid "All CNAME TYPE for your domain name" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:85 +#: ../vhffs-panel/dns/prefs.pl:116 msgid "All CNAME for you domain name" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:84 +#: ../vhffs-panel/dns/prefs.pl:115 msgid "All MX TYPE for you domain name" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:116 +#: ../vhffs-panel/dns/prefs.pl:147 msgid "All MX TYPE for your domain name" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:132 +#: ../vhffs-panel/dns/prefs.pl:163 msgid "All NS TYPE for your domain name" msgstr "" -#: ../vhffs-panel/admin/svn/list.pl:51 +#: ../vhffs-panel/admin/svn/list.pl:73 msgid "All Subversion repositories lists" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:19 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:49 msgid "All commands can be sent as mail subject.\n" msgstr "" -#: ../vhffs-panel/public/allgroups.pl:33 +#: ../vhffs-panel/public/allgroups.pl:65 #, perl-format msgid "All groups on %s" msgstr "" -#: ../vhffs-panel/admin/largefile/list.pl:49 -msgid "All hosted files lists" -msgstr "" - -#: ../vhffs-panel/admin/broadcast_list.pl:45 +#: ../vhffs-panel/admin/broadcast_list.pl:76 msgid "All mailings sent to hosted" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:21 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:51 msgid "" "All mails with commands must be sent on \n" " YOURLIST-request@xxxxxxxxxx list.\n" msgstr "" -#: ../vhffs-panel/admin/object/list.pl:52 +#: ../vhffs-panel/admin/object/list.pl:84 msgid "All objects List" msgstr "" -#: ../vhffs-panel/group/prefs.pl:95 +#: ../vhffs-panel/group/prefs.pl:126 msgid "All users in this group" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:34 -#: ../vhffs-panel/public/websearch.pl:42 +#: ../vhffs-panel/public/allwebsites.pl:69 +#: ../vhffs-panel/public/websearch.pl:74 #, perl-format msgid "All websites on %s" msgstr "" -#: ../vhffs-panel/mail/add_forward.pl:65 +#: ../vhffs-panel/mail/add_forward.pl:95 #, perl-format msgid "Already exists for this domain or bad parameters. Check your domain" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:95 +#: ../vhffs-panel/mailinglist/submit.pl:114 msgid "An error occured while adding an ACL for the group" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:148 +#: ../vhffs-panel/user/prefs_save.pl:184 msgid "An error occured while adding the box" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:152 +#: ../vhffs-panel/user/prefs_save.pl:188 msgid "An error occured while adding the box (anti-spam adding)" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:156 +#: ../vhffs-panel/user/prefs_save.pl:192 msgid "An error occured while adding the box (anti-virus adding)" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:243 +#: ../vhffs-panel/user/prefs_save.pl:260 msgid "An error occured while adding the forwarding" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:91 +#: ../vhffs-panel/mailinglist/submit.pl:112 msgid "An error occured while adding yourself to the ACL" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:83 -msgid "An error occured while applying changes" -msgstr "" - -#: ../vhffs-panel/user/delete.pl:52 +#: ../vhffs-panel/user/delete.pl:83 msgid "An error occured while applying changes. This user will NOT be deleted" msgstr "" -#: ../vhffs-panel/web/delete.pl:61 +#: ../vhffs-panel/web/delete.pl:92 msgid "" "An error occured while applying changes. This web area will NOT be deleted" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:87 +#: ../vhffs-panel/mailinglist/submit.pl:110 msgid "An error occured while creating the list" msgstr "" -#: ../vhffs-panel/mail/submit.pl:57 +#: ../vhffs-panel/mail/submit.pl:86 msgid "An error occured while creating the mail area" msgstr "" -#: ../vhffs-panel/admin/mailing/mailing_submit.pl:53 +#: ../vhffs-panel/admin/mailing/mailing_submit.pl:84 msgid "An error occured while creating the message in the database" msgstr "" -#: ../vhffs-panel/svn/svn_submit.pl:59 ../vhffs-panel/mysql/submit.pl:74 +#: ../vhffs-panel/svn/svn_submit.pl:80 ../vhffs-panel/mysql/submit.pl:103 msgid "An error occured while creating the object" msgstr "" -#: ../vhffs-panel/pgsql/pgsql_submit.pl:70 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:99 #, perl-format msgid "An error occured while creating the object %s %s" msgstr "" -#: ../vhffs-panel/largefile/submit.pl:66 +#: ../vhffs-panel/dns/dns_submit.pl:78 msgid "" -"An error occured while creating the object. Parameters are invalid or the " -"file already exists." -msgstr "" - -#: ../vhffs-panel/dns/dns_submit.pl:52 -msgid "" "An error occured while creating the object. The domain is not correct or " "aleady exists in Vhffs database" msgstr "" -#: ../vhffs-panel/cvs/cvs_submit.pl:63 +#: ../vhffs-panel/repository/repository_submit.pl:93 +#: ../vhffs-panel/cvs/cvs_submit.pl:92 msgid "An error occured while creating the object.It probably already exists" msgstr "" -#: ../vhffs-panel/cvs/delete.pl:68 +#: ../vhffs-panel/cvs/delete.pl:99 msgid "An error occured while deleting the CVS repository" msgstr "" -#: ../vhffs-panel/svn/delete.pl:67 ../vhffs-panel/largefile/delete.pl:66 +#: ../vhffs-panel/repository/delete.pl:99 +msgid "An error occured while deleting the Download repository" +msgstr "" + +#: ../vhffs-panel/svn/delete.pl:98 msgid "An error occured while deleting the Subversion repository" msgstr "" -#: ../vhffs-panel/admin/broadcast_delete.pl:64 +#: ../vhffs-panel/admin/broadcast_delete.pl:95 msgid "An error occured while deleting this mailing" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:81 -msgid "An error occured while fetching information about this mailing list" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Robots/Mysql.pm:140 +#: ../vhffs-api/src/Vhffs/Robots/Mysql.pm:108 msgid "An error occured while granting privileges to an admin user" msgstr "" -#: ../vhffs-panel/mailinglist/change_right.pl:80 +#: ../vhffs-panel/mailinglist/change_right.pl:107 msgid "An error occured while modifying the rights" msgstr "" -#: ../vhffs-panel/svn/svn_submit.pl:55 +#: ../vhffs-panel/svn/svn_submit.pl:78 msgid "An error occured while setting up the ACL" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:255 +#: ../vhffs-panel/user/prefs_save.pl:272 msgid "An error occured while the forwarding" msgstr "" -#: ../vhffs-panel/mailinglist/del_member.pl:74 +#: ../vhffs-panel/mailinglist/del_member.pl:101 msgid "An error occured while unsubscribing the user" msgstr "" -#: ../vhffs-panel/admin/user/edit_submit.pl:100 +#: ../vhffs-panel/admin/user/edit_submit.pl:131 msgid "An error occured while updating" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:243 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:273 #, perl-format msgid "" "An error occured while updating language for the following address: %s.\n" msgstr "" -#: ../vhffs-panel/cvs/prefs_save.pl:82 +#: ../vhffs-panel/cvs/prefs_save.pl:112 msgid "An error occured while updating the CVS repository" msgstr "" -#: ../vhffs-panel/svn/prefs_save.pl:76 +#: ../vhffs-panel/repository/prefs_save.pl:96 +msgid "An error occured while updating the Download repository" +msgstr "" + +#: ../vhffs-panel/svn/prefs_save.pl:107 msgid "An error occured while updating the Subversion repository" msgstr "" -#: ../vhffs-panel/mail/save_catchall.pl:65 +#: ../vhffs-panel/mail/save_catchall.pl:96 msgid "An error occured while updating the mail domain" msgstr "" -#: ../vhffs-panel/admin/object/edit_submit.pl:58 +#: ../vhffs-panel/admin/object/edit_submit.pl:89 msgid "An error occured while updating the object" msgstr "" -#: ../vhffs-panel/group/prefs_save.pl:65 ../vhffs-panel/group/delete.pl:58 +#: ../vhffs-panel/group/delete.pl:89 ../vhffs-panel/group/prefs_save.pl:91 msgid "An error occured while updating the project" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:97 +#: ../vhffs-panel/user/prefs_save.pl:128 msgid "An error occured while updating the user account" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:151 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:181 #, perl-format msgid "An error occurs while you subscribed to the list %s \n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:385 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:415 msgid "April" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:62 -#: ../vhffs-listengine/src/archives/archives.pl:116 +#: ../vhffs-listengine/src/archives/archives.pl:147 +#: ../vhffs-listengine/src/archives/show_msg.pl:93 msgid "Archive are not open for this list" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:129 -#: ../vhffs-listengine/src/archives/archives.pl:166 -#: ../vhffs-listengine/src/archives/archives.pl:188 -#: ../vhffs-listengine/src/archives/archives.pl:212 +#: ../vhffs-listengine/src/archives/archives.pl:160 +#: ../vhffs-listengine/src/archives/archives.pl:197 +#: ../vhffs-listengine/src/archives/archives.pl:219 +#: ../vhffs-listengine/src/archives/archives.pl:243 msgid "Archives" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:200 +#: ../vhffs-listengine/src/archives/archives.pl:231 msgid "Archives for " msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:224 +#: ../vhffs-listengine/src/archives/archives.pl:255 msgid "Archives for year" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:94 ../vhffs-panel/largefile/prefs.pl:101 +#: ../vhffs-panel/svn/prefs.pl:124 msgid "Are you SURE you want DELETE this subversion repository ?" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:167 ../vhffs-panel/mail/prefs.pl:101 +#: ../vhffs-panel/mailinglist/prefs.pl:202 ../vhffs-panel/mail/prefs.pl:132 msgid "Are you SURE you want DELETE this Mail Area ?" msgstr "" -#: ../vhffs-panel/mysql/prefs.pl:85 +#: ../vhffs-panel/mysql/prefs.pl:116 msgid "Are you SURE you want DELETE this MySQL database ?" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:78 +#: ../vhffs-panel/pgsql/prefs.pl:109 msgid "Are you SURE you want DELETE this PostgreSQL database ?" msgstr "" -#: ../vhffs-panel/web/prefs.pl:97 +#: ../vhffs-panel/web/prefs.pl:128 msgid "Are you SURE you want DELETE this Web Area ?" msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:77 +#: ../vhffs-panel/cvs/prefs.pl:108 msgid "Are you SURE you want DELETE this cvs repository ?" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:100 +#: ../vhffs-panel/dns/prefs.pl:131 msgid "Are you SURE you want DELETE this domain ?" msgstr "" -#: ../vhffs-panel/group/prefs.pl:68 +#: ../vhffs-panel/repository/prefs.pl:104 +msgid "Are you SURE you want DELETE this download repository ?" +msgstr "" + +#: ../vhffs-panel/group/prefs.pl:99 msgid "Are you SURE you want DELETE this project ?" msgstr "" -#: ../vhffs-panel/user/prefs.pl:74 +#: ../vhffs-panel/user/prefs.pl:103 msgid "Are you SURE you want DELETE this user?" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:401 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:431 msgid "August" msgstr "" -#: ../vhffs-panel/admin/object/delete_avatar.pl:68 +#: ../vhffs-panel/admin/object/delete_avatar.pl:99 msgid "Avatar deleted" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:163 +#: ../vhffs-panel/admin/object/edit.pl:194 msgid "Avatar management" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:65 -#: ../vhffs-panel/admin/broadcast_list.pl:64 +#: ../vhffs-panel/admin/broadcast_list.pl:95 +#: ../vhffs-panel/admin/broadcast_view.pl:96 msgid "Awaiting sending" msgstr "" -#: ../vhffs-panel/subscribe.pl:45 ../vhffs-panel/subscribe_complete.pl:214 +#: ../vhffs-panel/subscribe.pl:169 ../vhffs-panel/subscribe.pl:207 msgid "Back to Login" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:160 +#: ../vhffs-listengine/src/archives/archives.pl:191 #, perl-format msgid "Back to archives by month ( %s )" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:189 +#: ../vhffs-listengine/src/archives/archives.pl:220 #, perl-format msgid "Back to archives by year ( %s )" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:130 +#: ../vhffs-listengine/src/archives/archives.pl:161 msgid "Back to list by day" msgstr "" -#: ../vhffs-panel/lost.pl:28 +#: ../vhffs-panel/lost.pl:56 msgid "Back to login page" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:40 +#: ../vhffs-listengine/src/archives/show_msg.pl:71 msgid "Bad listname" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:100 +#: ../vhffs-listengine/src/archives/archives.pl:131 #, perl-format msgid "Bad listname %s" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:56 +#: ../vhffs-listengine/src/archives/show_msg.pl:87 msgid "Bad message-id" msgstr "" -#: ../vhffs-panel/mysql/prefs.pl:67 +#: ../vhffs-panel/mysql/prefs.pl:98 msgid "" "Be careful ! If you click on modify, VHFFS will stop the database and set a " "new password for this database." msgstr "" -#: ../vhffs-panel/dns/create.pl:35 +#: ../vhffs-panel/dns/create.pl:36 msgid "" "Be careful ! You must give the reason why you want to host this domain on " "our servers." msgstr "" -#: ../vhffs-panel/web/create.pl:44 +#: ../vhffs-panel/web/create.pl:75 msgid "" "Be careful, if you want create www.domain.tld, you should create a webspace " "with servername as domain.tld. VHFFS redirect all request from www.domain." "tld to domain.tld" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:57 +#: ../vhffs-panel/admin/broadcast_view.pl:88 msgid "Body" msgstr "" -#: ../vhffs-panel/lost.pl:25 +#: ../vhffs-panel/lost.pl:53 msgid "" "But fortunately we're smart, so just type your login here<br/>and a new " "password will be sent to you by email!" msgstr "" -#: ../vhffs-panel/mail/delete_forward.pl:53 -#: ../vhffs-panel/mail/change_forward.pl:59 ../vhffs-panel/mail/spambox.pl:59 -#: ../vhffs-panel/mail/spamvirus.pl:59 ../vhffs-panel/mail/delete_box.pl:56 -#: ../vhffs-panel/mail/password_box.pl:59 -#: ../vhffs-panel/mail/add_forward.pl:48 ../vhffs-panel/mail/delete.pl:43 -#: ../vhffs-panel/mail/add_account.pl:51 -#: ../vhffs-panel/admin/mail/delete_forward.pl:59 -#: ../vhffs-panel/admin/mail/change_forward.pl:60 -#: ../vhffs-panel/admin/mail/delete_box.pl:59 -#: ../vhffs-panel/admin/mail/password_box.pl:60 +#: ../vhffs-panel/admin/mail/delete_box.pl:82 +#: ../vhffs-panel/admin/mail/password_box.pl:83 +#: ../vhffs-panel/admin/mail/delete_forward.pl:83 +#: ../vhffs-panel/admin/mail/change_forward.pl:83 +#: ../vhffs-panel/mail/delete.pl:74 ../vhffs-panel/mail/delete_box.pl:79 +#: ../vhffs-panel/mail/add_account.pl:82 +#: ../vhffs-panel/mail/password_box.pl:82 +#: ../vhffs-panel/mail/delete_forward.pl:79 +#: ../vhffs-panel/mail/add_forward.pl:78 +#: ../vhffs-panel/mail/change_forward.pl:82 +#: ../vhffs-panel/mail/spamvirus.pl:82 ../vhffs-panel/mail/spambox.pl:82 msgid "CGI ERROR" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:50 ../vhffs-panel/admin/mail/show.pl:50 -#: ../vhffs-panel/admin/pgsql/edit.pl:48 -#: ../vhffs-panel/admin/pgsql/edit_submit.pl:48 -#: ../vhffs-panel/admin/pgsql/show.pl:48 ../vhffs-panel/admin/cvs/edit.pl:48 -#: ../vhffs-panel/admin/cvs/edit_submit.pl:50 -#: ../vhffs-panel/admin/cvs/show.pl:48 -#: ../vhffs-panel/admin/group/edit_submit.pl:53 -#: ../vhffs-panel/admin/mysql/edit.pl:48 -#: ../vhffs-panel/admin/mysql/edit_submit.pl:48 -#: ../vhffs-panel/admin/mysql/show.pl:47 -#: ../vhffs-panel/admin/object/edit.pl:48 -#: ../vhffs-panel/admin/object/edit_submit.pl:46 -#: ../vhffs-panel/admin/object/delete_avatar.pl:50 -#: ../vhffs-panel/admin/web/edit.pl:48 -#: ../vhffs-panel/admin/web/edit_submit.pl:48 -#: ../vhffs-panel/admin/web/show.pl:48 ../vhffs-panel/admin/user/edit.pl:48 -#: ../vhffs-panel/admin/user/edit_submit.pl:60 -#: ../vhffs-panel/admin/user/edit_note.pl:50 -#: ../vhffs-panel/admin/user/show.pl:50 +#: ../vhffs-panel/admin/user/edit_submit.pl:91 +#: ../vhffs-panel/admin/user/edit.pl:79 ../vhffs-panel/admin/user/show.pl:81 +#: ../vhffs-panel/admin/user/edit_note.pl:81 +#: ../vhffs-panel/admin/pgsql/edit_submit.pl:79 +#: ../vhffs-panel/admin/pgsql/edit.pl:79 ../vhffs-panel/admin/pgsql/show.pl:79 +#: ../vhffs-panel/admin/group/edit_submit.pl:83 +#: ../vhffs-panel/admin/group/edit.pl:77 +#: ../vhffs-panel/admin/repository/edit_submit.pl:81 +#: ../vhffs-panel/admin/repository/edit.pl:79 +#: ../vhffs-panel/admin/repository/show.pl:79 +#: ../vhffs-panel/admin/object/edit_submit.pl:77 +#: ../vhffs-panel/admin/object/delete_avatar.pl:81 +#: ../vhffs-panel/admin/object/edit.pl:79 +#: ../vhffs-panel/admin/web/edit_submit.pl:79 +#: ../vhffs-panel/admin/web/edit.pl:79 ../vhffs-panel/admin/web/show.pl:79 +#: ../vhffs-panel/admin/mysql/edit_submit.pl:78 +#: ../vhffs-panel/admin/mysql/edit.pl:79 ../vhffs-panel/admin/mysql/show.pl:78 +#: ../vhffs-panel/admin/cvs/edit_submit.pl:81 +#: ../vhffs-panel/admin/cvs/edit.pl:79 ../vhffs-panel/admin/cvs/show.pl:79 +#: ../vhffs-panel/admin/mail/edit.pl:81 ../vhffs-panel/admin/mail/show.pl:81 msgid "CGI ERROR !" msgstr "" -#: ../vhffs-panel/admin/group/edit.pl:48 ../vhffs-panel/admin/group/show.pl:48 +#: ../vhffs-panel/admin/group/show.pl:78 #, perl-format msgid "CGI ERROR ! %s" msgstr "" -#: ../vhffs-panel/public/largefile.pl:48 ../vhffs-panel/public/group.pl:39 -#: ../vhffs-panel/public/user.pl:38 +#: ../vhffs-panel/public/user.pl:66 ../vhffs-panel/public/group.pl:71 msgid "CGI ERROR!" msgstr "" -#: ../vhffs-panel/group/join_group.pl:39 -#: ../vhffs-panel/group/remove_user_from_group.pl:40 -#: ../vhffs-panel/acl/submit.pl:54 ../vhffs-panel/svn/prefs.pl:52 -#: ../vhffs-panel/svn/create.pl:33 ../vhffs-panel/mailinglist/submit.pl:65 -#: ../vhffs-panel/mail/submit.pl:43 ../vhffs-panel/largefile/prefs.pl:53 +#: ../vhffs-panel/mailinglist/submit.pl:96 ../vhffs-panel/svn/prefs.pl:82 +#: ../vhffs-panel/svn/create.pl:64 ../vhffs-panel/acl/submit.pl:85 +#: ../vhffs-panel/group/remove_user_from_group.pl:71 +#: ../vhffs-panel/group/join_group.pl:70 ../vhffs-panel/mail/submit.pl:74 msgid "CGI Error" msgstr "" -#: ../vhffs-panel/acl/add_acl_user.pl:55 -#: ../vhffs-panel/acl/add_acl_group.pl:55 +#: ../vhffs-panel/acl/add_acl_group.pl:86 +#: ../vhffs-panel/acl/add_acl_user.pl:86 msgid "CGI Error " msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:42 ../vhffs-panel/group/prefs_save.pl:48 -#: ../vhffs-panel/svn/svn_submit.pl:41 ../vhffs-panel/svn/delete.pl:42 -#: ../vhffs-panel/pgsql/delete.pl:50 -#: ../vhffs-panel/admin/mailing/mailing_submit.pl:47 -#: ../vhffs-panel/admin/group/edit_submit.pl:65 -#: ../vhffs-panel/admin/broadcast_delete.pl:52 -#: ../vhffs-panel/admin/broadcast_submit.pl:52 -#: ../vhffs-panel/admin/broadcast_view.pl:47 -#: ../vhffs-panel/largefile/delete.pl:41 ../vhffs-panel/largefile/submit.pl:44 -#: ../vhffs-panel/mysql/prefs_save.pl:48 ../vhffs-panel/mysql/prefs.pl:40 -#: ../vhffs-panel/mysql/delete.pl:45 ../vhffs-panel/mysql/submit.pl:44 -#: ../vhffs-panel/history.pl:53 +#: ../vhffs-panel/svn/delete.pl:73 ../vhffs-panel/svn/svn_submit.pl:71 +#: ../vhffs-panel/history.pl:84 ../vhffs-panel/pgsql/delete.pl:81 +#: ../vhffs-panel/group/prefs_save.pl:74 ../vhffs-panel/repository/prefs.pl:72 +#: ../vhffs-panel/admin/mailing/mailing_submit.pl:78 +#: ../vhffs-panel/admin/broadcast_submit.pl:83 +#: ../vhffs-panel/admin/broadcast_delete.pl:83 +#: ../vhffs-panel/admin/group/edit_submit.pl:95 +#: ../vhffs-panel/admin/broadcast_view.pl:78 ../vhffs-panel/mysql/delete.pl:76 +#: ../vhffs-panel/mysql/prefs.pl:71 ../vhffs-panel/mysql/submit.pl:75 +#: ../vhffs-panel/mysql/prefs_save.pl:79 ../vhffs-panel/cvs/prefs.pl:73 msgid "CGI Error !" msgstr "" -#: ../vhffs-panel/cvs/prefs_save.pl:43 ../vhffs-panel/cvs/delete.pl:43 -#: ../vhffs-panel/svn/prefs_save.pl:43 +#: ../vhffs-panel/svn/prefs_save.pl:74 ../vhffs-panel/repository/delete.pl:74 +#: ../vhffs-panel/repository/prefs_save.pl:74 ../vhffs-panel/cvs/delete.pl:74 +#: ../vhffs-panel/cvs/prefs_save.pl:74 #, perl-format msgid "CGI Error ! %s" msgstr "" -#: ../vhffs-panel/dns/delete_cname.pl:48 ../vhffs-panel/dns/delete_mx.pl:48 -#: ../vhffs-panel/dns/add_ns.pl:48 ../vhffs-panel/dns/prefs.pl:47 -#: ../vhffs-panel/dns/add_cname.pl:49 ../vhffs-panel/dns/add_a.pl:52 -#: ../vhffs-panel/dns/modif_cname.pl:49 ../vhffs-panel/dns/add_mx.pl:49 -#: ../vhffs-panel/dns/modif_a.pl:49 ../vhffs-panel/dns/modif_mx.pl:49 -#: ../vhffs-panel/dns/delete_ns.pl:47 ../vhffs-panel/dns/delete_a.pl:49 -#: ../vhffs-panel/dns/delete.pl:48 -#: ../vhffs-panel/mailinglist/save_options.pl:53 -#: ../vhffs-panel/mailinglist/del_member.pl:48 -#: ../vhffs-panel/mailinglist/add_sub.pl:48 -#: ../vhffs-panel/mailinglist/change_right.pl:50 -#: ../vhffs-panel/mailinglist/change_right.pl:74 -#: ../vhffs-panel/mailinglist/delete.pl:47 ../vhffs-panel/web/web_submit.pl:41 -#: ../vhffs-panel/pgsql/pgsql_submit.pl:42 -#: ../vhffs-panel/user/prefs_save.pl:60 +#: ../vhffs-panel/mailinglist/delete.pl:78 +#: ../vhffs-panel/mailinglist/save_sig.pl:77 +#: ../vhffs-panel/mailinglist/add_sub.pl:79 +#: ../vhffs-panel/mailinglist/save_options.pl:84 +#: ../vhffs-panel/mailinglist/change_right.pl:81 +#: ../vhffs-panel/mailinglist/change_right.pl:101 +#: ../vhffs-panel/mailinglist/del_member.pl:79 +#: ../vhffs-panel/user/prefs_save.pl:91 ../vhffs-panel/dns/delete.pl:79 +#: ../vhffs-panel/dns/add_mx.pl:80 ../vhffs-panel/dns/prefs.pl:78 +#: ../vhffs-panel/dns/modif_a.pl:80 ../vhffs-panel/dns/add_ns.pl:79 +#: ../vhffs-panel/dns/add_cname.pl:80 ../vhffs-panel/dns/delete_a.pl:50 +#: ../vhffs-panel/dns/delete_ns.pl:78 ../vhffs-panel/dns/delete_mx.pl:79 +#: ../vhffs-panel/dns/modif_cname.pl:81 ../vhffs-panel/dns/modif_mx.pl:81 +#: ../vhffs-panel/dns/add_a.pl:84 ../vhffs-panel/dns/delete_cname.pl:79 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:73 ../vhffs-panel/web/web_submit.pl:72 msgid "CGI Error!" msgstr "" -#: ../vhffs-panel/group/project_submit.pl:39 +#: ../vhffs-panel/group/project_submit.pl:70 msgid "CGI Errror!" msgstr "" -#: ../vhffs-panel/admin/moderation_submit.pl:59 +#: ../vhffs-panel/admin/moderation_submit.pl:90 msgid "CGI problem" msgstr "" -#: ../vhffs-panel/dns/modif_cname.pl:73 +#: ../vhffs-panel/dns/modif_cname.pl:105 msgid "CNAME field successfully updated" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:116 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:145 msgid "CVS Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:118 +#: ../vhffs-panel/admin/cvs/list.pl:89 +msgid "CVS Root" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:147 msgid "CVS Search" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:349 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:425 msgid "CVS repositories for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:90 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:118 msgid "CVS repository" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:186 +#: ../vhffs-panel/admin/moderation.pl:217 msgid "CVS repository awaiting validation" msgstr "" -#: ../vhffs-panel/public/group.pl:114 +#: ../vhffs-panel/public/group.pl:146 msgid "CVS repository for this group" msgstr "" -#: ../vhffs-panel/cvs/prefs_save.pl:86 +#: ../vhffs-panel/cvs/prefs_save.pl:116 msgid "CVS repository updated" msgstr "" -#: ../vhffs-panel/admin/stats.pl:88 +#: ../vhffs-panel/admin/stats.pl:119 msgid "CVS stats" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:107 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:136 msgid "CVSweb" msgstr "" -#: ../vhffs-panel/acl/view.pl:133 ../vhffs-panel/acl/view.pl:158 -#: ../vhffs-panel/acl/view.pl:206 +#: ../vhffs-panel/acl/view.pl:165 ../vhffs-panel/acl/view.pl:189 +#: ../vhffs-panel/acl/view.pl:236 msgid "Can destroy this service" msgstr "" -#: ../vhffs-panel/acl/view.pl:132 ../vhffs-panel/acl/view.pl:157 -#: ../vhffs-panel/acl/view.pl:205 +#: ../vhffs-panel/acl/view.pl:164 ../vhffs-panel/acl/view.pl:188 +#: ../vhffs-panel/acl/view.pl:235 msgid "Can manage ACL for this service" msgstr "" -#: ../vhffs-panel/acl/view.pl:131 ../vhffs-panel/acl/view.pl:156 -#: ../vhffs-panel/acl/view.pl:204 +#: ../vhffs-panel/acl/view.pl:163 ../vhffs-panel/acl/view.pl:187 +#: ../vhffs-panel/acl/view.pl:234 msgid "Can modify this service" msgstr "" -#: ../vhffs-panel/acl/view.pl:130 ../vhffs-panel/acl/view.pl:155 -#: ../vhffs-panel/acl/view.pl:203 +#: ../vhffs-panel/acl/view.pl:162 ../vhffs-panel/acl/view.pl:186 +#: ../vhffs-panel/acl/view.pl:233 msgid "Can view this service" msgstr "" -#: ../vhffs-panel/acl/view.pl:129 ../vhffs-panel/acl/view.pl:154 -#: ../vhffs-panel/acl/view.pl:202 +#: ../vhffs-panel/acl/view.pl:161 ../vhffs-panel/acl/view.pl:185 +#: ../vhffs-panel/acl/view.pl:232 msgid "Can't access" msgstr "" -#: ../vhffs-panel/mail/password_box.pl:81 +#: ../vhffs-panel/mail/password_box.pl:104 msgid "Can't change password" msgstr "" -#: ../vhffs-panel/mail/delete_box.pl:78 +#: ../vhffs-panel/mail/delete_box.pl:101 #, perl-format msgid "Can't delete box %s" msgstr "" -#: ../vhffs-panel/mail/change_forward.pl:81 -#: ../vhffs-panel/admin/mail/change_forward.pl:82 -msgid "Can't modify forwarding" -msgstr "" - -#: ../vhffs-panel/admin/web/edit_submit.pl:68 +#: ../vhffs-panel/admin/web/edit_submit.pl:100 msgid "Can't modify object ..." msgstr "" -#: ../vhffs-panel/admin/cvs/edit_submit.pl:69 -#: ../vhffs-panel/admin/group/edit_submit.pl:80 +#: ../vhffs-panel/admin/group/edit_submit.pl:110 +#: ../vhffs-panel/admin/repository/edit_submit.pl:101 +#: ../vhffs-panel/admin/cvs/edit_submit.pl:100 msgid "Can't modify object..." msgstr "" -#: ../vhffs-panel/dns/add_ns.pl:68 ../vhffs-panel/dns/add_cname.pl:69 -#: ../vhffs-panel/dns/add_a.pl:76 ../vhffs-panel/dns/add_a.pl:92 -#: ../vhffs-panel/dns/add_mx.pl:69 +#: ../vhffs-panel/dns/add_mx.pl:98 ../vhffs-panel/dns/add_ns.pl:96 +#: ../vhffs-panel/dns/add_cname.pl:100 ../vhffs-panel/dns/add_a.pl:108 +#: ../vhffs-panel/dns/add_a.pl:124 msgid "Cannot add this ressource to this domain" msgstr "" -#: ../vhffs-panel/group/join_group.pl:55 +#: ../vhffs-panel/group/join_group.pl:82 msgid "Cannot add this user in this group" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:200 +#: ../vhffs-panel/subscribe.pl:162 msgid "Cannot apply changes to the user" msgstr "" -#: ../vhffs-panel/admin/moderation_submit.pl:106 +#: ../vhffs-panel/admin/moderation_submit.pl:136 msgid "Cannot apply modifications" msgstr "" -#: ../vhffs-panel/mailinglist/save_options.pl:57 -#: ../vhffs-panel/mailinglist/del_member.pl:52 -#: ../vhffs-panel/mailinglist/add_sub.pl:52 -#: ../vhffs-panel/mailinglist/change_right.pl:54 -#: ../vhffs-panel/mailinglist/delete.pl:51 -msgid "Cannot build object" -msgstr "" - -#: ../vhffs-panel/mailinglist/delete.pl:75 +#: ../vhffs-panel/mailinglist/delete.pl:102 msgid "Cannot commit changes on this object, will NOT be deleted" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:179 +#: ../vhffs-panel/subscribe.pl:152 msgid "Cannot create user, the username you entered already exists" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:212 -msgid "" -"Cannot create user. Your username should contain at least 3 characters which " -"are only lower case and digits." -msgstr "" - -#: ../vhffs-panel/dns/delete_cname.pl:68 ../vhffs-panel/dns/delete_mx.pl:68 -#: ../vhffs-panel/dns/delete_ns.pl:67 ../vhffs-panel/dns/delete_a.pl:69 +#: ../vhffs-panel/dns/delete_a.pl:70 ../vhffs-panel/dns/delete_ns.pl:98 +#: ../vhffs-panel/dns/delete_mx.pl:99 ../vhffs-panel/dns/delete_cname.pl:97 msgid "Cannot delete it." msgstr "" -#: ../vhffs-panel/admin/object/delete_avatar.pl:64 +#: ../vhffs-panel/admin/object/delete_avatar.pl:95 msgid "Cannot delete this avatar" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:56 ../vhffs-panel/admin/mail/show.pl:56 -#: ../vhffs-panel/admin/pgsql/edit.pl:54 ../vhffs-panel/admin/pgsql/show.pl:54 -#: ../vhffs-panel/admin/cvs/edit.pl:54 ../vhffs-panel/admin/cvs/show.pl:54 -#: ../vhffs-panel/admin/group/edit.pl:54 -#: ../vhffs-panel/admin/group/edit_submit.pl:59 -#: ../vhffs-panel/admin/group/show.pl:54 ../vhffs-panel/admin/mysql/edit.pl:54 -#: ../vhffs-panel/admin/mysql/show.pl:53 -#: ../vhffs-panel/admin/object/edit.pl:53 -#: ../vhffs-panel/admin/object/edit_submit.pl:50 -#: ../vhffs-panel/admin/object/delete_avatar.pl:54 -#: ../vhffs-panel/admin/web/edit.pl:54 -#: ../vhffs-panel/admin/web/edit_submit.pl:54 -#: ../vhffs-panel/admin/web/show.pl:54 ../vhffs-panel/admin/user/edit.pl:54 -#: ../vhffs-panel/admin/user/edit_submit.pl:65 -#: ../vhffs-panel/admin/user/edit_note.pl:55 -#: ../vhffs-panel/admin/user/show.pl:56 +#: ../vhffs-panel/admin/user/edit_submit.pl:96 +#: ../vhffs-panel/admin/user/edit.pl:85 ../vhffs-panel/admin/user/show.pl:87 +#: ../vhffs-panel/admin/user/edit_note.pl:86 +#: ../vhffs-panel/admin/pgsql/edit.pl:85 ../vhffs-panel/admin/pgsql/show.pl:85 +#: ../vhffs-panel/admin/group/edit_submit.pl:89 +#: ../vhffs-panel/admin/group/edit.pl:83 ../vhffs-panel/admin/group/show.pl:84 +#: ../vhffs-panel/admin/repository/edit.pl:85 +#: ../vhffs-panel/admin/repository/show.pl:85 +#: ../vhffs-panel/admin/object/edit_submit.pl:81 +#: ../vhffs-panel/admin/object/delete_avatar.pl:85 +#: ../vhffs-panel/admin/object/edit.pl:84 +#: ../vhffs-panel/admin/web/edit_submit.pl:85 +#: ../vhffs-panel/admin/web/edit.pl:85 ../vhffs-panel/admin/web/show.pl:85 +#: ../vhffs-panel/admin/mysql/edit.pl:85 ../vhffs-panel/admin/mysql/show.pl:84 +#: ../vhffs-panel/admin/cvs/edit.pl:85 ../vhffs-panel/admin/cvs/show.pl:85 +#: ../vhffs-panel/admin/mail/edit.pl:87 ../vhffs-panel/admin/mail/show.pl:87 msgid "Cannot fetch object" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit_submit.pl:54 -#: ../vhffs-panel/admin/cvs/edit_submit.pl:56 -#: ../vhffs-panel/admin/mysql/edit_submit.pl:54 +#: ../vhffs-panel/admin/pgsql/edit_submit.pl:85 +#: ../vhffs-panel/admin/repository/edit_submit.pl:87 +#: ../vhffs-panel/admin/mysql/edit_submit.pl:84 +#: ../vhffs-panel/admin/cvs/edit_submit.pl:87 #, perl-format msgid "Cannot fetch object %s" msgstr "" -#: ../vhffs-panel/object/upavatar.pl:70 +#: ../vhffs-panel/object/upavatar.pl:101 msgid "Cannot find object" msgstr "" -#: ../vhffs-panel/admin/mail/delete_box.pl:52 -#: ../vhffs-panel/admin/mail/password_box.pl:53 ../vhffs-panel/history.pl:60 +#: ../vhffs-panel/history.pl:91 msgid "Cannot get information on this object" msgstr "" -#: ../vhffs-panel/dns/delete_cname.pl:53 ../vhffs-panel/dns/delete_mx.pl:53 -#: ../vhffs-panel/dns/add_ns.pl:53 ../vhffs-panel/dns/prefs.pl:54 -#: ../vhffs-panel/dns/add_cname.pl:54 ../vhffs-panel/dns/add_a.pl:56 -#: ../vhffs-panel/dns/modif_cname.pl:54 ../vhffs-panel/dns/add_mx.pl:54 -#: ../vhffs-panel/dns/modif_a.pl:54 ../vhffs-panel/dns/modif_mx.pl:54 -#: ../vhffs-panel/dns/delete_ns.pl:52 ../vhffs-panel/dns/delete_a.pl:54 -#: ../vhffs-panel/dns/delete.pl:53 ../vhffs-panel/cvs/prefs.pl:48 -#: ../vhffs-panel/svn/prefs.pl:63 -#: ../vhffs-panel/mailinglist/save_options.pl:61 -#: ../vhffs-panel/mailinglist/del_member.pl:56 -#: ../vhffs-panel/mailinglist/prefs.pl:55 -#: ../vhffs-panel/mailinglist/add_sub.pl:56 -#: ../vhffs-panel/mailinglist/change_right.pl:58 -#: ../vhffs-panel/mailinglist/delete.pl:55 ../vhffs-panel/web/prefs.pl:41 -#: ../vhffs-panel/mail/delete_forward.pl:48 -#: ../vhffs-panel/mail/change_forward.pl:52 -#: ../vhffs-panel/mail/save_catchall.pl:43 ../vhffs-panel/mail/spambox.pl:52 -#: ../vhffs-panel/mail/spamvirus.pl:52 ../vhffs-panel/mail/delete_box.pl:49 -#: ../vhffs-panel/mail/password_box.pl:52 -#: ../vhffs-panel/mail/add_forward.pl:43 ../vhffs-panel/mail/prefs.pl:46 -#: ../vhffs-panel/mail/delete.pl:47 ../vhffs-panel/mail/add_account.pl:44 -#: ../vhffs-panel/pgsql/prefs.pl:40 -#: ../vhffs-panel/admin/mail/delete_forward.pl:52 -#: ../vhffs-panel/admin/mail/change_forward.pl:53 -#: ../vhffs-panel/largefile/prefs.pl:64 ../vhffs-panel/mysql/prefs.pl:46 +#: ../vhffs-panel/mailinglist/delete.pl:82 +#: ../vhffs-panel/mailinglist/save_sig.pl:81 +#: ../vhffs-panel/mailinglist/add_sub.pl:83 +#: ../vhffs-panel/mailinglist/prefs.pl:86 +#: ../vhffs-panel/mailinglist/save_options.pl:88 +#: ../vhffs-panel/mailinglist/change_right.pl:85 +#: ../vhffs-panel/mailinglist/del_member.pl:83 ../vhffs-panel/svn/prefs.pl:93 +#: ../vhffs-panel/dns/delete.pl:84 ../vhffs-panel/dns/add_mx.pl:83 +#: ../vhffs-panel/dns/prefs.pl:85 ../vhffs-panel/dns/modif_a.pl:83 +#: ../vhffs-panel/dns/add_ns.pl:81 ../vhffs-panel/dns/add_cname.pl:85 +#: ../vhffs-panel/dns/delete_a.pl:55 ../vhffs-panel/dns/delete_ns.pl:83 +#: ../vhffs-panel/dns/delete_mx.pl:84 ../vhffs-panel/dns/modif_cname.pl:86 +#: ../vhffs-panel/dns/modif_mx.pl:86 ../vhffs-panel/dns/add_a.pl:88 +#: ../vhffs-panel/dns/delete_cname.pl:82 ../vhffs-panel/pgsql/prefs.pl:71 +#: ../vhffs-panel/repository/prefs.pl:76 ../vhffs-panel/web/prefs.pl:72 +#: ../vhffs-panel/mysql/prefs.pl:77 ../vhffs-panel/cvs/prefs.pl:79 +#: ../vhffs-panel/mail/add_account.pl:75 +#: ../vhffs-panel/mail/save_catchall.pl:74 +#: ../vhffs-panel/mail/add_forward.pl:73 msgid "Cannot get informations on this object" msgstr "" -#: ../vhffs-panel/acl/view.pl:102 +#: ../vhffs-panel/acl/view.pl:134 #, perl-format msgid "Cannot get informations on this object %s %s" msgstr "" -#: ../vhffs-panel/admin/stats.pl:42 +#: ../vhffs-panel/admin/stats.pl:73 msgid "Cannot get statistics" msgstr "" -#: ../vhffs-panel/mail/delete_forward.pl:43 -#: ../vhffs-panel/mail/change_forward.pl:45 ../vhffs-panel/mail/spambox.pl:45 -#: ../vhffs-panel/mail/spamvirus.pl:45 ../vhffs-panel/mail/delete_box.pl:42 -#: ../vhffs-panel/mail/password_box.pl:45 -#: ../vhffs-panel/admin/mail/delete_forward.pl:45 -#: ../vhffs-panel/admin/mail/change_forward.pl:46 -#: ../vhffs-panel/admin/mail/delete_box.pl:45 -#: ../vhffs-panel/admin/mail/password_box.pl:46 -#, perl-format -msgid "Cannot instanciate object %s" -msgstr "" - -#: ../vhffs-panel/dns/modif_a.pl:73 +#: ../vhffs-panel/dns/modif_a.pl:102 msgid "Cannot modify this ressource on this domain" msgstr "" -#: ../vhffs-panel/admin/moderation_submit.pl:63 -msgid "Cannot obtain information about this object" -msgstr "" - -#: ../vhffs-panel/group/remove_user_from_group.pl:52 +#: ../vhffs-panel/group/remove_user_from_group.pl:83 msgid "Cannot remove the owner from a group" msgstr "" -#: ../vhffs-panel/cvs/prefs_save.pl:47 ../vhffs-panel/cvs/delete.pl:47 +#: ../vhffs-panel/cvs/delete.pl:78 ../vhffs-panel/cvs/prefs_save.pl:77 msgid "Cannot retrieve informations about this CVS repository" msgstr "" -#: ../vhffs-panel/svn/prefs_save.pl:47 +#: ../vhffs-panel/repository/delete.pl:78 +#: ../vhffs-panel/repository/prefs_save.pl:78 +msgid "Cannot retrieve informations about this Download repository" +msgstr "" + +#: ../vhffs-panel/svn/prefs_save.pl:78 msgid "Cannot retrieve informations about this Subversion repository" msgstr "" -#: ../vhffs-panel/svn/delete.pl:46 ../vhffs-panel/largefile/delete.pl:45 +#: ../vhffs-panel/svn/delete.pl:77 msgid "Cannot retrieve informations about this repository" msgstr "" -#: ../vhffs-panel/mailinglist/save_options.pl:123 +#: ../vhffs-panel/mailinglist/save_sig.pl:95 +#: ../vhffs-panel/mailinglist/save_options.pl:150 msgid "Cannot save" msgstr "" -#: ../vhffs-panel/alert_submit.pl:53 +#: ../vhffs-panel/alert_submit.pl:84 msgid "Cannot send message, CGI error..." msgstr "" -#: ../vhffs-panel/dns/modif_cname.pl:69 +#: ../vhffs-panel/dns/modif_cname.pl:101 msgid "Cannot update CNAME on this domain" msgstr "" -#: ../vhffs-panel/dns/modif_mx.pl:69 +#: ../vhffs-panel/dns/modif_mx.pl:101 msgid "Cannot update MX on this domain" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:67 ../vhffs-panel/admin/mail/show.pl:67 +#: ../vhffs-panel/admin/mail/edit.pl:98 ../vhffs-panel/admin/mail/show.pl:98 msgid "Catchall" msgstr "" -#: ../vhffs-panel/mail/save_catchall.pl:69 -msgid "Catchall address successfully added" +#: ../vhffs-panel/mail/prefs.pl:101 +msgid "Catchall address" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:70 -msgid "Catchall adress" +#: ../vhffs-panel/mail/save_catchall.pl:100 +msgid "Catchall address successfully changed" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:73 +#: ../vhffs-panel/mail/prefs.pl:104 msgid "Catchall mail" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:77 +#: ../vhffs-listengine/src/archives/show_msg.pl:108 msgid "Cc: " msgstr "" -#: ../vhffs-panel/mail/prefs.pl:179 +#: ../vhffs-panel/mail/prefs.pl:210 msgid "Change Forward" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:120 ../vhffs-panel/admin/mail/edit.pl:111 +#: ../vhffs-panel/admin/mail/edit.pl:142 ../vhffs-panel/mail/prefs.pl:151 msgid "Change Password" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:207 ../vhffs-panel/user/prefs_save.pl:219 +#: ../vhffs-panel/user/prefs_save.pl:234 msgid "Change anti-virus status for your account\n" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:94 +#: ../vhffs-panel/mail/prefs.pl:125 msgid "Change catchall forward" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:97 +#: ../vhffs-panel/admin/mail/edit.pl:128 msgid "Change forward" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:88 +#: ../vhffs-listengine/src/archives/archives.pl:119 msgid "Change language" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:132 +#: ../vhffs-panel/mailinglist/prefs.pl:167 msgid "Change rights\n" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:180 ../vhffs-panel/user/prefs_save.pl:191 +#: ../vhffs-panel/user/prefs_save.pl:216 msgid "Change spam protection status for your account\n" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:87 +#: ../vhffs-listengine/src/archives/archives.pl:118 msgid "Change theme" msgstr "" -#: ../vhffs-panel/admin/web/list.pl:78 +#: ../vhffs-panel/admin/web/list.pl:91 msgid "Change this Website" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:58 ../vhffs-panel/admin/su.pl:45 +#: ../vhffs-panel/admin/su.pl:76 ../vhffs-api/src/Vhffs/Panel/Admin.pm:87 msgid "Change user-id" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:49 -#: ../vhffs-robots/src/refused_cvs.pl:50 -#: ../vhffs-robots/src/refused_postgres.pl:49 -#: ../vhffs-robots/src/refused_web.pl:49 -#: ../vhffs-robots/src/refused_mail.pl:49 -#: ../vhffs-robots/src/refused_dns.pl:49 -#: ../vhffs-robots/src/refused_mysql.pl:49 -#: ../vhffs-robots/src/refused_svn.pl:49 ../vhffs-robots/src/refused_ml.pl:49 -#: ../vhffs-robots/src/refused_groups.pl:49 ../vhffs-irc/modobot.pl:369 -#: ../vhffs-panel/admin/moderation_submit.pl:77 +#: ../vhffs-robots/src/refused_ml.pl:77 ../vhffs-robots/src/refused_mail.pl:79 +#: ../vhffs-robots/src/refused_postgres.pl:80 +#: ../vhffs-robots/src/refused_cvs.pl:76 ../vhffs-robots/src/refused_web.pl:75 +#: ../vhffs-robots/src/refused_mysql.pl:50 +#: ../vhffs-robots/src/refused_svn.pl:46 +#: ../vhffs-robots/src/refused_groups.pl:75 +#: ../vhffs-robots/src/refused_repository.pl:80 +#: ../vhffs-robots/src/refused_dns.pl:79 msgid "Cheers," msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:74 ../vhffs-panel/admin/user/show.pl:74 -#: ../vhffs-panel/user/prefs.pl:52 ../vhffs-panel/subscribe.pl:41 +#: ../vhffs-panel/admin/moderation_submit.pl:106 ../vhffs-irc/modobot.pl:398 +msgid "" +"Cheers,\n" +"The Moderator and Admin team\n" +msgstr "" + +#: ../vhffs-panel/subscribe.pl:203 ../vhffs-panel/user/prefs.pl:83 +#: ../vhffs-panel/admin/user/edit.pl:105 ../vhffs-panel/admin/user/show.pl:105 msgid "City" msgstr "" -#: ../vhffs-panel/subscribe.pl:46 +#: ../vhffs-panel/subscribe.pl:212 msgid "Code confirmation" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:66 +#: ../vhffs-panel/subscribe.pl:85 msgid "Codes do not match" msgstr "" -#: ../vhffs-panel/user/prefs.pl:56 +#: ../vhffs-panel/user/prefs.pl:87 msgid "Confirm Password" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:200 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:230 msgid "Confirmation code was wrong.\n" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:76 ../vhffs-panel/admin/user/show.pl:76 -#: ../vhffs-panel/user/prefs.pl:54 ../vhffs-panel/subscribe.pl:42 +#: ../vhffs-panel/subscribe.pl:204 ../vhffs-panel/user/prefs.pl:85 +#: ../vhffs-panel/admin/user/edit.pl:107 ../vhffs-panel/admin/user/show.pl:107 msgid "Country" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:65 ../vhffs-panel/admin/web/show.pl:64 +#: ../vhffs-panel/admin/web/edit.pl:96 ../vhffs-panel/admin/web/show.pl:95 msgid "Crawl" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:110 -#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:116 -#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:98 -#: ../vhffs-api/src/Vhffs/Panel/Web.pm:105 -#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:115 -#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:121 -#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:84 -#: ../vhffs-api/src/Vhffs/Panel/LargeFile.pm:33 -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:89 -#: ../vhffs-api/src/Vhffs/Panel/Group.pm:114 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:142 +#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:147 +#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:146 +#: ../vhffs-api/src/Vhffs/Panel/Web.pm:136 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:117 +#: ../vhffs-api/src/Vhffs/Panel/Repository.pm:119 +#: ../vhffs-api/src/Vhffs/Panel/Group.pm:163 +#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:140 +#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:118 +#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:151 msgid "Create" msgstr "" -#: ../vhffs-panel/cvs/create.pl:33 +#: ../vhffs-panel/cvs/create.pl:64 msgid "Create a CVS Repository" msgstr "" -#: ../vhffs-panel/dns/create.pl:33 +#: ../vhffs-panel/dns/create.pl:34 msgid "Create a DNS " msgstr "" -#: ../vhffs-panel/mysql/create.pl:33 +#: ../vhffs-panel/repository/create.pl:64 +msgid "Create a Download Repository" +msgstr "" + +#: ../vhffs-panel/mysql/create.pl:64 msgid "Create a MySQL database" msgstr "" -#: ../vhffs-panel/pgsql/create.pl:33 +#: ../vhffs-panel/pgsql/create.pl:64 msgid "Create a Postgres database" msgstr "" -#: ../vhffs-panel/group/create.pl:30 +#: ../vhffs-panel/group/create.pl:61 msgid "Create a Project" msgstr "" -#: ../vhffs-panel/svn/create.pl:39 +#: ../vhffs-panel/svn/create.pl:70 msgid "Create a Subversion Repository" msgstr "" -#: ../vhffs-panel/mail/create.pl:33 +#: ../vhffs-panel/mail/create.pl:64 msgid "Create a mail space" msgstr "" -#: ../vhffs-panel/mailinglist/create.pl:56 +#: ../vhffs-panel/mailinglist/create.pl:87 msgid "Create a new mailing list" msgstr "" -#: ../vhffs-panel/web/create.pl:42 +#: ../vhffs-panel/web/create.pl:73 msgid "Create a web space" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:344 -#: ../vhffs-panel/admin/mail/edit.pl:130 ../vhffs-panel/admin/pgsql/edit.pl:89 -#: ../vhffs-panel/admin/cvs/edit.pl:98 ../vhffs-panel/admin/group/edit.pl:91 -#: ../vhffs-panel/admin/mysql/edit.pl:89 -#: ../vhffs-panel/admin/object/edit.pl:89 ../vhffs-panel/admin/web/edit.pl:102 -#: ../vhffs-panel/admin/user/edit.pl:113 +#: ../vhffs-panel/admin/user/edit.pl:144 +#: ../vhffs-panel/admin/pgsql/edit.pl:120 +#: ../vhffs-panel/admin/group/edit.pl:120 +#: ../vhffs-panel/admin/repository/edit.pl:120 +#: ../vhffs-panel/admin/object/edit.pl:120 +#: ../vhffs-panel/admin/web/edit.pl:133 ../vhffs-panel/admin/mysql/edit.pl:121 +#: ../vhffs-panel/admin/cvs/edit.pl:129 ../vhffs-panel/admin/mail/edit.pl:161 msgid "Created" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:340 -#: ../vhffs-panel/admin/mail/edit.pl:128 ../vhffs-panel/admin/pgsql/edit.pl:87 -#: ../vhffs-panel/admin/cvs/edit.pl:96 ../vhffs-panel/admin/group/edit.pl:89 -#: ../vhffs-panel/admin/mysql/edit.pl:87 -#: ../vhffs-panel/admin/object/edit.pl:87 ../vhffs-panel/admin/web/edit.pl:100 -#: ../vhffs-panel/admin/user/edit.pl:111 +#: ../vhffs-panel/admin/user/edit.pl:142 +#: ../vhffs-panel/admin/pgsql/edit.pl:118 +#: ../vhffs-panel/admin/group/edit.pl:118 +#: ../vhffs-panel/admin/repository/edit.pl:118 +#: ../vhffs-panel/admin/object/edit.pl:118 +#: ../vhffs-panel/admin/web/edit.pl:131 ../vhffs-panel/admin/mysql/edit.pl:119 +#: ../vhffs-panel/admin/cvs/edit.pl:127 ../vhffs-panel/admin/mail/edit.pl:159 msgid "Creating error" msgstr "" -#: ../vhffs-panel/group/prefs.pl:80 ../vhffs-panel/user/prefs.pl:80 +#: ../vhffs-panel/user/prefs.pl:113 ../vhffs-panel/group/prefs.pl:111 msgid "Current avatar" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:529 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:612 #, perl-format msgid "Current group: %s" msgstr "" -#: ../vhffs-panel/admin/cvs/edit.pl:64 ../vhffs-panel/admin/cvs/show.pl:63 +#: ../vhffs-panel/admin/cvs/edit.pl:95 ../vhffs-panel/admin/cvs/show.pl:94 msgid "Cvsroot" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:131 +#: ../vhffs-panel/admin/pgsql/list.pl:87 ../vhffs-panel/admin/mysql/list.pl:88 +msgid "DB Name" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:160 msgid "DB Search" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:122 +#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:152 msgid "DNS" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:144 +#: ../vhffs-panel/admin/moderation.pl:175 msgid "DNS awaiting validation" msgstr "" -#: ../vhffs-panel/dns/create.pl:36 +#: ../vhffs-panel/dns/create.pl:37 msgid "DNS servers:" msgstr "" -#: ../vhffs-panel/admin/stats.pl:80 +#: ../vhffs-panel/admin/stats.pl:111 msgid "DNS stats" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:112 -#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:86 +#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:142 +#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:120 msgid "Database Access" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit.pl:64 ../vhffs-panel/admin/pgsql/show.pl:63 +#: ../vhffs-panel/admin/pgsql/edit.pl:95 ../vhffs-panel/admin/pgsql/show.pl:94 msgid "Database Name" msgstr "" -#: ../vhffs-panel/mysql/submit.pl:52 +#: ../vhffs-panel/mysql/submit.pl:83 msgid "Database name must contain at least 3 caracters" msgstr "" -#: ../vhffs-panel/pgsql/pgsql_submit.pl:54 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:85 msgid "Database name must contain between 3 and 16 characters" msgstr "" -#: ../vhffs-panel/pgsql/pgsql_submit.pl:46 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:77 msgid "Database password must contains at least 3 characters" msgstr "" -#: ../vhffs-panel/pgsql/delete.pl:54 +#: ../vhffs-panel/pgsql/delete.pl:85 msgid "Database will NOT be deleted !" msgstr "" -#: ../vhffs-panel/pgsql/delete.pl:66 +#: ../vhffs-panel/pgsql/delete.pl:97 msgid "Database will be DELETE" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:54 +#: ../vhffs-panel/admin/broadcast_view.pl:85 msgid "Date" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:64 +#: ../vhffs-panel/admin/object/edit.pl:95 msgid "Date of creation" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:417 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:447 msgid "December" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:103 ../vhffs-panel/dns/prefs.pl:153 -#: ../vhffs-panel/dns/prefs.pl:174 ../vhffs-panel/dns/prefs.pl:194 -#: ../vhffs-panel/dns/prefs.pl:215 ../vhffs-panel/cvs/prefs.pl:80 -#: ../vhffs-panel/group/prefs.pl:71 ../vhffs-panel/svn/prefs.pl:97 -#: ../vhffs-panel/mailinglist/prefs.pl:170 ../vhffs-panel/web/prefs.pl:100 -#: ../vhffs-panel/mail/prefs.pl:104 ../vhffs-panel/pgsql/prefs.pl:81 -#: ../vhffs-panel/largefile/prefs.pl:104 ../vhffs-panel/mysql/prefs.pl:88 -#: ../vhffs-panel/user/prefs.pl:77 +#: ../vhffs-panel/mailinglist/prefs.pl:205 ../vhffs-panel/svn/prefs.pl:127 +#: ../vhffs-panel/user/prefs.pl:106 ../vhffs-panel/dns/prefs.pl:134 +#: ../vhffs-panel/dns/prefs.pl:184 ../vhffs-panel/dns/prefs.pl:205 +#: ../vhffs-panel/dns/prefs.pl:225 ../vhffs-panel/dns/prefs.pl:246 +#: ../vhffs-panel/pgsql/prefs.pl:112 ../vhffs-panel/group/prefs.pl:102 +#: ../vhffs-panel/repository/prefs.pl:107 ../vhffs-panel/web/prefs.pl:131 +#: ../vhffs-panel/mysql/prefs.pl:119 ../vhffs-panel/cvs/prefs.pl:111 +#: ../vhffs-panel/mail/prefs.pl:135 msgid "Delete" msgstr "" -#: ../vhffs-panel/user/prefs.pl:72 +#: ../vhffs-panel/user/prefs.pl:101 msgid "Delete YOUR user" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:164 +#: ../vhffs-panel/admin/object/edit.pl:195 msgid "Delete avatar for this object" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:131 +#: ../vhffs-panel/mailinglist/prefs.pl:166 msgid "Delete from list" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:76 +#: ../vhffs-panel/pgsql/prefs.pl:107 msgid "Delete this PostgreSQL database" msgstr "" -#: ../vhffs-panel/mysql/prefs.pl:83 +#: ../vhffs-panel/mysql/prefs.pl:114 msgid "Delete this database" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:98 +#: ../vhffs-panel/dns/prefs.pl:129 msgid "Delete this domain name from the VHFFS platform" msgstr "" -#: ../vhffs-panel/largefile/prefs.pl:99 -msgid "Delete this file from servers" -msgstr "" - -#: ../vhffs-panel/mail/prefs.pl:180 ../vhffs-panel/admin/mail/edit.pl:113 +#: ../vhffs-panel/admin/mail/edit.pl:144 ../vhffs-panel/mail/prefs.pl:211 msgid "Delete this forward" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:165 +#: ../vhffs-panel/mailinglist/prefs.pl:200 msgid "Delete this list" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:121 ../vhffs-panel/admin/mail/edit.pl:98 +#: ../vhffs-panel/admin/mail/edit.pl:129 ../vhffs-panel/mail/prefs.pl:152 msgid "Delete this mail account" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:99 +#: ../vhffs-panel/mail/prefs.pl:130 msgid "Delete this mail domain" msgstr "" -#: ../vhffs-panel/admin/broadcast_list.pl:57 +#: ../vhffs-panel/admin/broadcast_list.pl:88 msgid "Delete this mailing" msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:75 ../vhffs-panel/group/prefs.pl:66 +#: ../vhffs-panel/group/prefs.pl:97 ../vhffs-panel/repository/prefs.pl:102 +#: ../vhffs-panel/cvs/prefs.pl:106 msgid "Delete this project" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:92 +#: ../vhffs-panel/svn/prefs.pl:122 msgid "Delete this repository" msgstr "" -#: ../vhffs-panel/web/prefs.pl:95 +#: ../vhffs-panel/web/prefs.pl:126 msgid "Delete this web area" msgstr "" -#: ../vhffs-panel/dns/create.pl:41 ../vhffs-panel/cvs/create.pl:40 -#: ../vhffs-panel/group/create.pl:35 ../vhffs-panel/svn/create.pl:46 -#: ../vhffs-panel/public/allgroups.pl:46 ../vhffs-panel/public/group.pl:57 -#: ../vhffs-panel/public/lastgroups.pl:46 ../vhffs-panel/pgsql/create.pl:43 -#: ../vhffs-panel/admin/mail/edit.pl:71 ../vhffs-panel/admin/mail/show.pl:71 -#: ../vhffs-panel/admin/pgsql/edit.pl:70 ../vhffs-panel/admin/pgsql/show.pl:68 -#: ../vhffs-panel/admin/cvs/edit.pl:69 ../vhffs-panel/admin/cvs/show.pl:68 -#: ../vhffs-panel/admin/group/edit.pl:70 ../vhffs-panel/admin/group/show.pl:69 -#: ../vhffs-panel/admin/mysql/edit.pl:70 ../vhffs-panel/admin/mysql/show.pl:67 -#: ../vhffs-panel/admin/object/edit.pl:66 ../vhffs-panel/admin/web/edit.pl:73 -#: ../vhffs-panel/admin/web/show.pl:70 ../vhffs-panel/largefile/create.pl:42 -#: ../vhffs-panel/mysql/create.pl:41 +#: ../vhffs-panel/svn/create.pl:77 ../vhffs-panel/dns/create.pl:42 +#: ../vhffs-panel/pgsql/create.pl:74 ../vhffs-panel/group/create.pl:66 +#: ../vhffs-panel/repository/create.pl:72 +#: ../vhffs-panel/admin/pgsql/edit.pl:101 +#: ../vhffs-panel/admin/pgsql/show.pl:99 ../vhffs-panel/admin/group/edit.pl:99 +#: ../vhffs-panel/admin/group/show.pl:99 +#: ../vhffs-panel/admin/repository/edit.pl:99 +#: ../vhffs-panel/admin/repository/show.pl:98 +#: ../vhffs-panel/admin/object/edit.pl:97 ../vhffs-panel/admin/web/edit.pl:104 +#: ../vhffs-panel/admin/web/show.pl:101 ../vhffs-panel/admin/mysql/edit.pl:102 +#: ../vhffs-panel/admin/mysql/show.pl:98 ../vhffs-panel/admin/cvs/edit.pl:100 +#: ../vhffs-panel/admin/cvs/show.pl:99 ../vhffs-panel/admin/mail/edit.pl:102 +#: ../vhffs-panel/admin/mail/show.pl:102 +#: ../vhffs-panel/public/lastgroups.pl:75 ../vhffs-panel/public/group.pl:89 +#: ../vhffs-panel/public/allgroups.pl:82 ../vhffs-panel/mysql/create.pl:72 +#: ../vhffs-panel/cvs/create.pl:71 msgid "Description" msgstr "" -#: ../vhffs-panel/web/prefs.pl:68 +#: ../vhffs-panel/web/prefs.pl:99 msgid "Description of your webarea" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:127 +#: ../vhffs-panel/dns/prefs.pl:158 msgid "Destination" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:134 +#: ../vhffs-panel/mail/prefs.pl:165 msgid "Disable anti-spam" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:153 +#: ../vhffs-panel/mail/prefs.pl:184 msgid "Disable anti-virus" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:118 -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:91 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:144 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:119 msgid "Documentation" msgstr "" -#: ../vhffs-panel/group/join_group.pl:92 +#: ../vhffs-panel/group/join_group.pl:119 msgid "Doe not exist in the VHFFS database" msgstr "" -#: ../vhffs-panel/public/largefile.pl:55 -msgid "Does not support largefile" -msgstr "" - -#: ../vhffs-panel/mail/create.pl:34 ../vhffs-panel/admin/mail/edit.pl:66 -#: ../vhffs-panel/admin/mail/show.pl:66 +#: ../vhffs-panel/admin/mail/edit.pl:97 ../vhffs-panel/admin/mail/show.pl:97 +#: ../vhffs-panel/mail/create.pl:65 msgid "Domain" msgstr "" -#: ../vhffs-panel/dns/create.pl:34 +#: ../vhffs-panel/dns/create.pl:35 ../vhffs-panel/admin/dns/list.pl:87 +#: ../vhffs-panel/admin/mail/list.pl:87 msgid "Domain Name" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:480 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:555 msgid "Domains for this group" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:72 ../vhffs-panel/admin/web/show.pl:86 +#: ../vhffs-panel/admin/web/edit.pl:103 ../vhffs-panel/admin/web/show.pl:117 msgid "Don't use Crawl" msgstr "" -#: ../vhffs-panel/public/largefile.pl:113 -msgid "Download" +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:530 +msgid "Download repositories for this group" msgstr "" -#: ../vhffs-panel/public/largefile.pl:78 -#, perl-format -msgid "Download %s" +#: ../vhffs-api/src/Vhffs/Panel/Repository.pm:120 +msgid "Download repository" msgstr "" -#: ../vhffs-panel/admin/cvs/edit.pl:61 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:224 +msgid "Download repository admin" +msgstr "" + +#: ../vhffs-panel/admin/moderation.pl:477 +msgid "Download repository awaiting validation" +msgstr "" + +#: ../vhffs-panel/repository/prefs_save.pl:100 +msgid "Download repository updated" +msgstr "" + +#: ../vhffs-panel/admin/cvs/edit.pl:92 msgid "Edit CVS" msgstr "" -#: ../vhffs-panel/admin/group/edit.pl:61 +#: ../vhffs-panel/admin/repository/edit.pl:92 +msgid "Edit Download repository" +msgstr "" + +#: ../vhffs-panel/admin/group/edit.pl:90 msgid "Edit Group" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:63 +#: ../vhffs-panel/admin/mail/edit.pl:94 msgid "Edit Mail Domain" msgstr "" -#: ../vhffs-panel/admin/mysql/edit.pl:61 +#: ../vhffs-panel/admin/mysql/edit.pl:92 msgid "Edit MySQL database" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:59 +#: ../vhffs-panel/admin/object/edit.pl:90 msgid "Edit Object" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit.pl:61 +#: ../vhffs-panel/admin/pgsql/edit.pl:92 msgid "Edit PostgreSQL database" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:61 +#: ../vhffs-panel/admin/user/edit.pl:92 msgid "Edit User" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:61 +#: ../vhffs-panel/admin/web/edit.pl:92 msgid "Edit Web Area" msgstr "" -#: ../vhffs-panel/admin/object/list.pl:88 +#: ../vhffs-panel/admin/object/list.pl:96 msgid "Edit this object" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:95 +#: ../vhffs-panel/mailinglist/prefs.pl:130 msgid "Email adress" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:138 +#: ../vhffs-panel/mail/prefs.pl:169 msgid "Enable anti-spam" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:157 +#: ../vhffs-panel/mail/prefs.pl:188 msgid "Enable anti-virus" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:72 +#: ../vhffs-panel/mail/prefs.pl:103 msgid "Enter a mail address to catch all email for this domain" msgstr "" -#: ../vhffs-panel/admin/broadcast_submit.pl:64 +#: ../vhffs-panel/admin/broadcast_submit.pl:95 msgid "Error !" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:144 +#: ../vhffs-panel/user/prefs_save.pl:180 msgid "" "Error ! You MUST provide a password in your account when you create your " "popable account" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:184 ../vhffs-panel/user/prefs_save.pl:195 +#: ../vhffs-panel/group/project_submit.pl:83 +msgid "Error creating group (maybe a group with the same name already exists)" +msgstr "" + +#: ../vhffs-panel/user/prefs_save.pl:221 msgid "Error for spam protection\n" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:211 ../vhffs-panel/user/prefs_save.pl:223 +#: ../vhffs-panel/user/prefs_save.pl:239 msgid "Error for virus protection\n" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:45 -#: ../vhffs-listengine/src/archives/archives.pl:105 +#: ../vhffs-listengine/src/archives/archives.pl:136 +#: ../vhffs-listengine/src/archives/show_msg.pl:76 msgid "Error in listname" msgstr "" -#: ../vhffs-panel/mail/spambox.pl:87 ../vhffs-panel/mail/spamvirus.pl:87 -msgid "Error when applying changes" -msgstr "" - -#: ../vhffs-panel/object/upavatar.pl:99 +#: ../vhffs-panel/object/upavatar.pl:130 msgid "Error when upload avatar for this object" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:99 +#: ../vhffs-panel/mailinglist/submit.pl:116 msgid "Error while creating list (unknow problem)" msgstr "" -#: ../vhffs-panel/web/web_submit.pl:61 -msgid "Error while creating the user. The username already exists" +#: ../vhffs-panel/web/web_submit.pl:90 +msgid "Error while creating the webarea, it probably already exists !" msgstr "" -#: ../vhffs-panel/group/project_submit.pl:64 -msgid "Error while creation !" -msgstr "" - -#: ../vhffs-panel/dns/delete.pl:71 +#: ../vhffs-panel/dns/delete.pl:102 msgid "Error while switching state. DNS will NOT be deleted" msgstr "" -#: ../vhffs-panel/mysql/prefs_save.pl:52 +#: ../vhffs-panel/mysql/prefs_save.pl:83 msgid "Error, password can be only alphanumeric caracters" msgstr "" -#: ../vhffs-panel/group/delete.pl:51 +#: ../vhffs-panel/group/delete.pl:82 msgid "" "Error, your group is not empty. Please remove all objects from this group " "and try again" msgstr "" -#: ../vhffs-panel/group/prefs.pl:39 +#: ../vhffs-panel/group/prefs.pl:70 msgid "Error. This group doesn't exists" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:137 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:227 msgid "Expired session ! Please login again" msgstr "" -#: ../vhffs-panel/admin/user/edit_note.pl:70 +#: ../vhffs-panel/admin/user/edit_note.pl:101 msgid "Failed to modify note" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:377 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:407 msgid "February" msgstr "" -#: ../vhffs-panel/object/upavatar.pl:87 +#: ../vhffs-panel/object/upavatar.pl:118 msgid "File to big. Max size if 5000 bytes for an avatar" msgstr "" -#: ../vhffs-panel/public/largefile.pl:79 ../vhffs-panel/public/largefile.pl:84 -msgid "File type" +#: ../vhffs-panel/object/upavatar.pl:114 +msgid "Filetype not supported" msgstr "" -#: ../vhffs-panel/largefile/prefs.pl:87 ../vhffs-panel/largefile/create.pl:34 -msgid "Filename" +#: ../vhffs-panel/subscribe.pl:200 ../vhffs-panel/user/prefs.pl:80 +#: ../vhffs-panel/admin/user/edit.pl:96 ../vhffs-panel/admin/user/show.pl:97 +#: ../vhffs-panel/public/user.pl:83 ../vhffs-panel/public/lastusers.pl:78 +msgid "Firstname" msgstr "" -#: ../vhffs-panel/largefile/submit.pl:48 -msgid "Filename is too short. Must contains at least 3 caracters" +#: ../vhffs-panel/admin/mail/delete_forward.pl:109 +#, perl-format +msgid "Forward %s deleted" msgstr "" -#: ../vhffs-panel/admin/largefile/list.pl:82 -msgid "Filename(size in Mb/type)" +#: ../vhffs-panel/admin/mail/change_forward.pl:109 +#, perl-format +msgid "Forward %s successfully added" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:445 -msgid "Files awaiting validation" -msgstr "" - -#: ../vhffs-panel/largefile/create.pl:36 -msgid "Filetype (extension, ...)" -msgstr "" - -#: ../vhffs-panel/object/upavatar.pl:83 -msgid "Filetype not supported" -msgstr "" - -#: ../vhffs-panel/public/lastusers.pl:46 ../vhffs-panel/public/user.pl:55 -#: ../vhffs-panel/admin/user/edit.pl:65 ../vhffs-panel/admin/user/show.pl:66 -#: ../vhffs-panel/user/prefs.pl:49 ../vhffs-panel/subscribe.pl:38 -msgid "Firstname" -msgstr "" - -#: ../vhffs-panel/user/prefs.pl:142 +#: ../vhffs-panel/user/prefs.pl:179 #, perl-format msgid "Forward emails from %s@%s to %s" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:84 ../vhffs-panel/admin/mail/show.pl:84 +#: ../vhffs-panel/admin/mail/edit.pl:115 ../vhffs-panel/admin/mail/show.pl:115 msgid "Forward for" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:89 +#: ../vhffs-panel/mail/prefs.pl:120 msgid "Forward mail" msgstr "" -#: ../vhffs-panel/mail/change_forward.pl:91 -#: ../vhffs-panel/admin/mail/change_forward.pl:92 -msgid "Forwarding successfully added" +#: ../vhffs-panel/mail/change_forward.pl:108 +msgid "Forward successfully added" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:84 +#: ../vhffs-panel/mail/delete_forward.pl:100 +msgid "Forward successfully deleted" +msgstr "" + +#: ../vhffs-panel/mail/prefs.pl:115 msgid "Forwards" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:75 +#: ../vhffs-listengine/src/archives/show_msg.pl:106 msgid "From: " msgstr "" -#: ../vhffs-panel/admin/group/edit.pl:65 ../vhffs-panel/admin/group/show.pl:64 -#: ../vhffs-panel/admin/user/edit.pl:72 ../vhffs-panel/admin/user/show.pl:72 +#: ../vhffs-panel/admin/user/edit.pl:103 ../vhffs-panel/admin/user/show.pl:103 +#: ../vhffs-panel/admin/group/edit.pl:94 ../vhffs-panel/admin/group/show.pl:94 msgid "GID" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:78 ../vhffs-panel/admin/user/show.pl:78 +#: ../vhffs-panel/admin/user/edit.pl:109 ../vhffs-panel/admin/user/show.pl:109 msgid "GPG key" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:53 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:82 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:87 msgid "General" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:54 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:83 msgid "Get Statistics" msgstr "" -#: ../vhffs-panel/lost.pl:27 -msgid "Give me a new password... " +#: ../vhffs-panel/lost.pl:55 +msgid "Give me a new password" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:58 -#: ../vhffs-panel/public/lastusers.pl:81 ../vhffs-panel/public/index.pl:51 -#: ../vhffs-panel/public/allgroups.pl:74 ../vhffs-panel/public/group.pl:217 -#: ../vhffs-panel/public/user.pl:85 ../vhffs-panel/public/lastgroups.pl:73 +#: ../vhffs-panel/public/user.pl:114 ../vhffs-panel/public/lastgroups.pl:102 +#: ../vhffs-panel/public/lastusers.pl:111 +#: ../vhffs-panel/public/allwebsites.pl:98 ../vhffs-panel/public/index.pl:80 +#: ../vhffs-panel/public/group.pl:222 ../vhffs-panel/public/allgroups.pl:110 msgid "Go on login page" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:282 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:306 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:332 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:247 +msgid "Go to Login" +msgstr "" + #: ../vhffs-api/src/Vhffs/Panel/Main.pm:358 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:384 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:411 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:437 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:464 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:489 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:382 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:408 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:434 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:460 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:487 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:513 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:539 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:564 msgid "Go to admin" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:230 ../vhffs-panel/svn/prefs.pl:122 -#: ../vhffs-panel/mailinglist/prefs.pl:180 -#: ../vhffs-panel/largefile/prefs.pl:114 +#: ../vhffs-panel/login.pl:88 ../vhffs-panel/login.pl:118 +msgid "Go to login page" +msgstr "" + +#: ../vhffs-panel/mailinglist/prefs.pl:215 ../vhffs-panel/svn/prefs.pl:152 +#: ../vhffs-panel/dns/prefs.pl:261 msgid "Go to object-part admin" msgstr "" -#: ../vhffs-panel/auth.pl:54 +#: ../vhffs-panel/auth.pl:79 msgid "Go to public area" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:58 ../vhffs-panel/largefile/prefs.pl:59 +#: ../vhffs-panel/svn/prefs.pl:88 msgid "Grant an user access to this repository" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:68 ../vhffs-panel/admin/mail/show.pl:68 -#: ../vhffs-panel/admin/pgsql/edit.pl:67 ../vhffs-panel/admin/pgsql/show.pl:65 -#: ../vhffs-panel/admin/cvs/edit.pl:66 ../vhffs-panel/admin/cvs/show.pl:65 -#: ../vhffs-panel/admin/mysql/edit.pl:67 ../vhffs-panel/admin/mysql/show.pl:64 -#: ../vhffs-panel/admin/web/edit.pl:68 ../vhffs-panel/admin/web/show.pl:67 +#: ../vhffs-panel/admin/svn/list.pl:77 ../vhffs-panel/admin/mailing/list.pl:87 +#: ../vhffs-panel/admin/dns/list.pl:88 ../vhffs-panel/admin/pgsql/edit.pl:98 +#: ../vhffs-panel/admin/pgsql/show.pl:96 ../vhffs-panel/admin/pgsql/list.pl:88 +#: ../vhffs-panel/admin/repository/edit.pl:96 +#: ../vhffs-panel/admin/repository/show.pl:95 +#: ../vhffs-panel/admin/repository/list.pl:89 +#: ../vhffs-panel/admin/web/edit.pl:99 ../vhffs-panel/admin/web/show.pl:98 +#: ../vhffs-panel/admin/web/list.pl:79 ../vhffs-panel/admin/mysql/edit.pl:99 +#: ../vhffs-panel/admin/mysql/show.pl:95 ../vhffs-panel/admin/mysql/list.pl:89 +#: ../vhffs-panel/admin/cvs/edit.pl:97 ../vhffs-panel/admin/cvs/show.pl:96 +#: ../vhffs-panel/admin/cvs/list.pl:90 ../vhffs-panel/admin/mail/edit.pl:99 +#: ../vhffs-panel/admin/mail/show.pl:99 ../vhffs-panel/admin/mail/list.pl:88 msgid "Group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:265 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:341 #, perl-format msgid "Group %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:78 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:107 msgid "Group Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:260 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:336 msgid "Group error" msgstr "" -#: ../vhffs-panel/largefile/create.pl:39 -msgid "Group for this new file" -msgstr "" - -#: ../vhffs-panel/cvs/create.pl:35 +#: ../vhffs-panel/cvs/create.pl:66 msgid "Group owning this CVS" msgstr "" -#: ../vhffs-panel/dns/create.pl:37 +#: ../vhffs-panel/dns/create.pl:38 msgid "Group owning this DNS" msgstr "" -#: ../vhffs-panel/svn/create.pl:41 +#: ../vhffs-panel/svn/create.pl:72 msgid "Group owning this Subversion repository" msgstr "" -#: ../vhffs-panel/pgsql/create.pl:36 ../vhffs-panel/mysql/create.pl:35 +#: ../vhffs-panel/pgsql/create.pl:67 ../vhffs-panel/mysql/create.pl:66 msgid "Group owning this database" msgstr "" -#: ../vhffs-panel/mailinglist/create.pl:58 +#: ../vhffs-panel/mailinglist/create.pl:89 msgid "Group owning this mailing list" msgstr "" -#: ../vhffs-panel/web/create.pl:45 ../vhffs-panel/mail/create.pl:35 +#: ../vhffs-panel/repository/create.pl:66 +msgid "Group owning this repository" +msgstr "" + +#: ../vhffs-panel/web/create.pl:76 ../vhffs-panel/mail/create.pl:66 msgid "Group owning this web space" msgstr "" -#: ../vhffs-panel/public/index.pl:41 +#: ../vhffs-panel/public/index.pl:70 msgid "Group public area" msgstr "" -#: ../vhffs-panel/acl/view.pl:119 ../vhffs-panel/public/allgroups.pl:42 -#: ../vhffs-panel/public/group.pl:56 ../vhffs-panel/public/lastgroups.pl:42 -#: ../vhffs-panel/admin/group/edit.pl:64 ../vhffs-panel/admin/group/show.pl:63 +#: ../vhffs-panel/acl/view.pl:151 ../vhffs-panel/admin/group/edit.pl:93 +#: ../vhffs-panel/admin/group/show.pl:93 ../vhffs-panel/admin/group/list.pl:89 +#: ../vhffs-panel/public/lastgroups.pl:71 ../vhffs-panel/public/group.pl:88 +#: ../vhffs-panel/public/allgroups.pl:78 msgid "Groupname" msgstr "" -#: ../vhffs-panel/public/lastusers.pl:50 ../vhffs-panel/public/user.pl:59 +#: ../vhffs-panel/public/user.pl:87 ../vhffs-panel/public/lastusers.pl:82 msgid "Groups" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:57 +#: ../vhffs-panel/admin/moderation.pl:88 msgid "Groups awaiting validation" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:202 +#: ../vhffs-panel/admin/user/edit.pl:233 msgid "Groups of this user" msgstr "" -#: ../vhffs-panel/admin/stats.pl:67 +#: ../vhffs-panel/admin/stats.pl:98 msgid "Groups stats" msgstr "" -#: ../vhffs-panel/public/largefile.pl:81 ../vhffs-panel/largefile/create.pl:40 -msgid "Hash" -msgstr "" - -#: ../vhffs-panel/user/prefs_save.pl:91 +#: ../vhffs-panel/user/prefs_save.pl:122 #, perl-format msgid "" "Hello %s %s,\n" @@ -1669,1778 +1676,1744 @@ "VHFFS administrators\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:17 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:47 msgid "Hello and welcome on listengine help\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:55 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:89 msgid "Help" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:24 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:54 msgid "Here are the basic listengine commands:\n" msgstr "" -#: ../vhffs-panel/alert.pl:37 +#: ../vhffs-panel/alert.pl:68 msgid "Here, you can report a bug to the admin team" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:126 -#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:135 -#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:133 -#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:142 -#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:116 -#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:123 -#: ../vhffs-api/src/Vhffs/Panel/Web.pm:121 -#: ../vhffs-api/src/Vhffs/Panel/Web.pm:130 -#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:130 -#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:138 -#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:141 -#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:101 -#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:110 -#: ../vhffs-api/src/Vhffs/Panel/LargeFile.pm:49 -#: ../vhffs-api/src/Vhffs/Panel/LargeFile.pm:56 -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:105 -#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:116 -#: ../vhffs-panel/admin/mail/edit.pl:73 ../vhffs-panel/admin/mail/show.pl:72 -#: ../vhffs-panel/admin/pgsql/edit.pl:72 ../vhffs-panel/admin/pgsql/show.pl:69 -#: ../vhffs-panel/admin/cvs/edit.pl:71 ../vhffs-panel/admin/cvs/show.pl:69 -#: ../vhffs-panel/admin/group/edit.pl:72 ../vhffs-panel/admin/group/show.pl:70 -#: ../vhffs-panel/admin/mysql/edit.pl:72 ../vhffs-panel/admin/mysql/show.pl:69 -#: ../vhffs-panel/admin/object/list.pl:68 ../vhffs-panel/admin/web/edit.pl:75 -#: ../vhffs-panel/admin/web/show.pl:71 ../vhffs-panel/admin/user/edit.pl:79 -#: ../vhffs-panel/admin/user/show.pl:80 ../vhffs-panel/history.pl:74 +#: ../vhffs-panel/history.pl:105 ../vhffs-panel/admin/user/edit.pl:110 +#: ../vhffs-panel/admin/user/show.pl:111 +#: ../vhffs-panel/admin/pgsql/edit.pl:103 +#: ../vhffs-panel/admin/pgsql/show.pl:100 +#: ../vhffs-panel/admin/group/edit.pl:101 +#: ../vhffs-panel/admin/group/show.pl:100 +#: ../vhffs-panel/admin/repository/edit.pl:101 +#: ../vhffs-panel/admin/repository/show.pl:99 +#: ../vhffs-panel/admin/object/list.pl:90 +#: ../vhffs-panel/admin/object/list.pl:97 ../vhffs-panel/admin/web/edit.pl:106 +#: ../vhffs-panel/admin/web/show.pl:102 ../vhffs-panel/admin/mysql/edit.pl:104 +#: ../vhffs-panel/admin/mysql/show.pl:100 ../vhffs-panel/admin/cvs/edit.pl:102 +#: ../vhffs-panel/admin/cvs/show.pl:100 ../vhffs-panel/admin/mail/edit.pl:104 +#: ../vhffs-panel/admin/mail/show.pl:103 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:159 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:171 +#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:162 +#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:170 +#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:161 +#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:166 +#: ../vhffs-api/src/Vhffs/Panel/Web.pm:152 +#: ../vhffs-api/src/Vhffs/Panel/Web.pm:161 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:133 +#: ../vhffs-api/src/Vhffs/Panel/Cvs.pm:145 +#: ../vhffs-api/src/Vhffs/Panel/Repository.pm:133 +#: ../vhffs-api/src/Vhffs/Panel/Repository.pm:144 +#: ../vhffs-api/src/Vhffs/Panel/Group.pm:178 +#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:156 +#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:165 +#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:135 +#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:144 +#: ../vhffs-api/src/Vhffs/Panel/DNS.pm:171 msgid "History" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:166 +#: ../vhffs-panel/admin/object/edit.pl:197 msgid "History of this object" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:69 ../vhffs-panel/admin/user/show.pl:69 +#: ../vhffs-panel/admin/user/edit.pl:100 ../vhffs-panel/admin/user/show.pl:100 msgid "Home" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:57 -#: ../vhffs-panel/public/lastusers.pl:80 ../vhffs-panel/public/index.pl:50 -#: ../vhffs-panel/public/allgroups.pl:73 ../vhffs-panel/public/group.pl:216 -#: ../vhffs-panel/public/user.pl:84 ../vhffs-panel/public/lastgroups.pl:72 +#: ../vhffs-panel/public/user.pl:113 ../vhffs-panel/public/lastgroups.pl:101 +#: ../vhffs-panel/public/lastusers.pl:110 +#: ../vhffs-panel/public/allwebsites.pl:97 ../vhffs-panel/public/index.pl:79 +#: ../vhffs-panel/public/group.pl:221 ../vhffs-panel/public/allgroups.pl:109 msgid "Homepage of public area" msgstr "" -#: ../vhffs-panel/largefile/create.pl:33 -msgid "Host a file" -msgstr "" - -#: ../vhffs-panel/admin/user/edit.pl:101 ../vhffs-panel/admin/user/show.pl:109 +#: ../vhffs-panel/admin/user/edit.pl:132 ../vhffs-panel/admin/user/show.pl:140 msgid "Hosted" msgstr "" -#: ../vhffs-panel/largefile/prefs.pl:84 -msgid "Hosted file administration" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/LargeFile.pm:34 -msgid "Hosted files" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:195 -msgid "Hosted files admin" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:455 ../vhffs-panel/public/group.pl:167 -msgid "Hosted files for this group" -msgstr "" - -#: ../vhffs-panel/admin/stats.pl:138 -msgid "Hosted files stats" -msgstr "" - -#: ../vhffs-panel/auth.pl:35 +#: ../vhffs-panel/auth.pl:61 msgid "I've lost my password" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:110 +#: ../vhffs-panel/dns/prefs.pl:141 msgid "IP" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:134 +#: ../vhffs-panel/dns/prefs.pl:165 msgid "IP/host of your NS" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:59 -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:76 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:89 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:106 msgid "" "If this mail is an error and you don't ask to be a subscriber to this list, " "please do not answer to this mail\n" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:48 -#: ../vhffs-robots/src/refused_cvs.pl:49 -#: ../vhffs-robots/src/refused_postgres.pl:48 -#: ../vhffs-robots/src/refused_web.pl:48 -#: ../vhffs-robots/src/refused_mail.pl:48 -#: ../vhffs-robots/src/refused_dns.pl:48 -#: ../vhffs-robots/src/refused_mysql.pl:48 -#: ../vhffs-robots/src/refused_svn.pl:48 ../vhffs-robots/src/refused_ml.pl:48 -#: ../vhffs-robots/src/refused_groups.pl:48 +#: ../vhffs-robots/src/refused_ml.pl:76 ../vhffs-robots/src/refused_mail.pl:78 +#: ../vhffs-robots/src/refused_postgres.pl:79 +#: ../vhffs-robots/src/refused_cvs.pl:75 ../vhffs-robots/src/refused_web.pl:74 +#: ../vhffs-robots/src/refused_mysql.pl:49 +#: ../vhffs-robots/src/refused_svn.pl:45 +#: ../vhffs-robots/src/refused_groups.pl:74 +#: ../vhffs-robots/src/refused_repository.pl:79 +#: ../vhffs-robots/src/refused_dns.pl:78 #, perl-format msgid "If you encounters problem, please mail: %s\n" msgstr "" -#: ../vhffs-panel/group/prefs.pl:58 +#: ../vhffs-panel/group/prefs.pl:89 msgid "" "If you want more disk space for your project, you must fill a form in the " "bug report section, in the menu. Don't forget to mention the name of the " "group." msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:42 -#: ../vhffs-robots/src/refused_cvs.pl:43 -#: ../vhffs-robots/src/refused_postgres.pl:42 -#: ../vhffs-robots/src/refused_web.pl:42 -#: ../vhffs-robots/src/refused_mail.pl:42 -#: ../vhffs-robots/src/refused_dns.pl:42 -#: ../vhffs-robots/src/refused_mysql.pl:42 -#: ../vhffs-robots/src/refused_svn.pl:42 ../vhffs-robots/src/refused_ml.pl:42 -#: ../vhffs-robots/src/refused_groups.pl:42 +#: ../vhffs-robots/src/refused_ml.pl:70 ../vhffs-robots/src/refused_mail.pl:72 +#: ../vhffs-robots/src/refused_postgres.pl:73 +#: ../vhffs-robots/src/refused_cvs.pl:70 ../vhffs-robots/src/refused_web.pl:69 +#: ../vhffs-robots/src/refused_mysql.pl:43 +#: ../vhffs-robots/src/refused_svn.pl:40 +#: ../vhffs-robots/src/refused_groups.pl:69 +#: ../vhffs-robots/src/refused_repository.pl:73 +#: ../vhffs-robots/src/refused_dns.pl:72 msgid "In hope to keep you in our hosting service" msgstr "" -#: ../vhffs-panel/dns/add_a.pl:88 ../vhffs-panel/dns/modif_a.pl:69 +#: ../vhffs-panel/dns/modif_a.pl:98 ../vhffs-panel/dns/add_a.pl:120 msgid "Invalid IP" msgstr "" -#: ../vhffs-panel/dns/dns_submit.pl:42 +#: ../vhffs-panel/dns/dns_submit.pl:72 msgid "Invalid domain name" msgstr "" -#: ../vhffs-panel/public/largefile.pl:70 -msgid "Invalid file" +#: ../vhffs-panel/mail/submit.pl:78 +msgid "Invalid mail domain" msgstr "" -#: ../vhffs-panel/mail/submit.pl:47 -msgid "Invalid mail domain" +#: ../vhffs-panel/subscribe.pl:93 +msgid "" +"Invalid username, it must contain between 3 and 12 alphanumeric characters, " +"all in lowercase" msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:71 +#: ../vhffs-panel/cvs/prefs.pl:102 msgid "Is this CVS repository public ??" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:88 +#: ../vhffs-panel/svn/prefs.pl:118 msgid "Is this a public repository ?" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:373 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:403 msgid "January" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:397 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:427 msgid "July" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:393 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:423 msgid "June" msgstr "" -#: ../vhffs-panel/user/prefs.pl:57 +#: ../vhffs-panel/user/prefs.pl:88 msgid "Language" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:60 -#: ../vhffs-panel/public/lastusers.pl:83 ../vhffs-panel/public/index.pl:53 -#: ../vhffs-panel/public/allgroups.pl:76 ../vhffs-panel/public/group.pl:219 -#: ../vhffs-panel/public/user.pl:87 ../vhffs-panel/public/lastgroups.pl:75 +#: ../vhffs-panel/public/user.pl:116 ../vhffs-panel/public/lastgroups.pl:104 +#: ../vhffs-panel/public/lastusers.pl:113 +#: ../vhffs-panel/public/allwebsites.pl:100 ../vhffs-panel/public/index.pl:82 +#: ../vhffs-panel/public/group.pl:224 ../vhffs-panel/public/allgroups.pl:112 msgid "Last groups" msgstr "" -#: ../vhffs-panel/public/lastgroups.pl:33 +#: ../vhffs-panel/public/lastgroups.pl:62 #, perl-format msgid "Last groups on %s" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:61 -#: ../vhffs-panel/public/lastusers.pl:84 ../vhffs-panel/public/index.pl:54 -#: ../vhffs-panel/public/allgroups.pl:77 ../vhffs-panel/public/group.pl:220 -#: ../vhffs-panel/public/user.pl:88 ../vhffs-panel/public/lastgroups.pl:76 +#: ../vhffs-panel/public/user.pl:117 ../vhffs-panel/public/lastgroups.pl:105 +#: ../vhffs-panel/public/lastusers.pl:114 +#: ../vhffs-panel/public/allwebsites.pl:101 ../vhffs-panel/public/index.pl:83 +#: ../vhffs-panel/public/group.pl:225 ../vhffs-panel/public/allgroups.pl:113 msgid "Last users" msgstr "" -#: ../vhffs-panel/public/lastusers.pl:36 +#: ../vhffs-panel/public/lastusers.pl:68 #, perl-format msgid "Last users on %s" msgstr "" -#: ../vhffs-panel/public/lastusers.pl:48 ../vhffs-panel/public/user.pl:57 -#: ../vhffs-panel/admin/user/edit.pl:66 ../vhffs-panel/admin/user/show.pl:67 -#: ../vhffs-panel/user/prefs.pl:50 ../vhffs-panel/subscribe.pl:39 +#: ../vhffs-panel/subscribe.pl:201 ../vhffs-panel/user/prefs.pl:81 +#: ../vhffs-panel/admin/user/edit.pl:97 ../vhffs-panel/admin/user/show.pl:98 +#: ../vhffs-panel/public/user.pl:85 ../vhffs-panel/public/lastusers.pl:80 msgid "Lastname" msgstr "" -#: ../vhffs-panel/largefile/prefs.pl:90 ../vhffs-panel/largefile/create.pl:37 -msgid "License" -msgstr "" - -#: ../vhffs-panel/largefile/submit.pl:52 -msgid "" -"License is too short. Please tell us about legal aspects concerning the use " -"of this new file." -msgstr "" - -#: ../vhffs-panel/public/largefile.pl:82 -msgid "License of this file" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:117 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:146 msgid "List all CVS" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:130 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:159 msgid "List all DBs" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:170 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:199 msgid "List all Postgres DB" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:103 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:132 msgid "List all SVN repo" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:76 +#: ../vhffs-panel/mail/prefs.pl:107 msgid "List all accounts" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:86 +#: ../vhffs-panel/dns/prefs.pl:117 msgid "List all all A reccords" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:144 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:173 msgid "List all domain names" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:183 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:212 msgid "List all domains" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:85 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:225 +msgid "List all download repositories" +msgstr "" + +#: ../vhffs-panel/mail/prefs.pl:116 msgid "List all forwardings for this domain" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:79 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:108 msgid "List all groups" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:196 -msgid "List all hosted files" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:157 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:186 msgid "List all lists" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:93 +#: ../vhffs-panel/mailinglist/prefs.pl:128 msgid "List all members" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:61 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:90 msgid "List all objects" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:71 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:100 msgid "List all users" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:230 +#: ../vhffs-panel/admin/moderation.pl:261 msgid "List awaiting validation" msgstr "" -#: ../vhffs-panel/admin/cvs/list.pl:53 +#: ../vhffs-panel/admin/cvs/list.pl:86 msgid "List of all CVS repositories" msgstr "" -#: ../vhffs-panel/admin/mysql/list.pl:53 +#: ../vhffs-panel/admin/repository/list.pl:85 +msgid "List of all Download repositories" +msgstr "" + +#: ../vhffs-panel/admin/mysql/list.pl:85 msgid "List of all MySQL databases" msgstr "" -#: ../vhffs-panel/admin/pgsql/list.pl:53 +#: ../vhffs-panel/admin/pgsql/list.pl:84 msgid "List of all PostgreSQL databases" msgstr "" -#: ../vhffs-panel/admin/dns/list.pl:53 +#: ../vhffs-panel/admin/dns/list.pl:84 msgid "List of all domains" msgstr "" -#: ../vhffs-panel/admin/group/list.pl:49 +#: ../vhffs-panel/admin/group/list.pl:81 msgid "List of all groups" msgstr "" -#: ../vhffs-panel/admin/mail/list.pl:53 +#: ../vhffs-panel/admin/mail/list.pl:84 msgid "List of all mail-domain" msgstr "" -#: ../vhffs-panel/admin/mailing/list.pl:54 +#: ../vhffs-panel/admin/mailing/list.pl:83 msgid "List of all mailing-list" msgstr "" -#: ../vhffs-panel/admin/user/list.pl:53 +#: ../vhffs-panel/admin/user/list.pl:76 msgid "List of all users" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:59 -#: ../vhffs-panel/public/lastusers.pl:82 ../vhffs-panel/public/index.pl:52 -#: ../vhffs-panel/public/allgroups.pl:75 ../vhffs-panel/public/group.pl:218 -#: ../vhffs-panel/public/user.pl:86 ../vhffs-panel/public/lastgroups.pl:74 -#: ../vhffs-panel/admin/web/list.pl:53 +#: ../vhffs-panel/admin/web/list.pl:75 ../vhffs-panel/public/user.pl:115 +#: ../vhffs-panel/public/lastgroups.pl:103 +#: ../vhffs-panel/public/lastusers.pl:112 +#: ../vhffs-panel/public/allwebsites.pl:99 ../vhffs-panel/public/index.pl:81 +#: ../vhffs-panel/public/group.pl:223 ../vhffs-panel/public/allgroups.pl:111 msgid "List of all websites" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:89 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:118 msgid "List websites" msgstr "" -#: ../vhffs-panel/mailinglist/delete.pl:67 +#: ../vhffs-panel/mailinglist/delete.pl:94 msgid "List will NOT be deleted" msgstr "" -#: ../vhffs-panel/public/group.pl:194 +#: ../vhffs-panel/public/group.pl:199 msgid "List(s) for this group" msgstr "" -#: ../vhffs-panel/admin/stats.pl:129 +#: ../vhffs-panel/admin/stats.pl:160 msgid "Listengine stats" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:88 +#: ../vhffs-panel/mail/prefs.pl:119 msgid "Local Part" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:79 +#: ../vhffs-panel/mail/prefs.pl:110 msgid "Local Part for this account" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:170 ../vhffs-panel/login.pl:59 -#: ../vhffs-panel/login.pl:100 ../vhffs-panel/lost_ack.pl:41 -#: ../vhffs-panel/lost_ack.pl:52 +#: ../vhffs-panel/lost_ack.pl:70 ../vhffs-panel/lost_ack.pl:81 msgid "Login" msgstr "" -#: ../vhffs-panel/login.pl:89 +#: ../vhffs-panel/login.pl:107 msgid "Login OK, please wait..." msgstr "" -#: ../vhffs-panel/login.pl:58 ../vhffs-panel/login.pl:99 +#: ../vhffs-panel/login.pl:87 ../vhffs-panel/login.pl:117 msgid "Login failed !" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:57 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:91 msgid "Logout" msgstr "" -#: ../vhffs-panel/dns/modif_mx.pl:73 +#: ../vhffs-panel/dns/modif_mx.pl:105 msgid "MX successfully changed" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:129 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:158 msgid "MYSQL Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:116 -#: ../vhffs-panel/admin/user/edit.pl:77 ../vhffs-panel/admin/user/show.pl:77 +#: ../vhffs-panel/admin/user/edit.pl:108 ../vhffs-panel/admin/user/show.pl:108 +#: ../vhffs-api/src/Vhffs/Panel/Mail.pm:148 msgid "Mail" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:143 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:172 msgid "Mail Admin" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:67 +#: ../vhffs-panel/mail/prefs.pl:98 msgid "Mail Administration for domain " msgstr "" -#: ../vhffs-panel/admin/moderation.pl:319 +#: ../vhffs-panel/admin/moderation.pl:350 msgid "Mail Area awaiting validation" msgstr "" -#: ../vhffs-panel/mail/submit.pl:53 +#: ../vhffs-panel/mail/submit.pl:82 msgid "Mail area successfully created !" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:428 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:504 msgid "Mail domain for this group" msgstr "" -#: ../vhffs-panel/mailinglist/create.pl:57 +#: ../vhffs-panel/mailinglist/create.pl:88 msgid "Mail for the list" msgstr "" -#: ../vhffs-panel/admin/stats.pl:102 +#: ../vhffs-panel/admin/stats.pl:133 msgid "Mail stats" msgstr "" -#: ../vhffs-panel/admin/mailing/mailing_submit.pl:57 +#: ../vhffs-panel/admin/mailing/mailing_submit.pl:88 msgid "Mail successfully sent" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:59 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:88 msgid "Mail to all hosted people" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:322 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:352 #, perl-format msgid "Mail with id %s" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:90 +#: ../vhffs-panel/user/prefs_save.pl:121 msgid "Mailbox modified" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:161 +#: ../vhffs-panel/user/prefs_save.pl:197 msgid "Mailbox successfully added" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:99 +#: ../vhffs-panel/admin/mailing/list.pl:86 +#: ../vhffs-api/src/Vhffs/Panel/Mailinglist.pm:147 msgid "Mailing List" msgstr "" -#: ../vhffs-panel/admin/broadcast_submit.pl:60 +#: ../vhffs-panel/admin/broadcast_submit.pl:91 msgid "Mailing successfully added" msgstr "" -#: ../vhffs-panel/admin/broadcast_delete.pl:60 +#: ../vhffs-panel/admin/broadcast_delete.pl:91 msgid "Mailing successfully deleted" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:78 +#: ../vhffs-panel/mailinglist/submit.pl:108 msgid "Mailing-list successfully created !" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:156 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:185 msgid "Mailing-lists Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:402 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:478 msgid "Mailing-lists for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:60 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:89 msgid "Manage mailings" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:92 +#: ../vhffs-panel/mailinglist/prefs.pl:127 msgid "Manage members" msgstr "" -#: ../vhffs-panel/group/join_group.pl:74 +#: ../vhffs-panel/group/join_group.pl:101 msgid "Many users matched your query. Please choose between them" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:381 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:411 msgid "March" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:389 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:419 msgid "May" msgstr "" -#: ../vhffs-panel/admin/broadcast.pl:48 +#: ../vhffs-panel/admin/broadcast.pl:79 msgid "Message" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:89 +#: ../vhffs-listengine/src/archives/show_msg.pl:120 #, perl-format msgid "Message from list %s" msgstr "" -#: ../vhffs-panel/alert_submit.pl:43 +#: ../vhffs-panel/alert_submit.pl:74 msgid "Message sent by the following account" msgstr "" -#: ../vhffs-panel/alert_submit.pl:49 +#: ../vhffs-panel/alert_submit.pl:80 msgid "Message sent successfully" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:291 -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:306 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:321 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:336 #, perl-format msgid "Message with id: %s" msgstr "" -#: ../vhffs-panel/public/largefile.pl:99 -msgid "Mirrors" -msgstr "" - -#: ../vhffs-panel/mailinglist/prefs.pl:82 +#: ../vhffs-panel/mailinglist/prefs.pl:113 msgid "Moderated" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:55 -#: ../vhffs-panel/admin/moderation.pl:53 +#: ../vhffs-panel/admin/moderation.pl:84 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:84 msgid "Moderation" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:99 ../vhffs-panel/admin/user/show.pl:101 +#: ../vhffs-panel/admin/user/edit.pl:130 ../vhffs-panel/admin/user/show.pl:132 msgid "Moderator" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:44 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:77 msgid "Moderator account : " msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:368 -#: ../vhffs-panel/admin/mail/edit.pl:135 ../vhffs-panel/admin/pgsql/edit.pl:94 -#: ../vhffs-panel/admin/cvs/edit.pl:103 ../vhffs-panel/admin/group/edit.pl:96 -#: ../vhffs-panel/admin/mysql/edit.pl:94 -#: ../vhffs-panel/admin/object/edit.pl:94 ../vhffs-panel/admin/web/edit.pl:107 -#: ../vhffs-panel/admin/user/edit.pl:118 +#: ../vhffs-panel/admin/user/edit.pl:149 +#: ../vhffs-panel/admin/pgsql/edit.pl:125 +#: ../vhffs-panel/admin/group/edit.pl:125 +#: ../vhffs-panel/admin/repository/edit.pl:125 +#: ../vhffs-panel/admin/object/edit.pl:125 +#: ../vhffs-panel/admin/web/edit.pl:138 ../vhffs-panel/admin/mysql/edit.pl:126 +#: ../vhffs-panel/admin/cvs/edit.pl:134 ../vhffs-panel/admin/mail/edit.pl:166 msgid "Modification applied" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:364 -#: ../vhffs-panel/admin/mail/edit.pl:134 ../vhffs-panel/admin/pgsql/edit.pl:93 -#: ../vhffs-panel/admin/cvs/edit.pl:102 ../vhffs-panel/admin/group/edit.pl:95 -#: ../vhffs-panel/admin/mysql/edit.pl:93 -#: ../vhffs-panel/admin/object/edit.pl:93 ../vhffs-panel/admin/web/edit.pl:106 -#: ../vhffs-panel/admin/user/edit.pl:117 +#: ../vhffs-panel/admin/user/edit.pl:148 +#: ../vhffs-panel/admin/pgsql/edit.pl:124 +#: ../vhffs-panel/admin/group/edit.pl:124 +#: ../vhffs-panel/admin/repository/edit.pl:124 +#: ../vhffs-panel/admin/object/edit.pl:124 +#: ../vhffs-panel/admin/web/edit.pl:137 ../vhffs-panel/admin/mysql/edit.pl:125 +#: ../vhffs-panel/admin/cvs/edit.pl:133 ../vhffs-panel/admin/mail/edit.pl:165 msgid "Modification error" msgstr "" -#: ../vhffs-panel/admin/moderation_submit.pl:110 +#: ../vhffs-panel/admin/moderation_submit.pl:140 msgid "Modifications applied successfully" msgstr "" -#: ../vhffs-panel/pgsql/prefs_save.pl:69 +#: ../vhffs-panel/pgsql/prefs_save.pl:100 msgid "Modifications applied to your database" msgstr "" -#: ../vhffs-panel/web/prefs_save.pl:64 +#: ../vhffs-panel/web/prefs_save.pl:95 msgid "Modifications applied to your webarea" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit_submit.pl:71 -#: ../vhffs-panel/admin/cvs/edit_submit.pl:73 -#: ../vhffs-panel/admin/group/edit_submit.pl:84 -#: ../vhffs-panel/admin/mysql/edit_submit.pl:71 +#: ../vhffs-panel/admin/pgsql/edit_submit.pl:102 +#: ../vhffs-panel/admin/group/edit_submit.pl:114 +#: ../vhffs-panel/admin/repository/edit_submit.pl:105 +#: ../vhffs-panel/admin/mysql/edit_submit.pl:106 +#: ../vhffs-panel/admin/cvs/edit_submit.pl:104 msgid "Modifications successfully added" msgstr "" -#: ../vhffs-panel/admin/web/edit_submit.pl:72 -#: ../vhffs-panel/admin/user/edit_submit.pl:104 +#: ../vhffs-panel/admin/user/edit_submit.pl:135 +#: ../vhffs-panel/admin/web/edit_submit.pl:104 msgid "Modifications successfully applied" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:154 ../vhffs-panel/dns/prefs.pl:175 -#: ../vhffs-panel/dns/prefs.pl:195 ../vhffs-panel/cvs/prefs.pl:74 -#: ../vhffs-panel/group/prefs.pl:65 ../vhffs-panel/svn/prefs.pl:91 -#: ../vhffs-panel/web/prefs.pl:88 ../vhffs-panel/pgsql/prefs.pl:75 -#: ../vhffs-panel/mysql/prefs.pl:82 ../vhffs-panel/user/prefs.pl:59 +#: ../vhffs-panel/svn/prefs.pl:121 ../vhffs-panel/user/prefs.pl:90 +#: ../vhffs-panel/dns/prefs.pl:185 ../vhffs-panel/dns/prefs.pl:206 +#: ../vhffs-panel/dns/prefs.pl:226 ../vhffs-panel/pgsql/prefs.pl:106 +#: ../vhffs-panel/group/prefs.pl:96 ../vhffs-panel/web/prefs.pl:119 +#: ../vhffs-panel/mysql/prefs.pl:113 ../vhffs-panel/cvs/prefs.pl:105 msgid "Modify" msgstr "" -#: ../vhffs-panel/acl/view.pl:159 ../vhffs-panel/acl/view.pl:207 +#: ../vhffs-panel/acl/view.pl:190 ../vhffs-panel/acl/view.pl:237 msgid "Modify this ACL" msgstr "" -#: ../vhffs-panel/admin/cvs/list.pl:79 +#: ../vhffs-panel/admin/cvs/list.pl:97 msgid "Modify this CVS repository" msgstr "" -#: ../vhffs-panel/admin/mysql/list.pl:94 +#: ../vhffs-panel/admin/repository/list.pl:101 +msgid "Modify this Download repository" +msgstr "" + +#: ../vhffs-panel/admin/mysql/list.pl:100 msgid "Modify this MySQL area" msgstr "" -#: ../vhffs-panel/admin/pgsql/list.pl:94 +#: ../vhffs-panel/admin/pgsql/list.pl:101 msgid "Modify this PostgreSQL database" msgstr "" -#: ../vhffs-panel/admin/svn/list.pl:76 +#: ../vhffs-panel/admin/svn/list.pl:87 msgid "Modify this Subversion repository" msgstr "" -#: ../vhffs-panel/admin/dns/list.pl:93 +#: ../vhffs-panel/admin/dns/list.pl:100 msgid "Modify this domain" msgstr "" -#: ../vhffs-panel/admin/group/list.pl:81 +#: ../vhffs-panel/admin/group/list.pl:101 msgid "Modify this group" msgstr "" -#: ../vhffs-panel/admin/largefile/list.pl:77 -msgid "Modify this hosted file" -msgstr "" - -#: ../vhffs-panel/admin/mailing/list.pl:87 +#: ../vhffs-panel/admin/mailing/list.pl:97 msgid "Modify this list" msgstr "" -#: ../vhffs-panel/admin/mail/list.pl:79 +#: ../vhffs-panel/admin/mail/list.pl:103 msgid "Modify this mail domain" msgstr "" -#: ../vhffs-panel/admin/user/list.pl:82 +#: ../vhffs-panel/admin/user/list.pl:91 msgid "Modify this user" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:107 +#: ../vhffs-panel/dns/prefs.pl:138 msgid "Must we redirect the DNS on our servers ?" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Group.pm:112 +#: ../vhffs-api/src/Vhffs/Panel/Group.pm:162 msgid "My Projects" msgstr "" -#: ../vhffs-panel/mysql/prefs.pl:66 +#: ../vhffs-panel/mysql/prefs.pl:97 msgid "MySQL Administration" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:111 +#: ../vhffs-api/src/Vhffs/Panel/Mysql.pm:141 msgid "MySQL Databases" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:362 +#: ../vhffs-panel/admin/moderation.pl:393 msgid "MySQL database awaiting validation" msgstr "" -#: ../vhffs-panel/mysql/create.pl:37 +#: ../vhffs-panel/mysql/create.pl:68 msgid "MySQL database name " msgstr "" -#: ../vhffs-panel/mysql/create.pl:38 +#: ../vhffs-panel/mysql/create.pl:69 msgid "MySQL password for this database " msgstr "" -#: ../vhffs-panel/admin/stats.pl:114 +#: ../vhffs-panel/admin/stats.pl:145 msgid "MySQL stats" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:297 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:373 msgid "Mysql database for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:182 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:211 msgid "NS Admin" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:131 +#: ../vhffs-panel/dns/prefs.pl:162 msgid "NS TYPE" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:111 +#: ../vhffs-panel/admin/repository/edit.pl:95 +#: ../vhffs-panel/admin/repository/show.pl:94 +msgid "Name" +msgstr "" + +#: ../vhffs-panel/dns/prefs.pl:142 msgid "Name for reccord" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:62 ../vhffs-panel/mysql/prefs.pl:69 +#: ../vhffs-panel/pgsql/prefs.pl:93 ../vhffs-panel/mysql/prefs.pl:100 msgid "Name of the database" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:118 +#: ../vhffs-panel/dns/prefs.pl:149 msgid "Name of your MX" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:230 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:260 #, perl-format msgid "New language is: %s\n" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:109 ../vhffs-panel/cvs/prefs.pl:73 -#: ../vhffs-panel/svn/prefs.pl:90 ../vhffs-panel/web/prefs.pl:85 -#: ../vhffs-panel/admin/cvs/edit.pl:73 ../vhffs-panel/admin/cvs/show.pl:77 +#: ../vhffs-panel/svn/prefs.pl:120 ../vhffs-panel/dns/prefs.pl:140 +#: ../vhffs-panel/admin/cvs/edit.pl:104 ../vhffs-panel/admin/cvs/show.pl:108 +#: ../vhffs-panel/web/prefs.pl:116 ../vhffs-panel/cvs/prefs.pl:104 msgid "No" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:162 +#: ../vhffs-panel/dns/prefs.pl:193 msgid "No A type found" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:203 +#: ../vhffs-panel/dns/prefs.pl:234 msgid "No CNAME available on this domain" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:366 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:442 msgid "No CVS repository for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:497 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:572 msgid "No DNS domain for this group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:176 +#: ../vhffs-panel/admin/moderation.pl:207 msgid "No DNS to validate" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:93 +#: ../vhffs-panel/admin/moderation.pl:124 msgid "No Group to validate" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:183 +#: ../vhffs-panel/dns/prefs.pl:214 msgid "No MX reccord for this domain" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:353 +#: ../vhffs-panel/admin/moderation.pl:384 msgid "No Mail Area to validate" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:445 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:521 msgid "No Mail domain for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:419 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:495 msgid "No Mailing-list for this group" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:223 +#: ../vhffs-panel/dns/prefs.pl:254 msgid "No NS available on this domain" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:340 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:416 msgid "No PostgreSQL database for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:392 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:468 msgid "No SVN repository for this group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:135 +#: ../vhffs-panel/admin/moderation.pl:166 msgid "No Web Area to validate" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:127 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:217 msgid "No cookie found, please accept the cookie and then please login again !" msgstr "" -#: ../vhffs-panel/public/group.pl:129 +#: ../vhffs-panel/public/group.pl:161 msgid "No cvs repository available for this group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:396 -#: ../vhffs-panel/admin/moderation.pl:438 +#: ../vhffs-panel/admin/moderation.pl:427 +#: ../vhffs-panel/admin/moderation.pl:469 msgid "No database to validate" msgstr "" -#: ../vhffs-panel/object/upavatar.pl:74 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:547 +msgid "No download repository for this group" +msgstr "" + +#: ../vhffs-panel/object/upavatar.pl:105 msgid "No enough rights" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:172 ../vhffs-panel/history.pl:84 +#: ../vhffs-panel/history.pl:115 ../vhffs-panel/admin/object/edit.pl:203 msgid "No event about this object" msgstr "" -#: ../vhffs-panel/public/group.pl:185 -msgid "No file available for this group" +#: ../vhffs-panel/public/allgroups.pl:70 +msgid "No group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:479 -msgid "No files to validate" -msgstr "" - -#: ../vhffs-panel/public/lastusers.pl:62 ../vhffs-panel/public/allgroups.pl:56 -#: ../vhffs-panel/public/group.pl:69 ../vhffs-panel/public/user.pl:69 -#: ../vhffs-panel/public/lastgroups.pl:55 +#: ../vhffs-panel/public/user.pl:98 ../vhffs-panel/public/lastgroups.pl:84 +#: ../vhffs-panel/public/lastusers.pl:92 ../vhffs-panel/public/allgroups.pl:92 msgid "No group for this user" msgstr "" -#: ../vhffs-panel/public/largefile.pl:89 -msgid "No hash" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:472 -msgid "No hosted files for this group" -msgstr "" - -#: ../vhffs-panel/public/group.pl:209 +#: ../vhffs-panel/public/group.pl:214 msgid "No list available for this group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:263 +#: ../vhffs-panel/admin/moderation.pl:294 msgid "No list to validate" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:161 +#: ../vhffs-panel/mailinglist/prefs.pl:196 msgid "No member on this list" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:559 +#: ../vhffs-listengine/src/listengine.pl:570 msgid "No message to moderate" msgstr "" -#: ../vhffs-panel/pgsql/prefs_save.pl:65 +#: ../vhffs-panel/pgsql/prefs_save.pl:96 msgid "No modification can be applied. Please check your fields." msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:314 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:390 msgid "No mysql database for this group" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:220 -#: ../vhffs-panel/admin/moderation.pl:308 +#: ../vhffs-panel/admin/moderation.pl:251 +#: ../vhffs-panel/admin/moderation.pl:339 +#: ../vhffs-panel/admin/moderation.pl:511 msgid "No repository to validate" msgstr "" -#: ../vhffs-panel/public/largefile.pl:105 -msgid "No server" -msgstr "" - -#: ../vhffs-panel/public/group.pl:156 +#: ../vhffs-panel/public/group.pl:188 msgid "No subversion repository available for this group" msgstr "" -#: ../vhffs-panel/public/largefile.pl:62 ../vhffs-panel/public/group.pl:46 +#: ../vhffs-panel/public/group.pl:78 msgid "No such group" msgstr "" -#: ../vhffs-panel/public/user.pl:45 +#: ../vhffs-panel/public/user.pl:73 msgid "No such user" msgstr "" -#: ../vhffs-panel/group/join_group.pl:43 -msgid "No such user on Vhffs" +#: ../vhffs-panel/public/group.pl:101 +msgid "No user for this group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:290 +#: ../vhffs-panel/public/allwebsites.pl:74 +msgid "No webarea" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:366 msgid "No webarea for this group" msgstr "" -#: ../vhffs-panel/public/group.pl:105 +#: ../vhffs-panel/public/group.pl:137 msgid "No website available for this group" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:102 ../vhffs-panel/web/prefs.pl:99 -#: ../vhffs-panel/user/prefs.pl:76 +#: ../vhffs-panel/user/prefs.pl:105 ../vhffs-panel/dns/prefs.pl:133 +#: ../vhffs-panel/web/prefs.pl:130 msgid "No, I'm not sure, I prefer to keep it." msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:79 ../vhffs-panel/group/prefs.pl:70 -#: ../vhffs-panel/svn/prefs.pl:96 ../vhffs-panel/mailinglist/prefs.pl:169 -#: ../vhffs-panel/mail/prefs.pl:103 ../vhffs-panel/pgsql/prefs.pl:80 -#: ../vhffs-panel/largefile/prefs.pl:103 ../vhffs-panel/mysql/prefs.pl:87 +#: ../vhffs-panel/mailinglist/prefs.pl:204 ../vhffs-panel/svn/prefs.pl:126 +#: ../vhffs-panel/pgsql/prefs.pl:111 ../vhffs-panel/group/prefs.pl:101 +#: ../vhffs-panel/repository/prefs.pl:106 ../vhffs-panel/mysql/prefs.pl:118 +#: ../vhffs-panel/cvs/prefs.pl:110 ../vhffs-panel/mail/prefs.pl:134 msgid "No, I'm not sure, I prefer to keep this project." msgstr "" -#: ../vhffs-panel/mailinglist/del_member.pl:68 -#: ../vhffs-panel/mailinglist/add_sub.pl:68 -#: ../vhffs-panel/mailinglist/change_right.pl:70 +#: ../vhffs-panel/mailinglist/add_sub.pl:95 +#: ../vhffs-panel/mailinglist/change_right.pl:97 +#: ../vhffs-panel/mailinglist/del_member.pl:95 msgid "Not valid mail" msgstr "" -#: ../vhffs-panel/admin/user/edit_note.pl:66 +#: ../vhffs-panel/admin/user/edit_note.pl:97 msgid "Note successfully modified" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:413 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:443 msgid "November" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:61 -#, perl-format -msgid "Now, you have to log in on the ftp server %s with\n" +#: ../vhffs-panel/acl/submit.pl:89 ../vhffs-panel/acl/add_acl_user.pl:90 +msgid "Object Error" msgstr "" -#: ../vhffs-panel/acl/add_acl_user.pl:59 -#: ../vhffs-panel/acl/add_acl_group.pl:59 ../vhffs-panel/acl/submit.pl:58 -#: ../vhffs-panel/acl/submit.pl:62 -msgid "Object Error" +#: ../vhffs-panel/admin/object/list.pl:87 +msgid "Object ID" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:62 +#: ../vhffs-panel/admin/object/edit.pl:93 msgid "Object id" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:231 ../vhffs-panel/svn/prefs.pl:123 -#: ../vhffs-panel/mailinglist/prefs.pl:181 -#: ../vhffs-panel/largefile/prefs.pl:115 +#: ../vhffs-panel/mailinglist/prefs.pl:216 ../vhffs-panel/svn/prefs.pl:153 +#: ../vhffs-panel/dns/prefs.pl:262 msgid "Object part" msgstr "" -#: ../vhffs-panel/admin/object/edit_submit.pl:62 +#: ../vhffs-panel/admin/object/edit_submit.pl:93 msgid "Object successfully updated" msgstr "" -#: ../vhffs-panel/object/upavatar.pl:66 +#: ../vhffs-panel/object/upavatar.pl:97 msgid "Object-ID error" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:409 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:439 msgid "October" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:94 ../vhffs-panel/web/prefs.pl:93 -#: ../vhffs-panel/mail/prefs.pl:108 +#: ../vhffs-panel/dns/prefs.pl:125 ../vhffs-panel/web/prefs.pl:124 +#: ../vhffs-panel/mail/prefs.pl:139 msgid "Ok, go to ACL admin" msgstr "" -#: ../vhffs-panel/admin/broadcast.pl:49 +#: ../vhffs-panel/admin/broadcast.pl:80 msgid "Ok, send it !" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:30 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:60 msgid "Only this list administrators can use the following commands.\n" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:85 +#: ../vhffs-panel/mailinglist/prefs.pl:116 msgid "Open archives" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:83 +#: ../vhffs-panel/mailinglist/prefs.pl:114 msgid "Open post" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:84 +#: ../vhffs-panel/mailinglist/prefs.pl:115 msgid "Open subscribing" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:81 +#: ../vhffs-panel/mailinglist/prefs.pl:112 msgid "Options" msgstr "" -#: ../vhffs-panel/mailinglist/save_options.pl:127 +#: ../vhffs-panel/mailinglist/save_sig.pl:97 +#: ../vhffs-panel/mailinglist/save_options.pl:154 msgid "Options successfully modified" msgstr "" -#: ../vhffs-panel/public/allwebsites.pl:45 +#: ../vhffs-panel/public/allwebsites.pl:85 msgid "Owned by" msgstr "" -#: ../vhffs-panel/group/create.pl:32 ../vhffs-panel/admin/mail/edit.pl:69 -#: ../vhffs-panel/admin/mail/show.pl:69 ../vhffs-panel/admin/pgsql/edit.pl:68 -#: ../vhffs-panel/admin/pgsql/show.pl:66 ../vhffs-panel/admin/cvs/edit.pl:67 -#: ../vhffs-panel/admin/cvs/show.pl:66 ../vhffs-panel/admin/group/edit.pl:66 -#: ../vhffs-panel/admin/group/show.pl:65 ../vhffs-panel/admin/mysql/edit.pl:68 -#: ../vhffs-panel/admin/mysql/show.pl:65 ../vhffs-panel/admin/web/edit.pl:69 -#: ../vhffs-panel/admin/web/show.pl:68 +#: ../vhffs-panel/group/create.pl:63 ../vhffs-panel/admin/pgsql/edit.pl:99 +#: ../vhffs-panel/admin/pgsql/show.pl:97 ../vhffs-panel/admin/group/edit.pl:95 +#: ../vhffs-panel/admin/group/show.pl:95 +#: ../vhffs-panel/admin/repository/edit.pl:97 +#: ../vhffs-panel/admin/repository/show.pl:96 +#: ../vhffs-panel/admin/object/list.pl:88 ../vhffs-panel/admin/web/edit.pl:100 +#: ../vhffs-panel/admin/web/show.pl:99 ../vhffs-panel/admin/mysql/edit.pl:100 +#: ../vhffs-panel/admin/mysql/show.pl:96 ../vhffs-panel/admin/cvs/edit.pl:98 +#: ../vhffs-panel/admin/cvs/show.pl:97 ../vhffs-panel/admin/mail/edit.pl:100 +#: ../vhffs-panel/admin/mail/show.pl:100 msgid "Owner" msgstr "" -#: ../vhffs-panel/admin/largefile/list.pl:83 -msgid "Owner group" +#: ../vhffs-panel/admin/group/list.pl:90 +msgid "Owner name" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:195 +#: ../vhffs-panel/admin/user/edit.pl:226 msgid "Owner of this group" msgstr "" -#: ../vhffs-panel/lost.pl:27 -msgid "PLEASE!!!" -msgstr "" - -#: ../vhffs-panel/login.pl:90 +#: ../vhffs-panel/login.pl:108 msgid "Panel Access" msgstr "" -#: ../vhffs-panel/mail/prefs.pl:80 ../vhffs-panel/admin/pgsql/edit.pl:66 -#: ../vhffs-panel/admin/mysql/edit.pl:66 ../vhffs-panel/admin/user/edit.pl:68 -#: ../vhffs-panel/user/prefs.pl:55 ../vhffs-panel/auth.pl:33 +#: ../vhffs-panel/user/prefs.pl:86 ../vhffs-panel/admin/user/edit.pl:99 +#: ../vhffs-panel/admin/pgsql/edit.pl:97 ../vhffs-panel/admin/mysql/edit.pl:97 +#: ../vhffs-panel/auth.pl:59 ../vhffs-panel/mail/prefs.pl:111 msgid "Password" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:68 ../vhffs-panel/mysql/prefs.pl:75 +#: ../vhffs-panel/admin/mail/password_box.pl:109 +#, perl-format +msgid "Password changed for box %s" +msgstr "" + +#: ../vhffs-panel/pgsql/prefs.pl:99 ../vhffs-panel/mysql/prefs.pl:106 msgid "Password for this database" msgstr "" -#: ../vhffs-panel/mysql/submit.pl:56 +#: ../vhffs-panel/mysql/submit.pl:87 msgid "Password must contain at least 3 caracters" msgstr "" -#: ../vhffs-panel/pgsql/pgsql_submit.pl:50 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:81 msgid "Password must contains only alphanum caracters" msgstr "" -#: ../vhffs-panel/lost_ack.pl:51 +#: ../vhffs-panel/lost_ack.pl:80 msgid "Password recovery failed!" msgstr "" -#: ../vhffs-panel/mail/password_box.pl:91 +#: ../vhffs-panel/mail/password_box.pl:108 msgid "Password successfully changed" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:64 -#, perl-format -msgid "Password: %s\n" +#: ../vhffs-panel/admin/mysql/edit.pl:98 +msgid "Password will not be modified if it is set to 'blanked' or empty" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:68 +#: ../vhffs-panel/user/prefs_save.pl:99 msgid "Passwords don't match" msgstr "" -#: ../vhffs-panel/admin/stats.pl:121 +#: ../vhffs-panel/admin/stats.pl:152 msgid "PgSQL stats" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:29 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:40 ../vhffs-panel/login.pl:46 +#: ../vhffs-panel/login.pl:73 ../vhffs-api/src/Vhffs/Panel/Main.pm:32 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:43 msgid "Platform temporary closed" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:41 ../vhffs-panel/login.pl:47 +#: ../vhffs-panel/login.pl:74 ../vhffs-api/src/Vhffs/Panel/Main.pm:44 msgid "Platform temporary closed." msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:30 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:33 msgid "Platform temporary closed<br/>database error" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:156 +#: ../vhffs-panel/subscribe.pl:137 msgid "Please enter a correct city" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:163 +#: ../vhffs-panel/subscribe.pl:141 msgid "Please enter a correct country" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:142 -#: ../vhffs-panel/subscribe_complete.pl:149 +#: ../vhffs-panel/subscribe.pl:129 msgid "Please enter a correct firstname" msgstr "" -#: ../vhffs-panel/auth.pl:31 +#: ../vhffs-panel/subscribe.pl:133 +msgid "Please enter a correct lastname" +msgstr "" + +#: ../vhffs-panel/auth.pl:57 msgid "Please enter your username and password" msgstr "" -#: ../vhffs-panel/subscribe.pl:35 +#: ../vhffs-panel/subscribe.pl:197 msgid "" "Please fill in all fields, a mail containing your password will be sent to " "you" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:257 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:287 msgid "Please read help of listengine\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:153 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:183 msgid "Please try again\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:201 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:231 msgid "Please try again.\n" msgstr "" -#: ../vhffs-panel/lost_ack.pl:40 +#: ../vhffs-panel/lost_ack.pl:69 #, perl-format msgid "Please wait %s, a new password will be sent to you in a few minutes..." msgstr "" -#: ../vhffs-panel/pgsql/prefs_save.pl:50 ../vhffs-panel/pgsql/prefs.pl:53 +#: ../vhffs-panel/pgsql/prefs.pl:84 ../vhffs-panel/pgsql/prefs_save.pl:81 msgid "Please wait modification, creation or deletion" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:205 +#: ../vhffs-panel/subscribe.pl:167 msgid "" "Please wait while we are creating the account, it will take some minutes" msgstr "" -#: ../vhffs-irc/modobot.pl:368 ../vhffs-panel/admin/moderation_submit.pl:76 -msgid "Please wait while we are creating your object\n" -msgstr "" - -#: ../vhffs-panel/admin/mail/edit.pl:85 ../vhffs-panel/admin/mail/show.pl:85 +#: ../vhffs-panel/admin/mail/edit.pl:116 ../vhffs-panel/admin/mail/show.pl:116 msgid "Popboxes for" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:60 +#: ../vhffs-panel/pgsql/prefs.pl:91 msgid "PostgreSQL Administration" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:85 +#: ../vhffs-api/src/Vhffs/Panel/Pgsql.pm:119 msgid "PostgreSQL Databases" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:323 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:399 msgid "PostgreSQL database for this group" msgstr "" -#: ../vhffs-panel/pgsql/create.pl:34 +#: ../vhffs-panel/pgsql/create.pl:65 msgid "PostgreSQL database name" msgstr "" -#: ../vhffs-panel/pgsql/create.pl:35 +#: ../vhffs-panel/pgsql/create.pl:66 msgid "PostgreSQL password for this database" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:169 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:198 msgid "Postgres Admin" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:404 +#: ../vhffs-panel/admin/moderation.pl:435 msgid "Postgres database awaiting validation" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:87 +#: ../vhffs-panel/mailinglist/prefs.pl:118 msgid "Prefix on subject" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:119 +#: ../vhffs-panel/dns/prefs.pl:150 msgid "Priority of your MX" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:172 +#: ../vhffs-panel/dns/prefs.pl:203 msgid "Priority: " msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:90 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:123 msgid "Project : " msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:91 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:124 msgid "Project Configuration" msgstr "" -#: ../vhffs-panel/group/prefs.pl:62 +#: ../vhffs-panel/group/prefs.pl:93 msgid "Project Description" msgstr "" -#: ../vhffs-panel/group/create.pl:31 +#: ../vhffs-panel/group/create.pl:62 msgid "Project Name" msgstr "" -#: ../vhffs-panel/group/prefs.pl:60 +#: ../vhffs-panel/group/prefs.pl:91 msgid "Project Owner" msgstr "" -#: ../vhffs-panel/group/prefs.pl:57 +#: ../vhffs-panel/group/prefs.pl:88 msgid "Project Preferences" msgstr "" -#: ../vhffs-panel/group/project_submit.pl:74 +#: ../vhffs-panel/group/project_submit.pl:85 msgid "Project Successfully created !" msgstr "" -#: ../vhffs-panel/group/prefs_save.pl:67 +#: ../vhffs-panel/group/prefs_save.pl:93 msgid "Project Successfully modified" msgstr "" -#: ../vhffs-panel/svn/prefs.pl:87 ../vhffs-panel/admin/cvs/edit.pl:65 -#: ../vhffs-panel/admin/cvs/show.pl:64 +#: ../vhffs-panel/svn/prefs.pl:117 ../vhffs-panel/admin/cvs/edit.pl:96 +#: ../vhffs-panel/admin/cvs/show.pl:95 msgid "Public" msgstr "" -#: ../vhffs-panel/admin/group/edit.pl:67 ../vhffs-panel/admin/group/show.pl:66 +#: ../vhffs-panel/admin/group/edit.pl:96 ../vhffs-panel/admin/group/show.pl:96 +#: ../vhffs-panel/admin/repository/edit.pl:102 +#: ../vhffs-panel/admin/repository/show.pl:100 msgid "Quota" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:268 -#: ../vhffs-panel/admin/group/edit.pl:81 +#: ../vhffs-panel/repository/prefs.pl:100 +#: ../vhffs-panel/admin/group/edit.pl:110 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:344 #, perl-format msgid "Quota (used/total) : %s/%s" msgstr "" -#: ../vhffs-panel/admin/group/edit.pl:68 ../vhffs-panel/admin/group/show.pl:67 +#: ../vhffs-panel/admin/group/edit.pl:97 ../vhffs-panel/admin/group/show.pl:97 +#: ../vhffs-panel/admin/repository/edit.pl:103 +#: ../vhffs-panel/admin/repository/show.pl:101 msgid "Quota used" msgstr "" -#: ../vhffs-panel/public/rss/lastgroups.pl:76 -#: ../vhffs-panel/public/rss/lastusers.pl:75 +#: ../vhffs-panel/public/rss/lastgroups.pl:107 +#: ../vhffs-panel/public/rss/lastusers.pl:106 msgid "RSS infos are not published" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:45 -#: ../vhffs-robots/src/refused_cvs.pl:46 -#: ../vhffs-robots/src/refused_postgres.pl:45 -#: ../vhffs-robots/src/refused_web.pl:45 -#: ../vhffs-robots/src/refused_mail.pl:45 -#: ../vhffs-robots/src/refused_dns.pl:45 -#: ../vhffs-robots/src/refused_mysql.pl:45 -#: ../vhffs-robots/src/refused_svn.pl:45 ../vhffs-robots/src/refused_ml.pl:45 -#: ../vhffs-robots/src/refused_groups.pl:45 +#: ../vhffs-panel/admin/user/list.pl:80 +msgid "Real Name" +msgstr "" + +#: ../vhffs-robots/src/refused_ml.pl:73 ../vhffs-robots/src/refused_mail.pl:75 +#: ../vhffs-robots/src/refused_postgres.pl:76 +#: ../vhffs-robots/src/refused_cvs.pl:72 ../vhffs-robots/src/refused_web.pl:71 +#: ../vhffs-robots/src/refused_mysql.pl:46 +#: ../vhffs-robots/src/refused_svn.pl:42 +#: ../vhffs-robots/src/refused_groups.pl:71 +#: ../vhffs-robots/src/refused_repository.pl:76 +#: ../vhffs-robots/src/refused_dns.pl:75 msgid "Reason given : " msgstr "" -#: ../vhffs-panel/subscribe.pl:47 +#: ../vhffs-panel/subscribe.pl:213 msgid "Recopy the code" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:85 -#: ../vhffs-panel/admin/moderation.pl:127 -#: ../vhffs-panel/admin/moderation.pl:168 -#: ../vhffs-panel/admin/moderation.pl:212 -#: ../vhffs-panel/admin/moderation.pl:255 -#: ../vhffs-panel/admin/moderation.pl:300 -#: ../vhffs-panel/admin/moderation.pl:345 -#: ../vhffs-panel/admin/moderation.pl:388 -#: ../vhffs-panel/admin/moderation.pl:430 -#: ../vhffs-panel/admin/moderation.pl:471 +#: ../vhffs-panel/admin/moderation.pl:116 +#: ../vhffs-panel/admin/moderation.pl:158 +#: ../vhffs-panel/admin/moderation.pl:199 +#: ../vhffs-panel/admin/moderation.pl:243 +#: ../vhffs-panel/admin/moderation.pl:286 +#: ../vhffs-panel/admin/moderation.pl:331 +#: ../vhffs-panel/admin/moderation.pl:376 +#: ../vhffs-panel/admin/moderation.pl:419 +#: ../vhffs-panel/admin/moderation.pl:461 +#: ../vhffs-panel/admin/moderation.pl:503 msgid "Refuse" msgstr "" -#: ../vhffs-panel/group/prefs.pl:90 +#: ../vhffs-panel/group/prefs.pl:121 msgid "Remove this user from this group" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:86 +#: ../vhffs-panel/mailinglist/prefs.pl:117 msgid "Reply to: on list" msgstr "" -#: ../vhffs-panel/cvs/create.pl:34 ../vhffs-panel/svn/create.pl:40 +#: ../vhffs-panel/svn/create.pl:71 ../vhffs-panel/repository/create.pl:65 +#: ../vhffs-panel/admin/repository/list.pl:88 ../vhffs-panel/cvs/create.pl:65 msgid "Repository Name" msgstr "" -#: ../vhffs-panel/svn/prefs_save.pl:80 +#: ../vhffs-panel/svn/prefs_save.pl:111 msgid "Repository updated" msgstr "" -#: ../vhffs-panel/dns/add_ns.pl:72 ../vhffs-panel/dns/add_cname.pl:73 -#: ../vhffs-panel/dns/add_a.pl:80 ../vhffs-panel/dns/add_a.pl:96 -#: ../vhffs-panel/dns/add_mx.pl:73 +#: ../vhffs-panel/dns/add_mx.pl:102 ../vhffs-panel/dns/add_ns.pl:100 +#: ../vhffs-panel/dns/add_cname.pl:104 ../vhffs-panel/dns/add_a.pl:112 +#: ../vhffs-panel/dns/add_a.pl:128 msgid "Resource successfully added to this domain" msgstr "" -#: ../vhffs-panel/mailinglist/change_right.pl:84 +#: ../vhffs-panel/mailinglist/change_right.pl:111 msgid "Rights successfully changed" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:375 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:451 msgid "SVN repositories for this group" msgstr "" -#: ../vhffs-panel/public/group.pl:140 +#: ../vhffs-panel/public/group.pl:172 msgid "SVN repository for this group" msgstr "" -#: ../vhffs-panel/admin/stats.pl:95 +#: ../vhffs-panel/admin/svn/list.pl:76 +msgid "SVN root" +msgstr "" + +#: ../vhffs-panel/admin/stats.pl:126 msgid "SVN stats" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:90 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:161 +msgid "SVNweb" +msgstr "" + +#: ../vhffs-panel/mailinglist/prefs.pl:121 msgid "Save options" msgstr "" -#: ../vhffs-panel/admin/object/search.pl:45 +#: ../vhffs-panel/admin/object/search.pl:76 msgid "Search an object (give object_id)" msgstr "" -#: ../vhffs-panel/admin/cvs/search.pl:46 +#: ../vhffs-panel/admin/cvs/search.pl:77 msgid "Search for a CVS repository" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:171 +#: ../vhffs-panel/admin/repository/search.pl:77 +msgid "Search for a Download repository" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:200 msgid "Search for a PostgreSQL database" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:104 -#: ../vhffs-panel/admin/svn/search.pl:48 +#: ../vhffs-panel/admin/svn/search.pl:79 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:133 msgid "Search for a SVN repository" msgstr "" -#: ../vhffs-panel/admin/pgsql/search.pl:47 -#: ../vhffs-panel/admin/mysql/search.pl:47 +#: ../vhffs-panel/admin/pgsql/search.pl:78 +#: ../vhffs-panel/admin/mysql/search.pl:78 msgid "Search for a database" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:184 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:213 msgid "Search for a domain" msgstr "" -#: ../vhffs-panel/admin/dns/search.pl:47 +#: ../vhffs-panel/admin/dns/search.pl:78 msgid "Search for a domain name" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:197 -#: ../vhffs-panel/admin/largefile/search.pl:47 -msgid "Search for a file" +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:226 +msgid "Search for a download repository" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:80 -#: ../vhffs-panel/admin/group/search.pl:47 +#: ../vhffs-panel/admin/group/search.pl:78 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:109 msgid "Search for a group" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:158 -#: ../vhffs-panel/admin/mailing/search.pl:46 +#: ../vhffs-panel/admin/mailing/search.pl:77 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:187 msgid "Search for a list" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:145 -#: ../vhffs-panel/admin/mail/search.pl:47 +#: ../vhffs-panel/admin/mail/search.pl:78 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:174 msgid "Search for a mail domain" msgstr "" -#: ../vhffs-panel/admin/web/search.pl:47 +#: ../vhffs-panel/admin/web/search.pl:78 msgid "Search for a web area" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:90 ../vhffs-panel/public/index.pl:46 +#: ../vhffs-panel/public/index.pl:75 ../vhffs-api/src/Vhffs/Panel/Admin.pm:119 msgid "Search for a website" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:62 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:91 msgid "Search for an object" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:72 -#: ../vhffs-panel/admin/user/search.pl:47 +#: ../vhffs-panel/admin/user/search.pl:78 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:101 msgid "Search for an user" msgstr "" -#: ../vhffs-panel/admin/group/list.pl:53 +#: ../vhffs-panel/admin/group/list.pl:85 msgid "Search result" msgstr "" -#: ../vhffs-panel/admin/object/list.pl:48 +#: ../vhffs-panel/admin/object/list.pl:80 msgid "Search result " msgstr "" -#: ../vhffs-panel/admin/mailing/list.pl:50 -#: ../vhffs-panel/admin/mail/list.pl:49 ../vhffs-panel/admin/web/list.pl:49 -#: ../vhffs-panel/admin/user/list.pl:49 +#: ../vhffs-panel/admin/mailing/list.pl:79 +#: ../vhffs-panel/admin/user/list.pl:72 ../vhffs-panel/admin/web/list.pl:71 +#: ../vhffs-panel/admin/mail/list.pl:80 msgid "Search result for" msgstr "" -#: ../vhffs-panel/admin/cvs/list.pl:49 +#: ../vhffs-panel/admin/cvs/list.pl:82 msgid "Search result for CVS repository" msgstr "" -#: ../vhffs-panel/admin/svn/list.pl:47 +#: ../vhffs-panel/admin/repository/list.pl:81 +msgid "Search result for Download repository" +msgstr "" + +#: ../vhffs-panel/admin/svn/list.pl:69 msgid "Search result for Subversion repository" msgstr "" -#: ../vhffs-panel/admin/pgsql/list.pl:49 ../vhffs-panel/admin/mysql/list.pl:49 +#: ../vhffs-panel/admin/pgsql/list.pl:80 ../vhffs-panel/admin/mysql/list.pl:81 msgid "Search result for database" msgstr "" -#: ../vhffs-panel/admin/dns/list.pl:49 +#: ../vhffs-panel/admin/dns/list.pl:80 msgid "Search result for domain" msgstr "" -#: ../vhffs-panel/admin/largefile/list.pl:45 -msgid "Search result for file" -msgstr "" - -#: ../vhffs-panel/public/allwebsites.pl:62 -#: ../vhffs-panel/public/lastusers.pl:85 ../vhffs-panel/public/index.pl:55 -#: ../vhffs-panel/public/allgroups.pl:78 ../vhffs-panel/public/group.pl:221 -#: ../vhffs-panel/public/user.pl:89 ../vhffs-panel/public/lastgroups.pl:77 +#: ../vhffs-panel/public/user.pl:118 ../vhffs-panel/public/lastgroups.pl:106 +#: ../vhffs-panel/public/lastusers.pl:115 +#: ../vhffs-panel/public/allwebsites.pl:102 ../vhffs-panel/public/index.pl:84 +#: ../vhffs-panel/public/group.pl:226 ../vhffs-panel/public/allgroups.pl:114 msgid "Search:" msgstr "" -#: ../vhffs-panel/dns/create.pl:40 ../vhffs-panel/cvs/create.pl:39 -#: ../vhffs-panel/group/create.pl:34 ../vhffs-panel/svn/create.pl:45 -#: ../vhffs-panel/mailinglist/create.pl:70 ../vhffs-panel/web/create.pl:49 -#: ../vhffs-panel/mail/create.pl:39 ../vhffs-panel/pgsql/create.pl:42 -#: ../vhffs-panel/admin/mail/edit.pl:72 ../vhffs-panel/admin/pgsql/edit.pl:71 -#: ../vhffs-panel/admin/cvs/edit.pl:70 ../vhffs-panel/admin/group/edit.pl:71 -#: ../vhffs-panel/admin/mysql/edit.pl:71 -#: ../vhffs-panel/admin/object/edit.pl:67 ../vhffs-panel/admin/web/edit.pl:74 -#: ../vhffs-panel/admin/user/edit.pl:80 -#: ../vhffs-panel/admin/broadcast_view.pl:69 -#: ../vhffs-panel/admin/broadcast_list.pl:68 -#: ../vhffs-panel/largefile/create.pl:41 ../vhffs-panel/mysql/create.pl:40 -#: ../vhffs-panel/alert.pl:40 +#: ../vhffs-panel/mailinglist/create.pl:101 ../vhffs-panel/svn/create.pl:76 +#: ../vhffs-panel/dns/create.pl:41 ../vhffs-panel/pgsql/create.pl:73 +#: ../vhffs-panel/group/create.pl:65 ../vhffs-panel/repository/create.pl:71 +#: ../vhffs-panel/alert.pl:71 ../vhffs-panel/admin/user/edit.pl:111 +#: ../vhffs-panel/admin/pgsql/edit.pl:102 +#: ../vhffs-panel/admin/group/edit.pl:100 +#: ../vhffs-panel/admin/broadcast_list.pl:99 +#: ../vhffs-panel/admin/repository/edit.pl:100 +#: ../vhffs-panel/admin/object/edit.pl:98 +#: ../vhffs-panel/admin/broadcast_view.pl:100 +#: ../vhffs-panel/admin/web/edit.pl:105 ../vhffs-panel/admin/mysql/edit.pl:103 +#: ../vhffs-panel/admin/cvs/edit.pl:101 ../vhffs-panel/admin/mail/edit.pl:103 +#: ../vhffs-panel/web/create.pl:80 ../vhffs-panel/mysql/create.pl:71 +#: ../vhffs-panel/cvs/create.pl:70 ../vhffs-panel/mail/create.pl:70 msgid "Send" msgstr "" -#: ../vhffs-panel/admin/broadcast.pl:45 +#: ../vhffs-panel/admin/broadcast.pl:76 msgid "Send an email to all hosted people" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:258 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:288 msgid "Send an email with the subject \"help\" to the following address: \n" msgstr "" -#: ../vhffs-panel/acl/view.pl:138 +#: ../vhffs-panel/acl/view.pl:170 msgid "Send it" msgstr "" -#: ../vhffs-panel/group/prefs.pl:77 ../vhffs-panel/group/prefs.pl:78 +#: ../vhffs-panel/group/prefs.pl:108 ../vhffs-panel/group/prefs.pl:109 msgid "Send logo" msgstr "" -#: ../vhffs-panel/user/prefs.pl:79 ../vhffs-panel/user/prefs.pl:81 +#: ../vhffs-panel/user/prefs.pl:112 ../vhffs-panel/user/prefs.pl:114 msgid "Send my avatar" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:405 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:435 msgid "September" msgstr "" -#: ../vhffs-panel/admin/mysql/edit.pl:64 ../vhffs-panel/admin/mysql/show.pl:62 -#: ../vhffs-panel/admin/web/edit.pl:64 ../vhffs-panel/admin/web/show.pl:63 +#: ../vhffs-panel/admin/web/edit.pl:95 ../vhffs-panel/admin/web/show.pl:94 +#: ../vhffs-panel/admin/web/list.pl:78 ../vhffs-panel/admin/mysql/edit.pl:95 +#: ../vhffs-panel/admin/mysql/show.pl:93 msgid "Servername" msgstr "" -#: ../vhffs-panel/web/web_submit.pl:46 +#: ../vhffs-panel/web/web_submit.pl:77 msgid "Servername error. Please enter a valid servername" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:67 ../vhffs-panel/admin/user/show.pl:68 +#: ../vhffs-panel/admin/user/edit.pl:98 ../vhffs-panel/admin/user/show.pl:99 msgid "Shell" msgstr "" -#: ../vhffs-panel/admin/cvs/show.pl:61 +#: ../vhffs-panel/admin/cvs/show.pl:92 msgid "Show CVS" msgstr "" -#: ../vhffs-panel/admin/group/show.pl:61 +#: ../vhffs-panel/admin/repository/show.pl:92 +msgid "Show Download repository" +msgstr "" + +#: ../vhffs-panel/admin/group/show.pl:91 msgid "Show Group" msgstr "" -#: ../vhffs-panel/admin/mail/show.pl:63 +#: ../vhffs-panel/admin/mail/show.pl:94 msgid "Show Mail Domain" msgstr "" -#: ../vhffs-panel/admin/mysql/show.pl:60 +#: ../vhffs-panel/admin/mysql/show.pl:91 msgid "Show MySQL database" msgstr "" -#: ../vhffs-panel/admin/pgsql/show.pl:61 +#: ../vhffs-panel/admin/pgsql/show.pl:92 msgid "Show PostgreSQL database" msgstr "" -#: ../vhffs-panel/admin/user/show.pl:63 +#: ../vhffs-panel/admin/user/show.pl:94 msgid "Show User" msgstr "" -#: ../vhffs-panel/admin/web/show.pl:61 +#: ../vhffs-panel/admin/web/show.pl:92 msgid "Show Web Area" msgstr "" -#: ../vhffs-panel/public/index.pl:40 +#: ../vhffs-panel/public/index.pl:69 #, perl-format msgid "Show me all groups on %s" msgstr "" -#: ../vhffs-panel/public/index.pl:44 +#: ../vhffs-panel/public/index.pl:73 msgid "Show me all websites" msgstr "" -#: ../vhffs-panel/public/index.pl:39 +#: ../vhffs-panel/public/index.pl:68 #, perl-format msgid "Show me last groups on %s" msgstr "" -#: ../vhffs-panel/public/index.pl:33 +#: ../vhffs-panel/public/index.pl:62 #, perl-format msgid "Show me last users on %s" msgstr "" -#: ../vhffs-panel/public/index.pl:42 +#: ../vhffs-panel/public/index.pl:71 msgid "Show me this group according to this username" msgstr "" -#: ../vhffs-panel/public/index.pl:35 +#: ../vhffs-panel/public/index.pl:64 msgid "Show me this user according to this username" msgstr "" -#: ../vhffs-panel/admin/cvs/list.pl:81 +#: ../vhffs-panel/admin/cvs/list.pl:102 msgid "Show this CVS repository" msgstr "" -#: ../vhffs-panel/admin/mysql/list.pl:96 +#: ../vhffs-panel/admin/repository/list.pl:104 +msgid "Show this Download repository" +msgstr "" + +#: ../vhffs-panel/admin/mysql/list.pl:103 msgid "Show this MySQL area" msgstr "" -#: ../vhffs-panel/admin/pgsql/list.pl:96 +#: ../vhffs-panel/admin/pgsql/list.pl:104 msgid "Show this PostgreSQL database" msgstr "" -#: ../vhffs-panel/admin/group/list.pl:83 +#: ../vhffs-panel/admin/web/list.pl:94 +msgid "Show this Website" +msgstr "" + +#: ../vhffs-panel/admin/group/list.pl:104 msgid "Show this group" msgstr "" -#: ../vhffs-panel/admin/mailing/list.pl:89 +#: ../vhffs-panel/admin/mailing/list.pl:99 msgid "Show this list" msgstr "" -#: ../vhffs-panel/admin/mail/list.pl:81 +#: ../vhffs-panel/admin/mail/list.pl:106 msgid "Show this mail domain" msgstr "" -#: ../vhffs-panel/admin/user/list.pl:84 +#: ../vhffs-panel/admin/user/list.pl:94 msgid "Show this user" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:89 -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:39 -#: ../vhffs-api/src/Vhffs/Panel/Group.pm:113 -msgid "Show/Hide" +#: ../vhffs-panel/mailinglist/prefs.pl:123 +msgid "Signature" msgstr "" -#: ../vhffs-panel/public/largefile.pl:80 ../vhffs-panel/public/largefile.pl:85 -#: ../vhffs-panel/largefile/prefs.pl:93 -msgid "Size" -msgstr "" - -#: ../vhffs-panel/largefile/create.pl:35 -msgid "Size (in Mo)" -msgstr "" - -#: ../vhffs-panel/largefile/submit.pl:56 -msgid "Size is only a number (in Mo)" -msgstr "" - -#: ../vhffs-panel/acl/add_acl_user.pl:75 -#: ../vhffs-panel/acl/add_acl_group.pl:75 ../vhffs-panel/acl/submit.pl:88 +#: ../vhffs-panel/acl/submit.pl:115 ../vhffs-panel/acl/add_acl_group.pl:102 +#: ../vhffs-panel/acl/add_acl_user.pl:102 msgid "Sorry, can't add ACL" msgstr "" -#: ../vhffs-panel/acl/submit.pl:77 +#: ../vhffs-panel/acl/submit.pl:104 msgid "Sorry, can't delete this ACL" msgstr "" -#: ../vhffs-panel/mail/spambox.pl:78 +#: ../vhffs-panel/mail/spambox.pl:101 msgid "Spam protection is not allowed" msgstr "" -#: ../vhffs-panel/mail/spambox.pl:97 +#: ../vhffs-panel/mail/spambox.pl:114 #, perl-format msgid "Spam status updated for box %s" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:56 +#: ../vhffs-panel/admin/svn/list.pl:78 ../vhffs-panel/admin/mailing/list.pl:88 +#: ../vhffs-panel/admin/user/list.pl:81 ../vhffs-panel/admin/dns/list.pl:89 +#: ../vhffs-panel/admin/pgsql/list.pl:89 ../vhffs-panel/admin/group/list.pl:91 +#: ../vhffs-panel/admin/repository/list.pl:90 +#: ../vhffs-panel/admin/object/list.pl:89 +#: ../vhffs-panel/admin/broadcast_view.pl:87 +#: ../vhffs-panel/admin/web/list.pl:80 ../vhffs-panel/admin/mysql/list.pl:90 +#: ../vhffs-panel/admin/cvs/list.pl:91 ../vhffs-panel/admin/mail/list.pl:89 msgid "State" msgstr "" -#: ../vhffs-panel/admin/mail/edit.pl:70 ../vhffs-panel/admin/mail/show.pl:70 -#: ../vhffs-panel/admin/pgsql/edit.pl:69 ../vhffs-panel/admin/pgsql/show.pl:67 -#: ../vhffs-panel/admin/largefile/list.pl:84 -#: ../vhffs-panel/admin/cvs/edit.pl:68 ../vhffs-panel/admin/cvs/show.pl:67 -#: ../vhffs-panel/admin/group/edit.pl:69 ../vhffs-panel/admin/group/show.pl:68 -#: ../vhffs-panel/admin/mysql/edit.pl:69 ../vhffs-panel/admin/mysql/show.pl:66 -#: ../vhffs-panel/admin/mysql/show.pl:68 -#: ../vhffs-panel/admin/object/edit.pl:65 ../vhffs-panel/admin/web/edit.pl:70 -#: ../vhffs-panel/admin/web/show.pl:69 ../vhffs-panel/admin/user/edit.pl:106 -#: ../vhffs-panel/admin/user/show.pl:79 +#: ../vhffs-panel/admin/user/edit.pl:137 ../vhffs-panel/admin/user/show.pl:110 +#: ../vhffs-panel/admin/pgsql/edit.pl:100 +#: ../vhffs-panel/admin/pgsql/show.pl:98 ../vhffs-panel/admin/group/edit.pl:98 +#: ../vhffs-panel/admin/group/show.pl:98 +#: ../vhffs-panel/admin/repository/edit.pl:98 +#: ../vhffs-panel/admin/repository/show.pl:97 +#: ../vhffs-panel/admin/object/edit.pl:96 ../vhffs-panel/admin/web/edit.pl:101 +#: ../vhffs-panel/admin/web/show.pl:100 ../vhffs-panel/admin/mysql/edit.pl:101 +#: ../vhffs-panel/admin/mysql/show.pl:97 ../vhffs-panel/admin/mysql/show.pl:99 +#: ../vhffs-panel/admin/cvs/edit.pl:99 ../vhffs-panel/admin/cvs/show.pl:98 +#: ../vhffs-panel/admin/mail/edit.pl:101 ../vhffs-panel/admin/mail/show.pl:101 msgid "Status" msgstr "" -#: ../vhffs-panel/admin/su.pl:48 +#: ../vhffs-panel/admin/su.pl:79 msgid "Su !" msgstr "" -#: ../vhffs-panel/panel.pl:52 -#, perl-format -msgid "Su successfull with name %s " -msgstr "" - -#: ../vhffs-panel/dns/prefs.pl:128 +#: ../vhffs-panel/dns/prefs.pl:159 msgid "Subdomain name" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:55 -#: ../vhffs-panel/admin/broadcast.pl:47 +#: ../vhffs-panel/admin/broadcast.pl:78 +#: ../vhffs-panel/admin/broadcast_view.pl:86 msgid "Subject" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:78 +#: ../vhffs-listengine/src/archives/show_msg.pl:109 msgid "Subject: " msgstr "" -#: ../vhffs-panel/dns/prefs.pl:120 ../vhffs-panel/dns/prefs.pl:126 -#: ../vhffs-panel/dns/prefs.pl:138 +#: ../vhffs-panel/dns/prefs.pl:151 ../vhffs-panel/dns/prefs.pl:157 +#: ../vhffs-panel/dns/prefs.pl:169 msgid "Submit" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:56 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:90 msgid "Submit a bug" msgstr "" -#: ../vhffs-panel/subscribe.pl:44 ../vhffs-panel/subscribe_complete.pl:61 -#: ../vhffs-panel/subscribe_complete.pl:67 -#: ../vhffs-panel/subscribe_complete.pl:74 -#: ../vhffs-panel/subscribe_complete.pl:81 -#: ../vhffs-panel/subscribe_complete.pl:88 -#: ../vhffs-panel/subscribe_complete.pl:95 -#: ../vhffs-panel/subscribe_complete.pl:102 -#: ../vhffs-panel/subscribe_complete.pl:109 -#: ../vhffs-panel/subscribe_complete.pl:116 -#: ../vhffs-panel/subscribe_complete.pl:123 -#: ../vhffs-panel/subscribe_complete.pl:130 -#: ../vhffs-panel/subscribe_complete.pl:137 -#: ../vhffs-panel/subscribe_complete.pl:144 -#: ../vhffs-panel/subscribe_complete.pl:151 -#: ../vhffs-panel/subscribe_complete.pl:158 -#: ../vhffs-panel/subscribe_complete.pl:165 -#: ../vhffs-panel/subscribe_complete.pl:220 ../vhffs-panel/auth.pl:36 +#: ../vhffs-panel/subscribe.pl:206 ../vhffs-panel/subscribe.pl:215 +#: ../vhffs-panel/auth.pl:62 msgid "Subscribe" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:106 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:136 #, perl-format msgid "Subscribe to the list %s is forbidden\n" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:143 +#: ../vhffs-panel/mailinglist/prefs.pl:178 msgid "Subscribed. Waiting for confirmation" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:142 +#: ../vhffs-panel/mailinglist/prefs.pl:177 msgid "Subscriber" msgstr "" -#: ../vhffs-panel/subscribe.pl:34 +#: ../vhffs-panel/subscribe.pl:196 msgid "Subscription" msgstr "" -#: ../vhffs-panel/subscribe.pl:33 -msgid "Subscription " -msgstr "" - -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:102 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:131 msgid "Subversion Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:117 +#: ../vhffs-api/src/Vhffs/Panel/Svn.pm:143 msgid "Subversion repository" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:274 +#: ../vhffs-panel/admin/moderation.pl:305 msgid "Subversion repository awaiting validation" msgstr "" -#: ../vhffs-panel/object/upavatar.pl:95 +#: ../vhffs-panel/object/upavatar.pl:126 msgid "Successfull create or replace avatar" msgstr "" -#: ../vhffs-panel/mailinglist/add_sub.pl:78 +#: ../vhffs-panel/mailinglist/add_sub.pl:105 msgid "Successfully added" msgstr "" -#: ../vhffs-panel/mailinglist/del_member.pl:78 +#: ../vhffs-panel/mailinglist/del_member.pl:105 msgid "Successfully deleted" msgstr "" -#: ../vhffs-panel/group/join_group.pl:59 +#: ../vhffs-panel/group/join_group.pl:86 msgid "" "Sucessfully added this user to this group. Please wait while robots add him" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:352 -#: ../vhffs-panel/admin/mail/edit.pl:131 ../vhffs-panel/admin/mail/edit.pl:132 -#: ../vhffs-panel/admin/pgsql/edit.pl:90 ../vhffs-panel/admin/pgsql/edit.pl:91 -#: ../vhffs-panel/admin/cvs/edit.pl:99 ../vhffs-panel/admin/cvs/edit.pl:100 -#: ../vhffs-panel/admin/group/edit.pl:92 ../vhffs-panel/admin/group/edit.pl:93 -#: ../vhffs-panel/admin/mysql/edit.pl:90 ../vhffs-panel/admin/mysql/edit.pl:91 -#: ../vhffs-panel/admin/object/edit.pl:90 -#: ../vhffs-panel/admin/object/edit.pl:91 ../vhffs-panel/admin/web/edit.pl:103 -#: ../vhffs-panel/admin/web/edit.pl:104 ../vhffs-panel/admin/user/edit.pl:114 +#: ../vhffs-panel/admin/user/edit.pl:145 +#: ../vhffs-panel/admin/pgsql/edit.pl:121 +#: ../vhffs-panel/admin/pgsql/edit.pl:122 +#: ../vhffs-panel/admin/group/edit.pl:121 +#: ../vhffs-panel/admin/group/edit.pl:122 +#: ../vhffs-panel/admin/repository/edit.pl:121 +#: ../vhffs-panel/admin/repository/edit.pl:122 +#: ../vhffs-panel/admin/object/edit.pl:121 +#: ../vhffs-panel/admin/object/edit.pl:122 +#: ../vhffs-panel/admin/web/edit.pl:134 ../vhffs-panel/admin/web/edit.pl:135 +#: ../vhffs-panel/admin/mysql/edit.pl:122 +#: ../vhffs-panel/admin/mysql/edit.pl:123 ../vhffs-panel/admin/cvs/edit.pl:130 +#: ../vhffs-panel/admin/cvs/edit.pl:131 ../vhffs-panel/admin/mail/edit.pl:162 +#: ../vhffs-panel/admin/mail/edit.pl:163 msgid "Suspended" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:356 -#: ../vhffs-panel/admin/user/edit.pl:115 +#: ../vhffs-panel/admin/user/edit.pl:146 msgid "Suspended before deletion" msgstr "" -#: ../vhffs-panel/mail/create.pl:40 +#: ../vhffs-panel/mail/create.pl:71 msgid "Tell us what the use of this mail space will be" msgstr "" -#: ../vhffs-panel/mailinglist/create.pl:71 +#: ../vhffs-panel/mailinglist/create.pl:102 msgid "Tell us what the use of this mailing list will be" msgstr "" -#: ../vhffs-panel/web/create.pl:50 +#: ../vhffs-panel/web/create.pl:81 msgid "Tell us what the use of this web space will be" msgstr "" -#: ../vhffs-panel/cvs/cvs_submit.pl:59 +#: ../vhffs-panel/cvs/cvs_submit.pl:88 msgid "The CVS object was successfully created !" msgstr "" -#: ../vhffs-panel/dns/dns_submit.pl:48 +#: ../vhffs-panel/dns/dns_submit.pl:76 msgid "The DNS object was successfully created !" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:50 -#: ../vhffs-robots/src/refused_cvs.pl:51 -#: ../vhffs-robots/src/refused_postgres.pl:50 -#: ../vhffs-robots/src/refused_web.pl:50 -#: ../vhffs-robots/src/refused_mail.pl:50 -#: ../vhffs-robots/src/refused_dns.pl:50 -#: ../vhffs-robots/src/refused_mysql.pl:50 -#: ../vhffs-robots/src/refused_svn.pl:50 ../vhffs-robots/src/refused_ml.pl:50 -#: ../vhffs-robots/src/refused_groups.pl:50 ../vhffs-irc/modobot.pl:370 -#: ../vhffs-panel/admin/moderation_submit.pl:78 +#: ../vhffs-panel/repository/repository_submit.pl:89 +msgid "The Download repository object was successfully created !" +msgstr "" + +#: ../vhffs-robots/src/refused_ml.pl:78 ../vhffs-robots/src/refused_mail.pl:80 +#: ../vhffs-robots/src/refused_postgres.pl:81 +#: ../vhffs-robots/src/refused_cvs.pl:77 ../vhffs-robots/src/refused_web.pl:76 +#: ../vhffs-robots/src/refused_mysql.pl:51 +#: ../vhffs-robots/src/refused_svn.pl:47 +#: ../vhffs-robots/src/refused_groups.pl:76 +#: ../vhffs-robots/src/refused_repository.pl:81 +#: ../vhffs-robots/src/refused_dns.pl:80 msgid "The Moderator and Admin team" msgstr "" -#: ../vhffs-panel/mysql/submit.pl:70 +#: ../vhffs-panel/mysql/submit.pl:99 msgid "The MySQL object was successfully created !" msgstr "" -#: ../vhffs-panel/pgsql/pgsql_submit.pl:66 +#: ../vhffs-panel/pgsql/pgsql_submit.pl:95 msgid "The PostgreSQL object was successfully created !" msgstr "" -#: ../vhffs-panel/svn/svn_submit.pl:66 +#: ../vhffs-panel/svn/svn_submit.pl:83 msgid "The Subversion object was successfully created !" msgstr "" -#: ../vhffs-panel/user/prefs.pl:82 +#: ../vhffs-panel/user/prefs.pl:115 msgid "" "The avatar is a pictures that describes you. You can upload an PNG image and " "use it as avatar. This image will then appear in the public section." msgstr "" -#: ../vhffs-panel/group/prefs.pl:79 +#: ../vhffs-panel/group/prefs.pl:110 msgid "The avatar is an image to describe the group" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:152 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:182 msgid "The confirmation code was wrong\n" msgstr "" -#: ../vhffs-panel/mysql/submit.pl:60 +#: ../vhffs-panel/mysql/submit.pl:91 msgid "The database name is not valid" msgstr "" -#: ../vhffs-panel/mysql/submit.pl:48 +#: ../vhffs-panel/mysql/submit.pl:79 msgid "The database name is too long. There is a 32 character limit" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:340 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:370 #, perl-format msgid "" "The following address %s is not allowed to execute commands on the list %s\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:168 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:198 #, perl-format msgid "The following address %s is not on the list %s\n" msgstr "" -#: ../vhffs-panel/acl/add_acl_group.pl:63 +#: ../vhffs-panel/acl/add_acl_group.pl:90 msgid "The group does not exist" msgstr "" -#: ../vhffs-panel/group/project_submit.pl:47 +#: ../vhffs-panel/group/project_submit.pl:78 msgid "The groupname can have no more than 12 caracters." msgstr "" -#: ../vhffs-panel/group/project_submit.pl:55 +#: ../vhffs-panel/group/project_submit.pl:74 msgid "" "The groupname should contain at least 3 caracters and must contain only " -"letters or numbers" -msgstr "" - -#: ../vhffs-panel/group/project_submit.pl:43 -msgid "" -"The groupname should contain at least 3 caracters and must contain only " "letters or numbers in lower case" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:229 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:259 #, perl-format msgid "" "The listengine language preference was changed for the following address %" "s.\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:277 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:307 msgid "The message does not exists or was moderated before you.\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:274 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:304 #, perl-format msgid "The message with the following id %s" msgstr "" -#: ../vhffs-panel/largefile/submit.pl:62 -msgid "The new file has been created. Please wait mail." -msgstr "" - -#: ../vhffs-panel/mysql/submit.pl:64 +#: ../vhffs-panel/mysql/submit.pl:95 msgid "The password is not valid" msgstr "" -#: ../vhffs-panel/pgsql/create.pl:39 ../vhffs-panel/mysql/create.pl:34 +#: ../vhffs-panel/pgsql/create.pl:70 ../vhffs-panel/mysql/create.pl:65 #, perl-format msgid "" "The prefix of your databases is constant, so the names of your databases " @@ -3448,1245 +3421,1272 @@ "s_DBNAME" msgstr "" -#: ../vhffs-panel/svn/svn_submit.pl:45 +#: ../vhffs-panel/svn/svn_submit.pl:73 msgid "" "The repository name is too short. It must contains at least 3 caracters, and " "must only contain letters and numbers" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:93 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:123 msgid "" "The state of you subscription was not changed, you are always a subscriber\n" msgstr "" -#: ../vhffs-panel/acl/add_acl_user.pl:63 -msgid "The user does not exist" -msgstr "" - -#: ../vhffs-panel/user/prefs.pl:58 +#: ../vhffs-panel/user/prefs.pl:89 msgid "Theme" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:237 +#: ../vhffs-panel/user/prefs_save.pl:254 msgid "" "There is a problem with the address you filled in your profile, unable to " "add forwarding" msgstr "" -#: ../vhffs-panel/user/prefs.pl:140 +#: ../vhffs-panel/user/prefs.pl:177 msgid "There is two possible usages :" msgstr "" -#: ../vhffs-panel/cvs/delete.pl:59 +#: ../vhffs-panel/cvs/delete.pl:90 msgid "This CVS repository will NOT be deleted" msgstr "" -#: ../vhffs-panel/cvs/delete.pl:72 +#: ../vhffs-panel/cvs/delete.pl:103 msgid "This CVS will be delete" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:99 ../vhffs-panel/cvs/prefs.pl:76 -#: ../vhffs-panel/group/prefs.pl:67 ../vhffs-panel/svn/prefs.pl:93 -#: ../vhffs-panel/mailinglist/prefs.pl:166 ../vhffs-panel/web/prefs.pl:96 -#: ../vhffs-panel/mail/prefs.pl:100 ../vhffs-panel/pgsql/prefs.pl:77 -#: ../vhffs-panel/largefile/prefs.pl:100 ../vhffs-panel/mysql/prefs.pl:84 +#: ../vhffs-panel/pgsql/delete.pl:73 ../vhffs-panel/pgsql/prefs_save.pl:77 +msgid "This DB doesn't exist in VHFFS database" +msgstr "" + +#: ../vhffs-panel/repository/delete.pl:90 +msgid "This Download repository will NOT be deleted" +msgstr "" + +#: ../vhffs-panel/repository/delete.pl:103 +msgid "This Download repository will be deleted" +msgstr "" + +#: ../vhffs-panel/mailinglist/prefs.pl:201 ../vhffs-panel/svn/prefs.pl:123 +#: ../vhffs-panel/dns/prefs.pl:130 ../vhffs-panel/pgsql/prefs.pl:108 +#: ../vhffs-panel/group/prefs.pl:98 ../vhffs-panel/repository/prefs.pl:103 +#: ../vhffs-panel/web/prefs.pl:127 ../vhffs-panel/mysql/prefs.pl:115 +#: ../vhffs-panel/cvs/prefs.pl:107 ../vhffs-panel/mail/prefs.pl:131 msgid "" "This action is non-reversible. All services associated to this project will " "be DESTROYED." msgstr "" -#: ../vhffs-panel/user/prefs.pl:73 +#: ../vhffs-panel/user/prefs.pl:102 msgid "This action is non-reversible. WHEN YOU DELETE IT, YOU CANNOT CANCEL." msgstr "" -#: ../vhffs-panel/mail/add_account.pl:73 +#: ../vhffs-panel/mail/add_account.pl:104 msgid "" "This box already exists for this domain or parameters are not valid. Check " "your domain." msgstr "" -#: ../vhffs-panel/mail/add_account.pl:83 +#: ../vhffs-panel/mail/add_account.pl:108 msgid "This box has been successfully added to this domain" msgstr "" -#: ../vhffs-panel/pgsql/delete.pl:62 +#: ../vhffs-panel/pgsql/delete.pl:93 msgid "This database cannot be deleted" msgstr "" -#: ../vhffs-panel/mysql/delete.pl:41 +#: ../vhffs-panel/mysql/delete.pl:72 msgid "This database doesn't exist in VHFFS database" msgstr "" -#: ../vhffs-panel/mysql/prefs_save.pl:44 +#: ../vhffs-panel/mysql/prefs_save.pl:75 msgid "This database doesn't exist on VHFFS" msgstr "" -#: ../vhffs-panel/mysql/delete.pl:53 +#: ../vhffs-panel/mysql/delete.pl:84 msgid "This database will NOT be deleted" msgstr "" -#: ../vhffs-panel/dns/dns_type_submit.pl:42 +#: ../vhffs-panel/dns/dns_type_submit.pl:74 msgid "This domain name doesn't exist in the VHFFS database" msgstr "" -#: ../vhffs-panel/dns/delete.pl:80 +#: ../vhffs-panel/dns/delete.pl:111 msgid "This domain will NOT be DELETED from Vhffs platform" msgstr "" -#: ../vhffs-panel/dns/delete.pl:75 +#: ../vhffs-panel/dns/delete.pl:106 msgid "This domain will be DELETED from Vhffs platform" msgstr "" -#: ../vhffs-panel/mail/add_forward.pl:75 -msgid "This forward has been successfully added to this domain" -msgstr "" - -#: ../vhffs-panel/group/project_submit.pl:60 -msgid "This group already exists" -msgstr "" - -#: ../vhffs-panel/group/prefs_save.pl:56 +#: ../vhffs-panel/group/prefs_save.pl:82 msgid "This group is not activated yet" msgstr "" -#: ../vhffs-panel/group/delete.pl:60 +#: ../vhffs-panel/group/delete.pl:91 msgid "This group will be deleted" msgstr "" -#: ../vhffs-panel/mail/save_catchall.pl:59 +#: ../vhffs-panel/mail/save_catchall.pl:90 msgid "This is not a correct mail address" msgstr "" -#: ../vhffs-panel/mail/delete.pl:71 +#: ../vhffs-panel/mail/delete.pl:102 msgid "This mail domain WILL BE DELETED" msgstr "" -#: ../vhffs-panel/mail/delete.pl:59 +#: ../vhffs-panel/mail/delete.pl:90 msgid "This mail domain will NOT be DELETED" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:75 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:105 #, perl-format msgid "" "This mail must contains the following subject : \"confirm unsubscribe %s\"\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:57 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:87 #, perl-format msgid "This mail must have the following subject : \"confirm subscribe %s\"\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:357 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:387 #, perl-format msgid "This mail was sent by %s with the following subject: \n" msgstr "" -#: ../vhffs-panel/mailinglist/add_sub.pl:74 +#: ../vhffs-panel/mailinglist/add_sub.pl:101 msgid "This member already exists on this list !" msgstr "" -#: ../vhffs-panel/admin/object/delete_avatar.pl:73 +#: ../vhffs-panel/admin/object/delete_avatar.pl:104 msgid "This object does not have an avatar" msgstr "" -#: ../vhffs-panel/group/prefs.pl:44 +#: ../vhffs-panel/group/prefs.pl:75 msgid "This object is not functional yet. Please wait creation or moderation." msgstr "" -#: ../vhffs-panel/dns/prefs.pl:68 ../vhffs-panel/cvs/prefs_save.pl:55 -#: ../vhffs-panel/cvs/delete.pl:55 ../vhffs-panel/group/delete.pl:43 -#: ../vhffs-panel/svn/prefs_save.pl:55 ../vhffs-panel/svn/delete.pl:54 -#: ../vhffs-panel/mailinglist/save_options.pl:65 -#: ../vhffs-panel/mailinglist/del_member.pl:60 -#: ../vhffs-panel/mailinglist/prefs.pl:63 -#: ../vhffs-panel/mailinglist/add_sub.pl:60 -#: ../vhffs-panel/mailinglist/change_right.pl:62 -#: ../vhffs-panel/mailinglist/delete.pl:59 ../vhffs-panel/web/prefs_save.pl:51 -#: ../vhffs-panel/web/prefs.pl:49 ../vhffs-panel/mail/delete_forward.pl:58 -#: ../vhffs-panel/mail/change_forward.pl:66 -#: ../vhffs-panel/mail/save_catchall.pl:49 ../vhffs-panel/mail/spambox.pl:66 -#: ../vhffs-panel/mail/spamvirus.pl:66 ../vhffs-panel/mail/delete_box.pl:63 -#: ../vhffs-panel/mail/password_box.pl:66 -#: ../vhffs-panel/mail/add_forward.pl:53 ../vhffs-panel/mail/prefs.pl:54 -#: ../vhffs-panel/mail/delete.pl:51 ../vhffs-panel/mail/add_account.pl:58 -#: ../vhffs-panel/admin/mail/delete_forward.pl:66 -#: ../vhffs-panel/admin/mail/change_forward.pl:67 -#: ../vhffs-panel/admin/mail/delete_box.pl:66 -#: ../vhffs-panel/admin/mail/password_box.pl:67 -#: ../vhffs-panel/largefile/delete.pl:53 ../vhffs-panel/mysql/prefs_save.pl:60 -#: ../vhffs-panel/mysql/prefs.pl:59 +#: ../vhffs-panel/mailinglist/delete.pl:86 +#: ../vhffs-panel/mailinglist/save_sig.pl:85 +#: ../vhffs-panel/mailinglist/add_sub.pl:87 +#: ../vhffs-panel/mailinglist/prefs.pl:94 +#: ../vhffs-panel/mailinglist/save_options.pl:92 +#: ../vhffs-panel/mailinglist/change_right.pl:89 +#: ../vhffs-panel/mailinglist/del_member.pl:87 ../vhffs-panel/svn/delete.pl:85 +#: ../vhffs-panel/svn/prefs_save.pl:86 ../vhffs-panel/dns/prefs.pl:99 +#: ../vhffs-panel/group/delete.pl:74 ../vhffs-panel/repository/delete.pl:86 +#: ../vhffs-panel/repository/prefs_save.pl:86 +#: ../vhffs-panel/admin/mail/delete_box.pl:89 +#: ../vhffs-panel/admin/mail/password_box.pl:90 +#: ../vhffs-panel/admin/mail/delete_forward.pl:90 +#: ../vhffs-panel/admin/mail/change_forward.pl:90 +#: ../vhffs-panel/web/prefs.pl:80 ../vhffs-panel/web/prefs_save.pl:82 +#: ../vhffs-panel/mysql/prefs.pl:90 ../vhffs-panel/mysql/prefs_save.pl:91 +#: ../vhffs-panel/cvs/delete.pl:86 ../vhffs-panel/cvs/prefs_save.pl:85 +#: ../vhffs-panel/mail/delete.pl:82 ../vhffs-panel/mail/delete_box.pl:86 +#: ../vhffs-panel/mail/add_account.pl:89 ../vhffs-panel/mail/prefs.pl:85 +#: ../vhffs-panel/mail/save_catchall.pl:80 +#: ../vhffs-panel/mail/password_box.pl:89 +#: ../vhffs-panel/mail/delete_forward.pl:84 +#: ../vhffs-panel/mail/add_forward.pl:83 +#: ../vhffs-panel/mail/change_forward.pl:89 +#: ../vhffs-panel/mail/spamvirus.pl:89 ../vhffs-panel/mail/spambox.pl:89 msgid "This object is not functionnal yet. Please wait creation or moderation." msgstr "" -#: ../vhffs-panel/cvs/prefs.pl:61 ../vhffs-panel/svn/prefs.pl:76 -#: ../vhffs-panel/largefile/prefs.pl:77 +#: ../vhffs-panel/svn/prefs.pl:106 ../vhffs-panel/repository/prefs.pl:89 +#: ../vhffs-panel/cvs/prefs.pl:92 msgid "" "This object is not functionnal yet. Please wait creation, moderation or " "modification." msgstr "" -#: ../vhffs-panel/web/delete.pl:65 +#: ../vhffs-panel/web/delete.pl:96 msgid "This object will BE DELETED" msgstr "" -#: ../vhffs-panel/group/delete.pl:47 ../vhffs-panel/web/delete.pl:70 +#: ../vhffs-panel/group/delete.pl:78 ../vhffs-panel/web/delete.pl:101 msgid "This object will NOT be DELETED" msgstr "" -#: ../vhffs-panel/dns/delete_cname.pl:72 ../vhffs-panel/dns/delete_mx.pl:72 -#: ../vhffs-panel/dns/delete_ns.pl:71 ../vhffs-panel/dns/delete_a.pl:73 +#: ../vhffs-panel/dns/delete_a.pl:74 ../vhffs-panel/dns/delete_ns.pl:102 +#: ../vhffs-panel/dns/delete_mx.pl:103 ../vhffs-panel/dns/delete_cname.pl:101 msgid "This part of the domain is now removed." msgstr "" -#: ../vhffs-panel/object/upavatar.pl:62 +#: ../vhffs-panel/object/upavatar.pl:93 msgid "This platform does not provide avatar support" msgstr "" -#: ../vhffs-panel/admin/object/delete_avatar.pl:42 +#: ../vhffs-panel/admin/object/delete_avatar.pl:73 msgid "This platform does not support avatar" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:31 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:34 msgid "" "This platform is temporary closed. Administrators are performing some " "maintenances tasks or system has database errors. Please come back in a few " "minutes to log in." msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:42 ../vhffs-panel/login.pl:48 +#: ../vhffs-panel/login.pl:75 ../vhffs-api/src/Vhffs/Panel/Main.pm:45 msgid "" "This platform is temporary closed. Administrators are performing some " "maintenances tasks. Please come back in a few minutes to log in." msgstr "" -#: ../vhffs-panel/svn/svn_submit.pl:51 +#: ../vhffs-panel/svn/svn_submit.pl:76 msgid "This repository name already exists" msgstr "" -#: ../vhffs-panel/svn/delete.pl:71 ../vhffs-panel/largefile/delete.pl:70 +#: ../vhffs-panel/svn/delete.pl:102 msgid "This repository will be deleted" msgstr "" -#: ../vhffs-panel/svn/delete.pl:58 ../vhffs-panel/largefile/delete.pl:57 +#: ../vhffs-panel/svn/delete.pl:89 msgid "This subversion repository will NOT be deleted" msgstr "" -#: ../vhffs-panel/acl/view.pl:92 +#: ../vhffs-panel/acl/view.pl:124 msgid "This type of object is not treated in the panel." msgstr "" -#: ../vhffs-panel/group/remove_user_from_group.pl:48 +#: ../vhffs-panel/group/remove_user_from_group.pl:79 msgid "This user does not exists " msgstr "" -#: ../vhffs-panel/pgsql/prefs_save.pl:46 ../vhffs-panel/pgsql/delete.pl:42 -msgid "This user doesn't exist in VHFFS database" -msgstr "" - -#: ../vhffs-panel/user/delete.pl:45 +#: ../vhffs-panel/user/delete.pl:76 msgid "This user is always in a group" msgstr "" -#: ../vhffs-panel/group/remove_user_from_group.pl:57 +#: ../vhffs-panel/group/remove_user_from_group.pl:88 msgid "This user is not in this group " msgstr "" -#: ../vhffs-panel/user/delete.pl:56 +#: ../vhffs-panel/user/delete.pl:87 msgid "This user will BE DELETED" msgstr "" -#: ../vhffs-panel/user/delete.pl:62 +#: ../vhffs-panel/user/delete.pl:93 msgid "This user will NOT be DELETED" msgstr "" -#: ../vhffs-panel/group/remove_user_from_group.pl:61 +#: ../vhffs-panel/group/remove_user_from_group.pl:92 msgid "This user will be removed from this group as soon as possible" msgstr "" -#: ../vhffs-panel/web/prefs_save.pl:47 ../vhffs-panel/web/delete.pl:48 +#: ../vhffs-panel/web/delete.pl:79 ../vhffs-panel/web/prefs_save.pl:78 msgid "This web area doesn't exist in VHFFS database" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:360 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:390 msgid "To put this post on the list, send a message \n" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:76 +#: ../vhffs-listengine/src/archives/show_msg.pl:107 msgid "To: " msgstr "" -#: ../vhffs-panel/admin/stats.pl:62 +#: ../vhffs-panel/admin/stats.pl:93 msgid "Total Admin Users in VHFFS database" msgstr "" -#: ../vhffs-panel/admin/stats.pl:89 +#: ../vhffs-panel/admin/stats.pl:120 msgid "Total CVS in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:81 +#: ../vhffs-panel/admin/stats.pl:112 msgid "Total DNS in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:103 +#: ../vhffs-panel/admin/stats.pl:134 msgid "Total Mail domains in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:64 +#: ../vhffs-panel/admin/stats.pl:95 msgid "Total Moderator Users in VHFFS database" msgstr "" -#: ../vhffs-panel/admin/stats.pl:115 +#: ../vhffs-panel/admin/stats.pl:146 msgid "Total MySQL in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:122 +#: ../vhffs-panel/admin/stats.pl:153 msgid "Total PostgreSQL in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:96 +#: ../vhffs-panel/admin/stats.pl:127 msgid "Total SVN in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:60 +#: ../vhffs-panel/admin/stats.pl:91 msgid "Total Users in VHFFS database" msgstr "" -#: ../vhffs-panel/admin/stats.pl:74 +#: ../vhffs-panel/admin/stats.pl:105 msgid "Total Web Areas in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:91 +#: ../vhffs-panel/admin/stats.pl:122 msgid "Total activated CVS" msgstr "" -#: ../vhffs-panel/admin/stats.pl:83 +#: ../vhffs-panel/admin/stats.pl:114 msgid "Total activated DNS" msgstr "" -#: ../vhffs-panel/admin/stats.pl:105 +#: ../vhffs-panel/admin/stats.pl:136 msgid "Total activated Mail domains" msgstr "" -#: ../vhffs-panel/admin/stats.pl:117 +#: ../vhffs-panel/admin/stats.pl:148 msgid "Total activated MySQL" msgstr "" -#: ../vhffs-panel/admin/stats.pl:124 +#: ../vhffs-panel/admin/stats.pl:155 msgid "Total activated PostgreSQL" msgstr "" -#: ../vhffs-panel/admin/stats.pl:98 +#: ../vhffs-panel/admin/stats.pl:129 msgid "Total activated SVN" msgstr "" -#: ../vhffs-panel/admin/stats.pl:76 +#: ../vhffs-panel/admin/stats.pl:107 msgid "Total activated Web Areas" msgstr "" -#: ../vhffs-panel/admin/stats.pl:70 +#: ../vhffs-panel/admin/stats.pl:101 msgid "Total activated groups" msgstr "" -#: ../vhffs-panel/admin/stats.pl:140 -msgid "Total activated hoted files" -msgstr "" - -#: ../vhffs-panel/admin/stats.pl:132 +#: ../vhffs-panel/admin/stats.pl:163 msgid "Total activated lists" msgstr "" -#: ../vhffs-panel/admin/stats.pl:68 +#: ../vhffs-panel/admin/stats.pl:99 msgid "Total groups in database" msgstr "" -#: ../vhffs-panel/admin/stats.pl:109 +#: ../vhffs-panel/admin/stats.pl:140 msgid "Total hosted boxes" msgstr "" -#: ../vhffs-panel/admin/stats.pl:107 +#: ../vhffs-panel/admin/stats.pl:138 msgid "Total hosted forwards" msgstr "" -#: ../vhffs-panel/admin/stats.pl:139 -msgid "Total hoted files" -msgstr "" - -#: ../vhffs-panel/admin/stats.pl:130 +#: ../vhffs-panel/admin/stats.pl:161 msgid "Total lists in moderation" msgstr "" -#: ../vhffs-panel/admin/stats.pl:134 +#: ../vhffs-panel/admin/stats.pl:165 msgid "Total subscribtion for lists" msgstr "" -#: ../vhffs-panel/largefile/prefs.pl:96 -msgid "Type" -msgstr "" - -#: ../vhffs-panel/admin/user/edit.pl:71 ../vhffs-panel/admin/user/show.pl:71 +#: ../vhffs-panel/admin/user/edit.pl:102 ../vhffs-panel/admin/user/show.pl:102 msgid "UID" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:63 +#: ../vhffs-panel/admin/object/edit.pl:94 msgid "UID of owner" msgstr "" -#: ../vhffs-panel/mysql/prefs_save.pl:64 +#: ../vhffs-api/src/Vhffs/Panel/Repository.pm:135 +msgid "URL" +msgstr "" + +#: ../vhffs-panel/admin/mail/password_box.pl:105 +#, perl-format +msgid "Unable to change password for box %s (%d)" +msgstr "" + +#: ../vhffs-panel/mail/spambox.pl:110 +#, perl-format +msgid "Unable to change spam status for %s" +msgstr "" + +#: ../vhffs-panel/mysql/prefs_save.pl:95 msgid "Unable to change this database's password" msgstr "" -#: ../vhffs-panel/mail/delete.pl:67 +#: ../vhffs-panel/mail/spamvirus.pl:110 +#, perl-format +msgid "Unable to change virus protection status for %s" +msgstr "" + +#: ../vhffs-panel/mail/delete_forward.pl:96 +#, perl-format +msgid "Unable to delete forward %s" +msgstr "" + +#: ../vhffs-panel/admin/mail/delete_forward.pl:105 +#, perl-format +msgid "Unable to delete forward %s (%d)" +msgstr "" + +#: ../vhffs-panel/mail/delete.pl:98 msgid "Unable to delete this domain" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit_submit.pl:67 -#: ../vhffs-panel/admin/mysql/edit_submit.pl:67 -msgid "Unable to modify the object" +#: ../vhffs-panel/admin/mail/delete_box.pl:76 +#: ../vhffs-panel/admin/mail/password_box.pl:77 +#: ../vhffs-panel/admin/mail/delete_forward.pl:77 +#: ../vhffs-panel/admin/mail/change_forward.pl:77 +#: ../vhffs-panel/mail/delete.pl:78 ../vhffs-panel/mail/delete_box.pl:73 +#: ../vhffs-panel/mail/prefs.pl:77 ../vhffs-panel/mail/password_box.pl:76 +#: ../vhffs-panel/mail/delete_forward.pl:74 +#: ../vhffs-panel/mail/change_forward.pl:76 +#: ../vhffs-panel/mail/spamvirus.pl:76 ../vhffs-panel/mail/spambox.pl:76 +#, perl-format +msgid "Unable to get information on mail domain %s" msgstr "" -#: ../vhffs-panel/mail/change_forward.pl:87 ../vhffs-panel/mail/spambox.pl:93 -#: ../vhffs-panel/mail/spamvirus.pl:93 ../vhffs-panel/mail/password_box.pl:87 -msgid "Unable to reccord changes on this domain" +#: ../vhffs-panel/admin/mail/change_forward.pl:105 +#: ../vhffs-panel/mail/change_forward.pl:104 +#, perl-format +msgid "Unable to modify forward %s (%d)" msgstr "" -#: ../vhffs-panel/mail/add_forward.pl:71 ../vhffs-panel/mail/add_account.pl:79 -#: ../vhffs-panel/admin/mail/change_forward.pl:88 +#: ../vhffs-panel/admin/pgsql/edit_submit.pl:98 +#: ../vhffs-panel/admin/mysql/edit_submit.pl:102 +msgid "Unable to modify the object" +msgstr "" + +#: ../vhffs-panel/mail/add_forward.pl:99 msgid "Unable to record changes on this domain" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:50 -#: ../vhffs-listengine/src/archives/archives.pl:110 +#: ../vhffs-listengine/src/archives/archives.pl:141 +#: ../vhffs-listengine/src/archives/show_msg.pl:81 msgid "Undefined list" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:256 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:286 msgid "Unknow command\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:423 +#: ../vhffs-api/src/Vhffs/Functions.pm:391 +#: ../vhffs-api/src/Vhffs/Functions.pm:396 +msgid "Unknown" +msgstr "" + +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:453 msgid "Unknown month" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:73 -#: ../vhffs-panel/admin/broadcast_list.pl:72 +#: ../vhffs-panel/admin/broadcast_list.pl:103 +#: ../vhffs-panel/admin/broadcast_view.pl:104 msgid "Unknown status" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:199 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:229 #, perl-format msgid "Unsubscribe for the list %s was not complete.\n" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:229 +#: ../vhffs-panel/admin/user/edit.pl:260 msgid "Update note" msgstr "" -#: ../vhffs-panel/dns/modif_a.pl:77 +#: ../vhffs-panel/mailinglist/prefs.pl:125 +msgid "Update signature" +msgstr "" + +#: ../vhffs-panel/dns/modif_a.pl:106 msgid "Updated !" msgstr "" -#: ../vhffs-panel/admin/web/edit.pl:71 ../vhffs-panel/admin/web/show.pl:84 +#: ../vhffs-panel/admin/web/edit.pl:102 ../vhffs-panel/admin/web/show.pl:115 msgid "Use Crawl" msgstr "" -#: ../vhffs-panel/user/prefs.pl:141 +#: ../vhffs-panel/user/prefs.pl:178 #, perl-format msgid "" "Use VHFFS servers to manage this mail,<br>you should use use the host pop.%s " "or imap.%s to fetch your mails" msgstr "" -#: ../vhffs-panel/user/prefs.pl:147 +#: ../vhffs-panel/user/prefs.pl:184 msgid "Use anti-spam protection" msgstr "" -#: ../vhffs-panel/user/prefs.pl:155 +#: ../vhffs-panel/user/prefs.pl:192 msgid "Use anti-virus protection" msgstr "" -#: ../vhffs-panel/web/prefs.pl:67 +#: ../vhffs-panel/web/prefs.pl:98 msgid "Use crawl (useful for web-search engine)" msgstr "" -#: ../vhffs-panel/admin/pgsql/edit.pl:65 ../vhffs-panel/admin/pgsql/show.pl:64 -#: ../vhffs-panel/admin/mysql/edit.pl:65 ../vhffs-panel/admin/mysql/show.pl:63 +#: ../vhffs-panel/admin/pgsql/edit.pl:96 ../vhffs-panel/admin/pgsql/show.pl:95 +#: ../vhffs-panel/admin/mysql/edit.pl:96 ../vhffs-panel/admin/mysql/show.pl:94 msgid "User" msgstr "" -#: ../vhffs-panel/panel.pl:56 +#: ../vhffs-panel/panel.pl:84 #, perl-format msgid "User %s does not exists" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:70 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:99 msgid "User Admin" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:54 ../vhffs-panel/user/prefs.pl:45 +#: ../vhffs-panel/user/prefs.pl:76 ../vhffs-api/src/Vhffs/Panel/Menu.pm:88 msgid "User Preferences" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:204 +#: ../vhffs-panel/subscribe.pl:166 msgid "User Successfully created" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:101 +#: ../vhffs-panel/user/prefs_save.pl:132 msgid "User Successfully modified" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:48 +#: ../vhffs-api/src/Vhffs/Panel/Menu.pm:81 msgid "User account : " msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:150 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:237 msgid "User does not exist" msgstr "" -#: ../vhffs-panel/public/index.pl:34 +#: ../vhffs-panel/public/index.pl:63 msgid "User public area" msgstr "" -#: ../vhffs-panel/group/prefs.pl:73 ../vhffs-panel/acl/view.pl:118 -#: ../vhffs-panel/public/lastusers.pl:44 ../vhffs-panel/public/user.pl:53 -#: ../vhffs-panel/admin/su.pl:47 ../vhffs-panel/user/prefs.pl:47 -#: ../vhffs-panel/subscribe.pl:36 ../vhffs-panel/auth.pl:32 -#: ../vhffs-panel/lost.pl:26 +#: ../vhffs-panel/subscribe.pl:198 ../vhffs-panel/user/prefs.pl:78 +#: ../vhffs-panel/acl/view.pl:150 ../vhffs-panel/group/prefs.pl:104 +#: ../vhffs-panel/admin/user/list.pl:79 ../vhffs-panel/admin/su.pl:78 +#: ../vhffs-panel/public/user.pl:81 ../vhffs-panel/public/lastusers.pl:76 +#: ../vhffs-panel/auth.pl:58 ../vhffs-panel/lost.pl:54 msgid "Username" msgstr "" -#: ../vhffs-panel/pgsql/prefs.pl:65 ../vhffs-panel/mysql/prefs.pl:72 +#: ../vhffs-panel/pgsql/prefs.pl:96 ../vhffs-panel/mysql/prefs.pl:103 msgid "Username for this database" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:79 -msgid "Username must contain between 3 and 12 characters" -msgstr "" - -#: ../vhffs-panel/admin/user/edit.pl:64 ../vhffs-panel/admin/user/show.pl:65 +#: ../vhffs-panel/admin/user/edit.pl:95 ../vhffs-panel/admin/user/show.pl:96 msgid "Username:" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:63 -#, perl-format -msgid "Username: %s\n" -msgstr "" - -#: ../vhffs-panel/public/allgroups.pl:44 ../vhffs-panel/public/group.pl:60 -#: ../vhffs-panel/public/lastgroups.pl:44 +#: ../vhffs-panel/public/lastgroups.pl:73 ../vhffs-panel/public/group.pl:92 +#: ../vhffs-panel/public/allgroups.pl:80 msgid "Users" msgstr "" -#: ../vhffs-panel/admin/stats.pl:59 +#: ../vhffs-panel/admin/stats.pl:90 msgid "Users stats" msgstr "" -#: ../vhffs-panel/auth.pl:28 +#: ../vhffs-panel/auth.pl:54 msgid "VHFFS Login" msgstr "" -#: ../vhffs-panel/login.pl:88 +#: ../vhffs-panel/login.pl:106 msgid "VHFFS Login OK" msgstr "" -#: ../vhffs-panel/login.pl:57 ../vhffs-panel/login.pl:98 +#: ../vhffs-panel/login.pl:86 ../vhffs-panel/login.pl:116 msgid "VHFFS Login failed" msgstr "" -#: ../vhffs-panel/logout.pl:29 +#: ../vhffs-panel/logout.pl:58 msgid "VHFFS Logout" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:208 -msgid "VHFFS Panel" -msgstr "" - -#: ../vhffs-panel/lost_ack.pl:39 +#: ../vhffs-panel/lost_ack.pl:68 msgid "VHFFS Password Lost OK" msgstr "" -#: ../vhffs-panel/lost_ack.pl:50 +#: ../vhffs-panel/lost_ack.pl:79 msgid "VHFFS Password Lost failed" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:332 -#: ../vhffs-panel/admin/mail/edit.pl:126 ../vhffs-panel/admin/pgsql/edit.pl:85 -#: ../vhffs-panel/admin/cvs/edit.pl:94 ../vhffs-panel/admin/group/edit.pl:87 -#: ../vhffs-panel/admin/mysql/edit.pl:85 -#: ../vhffs-panel/admin/object/edit.pl:85 ../vhffs-panel/admin/web/edit.pl:98 -#: ../vhffs-panel/admin/user/edit.pl:109 +#: ../vhffs-panel/admin/user/edit.pl:140 +#: ../vhffs-panel/admin/pgsql/edit.pl:116 +#: ../vhffs-panel/admin/group/edit.pl:116 +#: ../vhffs-panel/admin/repository/edit.pl:116 +#: ../vhffs-panel/admin/object/edit.pl:116 +#: ../vhffs-panel/admin/web/edit.pl:129 ../vhffs-panel/admin/mysql/edit.pl:117 +#: ../vhffs-panel/admin/cvs/edit.pl:125 ../vhffs-panel/admin/mail/edit.pl:157 msgid "Validation refused" msgstr "" -#: ../vhffs-panel/admin/stats.pl:57 +#: ../vhffs-panel/admin/stats.pl:88 msgid "Vhffs Statistics" msgstr "" -#: ../vhffs-listengine/src/archives/archives.pl:37 -#: ../vhffs-listengine/src/archives/archives.pl:144 +#: ../vhffs-listengine/src/archives/archives.pl:68 +#: ../vhffs-listengine/src/archives/archives.pl:175 msgid "View" msgstr "" -#: ../vhffs-panel/public/group.pl:202 +#: ../vhffs-panel/public/group.pl:207 msgid "View archives" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:283 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:307 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:333 #: ../vhffs-api/src/Vhffs/Panel/Main.pm:359 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:385 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:412 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:438 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:465 -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:490 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:383 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:409 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:435 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:461 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:488 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:514 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:540 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:565 msgid "View history" msgstr "" -#: ../vhffs-panel/admin/broadcast_view.pl:53 +#: ../vhffs-panel/admin/broadcast_view.pl:84 msgid "View mailing" msgstr "" -#: ../vhffs-panel/admin/broadcast_list.pl:58 +#: ../vhffs-panel/admin/broadcast_list.pl:89 msgid "View this mailing" msgstr "" -#: ../vhffs-panel/mail/spamvirus.pl:78 +#: ../vhffs-panel/mail/spamvirus.pl:101 msgid "Virus protection is not allowed" msgstr "" -#: ../vhffs-panel/mail/spamvirus.pl:97 +#: ../vhffs-panel/mail/spamvirus.pl:114 #, perl-format msgid "Virus status updated for box %s" msgstr "" -#: ../vhffs-panel/admin/stats.pl:73 +#: ../vhffs-panel/admin/stats.pl:104 msgid "WEB stats" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:336 -#: ../vhffs-panel/admin/mail/edit.pl:127 ../vhffs-panel/admin/dns/list.pl:76 -#: ../vhffs-panel/admin/pgsql/edit.pl:86 ../vhffs-panel/admin/pgsql/list.pl:78 -#: ../vhffs-panel/admin/cvs/edit.pl:95 ../vhffs-panel/admin/group/edit.pl:88 -#: ../vhffs-panel/admin/mysql/edit.pl:86 ../vhffs-panel/admin/mysql/list.pl:78 -#: ../vhffs-panel/admin/object/edit.pl:86 -#: ../vhffs-panel/admin/object/list.pl:73 ../vhffs-panel/admin/web/edit.pl:99 -#: ../vhffs-panel/admin/user/edit.pl:110 +#: ../vhffs-panel/admin/user/edit.pl:141 +#: ../vhffs-panel/admin/pgsql/edit.pl:117 +#: ../vhffs-panel/admin/group/edit.pl:117 +#: ../vhffs-panel/admin/repository/edit.pl:117 +#: ../vhffs-panel/admin/object/edit.pl:117 +#: ../vhffs-panel/admin/web/edit.pl:130 ../vhffs-panel/admin/mysql/edit.pl:118 +#: ../vhffs-panel/admin/cvs/edit.pl:126 ../vhffs-panel/admin/mail/edit.pl:158 msgid "Waiting for creation" msgstr "" -#: ../vhffs-panel/mailinglist/prefs.pl:144 ../vhffs-panel/admin/dns/list.pl:84 -#: ../vhffs-panel/admin/pgsql/list.pl:86 ../vhffs-panel/admin/mysql/list.pl:86 -#: ../vhffs-panel/admin/object/list.pl:81 +#: ../vhffs-panel/mailinglist/prefs.pl:179 msgid "Waiting for delete" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:360 -#: ../vhffs-panel/admin/mail/edit.pl:133 ../vhffs-panel/admin/pgsql/edit.pl:92 -#: ../vhffs-panel/admin/cvs/edit.pl:101 ../vhffs-panel/admin/group/edit.pl:94 -#: ../vhffs-panel/admin/mysql/edit.pl:92 -#: ../vhffs-panel/admin/object/edit.pl:92 ../vhffs-panel/admin/web/edit.pl:105 -#: ../vhffs-panel/admin/user/edit.pl:116 +#: ../vhffs-panel/admin/user/edit.pl:147 +#: ../vhffs-panel/admin/pgsql/edit.pl:123 +#: ../vhffs-panel/admin/group/edit.pl:123 +#: ../vhffs-panel/admin/repository/edit.pl:123 +#: ../vhffs-panel/admin/object/edit.pl:123 +#: ../vhffs-panel/admin/web/edit.pl:136 ../vhffs-panel/admin/mysql/edit.pl:124 +#: ../vhffs-panel/admin/cvs/edit.pl:132 ../vhffs-panel/admin/mail/edit.pl:164 msgid "Waiting for modification" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:328 -#: ../vhffs-panel/admin/mail/edit.pl:125 ../vhffs-panel/admin/dns/list.pl:88 -#: ../vhffs-panel/admin/pgsql/edit.pl:84 ../vhffs-panel/admin/pgsql/list.pl:90 -#: ../vhffs-panel/admin/cvs/edit.pl:93 ../vhffs-panel/admin/group/edit.pl:86 -#: ../vhffs-panel/admin/mysql/edit.pl:84 ../vhffs-panel/admin/mysql/list.pl:90 -#: ../vhffs-panel/admin/object/edit.pl:84 -#: ../vhffs-panel/admin/object/list.pl:85 ../vhffs-panel/admin/web/edit.pl:97 -#: ../vhffs-panel/admin/user/edit.pl:108 +#: ../vhffs-panel/admin/user/edit.pl:139 +#: ../vhffs-panel/admin/pgsql/edit.pl:115 +#: ../vhffs-panel/admin/group/edit.pl:115 +#: ../vhffs-panel/admin/repository/edit.pl:115 +#: ../vhffs-panel/admin/object/edit.pl:115 +#: ../vhffs-panel/admin/web/edit.pl:128 ../vhffs-panel/admin/mysql/edit.pl:116 +#: ../vhffs-panel/admin/cvs/edit.pl:124 ../vhffs-panel/admin/mail/edit.pl:156 msgid "Waiting for validation" msgstr "" -#: ../vhffs-panel/alert.pl:36 +#: ../vhffs-panel/alert.pl:67 msgid "Warn the admin team" msgstr "" -#: ../vhffs-panel/user/prefs.pl:139 +#: ../vhffs-panel/user/prefs.pl:176 #, perl-format msgid "We offer you the possibility to have one email box on the domain %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:88 +#: ../vhffs-api/src/Vhffs/Panel/Admin.pm:117 msgid "Web Admin" msgstr "" -#: ../vhffs-panel/web/prefs.pl:62 +#: ../vhffs-panel/web/prefs.pl:93 msgid "Web Area Administration" msgstr "" -#: ../vhffs-panel/admin/moderation.pl:100 +#: ../vhffs-panel/admin/moderation.pl:131 msgid "Web Area awaiting validation" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Web.pm:106 +#: ../vhffs-api/src/Vhffs/Panel/Web.pm:137 msgid "Web Areas" msgstr "" -#: ../vhffs-panel/web/web_submit.pl:57 +#: ../vhffs-panel/web/web_submit.pl:86 msgid "Web area successfully created !" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:273 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:349 msgid "Webarea for this group" msgstr "" -#: ../vhffs-panel/public/group.pl:90 +#: ../vhffs-panel/public/group.pl:122 msgid "Website for this group" msgstr "" -#: ../vhffs-panel/public/index.pl:45 +#: ../vhffs-panel/public/index.pl:74 msgid "Websites area" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:235 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:313 msgid "Welcome" msgstr "" -#: ../vhffs-panel/auth.pl:29 +#: ../vhffs-panel/auth.pl:55 #, perl-format msgid "Welcome on %s" msgstr "" -#: ../vhffs-panel/mailinglist/delete.pl:79 +#: ../vhffs-panel/mailinglist/delete.pl:106 msgid "Will be DELETED in a few minutes" msgstr "" -#: ../vhffs-api/src/Vhffs/Functions.pm:372 -#: ../vhffs-panel/admin/mail/edit.pl:136 ../vhffs-panel/admin/pgsql/edit.pl:95 -#: ../vhffs-panel/admin/cvs/edit.pl:104 ../vhffs-panel/admin/group/edit.pl:97 -#: ../vhffs-panel/admin/mysql/edit.pl:95 -#: ../vhffs-panel/admin/object/edit.pl:95 ../vhffs-panel/admin/web/edit.pl:108 -#: ../vhffs-panel/admin/user/edit.pl:119 +#: ../vhffs-panel/admin/user/edit.pl:150 +#: ../vhffs-panel/admin/pgsql/edit.pl:126 +#: ../vhffs-panel/admin/group/edit.pl:126 +#: ../vhffs-panel/admin/repository/edit.pl:126 +#: ../vhffs-panel/admin/object/edit.pl:126 +#: ../vhffs-panel/admin/web/edit.pl:139 ../vhffs-panel/admin/mysql/edit.pl:127 +#: ../vhffs-panel/admin/cvs/edit.pl:135 ../vhffs-panel/admin/mail/edit.pl:167 msgid "Will be deleted" msgstr "" -#: ../vhffs-panel/auth.pl:49 +#: ../vhffs-panel/auth.pl:74 #, perl-format msgid "Woah, %s users and %s groups already trust %s" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:108 ../vhffs-panel/cvs/prefs.pl:72 -#: ../vhffs-panel/svn/prefs.pl:89 ../vhffs-panel/web/prefs.pl:84 -#: ../vhffs-panel/admin/cvs/edit.pl:74 ../vhffs-panel/admin/cvs/show.pl:73 +#: ../vhffs-panel/svn/prefs.pl:119 ../vhffs-panel/dns/prefs.pl:139 +#: ../vhffs-panel/admin/cvs/edit.pl:105 ../vhffs-panel/admin/cvs/show.pl:104 +#: ../vhffs-panel/web/prefs.pl:115 ../vhffs-panel/cvs/prefs.pl:103 msgid "Yes" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:101 ../vhffs-panel/cvs/prefs.pl:78 -#: ../vhffs-panel/group/prefs.pl:69 ../vhffs-panel/svn/prefs.pl:95 -#: ../vhffs-panel/mailinglist/prefs.pl:168 ../vhffs-panel/web/prefs.pl:98 -#: ../vhffs-panel/mail/prefs.pl:102 ../vhffs-panel/pgsql/prefs.pl:79 -#: ../vhffs-panel/largefile/prefs.pl:102 ../vhffs-panel/mysql/prefs.pl:86 -#: ../vhffs-panel/user/prefs.pl:75 +#: ../vhffs-panel/mailinglist/prefs.pl:203 ../vhffs-panel/svn/prefs.pl:125 +#: ../vhffs-panel/user/prefs.pl:104 ../vhffs-panel/dns/prefs.pl:132 +#: ../vhffs-panel/pgsql/prefs.pl:110 ../vhffs-panel/group/prefs.pl:100 +#: ../vhffs-panel/repository/prefs.pl:105 ../vhffs-panel/web/prefs.pl:129 +#: ../vhffs-panel/mysql/prefs.pl:117 ../vhffs-panel/cvs/prefs.pl:109 +#: ../vhffs-panel/mail/prefs.pl:133 msgid "Yes I'm sure of what I do" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:185 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:215 msgid "You are not a subscriber on this list.\n" msgstr "" -#: ../vhffs-panel/admin/mailing/search.pl:39 -#: ../vhffs-panel/admin/mailing/list.pl:41 -#: ../vhffs-panel/admin/mailing/mailing_submit.pl:43 -#: ../vhffs-panel/admin/mail/search.pl:40 ../vhffs-panel/admin/mail/edit.pl:44 -#: ../vhffs-panel/admin/mail/list.pl:40 ../vhffs-panel/admin/mail/show.pl:44 -#: ../vhffs-panel/admin/dns/search.pl:40 ../vhffs-panel/admin/dns/list.pl:40 -#: ../vhffs-panel/admin/pgsql/search.pl:40 -#: ../vhffs-panel/admin/pgsql/edit.pl:42 -#: ../vhffs-panel/admin/pgsql/edit_submit.pl:42 -#: ../vhffs-panel/admin/pgsql/list.pl:40 ../vhffs-panel/admin/pgsql/show.pl:42 -#: ../vhffs-panel/admin/largefile/search.pl:40 -#: ../vhffs-panel/admin/largefile/list.pl:37 -#: ../vhffs-panel/admin/cvs/search.pl:39 ../vhffs-panel/admin/cvs/edit.pl:42 -#: ../vhffs-panel/admin/cvs/edit_submit.pl:44 -#: ../vhffs-panel/admin/cvs/list.pl:40 ../vhffs-panel/admin/cvs/show.pl:42 -#: ../vhffs-panel/admin/group/search.pl:40 -#: ../vhffs-panel/admin/group/edit.pl:42 -#: ../vhffs-panel/admin/group/edit_submit.pl:47 -#: ../vhffs-panel/admin/group/list.pl:40 ../vhffs-panel/admin/group/show.pl:42 -#: ../vhffs-panel/admin/mysql/search.pl:40 -#: ../vhffs-panel/admin/mysql/edit.pl:42 -#: ../vhffs-panel/admin/mysql/edit_submit.pl:42 -#: ../vhffs-panel/admin/mysql/list.pl:40 ../vhffs-panel/admin/mysql/show.pl:41 -#: ../vhffs-panel/admin/object/search.pl:39 -#: ../vhffs-panel/admin/object/edit.pl:42 -#: ../vhffs-panel/admin/object/edit_submit.pl:42 -#: ../vhffs-panel/admin/object/list.pl:39 -#: ../vhffs-panel/admin/object/delete_avatar.pl:46 -#: ../vhffs-panel/admin/svn/search.pl:41 ../vhffs-panel/admin/svn/list.pl:39 -#: ../vhffs-panel/admin/web/search.pl:40 ../vhffs-panel/admin/web/edit.pl:42 -#: ../vhffs-panel/admin/web/edit_submit.pl:42 -#: ../vhffs-panel/admin/web/list.pl:40 ../vhffs-panel/admin/web/show.pl:42 -#: ../vhffs-panel/admin/user/search.pl:40 ../vhffs-panel/admin/user/edit.pl:42 -#: ../vhffs-panel/admin/user/edit_submit.pl:54 -#: ../vhffs-panel/admin/user/edit_note.pl:44 -#: ../vhffs-panel/admin/user/list.pl:40 ../vhffs-panel/admin/user/show.pl:44 -#: ../vhffs-panel/admin/su.pl:38 ../vhffs-panel/admin/broadcast_view.pl:41 -#: ../vhffs-panel/admin/broadcast_list.pl:39 ../vhffs-panel/admin/stats.pl:50 -#: ../vhffs-panel/admin/broadcast.pl:38 +#: ../vhffs-panel/admin/svn/search.pl:72 ../vhffs-panel/admin/svn/list.pl:61 +#: ../vhffs-panel/admin/broadcast.pl:69 +#: ../vhffs-panel/admin/mailing/mailing_submit.pl:74 +#: ../vhffs-panel/admin/mailing/search.pl:70 +#: ../vhffs-panel/admin/mailing/list.pl:70 ../vhffs-panel/admin/stats.pl:81 +#: ../vhffs-panel/admin/user/edit_submit.pl:85 +#: ../vhffs-panel/admin/user/edit.pl:73 ../vhffs-panel/admin/user/show.pl:75 +#: ../vhffs-panel/admin/user/edit_note.pl:75 +#: ../vhffs-panel/admin/user/search.pl:71 ../vhffs-panel/admin/user/list.pl:63 +#: ../vhffs-panel/admin/dns/search.pl:71 ../vhffs-panel/admin/dns/list.pl:71 +#: ../vhffs-panel/admin/pgsql/edit_submit.pl:73 +#: ../vhffs-panel/admin/pgsql/edit.pl:73 ../vhffs-panel/admin/pgsql/show.pl:73 +#: ../vhffs-panel/admin/pgsql/search.pl:71 +#: ../vhffs-panel/admin/pgsql/list.pl:71 +#: ../vhffs-panel/admin/group/edit_submit.pl:77 +#: ../vhffs-panel/admin/group/edit.pl:71 ../vhffs-panel/admin/group/show.pl:72 +#: ../vhffs-panel/admin/group/search.pl:71 +#: ../vhffs-panel/admin/group/list.pl:72 +#: ../vhffs-panel/admin/broadcast_list.pl:70 +#: ../vhffs-panel/admin/repository/edit_submit.pl:75 +#: ../vhffs-panel/admin/repository/edit.pl:73 +#: ../vhffs-panel/admin/repository/show.pl:73 +#: ../vhffs-panel/admin/repository/search.pl:70 +#: ../vhffs-panel/admin/repository/list.pl:72 ../vhffs-panel/admin/su.pl:69 +#: ../vhffs-panel/admin/object/edit_submit.pl:73 +#: ../vhffs-panel/admin/object/delete_avatar.pl:77 +#: ../vhffs-panel/admin/object/edit.pl:73 +#: ../vhffs-panel/admin/object/search.pl:70 +#: ../vhffs-panel/admin/object/list.pl:71 +#: ../vhffs-panel/admin/broadcast_view.pl:72 +#: ../vhffs-panel/admin/web/edit_submit.pl:73 +#: ../vhffs-panel/admin/web/edit.pl:73 ../vhffs-panel/admin/web/show.pl:73 +#: ../vhffs-panel/admin/web/search.pl:71 ../vhffs-panel/admin/web/list.pl:62 +#: ../vhffs-panel/admin/mysql/edit_submit.pl:72 +#: ../vhffs-panel/admin/mysql/edit.pl:73 ../vhffs-panel/admin/mysql/show.pl:72 +#: ../vhffs-panel/admin/mysql/search.pl:71 +#: ../vhffs-panel/admin/mysql/list.pl:72 +#: ../vhffs-panel/admin/cvs/edit_submit.pl:75 +#: ../vhffs-panel/admin/cvs/edit.pl:73 ../vhffs-panel/admin/cvs/show.pl:73 +#: ../vhffs-panel/admin/cvs/search.pl:70 ../vhffs-panel/admin/cvs/list.pl:73 +#: ../vhffs-panel/admin/mail/edit.pl:75 ../vhffs-panel/admin/mail/show.pl:75 +#: ../vhffs-panel/admin/mail/search.pl:71 ../vhffs-panel/admin/mail/list.pl:71 msgid "You are not allowed to see it" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:91 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:121 #, perl-format msgid "You ask to be subscribed to the following list: %s\n" msgstr "" -#: ../vhffs-panel/dns/prefs.pl:93 ../vhffs-panel/web/prefs.pl:92 -#: ../vhffs-panel/mail/prefs.pl:107 +#: ../vhffs-panel/dns/prefs.pl:124 ../vhffs-panel/web/prefs.pl:123 +#: ../vhffs-panel/mail/prefs.pl:138 msgid "" "You can Manage rights on this service for each user in the VHFFS database. " "Please read help before manage it." msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:20 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:50 msgid "You can also send a command list in the mail body.\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:124 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:154 msgid "You can have some help on listengine, sending an email to\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:122 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:152 msgid "You can post on the list now." msgstr "" -#: ../vhffs-panel/subscribe.pl:26 ../vhffs-panel/subscribe_complete.pl:59 +#: ../vhffs-panel/subscribe.pl:80 msgid "You cannot subscribe to VHFFS" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:184 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:214 #, perl-format msgid "You cannot unsubscribe from the list %s\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:169 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:199 msgid "You demand was refused\n" msgstr "" -#: ../vhffs-panel/mailinglist/submit.pl:69 +#: ../vhffs-panel/mailinglist/submit.pl:100 msgid "You don't own this domain" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:65 -msgid "You have 24H to put your file on the FTP server. After\n" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:138 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:168 #, perl-format msgid "You have been successfully removed from the list %s\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:214 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:244 #, perl-format msgid "You have been successfully removed from the list %s.\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:120 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:150 #, perl-format msgid "You have been successfully subscribed to the list %s\n" msgstr "" -#: ../vhffs-panel/logout.pl:30 +#: ../vhffs-panel/logout.pl:59 msgid "You left your VHFFS session!" msgstr "" -#: ../vhffs-panel/lost.pl:24 +#: ../vhffs-panel/lost.pl:52 msgid "You lost your password? You're a bad guy!" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:134 +#: ../vhffs-panel/user/prefs_save.pl:170 msgid "You must choose a method for your mail" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:74 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:104 msgid "You must confirm this request by seding a email\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:56 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:86 msgid "You must confirm your request by sending a confirmation emailn\n" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:128 +#: ../vhffs-panel/subscribe.pl:121 msgid "You must declare a valid mail address" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:93 +#: ../vhffs-panel/subscribe.pl:101 msgid "You must declare your city" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:86 +#: ../vhffs-panel/subscribe.pl:97 msgid "You must declare your country" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:107 +#: ../vhffs-panel/subscribe.pl:109 msgid "You must declare your firstname" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:114 +#: ../vhffs-panel/subscribe.pl:113 msgid "You must declare your lastname" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:121 +#: ../vhffs-panel/subscribe.pl:117 msgid "You must declare your mail address" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:72 +#: ../vhffs-panel/subscribe.pl:89 msgid "You must declare your username" msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:100 +#: ../vhffs-panel/subscribe.pl:105 msgid "You must declare your zipcode" msgstr "" -#: ../vhffs-panel/mailinglist/create.pl:50 +#: ../vhffs-panel/mailinglist/create.pl:81 msgid "You need to manage at least a domain to host a mailing-list" msgstr "" -#: ../vhffs-api/src/Vhffs/Panel/Main.pm:154 +#: ../vhffs-api/src/Vhffs/Panel/Main.pm:239 msgid "You're are not allowed to browse panel" msgstr "" -#: ../vhffs-panel/dns/delete_cname.pl:58 ../vhffs-panel/dns/delete_cname.pl:62 -#: ../vhffs-panel/dns/delete_mx.pl:58 ../vhffs-panel/dns/delete_mx.pl:62 -#: ../vhffs-panel/dns/add_ns.pl:58 ../vhffs-panel/dns/add_ns.pl:62 -#: ../vhffs-panel/dns/prefs.pl:61 ../vhffs-panel/dns/add_cname.pl:59 -#: ../vhffs-panel/dns/add_cname.pl:63 ../vhffs-panel/dns/add_a.pl:60 -#: ../vhffs-panel/dns/add_a.pl:64 ../vhffs-panel/dns/modif_cname.pl:59 -#: ../vhffs-panel/dns/modif_cname.pl:63 ../vhffs-panel/dns/add_mx.pl:59 -#: ../vhffs-panel/dns/add_mx.pl:63 ../vhffs-panel/dns/modif_a.pl:59 -#: ../vhffs-panel/dns/modif_a.pl:63 ../vhffs-panel/dns/modif_mx.pl:59 -#: ../vhffs-panel/dns/modif_mx.pl:63 ../vhffs-panel/dns/delete_ns.pl:57 -#: ../vhffs-panel/dns/delete_ns.pl:61 ../vhffs-panel/dns/delete_a.pl:59 -#: ../vhffs-panel/dns/delete_a.pl:63 ../vhffs-panel/dns/delete.pl:58 -#: ../vhffs-panel/dns/delete.pl:62 ../vhffs-panel/cvs/prefs_save.pl:51 -#: ../vhffs-panel/cvs/prefs.pl:55 ../vhffs-panel/cvs/delete.pl:51 -#: ../vhffs-panel/group/join_group.pl:47 ../vhffs-panel/group/prefs.pl:49 -#: ../vhffs-panel/group/remove_user_from_group.pl:44 -#: ../vhffs-panel/group/prefs_save.pl:52 ../vhffs-panel/group/delete.pl:39 -#: ../vhffs-panel/svn/prefs_save.pl:51 ../vhffs-panel/svn/prefs.pl:70 -#: ../vhffs-panel/svn/delete.pl:50 -#: ../vhffs-panel/mailinglist/save_options.pl:69 -#: ../vhffs-panel/mailinglist/del_member.pl:64 -#: ../vhffs-panel/mailinglist/prefs.pl:69 -#: ../vhffs-panel/mailinglist/add_sub.pl:64 -#: ../vhffs-panel/mailinglist/change_right.pl:66 -#: ../vhffs-panel/mailinglist/delete.pl:63 ../vhffs-panel/web/prefs_save.pl:55 -#: ../vhffs-panel/web/prefs.pl:55 ../vhffs-panel/web/delete.pl:52 -#: ../vhffs-panel/mail/change_forward.pl:72 -#: ../vhffs-panel/mail/save_catchall.pl:54 ../vhffs-panel/mail/spambox.pl:72 -#: ../vhffs-panel/mail/spamvirus.pl:72 ../vhffs-panel/mail/delete_box.pl:69 -#: ../vhffs-panel/mail/password_box.pl:72 -#: ../vhffs-panel/mail/add_forward.pl:58 ../vhffs-panel/mail/prefs.pl:60 -#: ../vhffs-panel/mail/delete.pl:55 ../vhffs-panel/mail/add_account.pl:64 -#: ../vhffs-panel/pgsql/prefs_save.pl:54 ../vhffs-panel/pgsql/prefs.pl:47 -#: ../vhffs-panel/pgsql/delete.pl:46 -#: ../vhffs-panel/admin/mail/change_forward.pl:73 -#: ../vhffs-panel/admin/mail/delete_box.pl:72 -#: ../vhffs-panel/admin/mail/password_box.pl:73 -#: ../vhffs-panel/admin/moderation_submit.pl:47 -#: ../vhffs-panel/admin/broadcast_delete.pl:47 -#: ../vhffs-panel/admin/broadcast_submit.pl:47 -#: ../vhffs-panel/admin/moderation.pl:45 ../vhffs-panel/largefile/delete.pl:49 -#: ../vhffs-panel/largefile/prefs.pl:71 ../vhffs-panel/mysql/prefs_save.pl:56 -#: ../vhffs-panel/mysql/prefs.pl:53 ../vhffs-panel/mysql/delete.pl:49 +#: ../vhffs-panel/mailinglist/delete.pl:90 +#: ../vhffs-panel/mailinglist/save_sig.pl:89 +#: ../vhffs-panel/mailinglist/add_sub.pl:91 +#: ../vhffs-panel/mailinglist/prefs.pl:100 +#: ../vhffs-panel/mailinglist/save_options.pl:96 +#: ../vhffs-panel/mailinglist/change_right.pl:93 +#: ../vhffs-panel/mailinglist/del_member.pl:91 ../vhffs-panel/svn/delete.pl:81 +#: ../vhffs-panel/svn/prefs.pl:100 ../vhffs-panel/svn/prefs_save.pl:82 +#: ../vhffs-panel/dns/delete.pl:89 ../vhffs-panel/dns/delete.pl:93 +#: ../vhffs-panel/dns/add_mx.pl:88 ../vhffs-panel/dns/add_mx.pl:92 +#: ../vhffs-panel/dns/prefs.pl:92 ../vhffs-panel/dns/modif_a.pl:88 +#: ../vhffs-panel/dns/modif_a.pl:92 ../vhffs-panel/dns/add_ns.pl:86 +#: ../vhffs-panel/dns/add_ns.pl:90 ../vhffs-panel/dns/add_cname.pl:90 +#: ../vhffs-panel/dns/add_cname.pl:94 ../vhffs-panel/dns/delete_a.pl:60 +#: ../vhffs-panel/dns/delete_a.pl:64 ../vhffs-panel/dns/delete_ns.pl:88 +#: ../vhffs-panel/dns/delete_ns.pl:92 ../vhffs-panel/dns/delete_mx.pl:89 +#: ../vhffs-panel/dns/delete_mx.pl:93 ../vhffs-panel/dns/modif_cname.pl:91 +#: ../vhffs-panel/dns/modif_cname.pl:95 ../vhffs-panel/dns/modif_mx.pl:91 +#: ../vhffs-panel/dns/modif_mx.pl:95 ../vhffs-panel/dns/add_a.pl:92 +#: ../vhffs-panel/dns/add_a.pl:96 ../vhffs-panel/dns/delete_cname.pl:87 +#: ../vhffs-panel/dns/delete_cname.pl:91 ../vhffs-panel/pgsql/delete.pl:77 +#: ../vhffs-panel/pgsql/prefs.pl:78 ../vhffs-panel/pgsql/prefs_save.pl:85 +#: ../vhffs-panel/group/delete.pl:70 +#: ../vhffs-panel/group/remove_user_from_group.pl:75 +#: ../vhffs-panel/group/prefs.pl:80 ../vhffs-panel/group/join_group.pl:74 +#: ../vhffs-panel/group/prefs_save.pl:78 +#: ../vhffs-panel/repository/delete.pl:82 +#: ../vhffs-panel/repository/prefs.pl:83 +#: ../vhffs-panel/repository/prefs_save.pl:82 +#: ../vhffs-panel/admin/moderation_submit.pl:78 +#: ../vhffs-panel/admin/moderation.pl:76 +#: ../vhffs-panel/admin/broadcast_submit.pl:78 +#: ../vhffs-panel/admin/broadcast_delete.pl:78 +#: ../vhffs-panel/admin/mail/delete_box.pl:95 +#: ../vhffs-panel/admin/mail/password_box.pl:96 +#: ../vhffs-panel/admin/mail/change_forward.pl:96 +#: ../vhffs-panel/web/delete.pl:83 ../vhffs-panel/web/prefs.pl:86 +#: ../vhffs-panel/web/prefs_save.pl:86 ../vhffs-panel/mysql/delete.pl:80 +#: ../vhffs-panel/mysql/prefs.pl:84 ../vhffs-panel/mysql/prefs_save.pl:87 +#: ../vhffs-panel/cvs/delete.pl:82 ../vhffs-panel/cvs/prefs.pl:86 +#: ../vhffs-panel/cvs/prefs_save.pl:81 ../vhffs-panel/mail/delete.pl:86 +#: ../vhffs-panel/mail/delete_box.pl:92 ../vhffs-panel/mail/add_account.pl:95 +#: ../vhffs-panel/mail/prefs.pl:91 ../vhffs-panel/mail/save_catchall.pl:85 +#: ../vhffs-panel/mail/password_box.pl:95 +#: ../vhffs-panel/mail/add_forward.pl:88 +#: ../vhffs-panel/mail/change_forward.pl:95 +#: ../vhffs-panel/mail/spamvirus.pl:95 ../vhffs-panel/mail/spambox.pl:95 msgid "You're not allowed to do this (ACL rights)" msgstr "" -#: ../vhffs-panel/mail/delete_forward.pl:63 -#: ../vhffs-panel/admin/mail/delete_forward.pl:72 +#: ../vhffs-panel/admin/mail/delete_forward.pl:96 +#: ../vhffs-panel/mail/delete_forward.pl:89 msgid "You're not allowed to do this (ACL rights) " msgstr "" -#: ../vhffs-panel/acl/add_acl_user.pl:69 ../vhffs-panel/acl/view.pl:109 -#: ../vhffs-panel/acl/add_acl_group.pl:69 ../vhffs-panel/acl/submit.pl:68 -#: ../vhffs-panel/history.pl:67 +#: ../vhffs-panel/history.pl:98 ../vhffs-panel/acl/view.pl:141 +#: ../vhffs-panel/acl/submit.pl:95 ../vhffs-panel/acl/add_acl_group.pl:96 +#: ../vhffs-panel/acl/add_acl_user.pl:96 msgid "You're not allowed to view this object's ACL" msgstr "" -#: ../vhffs-panel/panel.pl:61 +#: ../vhffs-panel/panel.pl:89 msgid "You're not an administrator" msgstr "" -#: ../vhffs-robots/src/refused_cvs.pl:53 +#: ../vhffs-robots/src/refused_cvs.pl:79 msgid "Your CVS repository request" msgstr "" -#: ../vhffs-robots/src/refused_cvs.pl:41 +#: ../vhffs-robots/src/refused_cvs.pl:68 #, perl-format msgid "Your CVS request : %s " msgstr "" -#: ../vhffs-robots/src/refused_dns.pl:52 +#: ../vhffs-robots/src/refused_dns.pl:82 msgid "Your DNS hosting request" msgstr "" -#: ../vhffs-robots/src/refused_dns.pl:40 +#: ../vhffs-robots/src/refused_dns.pl:70 #, perl-format msgid "Your DNS hosting request for the domain : %s " msgstr "" -#: ../vhffs-robots/src/refused_groups.pl:52 +#: ../vhffs-robots/src/refused_repository.pl:83 +msgid "Your Download repository request" +msgstr "" + +#: ../vhffs-robots/src/refused_repository.pl:71 +#, perl-format +msgid "Your Download repository request : %s " +msgstr "" + +#: ../vhffs-robots/src/refused_groups.pl:78 msgid "Your Group request" msgstr "" -#: ../vhffs-robots/src/refused_groups.pl:40 +#: ../vhffs-robots/src/refused_groups.pl:67 #, perl-format msgid "Your Group request : %s " msgstr "" -#: ../vhffs-robots/src/refused_web.pl:52 -#: ../vhffs-robots/src/refused_mail.pl:52 +#: ../vhffs-robots/src/refused_mail.pl:82 msgid "Your Mail hosting request" msgstr "" -#: ../vhffs-robots/src/refused_mail.pl:40 +#: ../vhffs-robots/src/refused_mail.pl:70 #, perl-format msgid "Your Mail hosting request for the domain: %s " msgstr "" -#: ../vhffs-robots/src/refused_ml.pl:51 +#: ../vhffs-robots/src/refused_ml.pl:79 msgid "Your Mailing-list request" msgstr "" -#: ../vhffs-robots/src/refused_ml.pl:40 +#: ../vhffs-robots/src/refused_ml.pl:68 #, perl-format msgid "Your Mailing-list request : %s " msgstr "" -#: ../vhffs-robots/src/refused_mysql.pl:52 +#: ../vhffs-robots/src/refused_mysql.pl:53 msgid "Your MySQL database request" msgstr "" -#: ../vhffs-robots/src/refused_mysql.pl:40 +#: ../vhffs-robots/src/refused_mysql.pl:41 #, perl-format msgid "Your MySQL database request : %s " msgstr "" -#: ../vhffs-robots/src/refused_postgres.pl:52 +#: ../vhffs-robots/src/refused_postgres.pl:83 msgid "Your PostgreSQL database request" msgstr "" -#: ../vhffs-robots/src/refused_postgres.pl:40 +#: ../vhffs-robots/src/refused_postgres.pl:71 #, perl-format msgid "Your PostgreSQL database request : %s " msgstr "" -#: ../vhffs-robots/src/refused_svn.pl:52 +#: ../vhffs-robots/src/refused_svn.pl:49 msgid "Your Subversion repository request" msgstr "" -#: ../vhffs-robots/src/refused_svn.pl:40 +#: ../vhffs-robots/src/refused_svn.pl:38 #, perl-format msgid "Your Subversion repository request : %s" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:52 -msgid "Your file hosting request" +#: ../vhffs-robots/src/refused_web.pl:78 +msgid "Your hosting request" msgstr "" -#: ../vhffs-panel/alert.pl:39 +#: ../vhffs-panel/alert.pl:70 msgid "Your message" msgstr "" -#: ../vhffs-panel/pgsql/prefs_save.pl:58 +#: ../vhffs-panel/pgsql/prefs_save.pl:89 msgid "Your password is not correct. Please check it." msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:60 -#, perl-format -msgid "Your request for hosting the file %s was accepted.\n" +#: ../vhffs-panel/cvs/cvs_submit.pl:80 +msgid "" +"Your repository name is not correct. It must contains at least 3 caracters" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:40 -#, perl-format -msgid "Your request for hosting the file: %s" +#: ../vhffs-panel/cvs/cvs_submit.pl:76 +msgid "" +"Your repository name is not correct. It must contains only caracter and " +"numbers" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:107 +#: ../vhffs-panel/admin/moderation_submit.pl:101 ../vhffs-irc/modobot.pl:393 +msgid "Your request for a " +msgstr "" + +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:137 msgid "Your request has been removed.\n" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:68 +#: ../vhffs-irc/modobot.pl:404 #, perl-format -msgid "Your request on %s for hosting file" +msgid "Your request on %s" msgstr "" -#: ../vhffs-irc/modobot.pl:372 ../vhffs-panel/admin/moderation_submit.pl:80 +#: ../vhffs-panel/admin/moderation_submit.pl:111 msgid "Your request on VHFFS platform" msgstr "" -#: ../vhffs-irc/modobot.pl:367 ../vhffs-panel/admin/moderation_submit.pl:75 -msgid "Your request on VHFFS was accepted\n" -msgstr "" - -#: ../vhffs-robots/src/refused_web.pl:40 +#: ../vhffs-robots/src/refused_web.pl:67 #, perl-format msgid "Your web hosting request for the servername : %s " msgstr "" -#: ../vhffs-panel/subscribe_complete.pl:135 +#: ../vhffs-panel/subscribe.pl:125 msgid "Your zipcode is not correct! Please enter a correct zipcode" msgstr "" -#: ../vhffs-panel/admin/user/edit.pl:75 ../vhffs-panel/admin/user/show.pl:75 -#: ../vhffs-panel/user/prefs.pl:51 ../vhffs-panel/subscribe.pl:40 +#: ../vhffs-panel/subscribe.pl:202 ../vhffs-panel/user/prefs.pl:82 +#: ../vhffs-panel/admin/user/edit.pl:106 ../vhffs-panel/admin/user/show.pl:106 msgid "Zipcode" msgstr "" -#: ../vhffs-panel/user/prefs_save.pl:64 +#: ../vhffs-panel/user/prefs_save.pl:95 msgid "Zipcode is not correct !" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:308 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:338 msgid "cannot be removed from the list\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:276 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:306 msgid "cannot be removed.\n" msgstr "" -#: ../vhffs-robots/src/refused_largefile.pl:41 -#: ../vhffs-robots/src/refused_cvs.pl:42 -#: ../vhffs-robots/src/refused_postgres.pl:41 -#: ../vhffs-robots/src/refused_web.pl:41 -#: ../vhffs-robots/src/refused_mail.pl:41 -#: ../vhffs-robots/src/refused_dns.pl:41 -#: ../vhffs-robots/src/refused_mysql.pl:41 -#: ../vhffs-robots/src/refused_svn.pl:41 ../vhffs-robots/src/refused_ml.pl:41 -#: ../vhffs-robots/src/refused_groups.pl:41 +#: ../vhffs-robots/src/refused_ml.pl:69 ../vhffs-robots/src/refused_mail.pl:71 +#: ../vhffs-robots/src/refused_postgres.pl:72 +#: ../vhffs-robots/src/refused_cvs.pl:69 ../vhffs-robots/src/refused_web.pl:68 +#: ../vhffs-robots/src/refused_mysql.pl:42 +#: ../vhffs-robots/src/refused_svn.pl:39 +#: ../vhffs-robots/src/refused_groups.pl:68 +#: ../vhffs-robots/src/refused_repository.pl:72 +#: ../vhffs-robots/src/refused_dns.pl:71 msgid "has been refused by the Moderators team" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:25 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:55 msgid "help\t\t - show this help\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:323 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:353 #, perl-format msgid "in the moderation queue of the list %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:28 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:58 msgid "lang [fr|us|es]\t - set listengine language\n" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:748 +#: ../vhffs-listengine/src/listengine.pl:759 #, perl-format msgid "listengine - list of messages to moderate for %s" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:631 -#: ../vhffs-listengine/src/listengine.pl:653 +#: ../vhffs-listengine/src/listengine.pl:642 #: ../vhffs-listengine/src/listengine.pl:664 +#: ../vhffs-listengine/src/listengine.pl:675 msgid "listengine help" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:696 #: ../vhffs-listengine/src/listengine.pl:707 -#: ../vhffs-listengine/src/listengine.pl:723 -#: ../vhffs-listengine/src/listengine.pl:735 -#: ../vhffs-listengine/src/listengine.pl:762 +#: ../vhffs-listengine/src/listengine.pl:718 +#: ../vhffs-listengine/src/listengine.pl:734 +#: ../vhffs-listengine/src/listengine.pl:746 #: ../vhffs-listengine/src/listengine.pl:773 +#: ../vhffs-listengine/src/listengine.pl:784 msgid "listengine moderation" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:681 +#: ../vhffs-listengine/src/listengine.pl:692 msgid "listengine result command" msgstr "" -#: ../vhffs-listengine/src/listengine.pl:800 +#: ../vhffs-listengine/src/listengine.pl:811 msgid "listengine: unknown command" msgstr "" -#: ../vhffs-panel/user/prefs.pl:48 ../vhffs-panel/subscribe.pl:37 +#: ../vhffs-panel/subscribe.pl:199 ../vhffs-panel/user/prefs.pl:79 msgid "mail" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:31 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:61 msgid "moderate XXXXX\t\t\t - moderate the message with message-id XXXXX\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:34 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:64 msgid "moderate list\t\t\t - give the message list for moderation\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:33 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:63 msgid "" "moderate refused XXXXX\t\t\t - refuse the message with message-id XXXXX\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:32 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:62 msgid "" "moderate validate XXXXX\t\t\t - moderate the message with message-id XXXXX\n" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:81 +#: ../vhffs-panel/admin/object/edit.pl:112 msgid "no date" msgstr "" -#: ../vhffs-panel/admin/object/edit.pl:187 ../vhffs-panel/history.pl:98 +#: ../vhffs-panel/history.pl:129 ../vhffs-panel/admin/object/edit.pl:218 msgid "no information about date" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:275 -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:307 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:305 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:337 #, perl-format msgid "present in the moderation queue for the list %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:26 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:56 msgid "subscribe\t - subscribe the shipper to the list\n" msgstr "" -#: ../vhffs-robots/src/create_largefile.pl:62 -msgid "the following login and password :\n" -msgstr "" - -#: ../vhffs-robots/src/create_largefile.pl:66 -msgid "this delay, your request will be delete\n" -msgstr "" - -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:361 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:391 #, perl-format msgid "to %s-request@%s with the following subject : \"moderate %s\" \n" msgstr "" -#: ../vhffs-listengine/src/archives/show_msg.pl:68 +#: ../vhffs-listengine/src/archives/show_msg.pl:99 #, perl-format msgid "unknown message-id t: %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:27 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:57 msgid "unsubscribe\t - unsubscribe from this list\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:39 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:69 msgid "user info user@xxxxxxxxxx\t\t - show this user's informations\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:37 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:67 msgid "user right RIGHT user@xxxxxxxxxx\t - change right for this user\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:36 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:66 msgid "" "user subscribe user@xxxxxxxxxx\t\t - register the user user@xxxxxxxxxx on " "the list\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:35 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:65 msgid "" "user unsubscribe user@xxxxxxxxxx\t - delete user user@xxxxxxxxxx from list\n" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:292 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:322 #, perl-format msgid "was removed from the moderation queue from the list %s" msgstr "" -#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:324 +#: ../vhffs-api/src/Vhffs/Listengine/Intl.pm:354 msgid "was sent on the list.\n" msgstr "" Copied: trunk/vhffs-intl/update_po.sh (from rev 555, branches/vhffs_4.1/vhffs-intl/update_po.sh) Modified: trunk/vhffs-irc/modobot.pl =================================================================== --- trunk/vhffs-irc/modobot.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-irc/modobot.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -11,6 +11,7 @@ use Locale::gettext; use Data::Dumper; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -24,10 +25,10 @@ use constant { - SERVER => "PUT YOUR IRC SERVER HERE", - PORT => "6667", - CHANNEL => "IRC CHANNEL TO JOIN", - NAME => "BOT NAME", + SERVER => "PUT YOUR IRC SERVER HERE", + PORT => "6667", + CHANNEL => "IRC CHANNEL TO JOIN WITH #", + NAME => "BOT NAME", }; @@ -87,7 +88,7 @@ map { last GR if (($_->get_oid eq $temp->get_oid) && ($_->get_groupname eq $temp->get_groupname)); } @oldgroup; if( $vhffs->get_config->use_notation == 1 ) { - irc_msg ("Groupe : " . $temp->get_oid . " " . $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."] " . $temp->get_groupname . " " . Vhffs::Functions::stripslashes($temp->get_description)); + irc_msg ("Groupe : " . $temp->get_oid . " " . $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."] " . $temp->get_groupname . " " . Vhffs::Functions::stripslashes($temp->get_description)); } else { @@ -200,7 +201,7 @@ map { last ML if (($_->get_oid eq $temp->get_oid) && ($_->get_localpart eq $temp->get_localpart)); } @oldmailing; if( $vhffs->get_config->use_notation == 1 ) { - irc_msg ("Mailing list : " . $temp->get_oid . " " . $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") [".$temp->get_user->get_lang."] " . $temp->get_group->get_groupname . " " . $temp->get_localpart . "@" . $temp->get_domain . " " . Vhffs::Functions::stripslashes($temp->get_description)); + irc_msg ("Mailing list : " . $temp->get_oid . " " . $temp->get_user->get_username . "(" . Vhffs::Note::get_note( $vhffs , $temp->get_user ) . ") " . $temp->get_group->get_groupname . " " . $temp->get_localpart . "@" . $temp->get_domain . " " . Vhffs::Functions::stripslashes($temp->get_description)); } else { @@ -368,15 +369,10 @@ $oid = shift; $status = shift; - $object = new Vhffs::Object( $vhffs , $oid , '51' ); + $object = Vhffs::Object::get_by_oid( $vhffs , $oid ); if( ! defined $object ) { - irc_msg ("Error : Object is null"); - return ( -1 ); - } - elsif( $object->fetch < 0 ) - { irc_msg ("Error : Cannot fetch object"); return ( -1 ); } @@ -390,17 +386,22 @@ if( $status == 1 ) { $object->set_status( Vhffs::Constants::WAITING_FOR_CREATION ); - my $username = Vhffs::User::get_name_by_uid( $vhffs , $object->get_owner_uid ); - my $userbis = new Vhffs::User( $vhffs , $username , '401' ); - if( $userbis->fetch > 0 ) + my $userbis = Vhffs::User::get_by_uid( $vhffs , $object->get_owner_uid ); + if( defined $userbis ) { my $mail; - $mail = gettext("Your request on VHFFS was accepted\n"); - $mail .= gettext("Please wait while we are creating your object\n"); - $mail .= gettext("Cheers,")."\n"; - $mail .= gettext("The Moderator and Admin team"); + $mail = gettext('Your request for a '); + $mail .= Vhffs::Functions::type_string_from_type_id($object->get_type); + $mail .= (' on '); + $mail .= $vhffs->get_config->get_host_name; + $mail .= gettext(" was accepted\nPlease wait while we are creating your object\n"); + $mail .= gettext("Cheers,\nThe Moderator and Admin team\n"); + $mail .= "-----\n"; + $mail .= $vhffs->get_config->get_host_name()."\n"; + $mail .= $vhffs->get_config->get_panel_url(); - my $subject = gettext("Your request on VHFFS platform"); + + my $subject = sprintf(gettext("Your request on %s"), $vhffs->get_config->get_host_name()); Vhffs::Functions::send_mail( $vhffs->get_config->get_moderator_mail , $userbis->get_mail , $subject , $mail ); if( $vhffs->get_config->use_notation == 1 ) @@ -415,9 +416,8 @@ $raison = shift; $object->set_status( Vhffs::Constants::VALIDATION_REFUSED ); $object->set_description( $raison ); - my $username = Vhffs::User::get_name_by_uid( $vhffs , $object->get_owner_uid ); - my $userbis = new Vhffs::User( $vhffs , $username , '401' ); - if( $userbis->fetch > 0 ) + my $userbis = Vhffs::User::get_by_uid( $vhffs , $object->get_owner_uid ); + if( defined $userbis ) { if( $vhffs->get_config->use_notation == 1 ) { @@ -469,34 +469,26 @@ $bot=$self; $self->join($chan); irc_msg ("--> $botname started"); + &CatchAlrm(); } # on_connect sub is_modo { - my $user = new Vhffs::User( $vhffs, shift, 401 ); - my $ret; - $ret = $user->fetch; - if ( $ret >= 0 ) - { - if( ($user->is_moderator == 1 ) || ( $user->is_admin ) == 1 ) - { - return 1; - } - } - return 0; + my $user = Vhffs::User::get_by_username( $vhffs, shift ); + return ( (defined $user) && ($user->is_moderator == 1 || $user->is_admin == 1) ); } # is_modo sub get_desc { my $name = shift; my $group; - if ((! defined ($group= new Vhffs::Group( $vhffs , $name , '401' ) ) ) || ( $group->fetch < 0 )) + if (! defined ($group= Vhffs::Group::get_by_groupname( $vhffs , $name ) ) ) { irc_msg ("$name : No such group"); } else { - irc_msg ("$name : " . Vhffs::Functions::stripslashes ($group->get_description)); + irc_msg ("$name : " . $group->get_description ); } } @@ -504,7 +496,7 @@ { my $name = shift; my $web; - if ((! defined ($web = new Vhffs::Services::Httpd( $vhffs , $name, $name ) ) ) || ( $web->fetch < 0 )) + if (! defined ($web = Vhffs::Services::Httpd::get_by_servername( $vhffs , $name))) { irc_msg ("$name : No such website"); } @@ -519,16 +511,14 @@ { my $groupname = shift; my $group; - if ((! defined ($group = new Vhffs::Group( $vhffs , $groupname,'401' ) ) ) || ( $group->fetch < 0 )) + if (! defined ($group = Vhffs::Group::get_by_groupname( $vhffs , $groupname))) { irc_msg ("$groupname : No such groupname"); } else { - my $user = new Vhffs::User($vhffs,$group->get_owner_username,401); - my $ret; - $ret = $user->fetch; - if ( $ret >= 0 ) + my $user = Vhffs::User::get_by_uid($vhffs, $group->get_owneruid); + if ( defined $user ) { irc_msg ($groupname." owned by ". $user->get_username ." (". $user->get_firstname ." ". $user->get_lastname ." [". $user->get_mail ."] )"); } @@ -542,7 +532,7 @@ { my $groupname = shift; my $group; - if ((! defined ($group= new Vhffs::Group( $vhffs , $groupname , '401' ) ) ) || ( $group->fetch < 0 )) + if (! defined ($group= Vhffs::Group::get_by_groupname( $vhffs , $groupname , '401' ))) { irc_msg ("$groupname : No such group"); } @@ -564,6 +554,18 @@ } } +sub quotacheck +{ + my $limit = shift; + my $list = Vhffs::Group::getall_quotalimit($vhffs,$limit); + my $temp; + foreach $temp ( @{$list} ) + { + irc_msg("Group ".$temp->get_groupname.": ".$temp->get_quota_used." / ".$temp->get_quota); + } +} + + sub irc_msg { my $text = shift; @@ -616,7 +618,8 @@ irc_msg("desc <group> - give the description of <group>"); irc_msg("web2group <website> - give the groupe name of <website>"); irc_msg("owner <group> - give owner information of <group>"); - irc_msg("lsgroup <group> - give the list of users of <group>"); + irc_msg("lsgroup <group> - give the list of users of <group>"); + irc_msg("quotacheck <limit> - give the list of <limit> users where quota limit nearly reach "); } elsif ($texte =~ m/^${mynick}: list$/) @@ -660,7 +663,14 @@ $groupid =~ s/^${mynick}: lsgroup //; fetch_usergroup ($groupid); } + elsif ($texte =~ m/^${mynick}: quotacheck$/) + { + my $limit = $texte; + $limit =~ s/^{mynick}: quotacheck //; + quotacheck($limit); + } + } # on_public sub on_kick { @@ -683,7 +693,5 @@ local $SIG{ALRM} = \&CatchAlrm; -alarm 5; - $irc->start; Modified: trunk/vhffs-jabber/vhffspipe.pl =================================================================== --- trunk/vhffs-jabber/vhffspipe.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-jabber/vhffspipe.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,6 +1,7 @@ #!/usr/bin/perl -w use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::User; use Vhffs::Group; @@ -40,19 +41,11 @@ $vhffs = init Vhffs::Main if ( ! defined $vhffs ); return undef if ( ! defined $vhffs ); - my $user = new Vhffs::User( $vhffs , $username , '401' ); - return undef if( ! defined $user ); + # DB connection lost ! + $vhffs->reconnect() if( !$vhffs->is_valid() ); + my $user = Vhffs::User::get_by_username( $vhffs , $username ); + return undef unless( defined $user ); - my $ret = $user->fetch; - - # connection lost to database - if( $ret == -2 ) { - undef $vhffs; - $vhffs = init Vhffs::Main; - $ret = $user->fetch if ( defined $vhffs ); - } - undef $user if( $ret < 0 ); - undef $user if( $user->have_activegroups <= 0 ); return $user; Modified: trunk/vhffs-listengine/src/archives/archives.pl =================================================================== --- trunk/vhffs-listengine/src/archives/archives.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-listengine/src/archives/archives.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use HTML::Template; use CGI; use CGI::Session; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Functions; @@ -103,7 +104,7 @@ #On obtient le domaine, le local part et on construit l'objet de la liste my( $lpart , $domain ) = split/\@/,$listname,2; -my $list = new Vhffs::Services::Mailing( $vhffs , $lpart , $domain ); +my $list = Vhffs::Services::Mailing::get_by_mladdress( $vhffs , $lpart , $domain ); my $templatedir = $vhffs->get_config->get_listengine_templatesdir; @@ -134,7 +135,7 @@ $template = new HTML::Template( filename => $templatedir."/error.tmpl"); $template->param( ERROR => gettext("Error in listname") ); } -elsif( ( ! defined $list ) || ( $list->fetch < 0 ) ) +elsif( ! defined $list ) { $template = new HTML::Template( filename => $templatedir."/error.tmpl"); $template->param( ERROR => gettext("Undefined list") ); Modified: trunk/vhffs-listengine/src/archives/show_msg.pl =================================================================== --- trunk/vhffs-listengine/src/archives/show_msg.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-listengine/src/archives/show_msg.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use HTML::Template; use CGI; use CGI::Session; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::Functions; use Vhffs::Services::Mailing; @@ -57,7 +58,7 @@ my $listname = $cgi->param("list"); my $mid = $cgi->param("mid"); my( $lpart , $domain ) = split/\@/,$listname,2; -my $list = new Vhffs::Services::Mailing( $vhffs , $lpart , $domain ); +my $list = Vhffs::Services::Mailing::get_by_mladdress( $vhffs , $lpart , $domain ); my $templatedir = $vhffs->get_config->get_listengine_templatesdir; my $theme = Vhffs::Listengine::Panel::check_theme( $cgi->cookie("theme") ); @@ -74,7 +75,7 @@ $template = new HTML::Template( filename => $templatedir."/error.tmpl"); $template->param( ERROR => gettext("Error in listname") ); } -elsif( ( ! defined $list ) || ( $list->fetch < 0 ) ) +elsif( ! defined $list ) { $template = new HTML::Template( filename => $templatedir."/error.tmpl"); $template->param( ERROR => gettext("Undefined list") ); Modified: trunk/vhffs-listengine/src/listengine.pl =================================================================== --- trunk/vhffs-listengine/src/listengine.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-listengine/src/listengine.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -37,6 +37,7 @@ use locale; use Locale::gettext; use Mail::Internet; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::Services::Mailing; use Vhffs::Listengine::Intl; @@ -59,7 +60,7 @@ my $ADMIN = $vhffs->get_config->get_listengine_listmaster; my $SMTP_SERVER = $vhffs->get_config->get_listengine_smtp; -#Be careful, listengine will create /data/listengine/archives for archives +#Be carefule, listengine will create /data/listengine/archives for archives #and /data/listengine/tomoderate for moderation my $DIRECTORY = $vhffs->get_config->get_listengine_datadir; @@ -122,19 +123,21 @@ my $mail = shift; my $list = shift; - my ( $message_id )= ($mail->get( 'Message-Id' ) =~ /<(.+)>/); + my (undef,undef,undef,$day,$month,$year) = localtime(time); + $year += 1900; + $month += 1; + $month = '0'.$month if( $month < 9 ); + $day = '0'.$day if( $day < 9 ); + my $message_id = ( $mail->get( 'Message-Id' ) =~ /<(.+)>/ ); + #Don't archive if message-id is not found return if( ( ! defined $message_id ) || ( $message_id eq "" ) ); - my $directory = $DIRECTORY . "/archives/" . $list->get_domain . "/" . $list->get_localpart; - - my ( undef, undef, undef, $day, $month, $year ) = gmtime(time); - $directory .= sprintf ('/%.4u/%.2u/%.2u', $year+1900, $month+1, $day); - + my $directory = $DIRECTORY.'/archives/'.$list->get_domain.'/'.$list->get_localpart.'/'.$year.'/'.$month.'/'.$day; Vhffs::Functions::create_dir( $directory ) if( ! -d $directory ); - my $file = $directory . "/" . $message_id; + my $file = "$directory/".$message_id; open( FILE , ">$file"); print FILE $mail->as_string; close( FILE ); @@ -158,9 +161,7 @@ my $filehash = Digest::MD5::md5_hex( $message_id ); my $file = "$directory/".$filehash; - - - + open( FILE , ">$file"); print FILE $mail->as_string; close( FILE ); @@ -175,8 +176,7 @@ $header->replace( 'From' , $LISTMASTER ); $header->replace( 'Subject' , "moderate $filehash" ); $header->replace( 'Reply-To' , $list->get_localpart ."-request"."\@".$list->get_domain); - - + $email = Mail::Internet->new( [ <> ] , Header => $header, Body => Vhffs::Listengine::Intl::moderate_message( $list , $filehash , $from , $subject ) @@ -186,76 +186,73 @@ } - sub subscribe_to_list { my $list = shift; my $from = shift; - my $hash; my $header; my $email; my $message; my @body; - if( $list->get_open_sub != 1 ) + my $sub_ctrl = $list->get_sub_ctrl; + + if( $sub_ctrl == Vhffs::Constants::ML_SUBSCRIBE_CLOSED ) { - $message ="Subscribtion are not allowed for this list"; + $message = "Subscribtion are not allowed for this list"; push @body , $message ; push @body , "\n"; $header = new Mail::Header( ); $header->replace( 'To' , $from ); $header->replace( 'From' , $LISTMASTER ); - $header->replace( 'Subject' , "subscription denied" ); + + my $subject = 'subscription denied'; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); - $email = Mail::Internet->new( [ <> ] , Header => $header , Body => Vhffs::Listengine::Intl::sub_deny( $list , $from ) ); } else - { - - if( defined ( $hash = $list->add_sub_with_reply( $from ) ) ) + { + if( defined ( my $pass = $list->add_sub_with_reply( $from ) ) ) { $header = new Mail::Header( ); $header->replace( 'To' , $from ); $header->replace( 'From' , $LISTMASTER ); - $header->replace( 'Subject' , "confirm subscribe $hash" ); + my $subject = 'confirm subscribe '.$pass; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); $header->replace( 'Reply-To' , $list->get_localpart ."-request"."\@".$list->get_domain); - $email = Mail::Internet->new( [ <> ] , Header => $header, - Body => Vhffs::Listengine::Intl::new_sub( $list , $from , $hash ) + Body => Vhffs::Listengine::Intl::new_sub( $list , $from , $pass ) ); - } else { - $header = new Mail::Header( ); $header->replace( 'To' , $from ); $header->replace( 'From' , $LISTMASTER ); - $header->replace( 'Subject' , "already subscriber for the list" ); - - + my $subject = 'You are already subscribed to this list'; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); + $email = Mail::Internet->new( [ <> ] , Header => $header, Body => Vhffs::Listengine::Intl::sub_already_exist( $list , $from ) ); - } } - sendmail( $email , $from ) if( defined $email ); - } - sub unsubscribe_to_list { my $list = shift; @@ -321,38 +318,79 @@ # Ok, hash are the same, treat the mail now if( $hash eq $subs->{$from}{'hash'} ) { - my $header = new Mail::Header( ); - $header->replace( 'To' , $from ); - $header->replace( 'From' , $LISTMASTER ); - $header->replace( 'Subject' , "Successfully subscribe" ); - $header->replace('Date' , gmtime()." +00"); - - my $email = Mail::Internet->new( [ <> ] , - Header => $header , - Body => Vhffs::Listengine::Intl::confirm_sub( $list , $from ) - ); - sendmail( $email , $from ); - - $list->change_state_for_sub( $from , Vhffs::Constants::ML_RIGHT_SUB ); - $list->clear_hash( $from ); + my $header = new Mail::Header( ); + $header->replace( 'To' , $from ); + $header->replace( 'From' , $LISTMASTER ); + my $subject = 'Successfully subscribed'; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); + $header->replace('Date' , gmtime()." +00"); + + # validation needed or not ? + if( $list->get_sub_ctrl == Vhffs::Constants::ML_SUBSCRIBE_APPROVAL_REQUIRED ) { + + my $email = Mail::Internet->new( [ <> ] , + Header => $header , + Body => Vhffs::Listengine::Intl::confirm_sub_approvalneeded( $list , $from ) + ); + + $list->change_state_for_sub( $from , Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_VALIDATION ); + $list->clear_hash( $from ); + sendmail( $email , $from ); + + my @tos; + my $members = $list->get_members; + + # send a mail to all admins + foreach ( keys %{$members} ) + { + push( @tos , $_ ) if( $members->{$_}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN ); + } + + my $header = new Mail::Header( ); + $header->replace( 'From' , $LISTMASTER ); + $header->replace( 'To' , $LISTMASTER ); + my $subject = 'approval '.$from; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); + $header->replace( 'Reply-To' , $list->get_localpart ."-request"."\@".$list->get_domain); + + $email = Mail::Internet->new( [ <> ] , + Header => $header, + Body => Vhffs::Listengine::Intl::moderate_subscriber( $list , $from ) + ); + + sendmail( $email , \@tos ) if( ( defined $email ) && ( $#tos >= 0 ) ); + } + else { + + my $email = Mail::Internet->new( [ <> ] , + Header => $header , + Body => Vhffs::Listengine::Intl::confirm_sub( $list , $from ) + ); + + $list->change_state_for_sub( $from , Vhffs::Constants::ML_RIGHT_SUB ); + $list->clear_hash( $from ); + sendmail( $email , $from ); + } } else { my $header = new Mail::Header( ); $header->replace( 'To' , $from ); $header->replace( 'From' , $LISTMASTER ); - $header->replace( 'Subject' , "Subscribing error" ); + my $subject = 'Subscribe error'; + $subject = '['.$list->get_prefix.'] '.$subject if( length( $list->get_prefix ) > 0 ); + $header->replace( 'Subject' , $subject ); $header->replace('Date' , gmtime()." +00"); my $email = Mail::Internet->new( [ <> ] , Header => $header , Body => Vhffs::Listengine::Intl::error_sub( $list , $from ) ); - sendmail( $email , $from ); - + sendmail( $email , $from ); } } - } sub confirm_unsub @@ -429,9 +467,15 @@ my $qprefix = quotemeta $prefix; unless ( $tsubject =~ /\[$qprefix\]/) { - $mail->replace( 'Subject' , "[".$prefix."]"." ".$subject ) if( length( $prefix ) > 0 ); + $mail->replace( 'Subject' , '['.$prefix.'] '.$subject ) if( length( $prefix ) > 0 ); } + # Add list's signature at the bottom of mail + if(defined(my $signature = $list->get_signature)) { + my $body = $mail->body; + push @$body, "---\n".$signature; + } + foreach ( keys %{$subs} ) { #Send mail to user if he is a confirmed subscriber @@ -445,58 +489,37 @@ sub bounce_mail { + my $mail = shift; + my $list = shift; - my $mail = shift; - my $list = shift; - - exit -1 if( ! defined $list ); - exit 0 if( $list->fetch < 0 ); + exit -1 if( ! defined $list ); - my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([a\.-zA-Z_\-0-9^\s]+)\.(\w+))/); - my $subject = $mail->get('Subject'); - my $subs = $list->get_members; + my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([a\.-zA-Z_\-0-9^\s]+)\.(\w+))/); + my $subject = $mail->get('Subject'); + my $subs = $list->get_members; - my $authorized = 0; - my $in_moderation = 0; - + # we need to know if the sender is a member, an admin, or other + my $user_class = "other"; #assume other + $user_class = "member" if( defined $subs->{$from} && $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_SUB ); + $user_class = "admin" if( defined $subs->{$from} && $subs->{$from}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN ); - if( $list->get_moderated == 1 ) - { - - $in_moderation = 1; + my $post_ctrl = $list->get_post_ctrl; - # If the list is moderated, we refuse the mail - # But if the mail is from an admin, we allow it - foreach ( keys %{$subs} ) - { - if( ( $from eq $_ ) && ( $subs->{$_}{perm} == Vhffs::Constants::ML_RIGHT_ADMIN ) ) - { - $authorized = 1; - $in_moderation = 0; - last; - } + if( $user_class eq "admin" || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_ALL ) { + sendmail_to_list( $mail , $list ); } - - } - elsif( $list->get_open_post == 1 ) - { - # If the list is not moderated, and open_post, - # we authorize the mail - $authorized = 1; - } - else - { - # In this case, The list is not in open_post - # We must check if the poster is a subscriber - foreach ( keys %{$subs} ) - { - $authorized = 1 if( ( $from eq $_ ) && ( $subs->{$_}{perm} != Vhffs::Constants::ML_RIGHT_SUB_WAITING_FOR_REPLY ) ); + elsif ( $user_class eq "member" ) { + if( $post_ctrl == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS ) { + sendmail_to_list( $mail , $list ) + } elsif ( $post_ctrl == Vhffs::Constants::ML_POSTING_MODERATED_ALL || $post_ctrl == Vhffs::Constants::ML_POSTING_MEMBERS_ONLY_MODERATED ) { + put_in_moderation( $mail , $list ); + } } - } - - - sendmail_to_list( $mail , $list ) if( $authorized == 1 ); - put_in_moderation( $mail , $list ) if( $in_moderation == 1 ); + elsif ( $user_class eq "other" ) { + if( $post_ctrl == Vhffs::Constants::ML_POSTING_MODERATED_ALL || $post_ctrl == Vhffs::Constants::ML_POSTING_OPEN_MEMBERS_MODERATED_OTHERS ) { + put_in_moderation( $mail , $list ); + } + } } @@ -621,7 +644,7 @@ my $temp; my $members = $list->get_members; - $lang = Vhffs::Services::Mailing::get_lang_for_sub( $vhffs , $from ); + $lang = Vhffs::Services::Mailing::get_language_for_sub( $vhffs , $from ); #If the user specified a lang, we change it to get internationalized messages if( defined $lang ) { @@ -652,17 +675,17 @@ } elsif( ( $lang ) = $subject =~ /^lang\s([a-zA-Z\_\-]+)$/ ) { - #Try to change the language for this subscriber on whole listengine subsystem - if( Vhffs::Services::Mailing::set_lang_for_sub( $vhffs , $from , $lang ) < 0 ) - { - $email = Mail::Internet->new( [ <> ], + #Try to change the language for this subscriber on whole listengine subsystem + unless( Vhffs::Services::Mailing::set_language_for_sub( $vhffs , $from , $lang ) ) + { + $email = Mail::Internet->new( [ <> ], Body => Vhffs::Listengine::Intl::lang_change_error( $from , $lang ) ); - $email->replace('From' , $LISTMASTER ); - $email->replace('To' , $from ); - $email->replace('Subject' , gettext("listengine help") ); - $email->replace('Date' , gmtime()." +00"); - sendmail( $email , $from ); + $email->replace('From' , $LISTMASTER ); + $email->replace('To' , $from ); + $email->replace('Subject' , gettext("listengine help") ); + $email->replace('Date' , gmtime()." +00"); + sendmail( $email , $from ); } else { @@ -894,7 +917,7 @@ my $mail = shift; my ( $from ) = ( $mail->get('From') =~ /(([\+\.a-zA-Z_\-0-9^\s]+)@([\.a-zA-Z_\-0-9^\s]+)\.(\w+))/); - my $lang = Vhffs::Services::Mailing::get_lang_for_sub( $vhffs , $from ); + my $lang = Vhffs::Services::Mailing::get_language_for_sub( $vhffs , $from ); if( defined $lang ) { #Change current locale to user preferences if defined @@ -937,8 +960,8 @@ get_lang( $mail ); #Build the list object from VHFFS -my $list = new Vhffs::Services::Mailing( $vhffs , $lpart , $domain ); -exit( 0 ) if( $list->fetch < 0 ); +my $list = Vhffs::Services::Mailing::get_by_mladdress( $vhffs , $lpart , $domain ); +exit( 0 ) if(!defined $list); verify_mail_with_list( $list , $mail ); Modified: trunk/vhffs-panel/acl/add_acl_group.pl =================================================================== --- trunk/vhffs-panel/acl/add_acl_group.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/acl/add_acl_group.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -74,8 +75,8 @@ $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); -my $obj_src = new Vhffs::Group( $vhffs , $groupname , '401' ); -my $obj_dst = new Vhffs::Object( $vhffs , $oid_dst , '401' ); +my $obj_src = Vhffs::Group::get_by_groupname( $vhffs , $groupname ); +my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst ); my $message; @@ -86,10 +87,6 @@ } elsif( ( ! defined $obj_src ) || ( ! defined $obj_dst ) ) { - $message = gettext( "Object Error" ); -} -elsif( ( $obj_src->fetch < 0 ) || ( $obj_dst->fetch < 0) ) -{ $message = gettext( "The group does not exist" ); } else Modified: trunk/vhffs-panel/acl/add_acl_user.pl =================================================================== --- trunk/vhffs-panel/acl/add_acl_user.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/acl/add_acl_user.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -74,8 +75,8 @@ $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); -my $obj_src = new Vhffs::User( $vhffs , $username , '401' ); -my $obj_dst = new Vhffs::Object( $vhffs , $oid_dst , '401' ); +my $obj_src = Vhffs::User::get_by_username( $vhffs , $username ); +my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst ); my $message; @@ -88,10 +89,6 @@ { $message = gettext( "Object Error" ); } -elsif( ( $obj_src->fetch < 0 ) || ( $obj_dst->fetch < 0) ) -{ - $message = gettext( "The user does not exist" ); -} else { if( ( Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) ) Modified: trunk/vhffs-panel/acl/submit.pl =================================================================== --- trunk/vhffs-panel/acl/submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/acl/submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -73,8 +74,8 @@ $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); -my $obj_src = new Vhffs::Object( $vhffs , $oid_src , '401' ); -my $obj_dst = new Vhffs::Object( $vhffs , $oid_dst , '401' ); +my $obj_src = Vhffs::Object::get_by_oid( $vhffs , $oid_src ); +my $obj_dst = Vhffs::Object::get_by_oid( $vhffs , $oid_dst ); my $message; @@ -87,10 +88,6 @@ { $message = gettext( "Object Error" ); } -elsif( ( $obj_src->fetch < 0 ) || ( $obj_dst->fetch < 0) ) -{ - $message = gettext( "Object Error" ); -} else { if( ( Vhffs::Acl::what_perm_for_user( $user , $obj_dst , $vhffs ) < Vhffs::Constants::ACL_MANAGEACL ) && ( $user->is_admin != 1 ) ) Modified: trunk/vhffs-panel/acl/view.pl =================================================================== --- trunk/vhffs-panel/acl/view.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/acl/view.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -75,48 +76,45 @@ #First, we instanciate an Object, according to the variable $type if( $type eq "web" ) { - $object = new Vhffs::Services::Httpd( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::Httpd::get_by_servername( $vhffs , $name ); } elsif( $type eq "dns" ) { - $object = new Vhffs::Services::DNS( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::DNS::get_by_domainname( $vhffs , $name ); } elsif( $type eq "mysql" ) { - $object = new Vhffs::Services::Mysql( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $name ); } elsif( $type eq "pgsql" ) { - $object = new Vhffs::Services::Postgres( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::Postgres::get_by_dbname( $vhffs , $name ); } elsif( $type eq "cvs" ) { - $object = new Vhffs::Services::Cvs( $vhffs , $name ); + $object = Vhffs::Services::Cvs::get_by_cvsroot( $vhffs , $name ); } elsif( $type eq "svn" ) { - $object = new Vhffs::Services::Svn( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::Svn::get_by_reponame( $vhffs , $name ); } elsif( $type eq "ns" ) { - $object = new Vhffs::Services::DNS( $vhffs , $name ); + #????? + $object = Vhffs::Services::DNS::get_by_domainname( $vhffs , $name ); } elsif( $type eq "mail" ) { - $object = new Vhffs::Services::Mail( $vhffs , $name ); + $object = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $name ); } elsif( $type eq "ml" ) { my( $lpart , $domain ) = split( /\@/ , $name ); - $object = new Vhffs::Services::Mailing( $vhffs , $lpart , $domain ); + $object = Vhffs::Services::Mailing::get_by_mladdress( $vhffs , $lpart , $domain ); } -elsif( $type eq "largefile" ) -{ - $object = new Vhffs::Services::LargeFile( $vhffs , $name , $user , $group ); -} elsif( $type eq "repository" ) { - $object = new Vhffs::Services::Repository( $vhffs , $name , $user , $group ); + $object = Vhffs::Services::Repository::get_by_reponame( $vhffs , $name ); } else { @@ -130,7 +128,7 @@ # $ok = 1 , so, ths object is instanciate if( $ok == 1 ) { - if( ( ! defined $object ) || ( $object->fetch < 0 ) ) + if( ! defined $object ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $message = sprintf( gettext("Cannot get informations on this object %s %s"), $type, $name); @@ -180,8 +178,7 @@ foreach( keys %{$user_rights} ) { - $u = new Vhffs::User( $vhffs , $user_rights->{$_}{'username'} , '401' ); - $u->fetch; + $u = Vhffs::User::get_by_username( $vhffs , $user_rights->{$_}{'username'} ); $subtemplate = new HTML::Template( filename => $templatedir."/acl/view_each.tmpl" ); $subtemplate->param( NAME => $user_rights->{$_}{'username'} ); @@ -227,8 +224,7 @@ foreach( keys %{$group_rights} ) { - $g = new Vhffs::Group( $vhffs , $group_rights->{$_}{'groupname'} , '401' ); - $g->fetch; + $g = Vhffs::Group::get_by_groupname($vhffs , $group_rights->{$_}{'groupname'} ); $subtemplate = new HTML::Template( filename => $templatedir."/acl/view_each.tmpl" ); $subtemplate->param( NAME => $group_rights->{$_}{'groupname'} ); Modified: trunk/vhffs-panel/admin/broadcast.pl =================================================================== --- trunk/vhffs-panel/admin/broadcast.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/broadcast.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/broadcast_delete.pl =================================================================== --- trunk/vhffs-panel/admin/broadcast_delete.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/broadcast_delete.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/broadcast_list.pl =================================================================== --- trunk/vhffs-panel/admin/broadcast_list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/broadcast_list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/broadcast_submit.pl =================================================================== --- trunk/vhffs-panel/admin/broadcast_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/broadcast_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/broadcast_view.pl =================================================================== --- trunk/vhffs-panel/admin/broadcast_view.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/broadcast_view.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/cvs/edit.pl =================================================================== --- trunk/vhffs-panel/admin/cvs/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/cvs/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Cvs( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Cvs::get_by_cvsroot( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/cvs/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/cvs/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/cvs/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Cvs( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Cvs::get_by_cvsroot( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = sprintf( gettext("Cannot fetch object %s"), $name ); Modified: trunk/vhffs-panel/admin/cvs/list.pl =================================================================== --- trunk/vhffs-panel/admin/cvs/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/cvs/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,13 +39,16 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; +use Vhffs::Panel::Cvs; use Vhffs::Stats; use Vhffs::Constants; + my $panel = new Vhffs::Panel::Main(); if(!$panel) { exit 0; @@ -83,40 +86,24 @@ $template->param( TITLE => gettext("List of all CVS repositories") ); } - use Vhffs::Services::Cvs; + $template->param( TEXT_TITLE1 => gettext('CVS Root') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); - my $cvs = Vhffs::Services::Cvs::getall( $vhffs , undef , $name , undef ); - my $c; - my $output = ""; - - if( defined $cvs ) - { - foreach $c ( @{$cvs} ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/cvs/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/cvs/part-modo.tmpl" ); - } - - $subtemplate->param( CVSROOT => $c->get_cvsroot ); - $subtemplate->param( GROUP => $c->get_group->get_groupname ); - $subtemplate->param( OID => $c->get_oid ); - $subtemplate->param( STATE => gettext( Vhffs::Functions::status_string_from_status_id( $c->get_status ) ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this CVS repository") ); - } else { - $subtemplate->param( SEND => gettext("Show this CVS repository") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); - } - - + my $cvs = Vhffs::Panel::Cvs::search( $vhffs, $name ); + my $subtemplate; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/cvs/part.tmpl", global_vars => 1); + $subtemplate->param( SEND => gettext("Modify this CVS repository") ); + } else { + # die_on_bad_param => 0 is required since the values provided by Vhffs::Panel::Cvs::search + # contains fields that are not used in moderator's template. + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/cvs/part-modo.tmpl", global_vars => 1); + $subtemplate->param( SEND => gettext("Show this CVS repository") ); + } + + $subtemplate->param(CVSES => $cvs); + $template->param( LIST => $subtemplate->output ); } display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/admin/cvs/search.pl =================================================================== --- trunk/vhffs-panel/admin/cvs/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/cvs/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/cvs/show.pl =================================================================== --- trunk/vhffs-panel/admin/cvs/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/cvs/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Cvs( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Cvs::get_by_cvsroot( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/dns/list.pl =================================================================== --- trunk/vhffs-panel/admin/dns/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/dns/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -83,49 +84,26 @@ $template->param( TITLE => gettext("List of all domains") ); } + $template->param( TEXT_TITLE1 => gettext('Domain Name') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); + use Vhffs::Panel::Web; - my $domains = Vhffs::Panel::DNS::getall_domains( $vhffs , $name ); + my $domains = Vhffs::Panel::DNS::search( $vhffs , $name ); if( defined $domains ) { - my $output = ""; - foreach( sort ( keys %{$domains} ) ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/dns/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/dns/part-modo.tmpl" ); - } - $subtemplate->param( DOMAIN => $domains->{$_}{'domain'} ) if( defined $domains->{$_}{'domain'} ); - $subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $domains->{$_}{'owner_gid'} ) ) if( defined $domains->{$_}{'owner_gid'} ); - - if( $domains->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION ) - { - $subtemplate->param( STATE => gettext("Waiting for creation") ); - } - elsif( $domains->{$_}{'state'} == Vhffs::Constants::ACTIVATED ) - { - $subtemplate->param( STATE => gettext("Activated") ); - } - elsif( $domains->{$_}{'state'} == Vhffs::Constants::TO_DELETE ) - { - $subtemplate->param( STATE => gettext("Waiting for delete") ); - } - elsif( $domains->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION ) - { - $subtemplate->param( STATE => gettext("Waiting for validation") ); - } - - if( $user->is_admin == 1 ) { - $subtemplate->param( OID => $domains->{$_}{'object_id'} ) if( defined $domains->{$_}{'object_id'} ); - $subtemplate->param( SEND => gettext("Modify this domain") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + my $subtemplate; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/dns/part.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Modify this domain') ); + } else { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/dns/part-modo.tmpl", die_on_bad_params => 0 ) + } + + $subtemplate->param(DNSES => $domains); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/dns/search.pl =================================================================== --- trunk/vhffs-panel/admin/dns/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/dns/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/group/edit.pl =================================================================== --- trunk/vhffs-panel/admin/group/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/group/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -55,16 +56,14 @@ my $session = $panel->{'session'}; my $maintemplate = $panel->{'template'}; my $user = $panel->{'user'}; -#my $group = $panel->{'group'}; my $projectname = $session->param("project"); my $cgi = $panel->{'cgi'}; my $groupname = $cgi->param("NAME"); my $template; +my $group; my $templatedir = $vhffs->get_config->get_templatedir; -my $object; - if( $user->is_admin != 1 ) { @@ -73,12 +72,12 @@ $template->param( MESSAGE => $message ); } elsif( ! defined $groupname ) -{ - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - my $message = sprintf( gettext("CGI ERROR ! %s"), $groupname ); - $template->param( MESSAGE => $message ); +{ + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + my $message = gettext( "CGI ERROR !"); + $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Group( $vhffs , $groupname , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $group = Vhffs::Group::get_by_groupname($vhffs, $groupname) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); @@ -101,16 +100,16 @@ $template->param( SEND => gettext("Send") ); $template->param( TEXT_HISTORY => gettext("History") ); - $template->param( VALUE_GROUPNAME => $object->get_groupname ); - $template->param( VALUE_GID => $object->get_gid ); - $template->param( VALUE_OWNER => $object->get_owner_username ); - $template->param( VALUE_QUOTA => $object->get_quota ); - $template->param( VALUE_QUOTA_USED => $object->get_quota_used ); - $template->param( VALUE_DESCRIPTION => $object->get_description ); + $template->param( VALUE_GROUPNAME => $group->get_groupname ); + $template->param( VALUE_GID => $group->get_gid ); + $template->param( VALUE_OWNER => $group->get_owner_username ); + $template->param( VALUE_QUOTA => $group->get_quota ); + $template->param( VALUE_QUOTA_USED => $group->get_quota_used ); + $template->param( VALUE_DESCRIPTION => $group->get_description ); -$template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $object->get_quota_used , $object->get_quota ) ); +$template->param( QUOTA_VALUE => sprintf( gettext("Quota (used/total) : %s/%s") , $group->get_quota_used , $group->get_quota ) ); - my $oid = $object->get_oid; + my $oid = $group->get_oid; $template->param( VALUE_HISTORY => "/history.pl?OID=$oid" ); $template->param( TEXT_STATUS_WAITING_FOR_VALIDATION => gettext("Waiting for validation") ); @@ -140,7 +139,7 @@ $template->param( VALUE_STATUS_MODIFICATION_APPLIED => Vhffs::Constants::MODIFICATION_APPLIED ); $template->param( VALUE_STATUS_TO_DELETE => Vhffs::Constants::TO_DELETE ); - my $status = $object->get_status; + my $status = $group->get_status; if( $status == Vhffs::Constants::WAITING_FOR_VALIDATION ) { Modified: trunk/vhffs-panel/admin/group/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/group/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/group/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -55,7 +56,6 @@ my $session = $panel->{'session'}; my $maintemplate = $panel->{'template'}; my $user = $panel->{'user'}; -#my $group = $panel->{'group'}; my $projectname = $session->param("project"); my $cgi = $panel->{'cgi'}; my $groupname = $cgi->param("NAME"); @@ -63,7 +63,7 @@ my $templatedir = $vhffs->get_config->get_templatedir; -my $object; +my $group; my $message; my $status = $cgi->param( "STATUS" ); my $quota = $cgi->param( "QUOTA" ); @@ -83,7 +83,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Group( $vhffs , $groupname , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $group = Vhffs::Group::get_by_groupname($vhffs, $groupname) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); @@ -100,12 +100,12 @@ $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $object->set_status( $status ); - $object->set_quota( $quota ); - $object->set_quota_used( $quotau ); + $group->set_status( $status ); + $group->set_quota( $quota ); + $group->set_quota_used( $quotau ); - if( $object->commit < 0 ) + if( $group->commit < 0 ) { $message = gettext("Can't modify object..."); } Modified: trunk/vhffs-panel/admin/group/list.pl =================================================================== --- trunk/vhffs-panel/admin/group/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/group/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,11 +39,13 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; +use Vhffs::Panel::Group; use Vhffs::Stats; use Vhffs::Constants; my $panel = new Vhffs::Panel::Main(); @@ -84,38 +86,27 @@ } - use Vhffs::Panel::Group; + $template->param( TEXT_TITLE1 => gettext('Groupname') ); + $template->param( TEXT_TITLE2 => gettext('Owner name') ); + $template->param( TEXT_TITLE3 => gettext('State') ); + - my $groups = Vhffs::Group::getall( $vhffs , undef , $name ); - my $group; + + my $groups = Vhffs::Panel::Group::search( $vhffs, $name ); if( defined $groups ) { - my $output = ""; + my $subtemplate; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/group/part.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Modify this group')); + } else { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/group/part-modo.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Show this group')); + } + - foreach $group ( @{$groups} ) - { - my $subtemplate; - - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/group/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/group/part-modo.tmpl" ); - } - - $subtemplate->param( GROUPNAME => $group->get_groupname ); - $subtemplate->param( USERNAME => $group->get_owner_username ); - - $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $group->get_status ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this group") ); - } else { - $subtemplate->param( SEND => gettext("Show this group") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + $subtemplate->param( GROUPS => $groups ); + $template->param( LIST => $subtemplate->output ); } } Modified: trunk/vhffs-panel/admin/group/search.pl =================================================================== --- trunk/vhffs-panel/admin/group/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/group/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/group/show.pl =================================================================== --- trunk/vhffs-panel/admin/group/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/group/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -55,7 +56,6 @@ my $session = $panel->{'session'}; my $maintemplate = $panel->{'template'}; my $user = $panel->{'user'}; -#my $group = $panel->{'group'}; my $projectname = $session->param("project"); my $cgi = $panel->{'cgi'}; my $groupname = $cgi->param("NAME"); @@ -63,7 +63,7 @@ my $templatedir = $vhffs->get_config->get_templatedir; -my $object; +my $group; if( ($user->is_moderator != 1 ) && ( $user->is_admin != 1 ) ) { @@ -78,7 +78,7 @@ my $message = sprintf( gettext("CGI ERROR ! %s"), $groupname ); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Group( $vhffs , $groupname , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $group = Vhffs::Group::get_by_groupname( $vhffs , $groupname ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); @@ -99,15 +99,15 @@ $template->param( TEXT_DESCRIPTION => gettext("Description") ); $template->param( TEXT_HISTORY => gettext("History") ); - $template->param( VALUE_GROUPNAME => $object->get_groupname ); - $template->param( VALUE_GID => $object->get_gid ); - $template->param( VALUE_OWNER => $object->get_owner_username ); - $template->param( VALUE_QUOTA => $object->get_quota ); - $template->param( VALUE_QUOTA_USED => $object->get_quota_used ); - $template->param( VALUE_DESCRIPTION => $object->get_description ); - $template->param( VALUE_STATUS => Vhffs::Functions::status_string_from_status_id ($object->get_status) ); + $template->param( VALUE_GROUPNAME => $group->get_groupname ); + $template->param( VALUE_GID => $group->get_gid ); + $template->param( VALUE_OWNER => $group->get_owner_username ); + $template->param( VALUE_QUOTA => $group->get_quota ); + $template->param( VALUE_QUOTA_USED => $group->get_quota_used ); + $template->param( VALUE_DESCRIPTION => $group->get_description ); + $template->param( VALUE_STATUS => Vhffs::Functions::status_string_from_status_id ($group->get_status) ); - my $oid = $object->{'object_id'}; + my $oid = $group->{'object_id'}; $template->param( VALUE_HISTORY => "/history.pl?OID=$oid" ); } Modified: trunk/vhffs-panel/admin/mail/change_forward.pl =================================================================== --- trunk/vhffs-panel/admin/mail/change_forward.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/change_forward.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -64,7 +65,7 @@ my $forward = $cgi->param("FORWARD"); my $template; my $message; -my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group ); +my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain ); my $templatedir = $vhffs->get_config->get_templatedir; @@ -73,17 +74,9 @@ if( ! defined $mail ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = sprintf( gettext("Cannot instanciate object %s"), $domain ); + $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain ); $template->param( MESSAGE => $message ); } -elsif( $mail->fetch < 0 ) -{ - - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "Cannot get informations on this object"); - $template->param( MESSAGE => $message ); - -} elsif( ( ! defined $boxname ) || ( ! defined $forward ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); @@ -109,18 +102,11 @@ if( ( $retour = $mail->change_forward( $boxname , $forward ) ) < 0 ) { - $message = gettext( "Can't modify forwarding" ) . "$retour , $boxname , $domain , $forward"; + $message = sprintf(gettext('Unable to modify forward %s (%d)'), $boxname, $retour); } else { - if( $mail->commit < 0 ) - { - $message = gettext( "Unable to record changes on this domain" ); - } - else - { - $message = gettext( "Forwarding successfully added" ); - } + $message = sprintf(gettext('Forward %s successfully added'), $boxname ); } $template->param( MESSAGE => $message ); } Modified: trunk/vhffs-panel/admin/mail/delete_box.pl =================================================================== --- trunk/vhffs-panel/admin/mail/delete_box.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/delete_box.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -63,7 +64,7 @@ my $boxname = $cgi->param("LOCALPART"); my $template; my $message; -my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group ); +my $mail = Vhffs::Services::Mail::get_by_mxdomain($vhffs, $domain); my $templatedir = $vhffs->get_config->get_templatedir; @@ -72,17 +73,9 @@ if( ! defined $mail ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = sprintf( gettext("Cannot instanciate object %s"), $domain ); + $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain ); $template->param( MESSAGE => $message ); } -elsif( $mail->fetch < 0 ) -{ - - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "Cannot get information on this object"); - $template->param( MESSAGE => $message ); - -} elsif( ! defined $boxname ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); Modified: trunk/vhffs-panel/admin/mail/delete_forward.pl =================================================================== --- trunk/vhffs-panel/admin/mail/delete_forward.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/delete_forward.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -63,8 +64,9 @@ my $boxname = $cgi->param("LOCALPART"); my $template; my $message; -my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group ); +my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $domain ); + my $templatedir = $vhffs->get_config->get_templatedir; my $retour; @@ -72,17 +74,9 @@ if( ! defined $mail ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = sprintf( gettext("Cannot instanciate object %s"), $domain ); + $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain ); $template->param( MESSAGE => $message ); } -elsif( $mail->fetch < 0 ) -{ - - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "Cannot get informations on this object"); - $template->param( MESSAGE => $message ); - -} elsif( ! defined $boxname ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); @@ -108,11 +102,11 @@ if( ( $retour = $mail->delforward( $boxname ) ) < 0 ) { - $message = "Can't delete forward $retour"; + $message = sprintf(gettext('Unable to delete forward %s (%d)'), $boxname, $retour); } else { - $message = "Succesfully delete forward"; + $message = sprintf(gettext('Forward %s deleted'), $boxname); } $template->param( MESSAGE => $message ); } Modified: trunk/vhffs-panel/admin/mail/edit.pl =================================================================== --- trunk/vhffs-panel/admin/mail/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Mail( $vhffs , $domain_name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain_name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/mail/list.pl =================================================================== --- trunk/vhffs-panel/admin/mail/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -83,38 +84,30 @@ $template->param( TITLE => gettext("List of all mail-domain") ); } + $template->param( TEXT_TITLE1 => gettext('Domain Name') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); + use Vhffs::Panel::Mail; - my $mails = Vhffs::Panel::Mail::getall_mails( $vhffs , $name ); + my $mails = Vhffs::Panel::Mail::search( $vhffs , $name ); if( defined $mails ) { - my $output = ""; - foreach( sort ( keys %{$mails} ) ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mail/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mail/part-modo.tmpl" ); - } + my $subtemplate; + my $tmplmails; + my $mailhash; + my $send; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/mail/part.tmpl", global_vars => 1 ); + $subtemplate->param( SEND => gettext('Modify this mail domain') ); + } else { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/mail/part-modo.tmpl", global_vars => 1 ); + $subtemplate->param( SEND => gettext('Show this mail domain')); + } - $subtemplate->param( DOMAIN => $mails->{$_}{'domain'} ) if( defined $mails->{$_}{'domain'} ); - $subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $mails->{$_}{'owner_gid'} ) ) if( defined $mails->{$_}{'owner_gid'} ); - $subtemplate->param( OID => $mails->{$_}{'object_id'} ) if( defined $mails->{$_}{'object_id'} ); - - $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $mails->{$_}{'state'} ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this mail domain") ); - } else { - $subtemplate->param( SEND => gettext("Show this mail domain") ); - } - - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + $subtemplate->param( MAILS => $mails ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/mail/password_box.pl =================================================================== --- trunk/vhffs-panel/admin/mail/password_box.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/password_box.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -64,7 +65,7 @@ my $password = $cgi->param("PASSWORD"); my $template; my $message; -my $mail = new Vhffs::Services::Mail( $vhffs , $domain , $user , $group ); +my $mail = Vhffs::Services::Mail::get_by_mxdomain( $vhffs, $domain ); my $templatedir = $vhffs->get_config->get_templatedir; @@ -73,17 +74,9 @@ if( ! defined $mail ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = sprintf( gettext("Cannot instanciate object %s"), $domain ); + $message = sprintf( gettext("Unable to get information on mail domain %s"), $domain ); $template->param( MESSAGE => $message ); } -elsif( $mail->fetch < 0 ) -{ - - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "Cannot get information on this object"); - $template->param( MESSAGE => $message ); - -} elsif( ( ! defined $password ) || ( ! defined $boxname ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); @@ -109,18 +102,11 @@ if( ( $retour = $mail->change_box_password( $boxname , $password ) ) < 0 ) { - $message = "Can't change password $boxname , $password , $retour"; + $message = sprintf(gettext('Unable to change password for box %s (%d)'), $boxname, $retour); } else { - if( $mail->commit < 0 ) - { - $message = "Unable to reccord changes on this domain"; - } - else - { - $message = "Sucessfully password change"; - } + $message = sprintf(gettext('Password changed for box %s'), $boxname); } $template->param( MESSAGE => $message ); } Modified: trunk/vhffs-panel/admin/mail/search.pl =================================================================== --- trunk/vhffs-panel/admin/mail/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/mail/show.pl =================================================================== --- trunk/vhffs-panel/admin/mail/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mail/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Mail( $vhffs , $domain_name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Mail::get_by_mxdomain( $vhffs , $domain_name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/mailing/list.pl =================================================================== --- trunk/vhffs-panel/admin/mailing/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mailing/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,14 +38,13 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; -use Vhffs::Services::Mailing; -use Vhffs::Stats; -use Vhffs::Constants; +use Vhffs::Panel::Mailinglist; my $panel = new Vhffs::Panel::Main(); if(!$panel) { @@ -84,44 +83,24 @@ $template->param( TITLE => gettext("List of all mailing-list") ); } + $template->param( TEXT_TITLE1 => gettext('Mailing List') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); - my $lists = Vhffs::Services::Mailing::getall( $vhffs , undef , $name ); + my $lists = Vhffs::Panel::Mailinglist::search( $vhffs, $name ); if( defined $lists ) { - my $output = ""; - foreach( @{$lists} ) - { - my $subtemplate; - if( $user->is_admin == 1 ) - { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mailing/part.tmpl" ); - } - else - { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mailing/part.tmpl" ); - } + my $subtemplate = new HTML::Template( filename => $templatedir."/admin/mailing/part.tmpl", global_vars => 1 ); + if( $user->is_admin == 1 ) { + $subtemplate->param( SEND => gettext('Modify this list') ); + } else { + $subtemplate->param( SEND => gettext('Show this list') ); + } - - $subtemplate->param( DOMAIN => $_->get_domain ); - $subtemplate->param( LPART => $_->get_localpart ); - $subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $_->get_ownergid )); - $subtemplate->param( OID => $_->get_oid ); - - - $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $_->get_status ) ); - - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this list") ); - } else { - $subtemplate->param( SEND => gettext("Show this list") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + $subtemplate->param( LISTS => $lists ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/mailing/mailing_submit.pl =================================================================== --- trunk/vhffs-panel/admin/mailing/mailing_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mailing/mailing_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/mailing/search.pl =================================================================== --- trunk/vhffs-panel/admin/mailing/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mailing/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/moderation.pl =================================================================== --- trunk/vhffs-panel/admin/moderation.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/moderation.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -100,7 +101,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -143,7 +144,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -175,7 +176,7 @@ my $nss = Vhffs::Services::DNS::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION ); $output = ""; - if( defined $nss ) + if( @$nss > 0 ) { foreach $temp ( @{$nss} ) { @@ -184,7 +185,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -228,7 +229,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -272,7 +273,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -316,7 +317,7 @@ { $subtemplate->param( OWNER => $svn->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $svn->get_user ) ); - $subtemplate->param( OID_ASKER => $svn->get_user->get_oid); + $subtemplate->param( UID_ASKER => $svn->get_user->get_uid); } else { @@ -361,7 +362,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -403,7 +404,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -445,7 +446,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { @@ -469,48 +470,7 @@ } } - if( $vhffs->get_config->use_largefile == 1 ) - { - use Vhffs::Services::LargeFile; - $template->param( TEXT_LARGEFILE => gettext( "Files awaiting validation" ) ); - my $files = Vhffs::Services::LargeFile::getall( $vhffs , Vhffs::Constants::WAITING_FOR_VALIDATION ); - $output = ""; - if( defined @{$files} ) - { - foreach $temp ( @{$files} ) - { - my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/misc/moderation_part.tmpl" ); - - if( $vhffs->get_config->use_notation == 1 ) - { - $subtemplate->param( OWNER => $temp->get_user->get_username); - $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); - } - else - { - $subtemplate->param( OWNER => $temp->get_user->get_username ); - } - - $subtemplate->param( NAME => $temp->get_filename ."( ".$temp->get_size."Mo,".$temp->get_type." )" ); - $subtemplate->param( GROUP => $temp->get_group->get_groupname ); - $subtemplate->param( OID => $temp->get_oid ); - $subtemplate->param( DESCRIPTION => $temp->get_description ); - $subtemplate->param( ACCEPT => gettext("Accept") ); - $subtemplate->param( REFUSE => gettext("Refuse") ); - $output.= $subtemplate->output; - } - - $template->param( MODERATION_LARGEFILE => $output ); - } - else - { - $template->param( MODERATION_LARGEFILE => gettext("No files to validate") ); - } - } - - if( $vhffs->get_config->use_repository == 1 ) { use Vhffs::Services::Repository; @@ -528,7 +488,7 @@ { $subtemplate->param( OWNER => $temp->get_user->get_username); $subtemplate->param( NOTE => Vhffs::Note::get_note( $vhffs , $temp->get_user ) ); - $subtemplate->param( OID_ASKER => $temp->get_user->get_oid); + $subtemplate->param( UID_ASKER => $temp->get_user->get_uid); } else { Modified: trunk/vhffs-panel/admin/moderation_submit.pl =================================================================== --- trunk/vhffs-panel/admin/moderation_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/moderation_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -81,31 +82,31 @@ { use Vhffs::Object; my $oid = $cgi->param("OID"); - my $oidasker = $cgi->param("OID_ASKER"); - my $object = new Vhffs::Object( $vhffs , $oid , '401' ); + my $uidasker = $cgi->param("UID_ASKER"); + my $object = Vhffs::Object::get_by_oid( $vhffs , $oid ); if( ( ! defined $oid ) || ( ! defined $object ) || ( ! defined $accept ) ) { $template->param( MESSAGE => gettext("CGI problem") ); } - elsif( $object->fetch < 0 ) - { - $template->param( MESSAGE => gettext("Cannot obtain information about this object") ); - } else { if( $accept == 1 ) { $object->set_status( Vhffs::Constants::WAITING_FOR_CREATION ); - my $username = Vhffs::User::get_name_by_uid( $vhffs , $object->get_owner_uid ); - my $userbis = new Vhffs::User( $vhffs , $username , '401' ); - if( $userbis->fetch > 0 ) + my $userbis = Vhffs::User::get_by_uid( $vhffs , $object->get_owner_uid ); + if( defined $userbis ) { my $mail; - $mail = gettext("Your request on VHFFS was accepted\n"); - $mail .= gettext("Please wait while we are creating your object\n"); - $mail .= gettext("Cheers,")."\n"; - $mail .= gettext("The Moderator and Admin team"); + $mail = gettext('Your request for a '); + $mail .= Vhffs::Functions::type_string_from_type_id($object->get_type); + $mail .= (' on '); + $mail .= $vhffs->get_config->get_host_name; + $mail .= gettext(" was accepted\nPlease wait while we are creating your object\n"); + $mail .= gettext("Cheers,\nThe Moderator and Admin team\n"); + $mail .= "-----\n"; + $mail .= $vhffs->get_config->get_host_name()."\n"; + $mail .= $vhffs->get_config->get_panel_url(); my $subject = gettext("Your request on VHFFS platform"); Vhffs::Functions::send_mail( $vhffs->get_config->get_moderator_mail , $userbis->get_mail , $subject , $mail ); @@ -120,14 +121,13 @@ } else { - my $askerobject = new Vhffs::Object( $vhffs , $oidasker , '401' ); - $askerobject->fetch; + my $askeruser = Vhffs::User::get_by_uid($vhffs, $uidasker), $object->set_description( $reason ); $object->set_status( Vhffs::Constants::VALIDATION_REFUSED ); if( $vhffs->get_config->use_notation == 1 ) { use Vhffs::Note; - Vhffs::Note::inc_note( $vhffs , $askerobject , -1 ); + Vhffs::Note::inc_note( $vhffs , $askeruser , -1 ); } } Modified: trunk/vhffs-panel/admin/mysql/edit.pl =================================================================== --- trunk/vhffs-panel/admin/mysql/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mysql/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Mysql( $vhffs , $name , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/mysql/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/mysql/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mysql/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -55,7 +56,6 @@ my $session = $panel->{'session'}; my $maintemplate = $panel->{'template'}; my $user = $panel->{'user'}; -#my $group = $panel->{'group'}; my $projectname = $session->param("project"); my $cgi = $panel->{'cgi'}; my $name = $cgi->param("NAME"); @@ -78,7 +78,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Mysql( $vhffs , $name , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = sprintf( gettext("Cannot fetch object %s"), $name ); Modified: trunk/vhffs-panel/admin/mysql/list.pl =================================================================== --- trunk/vhffs-panel/admin/mysql/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mysql/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,11 +39,13 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; +use Vhffs::Panel::Mysql; use Vhffs::Stats; use Vhffs::Constants; my $panel = new Vhffs::Panel::Main(); @@ -83,52 +85,26 @@ $template->param( TITLE => gettext("List of all MySQL databases") ); } - use Vhffs::Panel::Web; + $template->param( TEXT_TITLE1 => gettext('DB Name') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); - my $dbs = Vhffs::Panel::Mysql::getall_mysql( $vhffs , $name ); + my $dbs = Vhffs::Panel::Mysql::search( $vhffs , $name ); if( defined $dbs ) { - my $output = ""; - foreach( sort ( keys %{$dbs} ) ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mysql/part.tmpl" ) - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/mysql/part-modo.tmpl" ) - } + my $subtemplate; - $subtemplate->param( DBNAME => $dbs->{$_}{'dbname'} ) if( defined $dbs->{$_}{'dbname'} ); - $subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $dbs->{$_}{'owner_gid'} ) ) if( defined $dbs->{$_}{'owner_gid'} ); - $subtemplate->param( OID => $dbs->{$_}{'object_id'} ) if( defined $dbs->{$_}{'object_id'} ); + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/mysql/part.tmpl', global_vars => 1 ); + $subtemplate->param( SEND => gettext('Modify this MySQL area')); + } else { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/mysql/part-modo.tmpl', global_vars => 1 ); + $subtemplate->param( SEND => gettext('Show this MySQL area')); + } - if( $dbs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION ) - { - $subtemplate->param( STATE => gettext("Waiting for creation") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::ACTIVATED ) - { - $subtemplate->param( STATE => gettext("Activated") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::TO_DELETE ) - { - $subtemplate->param( STATE => gettext("Waiting for delete") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION ) - { - $subtemplate->param( STATE => gettext("Waiting for validation") ); - } - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this MySQL area") ); - } else { - $subtemplate->param( SEND => gettext("Show this MySQL area") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + $subtemplate->param(DBS => $dbs); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/mysql/search.pl =================================================================== --- trunk/vhffs-panel/admin/mysql/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mysql/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/mysql/show.pl =================================================================== --- trunk/vhffs-panel/admin/mysql/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/mysql/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -77,7 +78,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Mysql( $vhffs , $name , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Mysql::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/object/delete_avatar.pl =================================================================== --- trunk/vhffs-panel/admin/object/delete_avatar.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/object/delete_avatar.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -79,7 +80,7 @@ { $message = gettext( "CGI ERROR !"); } -elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) ) { $message = gettext( "Cannot fetch object"); } Modified: trunk/vhffs-panel/admin/object/edit.pl =================================================================== --- trunk/vhffs-panel/admin/object/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/object/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -77,7 +78,7 @@ $template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" ); $template->param( MESSAGE => gettext( "CGI ERROR !") ); } -elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) ) { $template = new HTML::Template( filename => "$templatesdir/misc/simplemsg.tmpl" ); $template->param( MESSAGE => gettext( "Cannot fetch object") ); Modified: trunk/vhffs-panel/admin/object/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/object/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/object/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -75,7 +76,7 @@ { $template->param( MESSAGE => gettext( "CGI ERROR !") ); } -elsif( ( ! defined ( $object = new Vhffs::Object( $vhffs , $oid , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Object::get_by_oid( $vhffs , $oid ) ) ) { $template->param( MESSAGE => gettext( "Cannot fetch object") ); } Modified: trunk/vhffs-panel/admin/object/list.pl =================================================================== --- trunk/vhffs-panel/admin/object/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/object/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,11 +39,13 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; +use Vhffs::Panel::Object; use Vhffs::Stats; use Vhffs::Constants; my $panel = new Vhffs::Panel::Main(); @@ -82,44 +84,19 @@ $template->param( TITLE => gettext("All objects List") ); } - use Vhffs::Object; + $template->param( TEXT_TITLE1 => gettext('Object ID') ); + $template->param( TEXT_TITLE2 => gettext('Owner') ); + $template->param( TEXT_TITLE3 => gettext('State') ); + $template->param( TEXT_TITLE4 => gettext('History') ); - my $objs = Vhffs::Object::getall( $vhffs , $name ); + my $objs = Vhffs::Panel::Object::search( $vhffs , $name ); - if( defined $objs ) - { - my $output = ""; - foreach( sort {$a - $b} ( keys %{$objs} ) ) - { - my $subtemplate; - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/object/part.tmpl" ); - - $subtemplate->param( USER => Vhffs::User::get_name_by_uid( $vhffs , $objs->{$_}{'owner_uid'} ) ) if( defined $objs->{$_}{'owner_uid'} ); - $subtemplate->param( HISTORY => gettext("History") ); - $subtemplate->param( OID => $objs->{$_}{'object_id'} ) if( defined $objs->{$_}{'object_id'} ); - - if( $objs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION ) - { - $subtemplate->param( STATE => gettext("Waiting for creation") ); - } - elsif( $objs->{$_}{'state'} == Vhffs::Constants::ACTIVATED ) - { - $subtemplate->param( STATE => gettext("Activated") ); - } - elsif( $objs->{$_}{'state'} == Vhffs::Constants::TO_DELETE ) - { - $subtemplate->param( STATE => gettext("Waiting for delete") ); - } - elsif( $objs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION ) - { - $subtemplate->param( STATE => gettext("Waiting for validation") ); - } - - $subtemplate->param( SEND => gettext("Edit this object") ); - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + if( defined $objs ) { + my $subtemplate = new HTML::Template( filename => "$templatesdir/admin/object/part.tmpl", global_vars => 1 ); + $subtemplate->param( SEND => gettext('Edit this object')); + $subtemplate->param( HISTORY => gettext('History')); + $subtemplate->param(OBJECTS => $objs); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/object/search.pl =================================================================== --- trunk/vhffs-panel/admin/object/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/object/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/pgsql/edit.pl =================================================================== --- trunk/vhffs-panel/admin/pgsql/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/pgsql/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Postgres( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Postgres::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/pgsql/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/pgsql/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/pgsql/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Postgres( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Postgres::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = sprintf( gettext("Cannot fetch object %s"), $name ); Modified: trunk/vhffs-panel/admin/pgsql/list.pl =================================================================== --- trunk/vhffs-panel/admin/pgsql/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/pgsql/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -83,52 +84,28 @@ $template->param( TITLE => gettext("List of all PostgreSQL databases") ); } - use Vhffs::Panel::Web; + $template->param( TEXT_TITLE1 => gettext('DB Name') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); - my $dbs = Vhffs::Panel::Pgsql::getall_pgsql( $vhffs , $name ); + my $dbs = Vhffs::Panel::Pgsql::search( $vhffs , $name ); + if( defined $dbs ) { - my $output = ""; - foreach( sort ( keys %{$dbs} ) ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/pgsql/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/pgsql/part-modo.tmpl" ); - } + my $subtemplate; + my $send; + my $tmpldbs; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/pgsql/part.tmpl', global_vars => 1 ); + $subtemplate->param(SEND => gettext('Modify this PostgreSQL database')); + } else { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/pgsql/part-modo.tmpl', global_vars => 1 ); + $subtemplate->param(SEND => gettext("Show this PostgreSQL database")); + } - $subtemplate->param( DBNAME => $dbs->{$_}{'dbname'} ) if( defined $dbs->{$_}{'dbname'} ); - $subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $dbs->{$_}{'owner_gid'} ) ) if( defined $dbs->{$_}{'owner_gid'} ); - $subtemplate->param( OID => $dbs->{$_}{'object_id'} ) if( defined $dbs->{$_}{'object_id'} ); - - if( $dbs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION ) - { - $subtemplate->param( STATE => gettext("Waiting for creation") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::ACTIVATED ) - { - $subtemplate->param( STATE => gettext("Activated") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::TO_DELETE ) - { - $subtemplate->param( STATE => gettext("Waiting for delete") ); - } - elsif( $dbs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION ) - { - $subtemplate->param( STATE => gettext("Waiting for validation") ); - } - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this PostgreSQL database") ); - } else { - $subtemplate->param( SEND => gettext("Show this PostgreSQL database") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + $subtemplate->param( DBS => $dbs ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/pgsql/search.pl =================================================================== --- trunk/vhffs-panel/admin/pgsql/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/pgsql/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/pgsql/show.pl =================================================================== --- trunk/vhffs-panel/admin/pgsql/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/pgsql/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Postgres( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Postgres::get_by_dbname( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/repository/edit.pl =================================================================== --- trunk/vhffs-panel/admin/repository/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/repository/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Repository( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Repository::get_by_reponame( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/repository/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/repository/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/repository/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Repository( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Repository::get_by_reponame( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = sprintf( gettext("Cannot fetch object %s"), $name ); Modified: trunk/vhffs-panel/admin/repository/list.pl =================================================================== --- trunk/vhffs-panel/admin/repository/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/repository/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,11 +39,13 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; +use Vhffs::Panel::Repository; use Vhffs::Stats; use Vhffs::Constants; my $panel = new Vhffs::Panel::Main(); @@ -83,37 +85,27 @@ $template->param( TITLE => gettext("List of all Download repositories") ); } - use Vhffs::Services::Repository; + $template->param( TEXT_TITLE1 => gettext('Repository Name') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); - my $repos = Vhffs::Services::Repository::getall( $vhffs , undef , $name , undef ); - my $repo; - my $output = ""; + my $repos = Vhffs::Panel::Repository::search( $vhffs, $name ); if( defined $repos ) { - foreach $repo ( @{$repos} ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/repository/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/repository/part-modo.tmpl" ); - } - - $subtemplate->param( NAME => $repo->get_name ); - $subtemplate->param( GROUP => $repo->get_group->get_groupname ); - $subtemplate->param( OID => $repo->get_oid ); - $subtemplate->param( STATE => gettext( Vhffs::Functions::status_string_from_status_id( $repo->get_status ) ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this Download repository") ); - } else { - $subtemplate->param( SEND => gettext("Show this Download repository") ); - } - - $output .= $subtemplate->output; - } - $template->param( LIST => $output ); + my $subtemplate; + my $send; + my $tmplrepos; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/repository/part.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Modify this Download repository')); + } else { + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/repository/part-modo.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Show this Download repository')); + } + + $subtemplate->param( REPOSITORIES => $repos ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/repository/search.pl =================================================================== --- trunk/vhffs-panel/admin/repository/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/repository/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/repository/show.pl =================================================================== --- trunk/vhffs-panel/admin/repository/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/repository/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Repository( $vhffs , $name ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Repository::get_by_reponame( $vhffs , $name ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/stats.pl =================================================================== --- trunk/vhffs-panel/admin/stats.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/stats.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -65,7 +66,7 @@ my $stats = new Vhffs::Stats( $vhffs ); -if( ( ! defined $stats ) || ($stats->fetch < 0 ) ) +if( ! defined $stats ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); @@ -163,14 +164,6 @@ $template->param( VALUE_TOTAL_LISTS_ACTIVATED => $stats->get_lists_activated ); $template->param( TEXT_TOTAL_SUBS => gettext("Total subscribtion for lists") ); $template->param( VALUE_TOTAL_SUBS => $stats->get_lists_totalsubs ); - - ##LargeFile part - $template->param( TEXT_LARGEFILE => gettext("Hosted files stats") ); - $template->param( TEXT_TOTAL_FILES => gettext("Total hoted files") ); - $template->param( TEXT_TOTAL_FILES_ACTIVATED => gettext("Total activated hoted files") ); - $template->param( VALUE_TOTAL_FILES => $stats->get_largefile_total ); - $template->param( VALUE_TOTAL_FILES_ACTIVATED => $stats->get_largefile_activated ); - } display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/admin/su.pl =================================================================== --- trunk/vhffs-panel/admin/su.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/su.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/svn/list.pl =================================================================== --- trunk/vhffs-panel/admin/svn/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/svn/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -30,22 +30,14 @@ # POSSIBILITY OF SUCH DAMAGE. -use POSIX qw(locale_h); +use strict; use HTML::Template; -use locale; use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; +use lib "/usr/share/vhffs/api/"; use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; -use Vhffs::Stats; -use Vhffs::Constants; +use Vhffs::Panel::Svn; + my $panel = new Vhffs::Panel::Main(); if(!$panel) { exit 0; @@ -81,34 +73,23 @@ $template->param( TITLE => gettext("All Subversion repositories lists") ); } - use Vhffs::Services::Svn; - my $repos = Vhffs::Services::Svn::getall( $vhffs , undef , $name ); - my $svn; + $template->param(TEXT_TITLE1 => gettext('SVN root')); + $template->param(TEXT_TITLE2 => gettext('Group')); + $template->param(TEXT_TITLE3 => gettext('State')); + my $repos = Vhffs::Panel::Svn::search( $vhffs, $name ); + if( defined $repos ) { - my $output = ""; - foreach $svn ( @{$repos} ) - { - my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/svn/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => "$templatesdir/admin/svn/part-modo.tmpl" ); - } - $subtemplate->param( SVNROOT => $svn->get_reponame ); - $subtemplate->param( GROUP => $svn->get_group->get_groupname ); - $subtemplate->param( OID => $svn->get_oid ); - $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $svn->get_status ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( CGIGROUP => $svn->get_group->get_groupname ); - $subtemplate->param( SEND => gettext("Modify this Subversion repository") ); - } - - $output .= $subtemplate->output; + my $subtemplate; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/svn/part.tmpl", global_vars => 1 ); + $subtemplate->param(SEND => gettext('Modify this Subversion repository')); + } else { + $subtemplate = new HTML::Template( filename => "$templatesdir/admin/svn/part-modo.tmpl", global_vars => 1, die_on_bad_params => 0); } - $template->param( LIST => $output ); + $subtemplate->param( SVNREPOS => $repos); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/svn/search.pl =================================================================== --- trunk/vhffs-panel/admin/svn/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/svn/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/user/edit.pl =================================================================== --- trunk/vhffs-panel/admin/user/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::User( $vhffs , $username , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::User::get_by_username( $vhffs , $username ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/user/edit_note.pl =================================================================== --- trunk/vhffs-panel/admin/user/edit_note.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/edit_note.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ $message = gettext( "CGI ERROR !" ); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::User( $vhffs , $username , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::User::get_by_username( $vhffs , $username) ) ) { $message = gettext( "Cannot fetch object" ); $template->param( MESSAGE => $message ); Modified: trunk/vhffs-panel/admin/user/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/user/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -90,7 +91,7 @@ $message = gettext( "CGI ERROR !" ); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::User( $vhffs , $username , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::User::get_by_username( $vhffs , $username ) ) ) { $message = gettext( "Cannot fetch object" ); $template->param( MESSAGE => $message ); Modified: trunk/vhffs-panel/admin/user/list.pl =================================================================== --- trunk/vhffs-panel/admin/user/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -30,22 +30,15 @@ # POSSIBILITY OF SUCH DAMAGE. -use POSIX qw(locale_h); +use strict; use HTML::Template; -use locale; use Locale::gettext; -use CGI; -use CGI::Session; -use strict; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Functions; +use lib "/usr/share/vhffs/api/"; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; -use Vhffs::Stats; -use Vhffs::Constants; +use Vhffs::Panel::User; + my $panel = new Vhffs::Panel::Main(); if(!$panel) { exit 0; @@ -83,40 +76,26 @@ $template->param( TITLE => gettext("List of all users") ); } - use Vhffs::Panel::User; + $template->param( TEXT_TITLE1 => gettext('Username') ); + $template->param( TEXT_TITLE2 => gettext('Real Name') ); + $template->param( TEXT_TITLE3 => gettext('State') ); -# my $users = Vhffs::Panel::User::getall_users( $vhffs , $name ); - my $users = Vhffs::User::getall( $vhffs , undef , $name ); - my $u; - - if( defined $users ) + my $users = Vhffs::Panel::User::search( $vhffs, $name ); + + if( defined $users ) { - my $output = ""; - foreach $u ( @{$users} ) - { - my $subtemplate; + my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/user/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/user/part-modo.tmpl" ); - } - - $subtemplate->param( NAME => $u->get_username ); - $subtemplate->param( FIRSTNAME => $u->get_firstname); - $subtemplate->param( LASTNAME => $u->get_lastname ); - - $subtemplate->param( STATE => gettext( Vhffs::Functions::status_string_from_status_id( $u->get_status ) ) ); - - if( $user->is_admin == 1 ) { - $subtemplate->param( SEND => gettext("Modify this user") ); - } else { - $subtemplate->param( SEND => gettext("Show this user") ); - } - - $output .= $subtemplate->output; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/user/part.tmpl', global_vars => 1 ); + $subtemplate->param( SEND => gettext('Modify this user') ); + } else { + $subtemplate = new HTML::Template( filename => $templatedir.'/admin/user/part-modo.tmpl', global_vars => 1 ); + $subtemplate->param( SEND => gettext('Show this user')); } - $template->param( LIST => $output ); + + $subtemplate->param( USERS => $users ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/user/search.pl =================================================================== --- trunk/vhffs-panel/admin/user/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/user/show.pl =================================================================== --- trunk/vhffs-panel/admin/user/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/user/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -80,7 +81,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::User( $vhffs , $username , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::User::get_by_username( $vhffs , $username ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/web/edit.pl =================================================================== --- trunk/vhffs-panel/admin/web/edit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/web/edit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Httpd( $vhffs , $webname , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Httpd::get_by_servername( $vhffs , $webname ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/admin/web/edit_submit.pl =================================================================== --- trunk/vhffs-panel/admin/web/edit_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/web/edit_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Httpd( $vhffs , $servername , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Httpd::get_by_servername( $vhffs , $servername ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); @@ -91,6 +92,7 @@ $object->set_status( $cgi->param( "STATUS" ) ); $object->set_crawl( $cgi->param( "CRAWL" ) ); + $object->set_alertlimit( $cgi->param( "TEXT_ALERT") ); if( $object->commit < 0 ) Modified: trunk/vhffs-panel/admin/web/list.pl =================================================================== --- trunk/vhffs-panel/admin/web/list.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/web/list.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -30,22 +30,14 @@ # POSSIBILITY OF SUCH DAMAGE. -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; use strict; +use Locale::gettext; -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; +use lib "/usr/share/vhffs/api/"; use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; -use Vhffs::Stats; -use Vhffs::Constants; +use Vhffs::Panel::Web; + my $panel = new Vhffs::Panel::Main(); if(!$panel) { exit 0; @@ -83,33 +75,27 @@ $template->param( TITLE => gettext("List of all websites") ); } - use Vhffs::Panel::Web; - use Vhffs::Services::Httpd; - my $webs = Vhffs::Services::Httpd::getall( $vhffs , undef , $name ); + $template->param( TEXT_TITLE1 => gettext('Servername') ); + $template->param( TEXT_TITLE2 => gettext('Group') ); + $template->param( TEXT_TITLE3 => gettext('State') ); + + + my $webs = Vhffs::Panel::Web::search( $vhffs, $name ); my $web; if( defined $webs ) { - my $output = ""; - foreach $web ( @{$webs} ) - { - my $subtemplate; - next if( $web->fetch < 0 ); + my $subtemplate; - if( $user->is_admin == 1 ) { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/web/part.tmpl" ); - } else { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/web/part-modo.tmpl" ); - } - - $subtemplate->param( SERVERNAME => $web->get_servername ); - $subtemplate->param( GROUP => $web->get_group->get_groupname ); - $subtemplate->param( OID => $web->get_oid ); - $subtemplate->param( STATE => Vhffs::Functions::status_string_from_status_id( $web->get_status ) ); - $subtemplate->param( SEND => gettext("Change this Website") ); - - $output .= $subtemplate->output; + if( $user->is_admin == 1 ) { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/web/part.tmpl", global_vars => 1 ); + $subtemplate->param( SEND => gettext('Change this Website') ); + } else { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/web/part-modo.tmpl", global_vars => 1 ); + $subtemplate->param( SEND => gettext('Show this Website')); } - $template->param( LIST => $output ); + + $subtemplate->param( WEBS => $webs ); + $template->param( LIST => $subtemplate->output ); } Modified: trunk/vhffs-panel/admin/web/search.pl =================================================================== --- trunk/vhffs-panel/admin/web/search.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/web/search.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/admin/web/show.pl =================================================================== --- trunk/vhffs-panel/admin/web/show.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/admin/web/show.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -78,7 +79,7 @@ my $message = gettext( "CGI ERROR !"); $template->param( MESSAGE => $message ); } -elsif( ( ! defined ( $object = new Vhffs::Services::Httpd( $vhffs , $webname , '401' ) ) ) || ( $object->fetch < 0 ) ) +elsif( ! defined ( $object = Vhffs::Services::Httpd::get_by_servername( $vhffs , $webname ) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); my $message = gettext( "Cannot fetch object"); Modified: trunk/vhffs-panel/alert.pl =================================================================== --- trunk/vhffs-panel/alert.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/alert.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/alert_submit.pl =================================================================== --- trunk/vhffs-panel/alert_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/alert_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; Modified: trunk/vhffs-panel/auth.pl =================================================================== --- trunk/vhffs-panel/auth.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/auth.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -37,51 +37,56 @@ use Locale::gettext; use HTML::Template; use CGI; +use lib "/usr/share/vhffs/api/"; use Vhffs::Main; use Vhffs::Panel::Main; +use Vhffs::Panel::Commons; use Vhffs::Constants; -my $vhffs = init Vhffs::Main; +my $panel = new_light Vhffs::Panel::Main(); +my $vhffs = $panel->{'vhffs'}; +my $templatedir = $panel->{'templatedir'}; +my $cgi = $panel->{cgi}; +my $submitted = defined($cgi->param('login_submit')); -#Set the language cookie -my $cookie = Vhffs::Panel::Main::cookie_lang( $vhffs ); +if($submitted) { + # User tried to log in + # we try to clean the previous session + my $oldsid = CGI->cookie('session'); + if( $oldsid ) { + my $oldsession = new CGI::Session(undef, $oldsid, {Directory=>'/tmp'}); + $oldsession->delete(); + } -my $templatedir = $vhffs->get_config->get_templatedir; -my $hostname = $vhffs->get_config->get_host_name; -my $cgi = new CGI; -my $template; + my $username = $cgi->param('username'); + my $password = $cgi->param('password'); + my $user; + $user = Vhffs::User::get_by_username($vhffs, $username) if(defined $username); -Vhffs::Panel::Main::check( $vhffs ); + #Incomplete input + if( ! defined( $username ) || ! defined ( $password ) || !defined $user + || !$user->check_password( $password )) { + $panel->add_error( gettext('Login failed !') ); + } elsif($user->get_status != Vhffs::Constants::ACTIVATED) { + $panel->add_error( gettext('User is not active yet') ); + } else { + # Creates the new session + my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'}); + $session->expires("+1h"); + $session->param("username", $user->get_username); + $session->param("uid", $user->get_uid); -$template = new HTML::Template( filename => $templatedir."/main/auth.tmpl", associate => $cgi ); + my $sessioncookie = new CGI::Cookie(-name => $session->name, -value => $session->id); -$template->param( TITLE => gettext("VHFFS Login") ); -$template->param( TEXT_WELCOME => sprintf( gettext("Welcome on %s") , $hostname ) ); -$template->param( VHFFS_INFO => sprintf( "Run VHFFS %s (%s)" , Vhffs::Constants::VHFFS_VERSION , Vhffs::Constants::VHFFS_RELEASE_NAME ) ); -$template->param( TEXT_PLEASEIDENTIFY => gettext("Please enter your username and password") ); -$template->param( TEXT_USERNAME => gettext("Username") ); -$template->param( TEXT_PASSWORD => gettext("Password") ); -$template->param( TEXT_LOGIN => gettext("Access to panel") ); -$template->param( TEXT_LOSTPASSWORD => gettext("I've lost my password") ); -$template->param( TEXT_SUBSCRIBE => gettext("Subscribe") ); + # Refresh cookies (avoid theme and language loss when user + # deletes cookies). + my $themecookie = new CGI::Cookie( -name=> 'theme', -value=>$user->get_theme, -expires=>'+10y' ); + my $langcookie = new CGI::Cookie( -name=>'language', -value=>$user->get_lang, -expires=>'+10y' ); -$template->param( LANGS => Vhffs::Panel::Main::select_lang( $vhffs ) ); - - -if( $vhffs->get_config->stats_on_home == 1 ) -{ - use Vhffs::Stats; - my $stats = new Vhffs::Stats( $vhffs ); - $stats->fetch; - my $users = $stats->get_user_total; - my $groups = $stats->get_groups_total; - - $template->param( TEXT_STATS => sprintf( gettext( "Woah, %s users and %s groups already trust %s" ) , $users, $groups , $hostname ) ); + $panel->redirect('/panel.pl', [$sessioncookie, $themecookie, $langcookie]); + } } -if( $vhffs->get_config->get_panel_public == 1 ) -{ - $template->param( TEXT_PUBLIC => gettext( "Go to public area" ) ); +if(!$submitted || $panel->has_errors) { + Vhffs::Panel::Commons::display_login($vhffs, $panel); } - -display_light Vhffs::Panel::Main( $vhffs , $template , $cookie ); Modified: trunk/vhffs-panel/cvs/create.pl =================================================================== --- trunk/vhffs-panel/cvs/create.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/cvs/create.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Main; use Vhffs::Panel::Main; @@ -55,18 +56,46 @@ my $maintemplate = $panel->{'template'}; my $user = $panel->{'user'}; my $group = $panel->{'group'}; +my $cgi = $panel->{cgi}; +my $submitted = defined($cgi->param('cvs_submit')); +my $repo_name = $cgi->param('REPOSITORY_NAME'); +my $description = $cgi->param('DESCRIPTION'); + my $templatedir = $vhffs->get_config->get_templatedir; -my $template = new HTML::Template( filename => $templatedir."/cvs/create.tmpl" ); +if($submitted) { + if( $repo_name !~ /^[a-z0-9]+$/ ) { + $panel->add_error( gettext('Your repository name is not correct. It must contains only caracter and numbers') ); + } elsif( length( $repo_name ) < 3 ) { + $panel->add_error( gettext('Your repository name is not correct. It must contains at least 3 caracters') ); + } elsif( $description =~ /^\s*$/ ) { + $panel->add_error( gettext('You must enter a description') ); + } else { + #Create CVS + my $cvs = Vhffs::Panel::Cvs::create_cvs( $vhffs, $repo_name, $description, $user , $group ); + if( defined $cvs ) { + my $url = '/panel.pl?project='.$panel->{groupname}.'&msg='.gettext('The CVS object was successfully created !'); + $panel->redirect($url); + } else { + $panel->add_error( gettext( 'An error occured while creating the object.It probably already exists' ) ); + } + } +} -$template->param( TITLE => gettext("Create a CVS Repository") ); -$template->param( REPOSITORY_NAME => gettext("Repository Name") ); -$template->param( GROUP_NAME => gettext("Group owning this CVS") ); +if(!$submitted || $panel->has_errors()) { + my $template = new HTML::Template( filename => $templatedir."/cvs/create.tmpl" ); + + $panel->set_title( gettext('Create a CVS Repository') ); + $template->param( REPOSITORY_NAME => gettext("Repository Name") ); + $template->param( REPOSITORY_VALUE => $repo_name ); + $template->param( GROUP_NAME => gettext("Group owning this CVS") ); -$template->param( GROUP => $group->get_groupname ); -$template->param( SEND => gettext("Send") ); -$template->param( DESCRIPTION => gettext("Description") ); + $template->param( GROUP => $group->get_groupname ); + $template->param( SEND => gettext("Send") ); + $template->param( DESCRIPTION => gettext("Description") ); + $template->param( DESCRIPTION_VALUE => $description); -display Vhffs::Panel::Main($panel, $template->output); + display Vhffs::Panel::Main($panel, $template->output); +} Deleted: trunk/vhffs-panel/cvs/cvs_submit.pl =================================================================== --- trunk/vhffs-panel/cvs/cvs_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/cvs/cvs_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,101 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -# This file is a part of VHFFS project -# Please consider the entire project - -# Author: sod - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; -use Vhffs::Panel::Group; - -my $panel = new Vhffs::Panel::Main; -if(!$panel) { - exit 0; -} - -my $vhffs = $panel->{'vhffs'}; -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; -my $user = $panel->{'user'}; -my $group = $panel->{'group'}; -my $groupname = $panel->{'groupname'}; -my $cgi = $panel->{'cgi'}; -my $message; - -my $repo_name = $cgi->param("REPOSITORY_NAME"); -my $description = $cgi->param("DESCRIPTION"); - -my $templatedir = $vhffs->get_config->get_templatedir; - - -if( ! ( $repo_name =~ /^[a-z0-9]+$/ ) ) -{ - $message = "Your repository name is not correct. It must contains only caracter and numbers"; -} -elsif( length( $repo_name ) < 3 ) -{ - $message = "Your repository name is not correct. It must contains at least 3 caracters"; -} -else -{ - #Create CVS - my $cvs = Vhffs::Panel::Cvs::create_cvs( $vhffs , "$repo_name" , $user , $group ); - if( defined $cvs ) - { - $cvs->set_description( $description ); - $cvs->commit; - $message = gettext("The CVS object was successfully created !"); - } - else - { - $message = gettext( "An error occured while creating the object.It probably already exists" ); - } -} - -my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); -$template->param( MESSAGE => $message ); - -set_refresh_url Vhffs::Panel::Main($panel, "/panel.pl?project=$groupname", 0); -display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/cvs/delete.pl =================================================================== --- trunk/vhffs-panel/cvs/delete.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/cvs/delete.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Main; use Vhffs::Group; @@ -66,13 +67,13 @@ my $templatedir = $vhffs->get_config->get_templatedir; -my $cvs = new Vhffs::Services::Cvs( $vhffs , $repo , $user , $group ); +my $cvs; -if( ( ! defined $repo ) || ( ! defined $cvs ) || ( ! defined $sure ) ) +if( ( ! defined $repo ) || ( ! defined $sure ) ) { $message = sprintf( gettext("CGI Error ! %s"), $repo ); } -elsif( $cvs->fetch < 0 ) +elsif( !defined($cvs = Vhffs::Services::Cvs::get_by_cvsroot($vhffs, $repo) ) ) { $message = gettext( "Cannot retrieve informations about this CVS repository" ); } Modified: trunk/vhffs-panel/cvs/prefs.pl =================================================================== --- trunk/vhffs-panel/cvs/prefs.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/cvs/prefs.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -60,19 +61,19 @@ my $repo_name = $cgi->param("name"); my $template; -my $cvs = new Vhffs::Services::Cvs( $vhffs , $repo_name , $user ); +my $cvs; my $message; my $templatedir = $vhffs->get_config->get_templatedir; -if( ( ! defined $repo_name ) || ( ! defined $cvs ) ) +if( ! defined $repo_name ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $message = gettext( "CGI Error !"); $template->param( MESSAGE => $message ); } -elsif( $cvs->fetch < 0 ) +elsif( !defined($cvs = Vhffs::Services::Cvs::get_by_cvsroot($vhffs, $repo_name) ) ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $message = gettext( "Cannot get informations on this object"); Modified: trunk/vhffs-panel/cvs/prefs_save.pl =================================================================== --- trunk/vhffs-panel/cvs/prefs_save.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/cvs/prefs_save.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Main; use Vhffs::Group; @@ -66,14 +67,13 @@ my $templatedir = $vhffs->get_config->get_templatedir; -my $cvs = new Vhffs::Services::Cvs( $vhffs , $repo , $user , $group ); +my $cvs; -if( ( ! defined $repo ) || ( ! defined $cvs ) ) +if( ( ! defined $repo ) ) { $message = sprintf( gettext("CGI Error ! %s"), $repo ); -} -elsif( $cvs->fetch < 0 ) -{ + +} elsif( !defined($cvs = Vhffs::Services::Cvs::get_by_cvsroot($vhffs, $repo) ) ) { $message = gettext( "Cannot retrieve informations about this CVS repository" ); } elsif( ( Vhffs::Acl::what_perm_for_user( $user , $cvs , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) Deleted: trunk/vhffs-panel/dns/add_a.pl =================================================================== --- trunk/vhffs-panel/dns/add_a.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/add_a.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,133 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -#Add a A to a domain -#This is the CGI part, it uses the main API of VHFFS - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} - - -#Fetch some vars from the main API -my $cgi = $panel->{'cgi'}; -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("PREFIX"); -my $ip = $cgi->param("IP"); -my $user = $panel->{'user'}; -my $question = $cgi->param("QUESTION"); -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) || ( ! defined $ip )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - $message = gettext( "Cannot get informations on this object"); -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - #If $question equals to 1, we must use the adress defined in the VHFFS config file - #With this option, the user just put the name for the A redir and the API takes the IP from the config file - if( ( defined $question ) && ( $question == 1 ) ) - { - # add_a( $foo , undef ) will add to the domain - # foo.domain IN A adress_in_config_file - if( $dns->add_a( $name , undef ) < 0 ) - { - $message = gettext("Cannot add this ressource to this domain"); - } - else - { - $message = gettext("Resource successfully added to this domain"); - } - } - else - { - #Check if the IP is valid and add it on the domain - if( ! ( $ip =~ /[\d+\.].[\d+\.].[\d+\.].[\d+]/ ) ) - { - $message = gettext("Invalid IP"); - } - elsif( $dns->add_a( $name , $ip ) < 0 ) - { - $message = gettext("Cannot add this ressource to this domain"); - } - else - { - $message = gettext("Resource successfully added to this domain"); - } - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/add_cname.pl =================================================================== --- trunk/vhffs-panel/dns/add_cname.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/add_cname.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,109 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("PREFIX"); -my $destination = $cgi->param("DESTINATION"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) || ( ! defined $destination )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->add_cname( $name , $destination ) < 0 ) - { - $message = gettext("Cannot add this ressource to this domain"); - } - else - { - $message = gettext("Resource successfully added to this domain"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/add_mx.pl =================================================================== --- trunk/vhffs-panel/dns/add_mx.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/add_mx.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,109 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $priority = $cgi->param("PRIORITY"); -my $mx = $cgi->param("MXNAME"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $mx ) || ( ! defined $priority )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->add_mx( $mx , $priority ) < 0 ) - { - $message = gettext("Cannot add this ressource to this domain"); - } - else - { - $message = gettext("Resource successfully added to this domain"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/add_ns.pl =================================================================== --- trunk/vhffs-panel/dns/add_ns.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/add_ns.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,108 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $destination = $cgi->param("DESTINATION"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $destination )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->add_ns( $destination ) < 0 ) - { - $message = gettext("Cannot add this ressource to this domain"); - } - else - { - $message = gettext("Resource successfully added to this domain"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/dns/create.pl =================================================================== --- trunk/vhffs-panel/dns/create.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/create.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -9,6 +9,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Main; use Vhffs::Panel::Main; Modified: trunk/vhffs-panel/dns/delete.pl =================================================================== --- trunk/vhffs-panel/dns/delete.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/delete.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -56,7 +57,7 @@ my $sure = $cgi->param("DELETE"); my $user = $panel->{'user'}; -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); +my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name ); my $templatedir = $vhffs->get_config->get_templatedir; @@ -73,11 +74,11 @@ $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); -if( ( ! defined $domain_name ) || ( ! defined $dns ) ) +if( ! defined $domain_name ) { $message = gettext( "CGI Error!"); } -elsif( $dns->fetch < 0 ) +elsif( ! defined $dns ) { $message = gettext( "Cannot get informations on this object"); Deleted: trunk/vhffs-panel/dns/delete_a.pl =================================================================== --- trunk/vhffs-panel/dns/delete_a.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/delete_a.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("ANAME"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - - -my $template; -my $output = ""; -my $message; - -my $templatedir = $vhffs->get_config->get_templatedir; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) ) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->delete_a( $name ) < 0 ) - { - $message = gettext("Cannot delete it."); - } - else - { - $message = gettext("This part of the domain is now removed."); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/delete_cname.pl =================================================================== --- trunk/vhffs-panel/dns/delete_cname.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/delete_cname.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,108 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("NAME"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) ) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->delete_cname( $name ) < 0 ) - { - $message = gettext("Cannot delete it."); - } - else - { - $message = gettext("This part of the domain is now removed."); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/delete_mx.pl =================================================================== --- trunk/vhffs-panel/dns/delete_mx.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/delete_mx.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,108 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $priority = $cgi->param("PRIORITY"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $priority ) ) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->delete_mx( $priority ) < 0 ) - { - $message = gettext("Cannot delete it."); - } - else - { - $message = gettext("This part of the domain is now removed."); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/delete_ns.pl =================================================================== --- trunk/vhffs-panel/dns/delete_ns.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/delete_ns.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,107 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $ip = $cgi->param("IP"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $ip ) ) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->delete_ns( $ip ) < 0 ) - { - $message = gettext("Cannot delete it."); - } - else - { - $message = gettext("This part of the domain is now removed."); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/dns/dns_submit.pl =================================================================== --- trunk/vhffs-panel/dns/dns_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/dns_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,6 +38,7 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -64,23 +65,19 @@ my $templatedir = $vhffs->get_config->get_templatedir; -my $dns = Vhffs::Panel::DNS::create_dns( $vhffs , "$domain_name" , $user , $group ); if( ! ( $domain_name =~ /^[a-z0-9\.\-]+$/ ) ) { - $message = gettext("Invalid domain name"); + $message = gettext('Invalid domain name'); +} else { + my $dns = Vhffs::Panel::DNS::create_dns( $vhffs, $domain_name, $description, $user, $group ); + if( defined $dns ) { + $message = gettext('The DNS object was successfully created !'); + } else { + $message = gettext('An error occured while creating the object. The domain is not correct or aleady exists in Vhffs database'); + } } -elsif( defined $dns ) -{ - $dns->set_description( $description ); - $dns->commit; - $message = gettext("The DNS object was successfully created !"); -} -else -{ - $message = gettext( "An error occured while creating the object. The domain is not correct or aleady exists in Vhffs database" ); -} my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); Modified: trunk/vhffs-panel/dns/dns_type_submit.pl =================================================================== --- trunk/vhffs-panel/dns/dns_type_submit.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/dns_type_submit.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -38,12 +38,14 @@ use CGI::Session; use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; use Vhffs::Panel::Main; use Vhffs::Panel::Menu; use Vhffs::Panel::Group; +use Vhffs::Services::DNS; my $panel = new Vhffs::Panel::Main; if(!$panel) { @@ -62,8 +64,8 @@ my $prefix = $cgi->param("PREFIX"); my $ip = $cgi->param("IP"); -my question = $cgi->param("QUESTION"); -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name ); +my $question = $cgi->param("QUESTION"); +my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name ); my $templatedir = $vhffs->get_config->get_templatedir; @@ -74,32 +76,19 @@ } else { - if( $dns->fetch < 0 ) - { - $message = "Error while fetching object $domain_name"; - } - else - { - - if( $dns->add_a( $prefix , $ip ) < 0 ) - { - $message = "Error while create a type $retour"; + if( $dns->add_a( $prefix , $ip ) < 0 ) { + $message = "Error while create a type A"; + } else { + if( $dns->commit < 0) { + $message = "Error while update object"; + } else { + $message = "Modifications applied to the database"; } - else - { - if( $dns->commit < 0) - { - $message = "Error while update object $retour"; - } - else - { - $message = "Modifications applied to the database"; - } - } } } + my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $template->param( MESSAGE => $message ); Deleted: trunk/vhffs-panel/dns/modif_a.pl =================================================================== --- trunk/vhffs-panel/dns/modif_a.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/modif_a.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,113 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("PREFIX"); -my $ip = $cgi->param("IP"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) || ( ! defined $ip )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( ! ( $ip =~ /[\d+\.].[\d+\.].[\d+\.].[\d+]/ ) ) - { - $message = gettext("Invalid IP"); - } - elsif( $dns->update_a( $name , $ip ) < 0 ) - { - $message = gettext("Cannot modify this ressource on this domain"); - } - else - { - $message = gettext("Updated !"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/modif_cname.pl =================================================================== --- trunk/vhffs-panel/dns/modif_cname.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/modif_cname.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,109 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $name = $cgi->param("PREFIX"); -my $destination = $cgi->param("DESTINATION"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $name ) || ( ! defined $destination )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->update_cname( $name , $destination ) < 0 ) - { - $message = gettext("Cannot update CNAME on this domain"); - } - else - { - $message = gettext("CNAME field successfully updated"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Deleted: trunk/vhffs-panel/dns/modif_mx.pl =================================================================== --- trunk/vhffs-panel/dns/modif_mx.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/modif_mx.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -1,109 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (c) vhffs project and its contributors -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -#2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -#3. Neither the name of vhffs nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -use POSIX qw(locale_h); -use HTML::Template; -use locale; -use Locale::gettext; -use CGI; -use CGI::Session; -use strict; - - -use Vhffs::User; -use Vhffs::Group; -use Vhffs::Main; -use Vhffs::Panel::Main; -use Vhffs::Panel::Menu; - -my $panel = new Vhffs::Panel::Main(); -if(!$panel) { - exit 0; -} -my $cgi = $panel->{'cgi'}; - -my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("DOMAIN"); -my $priority = $cgi->param("PRIORITY"); -my $mx = $cgi->param("IP"); -my $user = $panel->{'user'}; - -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); - - -my $session = $panel->{'session'}; -my $maintemplate = $panel->{'template'}; - -my $group = $panel->{'group'}; -my $projectname = $session->param("project"); - -my $templatedir = $vhffs->get_config->get_templatedir; - -my $template; -my $output = ""; -my $message; - -$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - -if( ( ! defined $domain_name ) || ( ! defined $dns ) || ( ! defined $mx ) || ( ! defined $priority )) -{ - $message = gettext( "CGI Error!"); -} -elsif( $dns->fetch < 0 ) -{ - - $message = gettext( "Cannot get informations on this object"); - -} -elsif( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -elsif( $dns->get_status != Vhffs::Constants::ACTIVATED ) -{ - $message = gettext("You're not allowed to do this (ACL rights)"); -} -else -{ - if( $dns->update_mx( $mx , $priority ) < 0 ) - { - $message = gettext("Cannot update MX on this domain"); - } - else - { - $message = gettext("MX successfully changed"); - } -} - -$template->param( MESSAGE => $message ); -set_refresh_url Vhffs::Panel::Main($panel, "/dns/prefs.pl?name=$domain_name", 0); -display Vhffs::Panel::Main($panel, $template->output); Modified: trunk/vhffs-panel/dns/prefs.pl =================================================================== --- trunk/vhffs-panel/dns/prefs.pl 2007-04-15 19:31:15 UTC (rev 560) +++ trunk/vhffs-panel/dns/prefs.pl 2007-04-15 21:17:33 UTC (rev 561) @@ -39,6 +39,7 @@ use strict; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -52,10 +53,10 @@ my $cgi = $panel->{'cgi'}; my $vhffs = $panel->{'vhffs'}; -my $domain_name = $cgi->param("name"); +my $domain_name = $cgi->param('domain'); my $user = $panel->{'user'}; -my $dns = new Vhffs::Services::DNS( $vhffs , $domain_name , $user ); +my $dns = Vhffs::Services::DNS::get_by_domainname( $vhffs , $domain_name ); my $session = $panel->{'session'}; @@ -71,13 +72,13 @@ my $output = ""; my $message; -if( ( ! defined $domain_name ) || ( ! defined $dns ) ) +if( ! defined $domain_name ) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $message = gettext( "CGI Error!"); $template->param( MESSAGE => $message ); } -elsif( ( my $retour = $dns->fetch ) < 0 ) +elsif( !defined $dns) { $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); @@ -100,16 +101,88 @@ } else { + my $action = $cgi->param('action'); +ACTION: { + if(defined $action) { + # Check user's rights + if( ( Vhffs::Acl::what_perm_for_user( $user , $dns , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) { + $panel->add_error(gettext('You\'re not allowed to do this (ACL rights)')); + last ACTION; + } + my $id = $cgi->param('rr_id'); + my $data = $cgi->param('data'); + my $name = $cgi->param('name'); + my $aux = $cgi->param('aux'); + + if($action eq 'manage_a') { + if(defined $cgi->param('modify_a_submit')) { + # User just want to modify an A record + eval { Vhffs::Panel::DNS::update_a($dns, $id, $data); }; + if($@) { $panel->add_error(sprintf(gettext('Unable to modify A record: %s'), $@)); } + else { $panel->add_info(gettext('A Record updated')); } + } else { + # User wants to delete it + eval { Vhffs::Panel::DNS::delete_a($dns, $id); }; + if($@) { $panel->add_error(sprintf(gettext('Unable to delete A record: %s'), $@)); } + else { $panel->add_info(gettext('A Record deleted')); } +