Example #1
0
/**
 * jmd_img_selector preferences
 *
 * @param string $event
 * @param string $step
 */
function jmd_img_selector($event, $step)
{
    global $jmdImgSel, $path_to_site, $prefs;
    $out = '<div id="jmd_img_selector" style="width: 500px; margin: 0 auto">';
    if ($step === 'update') {
        $settings = array('tbWidth' => gps('tbWidth'), 'tbHeight' => gps('tbHeight'), 'imgWidth' => gps('imgWidth'), 'imgHeight' => gps('imgHeight'));
        foreach ($settings as $key => $value) {
            $jmdImgSel->upsertPref($key, $value);
        }
        $msg = $jmdImgSel->gTxt('prefs_updated');
    }
    if ($step === 'css') {
        $css = <<<CSS
//inc <img_sel.css>
CSS;
        safe_insert("txp_css", "name='jmd_img_selector', css='" . base64_encode($css) . "'");
        $msg = $jmdImgSel->gTxt('css_created');
    }
    pageTop($jmdImgSel->gTxt('prefs'), isset($msg) ? $msg : '');
    // Preferences
    $out .= form(fieldset(fieldset($jmdImgSel->input('pref_width', 'tbWidth') . $jmdImgSel->input('pref_height', 'tbHeight'), $jmdImgSel->gTxt('tb_legend')) . fieldset($jmdImgSel->input('pref_width', 'imgWidth') . $jmdImgSel->input('pref_height', 'imgHeight'), $jmdImgSel->gTxt('img_legend')) . fInput('submit', 'update', $jmdImgSel->gTxt('update')) . eInput('jmd_img_selector') . sInput('update'), $jmdImgSel->gTxt('prefs_legend')));
    // Check if CSS file exists
    $rs = safe_field('name', 'txp_css', 'name="jmd_img_selector"');
    if (empty($rs)) {
        $out .= form(fieldset(fInput('submit', 'submit', $jmdImgSel->gTxt('create_css')) . eInput('jmd_img_selector') . sInput('css'), $jmdImgSel->gTxt('css_legend')));
    }
    echo $out;
}
Example #2
0
function install_ldap_correspondances()
{
    $champs = array();
    foreach (is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : array() as $champ => $v) {
        $nom = 'ldap_' . $champ;
        $val = is_array($v) ? join(',', $v) : strval($v);
        $champs[$nom] = array('label' => _T('ldap_correspondance', array('champ' => "<tt>{$champ}</tt>")) . '<br />', 'valeur' => $val);
    }
    return !$champs ? '' : fieldset(_T('ldap_correspondance_1'), $champs, '', _T('ldap_correspondance_2') . '<br /><br />');
}
Example #3
0
function install_etape_ldap1_dist()
{
    $adresse_ldap = defined('_INSTALL_HOST_LDAP') ? _INSTALL_HOST_LDAP : 'localhost';
    $port_ldap = defined('_INSTALL_PORT_LDAP') ? _INSTALL_PORT_LDAP : 389;
    $tls_ldap = defined('_INSTALL_TLS_LDAP') ? _INSTALL_TLS_LDAP : 'non';
    $protocole_ldap = defined('_INSTALL_PROTOCOLE_LDAP') ? _INSTALL_PROTOCOLE_LDAP : 3;
    // on essaie 2 en cas d'echec
    $login_ldap = defined('_INSTALL_USER_LDAP') ? _INSTALL_USER_LDAP : '';
    $pass_ldap = defined('_INSTALL_PASS_LDAP') ? _INSTALL_PASS_LDAP : '';
    echo install_debut_html();
    echo info_etape(_T('titre_connexion_ldap'), info_progression_etape(1, 'etape_ldap', 'install/'), _T('entree_informations_connexion_ldap'));
    echo generer_form_ecrire('install', "\n<input type='hidden' name='etape' value='ldap2' />" . fieldset(_T('entree_adresse_annuaire'), array('adresse_ldap' => array('label' => _T('texte_adresse_annuaire_1'), 'valeur' => $adresse_ldap), 'port_ldap' => array('label' => _T('entree_port_annuaire') . '<br />' . _T('texte_port_annuaire'), 'valeur' => $port_ldap), 'tls_ldap' => array('label' => '<b>' . _T('tls_ldap') . '</b>', 'valeur' => $tls_ldap, 'alternatives' => array('non' => _T('item_non'), 'oui' => _T('item_oui'))), 'protocole_ldap' => array('label' => _T('protocole_ldap'), 'valeur' => $protocole_ldap, 'alternatives' => array('3' => '3', '2' => '2')))) . "\n<p>" . _T('texte_acces_ldap_anonyme_1') . '</p>' . fieldset(_T('connexion_ldap'), array('login_ldap' => array('label' => _T('texte_login_ldap_1'), 'valeur' => $login_ldap), 'pass_ldap' => array('label' => _T('entree_passe_ldap'), 'valeur' => $pass_ldap))) . bouton_suivant());
    echo install_fin_html();
}
Example #4
0
function jmd_rate_prefs($event, $step)
{
    ob_start('jmd_rate_prefs_head');
    pagetop('jmd_rate_prefs');
    echo '<div id="jmd_rate_prefs">';
    if (!$step) {
        echo fieldset(form(fInput('submit', 'install', 'Install', 'publish') . eInput('jmd_rate_prefs') . sInput('install')) . form(fInput('submit', 'uninstall', 'Uninstall', 'publish') . eInput('jmd_rate_prefs') . sInput('uninstall'), '', "verify('Are you sure you want to delete all ratings?');"), 'Setup', 'setup');
        echo fieldset(form('<label>Quantity ' . fInput('text', 'qty', 4) . '</label><br/>
				<label>Path and filename of star image ' . fInput('text', 'path', '/stars.png') . '</label><br/>
				<label>Star width' . fInput('text', 'width', 19) . '</label><br/>
				<label>Star height' . fInput('text', 'height', 18) . '</label><br/>
				<label>Container class name' . fInput('text', 'class', 'rating') . '</label><br/>' . fInput('submit', 'generate', 'Generate CSS', 'publish') . eInput('jmd_rate_prefs') . sInput('builder')), 'CSS builder');
    } elseif ($step == 'install') {
        $sql = "CREATE TABLE " . safe_pfx('jmd_rate') . "(\n\t\t\tparentid INT,\n\t\t\tvalue INT,\n\t\t\tmax_value INT,\n\t\t\tip INT UNSIGNED,\n\t\t\tPRIMARY KEY(parentid, ip)\n\t\t)";
        $create = safe_query($sql);
        if ($create) {
            echo tag('Table created successfully. ' . eLink('jmd_rate_prefs', '', '', '', 'Back to preferences?'), 'p', ' class="ok"');
        } else {
            echo tag('Database exists. ' . eLink('jmd_rate_prefs', '', '', '', 'Back to preferences?'), 'p', ' class="not-ok"');
        }
    } elseif ($step == 'uninstall') {
        safe_query("DROP TABLE IF EXISTS " . safe_pfx('jmd_rate'));
        echo tag('Table dropped. ' . eLink('jmd_rate_prefs', '', '', '', 'Back to preferences?'), 'p', ' class="ok"');
    } elseif ($step == 'builder') {
        if (is_numeric(gps('qty')) && is_numeric(gps('width')) && is_numeric(gps('height'))) {
            $qty = gps('qty');
            $w = round(gps('width'));
            $h = round(gps('height'));
            $path = htmlentities(gps('path'));
            $class = '.' . gps('class');
            echo tag('CSS', 'h1');
            echo "\n<textarea class=\"code\" cols=\"78\" rows=\"32\" id=\"jmd_rate_css\">\n{$class} {}\n\t{$class}, {$class} * {\n\t\tmargin: 0;\n\t\tborder: 0;\n\t\tpadding: 0;\n\t}\n\t{$class} ul {\n\t\theight: " . $h . "px;\n\t\tposition: relative;\n\t}\n\t\t{$class} ul, {$class} .current_rating, {$class} a:hover {\n\t\t\tbackground: url({$path});\n\t\t}\n\t\t{$class} li {\n\t\t\tlist-style: none;\n\t\t\ttext-indent: -9999px;\n\t\t}\n\t\t\t{$class} .current_rating {\n\t\t\t\tbackground-position: 0 -" . $h . "px;\n\t\t\t\tz-index: 1;\n\t\t\t}\n\t\t\t\t{$class} .current_rating, {$class} a {\n\t\t\t\t\theight: " . $h . "px;\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: 0;\n\t\t\t\t\tleft: 0;\n\t\t\t\t}\n\t\t\t{$class} a {\n\t\t\t\twidth: " . $w . "px;\n\t\t\t\theight: " . $h . "px;\n\t\t\t\toverflow: hidden;\n\t\t\t\tz-index: 3;\n\t\t\t}\n\t\t\t\t{$class} a:hover{\n\t\t\t\t\tbackground-position: left center;\n\t\t\t\t\tleft: 0;\n\t\t\t\t\tz-index: 2;\n\t\t\t\t}\n\t\t\t\t\t" . $class . "_1 a:hover { width: " . $w . "px }\n\t\t\t";
            for ($i = 2; $i <= $qty; $i++) {
                echo '
					' . $class . '_' . $i . ' a { left: ' . ($i - 1) * $w . 'px }
					' . $class . '_' . $i . ' a:hover { width: ' . $w * $i . 'px }
				';
            }
            echo '</textarea>';
        }
        echo tag(eLink('jmd_rate_prefs', '', '', '', 'Try again?'), 'p');
    } else {
        echo tag('Error.', 'h1');
    }
    echo '</div><!--//jmd_rate_prefs-->';
}
function jmd_wiki_events_prefs($event, $step)
{
    ob_start('jmd_wiki_events_prefs_head');
    // event alias
    $eName = 'jmd_wiki_events_prefs';
    pagetop($eName);
    echo '<div id="jmd_wiki_events_prefs">';
    if (!$step) {
        echo fieldset(form(fInput('submit', 'install', 'Install', 'publish') . eInput($eName) . sInput('install')) . form(fInput('submit', 'uninstall', 'Uninstall', 'publish') . eInput($eName) . sInput('uninstall'), '', "verify('Are you sure you want to delete all stored events?');"), 'Setup', 'setup');
    } elseif ($step == 'install') {
        $sql = "CREATE TABLE " . safe_pfx('jmd_wiki_events') . "(\n            title VARCHAR(15) KEY,\n            last_mod DATE,\n            contents LONGTEXT\n        )";
        $create = safe_query($sql);
        if ($create) {
            echo tag('Table created successfully. ' . eLink($eName, '', '', '', 'Back to preferences?'), 'p', ' class="ok"');
        } else {
            echo tag('Database exists. ' . eLink($eName, '', '', '', 'Back to preferences?'), 'p', ' class="not-ok"');
        }
    } elseif ($step == 'uninstall') {
        safe_query("DROP TABLE IF EXISTS " . safe_pfx('jmd_wiki_events'));
        echo tag('Table dropped. ' . eLink($eName, '', '', '', 'Back to preferences?'), 'p', ' class="ok"');
    } else {
        echo tag('Error.', 'h1');
    }
    echo '</div>';
}
Example #6
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $file_statuses;
    pagetop(gTxt('file'), $message);
    extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($permissions == '') {
            $permissions = '-1';
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'upload', 'file_replace', $id))) : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created'])) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']));
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf(gTxt('file_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))));
        } else {
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'upload', 'file_replace', $id) . form(graf(gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $condition) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . $downloads))), $form, $replace, endTable();
    }
}
Example #7
0
function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape, $jquery = true)
{
    $server_db = is_string($predef[0]) ? $predef[0] : '';
    return generer_form_ecrire('install', "\n<input type='hidden' name='etape' value='{$etape}' />" . $hidden . (_request('echec') ? "<p><b>" . _T('avis_connexion_echec_1') . "</b></p><p>" . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . "</p>" : "") . ($jquery ? http_script('', 'jquery.js') : '') . http_script('
		$(document).ready(function() {
			$("input[type=hidden][name=server_db]").each(function(){
				if ($(this).attr("value").match("sqlite*")){
					$("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide();
				}
			});
			if ($("#sql_serveur_db").length) {
				if ($("#sql_serveur_db").attr("value").match("sqlite*"))
						$("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide();
					else
						$("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").show();
				$("#sql_serveur_db").change(function(){
					if ($(this).find("option:selected").attr("value").match("sqlite*"))
						$("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").hide();
					else
						$("#install_adresse_base_hebergeur,#install_login_base_hebergeur,#install_pass_base_hebergeur").show();
				});
			}
		});') . ($server_db ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' . ($predef[0] ? '<h3>' . _T('install_serveur_hebergeur') . '</h3>' : '') : '<fieldset><legend>' . _T('install_select_type_db') . "</legend>" . '<label for="sql_serveur_db" class="p">' . _T('install_types_db_connus') . "<br /><small>(" . _T('install_types_db_connus_avertissement') . ')</small>' . '</label>' . "\n<div class='p center'><select name='server_db' id='sql_serveur_db' >\n" . join("\n", install_select_serveur()) . "\n</select></div></fieldset>") . '<div id="install_adresse_base_hebergeur">' . '<p>' . _T('texte_connexion_mysql') . '</p>' . ($predef[1] ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' : fieldset(_T('entree_base_donnee_1'), array('adresse_db' => array('label' => $db[1], 'valeur' => $db[0])))) . '</div>' . '<div id="install_login_base_hebergeur">' . ($predef[2] ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' : fieldset(_T('entree_login_connexion_1'), array('login_db' => array('label' => $login[1], 'valeur' => $login[0])))) . '</div>' . '<div id="install_pass_base_hebergeur">' . ($predef[3] ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>' : fieldset(_T('entree_mot_passe_1'), array('pass_db' => array('label' => $pass[1], 'valeur' => $pass[0])))) . '</div>' . bouton_suivant());
}
Example #8
0
function install_premier_auteur($email, $login, $nom, $pass, $hidden)
{
	return info_progression_etape(3,'etape_','install/') .
		info_etape(_T('info_informations_personnelles'),

		     "<b>"._T('texte_informations_personnelles_1')."</b>" .
			     aide ("install5") .
			     "<p>" .
			     _T('texte_informations_personnelles_2') . " " .
			     _T('info_laisser_champs_vides')
			     )
	. generer_form_ecrire('install', (
			  "\n<input type='hidden' name='etape' value='3b' />"
			  . $hidden
			  . fieldset(_T('info_identification_publique'),
				    array(
					  'nom' => array(
							 'label' => "<b>"._T('entree_signature')."</b><br />\n"._T('entree_nom_pseudo_1')."\n",
							 'valeur' => $nom
							 ),
					  'email' => array(
							   'label' => "<b>"._T('entree_adresse_email')."</b>\n",
							   'valeur' => $email
							   )
					  )
				    )

			  . fieldset(_T('entree_identifiants_connexion'),
				   array(
					 'login' => array(
							  'label' => "<b>"._T('entree_login')."</b><br />\n"._T('info_plus_trois_car')."\n",
							  'valeur' => $login
							  ),
					 'pass' => array(
							 'label' => "<b>"._T('entree_mot_passe')."</b><br />\n"._T('info_plus_cinq_car_2')."\n",
							 'valeur' => $pass
							 ),
					 'pass_verif' => array(
							       'label' => "<b>"._T('info_confirmer_passe')."</b><br />\n",
							       'valeur' => $pass
							       )
					 )
				     )
			  . bouton_suivant()));
}
Example #9
0
function yab_shop_build_checkout_form()
{
    $req1 = '';
    $state = '';
    $tou = '';
    if (yab_shop_config('order_affirmation_mail') == '1') {
        $req1 = ' yab-shop-required';
    }
    if (yab_shop_config('using_checkout_state') == '1') {
        $state = graf(tag(yab_shop_lang('checkout_state'), 'label', ' for="state"') . fInput('text', 'state|r', yab_shop_return_input('state|r'), '', '', '', '', '', 'state'), ' class="yab-shop-required yab-shop-state"');
    }
    if (yab_shop_config('using_tou_checkbox') == '1') {
        $tou = graf(checkbox('tou', '1', '0', '', 'yab-tou') . tag(yab_shop_lang('checkout_terms_of_use'), 'label', ' for="yab-tou"'), ' class="yab-shop-required tou"');
    }
    $form = tag(fieldset(graf(tag(yab_shop_lang('checkout_firstname'), 'label', ' for="firstname"') . fInput('text', 'firstname|r', yab_shop_return_input('firstname|r'), '', '', '', '', '', 'firstname'), ' class="yab-shop-required yab-shop-firstname"') . graf(tag(yab_shop_lang('checkout_surname'), 'label', ' for="surname"') . fInput('text', 'surname|r', yab_shop_return_input('surname|r'), '', '', '', '', '', 'surname'), ' class="yab-shop-required yab-shop-surname"') . graf(tag(yab_shop_lang('checkout_street'), 'label', ' for="street"') . fInput('text', 'street|r', yab_shop_return_input('street|r'), '', '', '', '', '', 'street'), ' class="yab-shop-required yab-shop-street"') . graf(tag(yab_shop_lang('checkout_city'), 'label', ' for="city" class="city"') . fInput('text', 'city|r', yab_shop_return_input('city|r'), '', '', '', '', '', 'city'), ' class="yab-shop-required yab-shop-city"') . graf(tag(yab_shop_lang('checkout_postal'), 'label', ' for="postal"') . fInput('text', 'postal|r', yab_shop_return_input('postal|r'), '', '', '', '', '', 'postal'), ' class="yab-shop-required yab-shop-zip"') . $state . graf(tag(yab_shop_lang('checkout_phone'), 'label', ' for="phone"') . fInput('text', 'phone', yab_shop_return_input('phone'), '', '', '', '', '', 'phone'), ' class="yab-shop-phone"') . graf(tag(yab_shop_lang('checkout_email'), 'label', ' for="email"') . fInput('text', 'email', yab_shop_return_input('email'), '', '', '', '', '', 'email'), ' class="yab-shop-email' . $req1 . '"') . yab_shop_checkout_payment_methods() . graf(tag(yab_shop_lang('checkout_message'), 'label', ' for="message"') . '<textarea cols="40" rows="5" name="message" id="message">' . yab_shop_return_input('message') . '</textarea>', ' class="yab-shop-text"') . $tou . graf(yab_remember_checkbox(), ' class="tou remember"') . graf(fInput('submit', 'order', yab_shop_lang('checkout_order'), 'submit'), ' class="submit"')), 'form', ' method="post" action="' . pagelinkurl(array('s' => yab_shop_config('checkout_section_name'))) . '#yab-shop-checkout-anchor" id="yab-checkout-form"');
    return $form;
}
Example #10
0
function file_edit($message = '', $id = '')
{
    global $file_base_path, $levels, $file_statuses, $txp_user, $event;
    extract(gpsa(array('name', 'title', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        $filename = sanitizeForFile($filename);
        if (!has_privs('file.edit') && !($author == $txp_user && has_privs('file.edit.own'))) {
            file_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('file'), $message);
        if ($permissions == '') {
            $permissions = '-1';
        }
        if (!has_privs('file.publish') && $status >= 4) {
            $status = 3;
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'file_replace', 'file_replace', $id, 'file-replace')), ' class="replace-file"') : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>', ' class="publish-now"') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp'), ' class="publish-at"') . n . graf('<span class="label">' . gtxt('date') . '</span>' . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created']), ' class="date posted created"') . n . graf('<span class="label">' . gTxt('time') . '</span>' . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']), ' class="time posted created"');
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf('<label for="file_title">' . gTxt('title') . '</label>: ' . fInput('text', 'title', $title, '', '', '', 40, '', 'file_title'), ' class="title"') . graf('<label for="category">' . gTxt('file_category') . '</label>' . br . treeSelectInput('category', $categories, $category), ' class="category"') . graf('<label for="description">' . gTxt('description') . '</label>' . br . text_area('description', '100', '400', $description, 'description'), ' class="description text"') . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method), '', '', 'post', 'edit-form', '', 'file_details')), ' class="file-detail exists"');
        } else {
            $ef_select = empty($existing_files) ? '' : gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1);
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'file_reassign', 'file_replace', $id, 'file-reassign') . form(graf($ef_select . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('title', $title) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method)), '', '', 'post', 'edit-form', '', 'assign_file'), ' colspan="4" style="border:0"'), ' class="file-detail not-exists"');
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(graf(gTxt('file_status') . ': ' . $condition, ' class="condition"') . graf(gTxt('file_name') . ': ' . $downloadlink, ' class="name"') . graf(gTxt('file_download_count') . ': ' . $downloads, ' class="downloads"')), ' class="file-info"'), $form, $replace, endTable() . n . '</div>';
    }
}
Example #11
0
function article_edit_form($step, $view, $from_view, $article)
{
    global $txpcfg, $txp_user, $article_vars;
    extract(get_prefs());
    extract($article);
    if ($step != 'create') {
        // Previous record?
        $prev_id = checkIfNeighbour('prev', $sPosted);
        // Next record?
        $next_id = checkIfNeighbour('next', $sPosted);
    }
    echo n . n . '<form name="article" method="post" action="index.php" enctype="multipart/form-data">';
    if ($view != 'text') {
        echo hInput('store', base64_encode(serialize($article)));
    }
    echo hInput('ID', $ID) . eInput('article') . sInput($step) . '<input type="hidden" name="view" />' . startTable('edit') . '<tr>' . n . '<td id="article-col-1">';
    if ($view == 'text') {
        //-- markup help --------------
        echo side_help($markup_body, $markup_excerpt) . '<h3 class="plain"><a href="#advanced" onclick="toggleDisplay(\'advanced\'); return false;">' . gTxt('advanced_options') . '</a></h3>', '<div id="advanced" style="display:none;">', n . graf('<label for="markup-body">' . gTxt('article_markup') . '</label>' . br . pref_markup('markup_body', $markup_body, 'markup-body')), n . graf('<label for="markup-excerpt">' . gTxt('excerpt_markup') . '</label>' . pref_markup('markup_excerpt', $markup_excerpt, 'markup-excerpt')), $allow_form_override ? graf('<label for="override-form">' . gTxt('override_default_form') . '</label>' . br . form_pop($override_form, 'override-form') . sp . popHelp('override_form')) : '', n . graf('<label for="article-image">' . gTxt('article_image') . '</label>' . sp . popHelp('article_image') . br . fInput('text', 'Image', $Image, 'edit', '', '', 22, '', 'article-image')), n . graf('<label for="url-title">' . gTxt('url_title') . '</label>' . sp . popHelp('url_title') . br . fInput('text', 'url_title', $url_title, 'edit', '', '', 22, '', 'url-title')) . '</div>

			<h3 class="plain"><a href="#recent" onclick="toggleDisplay(\'recent\'); return false;">' . gTxt('recent_articles') . '</a>' . '</h3>' . '<div id="recent" style="display:none;">';
        $recents = safe_rows_start("Title, ID", 'textpattern', "1=1 order by LastMod desc limit 10");
        if ($recents) {
            echo '<ul class="plain-list">';
            while ($recent = nextRow($recents)) {
                if (!$recent['Title']) {
                    $recent['Title'] = gTxt('untitled') . sp . $recent['ID'];
                }
                echo n . t . '<li><a href="?event=article' . a . 'step=edit' . a . 'ID=' . $recent['ID'] . '">' . escape_title($recent['Title']) . '</a></li>';
            }
            echo '</ul>';
        }
        echo '</div>';
    } else {
        echo sp;
    }
    echo '</td>' . n . '<td id="article-main">';
    //-- title input --------------
    if ($view == 'preview') {
        echo hed(gTxt('preview'), 2) . hed($Title, 1);
    } elseif ($view == 'html') {
        echo hed('XHTML', 2) . hed($Title, 1);
    } else {
        echo '<p><label for="title">' . gTxt('title') . '</label>';
        if (($Status == 4 or $Status == 5) and $step != 'create') {
            include_once txpath . '/publish/taghandlers.php';
            echo sp . sp . '[<a href="' . permlinkurl_id($ID) . '">' . gTxt('view') . '</a>]';
        }
        echo '<br />' . n . '<input type="text" id="title" name="Title" value="' . cleanfInput($Title) . '" class="edit" size="65" tabindex="1" /></p>';
    }
    //-- body --------------------
    if ($view == 'preview') {
        echo do_markup($markup_body, $Body);
    } elseif ($view == 'html') {
        $bod = do_markup($markup_body, $Body);
        echo tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($bod)), 'code');
    } else {
        echo n . graf('<label for="body">' . gTxt('body') . '</label><br />' . n . '<textarea id="body" name="Body" cols="55" rows="31" tabindex="2">' . htmlspecialchars($Body) . '</textarea>');
    }
    //-- excerpt --------------------
    if ($articles_use_excerpts) {
        if ($view == 'text') {
            echo n . graf('<label for="excerpt">' . gTxt('excerpt') . '</label>' . sp . popHelp('excerpt') . br . '<textarea id="excerpt" name="Excerpt" cols="55" rows="10" tabindex="3">' . htmlspecialchars($Excerpt) . '</textarea>');
        } else {
            echo n . '<hr width="50%" />';
            echo $view == 'preview' ? graf(do_markup($markup_excerpt, $Excerpt)) : tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars(do_markup($markup_excerpt, $Excerpt))), 'code');
        }
    }
    //-- keywords --------------
    if ($view == 'text') {
        echo n . graf('<label for="keywords">' . gTxt('keywords') . '</label>' . sp . popHelp('keywords') . br . '<textarea id="keywords" name="Keywords" cols="55" rows="5">' . htmlspecialchars(str_replace(',', ', ', $Keywords)) . '</textarea>');
        //-- custom fields --------------
        echo $custom_1_set ? custField(1, $custom_1_set, $custom_1) : '', $custom_2_set ? custField(2, $custom_2_set, $custom_2) : '', $custom_3_set ? custField(3, $custom_3_set, $custom_3) : '', $custom_4_set ? custField(4, $custom_4_set, $custom_4) : '', $custom_5_set ? custField(5, $custom_5_set, $custom_5) : '', $custom_6_set ? custField(6, $custom_6_set, $custom_6) : '', $custom_7_set ? custField(7, $custom_7_set, $custom_7) : '', $custom_8_set ? custField(8, $custom_8_set, $custom_8) : '', $custom_9_set ? custField(9, $custom_9_set, $custom_9) : '', $custom_10_set ? custField(10, $custom_10_set, $custom_10) : '';
    }
    //-- author --------------
    if ($view == "text" && $step != "create") {
        echo '<p class="small">' . gTxt('posted_by') . ': ' . htmlspecialchars($AuthorID) . ' &#183; ' . safe_strftime('%d %b %Y &#183; %X', $sPosted);
        if ($sPosted != $sLastMod) {
            echo br . gTxt('modified_by') . ': ' . htmlspecialchars($LastModID) . ' &#183; ' . safe_strftime('%d %b %Y &#183; %X', $sLastMod);
        }
        echo '</p>';
    }
    echo hInput('from_view', $view);
    echo '</td>';
    echo '<td id="article-tabs">';
    //-- layer tabs -------------------
    echo graf(tab('text', $view) . br . tab('html', $view) . br . tab('preview', $view));
    echo '</td>';
    echo '<td id="article-col-2">';
    if ($view == 'text') {
        if ($step != 'create') {
            echo n . graf(href(gtxt('create_new'), 'index.php?event=article'));
        }
        //-- prev/next article links --
        if ($step != 'create' and ($prev_id or $next_id)) {
            echo '<p>', $prev_id ? prevnext_link('&#8249;' . gTxt('prev'), 'article', 'edit', $prev_id, gTxt('prev')) : '', $next_id ? prevnext_link(gTxt('next') . '&#8250;', 'article', 'edit', $next_id, gTxt('next')) : '', '</p>';
        }
        //-- status radios --------------
        echo n . n . fieldset(status_radio($Status), gTxt('status'), 'write-status') . n . n . fieldset(n . graf('<label for="section">' . gTxt('section') . '</label> ' . '<span class="small">[' . eLink('section', '', '', '', gTxt('edit')) . ']</span>' . br . section_popup($Section, 'section')) . n . graf('<label for="category-1">' . gTxt('category1') . '</label> ' . '<span class="small">[' . eLink('category', '', '', '', gTxt('edit')) . ']</span>' . br . n . category_popup('Category1', $Category1, 'category-1')) . n . graf('<label for="category-2">' . gTxt('category2') . '</label>' . br . n . category_popup('Category2', $Category2, 'category-2')), gTxt('sort_display'), 'write-sort') . n . n . '<h3 class="plain"><a href="#more" onclick="toggleDisplay(\'more\'); return false;">' . gTxt('more') . '</a></h3>', '<div id="more" style="display: none;">';
        //-- comments stuff --------------
        if ($step == "create") {
            //Avoiding invite disappear when previewing
            $AnnotateInvite = !empty($store_out['AnnotateInvite']) ? $store_out['AnnotateInvite'] : $comments_default_invite;
            if ($comments_on_default == 1) {
                $Annotate = 1;
            }
        }
        if ($use_comments == 1) {
            echo n . n . '<fieldset id="write-comments">' . n . '<legend>' . gTxt('comments') . '</legend>';
            $comments_expired = false;
            if ($step != 'create' && $comments_disabled_after) {
                $lifespan = $comments_disabled_after * 86400;
                $time_since = time() - $sPosted;
                if ($time_since > $lifespan) {
                    $comments_expired = true;
                }
            }
            if ($comments_expired) {
                echo n . n . graf(gTxt('expired'));
            } else {
                echo n . n . graf(onoffRadio('Annotate', $Annotate)) . n . n . graf('<label for="comment-invite">' . gTxt('comment_invitation') . '</label>' . br . fInput('text', 'AnnotateInvite', $AnnotateInvite, 'edit', '', '', '', '', 'comment-invite'));
            }
            echo n . n . '</fieldset>';
        }
        if ($step == "create" and empty($GLOBALS['ID'])) {
            //-- timestamp -------------------
            //Avoiding modified date to disappear
            $persist_timestamp = !empty($store_out['year']) ? safe_strtotime($store_out['year'] . '-' . $store_out['month'] . '-' . $store_out['day'] . ' ' . $store_out['hour'] . ':' . $store_out['minute'] . ':' . $store_out['second']) : time();
            echo n . n . fieldset(n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $persist_timestamp, '', 4) . ' / ' . tsi('month', '%m', $persist_timestamp) . ' / ' . tsi('day', '%d', $persist_timestamp)) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $persist_timestamp) . ' : ' . tsi('minute', '%M', $persist_timestamp) . ' : ' . tsi('second', '%S', $persist_timestamp)), gTxt('timestamp'), 'write-timestamp');
            //-- expires -------------------
            $persist_timestamp = !empty($store_out['exp_year']) ? safe_strtotime($store_out['exp_year'] . '-' . $store_out['exp_month'] . '-' . $store_out['exp_day'] . ' ' . $store_out['exp_hour'] . ':' . $store_out['exp_minute'] . ':' . $store_out['second']) : NULLDATETIME;
            echo n . n . fieldset(n . graf(gtxt('date') . sp . tsi('exp_year', '%Y', $persist_timestamp, '', 4) . ' / ' . tsi('exp_month', '%m', $persist_timestamp) . ' / ' . tsi('exp_day', '%d', $persist_timestamp)) . n . graf(gTxt('time') . sp . tsi('exp_hour', '%H', $persist_timestamp) . ' : ' . tsi('exp_minute', '%M', $persist_timestamp) . ' : ' . tsi('exp_second', '%S', $persist_timestamp)), gTxt('expires') . sp . popHelp('expires'), 'write-expires') . n . n . '</div>';
            //-- publish button --------------
            echo has_privs('article.publish') ? fInput('submit', 'publish', gTxt('publish'), "publish", '', '', '', 4) : fInput('submit', 'publish', gTxt('save'), "publish", '', '', '', 4);
        } else {
            //-- timestamp -------------------
            if (!empty($year)) {
                $sPosted = safe_strtotime($year . '-' . $month . '-' . $day . ' ' . $hour . ':' . $minute . ':' . $second);
            }
            echo n . n . fieldset(n . graf(checkbox('reset_time', '1', $reset_time, '', 'reset_time') . '<label for="reset_time">' . gTxt('reset_time') . '</label>') . n . graf(gTxt('published_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $sPosted, '', 4) . ' / ' . tsi('month', '%m', $sPosted) . ' / ' . tsi('day', '%d', $sPosted)) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $sPosted) . ' : ' . tsi('minute', '%M', $sPosted) . ' : ' . tsi('second', '%S', $sPosted)) . n . hInput('sPosted', $sPosted) . n . hInput('sLastMod', $sLastMod) . n . hInput('AuthorID', $AuthorID) . n . hInput('LastModID', $LastModID), gTxt('timestamp'), 'write-timestamp');
            //-- expires -------------------
            if (!empty($exp_year)) {
                if (empty($exp_month)) {
                    $exp_month = 1;
                }
                if (empty($exp_day)) {
                    $exp_day = 1;
                }
                if (empty($exp_hour)) {
                    $exp_hour = 0;
                }
                if (empty($exp_minute)) {
                    $exp_minute = 0;
                }
                if (empty($exp_second)) {
                    $exp_second = 0;
                }
                $sExpires = safe_strtotime($exp_year . '-' . $exp_month . '-' . $exp_day . ' ' . $exp_hour . ':' . $exp_minute . ':' . $exp_second);
            }
            echo n . n . fieldset(n . graf(gtxt('date') . sp . tsi('exp_year', '%Y', $sExpires, '', 4) . ' / ' . tsi('exp_month', '%m', $sExpires) . ' / ' . tsi('exp_day', '%d', $sExpires)) . n . graf(gTxt('time') . sp . tsi('exp_hour', '%H', $sExpires) . ' : ' . tsi('exp_minute', '%M', $sExpires) . ' : ' . tsi('exp_second', '%S', $sExpires)) . n . hInput('sExpires', $sExpires), gTxt('expires') . sp . popHelp('expires'), 'write-expires') . n . n . '</div>';
            //-- save button --------------
            if ($Status >= 4 and has_privs('article.edit.published') or $Status >= 4 and $AuthorID == $txp_user and has_privs('article.edit.own.published') or $Status < 4 and has_privs('article.edit') or $Status < 4 and $AuthorID == $txp_user and has_privs('article.edit.own')) {
                echo fInput('submit', 'save', gTxt('save'), "publish", '', '', '', 4);
            }
        }
    }
    echo '</td></tr></table></form>';
}
Example #12
0
function install_premier_auteur($email, $login, $nom, $pass, $hidden, $auteur_obligatoire)
{
    return info_progression_etape(3, 'etape_', 'install/') . info_etape(_T('info_informations_personnelles'), "<b>" . _T('texte_informations_personnelles_1') . "</b>" . aide("install5", true) . "<p>" . ($auteur_obligatoire ? '' : _T('texte_informations_personnelles_2') . " " . _T('info_laisser_champs_vides'))) . generer_form_ecrire('install', "\n<input type='hidden' name='etape' value='3b' />" . $hidden . fieldset(_T('info_identification_publique'), array('nom' => array('label' => "<b>" . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", 'valeur' => $nom, 'required' => $auteur_obligatoire), 'email' => array('label' => "<b>" . _T('entree_adresse_email') . "</b>\n", 'valeur' => $email))) . fieldset(_T('entree_identifiants_connexion'), array('login' => array('label' => "<b>" . _T('entree_login') . "</b><br />\n" . _T('info_login_trop_court_car_pluriel', array('nb' => _LOGIN_TROP_COURT)) . "\n", 'valeur' => $login, 'required' => $auteur_obligatoire), 'pass' => array('label' => "<b>" . _T('entree_mot_passe') . "</b><br />\n" . _T('info_passe_trop_court_car_pluriel', array('nb' => _PASS_LONGUEUR_MINI)) . "\n", 'valeur' => $pass, 'required' => $auteur_obligatoire), 'pass_verif' => array('label' => "<b>" . _T('info_confirmer_passe') . "</b><br />\n", 'valeur' => $pass, 'required' => $auteur_obligatoire))) . bouton_suivant());
}
Example #13
0
function install_connexion_form($db, $login, $pass, $predef, $hidden, $etape)
{
	$server_db = (is_string($predef[0])) ? $predef[0] : '';

	return generer_form_ecrire('install', (
	  "\n<input type='hidden' name='etape' value='$etape' />"
	. $hidden
	. (_request('echec')?
			("<p><b>"._T('avis_connexion_echec_1').
			"</b></p><p>"._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3')."</p>")
			:"")

	. http_script('',  'jquery.js')
	. http_script('
		$(document).ready(function() {
			$("input[type=hidden][name=server_db]").each(function(){
				if ($(this).attr("value").match("sqlite*")){
					$("#install_adresse_base_hebergeur").hide();
					$("#install_login_base_hebergeur").hide();
					$("#install_pass_base_hebergeur").hide();
				}
			});
			$("#sql_serveur_db").change(function(){
				if ($(this).find("option:selected").attr("value").match("sqlite*")){
					$("#install_adresse_base_hebergeur").hide();
					$("#install_login_base_hebergeur").hide();
					$("#install_pass_base_hebergeur").hide();
				} else {
					$("#install_adresse_base_hebergeur").show();
					$("#install_login_base_hebergeur").show();
					$("#install_pass_base_hebergeur").show();
				}
			});
		});')

	. ($server_db
		? '<input type="hidden" name="server_db" value="'.$server_db.'" />'
			. (($predef[0])
			   ?('<h3>'._T('install_serveur_hebergeur').'</h3>')
				:'')
		: ('<fieldset><legend>'
		   ._T('install_select_type_db')
		. "</legend>"
			.'<label for="sql_serveur_db">'
			. _T('install_types_db_connus')
			// Passer l'avertissement SQLIte en  commentaire, on pourra facilement le supprimer par la suite sans changer les traductions.
			. "<br /><small>(". _T('install_types_db_connus_avertissement') .')</small>'
			.'</label>'
		. "\n<div style='text-align: center;'><select name='server_db' id='sql_serveur_db' >\n"
		.   join("\n", install_select_serveur())
		. "\n</select></div></fieldset>")
	)
	. '<div id="install_adresse_base_hebergeur">'
	. ($predef[1]
	? '<h3>'._T('install_adresse_base_hebergeur').'</h3>'
	: fieldset(_T('entree_base_donnee_1'),
		array(
			'adresse_db' => array(
				'label' => $db[1],
				'valeur' => $db[0]
			),
		)
	)
	)
	. '</div>'

	. '<div id="install_login_base_hebergeur">'
	. ($predef[2]
	? '<h3>'._T('install_login_base_hebergeur').'</h3>'
	: fieldset(_T('entree_login_connexion_1'),
		array(
			'login_db' => array(
					'label' => $login[1],
					'valeur' => $login[0]
			),
		)
	)
	)
	. '</div>'

	. '<div id="install_pass_base_hebergeur">'
	. ($predef[3]
	? '<h3>'._T('install_pass_base_hebergeur').'</h3>'
	: fieldset(_T('entree_mot_passe_1'),
		array(
			'pass_db' => array(
				'label' => $pass[1],
				'valeur' => $pass[0]
			),
		)
	)
	)
	. '</div>'

	. bouton_suivant()));

}
Example #14
0
 function i_select_radio($name, $choices, $value = '', $opts = array())
 {
     // FIXME: not sure what the itag/ltag markup should be here
     $out = array();
     foreach ($choices as $k => $v) {
         // each radio button goes inside an itag
         $out[] = radio($name, $k, $k == $value, "{$name}_{$k}") . sp . '<label for="' . $name . '_' . $k . '">' . $v . '</label>';
     }
     return tag(tag($this->label($name, $opts) . ' ' . pophelp($name), $this->ltag) . tag(fieldset(join(br . n, $out), '', $name), $this->itag), $this->rowtag);
 }
Example #15
0
 function edit_view($id = '')
 {
     global $txpcfg, $file_base_path, $levels;
     extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'method', 'publish_now')));
     if (!$id) {
         $id = gps('id');
     }
     $categories = tree_get('txp_category', NULL, "type='file'");
     $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = '{$id}'");
     if ($rs) {
         extract($rs);
         if ($permissions == '') {
             $permissions = '-1';
         }
         $file_exists = file_exists(build_file_path($file_base_path, $filename));
         $existing_files = $this->get_filenames();
         $condition = '<span class="';
         $condition .= $file_exists ? 'ok' : 'not-ok';
         $condition .= '">';
         $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
         $condition .= '</span>';
         $downloadlink = $file_exists ? $this->make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
         $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created'])) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']));
         $form = '';
         #categorySelectInput($type, $name, $val, $id
         $form = tr(td(form(graf(gTxt('file_category') . br . categorySelectInput('file', 'category', $category, 'file_category')) . graf(gTxt('filename') . br . fInput('text', 'filename', $filename, 'edit')) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $this->file_statuses(), $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput($this->event) . sInput('save') . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('method', $method))));
         echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $condition) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . $downloads))), $form, tr(td($this->file_upload_form(gTxt('file_replace'), 'file_replace', 'new_replace', $id))), endTable();
     }
 }
