Example #1
0
function categorySelectInput($type, $name, $val, $id, $onchange = 0, $parent_id = NULL)
{
    $rs = tree_get('txp_category', $parent_id, "parent > 0 and type='" . doSlash($type) . "'");
    if ($rs) {
        return treeSelectInput($name, $rs, $val, $id, $onchange, 1, 'name');
    }
    return false;
}
Example #2
0
function parent_pop($name, $type)
{
    $rs = getTree("root", $type);
    if ($rs) {
        return ' ' . treeSelectInput('parent', $rs, $name);
    }
    return 'no categories created';
}
function oui_prefs_category_list($name, $val)
{
    $rs = getTree('root', '');
    if ($rs) {
        return treeSelectInput($name, $rs, $val);
    }
    return gtxt('no_categories_exist');
}
function oui_prefs_cat_article_list($name, $val)
{
    $rs = getTree('root', 'article', "title != 'default' ORDER BY id, title");
    if ($rs) {
        return treeSelectInput($name, $rs, $val);
    }
    return gtxt('no_categories_exist');
}
Example #5
0
function linkcategory_popup($cat = "")
{
    $arr = array('');
    $rs = getTree("root", "link");
    if ($rs) {
        return treeSelectInput("category", $rs, $cat);
    }
    return false;
}
Example #6
0
 function cat_parent_pop($input_name, $type, $id, $current_parent)
 {
     $id = assert_int($id);
     list($lft, $rgt) = array_values(safe_row('lft, rgt', 'txp_category', 'id = ' . $id));
     #			$rs = getTree('root', $type, "lft not between $lft and $rgt");
     $rs = tree_get('txp_category', NULL, "parent != 0 and type='" . doSlash($type) . "' and lft not between {$lft} and {$rgt}");
     if ($rs) {
         return treeSelectInput($input_name, $rs, $current_parent);
     }
     return gTxt('no_other_categories_exist');
 }
