Advertisement:

Author Topic: GDPR Compliance and Osclass script  (Read 15544 times)

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: GDPR Compliance and Osclass script
« Reply #210 on: May 08, 2018, 11:46:17 pm »

I might have an idea, there are some developers here (I am too, but a beginner). If we can join, we can probably do this.
Someone can do the plugin for checkboxes at item post and registration form. Someone can try to create a function/plugin to export data for users. Someone can try to create a function/plugin to export user items. Someone can create a simple function/plugin to show a "Delete user" button at the user page.

It would be much easier if everybody does something.

I understand your idea, and of course is good, but the problem is:

Why osclass team do not says anything about this long topic? That was created a long time ago, and we read him, inclusive they.

They can say what is the correct path to follow, they are the correct people to do that.

I think we will lose our time with something wrong or obsolete, or with a different sctructure, when they broke the silence. That for me is time lost to do something now.

That's, I'm affraid can happens that, must sure will.

I suggest we need wait for some notice from them.

Regards

It would be perfect if the osclass team would do what is needed or at least help, but there is not too much time left. I will continue checking the forums to see if they will do something about this, but until then I will try to do something myself. I just added checkboxes to accept TOS and to show or not user data at his public profile to registration.

EDIT: Custom user fields tutorial: https://forums.osclass.org/development/changing-item-url-(in-user-account)-28145/

Regards.

Aficionado

  • Guest
Re: GDPR Compliance and Osclass script
« Reply #211 on: May 08, 2018, 11:52:56 pm »

I not will read all pages of this topic.  ???


Nice to know that, thanks. Be sure to come back when we have something ready.

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: GDPR Compliance and Osclass script
« Reply #212 on: May 09, 2018, 12:02:51 am »
Of course, I not intend interrupt anything. But on my opinion, GDPR will check big companies first with your data of users. Osclass on the list, we don't know when. So, the osclass market need add the new apdates of that GDPR right? So, I will wait for see what changes will be implanted on osclass market. They have personal data of all of world, or almost all countries in eurpean union and out.

I'm not worried with nothing until see what they will do. I bet they already started. So I need see with my eyes on my user profile, what they will do to follow something to do.

@aficionado, that is very wrong from you.

My opinion is, a big storm on a water glass so far. Learn to wait is a good think. You said your words, but I don't need do anything now. For other hand, if I ask for something to other people to do, the minimal I will do is make a list with priorities I will need. That's why I said "I not will read all the pages of this topic"... is more easy someone create a list for what is needed to do. Indeed, someone did that, but was not from you. Please, I hope you understand wrong, and now understand my reason.

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: GDPR Compliance and Osclass script
« Reply #213 on: May 09, 2018, 12:05:32 am »
Or maybe I understood wrong. Sorry @aficionado if was that, my bad. Peace. Yes I will back, but on the certain circumstances I posted here.

Thanks
Regards

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: GDPR Compliance and Osclass script
« Reply #214 on: May 09, 2018, 01:02:31 am »
Solution for dumping data about user account, alerts and items WITHOUT ARCHIVE


1. Create a new static page in admin with slug 'export' and DO NOT SHOW THE LINK in the footer.
2. Create 'page-export.php' in oc-content/themes/bender/


EDITED
Added custom fields.

EDITED
Added alerts


Code: [Select]
<?php
    
