* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
* @since file available since contenido release <= 4.6
*
* {@internal
* created 2003-01-21
* modified 2008-06-27, Frederic Schneider, add security fix
* modified 2008-08-29, Murat Purc, add handling of urlname
* modified 2008-09-11, Andreas Lindner, added decoding of text and cat names
* with unFilter function
*
* $Id$:
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude("includes", "functions.str.php");
cInclude("includes", "functions.pathresolver.php");
$tpl->reset();
if ($action == "remove_assignments") {
$sql = "DELETE FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' AND idcat != '" . Contenido_Security::toInteger($idcat) . "'";
$db->query($sql);
}
if ($action == "con_newart" && $newart != true) {
// nothing to be done here ?!
} else {
$disabled = "";
if ($perm->have_perm_area_action($area, "con_edit") || $perm->have_perm_area_action_item($area, "con_edit", $idcat)) {
$sql = "SELECT * FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' AND idcat = '" . Contenido_Security::toInteger($idcat) . "'";
$db->query($sql);
$db->next_record();
if ($cfg["is_start_compatible"] == true) {
$tmp_is_start = $db->f("is_start");
}
$tmp_cat_art = $db->f("idcatart");
$sql = "SELECT * FROM " . $cfg["tab"]["art_lang"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' AND idlang = '" . Contenido_Security::toInteger($lang) . "'";
$db->query($sql);
$db->next_record();
if ($cfg["is_start_compatible"] == false) {
$tmp_is_start = isStartArticle($db->f("idartlang"), $idcat, $lang);
}
if ($db->f("created")) {
//****************** this art was edited before ********************
$tmp_firstedit = 0;
$tmp_idartlang = $db->f("idartlang");
$tmp_page_title = Contenido_Security::unFilter(stripslashes($db->f("pagetitle")));
$tmp_idlang = $db->f("idlang");
$tmp_title = Contenido_Security::unFilter($db->f("title"));
$tmp_urlname = Contenido_Security::unFilter($db->f("urlname")); // plugin Advanced Mod Rewrite - edit by stese
$tmp_artspec = $db->f("artspec");
$tmp_summary = Contenido_Security::unFilter($db->f("summary"));
$tmp_created = $db->f("created");
$tmp_lastmodified = $db->f("lastmodified");
$tmp_author = $db->f("author");
$tmp_modifiedby = $db->f("modifiedby");
$tmp_online = $db->f("online");
$tmp_published = $db->f("published");
$tmp_publishedby = $db->f("publishedby");
$tmp_datestart = $db->f("datestart");
$tmp_dateend = $db->f("dateend");
$tmp_sort = $db->f("artsort");
$tmp_movetocat = $db->f("time_move_cat");
$tmp_targetcat = $db->f("time_target_cat");
$tmp_onlineaftermove = $db->f("time_online_move");
$tmp_usetimemgmt = $db->f("timemgmt");
$tmp_locked = $db->f("locked");
$tmp_redirect_checked = ($db->f("redirect") == '1') ? 'checked' : '';
$tmp_redirect_url = ($db->f("redirect_url") != '0') ? $db->f("redirect_url") : "http://";
$tmp_external_redirect_checked = ($db->f("external_redirect") == '1') ? 'checked' : '';
$idtplinput = $db->f("idtplinput");
if ($tmp_modifiedby == "") {
$tmp_modifiedby = $tmp_author;
}
$col = new InUseCollection;
/* Remove all own marks */
$col->removeSessionMarks($sess->id);
if (($obj = $col->checkMark("article", $tmp_idartlang)) === false) {
$col->markInUse("article", $tmp_idartlang, $sess->id, $auth->auth["uid"]);
$inUse = false;
$disabled = "";
} else {
$vuser = new User;
$vuser->loadUserByUserID($obj->get("userid"));
$inUseUser = $vuser->getField("username");
$inUseUserRealName = $vuser->getField("realname");
$message = sprintf(i18n("Article is in use by %s (%s)"), $inUseUser, $inUseUserRealName);
$notification->displayNotification("warning", $message);
$inUse = true;
$disabled = 'disabled="disabled"';
}
if ($tmp_locked == 1) {
$inUse = true;
$disabled = 'disabled="disabled"';
}
} else {
//***************** this art is edited the first time *************
if (!$idart)
$tmp_firstedit = 1; //**** is needed when input is written to db (update or insert)
$tmp_idartlang = 0;
$tmp_idlang = $lang;
$tmp_page_title = stripslashes($db->f("pagetitle"));
$tmp_title = "";
$tmp_urlname = ""; // plugin Advanced Mod Rewrite - edit by stese
$tmp_artspec = "";
$tmp_summary = "";
$tmp_created = date("Y-m-d H:i:s");
$tmp_lastmodified = date("Y-m-d H:i:s");
$tmp_published = date("Y-m-d H:i:s");
$tmp_publishedby = "";
$tmp_author = "";
$tmp_online = "0";
$tmp_datestart = "0000-00-00 00:00:00";
$tmp_dateend = "0000-00-00 00:00:00";
$tmp_keyart = "";
$tmp_keyautoart = "";
$tmp_sort = "";
if (!strHasStartArticle($idcat, $lang)) {
$tmp_is_start = 1;
}
$tmp_redirect_checked = '';
$tmp_redirect_url = "http://";
$tmp_external_redirect = '';
}
$dateformat = getEffectiveSetting("backend", "timeformat", "Y-m-d H:i:s");
$tmp2_created = date($dateformat, strtotime($tmp_created));
$tmp2_lastmodified = date($dateformat, strtotime($tmp_lastmodified));
$tmp2_published = date($dateformat, strtotime($tmp_published));
$tpl->set('s', 'ACTION', $sess->url("main.php?area=$area&frame=$frame&action=con_saveart"));
$tpl->set('s', 'HIDDENSESSION', $sess->hidden_session(true));
$tpl->set('s', 'TMP_FIRSTEDIT', $tmp_firstedit);
$tpl->set('s', 'IDART', $idart);
$tpl->set('s', 'SID', $sess->id);
$tpl->set('s', 'IDCAT', $idcat);
$tpl->set('s', 'IDARTLANG', $tmp_idartlang);
$hiddenfields = '
';
$tpl->set('s', 'HIDDENFIELDS', $hiddenfields);
// Show path of selected category to user
$catString = '';
prCreateURLNameLocationString($idcat, '/', $catString);
$tpl->set('s', 'CATEGORY', $catString . '/' . clHtmlSpecialChars($tmp_title));
/* Title */
$tpl->set('s', 'TITEL', i18n("Title"));
// plugin Advanced Mod Rewrite - edit by stese
$tpl->set('s', 'URLNAME', i18n("Alias"));
// end plugin Advanced Mod Rewrite
$arrArtSpecs = getArtSpec();
$tmp_inputArtSort = "";
if ($iAvariableSpec == 0) {
$tmp_inputArtSort = i18n("No article specifications found!");
}
$tpl->set('s', 'ARTIKELART', i18n("Article specification"));
$tpl->set('s', 'ARTIKELARTSELECT', $tmp_inputArtSort);
$tpl->set('s', 'TITEL-FIELD', '');
// plugin Advanced Mod Rewrite - edit by stese
$tpl->set('s', 'URLNAME-FIELD', '');
// end plugin Advanced Mod Rewrite
$tpl->set('s', 'ARTIKELID', "idart");
$tpl->set('s', 'ARTID', $idart);
$tpl->set('s', 'DIRECTLINKTEXT', i18n("Articlelink"));
$select = new cHTMLSelectElement("directlink");
$select->setEvent("change", "document.getElementById('linkhint').value = this.form.directlink.options[this.form.directlink.options.selectedIndex].value;");
$baselink = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?idart=$idart";
$option[0] = new cHTMLOptionElement(i18n("Select an entry to display link"), "");
$option[1] = new cHTMLOptionElement(i18n("Article only"), $baselink);
$option[2] = new cHTMLOptionElement(i18n("Article with Category"), $baselink . "&idcat=$idcat");
$option[3] = new cHTMLOptionElement(i18n("Article with Category and Language"), $baselink . "&idcat=$idcat&lang=$lang");
$option[4] = new cHTMLOptionElement(i18n("Article with Language"), $baselink . "&lang=$lang");
$select->addOptionElement(0, $option[0]);
$select->addOptionElement(1, $option[1]);
$select->addOptionElement(2, $option[2]);
$select->addOptionElement(3, $option[3]);
$select->addOptionElement(4, $option[4]);
$tpl->set('s', 'DIRECTLINK', $select->render() . '
');
$tpl->set('s', 'ZUORDNUNGSID', "idcatart");
$tpl->set('s', 'ALLOCID', $tmp_cat_art);
/* Author */
$tpl->set('s', 'AUTHOR_CREATOR', i18n("Author (Creator)"));
$tpl->set('s', 'AUTOR-ERSTELLUNGS-NAME', $classuser->getRealnameByUserName($tmp_author) . '' . ' ');
$tpl->set('s', 'AUTOR-AENDERUNG-NAME', $classuser->getRealnameByUserName($tmp_modifiedby) . ' ');
/* Created */
$tmp_erstellt = ($tmp_firstedit == 1) ? '' : '';
$tpl->set('s', 'ERSTELLT', i18n("Created"));
$tpl->set('s', 'ERSTELLUNGS-DATUM', $tmp2_created . $tmp_erstellt);
/* Last modified */
$tpl->set('s', 'AUTHOR_MODIFIER', i18n("Author (Modifier)"));
$tpl->set('s', 'LETZTE-AENDERUNG', i18n("Last modified"));
$tpl->set('s', 'AENDERUNGS-DATUM', $tmp2_lastmodified . '');
/* Published */
$tpl->set('s', 'PUBLISHING_DATE_LABEL', i18n("Publishing date"));
if ($tmp_online) {
$tpl->set('s', 'PUBLISHING_DATE', $tmp2_published);
} else {
$tpl->set('s', 'PUBLISHING_DATE', i18n("not yet published"));
}
$tpl->set('s', 'PUBLISHER', i18n("Publisher"));
if ($classuser->getRealnameByUserName($tmp_publishedby) != '') {
$tpl->set('s', 'PUBLISHER_NAME', '' . $classuser->getRealnameByUserName($tmp_publishedby));
} else {
$tpl->set('s', 'PUBLISHER_NAME', '' . ' ');
}
/* Redirect */
$tpl->set('s', 'WEITERLEITUNG', i18n("Redirect"));
$tpl->set('s', 'CHECKBOX', '');
/* Redirect - URL */
if ($tmp_redirect_checked != '') {
$forceDisable = "";
} else {
$forceDisable = "disabled";
}
$tpl->set('s', 'URL', '');
/* Redirect - New window */
if (getEffectiveSetting("articles", "show-new-window-checkbox", "false") == "true") {
$tpl->set('s', 'CHECKBOX-NEWWINDOW', '