Example #16
0
 function body()
 {
     extract(get_prefs());
     $locale = setlocale(LC_ALL, $locale);
     $textarray = load_lang($language);
     $evt_list = safe_column('distinct event', 'txp_prefs', "type = {$this->type} and prefs_id = 1 order by {$this->event_order}");
     if (!$use_comments) {
         unset($evt_list['comments']);
     }
     foreach ($evt_list as $event) {
         $rs = safe_rows_start('*', 'txp_prefs', "type = {$this->type} and prefs_id = 1 and event = '" . doSlash($event) . "' order by position");
         $out = array();
         while ($a = nextRow($rs)) {
             $name = $a['name'];
             $widget = $this->widget($a['html']);
             if (empty($a['choices'])) {
                 // Assuming this widget function signature:
                 // $thing = $this->i_foo( [string] $name, [string] $data);
                 $thing = $this->{$widget}($name, $this->data[$name]);
             } else {
                 $choices = $this->{$a}['choices']();
                 $widget = $this->widget($a['html']);
                 // Assuming this widget function signature:
                 // $thing = $this->i_foo( [string] $name, [array of strings] $choices, [string] $data);
                 $thing = $this->{$widget}($name, $choices, $this->data[$name]);
             }
             #$out[] = tag($thing, 'tr');
             $out[] = $thing;
         }
         $set[] = fieldset(tag(join(n, $out), 'table', " id='pref-panel-{$event}'"), gTxt($event));
     }
     return join(n, $set) . n . tag($this->i_button('save'), 'table');
 }