cot_redirect($r_url); exit; } $out['subtitle'] = $L['projects_edit_project_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['projects'][$item['item_cat']]['title']; $mskin = cot_tplfile(array('projects', 'edit', $structure['projects'][$item['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('projects.edit.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRJEDIT_FORM_SEND" => cot_url('projects', "m=edit&a=update&id=" . $item['item_id'] . "&r=" . $r), "PRJEDIT_FORM_ID" => $item['item_id'], "PRJEDIT_FORM_CAT" => cot_selectbox_structure('projects', $item['item_cat'], 'rcat'), "PRJEDIT_FORM_CATTITLE" => $structure['projects'][$item['item_cat']]['title'], "PRJEDIT_FORM_TYPETITLE" => is_array($projects_types) && !empty($item['item_type']) ? $projects_types[$item['item_type']] : '', "PRJEDIT_FORM_TYPE" => is_array($projects_types) ? cot_selectbox($item['item_type'] ? $item['item_type'] : $cfg['projects']['default_type'], 'rtype', array_keys($projects_types), array_values($projects_types)) : 'empty', "PRJEDIT_FORM_TITLE" => cot_inputbox('text', 'rtitle', $item['item_title'], 'size="56"'), "PRJEDIT_FORM_ALIAS" => cot_inputbox('text', 'ralias', $item['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRJEDIT_FORM_TEXT" => cot_textarea('rtext', $item['item_text'], 10, 60, 'id="formtext"', $prjeditor ? 'input_textarea_' . $prjeditor : ''), "PRJEDIT_FORM_COST" => cot_inputbox('text', 'rcost', $item['item_cost'], 'size="10"'), "PRJEDIT_FORM_STATE" => $item['item_state'], "PRJEDIT_FORM_PARSER" => cot_selectbox($item['item_parser'], 'rparser', cot_get_parsers(), cot_get_parsers(), false), "PRJEDIT_FORM_DELETE" => cot_radiobox(0, 'rdelete', array(1, 0), array($L['Yes'], $L['No'])))); // Extra fields foreach ($cot_extrafields[$db_projects] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $item['item_' . $exfld['field_name']]); $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRJEDIT_FORM_' . $uname => $exfld_val, 'PRJEDIT_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRJEDIT_FORM_EXTRAFLD' => $exfld_val, 'PRJEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('projects.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
cot_redirect($r_url); exit; } $out['subtitle'] = $L['folio_edit_product_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['folio'][$item['item_cat']]['title']; $mskin = cot_tplfile(array('folio', 'edit', $structure['folio'][$item['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('folio.edit.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRDEDIT_FORM_SEND" => cot_url('folio', "m=edit&a=update&id=" . $item['item_id'] . "&r=" . $r), "PRDEDIT_FORM_ID" => $item['item_id'], "PRDEDIT_FORM_CAT" => cot_selectbox_structure('folio', $item['item_cat'], 'rcat'), "PRDEDIT_FORM_CATTITLE" => $structure['folio'][$item['item_cat']]['title'], "PRDEDIT_FORM_TITLE" => cot_inputbox('text', 'rtitle', $item['item_title'], 'size="56"'), "PRDEDIT_FORM_ALIAS" => cot_inputbox('text', 'ralias', $item['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRDEDIT_FORM_TEXT" => cot_textarea('rtext', $item['item_text'], 10, 60, 'id="formtext"', $folioeditor ? 'input_textarea_' . $folioeditor : ''), "PRDEDIT_FORM_COST" => cot_inputbox('text', 'rcost', $item['item_cost'], 'size="10"'), "PRDEDIT_FORM_STATE" => $item['item_state'], "PRDEDIT_FORM_PARSER" => cot_selectbox($item['item_parser'], 'rparser', cot_get_parsers(), cot_get_parsers(), false), "PRDEDIT_FORM_DELETE" => cot_radiobox(0, 'rdelete', array(1, 0), array($L['Yes'], $L['No'])))); // Extra fields foreach ($cot_extrafields[$db_folio] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $item['item_' . $exfld['field_name']]); $exfld_title = isset($L['folio_' . $exfld['field_name'] . '_title']) ? $L['folio_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRDEDIT_FORM_' . $uname => $exfld_val, 'PRDEDIT_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRDEDIT_FORM_EXTRAFLD' => $exfld_val, 'PRDEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('folio.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
$type = cot_import('type', 'G', 'INT'); $r = cot_import('r', 'G', 'ALP'); $c = cot_import('c', 'G', 'TXT'); if (!empty($c) && !isset($structure['projects'][$c])) { $c = ''; } list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', 'any', 'RWA'); cot_block($usr['auth_write']); /* === Hook === */ $extp = cot_getextplugins('projects.add.first'); foreach ($extp as $pl) { include $pl; } /* ===== */ $sys['parser'] = $cfg['projects']['parser']; $parser_list = cot_get_parsers(); if ($a == 'add') { cot_shield_protect(); $ritem = array(); /* === Hook === */ foreach (cot_getextplugins('projects.add.add.first') as $pl) { include $pl; } /* ===== */ $ritem = cot_projects_import('POST', array(), $usr); list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', $ritem['item_cat']); cot_block($usr['auth_write']); /* === Hook === */ foreach (cot_getextplugins('projects.add.add.import') as $pl) { include $pl; }
/** * Imports page data from request parameters. * @param string $source Source request method for parameters * @param array $rpage Existing page data from database * @param array $auth Permissions array * @return array Page data */ function cot_page_import($source = 'POST', $rpage = array(), $auth = array()) { global $cfg, $db_pages, $cot_extrafields, $usr, $sys; if (count($auth) == 0) { $auth = cot_page_auth($rpage['page_cat']); } if ($source == 'D' || $source == 'DIRECT') { // A trick so we don't have to affect every line below global $_PATCH; $_PATCH = $rpage; $source = 'PATCH'; } $rpage['page_cat'] = cot_import('rpagecat', $source, 'TXT'); $rpage['page_keywords'] = cot_import('rpagekeywords', $source, 'TXT'); $rpage['page_alias'] = cot_import('rpagealias', $source, 'TXT'); $rpage['page_title'] = cot_import('rpagetitle', $source, 'TXT'); $rpage['page_desc'] = cot_import('rpagedesc', $source, 'TXT'); $rpage['page_text'] = cot_import('rpagetext', $source, 'HTM'); $rpage['page_parser'] = cot_import('rpageparser', $source, 'ALP'); $rpage['page_author'] = cot_import('rpageauthor', $source, 'TXT'); $rpage['page_file'] = intval(cot_import('rpagefile', $source, 'INT')); $rpage['page_url'] = cot_import('rpageurl', $source, 'TXT'); $rpage['page_size'] = (int) cot_import('rpagesize', $source, 'INT'); $rpage['page_file'] = $rpage['page_file'] == 0 && !empty($rpage['page_url']) ? 1 : $rpage['page_file']; $rpagedatenow = cot_import('rpagedatenow', $source, 'BOL'); $rpage['page_date'] = cot_import_date('rpagedate', true, false, $source); $rpage['page_date'] = $rpagedatenow || is_null($rpage['page_date']) ? $sys['now'] : (int) $rpage['page_date']; $rpage['page_begin'] = (int) cot_import_date('rpagebegin'); $rpage['page_expire'] = (int) cot_import_date('rpageexpire'); $rpage['page_expire'] = $rpage['page_expire'] <= $rpage['page_begin'] ? 0 : $rpage['page_expire']; $rpage['page_updated'] = $sys['now']; $rpage['page_keywords'] = cot_import('rpagekeywords', $source, 'TXT'); $rpage['page_metatitle'] = cot_import('rpagemetatitle', $source, 'TXT'); $rpage['page_metadesc'] = cot_import('rpagemetadesc', $source, 'TXT'); $rpublish = cot_import('rpublish', $source, 'ALP'); // For backwards compatibility $rpage['page_state'] = $rpublish == 'OK' ? 0 : cot_import('rpagestate', $source, 'INT'); if ($auth['isadmin'] && isset($rpage['page_ownerid'])) { $rpage['page_count'] = cot_import('rpagecount', $source, 'INT'); $rpage['page_ownerid'] = cot_import('rpageownerid', $source, 'INT'); $rpage['page_filecount'] = cot_import('rpagefilecount', $source, 'INT'); } else { $rpage['page_ownerid'] = $usr['id']; } $parser_list = cot_get_parsers(); if (empty($rpage['page_parser']) || !in_array($rpage['page_parser'], $parser_list) || $rpage['page_parser'] != 'none' && !cot_auth('plug', $rpage['page_parser'], 'W')) { $rpage['page_parser'] = isset($sys['parser']) ? $sys['parser'] : $cfg['page']['parser']; } // Extra fields foreach ($cot_extrafields[$db_pages] as $exfld) { $rpage['page_' . $exfld['field_name']] = cot_import_extrafields('rpage' . $exfld['field_name'], $exfld, $source, $rpage['page_' . $exfld['field_name']]); } return $rpage; }
} $pag = $row_page; $pag['page_status'] = cot_page_status($pag['page_state'], $pag['page_begin'], $pag['page_expire']); cot_block($usr['isadmin'] || $usr['auth_write'] && $usr['id'] == $pag['page_ownerid']); $out['subtitle'] = $L['page_edittitle']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['page'][$pag['page_cat']]['title']; $mskin = cot_tplfile(array('page', 'edit', $structure['page'][$pag['page_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('page.edit.main') as $pl) { include $pl; } /* ===== */ require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate($mskin); $pageedit_array = array('PAGEEDIT_PAGETITLE' => $L['page_edittitle'], 'PAGEEDIT_SUBTITLE' => $L['page_editsubtitle'], 'PAGEEDIT_FORM_SEND' => cot_url('page', "m=edit&a=update&id=" . $pag['page_id']), 'PAGEEDIT_FORM_ID' => $pag['page_id'], 'PAGEEDIT_FORM_STATE' => $pag['page_state'], 'PAGEEDIT_FORM_STATUS' => $pag['page_status'], 'PAGEEDIT_FORM_LOCALSTATUS' => $L['page_status_' . $pag['page_status']], 'PAGEEDIT_FORM_CAT' => cot_selectbox_structure('page', $pag['page_cat'], 'rpagecat'), 'PAGEEDIT_FORM_CAT_SHORT' => cot_selectbox_structure('page', $pag['page_cat'], 'rpagecat', $c), 'PAGEEDIT_FORM_KEYWORDS' => cot_inputbox('text', 'rpagekeywords', $pag['page_keywords'], array('size' => '32', 'maxlength' => '255')), 'PAGEEDIT_FORM_METATITLE' => cot_inputbox('text', 'rpagemetatitle', $pag['page_metatitle'], array('size' => '64', 'maxlength' => '255')), 'PAGEEDIT_FORM_METADESC' => cot_textarea('rpagemetadesc', $pag['page_metadesc'], 2, 64, array('maxlength' => '255')), 'PAGEEDIT_FORM_ALIAS' => cot_inputbox('text', 'rpagealias', $pag['page_alias'], array('size' => '32', 'maxlength' => '255')), 'PAGEEDIT_FORM_TITLE' => cot_inputbox('text', 'rpagetitle', $pag['page_title'], array('size' => '64', 'maxlength' => '255')), 'PAGEEDIT_FORM_DESC' => cot_textarea('rpagedesc', $pag['page_desc'], 2, 64, array('maxlength' => '255')), 'PAGEEDIT_FORM_AUTHOR' => cot_inputbox('text', 'rpageauthor', $pag['page_author'], array('size' => '24', 'maxlength' => '100')), 'PAGEEDIT_FORM_DATE' => cot_selectbox_date($pag['page_date'], 'long', 'rpagedate') . ' ' . $usr['timetext'], 'PAGEEDIT_FORM_DATENOW' => cot_checkbox(0, 'rpagedatenow'), 'PAGEEDIT_FORM_BEGIN' => cot_selectbox_date($pag['page_begin'], 'long', 'rpagebegin') . ' ' . $usr['timetext'], 'PAGEEDIT_FORM_EXPIRE' => cot_selectbox_date($pag['page_expire'], 'long', 'rpageexpire') . ' ' . $usr['timetext'], 'PAGEEDIT_FORM_UPDATED' => cot_date('datetime_full', $pag['page_updated']) . ' ' . $usr['timetext'], 'PAGEEDIT_FORM_FILE' => cot_selectbox($pag['page_file'], 'rpagefile', range(0, 2), array($L['No'], $L['Yes'], $L['Members_only']), false), 'PAGEEDIT_FORM_URL' => cot_inputbox('text', 'rpageurl', $pag['page_url'], array('size' => '56', 'maxlength' => '255')), 'PAGEEDIT_FORM_SIZE' => cot_inputbox('text', 'rpagesize', $pag['page_size'], array('size' => '56', 'maxlength' => '255')), 'PAGEEDIT_FORM_TEXT' => cot_textarea('rpagetext', $pag['page_text'], 24, 120, '', 'input_textarea_editor'), 'PAGEEDIT_FORM_DELETE' => cot_radiobox(0, 'rpagedelete', array(1, 0), array($L['Yes'], $L['No'])), 'PAGEEDIT_FORM_PARSER' => cot_selectbox($pag['page_parser'], 'rpageparser', cot_get_parsers(), cot_get_parsers(), false)); if ($usr['isadmin']) { $pageedit_array += array('PAGEEDIT_FORM_OWNERID' => cot_inputbox('text', 'rpageownerid', $pag['page_ownerid'], array('size' => '24', 'maxlength' => '24')), 'PAGEEDIT_FORM_PAGECOUNT' => cot_inputbox('text', 'rpagecount', $pag['page_count'], array('size' => '8', 'maxlength' => '8')), 'PAGEEDIT_FORM_FILECOUNT' => cot_inputbox('text', 'rpagefilecount', $pag['page_filecount'], array('size' => '8', 'maxlength' => '8'))); } $t->assign($pageedit_array); // Extra fields foreach ($cot_extrafields[$db_pages] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rpage' . $exfld['field_name'], $exfld, $pag['page_' . $exfld['field_name']]); $exfld_title = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PAGEEDIT_FORM_' . $uname => $exfld_val, 'PAGEEDIT_FORM_' . $uname . '_TITLE' => $exfld_title, 'PAGEEDIT_FORM_EXTRAFLD' => $exfld_val, 'PAGEEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } // Error and message handling cot_display_messages($t); /* === Hook === */