Final_Extract v.2.3 with usergroup settings by admin panel Final_Extract v.2.3 with usergroup settings by admin panel
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Final_Extract v.2.3 with usergroup settings by admin panel

Started by François Keller, September 24, 2006, 06:47:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

François Keller

Hello all,   
I have modified the final_extract plugin  v.2.2 (resulting from the plugin of Donoman and modified by Bmosavari) in order to be able to define for each usergroup the menu elements to display (or to hide). 
the  settings are done by admin panel.  If a new group is created , it is taken into account and can be also parameterized. 
This plugin is multilangage. currently  "english" and "french" files exist.
Not being a proffessional  coder  ;), so if some among you find there errors, they can of course correct them and make some profit all , me of first.   ;) 
I tested this plugin on my local install  and on my test site hosted by 1&1 without having error.
users of the precedent plugin must unistall it before installing this new version

[edit]*Attachement updated with Sami's correction
*German.php file added (Thank's AlexL)
*French.php file corrected (thank's AlexL for report)[/edit]

Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Sami

Frantz I've edited init2.inc.php
there was some issue with users group detection ;)
here is correct one ,
for others , you should rename this file to init2.inc.php and replace plugins/final_extract/include/init2.inc.php with this one
‍I don't answer to PM with support question
Please post your issue to related board

François Keller

Oh thank you Sami,  :-*

So I said, I'm not a good coder, i do it for fun but learn a lot with this. attachement is updated with Sami's correction.
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

aravot

Great mod, what I was looking for, question how to add logout to the list.

François Keller

in shema.sql just before
PRIMARY KEY  (`Group_Id`)
add
`logout` varchar(255) NOT NULL default '',
in basic.sql replace
INSERT INTO `CPG_final_extract_config` VALUES ('1', '0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `CPG_final_extract_config` VALUES ('2', '0','1','0','0','0','0','0','0','0','0','0');
INSERT INTO `CPG_final_extract_config` VALUES ('3', '0','0','1','1','1','0','0','0','0','1','0');
INSERT INTO `CPG_final_extract_config` VALUES ('4', '0','1','1','1','1','1','1','1','1','1','1');

with
INSERT INTO `CPG_final_extract_config` VALUES ('1', '0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `CPG_final_extract_config` VALUES ('2', '0','1','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `CPG_final_extract_config` VALUES ('3', '0','0','1','1','1','0','0','0','0','1','0','0');
INSERT INTO `CPG_final_extract_config` VALUES ('4', '0','1','1','1','1','1','1','1','1','1','1',1');

in plugin_config.php replace
$home=0;$login=0;$my_gallery=0;$upload_pic=0;$album_list=0;$lastup=0;$lastcom=0;$topn=0;$toprated=0;$favpics=0;$search=0;
if($_POST['home']<>"")$home=1;
if($_POST['login']<>"")$login=1;
if($_POST['my_gallery']<>"")$my_gallery=1;
if($_POST['upload_pic']<>"")$upload_pic=1;
if($_POST['album_list']<>"")$album_list=1;
if($_POST['lastup']<>"")$lastup=1;
if($_POST['lastcom']<>"")$lastcom=1;
if($_POST['topn']<>"")$topn=1;
if($_POST['toprated']<>"")$toprated=1;
if($_POST['favpics']<>"")$favpics=1;
if($_POST['search']<>"")$search=1;

with
$home=0;$login=0;$my_gallery=0;$upload_pic=0;$album_list=0;$lastup=0;$lastcom=0;$topn=0;$toprated=0;$favpics=0;$search=0;$logout=0;
if($_POST['home']<>"")$home=1;
if($_POST['login']<>"")$login=1;
if($_POST['my_gallery']<>"")$my_gallery=1;
if($_POST['upload_pic']<>"")$upload_pic=1;
if($_POST['album_list']<>"")$album_list=1;
if($_POST['lastup']<>"")$lastup=1;
if($_POST['lastcom']<>"")$lastcom=1;
if($_POST['topn']<>"")$topn=1;
if($_POST['toprated']<>"")$toprated=1;
if($_POST['favpics']<>"")$favpics=1;
if($_POST['search']<>"")$search=1;
if($_POST['logout'<>"")$logout=1;

search
$sql="INSERT INTO `{$CONFIG['TABLE_FINAL_EXTRACT_CONFIG']}`VALUE($groupid,$home,$login,$my_gallery,$upload_pic,$album_list,$lastup,$lastcom,$topn,$toprated,$favpics,$search)";
replace with
$sql="INSERT INTO `{$CONFIG['TABLE_FINAL_EXTRACT_CONFIG']}`VALUE($groupid,$home,$login,$my_gallery,$upload_pic,$album_list,$lastup,$lastcom,$topn,$toprated,$favpics,$search,$logout)";
search
$sql="UPDATE `{$CONFIG['TABLE_FINAL_EXTRACT_CONFIG']}` SET `home`=$home,`login`=$login,`my_gallery`=$my_gallery,`upload_pic`=$upload_pic,`album_list`=$album_list,`lastup`=$lastup,`lastcom`=$lastcom,`topn`=$topn,`toprated`=$toprated,`favpics`=$favpics,`search`=$search WHERE Group_Id=$groupid";
replace with
$sql="UPDATE `{$CONFIG['TABLE_FINAL_EXTRACT_CONFIG']}` SET `home`=$home,`login`=$login,`my_gallery`=$my_gallery,`upload_pic`=$upload_pic,`album_list`=$album_list,`lastup`=$lastup,`lastcom`=$lastcom,`topn`=$topn,`toprated`=$toprated,`favpics`=$favpics,`search`=$search,`logout`=$logout WHERE Group_Id=$groupid";
search
<tr>
            <td class=tableb align="<?php echo $align ?>" dir="<?php echo $direction ?>"><?php echo $lang_plugin_final_extract['search_block'];?></td>
            <td align="center" valign=top class=tableb><input name="search" type="checkbox"  <?php if($row2['search']==1) { echo 'checked="cheked"';} ?>/></td>
            </tr>

add just after
<tr>
            <td class=tableb align="<?php echo $align ?>" dir="<?php echo $direction ?>"><?php echo $lang_plugin_final_extract['logout_block'];?></td>
            <td align="center" valign=top class=tableb><input name="logout" type="checkbox"  <?php if($row2['logout']==1) { echo 'checked="cheked"';} ?>/></td>
            </tr>

in the lang/english.php file , search
'search_block'    =>'Search',
add just after
'logout_block'    =>'Logout',
in the include/init2.php file, search
$result = cpg_db_query("SELECT home,login,my_gallery,upload_pic,album_list,lastup,lastcom,topn,toprated,favpics,search FROM {$CONFIG['TABLE_PREFIX']}final_extract_config WHERE Group_Id=$group[0]");
replace with
$result = cpg_db_query("SELECT home,login,my_gallery,upload_pic,album_list,lastup,lastcom,topn,toprated,favpics,search,logout FROM {$CONFIG['TABLE_PREFIX']}final_extract_config WHERE Group_Id=$group[0]");
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

aravot

Thanks Frantz,
Added the code got two errors; errors one in plugin_config.php line 56 bracket ] missing from
Quoteif($_POST['logout'<>]"")$logout=1;

Error number two, when I replace the code in init2.inc.php I get the following error
QuoteCritical error
There was an error while processing a database query

Nibbler

Not a bracket missing, it is just in the wrong place (typo).

if($_POST['logout']<>"")$logout=1;

aravot

Quote from: Nibbler on October 07, 2006, 09:44:00 PM
Not a bracket missing, it is just in the wrong place (typo).

if($_POST['logout']<>"")$logout=1;

Sorry, I made a type, I have it like that^.

Any idea why the second error


aravot

Sorry if I am not providing a link, I am testing it on a local installation before I apply it to my live site.

Here is debug error.
QuoteWhile executing query "SELECT home,login,my_gallery,upload_pic,album_list,lastup,lastcom,topn,toprated,favpics,search,logout FROM cpg146_final_extract_config WHERE Group_Id=1" on 0

mySQL error: Unknown column 'logout' in 'field list'

QuoteFile: C:\wamp\www\cpg\include\functions.inc.php - Line: 249

USER:
------------------
Array
(
    [ID] => d825cf6e63dc6191b0c902a78108a299
    [am] => 1
    [lang] => english
    [theme] => classic
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_name] => admin
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg146_filetypes; (0.001s)
    [1] => select * from cpg146_plugins order by priority asc; (0s)
    [2] => delete from `cpg`.cpg146_sessions where time<1160249684 and remember=0; (0.001s)
    [3] => delete from `cpg`.cpg146_sessions where time<1159043684; (0s)
    [4] => select user_id from `cpg`.cpg146_sessions where session_id=md5("febb28b71025c48aa1b4afe08d8a56783e902f04a416f3a5d674b98f8aaff3f0"); (0s)
    [5] => select user_id as id, user_password as password from `cpg`.cpg146_users where user_id=1 (0s)
    [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `cpg`.cpg146_users AS u INNER JOIN `cpg`.cpg146_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='1' (0s)
    [7] => SELECT user_group_list FROM `cpg`.cpg146_users AS u WHERE user_id='1' and user_group_list <> ''; (0s)
    [8] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg146_usergroups WHERE group_id in (1) (0s)
    [9] => SELECT group_name FROM  cpg146_usergroups WHERE group_id= 1 (0s)
    [10] => update `cpg`.cpg146_sessions set time='1160253284' where session_id=md5('febb28b71025c48aa1b4afe08d8a56783e902f04a416f3a5d674b98f8aaff3f0'); (0.001s)
    [11] => SELECT user_favpics FROM cpg146_favpics WHERE user_id = 1 (0.001s)
    [12] => DELETE FROM cpg146_mod_online WHERE last_action < NOW() - INTERVAL 10 MINUTE (0s)
    [13] => REPLACE INTO cpg146_mod_online (user_id, user_name, user_ip, last_action) VALUES ('1', 'cpgadmin', '127.0.0.1', NOW()) (0.071s)
    [14] => SELECT home,login,my_gallery,upload_pic,album_list,lastup,lastcom,topn,toprated,favpics,search,logout FROM cpg146_final_extract_config WHERE Group_Id=1 (0.001s)
    [15] => SELECT COUNT(*) FROM cpg146_pictures WHERE approved = 'NO' (0.001s)
)

==========================
GET :
------------------
Array
(
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 5.1.6 - OK
------------------
mySQL version: 5.0.24a-community-nt
------------------
Coppermine version: 1.4.9(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support: 1
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XPM Support:
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 1
Client API version 5.0.24a
==========================
Module: zlib
------------------
ZLib Support enabled
Stream Wrapper support compress.zlib://
Stream Filter support zlib.inflate, zlib.deflate
Compiled Version 1.2.3
Linked Version 1.2.3
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .;C:\php5\pear | .;C:\php5\pear
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | name@email.com | name@email.com
sendmail_path | no value | no value
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | 60 | 60
upload_max_filesize | 32M | 32M
post_max_size | 32M | 32M
==========================
Page generated in 0.209 seconds - 16 queries in 0.077 seconds - Album set : ; Meta set: ;

Nibbler

You need to add the `login` field to your cpg146_final_extract_config table.

François Keller

QuoteYou need to add the `login` field to your cpg146_final_extract_config table.
Yes, or to uninstall the plugin and reinstall after modifying the code.
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

aravot

Quote from: Frantz on October 07, 2006, 11:03:06 PM
Yes, or to uninstall the plugin and reinstall after modifying the code.

Started with a fresh installation of CPG, made the necessary modifications but during installation of the plugin got this error
QuoteThere was an error while processing a database query.
While executing query "
QuoteFile: C:\wamp\www\cpg149\include\functions.inc.php - Line: 249

USER:
------------------
Array
(
    [ID] => d825cf6e63dc6191b0c902a78108a299
    [am] => 1
    [lang] => english
    [theme] => classic
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_name] => admin
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg149_filetypes; (0.001s)
    [1] => select * from cpg149_plugins order by priority asc; (0s)
    [2] => delete from `cpg149`.cpg149_sessions where time<1160253052 and remember=0; (0.001s)
    [3] => delete from `cpg149`.cpg149_sessions where time<1159047052; (0s)
    [4] => select user_id from `cpg149`.cpg149_sessions where session_id=md5("eccd4d60c7ce7f9507c96c2b489e21a48b80391951d67787e367e388655ff8f4"); (0s)
    [5] => select user_id as id, user_password as password from `cpg149`.cpg149_users where user_id=1 (0s)
    [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `cpg149`.cpg149_users AS u INNER JOIN `cpg149`.cpg149_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='1' (0s)
    [7] => SELECT user_group_list FROM `cpg149`.cpg149_users AS u WHERE user_id='1' and user_group_list <> ''; (0s)
    [8] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg149_usergroups WHERE group_id in (1) (0s)
    [9] => SELECT group_name FROM  cpg149_usergroups WHERE group_id= 1 (0s)
    [10] => update `cpg149`.cpg149_sessions set time='1160256652' where session_id=md5('eccd4d60c7ce7f9507c96c2b489e21a48b80391951d67787e367e388655ff8f4'); (0.001s)
    [11] => SELECT user_favpics FROM cpg149_favpics WHERE user_id = 1 (0.001s)
    [12] => DELETE FROM cpg149_banned WHERE expiry < '2006-10-07 21:30:52' (0.001s)
    [13] => SELECT * FROM cpg149_banned WHERE (ip_addr='127.0.0.1' OR ip_addr='127.0.0.1' OR user_id=1) AND brute_force=0 (0s)
    [14] => select plugin_id from cpg149_plugins where path="final_extract"; (0s)
    [15] => select priority from cpg149_plugins order by priority desc limit 1; (0s)
    [16] => INSERT INTO cpg149_config VALUES ('fex_enable', '1'); (0.001s)
    [17] =>
















CREATE TABLE IF NOT EXISTS `cpg149_final_extract_config` (
  `Group_Id` varchar(40) NOT NULL default '',
  `home` varchar(255) NOT NULL default '',
  `login` varchar(255) NOT NULL default '',
  `my_gallery` varchar(255) NOT NULL default '',
  `upload_pic` varchar(255) NOT NULL default '',
  `album_list` varchar(255) NOT NULL default '',
  `lastup` varchar(255) NOT NULL default '',
  `lastcom` varchar(255) NOT NULL default '',
  `topn` varchar(255) NOT NULL default '',
  `toprated` varchar(255) NOT NULL default '',
  `favpics` varchar(255) NOT NULL default '',
  `search` varchar(255) NOT NULL default '',
  `login` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`Group_Id`)
)TYPE=MyISAM (0.001s)
    [18] => SELECT COUNT(*) FROM cpg149_pictures WHERE approved = 'NO' (0s)
)

==========================
GET :
------------------
Array
(
    [op] => install
    [p] => final_extract
)

==========================
POST :
------------------
Array
(
    [submit] => Install
)

==========================
VERSION INFO :
------------------
PHP version: 5.1.6 - OK
------------------
mySQL version: 5.0.24a-community-nt
------------------
Coppermine version: 1.4.9(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support: 1
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XPM Support:
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 1
Client API version 5.0.24a
==========================
Module: zlib
------------------
ZLib Support enabled
Stream Wrapper support compress.zlib://
Stream Filter support zlib.inflate, zlib.deflate
Compiled Version 1.2.3
Linked Version 1.2.3
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .;C:\php5\pear | .;C:\php5\pear
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | name@email.com | name@email.com
sendmail_path | no value | no value
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | 60 | 60
upload_max_filesize | 32M | 32M
post_max_size | 32M | 32M
==========================
Page generated in 0.12 seconds - 19 queries in 0.007 seconds - Album set : ; Meta set: ;


In shema.sql shouldn't this
Quote`login` varchar(255) NOT NULL default '',
be logout instead of login

aravot

In shema.sql changing login to logout fix the error
Quote`login` varchar(255) NOT NULL default '',
to
Quote`logout` varchar(255) NOT NULL default '',

Thank you.

François Keller

Quote from: aravot on October 07, 2006, 11:40:52 PM
In shema.sql changing login to logout fix the errorto
Thank you.
Oups, I was to fast by copy/past code for the modif. Thank's
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

the_real_tisse

Hi there

I have installed your plugin, and I must say, it works like a charm, thx heaps for that!!

I hope you don't mind me asking, but how would I go about adding the 'my profile' to the list of choices?

Thx heaps in advance!

P

François Keller

Hi,

Quotehow would I go about adding the 'my profile' to the list of choices?

Same way that for logout explain a few post before  ;)
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

the_real_tisse

Hi again

Ok, I tried it, by using a $my_profile and instead of the logout I then see the my_profile and can select it.

However, when I want to implement it and make some choices, then I want to apply it, the system gives me an error that it can't write to the db.

Any thoughts or assistance? Thx in advance for your time!

P

François Keller

QuoteI want to apply it, the system gives me an error that it can't write to the db.

have you add "my_profile" field to your cpg146_final_extract_config table?
What's the error message ?
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

the_real_tisse

Hi again

yes, that field is in there, double checked.

The error message I get is: There was an error while processing a database query

In attachment the changes made. Hope that helps to find out what I did wrong.

Thx again for checking it

P