function add_or_edit_link() { global $smarty, $lang; $lin_id = post('lin_id'); $lin_word = post('lin_word'); $lin_url = post('lin_url'); $lin_img = post('lin_img'); $lin_title = post('lin_title'); if ($lin_img == 'http://' || $lin_img == '') { $lin_img = 'none'; } $obj = new link(); $obj->set_value('lin_word', $lin_word); $obj->set_value('lin_url', $lin_url); $obj->set_value('lin_img', $lin_img); $obj->set_value('lin_title', $lin_title); if ($lin_id != '') { $obj->set_where("lin_id = {$lin_id}"); $obj->edit(); $info_text = '修改友情链接成功'; } else { $obj->set_value('lin_lang', S_LANG); $obj->add(); $info_text = '添加友情链接成功'; } $smarty->assign('info_text', $info_text); $smarty->assign('link_text', $lang['return_list']); $smarty->assign('link_href', url(array('channel' => 'service', 'mod' => 'link_list'))); }
function module_link_edit() { global $global, $smarty; $obj = new link(); $obj->set_where('lin_id = ' . $global['id']); $smarty->assign('link', $obj->get_one()); }
function module_link() { global $smarty; $obj = new link(); $obj->set_field('lin_url,lin_img,lin_word,lin_title'); $obj->set_where("lin_img <> 'none'"); $smarty->assign('img_link', $obj->get_list()); $obj = new link(); $obj->set_field('lin_url,lin_img,lin_word,lin_title'); $obj->set_where("lin_img = 'none'"); $smarty->assign('word_link', $obj->get_list()); }