| ';
showsubmit('addsubmit');
showtablefooter();
showformfooter();
}
} elseif($operation == 'edit' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!($blockxml = C::t('common_block_xml')->fetch($id))) {
cpmsg('blockxml_xmlurl_notfound', '', 'error');
}
if(submitcheck('editsubmit')) {
require_once libfile('function/importdata');
import_block($_GET['xmlurl'], $_GET['clientid'], $_GET['key'], $_GET['signtype'], 1, $id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_update_succeed', 'action=blockxml', 'succeed');
} else {
showsubmenu('blockxml', array(
array('list', 'blockxml', 0),
array('add', 'blockxml&operation=add', 1)
));
showformheader('blockxml&operation=edit&id='.$id);
showtableheader(cplang('blockxml_edit').' - '.$blockxml['name']);
showsetting('blockxml_xmlurl', 'xmlurl', $blockxml['url'], 'text');
showsetting('blockxml_clientid', 'clientid', $blockxml['clientid'], 'text');
showsetting('blockxml_signtype', array('signtype', $signtypearr), $blockxml['signtype'], 'select');
showsetting('blockxml_xmlkey', 'key', $blockxml['key'], 'text');
showtablerow('', '', '');
showsubmit('editsubmit');
showtablefooter();
showformfooter();
}
} elseif($operation == 'update' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!($blockxml = C::t('common_block_xml')->fetch($id))) {
cpmsg('blockxml_xmlurl_notfound', '', 'error');
}
require_once libfile('function/importdata');
import_block($blockxml['url'], $blockxml['clientid'], $blockxml['key'], $blockxml['signtype'], 1, $id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_update_succeed', 'action=blockxml', 'succeed');
} elseif($operation == 'delete' && !empty($_GET['id'])) {
$id = intval($_GET['id']);
if(!empty($_GET['confirm'])) {
C::t('common_block_xml')->delete($id);
require_once libfile('function/block');
blockclass_cache();
cpmsg('blockxml_xmlurl_delete_succeed', 'action=blockxml', 'succeed');
} else {
cpmsg('blockxml_xmlurl_delete_confirm', 'action=blockxml&operation=delete&id='.$id.'&confirm=yes', 'form');
}
} else {
showsubmenu('blockxml', array(
array('list', 'blockxml', 1),
array('add', 'blockxml&operation=add', 0)
));
showtableheader('blockxml_list');
showsubtitle(array('blockxml_name', 'blockxml_xmlurl', 'operation'));
foreach(C::t('common_block_xml')->range() as $row) {
showtablerow('', array('class=""', 'class=""', 'class="td28"'), array(
$row['name'],
$row['url'],
"".cplang('blockxml_update')." ".
"".cplang('edit')." ".
"".cplang('delete')." "
));
}
showtablefooter();
showformfooter();
}
?>