if (!empty($files['picture'])) { cs_pictures_upload($files['picture'], 'articles', $articles_id); } cs_redirect($cs_lang['create_done'], 'articles'); } else { $data['head']['body'] = $errormsg; } } else { $data['art']['articles_com'] = ''; $data['art']['articles_navlist'] = ''; $data['art']['articles_fornext'] = ''; $data['art']['articles_headline'] = ''; $data['art']['articles_text'] = ''; $data['art']['articles_time'] = cs_time(); $data['art']['users_id'] = $account['users_id']; $data['art']['categories_id'] = 0; } $categories_id = empty($data['art']['categories_id']) ? 0 : $data['art']['categories_id']; $data['categories']['dropdown'] = cs_categories_dropdown('articles', $categories_id); $data['pictures']['select'] = cs_pictures_select('articles'); $on = "onclick=\"javascript:abc_insert"; if (empty($cs_main['rte_html'])) { $data['if']['rte_html'] = 0; $data['if']['no_rte_html'] = 1; $data['abcode']['features'] = cs_abcode_features('articles_text', 1, 1); } else { $data['if']['rte_html'] = 1; $data['if']['no_rte_html'] = 0; $data['articles']['content'] = cs_rte_html('articles_text', $data['art']['articles_text']); } echo cs_subtemplate(__FILE__, $data, 'articles', 'create');
if (!empty($error) or !isset($_POST['submit'])) { $data['data']['articles_id'] = empty($_POST['id']) ? $_GET['id'] : $_POST['id']; $data['data']['articles_time'] = $cs_articles['articles_time']; $data['data']['articles_headline'] = $cs_articles['articles_headline']; $data['data']['categories_id'] = $cs_articles['categories_id']; $data['data']['articles_text'] = $cs_articles['articles_text']; if (empty($cs_main['rte_html'])) { $data['if']['rte_html'] = 0; $data['if']['no_rte_html'] = 1; $data['abcode']['features'] = cs_abcode_features('articles_text', 1, 1); } else { $data['if']['rte_html'] = 1; $data['if']['no_rte_html'] = 0; $data['articles']['content'] = cs_rte_html('articles_text', $data['data']['articles_text']); } $data['data']['articles_com_checked'] = empty($cs_articles['articles_com']) ? '' : 'checked="checked"'; $data['data']['articles_navlist_checked'] = empty($cs_articles['articles_navlist']) ? '' : 'checked="checked"'; $data['data']['articles_fornext_checked'] = empty($cs_articles['articles_fornext']) ? '' : 'checked="checked"'; $data['pictures']['select'] = cs_pictures_select('articles', $data['data']['articles_id']); $data['categories']['dropdown'] = cs_categories_dropdown('articles', $cs_articles['categories_id']); echo cs_subtemplate(__FILE__, $data, 'articles', 'edit'); } else { $articles_id = (int) $_POST['id']; $articles_cells = array_keys($cs_articles); $articles_save = array_values($cs_articles); cs_sql_update(__FILE__, 'articles', $articles_cells, $articles_save, $articles_id); if (!empty($files['picture'])) { cs_pictures_upload($files['picture'], 'articles', $articles_id); } cs_redirect($cs_lang['changes_done'], 'articles'); }