/system/cp/cp.publish_ad.php
PHP | 9837 lines | 6347 code | 2490 blank | 1000 comment | 1050 complexity | cb9f56f24aac85e72e5f9a15660ae259 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- /*
- =====================================================
- ExpressionEngine - by EllisLab
- -----------------------------------------------------
- http://expressionengine.com/
- -----------------------------------------------------
- Copyright (c) 2003 - 2010 EllisLab, Inc.
- =====================================================
- THIS IS COPYRIGHTED SOFTWARE
- PLEASE READ THE LICENSE AGREEMENT
- http://expressionengine.com/docs/license.html
- =====================================================
- File: cp.publish_ad.php
- -----------------------------------------------------
- Purpose: The publish administration functions
- =====================================================
- */
- if ( ! defined('EXT'))
- {
- exit('Invalid file request');
- }
- class PublishAdmin {
- var $reserved = array('random', 'date', 'title', 'url_title', 'edit_date', 'comment_total', 'username', 'screen_name', 'most_recent_comment', 'expiration_date');
- // Default "open" and "closed" status colors
- var $status_color_open = '009933';
- var $status_color_closed = '990000';
-
- // Category arrays
-
- var $categories = array();
- var $cat_update = array();
-
- var $temp;
- /** -----------------------------------------------------------
- /** Constructor
- /** -----------------------------------------------------------*/
- // All it does it fetch the language file needed by the class
- //-----------------------------------------------------------
- function PublishAdmin()
- {
- global $LANG, $DSP;
-
- // Fetch language file
-
- $LANG->fetch_language_file('publish_ad');
- }
- /* END */
- /** -----------------------------------------------------------
- /** Weblog management page
- /** -----------------------------------------------------------*/
- // This function displays the "weblog management" page
- // accessed via the "admin" tab
- //-----------------------------------------------------------
- function weblog_overview($message = '')
- {
- global $LANG, $DSP, $DB, $PREFS;
-
- if ( ! $DSP->allowed_group('can_admin_weblogs'))
- {
- return $DSP->no_access_message();
- }
-
- $DSP->title = $LANG->line('weblog_management');
- $DSP->crumb = $DSP->anchor(BASE.AMP.'C=admin'.AMP.'area=weblog_administration', $LANG->line('weblog_administration'));
- $DSP->crumb .= $DSP->crumb_item($LANG->line('weblog_management'));
- $DSP->right_crumb($LANG->line('create_new_weblog'), BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=new_weblog');
- // Fetch weblogs
-
- $query = $DB->query("SELECT weblog_id, blog_name, blog_title FROM exp_weblogs WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' AND is_user_blog = 'n' ORDER BY blog_title");
-
- if ($query->num_rows == 0)
- {
- $DSP->body = $DSP->qdiv('tableHeading', $LANG->line('weblog_management'));
- $DSP->body .= $DSP->div('box');
- $DSP->body .= $DSP->qdiv('itemWrapper', $DSP->heading($LANG->line('no_weblogs_exist'), 5));
- $DSP->body .= $DSP->qdiv('itemWrapper', $DSP->anchor( BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=new_weblog', $LANG->line('create_new_weblog')));
- $DSP->body .= $DSP->div_c();
-
- return;
- }
-
- $r = $DSP->qdiv('tableHeading', $LANG->line('weblog_management'));
-
- if ($message != '')
- {
- $r .= $DSP->qdiv('box', stripslashes($message));
- }
- $r .= $DSP->table('tableBorder', '0', '', '100%');
-
- $r .= $DSP->tr().
- $DSP->td('tableHeadingAlt', '30px').$LANG->line('weblog_id').$DSP->td_c().
- $DSP->td('tableHeadingAlt').$LANG->line('weblog_name').$DSP->td_c().
- $DSP->td('tableHeadingAlt', '', '4').$LANG->line('weblog_short_name').$DSP->td_c().
- $DSP->tr_c();
-
- $i = 0;
-
- foreach($query->result as $row)
- {
- $style = ($i % 2) ? 'tableCellOne' : 'tableCellTwo'; $i++;
-
- $r .= $DSP->tr();
-
- $r .= $DSP->table_qcell($style, $DSP->qspan('default', $row['weblog_id']));
- $r .= $DSP->table_qcell($style, $DSP->qspan('defaultBold', $row['blog_title']).$DSP->nbs(5));
-
- $r .= $DSP->table_qcell($style, $DSP->qspan('default', $row['blog_name']).$DSP->nbs(5));
-
- $r .= $DSP->table_qcell($style,
- $DSP->anchor(
- BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=blog_prefs'.AMP.'weblog_id='.$row['weblog_id'],
- $LANG->line('edit_preferences')
- ));
-
- $r .= $DSP->table_qcell($style,
- $DSP->anchor(
- BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=group_prefs'.AMP.'weblog_id='.$row['weblog_id'],
- $LANG->line('edit_groups')
- ));
- $r .= $DSP->table_qcell($style,
- $DSP->anchor(
- BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=delete_conf'.AMP.'weblog_id='.$row['weblog_id'],
- $LANG->line('delete')
- ));
-
- $r .= $DSP->tr_c();
- }
-
- $r .= $DSP->table_c();
- // Assign output data
-
- $DSP->body = $r;
-
- }
- /* END */
- /** --------------------------------------------------------------
- /** "Create new weblog" form
- /** --------------------------------------------------------------*/
- // This function displays the form used to create a new weblog
- //--------------------------------------------------------------
- function new_weblog_form()
- {
- global $DSP, $IN, $DB, $REGX, $LANG, $FNS, $PREFS;
-
- if ( ! $DSP->allowed_group('can_admin_weblogs'))
- {
- return $DSP->no_access_message();
- }
-
- $r = <<<EOT
- <script type="text/javascript">
- <!--
- function show_hide(id)
- {
- if (document.getElementById(id))
- {
- if (document.getElementById(id).style.display == 'none')
- {
- document.getElementById(id).style.display = 'block';
- }
- else
- {
- document.getElementById(id).style.display = 'none';
- }
- }
- }
- //-->
- </script>
- EOT;
- $r .= $DSP->form_open(array('action' => 'C=admin'.AMP.'M=blog_admin'.AMP.'P=create_blog'));
-
- $r .= $DSP->table('tableBorder', '0', '', '100%');
- $r .= $DSP->tr()
- .$DSP->td('tableHeading', '', '2').$LANG->line('create_new_weblog').$DSP->td_c()
- .$DSP->tr_c();
-
-
- // Weblog "full name" field
-
- $r .= $DSP->tr().
- $DSP->table_qcell('tableCellTwo', $DSP->required().NBS.$DSP->qspan('defaultBold', $LANG->line('full_weblog_name', 'blog_title'))).
- $DSP->table_qcell('tableCellTwo', $DSP->input_text('blog_title', '', '20', '100', 'input', '260px')).
- $DSP->tr_c();
-
- // Weblog "short name" field
-
- $r .= $DSP->tr().
- $DSP->table_qcell('tableCellOne', $DSP->required().NBS.$DSP->qspan('defaultBold', $LANG->line('short_weblog_name', 'blog_name')).$DSP->qdiv('', $LANG->line('single_word_no_spaces')), '40%').
- $DSP->table_qcell('tableCellOne', $DSP->input_text('blog_name', '', '20', '40', 'input', '260px'), '60%').
- $DSP->tr_c();
-
- // Duplicate Preferences Select List
-
- $r .= $DSP->tr().
- $DSP->table_qcell('tableCellTwo', $DSP->qspan('defaultBold', $LANG->line('duplicate_weblog_prefs')));
- $w = $DSP->input_select_header('duplicate_weblog_prefs');
- $w .= $DSP->input_select_option('', $LANG->line('do_not_duplicate'));
-
- $wquery = $DB->query("SELECT weblog_id, blog_title FROM exp_weblogs WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' ORDER BY blog_name");
-
- if ($wquery->num_rows > 0)
- {
- foreach($wquery->result as $row)
- {
- $w .= $DSP->input_select_option($row['weblog_id'], $row['blog_title']);
- }
- }
-
- $w .= $DSP->input_select_footer();
-
- $r .= $DSP->table_qcell('tableCellTwo', $w).
- $DSP->tr_c();
- // Edit Group Preferences option
-
- $r .= $DSP->tr().
- $DSP->table_qcell('tableCellOne', $DSP->qspan('defaultBold', $LANG->line('edit_group_prefs')), '40%').
- $DSP->table_qcell('tableCellOne', $DSP->input_radio('edit_group_prefs', 'y', '', 'onclick="show_hide(\'group_preferences\');"').
- NBS.$LANG->line('yes').
- NBS.NBS.
- $DSP->input_radio('edit_group_prefs', 'n', 1, 'onclick="show_hide(\'group_preferences\');"').
- NBS.$LANG->line('no'), '60%').
- $DSP->tr_c();
-
- $r .= $DSP->table_c().BR;
-
-
-
- // GROUP FIELDS
-
- $g = '';
- $i = 0;
- $cat_group = '';
- $status_group = '';
- $field_group = '';
-
- $r .= $DSP->div('', '', 'group_preferences', '', 'style="display:none;"');
- $r .= $DSP->table('tableBorder', '0', '', '100%');
- $r .= $DSP->tr().
- $DSP->td('tableHeadingAlt', '100%', 2).$LANG->line('edit_group_prefs').$DSP->td_c().
- $DSP->tr_c();
- // Category group select list
-
- $style = ($i % 2) ? 'tableCellOne' : 'tableCellTwo'; $i++;
-
- $query = $DB->query("SELECT group_id, group_name FROM exp_category_groups WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' ORDER BY group_name");
-
- $g .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('category_group')), '40%', 'top');
-
- $g .= $DSP->td($style).
- $DSP->input_select_header('cat_group[]', ($query->num_rows > 0) ? 'y' : '');
-
- $selected = '';
- $g .= $DSP->input_select_option('', $LANG->line('none'), $selected);
-
- if ($query->num_rows > 0)
- {
- foreach ($query->result as $row)
- {
- $g .= $DSP->input_select_option($row['group_id'], $row['group_name']);
- }
- }
-
- $g .= $DSP->input_select_footer().
- $DSP->td_c().
- $DSP->tr_c();
-
-
- // Status group select list
-
- $style = ($i % 2) ? 'tableCellOne' : 'tableCellTwo'; $i++;
-
- $query = $DB->query("SELECT group_id, group_name FROM exp_status_groups WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' ORDER BY group_name");
-
- $g .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('status_group')));
-
- $g .= $DSP->td($style).
- $DSP->input_select_header('status_group');
-
- $selected = '';
- $g .= $DSP->input_select_option('', $LANG->line('none'), $selected);
-
- if ($query->num_rows > 0)
- {
- foreach ($query->result as $row)
- {
- $selected = ($status_group == $row['group_id']) ? 1 : '';
-
- $g .= $DSP->input_select_option($row['group_id'], $row['group_name'], $selected);
- }
- }
- $g .= $DSP->input_select_footer().
- $DSP->td_c().
- $DSP->tr_c();
-
-
- // Field group select list
-
- $style = ($i % 2) ? 'tableCellOne' : 'tableCellTwo'; $i++;
-
- $query = $DB->query("SELECT group_id, group_name FROM exp_field_groups WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' ORDER BY group_name");
-
- $g .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('field_group')));
-
- $g .= $DSP->td($style).
- $DSP->input_select_header('field_group');
-
- $selected = '';
- $g .= $DSP->input_select_option('', $LANG->line('none'), $selected);
-
- if ($query->num_rows > 0)
- {
- foreach ($query->result as $row)
- {
- $selected = ($field_group == $row['group_id']) ? 1 : '';
-
- $g .= $DSP->input_select_option($row['group_id'], $row['group_name'], $selected);
- }
- }
- $g .= $DSP->input_select_footer().
- $DSP->td_c().
- $DSP->tr_c().
- $DSP->table_c().BR.
- $DSP->div_c();
-
- $r .= $g;
-
- // Table end
-
- // Create Template
-
-
- if ($DSP->allowed_group('can_admin_templates'))
- {
- $r .= $DSP->table('tableBorder', '0', '', '100%')
- .$DSP->tr()
- .$DSP->td('tableHeadingAlt', '', '3').$LANG->line('template_creation').$DSP->td_c()
- .$DSP->tr_c();
-
- $r .= $DSP->tr()
- .$DSP->table_qcell('tableCellOne', $DSP->input_radio('create_templates', 'no', 1), '2%')
- .$DSP->td('tableCellOne', '', '3').$DSP->qdiv('defaultBold', $LANG->line('no')).$DSP->td_c()
- .$DSP->tr_c();
-
-
- $data = $FNS->create_directory_map(PATH_THEMES.'site_themes/', TRUE);
-
- $d = ' ';
-
- if (count($data) > 0)
- {
- $d = $DSP->input_select_header('template_theme');
-
- foreach ($data as $val)
- {
- if ($val == 'rss.php')
- continue;
-
- if ( ! file_exists(PATH_THEMES.'site_themes/'.$val.'/'.$val.'.php'))
- {
- continue;
- }
-
- $nval = str_replace("_", " ", $val);
- $nval = ucwords($nval);
-
- $d .= $DSP->input_select_option($val, $nval);
- }
-
- $d .= $DSP->input_select_footer();
- }
-
- $r .= $DSP->tr()
- .$DSP->table_qcell('tableCellTwo', $DSP->input_radio('create_templates', 'theme', ''), '2%', 'top')
- .$DSP->table_qcell('tableCellTwo', $DSP->qdiv('defaultBold', $LANG->line('use_a_theme'), '38%')
- .$DSP->qdiv('itemWrapper',$DSP->input_checkbox('add_rss', 'y', 0).' '.$LANG->line('include_rss_templates')))
- .$DSP->table_qcell('tableCellTwo', $d, '60%')
- .$DSP->tr_c();
-
- $sql = "SELECT group_id, group_name, exp_sites.site_label
- FROM exp_template_groups, exp_sites
- WHERE exp_template_groups.site_id = exp_sites.site_id ";
-
- if ($PREFS->ini('multiple_sites_enabled') !== 'y')
- {
- $sql .= "AND exp_template_groups.site_id = '1' ";
- }
-
- if (USER_BLOG == TRUE)
- {
- $sql .= "AND exp_template_groups.group_id = '".$SESS->userdata['tmpl_group_id']."'";
- }
- else
- {
- $sql .= "AND exp_template_groups.is_user_blog = 'n'";
- }
-
- $sql .= " ORDER BY exp_template_groups.group_name";
-
-
- $query = $DB->query($sql);
-
-
- $d = $DSP->input_select_header('old_group_id');
-
- foreach ($query->result as $row)
- {
- $d .= $DSP->input_select_option($row['group_id'], ($PREFS->ini('multiple_sites_enabled') == 'y') ? $row['site_label'].NBS.'-'.NBS.$row['group_name'] : $row['group_name']);
- }
-
- $d .= $DSP->input_select_footer();
-
-
- $r .= $DSP->tr()
- .$DSP->table_qcell('tableCellOne', $DSP->input_radio('create_templates', 'duplicate', ''))
- .$DSP->table_qcell('tableCellOne', $DSP->qdiv('defaultBold', $LANG->line('duplicate_group')))
- .$DSP->table_qcell('tableCellOne', $d)
- .$DSP->tr_c();
-
- $r .= $DSP->tr()
- .$DSP->table_qcell('tableCellTwo', NBS)
- .$DSP->table_qcell('tableCellTwo', $DSP->qdiv('defaultBold', $DSP->required().$LANG->line('template_group_name')).$DSP->qdiv('', $LANG->line('new_group_instructions')).$DSP->qdiv('', $LANG->line('single_word_no_spaces')))
- .$DSP->td('tableCellTwo', '', '').$DSP->input_text('group_name', '', '16', '50', 'input', '130px').$DSP->td_c()
- .$DSP->tr_c();
-
- $r .= $DSP->table_c();
- }
-
- // Submit button
- $r .= $DSP->qdiv('itemWrapper', $DSP->required(1));
- $r .= $DSP->qdiv('', $DSP->input_submit($LANG->line('submit')));
-
- $r .= $DSP->form_close();
-
- // Assign output data
-
- $DSP->title = $LANG->line('create_new_weblog');
- $DSP->crumb = $DSP->anchor(BASE.AMP.'C=admin'.AMP.'area=weblog_administration', $LANG->line('weblog_administration')).
- $DSP->crumb_item($DSP->anchor(BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=blog_list', $LANG->line('weblog_management'))).
- $DSP->crumb_item($LANG->line('new_weblog'));
- $DSP->body = $r;
- }
- /* END */
-
- /** -----------------------------------------------------------
- /** Weblog preference submission handler
- /** -----------------------------------------------------------*/
- // This function receives the submitted weblog preferences
- // and stores them in the database.
- //-----------------------------------------------------------
- function update_weblog_prefs()
- {
- global $DSP, $IN, $DB, $LOG, $LANG, $FNS, $PREFS, $SESS, $LOC;
-
- if ( ! $DSP->allowed_group('can_admin_weblogs'))
- {
- return $DSP->no_access_message();
- }
-
- // If the $weblog_id variable is present we are editing an
- // existing weblog, otherwise we are creating a new one
-
- $edit = (isset($_POST['weblog_id'])) ? TRUE : FALSE;
-
- $add_rss = (isset($_POST['add_rss'])) ? TRUE : FALSE;
- unset($_POST['add_rss']);
-
- $return = ($IN->GBL('return')) ? TRUE : FALSE;
- unset($_POST['return']);
-
- unset($_POST['edit_group_prefs']);
-
- $dupe_id = $IN->GBL('duplicate_weblog_prefs');
- unset($_POST['duplicate_weblog_prefs']);
-
- // Check for required fields
- $error = array();
-
- if ($_POST['blog_name'] == '')
- {
- $error[] = $LANG->line('no_weblog_name');
- }
-
- if ($_POST['blog_title'] == '')
- {
- $error[] = $LANG->line('no_weblog_title');
- }
-
- if (preg_match('/[^a-z0-9\-\_]/i', $_POST['blog_name']))
- {
- $error[] = $LANG->line('invalid_short_name');
- }
-
- if (isset($_POST['url_title_prefix']) && $_POST['url_title_prefix'] != '')
- {
- $_POST['url_title_prefix'] = strtolower(strip_tags($_POST['url_title_prefix']));
-
- if ( ! preg_match("/^[\w\-]+$/", $_POST['url_title_prefix']))
- {
- $error[] = $LANG->line('invalid_url_title_prefix');
- }
- }
-
- if (count($error) > 0)
- {
- $msg = '';
-
- foreach($error as $val)
- {
- $msg .= $val.BR;
- }
-
- return $DSP->error_message($msg);
- }
-
- if (isset($_POST['comment_expiration']))
- {
- if ( ! is_numeric($_POST['comment_expiration']) || $_POST['comment_expiration'] == '')
- {
- $_POST['comment_expiration'] = 0;
- }
- }
-
- // Is the weblog name taken?
-
- $sql = "SELECT COUNT(*) AS count FROM exp_weblogs WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' AND blog_name = '".$DB->escape_str($_POST['blog_name'])."'";
-
- if ($edit == TRUE)
- {
- $sql .= " AND weblog_id != '".$DB->escape_str($_POST['weblog_id'])."'";
- }
-
- $query = $DB->query($sql);
-
- if ($query->row['count'] > 0)
- {
- return $DSP->error_message($LANG->line('taken_weblog_name'));
- }
-
-
- /** -----------------------------------------
- /** Template Error Trapping
- /** -----------------------------------------*/
- if ($edit == FALSE)
- {
- $create_templates = $IN->GBL('create_templates');
- $old_group_id = $IN->GBL('old_group_id');
- $group_name = strtolower($IN->GBL('group_name', 'POST'));
- $template_theme = $FNS->filename_security($IN->GBL('template_theme'));
-
- unset($_POST['create_templates']);
- unset($_POST['old_group_id']);
- unset($_POST['group_name']);
- unset($_POST['template_theme']);
-
- if ($create_templates != 'no')
- {
- $LANG->fetch_language_file('templates');
-
- if ( ! $DSP->allowed_group('can_admin_templates'))
- {
- return $DSP->no_access_message();
- }
-
- if ( ! $group_name)
- {
- return $DSP->error_message($LANG->line('group_required'));
- }
-
- if ( ! preg_match("#^[a-zA-Z0-9_\-/]+$#i", $group_name))
- {
- return $DSP->error_message($LANG->line('illegal_characters'));
- }
-
- $reserved[] = 'act';
- $reserved[] = 'trackback';
-
- if ($PREFS->ini("forum_is_installed") == 'y' AND $PREFS->ini("forum_trigger") != '')
- {
- $reserved[] = $PREFS->ini("forum_trigger");
- }
-
- if (in_array($group_name, $reserved))
- {
- return $DSP->error_message($LANG->line('reserved_name'));
- }
-
- $query = $DB->query("SELECT COUNT(*) AS count FROM exp_template_groups
- WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
- AND group_name = '".$DB->escape_str($group_name)."'");
-
- if ($query->row['count'] > 0)
- {
- return $DSP->error_message($LANG->line('template_group_taken'));
- }
- }
- }
-
- /** -----------------------------------------
- /** Create Weblog
- /** -----------------------------------------*/
-
- // Construct the query based on whether we are updating or inserting
-
- if (isset($_POST['apply_expiration_to_existing']))
- {
- $this->update_comment_expiration($_POST['weblog_id'], $_POST['comment_expiration']);
- }
-
- unset($_POST['apply_expiration_to_existing']);
-
- if (isset($_POST['cat_group']) && is_array($_POST['cat_group']))
- {
- foreach($_POST['cat_group'] as $key => $value)
- {
- unset($_POST['cat_group_'.$key]);
- }
-
- $_POST['cat_group'] = implode('|', $_POST['cat_group']);
- }
-
- if ($edit == FALSE)
- {
- unset($_POST['weblog_id']);
- unset($_POST['clear_versioning_data']);
-
- $_POST['blog_url'] = $FNS->fetch_site_index();
- $_POST['blog_lang'] = $PREFS->ini('xml_lang');
- $_POST['blog_encoding'] = $PREFS->ini('charset');
-
- // Assign field group if there is only one
-
- if ( ! isset($_POST['field_group']) OR (isset($_POST['field_group']) && ! is_numeric($_POST['field_group'])))
- {
- $query = $DB->query("SELECT group_id FROM exp_field_groups WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'");
-
- if ($query->num_rows == 1)
- {
- $_POST['field_group'] = $query->row['group_id'];
- }
- }
-
- // Insert data
-
- $_POST['site_id'] = $PREFS->ini('site_id');
- // duplicating preferences?
- if ($dupe_id !== FALSE AND is_numeric($dupe_id))
- {
- $wquery = $DB->query("SELECT * FROM exp_weblogs WHERE weblog_id = '".$DB->escape_str($dupe_id)."'");
- if ($wquery->num_rows == 1)
- {
- $exceptions = array('weblog_id', 'site_id', 'blog_name', 'blog_title', 'total_entries',
- 'total_comments', 'total_trackbacks', 'last_entry_date', 'last_comment_date',
- 'last_trackback_date');
- foreach($wquery->row as $key => $val)
- {
- // don't duplicate fields that are unique to each weblog
- if (! in_array($key, $exceptions))
- {
- switch ($key)
- {
- // category, field, and status fields should only be duped
- // if both weblogs are assigned to the same group of each
- case 'cat_group':
- // allow to implicitly set category group to "None"
- if (! isset($_POST[$key]))
- {
- $_POST[$key] = $val;
- }
- break;
- case 'status_group':
- case 'field_group':
- if (! isset($_POST[$key]) OR $_POST[$key] == '')
- {
- $_POST[$key] = $val;
- }
- break;
- case 'deft_status':
- if (! isset($_POST['status_group']) OR $_POST['status_group'] == $wquery->row['status_group'])
- {
- $_POST[$key] = $val;
- }
- break;
- case 'search_excerpt':
- if (! isset($_POST['field_group']) OR $_POST['field_group'] == $wquery->row['field_group'])
- {
- $_POST[$key] = $val;
- }
- break;
- case 'deft_category':
- if (! isset($_POST['cat_group']) OR count(array_diff(explode('|', $_POST['cat_group']), explode('|', $wquery->row['cat_group']))) == 0)
- {
- $_POST[$key] = $val;
- }
- break;
- case 'blog_url':
- case 'comment_url':
- case 'search_results_url':
- case 'tb_return_url':
- case 'ping_return_url':
- case 'rss_url':
- if ($create_templates != 'no')
- {
- if ( ! isset($old_group_name))
- {
- $gquery = $DB->query("SELECT group_name FROM exp_template_groups WHERE group_id = '".$DB->escape_str($old_group_id)."'");
- $old_group_name = $gquery->row['group_name'];
- }
-
- $_POST[$key] = str_replace("/{$old_group_name}/", "/{$group_name}/", $val);
- }
- else
- {
- $_POST[$key] = $val;
- }
- break;
- default :
- $_POST[$key] = $val;
- break;
- }
- }
- }
- }
- }
- $sql = $DB->insert_string('exp_weblogs', $_POST);
- $DB->query($sql);
-
- $insert_id = $DB->insert_id;
- $weblog_id = $insert_id;
-
- $success_msg = $LANG->line('weblog_created');
-
- $crumb = $DSP->crumb_item($LANG->line('new_weblog'));
- $LOG->log_action($success_msg.$DSP->nbs(2).$_POST['blog_title']);
- }
- else
- {
- if (isset($_POST['clear_versioning_data']))
- {
- $DB->query("DELETE FROM exp_entry_versioning WHERE weblog_id = '".$DB->escape_str($_POST['weblog_id'])."'");
- unset($_POST['clear_versioning_data']);
- }
-
-
- $sql = $DB->update_string('exp_weblogs', $_POST, 'weblog_id='.$DB->escape_str($_POST['weblog_id']));
- $DB->query($sql);
- $weblog_id = $DB->escape_str($_POST['weblog_id']);
- $success_msg = $LANG->line('weblog_updated');
-
- $crumb = $DSP->crumb_item($LANG->line('update'));
- }
-
- /** -----------------------------------------
- /** Create Templates
- /** -----------------------------------------*/
- if ($edit == FALSE)
- {
- if ($create_templates != 'no')
- {
- $query = $DB->query("SELECT COUNT(*) AS count FROM exp_template_groups WHERE is_user_blog = 'n'");
- $group_order = $query->row['count'] +1;
-
- $DB->query(
- $DB->insert_string(
- 'exp_template_groups',
- array(
- 'group_id' => '',
- 'group_name' => $group_name,
- 'group_order' => $group_order,
- 'is_site_default' => 'n',
- 'site_id' => $PREFS->ini('site_id')
- )
- )
- );
-
- $group_id = $DB->insert_id;
-
- if ($create_templates == 'duplicate')
- {
- $query = $DB->query("SELECT group_name FROM exp_template_groups WHERE group_id = '".$DB->escape_str($old_group_id)."'");
- $old_group_name = $query->row['group_name'];
-
- $query = $DB->query("SELECT template_name, template_data, template_type, template_notes, cache, refresh, no_auth_bounce, allow_php, php_parse_location FROM exp_templates WHERE group_id = '".$DB->escape_str($old_group_id)."'");
-
- if ($query->num_rows == 0)
- {
- $DB->query(
- $DB->insert_string(
- 'exp_templates',
- array(
- 'template_id' => '',
- 'group_id' => $group_id,
- 'template_name' => 'index',
- 'edit_date' => $LOC->now,
- 'site_id' => $PREFS->ini('site_id')
- )
- )
- );
- }
- else
- {
- $old_blog_name = '';
-
- foreach ($query->result as $row)
- {
- if ($old_blog_name == '')
- {
- if (preg_match_all("/weblog=[\"'](.+?)[\"']/", $row['template_data'], $matches))
- {
- for ($i = 0; $i < count($matches['1']); $i++)
- {
- if (substr($matches['1'][$i], 0, 1) != '{')
- {
- $old_blog_name = $matches['1'][$i];
- break;
- }
- }
- }
- }
-
- $temp = str_replace('weblog="'.$old_blog_name.'"', 'weblog="'.$_POST['blog_name'].'"', $row['template_data']);
- $temp = str_replace("weblog='".$old_blog_name."'", 'weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = preg_replace("/{stylesheet=.+?\/(.+?)}/", "{stylesheet=".$group_name."/\\1}", $temp);
-
- $temp = preg_replace("#assign_variable:master_weblog_name=\".+?\"#", 'assign_variable:master_weblog_name="'.$_POST['blog_name'].'"', $temp);
- $temp = preg_replace("#assign_variable:master_weblog_name=\'.+?\'#", "assign_variable:master_weblog_name='".$_POST['blog_name']."'", $temp);
- $temp = preg_replace('#assign_variable:my_template_group=(\042|\047)([^\\1]*?)\\1#', "assign_variable:my_template_group=\\1{$group_name}\\1", $temp);
-
- $temp = preg_replace("#".$old_group_name."/(.+?)#", $group_name."/\\1", $temp);
-
- $data = array(
- 'template_id' => '',
- 'group_id' => $group_id,
- 'template_name' => $row['template_name'],
- 'template_notes' => $row['template_notes'],
- 'cache' => $row['cache'],
- 'refresh' => $row['refresh'],
- 'no_auth_bounce' => $row['no_auth_bounce'],
- 'php_parse_location' => $row['php_parse_location'],
- 'allow_php' => ($SESS->userdata['group_id'] == 1) ? $row['allow_php'] : 'n',
- 'template_type' => $row['template_type'],
- 'template_data' => $temp,
- 'edit_date' => $LOC->now,
- 'site_id' => $PREFS->ini('site_id')
- );
-
- $DB->query($DB->insert_string('exp_templates', $data));
- }
- }
- }
- else
- {
- $type = 'core';
- if ($fp = @opendir(PATH_MOD))
- {
- while (false !== ($file = readdir($fp)))
- {
- if (strpos($file, '.') === FALSE)
- {
- if ($file == 'mailinglist')
- {
- $type = 'full';
- break;
- }
- }
- }
- closedir($fp);
- }
-
-
- require PATH_THEMES.'site_themes/'.$template_theme.'/'.$template_theme.'.php';
-
- foreach ($template_matrix as $tmpl)
- {
- $Q[] = array($tmpl['0'](), "INSERT INTO exp_templates(template_id, group_id, template_name, template_type, template_data, edit_date, site_id)
- VALUES ('', '$group_id', '".$DB->escape_str($tmpl['0'])."', '".$DB->escape_str($tmpl['1'])."', '{template}', '".$LOC->now."', '".$DB->escape_str($PREFS->ini('site_id'))."')");
- }
-
- if ($add_rss == TRUE)
- {
- require PATH_THEMES.'site_themes/rss/rss.php';
- $Q[] = array(rss_2(), "INSERT INTO exp_templates(template_id, group_id, template_name, template_type, template_data, edit_date, site_id)
- VALUES ('', '$group_id', 'rss_2.0', 'rss', '{template}', '".$DB->escape_str($LOC->now)."', '".$DB->escape_str($PREFS->ini('site_id'))."')");
-
- $Q[] = array(atom(), "INSERT INTO exp_templates(template_id, group_id, template_name, template_type, template_data, edit_date, site_id)
- VALUES ('', '$group_id', 'atom', 'rss', '{template}', '".$DB->escape_str($LOC->now)."', '".$DB->escape_str($PREFS->ini('site_id'))."')");
- }
-
- foreach ($Q as $val)
- {
- $temp = $val['0'];
-
- $temp = str_replace('weblog="weblog1"', 'weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace("weblog='weblog1'", 'weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace('my_weblog="weblog1"', 'my_weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace("my_weblog='weblog1'", 'my_weblog="'.$_POST['blog_name'].'"', $temp);
-
- $temp = str_replace('weblog="default_site"', 'weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace("weblog='default_site'", 'weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace('my_weblog="default_site"', 'my_weblog="'.$_POST['blog_name'].'"', $temp);
- $temp = str_replace("my_weblog='default_site'", 'my_weblog="'.$_POST['blog_name'].'"', $temp);
-
- $temp = str_replace('my_template_group="site"', 'my_template_group="'.$group_name.'"', $temp);
- $temp = str_replace("my_template_group='site'", 'my_template_group="'.$group_name.'"', $temp);
-
- $temp = str_replace("{stylesheet=weblog/weblog_css}", "{stylesheet=".$group_name."/site_css}", $temp);
- $temp = str_replace("{stylesheet=site/site_css}", "{stylesheet=".$group_name."/site_css}", $temp);
-
- $temp = str_replace('assign_variable:master_weblog_name="weblog1"', 'assign_variable:master_weblog_name="'.$_POST['blog_name'].'"', $temp);
- $temp = preg_replace("#weblog/(.+?)#", $group_name."/\\1", $temp);
- $temp = addslashes($temp);
- $sql = str_replace('{template}', $temp, $val['1']);
-
- $DB->query($sql);
- }
- }
- }
- }
-
- $message = $DSP->qdiv('itemWrapper', $DSP->qspan('success', $success_msg).NBS.NBS.'<b>'.$_POST['blog_title'].'</b>');
- if ($edit == FALSE OR $return === TRUE)
- return $this->weblog_overview($message);
- else
- return $this->edit_blog_form($message, $weblog_id);
- }
- /* END */
-
-
- /** -------------------------------------------
- /** Update weblog entries with comment expiration
- /** -------------------------------------------*/
- function update_comment_expiration($weblog_id = '', $expiration = '')
- {
- global $DSP, $IN, $DB, $LOG, $LANG, $FNS, $PREF;
-
- if ( ! $DSP->allowed_group('can_admin_weblogs'))
- {
- return $DSP->no_access_message();
- }
-
- if ($weblog_id == '')
- {
- return FALSE;
- }
-
- if ($expiration == '')
- $expiration = 0;
-
- $time = $expiration * 86400;
-
- $expdate = '';
-
- $query = $DB->query("SELECT entry_id, entry_date FROM exp_weblog_titles WHERE weblog_id = '".$DB->escape_str($weblog_id)."'");
-
- if ($query->num_rows > 0)
- {
- foreach ($query->result as $row)
- {
- if ($expiration > 0)
- {
- $expdate = $row['entry_date'] + $time;
- }
-
- $DB->query("UPDATE exp_weblog_titles SET comment_expiration_date = '$expdate' WHERE entry_id = '".$DB->escape_str($row['entry_id'])."'");
- }
- }
-
- return;
- }
- /* END */
- /** -------------------------------------------
- /** Create pull-down optios from dirctory map
- /** -------------------------------------------*/
- function render_map_as_select_options($zarray, $array_name = '')
- {
- foreach ($zarray as $key => $val)
- {
- if ( is_array($val))
- {
- if ($array_name != "")
- $key = $array_name.'/'.$key;
-
- $this->render_map_as_select_options($val, $key);
- }
- else
- {
- if ($array_name <> "")
- $val = $array_name.'/'.$val;
-
- if (substr($val, -4) == '.php')
- {
- if ($val != 'theme_master.php')
- {
- $this->template_map[] = $val;
- }
- }
- }
- }
- }
- /* END */
- /** -----------------------------------------------------------
- /** Weblog preferences form
- /** -----------------------------------------------------------*/
- // This function displays the form used to edit the various
- // preferences for a given weblog
- //-----------------------------------------------------------
- function edit_blog_form($msg='', $weblog_id='')
- {
- global $DSP, $IN, $DB, $REGX, $LANG, $FNS, $PREFS;
-
- if ( ! $DSP->allowed_group('can_admin_weblogs'))
- {
- return $DSP->no_access_message();
- }
-
- // Set default values
-
- $i = 0;
- $blog_name = '';
- $blog_title = '';
- $cat_group = '';
- $status_group = '';
-
-
- // If we don't have the $weblog_id variable, bail out.
-
- if ($weblog_id == '')
- {
- if ( ! $weblog_id = $IN->GBL('weblog_id'))
- {
- return FALSE;
- }
- }
-
- if ( ! is_numeric($weblog_id))
- {
- return FALSE;
- }
-
- $query = $DB->query("SELECT * FROM exp_weblogs WHERE weblog_id = '$weblog_id'");
-
- foreach ($query->row as $key => $val)
- {
- $$key = $val;
- }
-
- if ($msg != '')
- {
- $DSP->body .= $DSP->qdiv('box', $msg);
- }
-
- $DSP->body_props .= ' onload="showHideMenu(\'weblog\');"';
-
- // Build the output
-
- ob_start();
- ?>
- <script type="text/javascript">
- <!--
- var lastShownObj = '';
- var lastShownColor = '';
- function showHideMenu(objValue)
- {
- if (lastShownObj != '')
- {
- document.getElementById(lastShownObj+'_pointer').getElementsByTagName('a')[0].style.color = lastShownColor;
- document.getElementById(lastShownObj + '_on').style.display = 'none';
- }
-
- lastShownObj = objValue;
- lastShownColor = document.getElementById(objValue+'_pointer').getElementsByTagName('a')[0].style.color;
-
- document.getElementById(objValue + '_on').style.display = 'block';
- document.getElementById(objValue+'_pointer').getElementsByTagName('a')[0].style.color = '#000';
- }
- //-->
- </script>
- <?php
-
- $buffer = ob_get_contents();
- ob_end_clean();
- $DSP->body .= $buffer;
-
- // Third table cell contains are preferences in hidden <div>'s
-
- $r = $DSP->form_open(array('action' => 'C=admin'.AMP.'M=blog_admin'.AMP.'P=update_preferences'));
- $r .= $DSP->input_hidden('weblog_id', $weblog_id);
-
- $r .= $DSP->qdiv('default', '', 'menu_contents');
-
- $r .= '<div id="weblog_on" style="display: none; padding:0; margin: 0;">';
- $r .= $DSP->table('tableBorder', '0', '', '100%');
- $r .= $DSP->tr();
-
- $r .= "<td class='tableHeadingAlt' id='weblog2' colspan='2'>";
- $r .= NBS.$LANG->line('weblog_base_setup').$DSP->td_c();
- $r .= $DSP->tr_c();
-
- /** -------------------------
- /** General settings
- /** ------------------------*/
-
- // Weblog "full name" field
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->required().NBS.$DSP->qspan('defaultBold', $LANG->line('full_weblog_name', 'blog_title')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('blog_title', $blog_title, '20', '100', 'input', '260px'), '50%').
- $DSP->tr_c();
-
- // Weblog "short name" field
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
-
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->required().NBS.$DSP->qspan('defaultBold', $LANG->line('short_weblog_name', 'blog_name')).$DSP->nbs(2).'-'.$DSP->nbs(2).$LANG->line('single_word_no_spaces'), '50%').
- $DSP->table_qcell($style, $DSP->input_text('blog_name', $blog_name, '20', '40', 'input', '260px'), '50%').
- $DSP->tr_c();
-
- // Weblog descriptions field
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('blog_description', 'blog_descriptions')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('blog_description', $blog_description, '50', '225', 'input', '100%'), '50%').
- $DSP->tr_c();
-
-
- // Weblog Language
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('blog_lang', 'blog_lang')), '50%').
- $DSP->table_qcell($style, $FNS->encoding_menu('languages', 'blog_lang', $blog_lang), '50%').
- $DSP->tr_c();
-
- // Weblog Encoding
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('blog_encoding', 'blog_encoding')), '50%').
- $DSP->table_qcell($style, $FNS->encoding_menu('charsets', 'blog_encoding', $blog_encoding), '50%').
- $DSP->tr_c().
- $DSP->table_c();
-
- $r .= $DSP->div_c();
-
- /** ---------------------------
- /** Paths
- /** ---------------------------*/
-
- $r .= '<div id="paths_on" style="display: none; padding:0; margin: 0;">';
- $r .= $DSP->table('tableBorder', '0', '', '100%');
- $r .= $DSP->tr();
-
- $r .= "<td class='tableHeadingAlt' id='paths2' colspan='2'>";
- $r .= NBS.$LANG->line('paths').$DSP->td_c();
- $r .= $DSP->tr_c();
-
- // Weblog URL field
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('blog_url', 'blog_url')).$DSP->qdiv('default', $LANG->line('weblog_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('blog_url', $blog_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
-
- // comment URL
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('comment_url', 'comment_url')).$DSP->qdiv('default', $LANG->line('comment_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('comment_url', $comment_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
-
- // Search results URL
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('search_results_url', 'search_results_url')).$DSP->qdiv('default', $LANG->line('search_results_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('search_results_url', $search_results_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
-
- // TB return URL
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('tb_return_url', 'tb_return_url')).$DSP->qdiv('default', $LANG->line('tb_return_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('tb_return_url', $tb_return_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
- // Ping pMachine URL
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('ping_return_url', 'ping_return_url')).$DSP->qdiv('default', $LANG->line('ping_return_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('ping_return_url', $ping_return_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
-
- // RSS URL - Extended Ping
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('rss_url', 'rss_url')).$DSP->qdiv('default', $LANG->line('rss_url_exp')), '50%').
- $DSP->table_qcell($style, $DSP->input_text('rss_url', $rss_url, '50', '80', 'input', '100%'), '50%').
- $DSP->tr_c();
- // live_look_template
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr()
- .$DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('live_look_template')))
- .$DSP->td($style, '50%')
- .$DSP->input_select_header('live_look_template')
- .$DSP->input_select_option('0', $LANG->line('no_live_look_template'), ($live_look_template == 0) ? '1' : 0);
- $sql = "SELECT tg.group_name, t.template_id, t.template_name
- FROM exp_template_groups tg, exp_templates t
- WHERE tg.group_id = t.group_id
- AND tg.site_id = '".$DB->escape_str($PREFS->ini('site_id'))."' ";
- if (USER_BLOG == TRUE)
- {
- $sql .= "AND tg.group_id = '".$SESS->userdata['tmpl_group_id']."' ";
- }
- else
- {
- $sql .= "AND tg.is_user_blog = 'n' ";
- }
- $sql .= " ORDER BY tg.group_name, t.template_name";
- $tquery = $DB->query($sql);
-
- if ($tquery->num_rows > 0)
- {
- foreach ($tquery->result as $template)
- {
- $r .= $DSP->input_select_option($template['template_id'], $template['group_name'].'/'.$template['template_name'], (($template['template_id'] == $live_look_template) ? 1 : ''));
- }
- }
- $r .= $DSP->input_select_footer()
- .$DSP->td_c()
- .$DSP->tr_c();
- $r .= $DSP->tr_c().
- $DSP->table_c();
-
- $r .= $DSP->div_c();
-
- /** ---------------------------
- /** Administrative settings
- /** ---------------------------*/
-
- $r .= '<div id="admin_on" style="display: none; padding:0; margin: 0;">';
- $r .= $DSP->table('tableBorder', '0', '', '100%');
- $r .= $DSP->tr();
-
- $r .= "<td class='tableHeadingAlt' id='admin2' colspan='2'>";
- $r .= NBS.$LANG->line('default_settings').$DSP->td_c();
- $r .= $DSP->tr_c();
-
-
- // Default status menu
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('default_status')), '50%');
-
- $r .= $DSP->td($style, '50%').
- $DSP->input_select_header('deft_status');
-
- $query = $DB->query("SELECT * FROM exp_statuses WHERE group_id = '".$DB->escape_str($status_group)."' ORDER BY status");
-
- if ($query->num_rows == 0)
- {
- $selected = ($deft_status == 'open') ? 1 : '';
-
- $r .= $DSP->input_select_option('open', $LANG->line('open'), $selected);
-
- $selected = ($deft_status == 'closed') ? 1 : '';
-
- $r .= $DSP->input_select_option('closed', $LANG->line('closed'), $selected);
- }
- else
- {
- foreach ($query->result as $row)
- {
- $selected = ($deft_status == $row['status']) ? 1 : '';
-
- $status_name = ($row['status'] == 'open' OR $row['status'] == 'closed') ? $LANG->line($row['status']) : $row['status'];
-
- $r .= $DSP->input_select_option($row['status'], $status_name, $selected);
- }
- }
-
- $r .= $DSP->input_select_footer().
- $DSP->td_c().
- $DSP->tr_c();
-
- // Default category menu
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr().
- $DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('default_category')), '50%');
-
- $r .= $DSP->td($style, '50%').
- $DSP->input_select_header('deft_category');
-
- $selected = '';
-
- $r .= $DSP->input_select_option('', $LANG->line('none'), $selected);
-
- $cats = implode("','", $DB->escape_str(explode('|', $cat_group)));
- $query = $DB->query("SELECT CONCAT(g.group_name, ': ', c.cat_name) as display_name, c.cat_id, c.cat_name, g.group_name
- FROM exp_categories c, exp_category_groups g
- WHERE g.group_id = c.group_id
- AND c.group_id IN ('{$cats}') ORDER BY display_name");
- if ($query->num_rows > 0)
- {
- foreach ($query->result as $row)
- {
- $selected = ($deft_category == $row['cat_id']) ? 1 : '';
-
- $r .= $DSP->input_select_option($row['cat_id'], $row['display_name'], $selected);
- }
- }
-
- $r .= $DSP->input_select_footer().
- $DSP->td_c().
- $DSP->tr_c();
-
- // Enable comments
-
- $style = ($i++ % 2) ? 'tableCellOne' : 'tableCellTwo' ;
- $r .= $DSP->tr()
- .$DSP->table_qcell($style, $DSP->qspan('defaultBold', $LANG->line('deft_comments')), '50%')
- .$DSP->td($style, '50%');
- $r .= $LANG->line('yes')
- .$DSP->input_radio('deft_comments', 'y', ($deft_comments == 'y') ? 1 : '').$DSP->nbs(3);
- $r .= $LANG->line('no')
- .$DSP->input_radio('deft_comments', 'n', ($deft_comments == 'n') ? 1 : '')
- .$DSP->td_c()
- .$DSP->tr_c();
- …
Large files files are truncated, but you can click here to view the full file