Commit 99e2c09c authored by clint's avatar clint

add anticommercial checkbox

parent 56fb4cc9
......@@ -74,6 +74,7 @@ if (isset($_POST['install'])) {
created INTEGER NOT NULL,
modified INTEGER,
userlevel INTEGER DEFAULT 0,
anticommercial INTEGER DEFAULT 0,
webid_uri VARCHAR(255),
avatar_uri VARCHAR(255),
active INTEGER DEFAULT 1,
......
......@@ -34,7 +34,7 @@ class User {
public $name, $email, $fullname, $bio, $location, $homepage, $error, $userlevel;
public $id, $acctid, $avatar_uri, $location_uri, $webid_uri, $laconica_profile, $journal_rss;
public $password, $has_identica, $created, $modified, $uniqueid;
public $password, $has_identica, $created, $modified, $uniqueid, $anticommercial;
/**
* User constructor
......@@ -78,6 +78,7 @@ class User {
$this->created = $row['created'];
$this->modified = $row['modified'];
$this->uniqueid = $row['uniqueid'];
$this->anticommercial = $row['anticommercial'];
$this->has_identica = preg_match('#^http://identi\.ca/#i', $this->laconica_profile);
......@@ -124,6 +125,7 @@ class User {
. 'avatar_uri=%s, '
. 'laconica_profile=%s, '
. 'journal_rss=%s, '
. 'anticommercial=%d, '
. 'modified=%d '
. 'WHERE username=%s'
, $adodb->qstr($this->email)
......@@ -138,6 +140,7 @@ class User {
, $adodb->qstr($this->avatar_uri)
, $adodb->qstr($this->laconica_profile)
, $adodb->qstr($this->journal_rss)
, (int)($this->anticommercial)
, time()
, $adodb->qstr($this->name));
......
......@@ -58,6 +58,11 @@
<td><input name="journal_rss" id="journal_rss" value="{$journal_rss|escape:'html':'UTF-8'}" /></td>
<td><a href="#dfn_journal_rss" rel="glossary">{t}What's this?{/t}</a></td>
</tr>
<tr>
<th align="right" valign="top"><label for="anticommercial">{t}Anticommercial{/t}</label></th>
<td><input name="anticommercial" id="anticommercial" type="checkbox"{if $anticommercial == 1} checked="checked"{/if} /></td>
<td><a href="#dfn_anticommercial" rel="glossary">{t}What's this?{/t}</a></td>
</tr>
<tr>
<th align="right" valign="top"><label for="password_1">{t}Password:{/t}</label></th>
<td><input name="password_1" id="password_1" type="password" value="" /></td>
......@@ -88,6 +93,12 @@
<dt id="dfn_id">WebID (FOAF)</dt>
<dd>{t escape=no}A URI that represents you in RDF. See <a href="http://esw.w3.org/topic/WebID">WebID</a> for details. If you don't know what this is, it's best to leave it blank.{/t}</dd>
<dt id="dfn_anticommercial">Anticommercial</dt>
<dd>{t escape=no}By enabling this option, you will not be shown advertisements or affiliate purchase links.{/t}</dd>
</dl>
{include file='footer.tpl'}
</dl>
{include file='footer.tpl'}
......@@ -113,6 +113,7 @@ if ($_POST['submit'])
$this_user->avatar_uri = $_POST['avatar_uri'];
$this_user->laconica_profile = $_POST['laconica_profile'];
$this_user->journal_rss = $_POST['journal_rss'];
$this_user->anticommercial = $_POST['anticommercial'] == "on" ? 1 : 0;
if (!empty( $_POST['password_1'] ))
$user->password = md5($_POST['password_1']);
......@@ -155,6 +156,7 @@ if(isset($this_user->name))
$smarty->assign('avatar_uri', $_POST['avatar_uri']);
$smarty->assign('laconica_profile', $_POST['laconica_profile']);
$smarty->assign('journal_rss', $_POST['journal_rss']);
$smarty->assign('anticommercial', $_POST['anticommercial']);
}
else
{
......@@ -167,6 +169,7 @@ if(isset($this_user->name))
$smarty->assign('avatar_uri', ($this_user->avatar_uri));
$smarty->assign('laconica_profile', ($this_user->laconica_profile));
$smarty->assign('journal_rss', ($this_user->journal_rss));
$smarty->assign('anticommercial', $this_user->anticommercial);
}
# And display the page.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment