$userForm->addVar('change_password', $this->data['change_password']);
        }
    } else {
        $passwdButton = new CSubmit('change_password', _('Change password'), null, 'formlist');
        if ($this->data['alias'] == ZBX_GUEST_USER) {
            $passwdButton->setAttribute('disabled', 'disabled');
        }
        $userFormList->addRow(_('Password'), $passwdButton);
    }
} else {
    $userFormList->addRow(_('Password'), new CSpan(_s('Unavailable for users with %1$s.', authentication2str($data['auth_type']))));
}
// append languages to form list
$languageComboBox = new CComboBox('lang', $this->data['lang']);
$allLocalesAvailable = true;
foreach (getLocales() as $localeId => $locale) {
    if ($locale['display']) {
        // checking if this locale exists in the system. The only way of doing it is to try and set one
        // trying to set only the LC_MONETARY locale to avoid changing LC_NUMERIC
        $localeExists = setlocale(LC_MONETARY, zbx_locale_variants($localeId)) || $localeId == 'en_GB';
        $languageComboBox->addItem($localeId, $locale['name'], $localeId == $this->data['lang'] ? true : null, $localeExists);
        $allLocalesAvailable &= $localeExists;
    }
}
// restoring original locale
setlocale(LC_MONETARY, zbx_locale_variants(CWebUser::$data['lang']));
$languageError = '';
if (!function_exists('bindtextdomain')) {
    $languageError = 'Translations are unavailable because the PHP gettext module is missing.';
    $languageComboBox->attr('disabled', 'disabled');
} elseif (!$allLocalesAvailable) {
Ejemplo n.º 2
0
    if (!$array) {
        return null;
    }
    $result = array();
    foreach ($array as $v) {
        if (is_numeric($v)) {
            $result[] = array('id' => $v);
        } else {
            $result[] = array('name' => $v);
        }
    }
    return $result;
}
$error_message = '';
$targeting_stats = '';
$allLocales = getLocales();
$name = 'Campaign';
$budget = 10.0;
$error_message = null;
$act_id = 'act_' . $account_id;
if (!empty($_POST['submit'])) {
    $name = $_POST['name'];
    $budget = $_POST['budget'];
    $campaign_spec = array('name' => $name, 'daily_budget' => round($budget * 100));
    try {
        $result = $facebook->api($act_id . '/adCampaigns', 'post', $campaign_spec);
        if (!empty($result['id'])) {
            echo '<html><META HTTP-EQUIV=REFRESH CONTENT="1; URL=index.php"></html>';
            return;
        } else {
            $error_message = var_export($result, true);
 require_once "../../config.php";
 require_once "../../dist/class/class.connect.php";
 require_once "../../dist/functions/data.access.php";
 require_once "../../dist/functions/functions.php";
 $c_host = $databaselocation;
 $c_user = $databaseuser;
 $c_pass = $databasepass;
 $c_db = $databasename;
 $username = $_SESSION["username"];
 $html = file_get_contents("add-offer.html");
 $html = str_replace("{USERNAME}", $username, $html);
 $user = $_SESSION["userid"];
 $premium = $_SESSION["premium"];
 $ofertasPremium = [1, 2, 3, 4, 5];
 $maxOffer = $ofertasPremium[$premium];
 $locales = getLocales($user);
 $html_locales = "";
 $contador_locales = 0;
 foreach ($locales as $local) {
     $contador_locales++;
     $html_locales .= "<div class='panel panel-default'><div class='panel-heading'><strong>" . $local->nombre . "</strong><span style='float:right;'>Ofertas Restantes: <span class='num-offer'>{#OFERTAS}</span> <input class='reference' value='" . ($contador_locales - 1) . "' type='hidden'><button type='button' class='btn btn-default btn-xs btn-add-offer'><span class='glyphicon glyphicon-plus' aria-hidden='true'></span></button></span></div><table class='table'><thead><tr><th>#</th><th>Producto</th><th>Precio</th></tr></thead>{OFERTAS}<tr class='new-offer'><td><input class='id_local' value='" . $local->id . "' type='hidden'><button type='button' class='btn btn-primary btn-sm btn-save-offer'>Agregar</button></td><td><input class='producto' type='text'></td><td><input class='precio' type='text'></td></tr></table></div>";
     $ofertas = getOfertas($local->id);
     $html_ofertas = "";
     $contador_ofertas = 0;
     foreach ($ofertas as $oferta) {
         $contador_ofertas++;
         $html_ofertas .= "<tr><td>" . $contador_ofertas . "</td><td>" . $oferta->oferta . "</td><td>" . $oferta->precio . "</td></tr>";
     }
     $html_locales = str_replace("{#OFERTAS}", $maxOffer - $contador_ofertas, $html_locales);
     $html_locales = str_replace("{OFERTAS}", $html_ofertas, $html_locales);
 }
     $activos = getLocales(1);
     $html_locales = "";
     $contador = 0;
     foreach ($activos as $local) {
         //$aux = getRubro($local->id);
         //$rubro = $aux[0]->nombre;
         //Optimizar
         $aux = getComuna($local->comuna);
         $comuna = $aux[0]->nombre;
         $aux = getCliente($local->usuario);
         $cliente = $aux[0]->nombre;
         $acciones = "<a href='#'><span class='glyphicon glyphicon-remove' aria-hidden='true'></span></a>";
         $html_locales .= "<tr><td>" . ++$contador . "</td><td>" . utf8_encode($local->nombre) . "</td><td>" . utf8_encode($local->direccion) . "</td><td>" . utf8_encode($comuna) . "</td><td>" . $local->telefono . "</td><td>" . $local->horario . "</td><td>" . $local->mail . "</td><td>" . utf8_encode($local->descripcion) . "</td><td>" . utf8_encode($cliente) . "</td><td>" . $acciones . "</td></tr>";
     }
     $html = str_replace("{LOCALES_ACTIVOS}", $html_locales, $html);
     $inactivos = getLocales(0);
     $html_locales = "";
     $contador = 0;
     foreach ($inactivos as $local) {
         //$aux = getRubro($local->tipo);
         //$rubro = $aux[0]->nombre;
         //Optimizar
         $aux = getComuna($local->comuna);
         $comuna = $aux[0]->nombre;
         $aux = getCliente($local->usuario);
         $cliente = $aux[0]->nombre;
         $acciones = "<a href='validate-shop.php?local=" . $local->id . "'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span></a>&nbsp;" . "<a href='#'><span class='glyphicon glyphicon-remove' aria-hidden='true'></span></a>";
         $html_locales .= "<tr><td>" . ++$contador . "</td><td>" . utf8_encode($local->nombre) . "</td><td>" . utf8_encode($local->direccion) . "</td><td>" . utf8_encode($comuna) . "</td><td>" . $local->telefono . "</td><td>" . $local->horario . "</td><td>" . $local->mail . "</td><td>" . utf8_encode($local->descripcion) . "</td><td>" . utf8_encode($cliente) . "</td><td>" . $acciones . "</td></tr>";
     }
     $html = str_replace("{LOCALES_INACTIVOS}", $html_locales, $html);
 }