30 require_once(
"../class/config.php");
31 include_once(
"head.php");
34 "user_name" => array (
"request",
"string", FALSE),
35 "site_id" => array (
"post",
"integer", -1),
36 "right" => array (
"post",
"string", FALSE),
40 if ($user_name === FALSE)
42 $error = _(
'No piwik user specified');
47 if ($site_id != -1 && $right !== FALSE) {
48 $db->query(
"SELECT COUNT(*) AS ok FROM piwik_sites WHERE uid='$cuid' AND piwik_id='$site_id'");
52 $error = _(
"You don't own this piwik website");
56 $db->query(
"SELECT COUNT(*) AS ok FROM piwik_users WHERE uid='$cuid' AND login='$user_name'");
60 $error = _(
"You don't own this piwik user");
64 $piwik_rights = array(
"noaccess",
"view",
"admin");
65 if (in_array($right, $piwik_rights))
67 $api_data = $piwik->site_set_user_right($site_id, $user_name, $right);
68 if ($api_data === FALSE)
75 $error = _(
"This right does not exist");
82 $db->query(
"SELECT piwik_id FROM piwik_sites WHERE uid='$cuid'");
83 while (
$db->next_record())
92 $db->query(
"SELECT login FROM piwik_users WHERE uid='$cuid'");
93 while (
$db->next_record())
101 echo
"<p class=\"alert alert-danger\">$error</p>";
105 <h3><?php printf(
'%s "%s"', _(
"Rights for user"), $user_name); ?></h3>
110 $piwik_sites[ $site->idsite ] = array(
'name' => $site->name,
'url' => $site->main_url);
122 printf(
"<li>%s -> %s</li>\n",
$piwik_sites[ $access->site ][
'name'], $access->access);
128 <h3><?php printf(
'%s "%s"', _(
"Add rights to user"), $user_name); ?></h3>
133 printf(
'<li>%s <form method="post"><input type="hidden" name="site_id" value="%d">
134 <select name="right">
135 <option value="noaccess">%s</option>
136 <option value="view">%s</option>
137 <option value="admin">%s</option>
139 <input type="submit" name="add" value="ajouter" class="inb" /></form></li>', $available_user_site[
'name'], $current_id_site, _(
"noacces"), _(
"view"), _(
"admin"));
145 include_once(
"foot.php"); ?>