/*
     *      Osclass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2014 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    // meta tag robots
    
osc_add_hook('header','bender_nofollow_construct');

    
bender_add_body_class('page');
    
osc_current_web_theme_path('header.php') ;
?>

<h1><?php echo osc_static_page_title(); ?></h1>
<?php echo osc_static_page_text(); 

if(
osc_is_web_user_logged_in()) {
    
$baseUrl=osc_base_url();
    
$userId=osc_logged_user_id();
    
$user User::newInstance()->findByPrimaryKey($userId);

    unset(
$user['s_secret']);
    unset(
$user['s_password']);
    echo 
'<br/>*For download, save this page (if you are using a computer press CTRL+S).<br/><br/><h2>Summary account data:</h2><br/><br/>';
    foreach(
$user as $k => $v)
    {   
        if(!
is_array($v)){
            if(
$v) {echo "<b>$k: </b>$v,<br>";}
        }
        else
        {
            echo 
"<b>$k: </b><br/>";
            foreach(
$v as $country => $locale){
                echo 
" ****<b>$country:</b><br/>";
                foreach(
$locale as $lk => $lv){
                    if(
$lv) {
                        echo 
" ********<b>$lk: </b>$lv,<br/>";
                        
                    }
                    
                    
                }
                
            }

        }
        
    }

    echo 
'<br/><br/><h2>Summary alerts data:</h2><br/><br/>';
    
$alerts Alerts::newInstance()->findByUser($userIdtrue );

    foreach(
$alerts as $alert)
    {   unset(
$alert['s_secret']);
        
$alert['s_search'] = json_decode($alert['s_search'], true);

        foreach(
$alert as $k => $v)
        {
            if(!
is_array($v)) {
                echo 
"<b>$k:</b>$v</br>";
            } else {
                               
                foreach(
$v as $kk => $vv){
                    
                    if(!
is_array($vv)) {
                        echo 
"****<b> $kk:</b> $vv</br>";
                    } else {
                        foreach(
$vv as $kkk => $vvv){
                            if(
strpos($kkk'catched') >= ){
                                
$re explode("'"$vvv);
                                echo 
"********<b> $kkk:</b> $re[1]";
            
                                if(isset(
$re[3])) {
                                    echo 
" - $re[3]</br>";
                                } else {
                                    echo 
"</br>";
                                }
                            } else {
                               echo 
"********<b> $kkk:</b> $vvv</br>";
                            }
                        }
                    }
                }
            }
        }
    }


    
osc_query_item(array('author' => $userId'results_per_page' => 10000));

    echo 
'<br/><br/><h2>Summary items:</h2><br/><br/>';
    
$items=View::newInstance()->_get('customItems');

    foreach(
$items as $item)
    {   unset(
$item['s_secret']);

        foreach(
$item as $k => $v)
        {
            if(!
is_array($v)) {
                if(
$v) {
                    echo 
"<b>$k: </b>$v,<br/>";
                }
            }
            else
            {
                echo 
"<b>$k: </b><br/>";

                foreach(
$v as $country => $locale){
                    echo 
" ****<b>$country:</b><br/>";

                    foreach(
$locale as $lk => $lv){

                        if(
$lv) {
                            echo 
" ********<b>$lk: </b>$lv,<br/>";
                            
                        }
                        
                        
                    }
                    
                }

            }
            
        }

        
View::newInstance()->_exportVariableToView('metafields'Item::newInstance()->metaFields($item['pk_i_id']) );
        
$custom_fields=View::newInstance()->_get('metafields');

        foreach (
$custom_fields as $custom_field){
            echo 
'"' $custom_field['s_name'] . '": "' $custom_field['s_value'] . '"' ",<br/>";
        }
        
        
View::newInstance()->_exportVariableToView('resources'ItemResource::newInstance()->getAllResourcesFromItem($item['pk_i_id']) );
        
$pictures=View::newInstance()->_get('resources');

        foreach(
$pictures as $picture){
            echo 
'<img src="' $baseUrl $picture['s_path'] . $picture['pk_i_id'] . '.' $picture['s_extension'] . '">';
            
        }
        echo 
"<hr/>";
    }
    
} else {
    
header('Location: 'osc_base_url() . 'user/login');
}

?>


<?php if( osc_get_preference('homepage-728x90''bender') != '') { ?>
<!-- homepage ad 728x60-->
<div class="ads_728">
    <?php echo osc_get_preference('homepage-728x90''bender'); ?>
</div>
<!-- /homepage ad 728x60-->
<?php ?>
<?php osc_current_web_theme_path('footer.php') ; ?>

3. in bender's functions.php
(replaces this https://forums.osclass.org/general-help/gdpr-compliance-and-osclass/msg161276/#msg161276)

Code: [Select]
function mc_export_html_info_user($usr) {

echo '<br/><br/><span class="ui-button" onclick="window.location = \'' . osc_base_url() . 'export-pXX' . '\';">Export personal data</span>';

}
osc_add_hook('user_form', 'mc_export_html_info_user');
REPLACE XX with export's page id
« Last Edit: May 24, 2018, 10:45:04 pm by marius-ciclistu »

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: GDPR Compliance and Osclass script
« Reply #215 on: May 09, 2018, 02:08:18 am »
Hi, I admire you arround this. But I don't understand why you need an dynamic page on your code, and user need create a static page. I think you can avoid these all troubles.

A simple plugin to install, and use the proper hook after form will do the job. That page export.php file can stay inside the plugin, and will reduce code. On index.php of plugin you can add the functions needed, including your button to export with a file, someting like: require_once( 'user_form.php') . You will need  a independent form after submit button of profile settings page.

Is only my suggestion, and no needs any action, just install plugin, and the proper hook will display your custom form on profile settings on current theme. That is the first part, independently of anything, is just a proper way to do it.

I not test anything, like I said, just a suggestion to you start something to avoid other troubles on your code.

Regards

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: GDPR Compliance and Osclass script
« Reply #216 on: May 09, 2018, 08:09:49 am »
I do not use plugins so that's my way of solving this... The issue is that limit of 10 items...

Who doesn't like my solution can search another one or pay a developer to solve his need.

And I'll add some js to load all images only onclick to speed up the process for the users that don't want to save the images.

Aficionado

  • Guest
Re: GDPR Compliance and Osclass script
« Reply #217 on: May 09, 2018, 01:41:20 pm »
I do not use plugins so that's my way of solving this... The issue is that limit of 10 items...


I think the "10" limit is from here:


Aficionado

  • Guest
Re: GDPR Compliance and Osclass script
« Reply #218 on: May 09, 2018, 06:38:59 pm »
More and more big players are in sync with GDPR.

See some interesting COOKIES approach:

« Last Edit: May 09, 2018, 06:41:05 pm by Aficionado »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: GDPR Compliance and Osclass script
« Reply #219 on: May 09, 2018, 08:09:25 pm »
I solved the limit issue.
    osc_query_item(array('author' => $userId, 'results_per_page' => 10000));

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: GDPR Compliance and Osclass script
« Reply #220 on: May 09, 2018, 10:35:57 pm »
Calin, what do you think? IS this a good and "cheap"(from host space point of view) solution?

Of course each one that uses it, could customize the html/css of the page.
edit.
You do realize that now it would be easier to export your items and move them to another ads site..that means that sites like olx etc will not give their users this opportunity. :))



Next point to solve?
« Last Edit: May 09, 2018, 10:37:55 pm by marius-ciclistu »

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 450
Re: GDPR Compliance and Osclass script
« Reply #221 on: May 09, 2018, 10:38:13 pm »
Calin, what do you think? IS this a good and "cheap"(from host space point of view) solution?

Of course each one that uses it, could customize the html/css of the page.

Next point to solve?

My vision it little different and you will see that in the next update of the plugin. I am working on this.


marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: GDPR Compliance and Osclass script
« Reply #222 on: May 09, 2018, 10:44:36 pm »
Ok. I wil not see it, as I don't even look at the plugin's code:)
Anyway thanks to all. With this occasion I solved this images /items export.

I wait for other possible unhandled requirements of GDPR that I missed.

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: GDPR Compliance and Osclass script
« Reply #223 on: May 10, 2018, 11:39:19 pm »
Solution for dumping data about user account and items


1. Create a new static page in admin with slug 'export' and DO NOT SHOW THE LINK in the footer.
2. Create 'page-export.php' in oc-content/themes/bender/
EDIT

   osc_query_item("author=$userId");

    $items=View::newInstance()->_get('customItems');
This retrieves only 10 items. Does anyone know the solution to get them all?

Solved

Code: [Select]
<?php
    
/*
     *      Osclass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2014 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    // meta tag robots
    
osc_add_hook('header','bender_nofollow_construct');

    
bender_add_body_class('page');
    
osc_current_web_theme_path('header.php') ;
?>

<h1><?php echo osc_static_page_title(); ?></h1>
<?php echo osc_static_page_text(); 

if(
osc_is_web_user_logged_in()) {
    
$baseUrl=osc_base_url();
    
$userId=osc_logged_user_id();
    
$user User::newInstance()->findByPrimaryKey($userId);

    unset(
$user['s_secret']);
    unset(
$user['s_password']);
    echo 
'<br/>*For download, save this page (if you are using a computer press CTRL+S).<br/><br/><h2>Summary account data:</h2><br/><br/>';
    foreach(
$user as $k => $v)
    {   
        if(!
is_array($v)){
            if(
$v) {echo "<b>$k: </b>$v,<br>";}
        }
        else
        {
            echo 
"<b>$k: </b><br/>";
            foreach(
$v as $country => $locale){
                echo 
" ****<b>$country:</b><br/>";
                foreach(
$locale as $lk => $lv){
                    if(
$lv) {
                        echo 
" ********<b>$lk: </b>$lv,<br/>";
                        
                    }
                    
                    
                }
                
            }

        }
        
    }
        
osc_query_item(array('author' => $userId'results_per_page' => 10000));

    echo 
'<br/><br/><h2>Summary items:</h2><br/><br/>';
    
$items=View::newInstance()->_get('customItems');

    foreach(
$items as $item)
    {   unset(
$item['s_secret']);

        foreach(
$item as $k => $v)
        {
            if(!
is_array($v)) {
                if(
$v) {
                    echo 
"<b>$k: </b>$v,<br/>";
                }
            }
            else
            {
                echo 
"<b>$k: </b><br/>";

                foreach(
$v as $country => $locale){
                    echo 
" ****<b>$country:</b><br/>";

                    foreach(
$locale as $lk => $lv){

                        if(
$lv) {
                            echo 
" ********<b>$lk: </b>$lv,<br/>";
                            
                        }
                        
                        
                    }
                    
                }

            }
            
        }
        
        
View::newInstance()->_exportVariableToView('metafields'Item::newInstance()->metaFields($item['pk_i_id']) );
        
$custom_fields=View::newInstance()->_get('metafields');

        foreach (
$custom_fields as $custom_field){
            echo 
'"' $custom_field['s_name'] . '": "' $custom_field['s_value'] . '"' ",<br/>";
        }

        
View::newInstance()->_exportVariableToView('resources'ItemResource::newInstance()->getAllResourcesFromItem($item['pk_i_id']) );
        
$pictures=View::newInstance()->_get('resources');

        foreach(
$pictures as $picture){
            echo 
'<img src="' $baseUrl $picture['s_path'] . $picture['pk_i_id'] . '.' $picture['s_extension'] . '">';
            
        }
        echo 
"<hr/>";
    }
    
} else {
    
header('Location: 'osc_base_url() . 'user/login');
}

?>


<?php if( osc_get_preference('homepage-728x90''bender') != '') { ?>
<!-- homepage ad 728x60-->
<div class="ads_728">
    <?php echo osc_get_preference('homepage-728x90''bender'); ?>
</div>
<!-- /homepage ad 728x60-->
<?php ?>
<?php osc_current_web_theme_path('footer.php') ; ?>

3. in bender's functions.php
(replaces this https://forums.osclass.org/general-help/gdpr-compliance-and-osclass/msg161276/#msg161276)

Code: [Select]
function mc_export_html_info_user($usr) {

echo '<br/><br/><span class="ui-button" onclick="window.location = \'' . osc_base_url() . 'export-pXX' . '\';">Export personal data</span>';

}
osc_add_hook('user_form', 'mc_export_html_info_user');
REPLACE XX with export's page id

I used your solution on my website and it's awesome. Thanks a lot for this.

P.S.
If someone (like me) is using OsclassWizards theme, replace this code:

Code: [Select]
    osc_add_hook('header','bender_nofollow_construct');

    bender_add_body_class('page');
    osc_current_web_theme_path('header.php') ;

With this one:

Code: [Select]
    osc_add_hook('header','osclasswizards_nofollow_construct');

    osclasswizards_add_body_class('page');
    osc_current_web_theme_path('header.php') ;

EDIT: Code fixed by @marius-ciclistu, custom fields now showing.

Regards.
« Last Edit: May 12, 2018, 03:54:35 pm by patrickFromCroatia »

Aficionado

  • Guest
Re: GDPR Compliance and Osclass script
« Reply #224 on: May 11, 2018, 12:35:26 am »
https://wptavern.com/wordpress-4-9-6-beta-1-adds-tools-for-gdpr-compliance

Wordpress adds also GDPR for its own services (what kind of information is exchanged between Wordpress.org and the sites using WP script etc etc).

Read all the info, very interesting what they do and how.