Example #7
0
function cat_parent_pop($name, $type, $id)
{
    if ($id) {
        $id = assert_int($id);
        list($lft, $rgt) = array_values(safe_row('lft, rgt', 'txp_category', 'id = ' . $id));
        $rs = getTree('root', $type, "lft not between {$lft} and {$rgt}");
    } else {
        $rs = getTree('root', $type);
    }
    if ($rs) {
        return treeSelectInput('parent', $rs, $name);
    }
    return gTxt('no_other_categories_exist');
}
Example #8
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    global $txpcfg, $img_dir;
    pagetop('image', $message);
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id='{$id}'");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf(gTxt('image_name') . br . fInput('text', 'name', $name, 'edit')) . graf(gTxt('image_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('alt_text') . br . fInput('text', 'alt', $alt, 'edit', '', '', 50)) . graf(gTxt('caption') . br . text_area('caption', '100', '400', $caption)) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save')))), endTable();
    }
}
Example #9
0
function pagetop($pagetitle, $message = "")
{
    global $siteurl, $sitename, $txp_user, $event, $step, $app_mode, $theme;
    if ($app_mode == 'async') {
        return;
    }
    $area = gps('area');
    $event = !$event ? 'article' : $event;
    $bm = gps('bm');
    $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'");
    $GLOBALS['privs'] = $privs;
    $areas = areas();
    $area = false;
    foreach ($areas as $k => $v) {
        if (in_array($event, $v)) {
            $area = $k;
            break;
        }
    }
    if (gps('logout')) {
        $body_id = 'page-logout';
    } elseif (!$txp_user) {
        $body_id = 'page-login';
    } else {
        $body_id = 'page-' . htmlspecialchars($event);
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
    echo LANG;
    ?>
" lang="<?php 
    echo LANG;
    ?>
" dir="<?php 
    echo gTxt('lang_dir');
    ?>
">
	<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<title>Txp &#8250; <?php 
    echo htmlspecialchars($sitename);
    ?>
 &#8250; <?php 
    echo escape_title($pagetitle);
    ?>
</title>
	<script src="jquery.js" type="text/javascript"></script>
	<?php 
    echo script_js('var textpattern = {event: "' . htmlspecialchars($event) . '", step: "' . htmlspecialchars($step) . '"};');
    ?>
	<script type="text/javascript" src="textpattern.js"></script>
	<script type="text/javascript">
	<!--

		var cookieEnabled = checkCookies();

		if (!cookieEnabled)
		{
			confirm('<?php 
    echo trim(gTxt('cookies_must_be_enabled'));
    ?>
');
		}

<?php 
    $edit = array();
    if ($event == 'list') {
        $rs = safe_column('name', 'txp_section', "name != 'default'");
        $edit['section'] = $rs ? selectInput('Section', $rs, '', true) : '';
        $rs = getTree('root', 'article');
        $edit['category1'] = $rs ? treeSelectInput('Category1', $rs, '') : '';
        $edit['category2'] = $rs ? treeSelectInput('Category2', $rs, '') : '';
        $edit['comments'] = onoffRadio('Annotate', safe_field('val', 'txp_prefs', "name = 'comments_on_default'"));
        $edit['status'] = selectInput('Status', array(1 => gTxt('draft'), 2 => gTxt('hidden'), 3 => gTxt('pending'), 4 => gTxt('live'), 5 => gTxt('sticky')), '', true);
        $rs = safe_column('name', 'txp_users', "privs not in(0,6) order by name asc");
        $edit['author'] = $rs ? selectInput('AuthorID', $rs, '', true) : '';
    }
    if (in_array($event, array('image', 'file', 'link'))) {
        $rs = getTree('root', $event);
        $edit['category'] = $rs ? treeSelectInput('category', $rs, '') : '';
        $rs = safe_column('name', 'txp_users', "privs not in(0,6) order by name asc");
        $edit['author'] = $rs ? selectInput('author', $rs, '', true) : '';
    }
    if ($event == 'plugin') {
        $edit['order'] = selectInput('order', array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9), 5, false);
    }
    if ($event == 'admin') {
        $edit['privilege'] = privs();
        $rs = safe_column('name', 'txp_users', '1=1');
        $edit_assign_assets = $rs ? selectInput('assign_assets', $rs, '', true) : '';
    }
    // output JavaScript
    ?>
		function poweredit(elm)
		{
			var something = elm.options[elm.selectedIndex].value;

			// Add another chunk of HTML
			var pjs = document.getElementById('js');

			if (pjs == null)
			{
				var br = document.createElement('br');
				elm.parentNode.appendChild(br);

				pjs = document.createElement('P');
				pjs.setAttribute('id','js');
				elm.parentNode.appendChild(pjs);
			}

			if (pjs.style.display == 'none' || pjs.style.display == '')
			{
				pjs.style.display = 'block';
			}

			if (something != '')
			{
				switch (something)
				{
<?php 
    foreach ($edit as $key => $val) {
        echo "case 'change" . $key . "':" . n . t . "pjs.innerHTML = '<span>" . str_replace(array("\n", '-'), array('', '&#45;'), str_replace('</', '<\\/', addslashes($val))) . "<\\/span>';" . n . t . 'break;' . n . n;
    }
    if (isset($edit_assign_assets)) {
        echo "case 'delete':" . n . t . "pjs.innerHTML = '<label for=\"assign_assets\">" . addslashes(gTxt('assign_assets_to')) . "</label><span>" . str_replace(array("\n", '-'), array('', '&#45;'), str_replace('</', '<\\/', addslashes($edit_assign_assets))) . "<\\/span>';" . n . t . 'break;' . n . n;
    }
    ?>
					default:
						pjs.style.display = 'none';
						break;
				}
			}

			return false;
		}

		addEvent(window, 'load', cleanSelects);
	-->
	</script>
	<?php 
    echo $theme->html_head();
    callback_event('admin_side', 'head_end');
    ?>
	</head>
	<body id="<?php 
    echo $body_id;
    ?>
" class="<?php 
    echo $area;
    ?>
">
	<?php 
    callback_event('admin_side', 'pagetop');
    $theme->set_state($area, $event, $bm, $message);
    echo pluggable_ui('admin_side', 'header', $theme->header());
    callback_event('admin_side', 'pagetop_end');
}
Example #10
0
/**
 * Renders a multi-edit form widget for articles.
 *
 * @param  int    $page          The page number
 * @param  string $sort          The current sort value
 * @param  string $dir           The current sort direction
 * @param  string $crit          The current search criteria
 * @param  string $search_method The current search method
 * @return string HTML
 */
function list_multiedit_form($page, $sort, $dir, $crit, $search_method)
{
    global $statuses, $all_cats, $all_authors, $all_sections;
    if ($all_cats) {
        $category1 = treeSelectInput('Category1', $all_cats, '');
        $category2 = treeSelectInput('Category2', $all_cats, '');
    } else {
        $category1 = $category2 = '';
    }
    $sections = $all_sections ? selectInput('Section', $all_sections, '', true) : '';
    $comments = onoffRadio('Annotate', get_pref('comments_on_default'));
    $status = selectInput('Status', $statuses, '', true);
    $authors = $all_authors ? selectInput('AuthorID', $all_authors, '', true) : '';
    $methods = array('changesection' => array('label' => gTxt('changesection'), 'html' => $sections), 'changecategory1' => array('label' => gTxt('changecategory1'), 'html' => $category1), 'changecategory2' => array('label' => gTxt('changecategory2'), 'html' => $category2), 'changestatus' => array('label' => gTxt('changestatus'), 'html' => $status), 'changecomments' => array('label' => gTxt('changecomments'), 'html' => $comments), 'changeauthor' => array('label' => gTxt('changeauthor'), 'html' => $authors), 'duplicate' => gTxt('duplicate'), 'delete' => gTxt('delete'));
    if (!$all_cats) {
        unset($methods['changecategory1'], $methods['changecategory2']);
    }
    if (has_single_author('textpattern', 'AuthorID')) {
        unset($methods['changeauthor']);
    }
    if (!has_privs('article.delete.own') && !has_privs('article.delete')) {
        unset($methods['delete']);
    }
    return multi_edit($methods, 'list', 'list_multi_edit', $page, $sort, $dir, $crit, $search_method);
}
Example #11
0
/**
 * PEDRO:
 * Helper functions for common textpattern event files actions.
 * Code refactoring from original files. Intended to do easy and less error 
 * prone the future build of new textpattern extensions, and to add new
 * events to multiedit forms.
 */
function event_category_popup($name, $cat = "")
{
    $arr = array('');
    $rs = getTree("root", $name);
    if ($rs) {
        return treeSelectInput("category", $rs, $cat);
    }
    return false;
}
Example #12
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $path_from_root;
    extract(doSlash(gpsa(array('name', 'category', 'permissions', 'description'))));
    if (!$id) {
        $id = gps('id');
    }
    pagetop('file', $message);
    $categories = getTree("root", "file");
    $rs = safe_row("*", "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 = get_filenames();
        $status = '<span style="color:';
        $status .= $file_exists ? 'green' : 'red';
        $status .= '">';
        $status .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $status .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, $filename, $filename) : $filename;
        $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)) . graf(fInput('submit', '', gTxt('save'))) . hInput('filename', $filename) . hInput('id', $id) . eInput('file') . sInput('file_save'))));
        } 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') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . sInput('file_save'))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $status) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . (isset($downloads) ? $downloads : 0)))), $form, endTable();
    }
}
Example #13
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>';
    }
}
function pagetop($pagetitle, $message = "")
{
    global $css_mode, $siteurl, $sitename, $txp_user, $event;
    $area = gps('area');
    $event = !$event ? 'article' : $event;
    $bm = gps('bm');
    $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'");
    $GLOBALS['privs'] = $privs;
    $areas = areas();
    $area = false;
    foreach ($areas as $k => $v) {
        if (in_array($event, $v)) {
            $area = $k;
            break;
        }
    }
    if (gps('logout')) {
        $body_id = 'page-logout';
    } elseif (!$txp_user) {
        $body_id = 'page-login';
    } else {
        $body_id = 'page-' . $event;
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
    echo LANG;
    ?>
" lang="<?php 
    echo LANG;
    ?>
" dir="<?php 
    echo gTxt('lang_dir');
    ?>
">
	<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<title>Txp &#8250; <?php 
    echo htmlspecialchars($sitename);
    ?>
 &#8250; <?php 
    echo escape_title($pagetitle);
    ?>
</title>
	<link href="textpattern.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="textpattern.js"></script>
	<script type="text/javascript">
	<!--

		var cookieEnabled = checkCookies();

		if (!cookieEnabled)
		{
			confirm('<?php 
    echo trim(gTxt('cookies_must_be_enabled'));
    ?>
');
		}

<?php 
    $edit = array();
    if ($event == 'list') {
        $rs = safe_column('name', 'txp_section', "name != 'default'");
        $edit['section'] = $rs ? selectInput('Section', $rs, '', true) : '';
        $rs = getTree('root', 'article');
        $edit['category1'] = $rs ? treeSelectInput('Category1', $rs, '') : '';
        $edit['category2'] = $rs ? treeSelectInput('Category2', $rs, '') : '';
        $edit['comments'] = onoffRadio('Annotate', safe_field('val', 'txp_prefs', "name = 'comments_on_default'"));
        $edit['status'] = selectInput('Status', array(1 => gTxt('draft'), 2 => gTxt('hidden'), 3 => gTxt('pending'), 4 => gTxt('live'), 5 => gTxt('sticky')), '', true);
        $rs = safe_column('name', 'txp_users', "privs not in(0,6)");
        $edit['author'] = $rs ? selectInput('AuthorID', $rs, '', true) : '';
    }
    if (in_array($event, array('image', 'file', 'link'))) {
        $rs = getTree('root', $event);
        $edit['category'] = $rs ? treeSelectInput('category', $rs, '') : '';
    }
    if ($event == 'plugin') {
        $edit['order'] = selectInput('order', array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9), 5, false);
    }
    if ($event == 'admin') {
        $edit['privilege'] = privs();
    }
    // output JavaScript
    ?>
		function poweredit(elm)
		{
			var something = elm.options[elm.selectedIndex].value;

			// Add another chunk of HTML
			var pjs = document.getElementById('js');

			if (pjs == null)
			{
				var br = document.createElement('br');
				elm.parentNode.appendChild(br);

				pjs = document.createElement('P');
				pjs.setAttribute('id','js');
				elm.parentNode.appendChild(pjs);
			}

			if (pjs.style.display == 'none' || pjs.style.display == '')
			{
				pjs.style.display = 'block';
			}

			if (something != '')
			{
				switch (something)
				{
<?php 
    foreach ($edit as $key => $val) {
        echo "case 'change" . $key . "':" . n . t . "pjs.innerHTML = '<span>" . str_replace(array("\n", '-'), array('', '&#45;'), addslashes($val)) . "</span>';" . n . t . 'break;' . n . n;
    }
    ?>
					default:
						pjs.style.display = 'none';
					break;
				}
			}

			return false;
		}

		addEvent(window, 'load', cleanSelects);
	-->
	</script>
	<script type="text/javascript" src="jquery.js"></script>
	<?php 
    callback_event('admin_side', 'head_end');
    ?>
	</head>
	<body id="<?php 
    echo $body_id;
    ?>
">
	<?php 
    callback_event('admin_side', 'pagetop');
    ?>
  <table id="pagetop" cellpadding="0" cellspacing="0">
  <tr id="branding"><td><h1 id="textpattern">Textpattern</h1></td><td id="navpop"><?php 
    echo navPop(1);
    ?>
</td></tr>
  <tr id="nav-primary"><td align="center" class="tabs" colspan="2">
 		<?php 
    if (!$bm) {
        echo '<table cellpadding="0" cellspacing="0" align="center"><tr>
  <td valign="middle" style="width:368px">&nbsp;' . $message . '</td>', has_privs('tab.content') ? areatab(gTxt('tab_content'), 'content', 'article', $area) : '', has_privs('tab.presentation') ? areatab(gTxt('tab_presentation'), 'presentation', 'page', $area) : '', has_privs('tab.admin') ? areatab(gTxt('tab_admin'), 'admin', 'admin', $area) : '', (has_privs('tab.extensions') and !empty($areas['extensions'])) ? areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area) : '', '<td class="tabdown"><a href="' . hu . '" class="plain" target="_blank">' . gTxt('tab_view_site') . '</a></td>', '</tr></table>';
        $secondary = tabsort($area, $event);
        if ($secondary) {
            echo '</td></tr><tr id="nav-secondary"><td align="center" class="tabs" colspan="2">
			<table cellpadding="0" cellspacing="0" align="center"><tr>', $secondary, '</tr></table>';
        }
    }
    echo '</td></tr></table>';
    callback_event('admin_side', 'pagetop_end');
}
Example #15
0
function category_popup($name, $val)
{
    $rs = getTree("root", 'article');
    if ($rs) {
        return treeSelectInput($name, $rs, $val);
    }
    return false;
}
Example #16
0
function category_pop($name)
{
    $arr = array('');
    $rs = getTree('root', 'article');
    if ($rs) {
        return ' ' . treeSelectInput("category", $rs, $name);
    }
    return 'no categories created';
}
Example #17
0
function image_edit($message = '', $id = '')
{
    global $prefs, $file_max_upload_size, $txp_user, $event, $all_image_cats;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author === $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img_info = $id . $ext . ' (' . $w . ' &#215; ' . $h . ')';
            $img = '<div class="fullsize-image"><img class="content-image" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" alt="' . $img_info . '" title="' . $img_info . '" /></div>';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb_info = $id . 't' . $ext . ' (' . $thumb_w . ' &#215; ' . $thumb_h . ')';
            $thumb = '<img class="content-image" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="' . $thumb_info . '" ' . ($thumb_w ? 'width="' . $thumb_w . '" height="' . $thumb_h . '" title="' . $thumb_info . '"' : '') . ' />';
        } else {
            $thumb = '';
            if ($thumb_w == 0) {
                $thumb_w = get_pref('thumb_w', 0);
            }
            if ($thumb_h == 0) {
                $thumb_h = get_pref('thumb_h', 0);
            }
        }
        echo n . '<div id="' . $event . '_container" class="txp-container">';
        echo pluggable_ui('image_ui', 'fullsize_image', $img, $rs), '<section class="txp-edit">', hed(gTxt('edit_image'), 2), pluggable_ui('image_ui', 'image_edit', wrapGroup('image_edit_group', upload_form('', '', 'image_replace', 'image', $id, $file_max_upload_size, 'image_replace', 'image-replace'), 'replace_image', 'replace-image', 'replace_image_form'), $rs), pluggable_ui('image_ui', 'thumbnail_image', '<div class="thumbnail-edit">' . ($thumbnail ? $thumb . n . dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)) : '') . '</div>', $rs), pluggable_ui('image_ui', 'thumbnail_edit', wrapGroup('thumbnail_edit_group', upload_form('', '', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload_thumbnail', 'thumbnail-upload'), 'upload_thumbnail', 'thumbnail-upload', 'upload_thumbnail'), $rs), check_gd($ext) ? pluggable_ui('image_ui', 'thumbnail_create', wrapGroup('thumbnail_create_group', form(graf(n . '<label for="width">' . gTxt('thumb_width') . '</label>' . fInput('text', 'width', @$thumb_w, 'input-xsmall', '', '', INPUT_XSMALL, '', 'width') . n . '<label for="height">' . gTxt('thumb_height') . '</label>' . fInput('text', 'height', @$thumb_h, 'input-xsmall', '', '', INPUT_XSMALL, '', 'height') . n . '<label for="crop">' . gTxt('keep_square_pixels') . '</label>' . checkbox('crop', 1, @$prefs['thumb_crop'], '', 'crop') . fInput('submit', '', gTxt('Create')), ' class="edit-alter-thumbnail"') . hInput('id', $id) . eInput('image') . sInput('thumbnail_create') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'thumbnail_alter_form'), 'create_thumbnail', 'thumbnail-alter', 'create_thumbnail'), $rs) : '', '<div class="image-detail">', form(inputLabel('image_name', fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'image_name'), 'image_name') . inputLabel('image_category', treeSelectInput('category', $all_image_cats, $category, 'image_category'), 'image_category') . inputLabel('image_alt_text', fInput('text', 'alt', $alt, '', '', '', INPUT_REGULAR, '', 'image_alt_text'), 'alt_text') . inputLabel('image_caption', text_area('caption', 0, 0, $caption, 'image_caption', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE), 'caption', '', '', '') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form'), '</div>', '</section>' . n . '</div>';
    }
}
Example #18
0
 /**
  * Renders a HTML &lt;select&gt; list of Categories.
  *
  * @param  string $value Currently selected value
  * @param  string $type  Context to which the category applies
  * @return string HTML
  */
 private function tbCategoryPop($value, $type = 'article')
 {
     $vals = getTree('root', $type);
     if ($vals) {
         return ' ' . treeSelectInput('category', $vals, $value, 'category');
     }
     return gTxt('no_categories_available');
 }
