Beispiel #1
0
        $apps = 12;
        $success = true;
        break;
    default:
        $success = false;
}
$quotas = api::send('self/quota/list');
foreach ($quotas as $q) {
    if ($q['name'] == 'DISK') {
        $dquota = $q;
    }
    if ($q['name'] == 'MEMORY') {
        $mquota = $q;
    }
    if ($q['name'] == 'SERVICES') {
        $squota = $q;
    }
    if ($q['name'] == 'APPS') {
        $aquota = $q;
    }
}
if ($disk && $dquota['used'] > $disk && ($dquota['max'] <= $disk || $diskplan === true) || $ram && $mquota['used'] > $ram || $ram && $squota['used'] > $services) {
    $_SESSION['MESSAGE']['TYPE'] = 'error';
    $_SESSION['MESSAGE']['TEXT'] = $lang['impossible'];
    template::redirect($_SERVER['HTTP_REFERER']);
}
$pay = array('lang' => translator::getLanguage(), 'first' => 1, 'ip' => $_SERVER['REMOTE_ADDR'], 'email' => $userinfo['email'], 'user' => $userinfo['name'], 'plan' => security::encode($_GET['plan']));
$xpay = base64_encode(serialize($pay));
$content = "\n\t<div class=\"panel\">\n\t\t<div class=\"top\">\n\t\t\t<h1 class=\"dark\" style=\"text-align: center;\">{$lang['title']}</h1>\n\t\t</div>\n\t\t<div class=\"clear\"></div><br /><br />\n\t\t<div class=\"container\" style=\"text-align: center;\">\n\t\t\t<br />\n\t\t\t<p style=\"font-size: 18px;\">{$lang['payment_text']}</p>\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<div style=\"text-align: center;\">\n\t\t\t\t<div class=\"pay\" onclick=\"\$('#paypal').submit(); return false;\">\n\t\t\t\t\t<h3 class=\"colored\">{$lang['paypal']}</h3>\n\t\t\t\t\t<br />\n\t\t\t\t\t<form id=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" id=\"paypal\" style=\"display: none;\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"cmd\" value=\"_xclick\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"business\" value=\"contact@anotherservice.com\" />  \n\t\t\t\t\t\t<input type=\"hidden\" name=\"currency_code\" value=\"EUR\">  \n\t\t\t\t\t\t<input type=\"hidden\" name=\"item_name\" value=\"" . $lang['offer_' . security::encode($_GET['plan']) . '_title'] . "\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"amount\" value=\"" . $lang['offer_' . security::encode($_GET['plan']) . '_price'] . "\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"return\" value=\"https://www.anotherservice.com/panel/plans/landing\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"cancel_return\" value=\"https://www.anotherservice.com/panel/plans/landing\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"notify_url\" value=\"https://www.anotherservice.com/ipn_paypal\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"custom\" value=\"{$xpay}\" />\n\t\t\t\t\t\t<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif\" width=\"1\" height=\"1\" />\n\t\t\t\t\t</form>\n\t\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/illu/paypal.png\" style=\"width: 150px;\" alt=\"\" />\n\t\t\t\t</div>\n\t\t\t\t<div class=\"pay\" onclick=\"\$('#sips').submit(); return false;\">\n\t\t\t\t\t<h3 class=\"colored\">{$lang['card']}</h3>\n\t\t\t\t\t<br />\n\t\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/illu/card.png\" style=\"width: 150px;\" alt=\"\" />\n\t\t\t\t</div>\n\t\t\t\t<div class=\"pay\">\n\t\t\t\t\t<h3 class=\"colored\" style=\"color: #6a6a6a\">{$lang['transfer']}</h3>\n\t\t\t\t\t<br />\n\t\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/illu/transfer_disabled.png\" style=\"width: 150px;\" alt=\"\" />\n\t\t\t\t</div>\n\t\t\t\t<div class=\"clear\"></div><br /><br />\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<form action=\"/panel/plans/card\" method=\"post\" id=\"sips\" style=\"display: none;\">\n\t\t<input type=\"hidden\" name=\"xpay\" value=\"{$xpay}\" />\n\t\t<input type=\"hidden\" name=\"amount\" value=\"" . str_replace('.', '', sprintf("%.2f", round($lang['offer_' . security::encode($_GET['plan']) . '_price'], 2))) . "\" />\n\t\t<input type=\"hidden\" name=\"desc\" value=\"" . str_replace(' ', '&nbsp;', $lang['offer_' . security::encode($_GET['plan']) . '_title']) . "\" />\n\t</form>\t\n";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);
 /**
  * Translate provided text to requested language
  * Configured method is used (default translation is a COPY)
  *
  * @param string $source_lang_code - two-letters language code (ISO 639-1)
  * @param string $src_text
  * @param string $dest_lang_code - two-letters language code (ISO 639-1)
  * @param string $translate_method (optional)
  * @return null
  * @throws AException
  */
 public function translate($source_lang_code, $src_text, $dest_lang_code, $translate_method = '')
 {
     $this->registry->get('extensions')->hk_InitData($this, __FUNCTION__);
     if (empty($source_lang_code) || empty($src_text) || empty($dest_lang_code)) {
         return null;
     }
     //check what method is selected for translation
     if (empty($translate_method)) {
         $translate_method = $this->registry->get('config')->get('translate_method');
     }
     $extensions = $this->registry->get('extensions')->getEnabledExtensions();
     if (in_array($translate_method, $extensions)) {
         $ex_class = DIR_EXT . $translate_method . '/core/translator.php';
         if (file_exists($ex_class)) {
             /** @noinspection PhpIncludeInspection */
             require_once $ex_class;
         } else {
             throw new AException(AC_ERR_LOAD, 'Error: Could not load translations class ' . $ex_class . '!');
         }
         /** @noinspection PhpUndefinedClassInspection */
         $translate_driver = new translator($this->registry->get('config'));
         /** @noinspection PhpUndefinedMethodInspection */
         $result_txt = $translate_driver->translate($source_lang_code, $src_text, $dest_lang_code);
         if (!$result_txt) {
             $result_txt = $src_text;
         }
         ADebug::checkpoint("AlangugeManager: Translated text: {$src_text} from {$source_lang_code} to {$dest_lang_code}");
     } else {
         //fail over to default 'copy_source_text' method
         $result_txt = $src_text;
     }
     $this->registry->get('extensions')->hk_UpdateData($this, __FUNCTION__);
     return $result_txt;
 }
