} $defs = array(); for ($i = 0; isset($_POST['cf_' . $i . '_key']); $i++) { $cf = array(); $cf['key'] = htmlspecialchars(stripslashes($_POST['cf_' . $i . '_key']), ENT_QUOTES); $cf['label'] = htmlspecialchars(stripslashes($_POST['cf_' . $i . '_label']), ENT_QUOTES); $cf['type'] = htmlspecialchars(stripslashes($_POST['cf_' . $i . '_type']), ENT_QUOTES); $cf['value'] = htmlspecialchars(stripslashes($_POST['cf_' . $i . '_value']), ENT_QUOTES); $cf['options'] = preg_split("/\r?\n/", rtrim(htmlspecialchars(stripslashes($_POST['cf_' . $i . '_value']), ENT_QUOTES))); $defs[] = $cf; } array_pop($defs); // remove the last hidden line } } else { $defs = im_customfield_def(); } } ?> <label><?php i18n('items/CUSTOMFIELDS_TITLE'); ?> </label> <p class="clear"><?php i18n('items/CUSTOMFIELDS_DESCR'); ?> </p> <p><?php i18n('items/FUNCTIONS_DESCR'); ?> </p>
<?php global $SITEURL; global $data_edit; global $item_data; $id = @$_GET['edit']; $file = ITEMDATA . $id . '.xml'; $data_edit = @getXML($file); // SimpleXML to read from $list_fields = im_customfield_def(); if (!$list_fields || count($list_fields) <= 0) { return; } echo '<table><tr class="user_sub_tr"><td><h2 style="padding:0px;margin:0px;">' . IMTITLE . ' Information: </h2></td></tr>'; // Editor settings (copied from edit.php) if (defined('GSEDITORLANG')) { $EDLANG = GSEDITORLANG; } else { $EDLANG = 'en'; } if (defined('GSEDITORTOOL')) { $EDTOOL = GSEDITORTOOL; } else { $EDTOOL = 'basic'; } if (defined('GSEDITOROPTIONS') && trim(GSEDITOROPTIONS) != "") { $EDOPTIONS = ", " . GSEDITOROPTIONS; } else { $EDOPTIONS = ''; } if ($EDTOOL == 'advanced') {
public function processItem() { $id = clean_urls(to7bits($_POST['post-title'], "UTF-8")); $file = ITEMDATA . $id . '.xml'; $title = $_POST['post-title']; $category = $_POST['category']; $content = safe_slash_htmll($_POST['post-content']); if (!file_exists($file)) { $date = date('j M Y'); } else { $data = @getXML($file); $date = $data->date; } $xml = @new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>'); $xml->addChild('title', empty($title) ? '(no title)' : $title); $xml->addChild('slug', $id); $xml->addChild('visible', true); $xml->addChild('date', $date); $xml->addChild('category', $category); $note = $xml->addChild('content'); $note->addCData($content); $newse = im_customfield_def(); foreach ($newse as $thes) { $keys = $thes['key']; if (isset($_POST['post-' . $keys])) { if ($keys != "content" && $keys != "excerpt") { $tmp = $xml->addChild($keys); $tmp->addCData($_POST['post-' . $keys]); } } } XMLsave($xml, $file); if (!is_writable($file)) { echo '<div class="error">Unable to write ' . IMTITLE . ' data to file</div>'; } else { echo '<div class="updated">The ' . IMTITLE . ' has been succesfully saved</div>'; } $this->showItemsAdmin(); }