23 OR $minute < 0 OR $minute > 59 OR $second < 0 OR $second > 59 ) $errors[] = $l['admin']['false_date']; */ if($form_input['section'] == 'page') { $sql = "SELECT id FROM ".JLOG_DB_CONTENT." WHERE url = '".$f['url']."';"; } else { $sql = "SELECT id FROM ".JLOG_DB_CONTENT." WHERE YEAR(date) = ".date("Y", strtotime($f['date']))." AND MONTH(date) = ".date("m", strtotime($f['date']))." AND url = '".$f['url']."';"; } $check_url = new Query($sql); if($check_url->error()) { echo "
\n"; echo $check_url->getError(); echo "\n"; die(); } if($check_url->numRows() > 0) { $c = $check_url->fetch(); if($c['id'] != $form_input['id'] AND $form_input['section'] != 'page') $errors[] = $l['admin']['url_duplicate']; elseif($c['id'] != $form_input['id'] AND $form_input['section'] == 'page') $errors[] = $l['admin']['url_duplicate_page']; } } if(strlen(trim($form_input['teaserpic']) > 0) AND !is_file(JLOG_BASEPATH.'img'.DIRECTORY_SEPARATOR."t_".$form_input['teaserpic'])) { $errors[] = $l['admin']['false_teaserpic']; } if(isset($form_input['teaserpiconblog']) && $form_input['teaserpiconblog'] == "1" AND strlen(trim($form_input['teaserpic'])) == 0) { $errors[] = $l['admin']['no_teaserpic_uploaded']; } if(strlen(trim($form_input['teaser'])) < 1) $errors[] = $l['admin']['no_teaser']; if(strlen(trim($form_input['content'])) < 1) $errors[] = $l['admin']['no_content']; return $errors; } // Eingabeformular function form_output($form_input) { $form_input = array_htmlspecialchars($form_input); global $l, $categories, $plugins; if (isset($form_input['teaserpiconblog']) && $form_input['teaserpiconblog'] == 1) $form_input['teaserpiconblog_check'] = "checked='checked'"; if (isset($form_input['section']) && $form_input['section'] == 'page') { $page = " checked='checked'"; $weblog = ''; } else { $page = ''; $weblog = " checked='checked'"; } if (isset($form_input['allowcomments']) && $form_input['allowcomments'] === '0') $form_input['comments_check'] = "checked='checked'"; if (isset($form_input['allowpingback']) && $form_input['allowpingback'] === '0') $form_input['pingback_check'] = "checked='checked'"; array_contains($form_input, array('topic', 'url', 'teaser', 'keywords', 'categories', 'teaserpic', 'teaserpiconblog_check', 'comments_check', 'pingback_check', 'content', 'id', 'date')); $o = " "; ### Plugin Hook $o = $plugins->callHook('adminForm', $o, $form_input); return $o; } function preview_output($form_input) { global $l, $bbcode, $categories; // get data from _post if(empty($form_input['date'])) $form_input['date'] = time(); $output = "
\n"; echo $writeblog->getError(); echo "\n"; die(); } if(is_array($form_input['categories']) AND $form_input['categories']['0'] != 'no_categories') { $sql = "INSERT INTO ".JLOG_DB_CATASSIGN." ( cat_id, content_id ) VALUES \n"; $i = 0; foreach($form_input['categories'] AS $category) { if(++$i > 1) $sql .= ",\n"; $sql .= "( '".$category."', '".$id."')"; } $sql .= ";"; $catassign = new Query($sql); if($catassign->error()) { echo "
\n"; echo $catassign->getError(); echo "\n"; die(); } } ### Plugin Hook $plugins->callHook('insertEntry', $id, $form_input); return $id; } function get_blog($id) { global $l, $categories; $sql = 'SELECT id, url, topic, UNIX_TIMESTAMP(date) AS date, ' . 'teaser, teaserpic, teaserpiconblog, keywords, ' . 'content, comments, allowpingback, section FROM ' . JLOG_DB_CONTENT . ' WHERE id = \'' . $id . '\' LIMIT 1;'; $blog = new Query($sql); if($blog->error()) { echo "
\n"; echo $blog->getError(); echo "\n"; die(); } $form_input = $blog->fetch(); $form_input['categories'] = $categories->get_assigned_categories($form_input['id']); return $form_input; } function update_blog($form_input) { global $l, $plugins; if(!isset($form_input['allowcomments']) || $form_input['allowcomments'] != "0") $form_input['allowcomments'] = "1"; if(!isset($form_input['allowpingback']) || $form_input['allowpingback'] != "0") $form_input['allowpingback'] = "1"; $form_input = escape_for_mysql($form_input); array_contains($form_input, ['teaserpiconblog', 'allowcomments', 'allowpingback']); $sql = "UPDATE ".JLOG_DB_CONTENT." SET topic = '".$form_input['topic']."', url = '".$form_input['url']."', section = '".$form_input['section']."', teaser = '".$form_input['teaser']."', teaserpic = '".$form_input['teaserpic']."', teaserpiconblog = '".$form_input['teaserpiconblog']."', keywords = '".$form_input['keywords']."', content = '".$form_input['content']."', comments = '".$form_input['allowcomments']."', allowpingback = '".$form_input['allowpingback']."' WHERE id = '".$form_input['id']."' LIMIT 1;"; $updateblog = new Query($sql); if($updateblog->error()) { echo "
\n"; echo $updateblog->getError(); echo "\n"; die(); } if(is_array($form_input['categories'])) { $sql = "DELETE FROM ".JLOG_DB_CATASSIGN." WHERE content_id = '".$form_input['id']."';"; $trashcatassign = new Query($sql); if($trashcatassign->error()) { echo "
\n"; echo $trashcatassign->getError(); echo "\n"; die(); } if(is_array($form_input['categories']) AND $form_input['categories']['0'] != 'no_categories') { $sql = "INSERT INTO ".JLOG_DB_CATASSIGN." ( cat_id, content_id ) VALUES \n"; $i = 0; foreach($form_input['categories'] AS $category) { if(++$i > 1) $sql .= ",\n"; $sql .= "( '".$category."', '".$form_input['id']."')"; } $sql .= ";"; $catassign = new Query($sql); if($catassign->error()) { echo "
\n"; echo $catassign->getError(); echo "\n"; die(); } } } ### Plugin Hook $plugins->callHook('updateEntry', $form_input['id'], $form_input); return $l['admin']['data_updated']; } function trash_blog($id) { global $l; $sql = "DELETE FROM ".JLOG_DB_CONTENT." WHERE id = '".escape_for_mysql($id)."' LIMIT 1"; $trashblog = new Query($sql); if($trashblog->error()) { echo "
\n"; echo $trashblog->getError(); echo "\n"; die(); } return $l['admin']['postleted']; } /** * add PHPSESSID GET parameter if cookies are not allowed **/ function add_session_id_to_url($url="") { if(empty($_COOKIE[session_name()])) { if(strpos($url, "?") === false) $url .= "?"; else $url .= "&"; $url .= session_name() . "=" . htmlspecialchars(session_id()); } return $url; } /** * add PHPSESSID -Tag if cookies are not allowed */ function add_session_id_input_tag() { if(empty($_COOKIE[session_name()])) { return ""; } } // output the administration menu function output_admin_menu() { global $l, $plugins; $o = ' '; ### Plugin Hook $o = $plugins->callHook('adminMenu', $o); return $o; } // eof