Beispiel #3
0
$month_translate = $lang[$month];
$userinfo = api::send('user/list', array('user' => $bill['user']['id']));
$userinfo = $userinfo[0];
$vats = array();
$credits = 0;
foreach ($bill['lines'] as $l) {
    $vats[$l['vat']]['vat'] = $vats[$l['vat']]['vat'] + ($l['amount_ati'] - $l['amount_et']);
    $vats[$l['vat']]['et'] = $vats[$l['vat']]['et'] + $l['amount_et'];
}
$content = "\n\t<div class=\"panel\">\n\t\t<div class=\"top\">\n\t\t\t<div class=\"left\">\n\t\t\t\t<h1 class=\"dark\">{$lang['bill']}</h1>\n\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/status_{$bill['status']}.png\" alt=\"\" style=\"display: block; padding: 0 10px 0 0; margin: 0 auto; float: left;\" />\n\t\t\t\t<span style=\"padding-top: 0px; display: block;\">" . $lang['status_' . $bill['status']] . "</span>\n\t\t\t</div>\n\t\t\t<div class=\"right\" style=\"width: 500px; float: right; text-align: right;\">\n\t\t\t\t<a class=\"action edit\" href=\"#\" onclick=\"\$('#add').dialog('open'); return false;\">\n\t\t\t\t\t{$lang['add']}\n\t\t\t\t</a>\n\t\t\t\t<a class=\"action push\" href=\"#\" onclick=\"\$('#send').dialog('open'); return false;\">\n\t\t\t\t\t{$lang['send']}\n\t\t\t\t</a>\n\t\t\t\t<a class=\"action print\" href=\"#\" onclick=\"window.print(); return false;\">\n\t\t\t\t\t{$lang['print']}\n\t\t\t\t</a>\n";
if ($bill['status'] == 1) {
    $content .= "\n\t\t\t\t<a class=\"action pay\" href=\"#\" onclick=\"\$('#pay').dialog('open'); return false;\">\n\t\t\t\t\t{$lang['pay']}\n\t\t\t\t</a>\n\t";
} else {
    $content .= "\n\n\t\t";
}
$content .= "\t\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div>\n\t\t</div>\n\t\t<br />\n\t\t<div class=\"container\">\n\t\t\t<div style=\"padding: 5px 10px 5px 10px; border: 1px solid #e7e7e7;\">\n\t\t\t\t<div style=\"float: left;\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<span style=\"font-weight: bold; font-size: 18px;\">Another Service</span><br />\n\t\t\t\t\t\t45 rue Joliot Curie<br />\n\t\t\t\t\t\t13382 Marseille CEDEX 13<br />\n\t\t\t\t\t\tFRANCE<br />\n\t\t\t\t\t\tSIRET 521745935 00010 - TVA FR33 521745935\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"float: right;\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t<span style=\"font-weight: bold; font-size: 18px;\">{$userinfo['organisation']}</span><br />\n\t\t\t\t\t\t" . ($userinfo['firstname'] ? "{$userinfo['firstname']} {$userinfo['lastname']}<br />" : "") . "\n\t\t\t\t\t\t" . ($userinfo['postal_address'] ? str_replace("\n", "<br />", $userinfo['postal_address']) . "<br />" : "") . "\n\t\t\t\t\t\t" . ($userinfo['postal_code'] ? "{$userinfo['postal_code']}" : "") . "\n\t\t\t\t\t\t" . ($userinfo['locality'] ? "{$userinfo['locality']}<br />" : "") . "\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\t\t\t<br />\n\t\t\t<p style=\"font-size: 18px;\">Paris, {$lang['the']} " . str_replace($month, $month_translate, date($lang['DATEFORMAT'], $bill['date'])) . "</i></p></td>\n\t\t\t<div class=\"clear\"></div><br />\n\t\t\t<h2 class=\"dark thin\">\n\t\t\t\t{$bill['name']}<br />\n\t\t\t\t<span style=\"font-size: 12px;\">" . str_replace($month, $month_translate, $bill['reference']) . "</span>\n\t\t\t</h2>\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th></th>\n\t\t\t\t\t<th>{$lang['name']}</th>\n\t\t\t\t\t<th>{$lang['description']}</th>\n\t\t\t\t\t<th>{$lang['amount_et']}</th>\n\t\t\t\t\t<th>{$lang['vat']}</th>\n\t\t\t\t\t<th>{$lang['amount_ati']}</th>\n\t\t\t\t\t<th style=\"text-align: center;\">{$lang['actions']}</th>\n\t\t\t\t</tr>\n";
foreach ($bill['lines'] as $l) {
    $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center;\"><img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/large/tag.png\" alt=\"\" style=\"display: block; margin: 0 auto;\"/></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$l['name']}</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$l['description']}</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$l['amount_et']} &euro;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">" . ($l['amount_et'] > 0 ? "{$l['vat']}%" : "") . "</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">" . ($l['amount_et'] > 0 ? "{$l['amount_ati']} &euro;" : "") . "</td>\n\t\t\t\t\t<td style=\"padding-top: 12px; text-align: center;\">\n\t\t\t\t\t\t" . ($l['amount_et'] > 0 ? "<a href=\"/admin/billing/reverse_action?id={$bill['id']}&title={$l['name']}&amount={$l['amount_et']}&vat={$l['vat']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/small/arrowLeft.png\" alt=\"\" /></a>" : "") . "\n\t\t\t\t\t\t<a href=\"/admin/billing/delete_action?id={$bill['id']}&lid={$l['id']}\"><img class=\"link\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/small/close.png\" alt=\"\" /></a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t";
}
$content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$lang['total_et']}</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$bill['amount_et']} &euro;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$lang['total_ati']}</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$bill['amount_ati']} &euro;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">&nbsp;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th></th>\n\t\t\t\t\t<th></th>\n\t\t\t\t\t<th></th>\n\t\t\t\t\t<th>{$lang['vat']}</th>\n\t\t\t\t\t<th>{$lang['base']}</th>\n\t\t\t\t\t<th>{$lang['totalvat']}</th>\n\t\t\t\t\t<th></th>\n\t\t\t\t</tr>\n";
foreach ($vats as $key => $value) {
    if ($value['vat'] != 0) {
        $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$lang['vat']} ({$key}%)</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$value['et']} &euro;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\">{$value['vat']} &euro;</td>\n\t\t\t\t\t<td style=\"padding-top: 12px;\"></td>\n\t\t\t\t</tr>\n\t\t";
    }
}
$content .= "\n\t\t\t</table>\n\t\t</div>\n\t</div>\n";
$pay = array('bill' => $bill['id'], 'lang' => translator::getLanguage(), 'ip' => $_SERVER['REMOTE_ADDR'], 'email' => $userinfo['email'], 'user' => $userinfo['name']);
$xpay = base64_encode(serialize($pay));
$content .= "\n\t<div id=\"pay\" style=\"text-align: center;\" class=\"floatingdialog\">\n\t\t<h3 class=\"center\">{$lang['pay']}</h3>\n\t\t<p style=\"text-align: center;\">{$lang['pay_text']}</p>\n\t\t<div class=\"form-small\">\t\t\n\t\t\t<form action=\"/admin/billing/pay_action\" method=\"get\" class=\"center\">\n\t\t\t\t<input id=\"id\" type=\"hidden\" value=\"{$bill['id']}\" name=\"id\" />\n\t\t\t\t<fieldset autofocus>\t\n\t\t\t\t\t<input type=\"submit\" value=\"{$lang['confirm']}\" />\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t</div>\n\t</div>\n\t<div id=\"send\" style=\"text-align: center;\" class=\"floatingdialog\">\n\t\t<h3 class=\"center\">{$lang['send']}</h3>\n\t\t<p style=\"text-align: center;\">{$lang['send_text']}</p>\n\t\t<div class=\"form-small\">\t\t\n\t\t\t<form action=\"/admin/billing/send_action\" method=\"get\" class=\"center\">\n\t\t\t\t<input id=\"id\" type=\"hidden\" value=\"{$bill['id']}\" name=\"id\" />\n\t\t\t\t<fieldset autofocus>\t\n\t\t\t\t\t<input type=\"submit\" value=\"{$lang['confirm']}\" />\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t</div>\n\t</div>\n\t<div id=\"add\" class=\"floatingdialog\">\n\t\t<h3 class=\"center\">{$lang['add']}</h3>\n\t\t<div class=\"form-small\">\t\t\n\t\t\t<form action=\"/admin/billing/add_action\" method=\"post\" class=\"center\">\n\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$bill['id']}\" />\n\t\t\t\t<fieldset>\n\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['title']}\" name=\"title\" onfocus=\"this.value = this.value=='{$lang['title']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['title']}' : this.value; this.value=='{$lang['title']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t<span class=\"help-block\">{$lang['tiptitle']}</span>\n\t\t\t\t</fieldset>\n\t\t\t\t<fieldset>\n\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['desc']}\" name=\"desc\" onfocus=\"this.value = this.value=='{$lang['desc']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['desc']}' : this.value; this.value=='{$lang['desc']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t<span class=\"help-block\">{$lang['tipdesc']}</span>\n\t\t\t\t</fieldset>\n\t\t\t\t<fieldset>\n\t\t\t\t\t<input class=\"auto\" type=\"text\" value=\"{$lang['amount']}\" name=\"amount\" onfocus=\"this.value = this.value=='{$lang['amount']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['amount']}' : this.value; this.value=='{$lang['amount']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\n\t\t\t\t\t<span class=\"help-block\">{$lang['tipamount']}</span>\n\t\t\t\t</fieldset>\n\t\t\t\t<fieldset>\n\t\t\t\t\t<select name=\"vat\">\n\t\t\t\t\t\t<option value=\"20\">20%</option>\n\t\t\t\t\t\t<option value=\"10\">10%</option>\n\t\t\t\t\t\t<option value=\"8.5\">8,5%</option>\n\t\t\t\t\t\t<option value=\"5.5\">5,5%</option>\n\t\t\t\t\t\t<option value=\"0\">0%</option>\n\t\t\t\t\t</select>\n\t\t\t\t\t<span class=\"help-block\">{$lang['tipvat']}</span>\n\t\t\t\t</fieldset>\n\t\t\t\t<fieldset autofocus>\t\n\t\t\t\t\t<input type=\"submit\" value=\"{$lang['create']}\" />\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t</div>\n\t</div>\n\t<script>\n\t\tnewFlexibleDialog('add', 550);\n\t\tnewFlexibleDialog('send', 550);\n\t\tnewFlexibleDialog('pay', 550);\n\t</script>\n";
/* ========================== OUTPUT PAGE ========================== */
$template->output($content);
Beispiel #4
0
<?php

