Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
domainepublic
alternc
Commits
9f6e8276
Commit
9f6e8276
authored
Aug 25, 2012
by
Alan Garcia
Browse files
Piwik by Fser
parent
33047a01
Changes
8
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
9f6e8276
...
...
@@ -281,12 +281,18 @@ bureau/admin/menu_lang.php -text
bureau/admin/menu_logs.php -text
bureau/admin/menu_mail.php -text
bureau/admin/menu_mem.php -text
bureau/admin/menu_piwik.php -text
bureau/admin/menu_quota.php -text
bureau/admin/menu_sql.php -text
bureau/admin/menu_sta2.php -text
bureau/admin/menu_web.php -text
bureau/admin/mxlist.php -text
bureau/admin/phpinfo.php -text
bureau/admin/piwik_addaccount.php -text
bureau/admin/piwik_addsites.php -text
bureau/admin/piwik_sitelist.php -text
bureau/admin/piwik_user_dodel.php -text
bureau/admin/piwik_userlist.php -text
bureau/admin/powered2.jpg -text
bureau/admin/quota_show.php -text
bureau/admin/quotas_oneuser.php -text
...
...
@@ -351,6 +357,7 @@ bureau/class/m_mail_redirection.php -text
bureau/class/m_mail_squirrelmail.php -text
bureau/class/m_mem.php -text
bureau/class/m_mysql.php -text
bureau/class/m_piwik.php -text
bureau/class/m_quota.php -text
bureau/class/m_sta2.php -text
bureau/class/m_trash.php -text
...
...
bureau/admin/menu_piwik.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: menu_piwik.php,v 1.1 2004/05/24 15:28:42 anonymous Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file:
Purpose of file:
----------------------------------------------------------------------
*/
/* ############# PIWIK ############# */
$q
=
$quota
->
getquota
(
"piwik"
);
if
(
!
empty
(
$piwik
->
piwik_server_uri
)
&&
$q
[
"t"
]
>
0
&&
$r
[
"u"
]
>
0
)
{
?>
<div
class=
"menu-box"
>
<div
class=
"menu-title"
><img
src=
"images/stat.png"
alt=
"
<?php
__
(
"Piwik statistics"
);
?>
"
/>
<a
href=
"piwik_userlist.php"
>
<?php
__
(
"Piwik statistics"
);
?>
(
<?php
echo
$q
[
"u"
];
?>
/
<?php
echo
$q
[
"t"
];
?>
)
</a></div>
</div>
<?php
}
?>
bureau/admin/piwik_addaccount.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: piwik_addaccount.php,v 1.5 2006/01/12 01:10:48 anarcat Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Ask the required values to add a ftp account
----------------------------------------------------------------------
*/
require_once
(
"../class/config.php"
);
include_once
(
"head.php"
);
if
(
!
$quota
->
cancreate
(
"piwik"
))
{
$error
=
_
(
"You cannot add any new Piwik account, your quota is over."
);
$fatal
=
1
;
}
$fields
=
array
(
"account_name"
=>
array
(
"post"
,
"string"
,
""
),
);
getFields
(
$fields
);
if
(
empty
(
$account_name
))
{
echo
"<p class=
\"
error
\"
>"
.
_
(
"Error : missing arguments."
)
.
"</p>"
;
include_once
(
"foot.php"
);
exit
;
}
?>
<h3>
<?php
printf
(
_
(
"Creation of Piwik account
\"
%s
\"
"
),
$account_name
);
?>
</h3>
<hr
id=
"topbar"
/>
<br
/>
<?php
$infos
=
$piwik
->
user_add
(
$account_name
);
if
(
!
$infos
)
{
$error
=
$err
->
errstr
();
//if (isset($error) && $error) {
echo
"<p class=
\"
error
\"
>
$error
</p>"
;
if
(
isset
(
$fatal
)
&&
$fatal
)
{
include_once
(
"foot.php"
);
exit
();
}
}
printVar
(
$infos
);
include_once
(
"foot.php"
);
?>
bureau/admin/piwik_addsites.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: piwik_addaccount.php,v 1.5 2006/01/12 01:10:48 anarcat Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Ask the required values to add a ftp account
----------------------------------------------------------------------
*/
require_once
(
"../class/config.php"
);
include_once
(
"head.php"
);
$fields
=
array
(
"site_name"
=>
array
(
"post"
,
"string"
,
""
),
"site_urls"
=>
array
(
"post"
,
"string"
,
""
),
);
getFields
(
$fields
);
if
(
empty
(
$site_name
))
$site_name
=
$site_urls
;
if
(
empty
(
$site_name
))
{
$error
=
(
"Error : missing arguments."
);
}
elseif
(
!
$piwik
->
site_add
(
$site_name
,
$site_urls
)
)
{
$error
=
_
(
"Error during adding website.<br/>"
.
$err
->
errstr
());
}
else
{
$error
=
_
(
"Successfully add website"
);
}
include_once
(
"piwik_sitelist.php"
);
?>
bureau/admin/piwik_sitelist.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: piwik_userlist.php, author: squidly
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: listing of mail accounts
----------------------------------------------------------------------
*/
require_once
(
"../class/config.php"
);
include_once
(
"head.php"
);
if
(
isset
(
$error
)
&&
$error
)
{
echo
"<p class=
\"
error
\"
>
$error
</p>"
;
}
if
(
$quota
->
cancreate
(
"piwik"
))
{
$quotapiwik
=
$quota
->
getquota
(
'piwik'
);
if
(
$quotapiwik
[
'u'
]
>
0
)
{
?>
<h3>
<?php
__
(
"Add a new website"
);
?>
</h3>
<form
method=
"post"
action=
"piwik_addsites.php"
id=
"main"
name=
"addsites"
>
<input
type=
"text"
class=
"int"
name=
"site_urls"
size=
"50"
id=
"site_name"
maxlength=
"255"
value=
""
placeholder=
"
<?php
__
(
"URL of the website"
)
?>
"
/>
<input
type=
"submit"
name=
"submit"
class=
"inb"
value=
"
<?php
__
(
"Create"
);
?>
"
/>
</form>
<br/>
<hr/>
<?php
}
// quotapiwik > 0
}
// cancreate piwik
?>
<h3>
<?php
__
(
"Existing Piwik monitored websites"
);
?>
</h3>
<?php
$sitelist
=
$piwik
->
site_list
();
if
(
empty
(
$sitelist
)){
__
(
"No existing Piwik users"
);
}
else
{
?>
<table
class=
"tlist"
>
<tr><th/><th>
<?php
__
(
"Site name"
);
?>
</th><th
align=
center
>
<?php
__
(
"Site url"
);
?>
</th></tr>
<?php
$col
=
1
;
foreach
(
$sitelist
as
$site
){
$col
=
3
-
$col
;
?>
<tr
class=
"lst_clic
<?php
echo
$col
;
?>
"
>
<td><div
class=
"ina"
><a
href=
"#"
><img
src=
"images/delete.png"
alt=
"
<?php
__
(
"Delete"
);
?>
"
/>
<?php
__
(
"Delete"
);
?>
</a></div></td>
<td
align=
right
>
<?php
echo
$site
->
name
?>
</td>
<td>
<?php
echo
$site
->
main_url
?>
</td>
</tr>
<?php
}
// foreach userlist
}
// empty userlist
?>
</table>
<?php
include_once
(
"foot.php"
);
?>
bureau/admin/piwik_user_dodel.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: piwik_user_dodel.php,v 1.2 2003/06/10 06:45:16 root Exp $
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Delete ftp accounts
----------------------------------------------------------------------
*/
require_once
(
"../class/config.php"
);
$fields
=
array
(
"confirm_del"
=>
array
(
"post"
,
"string"
,
""
),
"login"
=>
array
(
"request"
,
"string"
,
""
),
);
getFields
(
$fields
);
if
(
empty
(
$login
))
{
$error
=
_
(
"Missing login parameters"
);
include
(
'piwik_userlist.php'
);
exit
;
}
if
(
!
empty
(
$confirm_del
)
)
{
if
(
!
$piwik
->
user_delete
(
$login
)
)
{
$error
=
$err
->
errstr
();
include
(
'piwik_userlist.php'
);
exit
;
}
}
else
{
include_once
(
'head.php'
);
?>
<h3>
<?php
__
(
"Piwik accounts deletion confirm"
);
?>
</h3>
<hr
id=
"topbar"
/>
<br
/>
<?php
printf
(
_
(
"Do you really want to delete the Piwik account %s ?"
),
$login
);
?>
<br
/>
<br
/>
<form
method=
"post"
action=
"piwik_user_dodel.php"
name=
"main"
id=
"main"
>
<input
type=
"hidden"
name=
"login"
value=
"
<?php
echo
$login
;
?>
"
/>
<input
type=
"submit"
class=
"inb"
name=
"confirm_del"
value=
"
<?php
__
(
"Delete"
)
?>
"
/>
<input
type=
"button"
class=
"inb"
name=
"cancel"
value=
"
<?php
__
(
"Cancel"
);
?>
"
onclick=
"document.location='piwik_userlist.php'"
/>
</form>
<?php
include_once
(
'foot.php'
);
exit
();
}
?>
bureau/admin/piwik_userlist.php
0 → 100644
View file @
9f6e8276
<?php
/*
$Id: piwik_userlist.php, author: squidly
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
Based on:
Valentin Lacambre's web hosting softwares: http://altern.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: listing of mail accounts
----------------------------------------------------------------------
*/
require_once
(
"../class/config.php"
);
include_once
(
"head.php"
);
if
(
isset
(
$error
)
&&
$error
)
{
echo
"<p class=
\"
error
\"
>
$error
</p>"
;
}
//Mail creation.
if
(
$quota
->
cancreate
(
"piwik"
))
{
$quotapiwik
=
$quota
->
getquota
(
'piwik'
);
?>
<h3>
<?php
__
(
"Create a new piwik account"
);
?>
</h3>
<form
method=
"post"
action=
"piwik_addaccount.php"
id=
"main"
name=
"addaccount"
>
<input
type=
"text"
class=
"int"
name=
"account_name"
size=
"20"
id=
"account_name"
maxlength=
"32"
value=
"
<?php
if
(
$quotapiwik
[
'u'
]
==
0
)
{
echo
$mem
->
user
[
"login"
];}
?>
"
/>
<input
type=
"submit"
name=
"submit"
class=
"inb"
value=
"
<?php
__
(
"Create"
);
?>
"
/>
</form>
<br/>
<hr/>
<?php
}
// cancreate piwik
if
(
$quotapiwik
[
'u'
]
>
0
)
{
?>
<h3>
<?php
__
(
"Add a new website"
);
?>
</h3>
<form
method=
"post"
action=
"piwik_addsites.php"
id=
"main"
name=
"addsites"
>
<input
type=
"text"
class=
"int"
name=
"site_urls"
size=
"50"
id=
"site_name"
maxlength=
"255"
value=
""
placeholder=
"
<?php
__
(
"URL of the website"
)
?>
"
/>
<input
type=
"submit"
name=
"submit"
class=
"inb"
value=
"
<?php
__
(
"Create"
);
?>
"
/>
</form>
<br/>
<hr/>
<?php
}
// cancreate piwik
?>
<h3>
<?php
__
(
"Existing Piwik accounts"
);
?>
</h3>
<?php
$userslist
=
$piwik
->
users_list
();
// printVar($piwik->dev());
if
(
empty
(
$userslist
)){
__
(
"No existing Piwik users"
);
}
else
{
?>
<table
class=
"tlist"
>
<tr><th/><th>
<?php
__
(
"Username"
);
?>
</th><th
align=
center
>
<?php
__
(
"Connect"
);
?>
</th></tr>
<?php
$col
=
1
;
foreach
(
$userslist
as
$user
){
$col
=
3
-
$col
;
?>
<tr
class=
"lst_clic
<?php
echo
$col
;
?>
"
>
<td><div
class=
"ina"
><a
href=
"piwik_user_dodel.php?login=
<?php
echo
urlencode
(
$user
->
login
);
?>
"
><img
src=
"images/delete.png"
alt=
"
<?php
__
(
"Delete"
);
?>
"
/>
<?php
__
(
"Delete"
);
?>
</a></div></td>
<td
align=
right
>
<?php
echo
$user
->
login
?>
</td>
<td><div
class=
"ina"
><a
href=
"
<?php
printf
(
'%s?module=Login&action=logme&login=%s&password=%s'
,
$piwik
->
url
(),
$user
->
login
,
$user
->
password
);
?>
"
target=
"_blank"
>
<?php
__
(
'Connect'
);
?>
</a></td>
</tr>
<?php
}
// foreach userlist
}
// empty userlist
?>
</table>
<?php
include_once
(
"foot.php"
);
?>
bureau/class/m_piwik.php
0 → 100644
View file @
9f6e8276
<?php
/*
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
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 General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Camille Lafitte
Purpose of file: Manage hook system.
----------------------------------------------------------------------
*/
/**
* This class manage piwik.
*
* @copyright AlternC-Team 2002-2005 http://alternc.org/
*/
class
m_piwik
{
var
$piwik_server_uri
;
var
$piwik_admin_token
;
/*---------------------------------------------------------------------------*/
/** Constructor
*/
function
m_piwik
()
{
$this
->
piwik_server_uri
=
variable_get
(
'piwik_server_uri'
,
null
);
if
(
is_null
(
$this
->
piwik_server_uri
))
{
// if not configuration var, setup one (with a default value)
variable_set
(
'piwik_server_uri'
,
''
,
'Remote Piwik server uri'
);
$this
->
piwik_server_uri
=
''
;
}
$this
->
piwik_admin_token
=
variable_get
(
'piwik_admin_token'
,
null
);
if
(
is_null
(
$this
->
piwik_admin_token
))
{
// if not configuration var, setup one (with a default value)
variable_set
(
'piwik_admin_token'
,
''
,
'Remote Piwik super-admin token'
);
$this
->
piwik_admin_token
=
''
;
}
}
/**
* Quota name
*/
function
alternc_quota_names
()
{
return
"piwik"
;
}
/* ----------------------------------------------------------------- */
/** Fonction appellée par membres quand un membre est effacé.
* @param integer $uid Numéro de membre effacé.
* @access private
*/
function
alternc_del_member
()
{
//FIXME
return
true
;
}
/* ----------------------------------------------------------------- */
/**
* Returns the used quota for the $name service for the current user.
* @param $name string name of the quota
* @return integer the number of service used or false if an error occured
* @access private
*/
function
alternc_get_quota
()
{
global
$db
,
$cuid
;
$db
->
query
(
"SELECT COUNT(id) AS nb FROM piwik_users WHERE uid='
$cuid
'"
);
$db
->
next_record
();
return
$db
->
f
(
'nb'
);
}
function
url
()
{
return
$this
->
piwik_server_uri
;
}
/***********************/
/* Users related tasks */
/***********************/
// Créé un utilisateur
// Si échoue en remote, n'enregistre rien
function
user_add
(
$user_login
,
$user_mail
=
null
)
{
global
$db
,
$mem
,
$cuid
,
$err
;
$user_login
=
$this
->
clean_user_name
(
$user_login
);
$user_pass
=
create_pass
();
$user_mail
=
$user_mail
?
$user_mail
:
$mem
->
user
[
'mail'
];
$user_mail
=
create_pass
(
4
)
.
$user_mail
;
$user_alias
=
$user_login
;
$api_data
=
$this
->
call_privileged_page
(
'API'
,
'UsersManager.addUser'
,
array
(
'userLogin'
=>
$user_login
,
'password'
=>
$user_pass
,
'email'
=>
$user_mail
,
'alias'
=>
$user_alias
),
'JSON'
);
if
(
$api_data
)
{
if
(
$api_data
->
result
===
'success'
)
{
$user
=
$this
->
get_user
(
$user_login
);
$user_creation_date
=
$user
->
date_registered
;
$db
->
query
(
"INSERT INTO piwik_users (uid, login, created_date) VALUES ('
$cuid
', '
$user_login
', '
$user_creation_date
')"
);
}
}
else
// api_data = false -> error is already filled
{
return
FALSE
;
}
}
// Edite un user
function
user_edit
()
{
//FIXME
return
true
;
}
function
get_user
(
$user_login
)
{
$api_data
=
$this
->
call_privileged_page
(
'API'
,
'UsersManager.getUser'
,
array
(
'userLogin'
=>
$user_login
));
if
(
$api_data
)
return
$api_data
[
0
];
else
return
FALSE
;
}
// Supprime l'utilisateur Piwik passé en parametre
// Ne le supprime pas localement tant que pas supprimé en remote
function
user_delete
(
$piwik_user_login
)
{
global
$db
,
$cuid
,
$err
;
$db
->
query
(
"SELECT created_date, COUNT(id) AS cnt FROM piwik_users WHERE uid='
$cuid
' AND login='
$piwik_user_login
'"
);
$db
->
next_record
();
if
(
$db
->
f
(
'cnt'
)
==
1
)
{
$api_data
=
$this
->
call_privileged_page
(
'API'
,
'UsersManager.getUser'
,
array
(
'userLogin'
=>
$piwik_user_login
));
printvar
(
$api_data
);
if
(
$api_data
[
0
]
->
date_registered
==
$db
->
f
(
'created_date'
))
echo
"equals"
;
else
echo
"non equals"
;
// $api_data = $this->call_privileged_page('API', 'UsersManager.deleteUser', array('idSite' => $site_id));
}
else
{
$err
->
raise
(
"piwik"
,
_
(
"You are not allowed to delete the statistics of this website"
));
return
FALSE
;
}
//SitesManager.deleteSite (idSite)
//FIXME
return
true
;
}
function
users_list
()
{
global
$db
,
$cuid
;
$db
->
query
(
"SELECT login FROM piwik_users WHERE uid = '
$cuid
'"
);
if
(
$db
->
num_rows
()
==
0
)
<