Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 07:31:15 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155550 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Google Analytics in Settings  (Read 502 times)
scheltel

Offline Offline

Posts: 19


« on: August 05, 2011, 11:08:14 PM »

I want to extend the settings form to enter the Google Analytics String.

I have modified the code, but when I'm trying to save the settings,  the script tags are not submitted to the database. It seems that there anti-cross site scripting measurements are taken. Is this true? And if so, how can I bypass this behavior?
Logged
badknight
Security Team

Offline Offline

Posts: 246



WWW
« Reply #1 on: August 06, 2011, 08:46:32 AM »

show us the changes from the save.php you made for this.. maybe ther is something wrong
Logged

Ich würde gern die Welt verändern, doch Gott gibt mir den Quellcode nicht...
scheltel

Offline Offline

Posts: 19


« Reply #2 on: August 06, 2011, 10:19:17 AM »

I did not make any changes in save.php.

I have added the following 2 lines to /admin/settings/index.php

   $template->set_var(array(
                        [.... standard coding v2.8.2 ...]                        'HEADING_GOOGLE_ANAL YTICS_SETTINGS' => $HEADING['GOOGLE_ANALYTICS_SE TTINGS']                        
                        )
                  );

   // Insert language text and messages
   $template->set_var(array(
                        [.... standard coding v2.8.2 ...]
                        'TEXT_GOOGLE_ANALYTI CS_DESCRIPTION' => $TEXT['GOOGLE_ANALYTICS_DE SCRIPTION']
                        ));

Added to /templates/wb_theme/templates/settings.htt

<tr>
   <td colspan="3" style="padding-top: 10px;">
      <h2>{HEADING_GOOGLE_ANALYTICS_SETTINGS}</h2>
   </td>
</tr>
<tr>
   <td class="setting_name">{TEXT_GOOGLE_ANALYTICS_DESCRIPTION}</td>
   <td class="setting_value" colspan="2">
      <textarea name="google_analytics">{GOOGLE_ANALYTICS}</textarea>
   </td>
</tr>
<tr>
   <td>&nbsp;</td>
   <td>
      <input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
      <input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
   </td>
</tr>


Added to /install/save.php

   $settings_rows=   "INSERT INTO `".TABLE_PREFIX."settings` "
   ." (name, value) VALUES "
[.... standard coding v2.8.2 ...]
   ." ('google_analytics', '')";
   $database->query($settings_rows);


Added to /languages/[language].php
$TEXT['GOOGLE_ANALYTICS_DE SCRIPTION'] = 'Google Analytics String';
$HEADING['GOOGLE_ANALYTICS_SE TTINGS'] = 'Google Analytics Settings';


Added to /templates/[TEMPLATE_NAME]/index.php

if (function_exists('get_google_analytic s')) { get_google_analytic s(); }
?>
</body>


See attachment...
Logged
DarkViper
Development Team
*****
Offline Offline

Posts: 1253


« Reply #3 on: August 06, 2011, 10:33:29 AM »

go into /admin/settings/save.php and search for the Line:

Code: (/admin/settings/save.php)
<?php

139   $allow_tags_in_fields 
= array('website_header''website_footer');

?>

and add your new datafield to this array.

thats all


take care:
Google Analytics is a very hot iron. Especially in Germany and partly in other EU countries also, you can easily come in conflict with the privacy act and other law. Unawareness does not protect against punishment. That's why we do not include such 'features'.
« Last Edit: August 06, 2011, 10:50:45 AM by DarkViper » Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
scheltel

Offline Offline

Posts: 19


« Reply #4 on: August 06, 2011, 11:34:57 AM »

DarkViper thanks!

So Google Analytics will not be built-in in future releases?
Logged
DarkViper
Development Team
*****
Offline Offline

Posts: 1253


« Reply #5 on: August 06, 2011, 12:25:33 PM »

Definitely not.
Website Baker is used by a big amount of people who do not know many/all of the legal regulations. It would be careless of us to offer them options that they can bring into conflict with the law.

If somebody like to use GA anyway, so it's very easy to implement it in the index.php of each template.

Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!