if (!defined('PROPER_START')) {
    header("HTTP/1.0 403 Forbidden");
    exit;
}
header("Content-Type: text/xml");
$news = api::send('news/list', array('limit' => 10), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
$xml = "\n<rss version=\"2.0\">\n\t<channel> \n\t\t<title>{$lang['channel']}</title>\n\t\t<link>http://www.anotherservice.com</link>\n\t\t<description>{$lang['description']}</description>\n\t\t<language>" . translator::getLanguage() . "</language>\n\t\t<managingEditor>contact@anotherservice.com</managingEditor>\n";
foreach ($news as $n) {
    $xml .= "\n\t\t\t<item>\n\t\t\t\t<title>{$n['title']}</title>\n\t\t\t\t<link>http://www.anotherservice.com/blog/post?id={$n['id']}</link>\n\t\t\t\t<pubDate>" . date("D, d M Y H:i:s", $n['date']) . " GMT</pubDate> \n\t\t\t\t<description>{$n['description']}</description>\n\t\t\t</item>\n\t";
}
$xml .= "\n\t</channel>\n</rss>\n";
echo $xml;
Beispiel #5
0
// | 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.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/translator/pages/main/pre_process.php
//
$security_level = validate_user(SECURITY_TRANSLATOR_MGT);
/**************  include page specific files    *********************/
gen_pull_language('phreedom', 'admin');
require_once DIR_FS_WORKING . 'functions/translator.php';
require_once DIR_FS_WORKING . 'classes/translator.php';
require_once DIR_FS_MODULES . 'phreedom/classes/backup.php';
/**************   page specific initialization  *************************/
$error = false;
$translator = new translator();
$backup = new backup();
$replace = array();
$criteria = array();
history_filter();
// load the filters
$f0 = isset($_POST['action']) ? $_POST['f0'] : $_GET['f0'];
$f1 = isset($_POST['action']) ? $_POST['f1'] : $_GET['f1'];
$f2 = isset($_POST['action']) ? $_POST['f2'] : $_GET['f2'];
$f3 = isset($_POST['action']) ? $_POST['f3'] : $_GET['f3'];
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'import_go':
        // imports existing language file constants from current install
        $mod = db_prepare_input($_POST['mod']);
        $lang = db_prepare_input($_POST['lang']);
Beispiel #6
0
    exit;
}
try {
    if (!isset($_POST['code']) || !isset($_POST['email'])) {
        throw new SiteException('Invalid or missing arguments', 400, 'Parameter code or email is not present');
    }
    $result = api::send('registration/select', array('code' => $_POST['code']), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    if (count($result) == 0) {
        throw new SiteException('Invalid user/code', 400, 'No registration matches for this user/code');
    }
    if ($result[0]['date'] < time() - 864000) {
        // 10 days
        throw new SiteException('Outdated registration', 400, 'The registration is outdated : ' . date('Y-n-j', $result[0]['date']));
    }
    // INSERT USER
    $result = api::send('user/add', array('user' => strtolower($_POST['username']), 'pass' => $_POST['password'], 'email' => $_POST['email'], 'ip' => $_SERVER['HTTP_X_REAL_IP'], 'firstname' => '', 'lastname' => '', 'language' => translator::getLanguage()), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    $uid = $result['id'];
    // REGISTRATION IS OK -> DELETE REGISTRATION
    api::send('registration/delete', array('code' => $_POST['code']), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    // INSERT THE USER IN THE USERS GROUP
    api::send('group/user/add', array('user' => $uid, 'group' => 'USERS'), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    // CREATE THE FIRST TOKEN WITH BASIC ACCESS
    $result = api::send('token/insert', array('user' => $uid, 'lease' => 'never', 'name' => 'Another Service', 'grants' => 'ACCESS,SELF_SELECT,SELF_UPDATE,SELF_DELETE,SELF_GRANT_SELECT,SELF_GROUP_SELECT,SELF_GROUP_DELETE,SELF_TOKEN_INSERT,SELF_TOKEN_SELECT,SELF_TOKEN_UPDATE,SELF_TOKEN_DELETE,SELF_QUOTA_SELECT,SELF_TOKEN_GRANT_DELETE,SELF_TOKEN_GRANT_INSERT,SELF_DOMAIN_INSERT,SELF_DOMAIN_SELECT,SELF_DOMAIN_DELETE,SELF_DOMAIN_UPDATE,SELF_SUBDOMAIN_SELECT,SELF_SUBDOMAIN_UPDATE,SELF_SUBDOMAIN_INSERT,SELF_SUBDOMAIN_DELETE,SELF_ACCOUNT_DELETE,SELF_ACCOUNT_INSERT,SELF_ACCOUNT_SELECT,SELF_ACCOUNT_UPDATE,SELF_SERVICE_DELETE,SELF_SERVICE_INSERT,SELF_SERVICE_SELECT,SELF_SERVICE_UPDATE,SELF_APP_INSERT,SELF_APP_DELETE,SELF_APP_UPDATE,SELF_APP_SELECT,SELF_BILL_SELECT,SELF_BILL_INSERT,SELF_BILL_UPDATE,SELF_BILL_DELETE,SELF_STORAGE_SELECT,SELF_STORAGE_UPDATE,SELF_STORAGE_DELETE,SELF_STORAGE_INSERT,SELF_LOG_SELECT,SELF_LOG_INSERT,SELF_LOG_UPDATE,SELF_LOG_DELETE,SELF_BACKUP_SELECT,SELF_BACKUP_UPDATE,SELF_BACKUP_INSERT,SELF_BACKUP_DELETE'), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    $token = $result['token'];
    // ADD USER QUOTAS
    api::send('quota/user/add', array('user' => $uid, 'quotas' => 'APPS,DOMAINS,SERVICES,MEMORY,DISK'), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    api::send('quota/user/update', array('user' => $uid, 'quota' => 'APPS', 'max' => 0), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    api::send('quota/user/update', array('user' => $uid, 'quota' => 'DOMAINS', 'max' => 200), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    api::send('quota/user/update', array('user' => $uid, 'quota' => 'SERVICES', 'max' => 0), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    api::send('quota/user/update', array('user' => $uid, 'quota' => 'MEMORY', 'max' => 0), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
    api::send('quota/user/update', array('user' => $uid, 'quota' => 'DISK', 'max' => 0), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
Beispiel #7
0
if (!defined('PROPER_START')) {
    header("HTTP/1.0 403 Forbidden");
    exit;
}
$users = api::send('user/list', array('count' => 1), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
$apps = api::send('apps/list', array('count' => 1), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
$services = api::send('service/list', array('count' => 1), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
$domains = api::send('domain/list', array('count' => 1), $GLOBALS['CONFIG']['API_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_PASSWORD']);
$onusers = api::send('user/list', array('count' => 1), $GLOBALS['CONFIG']['API_ON_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_ON_PASSWORD'], false, $GLOBALS['CONFIG']['API_ON_HOST']);
$onapps = api::send('site/list', array('count' => 1), $GLOBALS['CONFIG']['API_ON_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_ON_PASSWORD'], false, $GLOBALS['CONFIG']['API_ON_HOST']);
$onservices = api::send('database/list', array('count' => 1), $GLOBALS['CONFIG']['API_ON_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_ON_PASSWORD'], false, $GLOBALS['CONFIG']['API_ON_HOST']);
$ondomains = api::send('domain/list', array('count' => 1), $GLOBALS['CONFIG']['API_ON_USERNAME'] . ':' . $GLOBALS['CONFIG']['API_ON_PASSWORD'], false, $GLOBALS['CONFIG']['API_ON_HOST']);
$users['count'] = $users['count'] + $onusers['count'];
$apps['count'] = $apps['count'] + $onapps['count'];
$services['count'] = $services['count'] + $onservices['count'];
$domains['count'] = $domains['count'] + $ondomains['count'];
switch (translator::getLanguage()) {
    case 'FR':
        $users['count'] = number_format($users['count'], 0, ',', ' ');
        $apps['count'] = number_format($apps['count'], 0, ',', ' ');
        $services['count'] = number_format($services['count'], 0, ',', ' ');
        $domains['count'] = number_format($domains['count'], 0, ',', ' ');
        break;
    default:
        $users['count'] = number_format($users['count']);
        $apps['count'] = number_format($apps['count']);
        $services['count'] = number_format($services['count']);
        $domains['count'] = number_format($domains['count']);
}
$content = "\n\t\t\t<div class=\"boxin small\">\n\t\t\t\t<span style=\"font-size: .8em; color: #acacac; text-transform: uppercase;\">{$lang['users']}</span><br />\n\t\t\t\t<span class=\"colored large\" style=\"display: block; margin: 0 auto; margin-bottom: 10px;\">{$users['count']}</span>\n\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/users_dark.png\" alt=\"\" style=\"width: 40px;\" />\n\t\t\t</div>\n\t\t\t<div class=\"boxin small\">\n\t\t\t\t<span style=\"font-size: .8em; color: #acacac; text-transform: uppercase;\">{$lang['apps']}</span><br />\n\t\t\t\t<span class=\"colored large\" style=\"display: block; margin: 0 auto; margin-bottom: 10px;\">{$apps['count']}</span>\n\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/apps_dark.png\" alt=\"\" style=\"width: 40px;\" />\n\t\t\t</div>\n\t\t\t<div class=\"boxin small\">\n\t\t\t\t<span style=\"font-size: .8em; color: #acacac; text-transform: uppercase;\">{$lang['services']}</span><br />\n\t\t\t\t<span class=\"colored large\" style=\"display: block; margin: 0 auto; margin-bottom: 10px;\">{$services['count']}</span>\n\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/databases_dark.png\" alt=\"\" style=\"width: 40px;\" />\n\t\t\t</div>\n\t\t\t<div class=\"boxin small\">\n\t\t\t\t<span style=\"font-size: .8em; color: #acacac; text-transform: uppercase;\">{$lang['domains']}</span><br />\n\t\t\t\t<span class=\"colored large\" style=\"display: block; margin: 0 auto; margin-bottom: 10px;\">{$domains['count']}</span>\n\t\t\t\t<img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/domains_dark.png\" alt=\"\" style=\"width: 40px;\" />\n\t\t\t</div>\n";
echo $content;