25 require_once(
"../class/config.php");
26 include_once(
"head.php");
27 include_once(
"piwik_utils.php");
30 "site_id" => array (
"request",
"integer", -1),
31 "right" => array (
"request",
"array", FALSE),
40 if ($quota->cancreate(
"piwik")) {
47 <h3><?php
__(
"Add a new website");?></h3>
49 echo
$msg->msg_html_all(
true,
true);
51 <form method=
"post" action=
"piwik_addsites.php" id=
"main" name=
"addsites" >
53 <input type=
"text" class=
"int" name=
"site_urls" size=
"50" id=
"site_name" maxlength=
"255" value=
"" placeholder=
"<?php __("URL of the website
")?>"/>
54 <input type=
"submit" name=
"submit" class=
"inb" value=
"<?php __("Create
"); ?>" />
62 $msg->raise(
"INFO",
"piwik", _(
"You cannot add any new Piwik sites, your quota is over."));
76 <h3><?php
__(
"Existing Piwik monitored websites"); ?></h3>
83 if ($right !== FALSE) {
86 $msg->raise(
"ERROR",
"piwik", _(
"You don't own this piwik site!"));
89 if ($site->id == $site_id)
94 foreach ($right AS
$user => $cred) {
98 $msg->raise(
"ERROR",
"piwik", _(
'You dont own user'),
$user);
103 if ($v[
'login'] ==
$user && $v[
'cred'] != $cred) {
105 if (!$piwik->site_set_user_right($site_id,
$user, $cred)) {
108 $msg->raise(
"INFO",
"piwik", _(
"Account '%s' has been given '%s' rights on '%s'"), array(
$user, $cred,
$domain));
118 echo
$msg->msg_html_all();
122 __(
"No existing Piwik websites");
127 <table
class=
"tlist">
128 <tr><th/><th><?php
__(
"Site name");?></th><th align=center><?php
__(
"Site url"); ?></th><th>Javascript Code</th><th>Interface</th></tr>
137 $list_users=
"<select name='list_users_".$site->id.
"' id='list_users_".$site->id.
"' onChange='change_url(".$site->id.
", this);'>";
139 if ($v[
'cred'] !=
'noaccess') {
140 $list_users .=
"<option value='".$piwik->url().
"?module=Login&action=logme&login=".$v[
'login'].
"&idSite=".$site->id.
"&password=".$v[
'password'].
"'>".$v[
'login'].
"</option>";
142 $first_url = $piwik->url().
"?module=Login&action=logme&login=".$v[
'login'].
"&idSite=".$site->id.
"&password=".$v[
'password'];
147 $list_users .=
"</select>";
150 <tr
class=
"lst_clic<?php echo $col; ?>">
151 <td><div
class=
"ina"><a href=
"/piwik_site_dodel.php?siteid=<?php echo $site->id; ?>"><img src=
"images/delete.png" alt=
"<?php __("Delete
"); ?>" /><?php
__(
"Delete"); ?></a></div></td>
152 <td><?php echo $site->name ?></td>
153 <td><?php echo $site->main_url ?></td>
154 <td><textarea><?php echo $piwik->site_js_tag($site->id); ?></textarea></td>
160 <a
id=
"connect_<?php echo $site->id; ?>" href=
"<?php echo $first_url; ?>" target=
"_blank"><?php
__(
'Connect as'); ?></a>
165 <img src=
"images/warning.png" onmouseover=
'$("#alert_div_msg").show();' onmouseout=
'$("#alert_div_msg").hide();'>
183 <h3><?php
__(
"Credentials management"); ?></h3>
185 <form method=
"get" action=
"piwik_sitelist.php">
186 <select name=
"site_id">
190 printf (
'<option value="%d"%s>%s</option>', $site->id, ($site->id == $site_id) ?
' selected ' :
'', $site->name);
194 <input type=
"submit" class=
"inb" value=
"ok" />
200 echo
'<form method="post">';
203 foreach ($piwik->get_users_access_from_site($site_id) AS $piwik_user => $cred) {
204 printf(
"<dt>%s:</dt>\n\t<dd>%s</dd>\n", $piwik_user,
piwik_right_widget(
'right', $piwik_user, $cred));
207 echo
'<input type="submit" name="valid" class="inb" value="' , _(
"submit"),
'" />';
212 <div
class=
"ina" id=
"alert_div_msg" style=
"display:none;background-color:yellow;padding:5px;border:2px solid black;margin-top:3em;";>
213 <?php
__(
"No user may access this site") ?>
216 <script type=
"text/javascript">
217 function change_url(
id, elt) {
218 document.getElementById(
"connect_" +
id).href = elt.value;
222 <?php include_once(
"foot.php"); ?>
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
$fields
Listing of piwik site, and manage associated credentials.
piwik_right_widget($name, $subname, $cred)