install -d ${web_path}__/$i
done
-for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*.txt' | sed 's/^....//g'); do
+for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do
install -m 644 "web/$i" "${web_path}__/$i"
done
chmod 755 "${web_path}__/spush/brisk-spush.php"
----------+
- AUTO-MAINTENANCE
. Terms Of Service acceptance
+ DONE . print date of hard switch
DONE . TOS version
DONE . user TOS acceptance (db field)
DONE . show TOS ([show me later, yes, no]/[yes, no])
DONE . show current TOS
DONE . disable user reason integer field and remove SUSPEND state (db, php)
DONE . fix tos layout
- . opt - download TOS
- . checkbox for anonimous users with message when not checked
- . opt - button on when arrived to the bottom of the TOS
- . min - check TOS version between config file and TOS file
+ DONE . opt - download TOS
+ . opt - checkbox for anonimous users with message when not checked
+ . opt - button enabled when arrived to the bottom of the TOS only
+ . opt - check TOS version between config file and TOS file
. show guaranteer
-
. email validation
-
. account expiration
// this is the prefix path to remove from backtrace
$G_btrace_pref_sub = "/home/nastasi/web/";
+// where documents are stored
+$G_doc_path = "Obj/doc/";
+
// licence related stuff
$G_tos_vers = "2.0";
$G_tos_fname = "Obj/doc/terms-of-service_%s_%s.txt";
return sprintf('var noti = new notify_ex(gst,"%s",%d,"%s",%d,%d, %s, %d);', $text, $tout, $butt, $w, $h, ($is_opaque ? "true" : "false"), $block_time);
}
-function show_notify_document($text, $tout, $butt_arr, $confirm_func, $w, $h, $is_opaque, $block_time)
+function show_notify_document($text, $tout, $butt_arr, $confirm_func, $confirm_func_args, $w, $h, $is_opaque, $block_time)
{
log_main("SHOW_NOTIFY OPAQUE: ".$text);
$butts .= sprintf("%s'%s'", ($i == 0 ? "" : ","), $butt_arr[$i]);
}
- return sprintf('g_nd = new notify_document(gst, "%s", %d, [ %s ], %s, %d, %d, %s, %d);|',
- escpush($text), $tout, $butts, ($confirm_func == NULL ? "null" : $confirm_func), $w, $h, ($is_opaque ? "true" : "false"), $block_time);
+ return sprintf('g_nd = new notify_document(gst, "%s", %d, [ %s ], %s, %s, %d, %d, %s, %d);|',
+ escpush($text), $tout, $butts, ($confirm_func == NULL ? "null" : $confirm_func), (($confirm_func == NULL|| $confirm_func_args == NULL) ? "[]" : $confirm_func_args), $w, $h, ($is_opaque ? "true" : "false"), $block_time);
}
GLOBAL $G_splash_w, $G_topbanner, $G_with_donors, $G_with_poll;
GLOBAL $G_with_sidebanner, $G_with_sidebanner2, $G_with_splash;
GLOBAL $G_with_topbanner;
- GLOBAL $G_tos_vers, $G_tos_fname, $G_tos_dtsoft, $G_tos_dthard, $G_tos_idx;
+ GLOBAL $G_tos_vers, $G_tos_fname, $G_tos_dtsoft, $G_tos_dthard, $G_tos_idx, $G_doc_path;
if ($this->main_loop) {
return (FALSE);
'en' => ' agree '),
'btn_refuse' => array('it' => ' rifiuto ',
'en' => ' refuse '),
- 'btn_after' => array('it' => ' leggo poi ',
- 'en' => ' read later ')
+ 'btn_dload' => array('it' => ' scarico ',
+ 'en' => ' download '),
+ 'btn_later' => array('it' => ' leggo poi ',
+ 'en' => ' read later '),
+ 'toc_date_dscl' => array('it' => 'I nuovi termini di servizio entreranno in vigore il %s.',
+ 'en' => 'EN I nuovi termini di servizio entreranno in vigore il %s.')
);
class User {
protected function maincheck($get, $post, $cookie)
{
- GLOBAL $G_lang, $G_base, $mlang_user;
+ GLOBAL $G_lang, $G_base, $G_doc_path, $mlang_user;
// GLOBAL $first_loop;
GLOBAL $G_with_splash, $G_splash_content, $G_splash_interval, $G_splash_idx;
GLOBAL $G_splash_w, $G_splash_h, $G_splash_timeout;
log_rd("roomma ".$this->step);
$curtime = time();
if ($this->rec !== FALSE) {
+ $doc_filepath = $G_base.$G_doc_path.sprintf($G_tos_fname, $G_tos_vers, $G_lang);
+ $doc_filename = basename($doc_filepath);
if ($curtime > $G_tos_dtsoft || $curtime > $G_tos_dthard) {
if (versions_cmp($this->rec->tos_vers_get(), $G_tos_vers) < 0) { // comparison between user version and current version
- if ($curtime > $G_tos_dtsoft) {
- // call notify soft
- $ret .= show_notify_document(esclfhtml(file_get_contents($G_base.sprintf($G_tos_fname, $G_tos_vers, $G_lang))),
- 0, array($mlang_user['btn_agree'][$G_lang], $mlang_user['btn_refuse'][$G_lang], $mlang_user['btn_after'][$G_lang] /* , "Scarico." */),
- "tos_confirm", 600, 600, TRUE, 0);
- $ret .= sprintf("act_tosmgr('soft', g_nd.ret_get(), '%s', '%s');",
- xcape($this->rec->tos_vers_get()), xcape($G_tos_vers));
+ $buttons = array($mlang_user['btn_agree'][$G_lang], $mlang_user['btn_refuse'][$G_lang],
+ $mlang_user['btn_dload'][$G_lang]);
+ if ($curtime > $G_tos_dtsoft && $curtime < $G_tos_dthard) {
+ // call notify soft (same as soft + later button)
+ array_push($buttons, $mlang_user['btn_later'][$G_lang]);
+ $type = "soft";
+ $preface = sprintf("<div class='doc_alert'>%s</div>",
+ sprintf($mlang_user['toc_date_dscl'][$G_lang],
+ strftime("%e/%m/%Y", $G_tos_dthard)));
}
- else if ($curtime > $G_tos_dthard) {
+ else {
// call notify hard
- $ret .= show_notify_document(esclfhtml(file_get_contents($G_base.sprintf($G_tos_fname, $G_tos_vers, $G_lang))),
- 0, array($mlang_user['btn_agree'][$G_lang], $mlang_user['btn_refuse'][$G_lang] /* , "Scarico." */),
- "tos_confirm", 600, 600, TRUE, 0);
- $ret .= sprintf("act_tosmgr('hard', g_nd.ret_get(), '%s', '%s');",
- xcape($this->rec->tos_vers_get()), xcape($G_tos_vers));
+ $type = "hard";
+ $preface = "";
}
+ $ret .= show_notify_document($preface.esclfhtml(file_get_contents($doc_filepath)), 0, $buttons,
+ "tos_confirm", sprintf("[ '%s/doc_download.php?doc=%s' ]", SITE_PREFIX,
+ basename($doc_filename, ".txt")), 600, 600, TRUE, 0);
+
+ $ret .= sprintf("act_tosmgr('%s', g_nd.ret_get(), '%s', '%s');", $type,
+ xcape($this->rec->tos_vers_get()), xcape($G_tos_vers));
}
}
}
bottom: 4px;
}
+div.doc_alert {
+ color: #ff5400;
+ background-color: #ffd780;
+ font-family: monospace;
+ font-weight: bold;
+ text-align: center;
+ margin: 8px;
+ padding: 8px;
+}
+
.input_text {
background-color: #f8f8f8;
border: 1px solid gray;
'en' : '(only aut.)' },
'2' : { 'it' : '(isolam.to)',
'en' : '(isolation)' } },
- 'tos_refu' : { 'it' : 'Rifiutando di sottoscrivere i nuovi termini del servizio non ti sarà più possibile accedere col tuo utente registrato al sito, sei proprio sicuro di non voler accettare le nuove condizioni d\'uso ?',
- 'en' : 'EN Rifiutando di sottoscrivere i nuovi termini del servizio non ti sarà più possibile accedere col tuo utente registrato al sito, sei proprio sicuro di non voler accettare le nuove condizioni d\'uso ?',
+ 'tos_refu' : { 'it' : 'Rifiutando di sottoscrivere i nuovi termini del servizio non ti sarà più possibile accedere come utente registrato al sito, sei proprio sicuro di voler rifiutare le nuove condizioni d\'uso ?',
+ 'en' : 'EN Rifiutando di sottoscrivere i nuovi termini del servizio non ti sarà più possibile accedere come utente registrato al sito, sei proprio sicuro di voler rifiutare le nuove condizioni d\'uso ?'
}
};
/*
type - 'hard' or 'soft'
- code - if soft: accept (0), refuse (1), after (2)
- if hard: accept (0), refuse (1)
+ code - if soft: accept (0), refuse (1), download (2), later (3)
+ if hard: accept (0), refuse (1), download (2)
*/
function act_tosmgr(type, code, tos_curr, tos_vers)
{
default:
break;
}
+
return true;
}
-function tos_confirm(val)
+function tos_confirm(val, url)
{
- if (val == 1) {
+ var dlm;
+
+ switch (val) {
+ case 1:
return (window.confirm(mlang_commons['tos_refu'][g_lang]));
+ break;
+ case 2:
+ dlm = new download_mgr(url);
+ return false;
+ break;
+ default:
+ return true;
+ break;
}
-
- return true;
}
/*
block_time:
*/
-function notify_document(st, text, tout, butt, confirm_func, w, h, is_opa, block_time)
+function notify_document(st, text, tout, butt, confirm_func, confirm_func_args, w, h, is_opa, block_time)
{
var i, clo, clodiv_ctx, clodiv_wai, box;
this.ancestor = document.body;
this.confirm_func = confirm_func;
-
+ this.confirm_func_args = confirm_func_args;
this.st.st_loc_new++;
clodiv_ctx = document.createElement("div");
tblkid: null,
confirm_func: null,
+ confirm_func_args: [],
ret: -1,
hide: function(val)
{
if (this.confirm_func != null) {
- if (this.confirm_func(val) == false) {
+ var args;
+
+ args = [ val ].concat(this.confirm_func_args);
+
+ if (this.confirm_func.apply(null, args) == false) {
return false;
}
}
return (host+path+url);
}
}
+
+function download_mgr(url)
+{
+ var ifra;
+
+ if ((ifra = $('the_downloader')) == null) {
+ ifra = document.createElement("iframe");
+ ifra.style.display = "none";
+ ifra.id = 'the_downloader';
+ document.body.appendChild(ifra);
+ }
+
+ ifra.contentWindow.location.href = url;
+
+ this.ifra = ifra;
+}
+
+download_mgr.prototype = {
+ ifra: null
+}
--- /dev/null
+<?php
+require_once("Obj/brisk.phh");
+
+function main()
+{
+ GLOBAL $G_doc_path, $_GET;
+
+ if (! isset($_GET['doc'])) {
+ return(FALSE);
+ }
+
+ $fname = sprintf("%s%s.pdf", $G_doc_path, basename($_GET['doc']));
+ if (! file_exists($fname)) {
+ return(FALSE);
+ }
+
+ header("Content-Type: application/octet-stream");
+ header(sprintf("Content-Disposition: attachment; filename=brisk_%s", basename($fname)));
+ readfile($fname);
+ return(TRUE);
+}
+
+main();
+?>
\ No newline at end of file