Example #19
0
/**
 * Renders a list of categories.
 *
 * @param  string $event Type of category
 * @return string HTML
 */
function cat_event_category_list($event)
{
    $rs = getTree('root', $event);
    $parent = ps('parent_cat');
    $heading = 'tab_' . ($event == 'article' ? 'list' : $event);
    $for = $rs ? ' for="' . $event . '_category_parent"' : '';
    $out = hed(gTxt($heading) . popHelp($event . '_category'), 2) . form(graf(tag(gTxt('create_new_category'), 'label', array('for' => $event . '_category_new')) . br . fInput('text', 'title', '', '', '', '', INPUT_REGULAR, '', $event . '_category_new')) . ($rs ? graf('<label' . $for . '>' . gTxt('parent') . '</label>' . br . treeSelectInput('parent_cat', $rs, $parent, $event . '_category_parent'), array('class' => 'parent')) : '') . graf(fInput('submit', '', gTxt('Create')) . eInput('category') . sInput('cat_' . $event . '_create')), '', '', 'post', $event);
    if ($rs) {
        $total_count = array();
        if ($event == 'article') {
            // Count distinct articles for both categories, avoid duplicates.
            $rs2 = getRows("SELECT category, COUNT(*) AS num FROM (\n                    SELECT ID, Category1 AS category FROM " . safe_pfx('textpattern') . "\n                        UNION\n                    SELECT ID, Category2 AS category FROM " . safe_pfx('textpattern') . "\n                ) AS t WHERE category != '' GROUP BY category");
            if ($rs2 !== false) {
                foreach ($rs2 as $a) {
                    $total_count[$a['category']] = $a['num'];
                }
            }
        } else {
            switch ($event) {
                case 'link':
                    $rs2 = safe_rows_start("category, COUNT(*) AS num", 'txp_link', "1 = 1 GROUP BY category");
                    break;
                case 'image':
                    $rs2 = safe_rows_start("category, COUNT(*) AS num", 'txp_image', "1 = 1 GROUP BY category");
                    break;
                case 'file':
                    $rs2 = safe_rows_start("category, COUNT(*) AS num", 'txp_file', "1 = 1 GROUP BY category");
                    break;
            }
            while ($a = nextRow($rs2)) {
                $name = $a['category'];
                $num = $a['num'];
                $total_count[$name] = $num;
            }
        }
        $items = array();
        foreach ($rs as $a) {
            extract($a);
            // Format count.
            switch ($event) {
                case 'article':
                    $url = 'index.php?event=list' . a . 'search_method=categories' . a . 'crit=' . $name;
                    break;
                case 'link':
                    $url = 'index.php?event=link' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
                case 'image':
                    $url = 'index.php?event=image' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
                case 'file':
                    $url = 'index.php?event=file' . a . 'search_method=category' . a . 'crit=' . $name;
                    break;
            }
            $count = isset($total_count[$name]) ? href('(' . $total_count[$name] . ')', $url) : '(0)';
            if (empty($title)) {
                $edit_link = '<em>' . eLink('category', 'cat_' . $event . '_edit', 'id', $id, gTxt('untitled')) . '</em>';
            } else {
                $edit_link = eLink('category', 'cat_' . $event . '_edit', 'id', $id, $title);
            }
            $items[] = graf(checkbox('selected[]', $id, 0) . sp . str_repeat(sp . sp, $level * 2) . $edit_link . sp . $count, ' class="level-' . $level . '"');
        }
        if ($items) {
            $out .= cat_article_multiedit_form($event, $items);
        }
    } else {
        $out .= graf(span(null, array('class' => 'ui-icon ui-icon-info')) . ' ' . gTxt('no_categories_exist'), array('class' => 'alert-block information'));
    }
    return $out;
}
Example #20
0
function image_edit($message = '', $id = '')
{
    global $txpcfg, $img_dir, $file_max_upload_size, $txp_user, $event;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author == $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        $categories = getTree("root", "image");
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img = '<img class="image fullsize" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" id="image-fullsize" />';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img class="image thumbnail" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="" ' . ($thumb_w ? "width='{$thumb_w}' height='{$thumb_h}'" : '') . ' />';
        } else {
            $thumb = '';
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(pluggable_ui('image_ui', 'image_edit', $img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', 'image-replace'), $rs)), ' class="image-edit' . $aspect . '"'), tr(td(pluggable_ui('image_ui', 'thumbnail_edit', join('', array($thumbnail ? startTable('image-thumbnail', '', 'image-thumbnail') . tr(td($thumb, '', 'thumbwrapper') . td(dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', 'thumbnail-upload'))), $rs)), ' class="thumbnail-edit"'), check_gd($ext) ? thumb_ui($id, $rs) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name'), ' class="name"') . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category'), ' class="category"') . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text'), ' class="alt text"') . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . '<textarea id="caption" name="caption">' . $caption . '</textarea>', ' class="caption description text"') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form')), ' class="image-detail"'), endTable() . n . '</div>';
    }
}
Example #21
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 #22
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    global $txpcfg, $img_dir, $file_max_upload_size;
    pagetop(gTxt('edit_image'), $message);
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
    $categories = getTree("root", "image");
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($ext != '.swf') {
            $img = '<img src="' . hu . $img_dir . '/' . $id . $ext . "?{$uDate}" . '" height="' . $h . '" width="' . $w . '" alt="" title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" />';
        } else {
            $img = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . "?{$uDate}" . '" alt="" />';
        } else {
            $thumb = '';
        }
        echo startTable('list'), tr(td($img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id, $file_max_upload_size, 'image-replace', ''))), tr(td(join('', array($thumbnail ? startTable('image-thumbnail') . tr(td($thumb) . td(dLink('image', 'thumbnail_delete', 'id', $id))) . endTable() . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload-thumbnail', ''))))), check_gd($ext) ? thumb_ui($id) : '', tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . treeSelectInput('category', $categories, $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput('image') . n . sInput('image_save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))), endTable();
    }
}
Example #23
0
function link_multiedit_form($page, $sort, $dir, $crit, $search_method)
{
    global $all_link_cats, $all_link_authors;
    $categories = $all_link_cats ? treeSelectInput('category', $all_link_cats, '') : '';
    $authors = $all_link_authors ? selectInput('author', $all_link_authors, '', true) : '';
    $methods = array('changecategory' => array('label' => gTxt('changecategory'), 'html' => $categories), 'changeauthor' => array('label' => gTxt('changeauthor'), 'html' => $authors), 'delete' => gTxt('delete'));
    if (!$categories) {
        unset($methods['changecategory']);
    }
    if (has_single_author('txp_link')) {
        unset($methods['changeauthor']);
    }
    if (!has_privs('link.delete.own') && !has_privs('link.delete')) {
        unset($methods['delete']);
    }
    return multi_edit($methods, 'link', 'link_multi_edit', $page, $sort, $dir, $crit, $search_method);
}
Example #24
0
function file_edit($message = '', $id = '')
{
    global $file_base_path, $levels, $file_statuses, $txp_user, $event, $all_file_cats;
    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);
    $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'))) {
            require_privs();
        }
        pagetop(gTxt('edit_file'), $message);
        if ($permissions == '') {
            $permissions = '-1';
        }
        if (!has_privs('file.publish') && $status >= STATUS_LIVE) {
            $status = STATUS_PENDING;
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $existing_files = get_filenames();
        $replace = $file_exists ? wrapGroup('file_upload_group', file_upload_form('', '', 'file_replace', $id, 'file_replace'), 'replace_file', 'replace-file', 'file_replace') : wrapGroup('file_upload_group', file_upload_form('', '', 'file_replace', $id, 'file_reassign'), 'file_relink', 'upload-file', 'file_reassign');
        $condition = span($file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing'), array('class' => $file_exists ? 'success' : 'error'));
        $downloadlink = $file_exists ? make_download_link($id, txpspecialchars($filename), $filename) : txpspecialchars($filename);
        $created = graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . n . '<label for="publish_now">' . gTxt('set_to_now') . '</label>', ' class="edit-file-publish-now"') . graf(gTxt('or_publish_at') . popHelp('timestamp'), ' class="edit-file-publish-at"') . graf(span(gTxt('date'), array('class' => 'txp-label-fixed')) . br . tsi('year', '%Y', $rs['created'], '', gTxt('yyyy')) . ' / ' . tsi('month', '%m', $rs['created'], '', gTxt('mm')) . ' / ' . tsi('day', '%d', $rs['created'], '', gTxt('dd')), ' class="edit-file-published"') . graf(span(gTxt('time'), array('class' => 'txp-label-fixed')) . br . tsi('hour', '%H', $rs['created'], '', gTxt('hh')) . ' : ' . tsi('minute', '%M', $rs['created'], '', gTxt('mm')) . ' : ' . tsi('second', '%S', $rs['created'], '', gTxt('ss')), ' class="edit-file-created"');
        echo n . '<div id="' . $event . '_container" class="txp-container">';
        echo n . '<section class="txp-edit">' . hed(gTxt('edit_file'), 2) . inputLabel('condition', $condition) . inputLabel('name', $downloadlink) . inputLabel('download_count', $downloads) . $replace . n . '<div class="file-detail ' . ($file_exists ? '' : 'not-') . 'exists">' . form(($file_exists ? inputLabel('file_status', selectInput('status', $file_statuses, $status, false, '', 'file_status'), 'file_status') . inputLabel('file_title', fInput('text', 'title', $title, '', '', '', INPUT_REGULAR, '', 'file_title'), 'title') . inputLabel('file_category', treeSelectInput('category', $all_file_cats, $category, 'file_category'), 'file_category') . inputLabel('file_description', '<textarea id="file_description" name="description" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_SMALL . '">' . $description . '</textarea>', 'description', '', '', '') . wrapRegion('file_created', $created, '', gTxt('timestamp'), '', 'file-created') . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('Save'), 'publish')) . hInput('filename', $filename) : (empty($existing_files) ? '' : gTxt('existing_file') . selectInput('filename', $existing_files, '', 1)) . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('Save'), 'publish')) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('title', $title) . hInput('description', $description) . hInput('status', $status)) . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method), '', '', 'post', 'edit-form', '', $file_exists ? 'file_details' : 'assign_file') . n . '</div>' . n . '</section>' . n . '</div>';
    }
}
Example #25
0
function file_category_pop($val)
{
    $vals = getTree('root', 'file');
    if ($vals) {
        return ' ' . treeSelectInput('category', $vals, $val);
    }
    return gTxt('no_categories_available');
}
Example #26
0
function pagetop($pagetitle, $message = "")
{
    global $css_mode, $siteurl, $sitename, $txp_user, $event;
    $area = gps('area');
    $event = !$event ? 'article' : $event;
    $bm = gps('bm');
    $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'");
    $GLOBALS['privs'] = $privs;
    $areas = areas();
    foreach ($areas as $k => $v) {
        if (in_array($event, $v)) {
            $area = $k;
        }
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
			"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex, nofollow" />
	<title>Txp &#8250; <?php 
    echo htmlspecialchars($sitename);
    ?>
 &#8250; <?php 
    echo escape_title($pagetitle);
    ?>
</title>
	<link href="textpattern.css" rel="Stylesheet" type="text/css" />
	<script type="text/javascript" src="textpattern.js"></script>
	<script type="text/javascript">
	<!--

		var cookieEnabled = checkCookies();

		if (!cookieEnabled)
		{
			confirm('<?php 
    echo trim(gTxt('cookies_must_be_enabled'));
    ?>
');
		}	
	
<?php 
    if ($event == 'list') {
        $sarr = array("\n", '-');
        $rarr = array('', '&#45;');
        $sections = '';
        $rs = safe_column('name', 'txp_section', "name != 'default'");
        if ($rs) {
            $sections = str_replace($sarr, $rarr, addslashes(selectInput('Section', $rs, '', true)));
        }
        $category1 = '';
        $category2 = '';
        $rs = getTree('root', 'article');
        if ($rs) {
            $category1 = str_replace($sarr, $rarr, addslashes(treeSelectInput('Category1', $rs, '')));
            $category2 = str_replace($sarr, $rarr, addslashes(treeSelectInput('Category2', $rs, '')));
        }
        $statuses = str_replace($sarr, $rarr, addslashes(selectInput('Status', array(1 => gTxt('draft'), 2 => gTxt('hidden'), 3 => gTxt('pending'), 4 => gTxt('live'), 5 => gTxt('sticky')), '', true)));
        $comments_annotate = addslashes(onoffRadio('Annotate', safe_field('val', 'txp_prefs', "name = 'comments_on_default'")));
        $authors = '';
        $rs = safe_column('name', 'txp_users', "privs not in(0,6)");
        if ($rs) {
            $authors = str_replace($sarr, $rarr, addslashes(selectInput('AuthorID', $rs, '', true)));
        }
        // output JavaScript
        ?>
		function poweredit(elm)
		{
			var something = elm.options[elm.selectedIndex].value;

			// Add another chunk of HTML
			var pjs = document.getElementById('js');

			if (pjs == null)
			{
				var br = document.createElement('br');
				elm.parentNode.appendChild(br);

				pjs = document.createElement('P');
				pjs.setAttribute('id','js');
				elm.parentNode.appendChild(pjs);
			}

			if (pjs.style.display == 'none' || pjs.style.display == '')
			{
				pjs.style.display = 'block';
			}

			if (something != '')
			{
				switch (something)
				{
					case 'changesection':
						var sections = '<?php 
        echo $sections;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('section');
        ?>
: '+sections+'</span>';
					break;

					case 'changecategory1':
						var categories = '<?php 
        echo $category1;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('category1');
        ?>
: '+categories+'</span>';
					break;

					case 'changecategory2':
						var categories = '<?php 
        echo $category2;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('category2');
        ?>
: '+categories+'</span>';
					break;

					case 'changestatus':
						var statuses = '<?php 
        echo $statuses;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('status');
        ?>
: '+statuses+'</span>';
					break;

					case 'changecomments':
						var comments = '<?php 
        echo $comments_annotate;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('comments');
        ?>
: '+comments+'</span>';
					break;

					case 'changeauthor':
						var authors = '<?php 
        echo $authors;
        ?>
';
						pjs.innerHTML = '<span><?php 
        echo gTxt('author');
        ?>
: '+authors+'</span>';
					break;

					default:
						pjs.style.display = 'none';
					break;
				}
			}

			return false;
		}

		addEvent(window, 'load', cleanSelects);
<?php 
    }
    ?>
	-->
	</script>
	<script type="text/javascript" src="jquery.js"></script>
	</head>
	<body>
  <table id="pagetop" cellpadding="0" cellspacing="0">
  <tr id="branding"><td><img src="txp_img/textpattern.gif" alt="textpattern" /></td><td id="navpop"><?php 
    echo navPop(1);
    ?>
</td></tr>
  <tr id="nav-primary"><td align="center" class="tabs" colspan="2">
 		<?php 
    if (!$bm) {
        echo '<table cellpadding="0" cellspacing="0" align="center"><tr>
  <td valign="middle" style="width:368px">&nbsp;' . $message . '</td>', has_privs('tab.content') ? areatab(gTxt('tab_content'), 'content', 'article', $area) : '', has_privs('tab.presentation') ? areatab(gTxt('tab_presentation'), 'presentation', 'page', $area) : '', has_privs('tab.admin') ? areatab(gTxt('tab_admin'), 'admin', 'admin', $area) : '', (has_privs('tab.extensions') and !empty($areas['extensions'])) ? areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area) : '', '<td class="tabdown"><a href="' . hu . '" class="plain" target="blank">' . gTxt('tab_view_site') . '</a></td>', '</tr></table>', '</td></tr><tr id="nav-secondary"><td align="center" class="tabs" colspan="2">
			<table cellpadding="0" cellspacing="0" align="center"><tr>', tabsort($area, $event), '</tr></table>';
    }
    echo '</td></tr></table>';
}
Example #27
0
function category_popup($name, $val, $id)
{
    $rs = getTree('root', 'article');
    if ($rs) {
        return treeSelectInput($name, $rs, $val, $id, 35);
    }
    return false;
}
Example #28
0
function file_multiedit_form($page, $sort, $dir, $crit, $search_method)
{
    global $file_statuses, $all_file_cats, $all_file_authors;
    $categories = $all_file_cats ? treeSelectInput('category', $all_file_cats, '') : '';
    $authors = $all_file_authors ? selectInput('author', $all_file_authors, '', true) : '';
    $status = selectInput('status', $file_statuses, '', true);
    $methods = array('changecategory' => array('label' => gTxt('changecategory'), 'html' => $categories), 'changeauthor' => array('label' => gTxt('changeauthor'), 'html' => $authors), 'changestatus' => array('label' => gTxt('changestatus'), 'html' => $status), 'changecount' => array('label' => gTxt('reset_download_count')), 'delete' => gTxt('delete'));
    if (!$categories) {
        unset($methods['changecategory']);
    }
    if (has_single_author('txp_file')) {
        unset($methods['changeauthor']);
    }
    if (!has_privs('file.delete.own') && !has_privs('file.delete')) {
        unset($methods['delete']);
    }
    return multi_edit($methods, 'file', 'file_multi_edit', $page, $sort, $dir, $crit, $search_method);
}
Example #29
0
/**
 * PEDRO:
 * Helper functions for common textpattern event files actions.
 * Code refactoring from original files. Intended to do easy and less error
 * prone the future build of new textpattern extensions, and to add new
 * events to multiedit forms.
 */
function event_category_popup($name, $cat = '', $id = '')
{
    $arr = array('');
    $rs = getTree('root', $name);
    if ($rs) {
        return treeSelectInput('category', $rs, $cat, $id);
    }
    return false;
}
Example #30
0
function hak_txpcatselect()
{
    $rs = getTree("root", 'image');
    if ($rs) {
        echo tag(gTxt('category'), "legend") . treeSelectInput("category", $rs, "", "txpCategory");
    }
    exit(0);
}