false, 'sort' => false, 'time' => false); $ezin_opts['url'] = array('images' => 'icons/'); $ezin_opts['sort_field'] = array($ezin_admin_action=='pages'?'access_key':'-datetime', '-id'); $ezin_opts['language'] = 'EN'; $ezin_opts['encoding'] = $ezin_cfg['encoding']; $ezin_opts['ext_hsc'] = false; // Buttons $ezin_opts['buttons']['C']['up'] = array('save','more','cancel', '   ', array('name' => 'wordclean', 'value' => 'Word Clean', 'css' => 'pme-wordclean', 'disabled' => false), array('name' => 'switch', 'value' => 'Move to '.($ezin_admin_action=='pages'?'Articles':'Pages'), 'css' => 'pme-switch', 'disabled' => false)); $ezin_opts['buttons']['C']['down'] = $ezin_opts['buttons']['C']['up']; // Triggers $ezin_opts['triggers']['insert']['before'][] = 'inc-db/triggers/word-count.trigger'; $ezin_opts['triggers']['update']['before'][] = 'inc-db/triggers/word-count.trigger'; $ezin_opts['triggers']['insert']['before'][] = 'inc-db/triggers/text-flags.trigger'; $ezin_opts['triggers']['update']['before'][] = 'inc-db/triggers/text-flags.trigger'; $ezin_opts['triggers']['insert']['before'][] = 'inc-db/triggers/access-key.trigger'; $ezin_opts['triggers']['update']['before'][] = 'inc-db/triggers/access-key.trigger'; $ezin_opts['triggers']['insert']['after'][] = 'inc-db/triggers/articles.after'; $ezin_opts['triggers']['update']['after'][] = 'inc-db/triggers/articles.after'; $ezin_opts['triggers']['delete']['after'][] = 'inc-db/triggers/articles.after'; $ezin_opts['triggers']['insert']['after'][] = 'inc-db/triggers/access-key.insert.after'; $ezin_opts['triggers']['update']['after'][] = 'inc-db/triggers/access-key.update.after'; $ezin_opts['triggers']['delete']['after'][] = 'inc-db/triggers/access-key.delete.after'; // Filters if ($ezin_admin_action == 'pages') { $ezin_opts['filters'] = '(datetime IS NULL OR UNIX_TIMESTAMP(datetime) = 0 OR UNIX_TIMESTAMP(datetime) IS NULL)'; } else { $ezin_opts['filters'] = 'UNIX_TIMESTAMP(datetime) != 0 AND UNIX_TIMESTAMP(datetime) IS NOT NULL'; } if (ezin_admin_is_blog()) { $ezin_opts['filters'] .= ' AND PMEtable0.author_id = '.intval($ezin_user['author_id']); $ezin_opts['filters'] .= ' AND PMEjoin10.type = "normal"'; } // Field definitions $ezin_opts['fdd']['id'] = array( 'name'=>($ezin_admin_action=='pages'?'Page ID':'Article ID'), 'name|LF'=>'ID', 'select'=>'T', 'sort'=>true, 'size'=>5, 'default'=>'', 'options'=>'LDVFPCR', 'URL'=>ezin_get_link('A', '$value'), // TODO: fix for length >= 5 'sql|LF'=>'IF(TRIM(PMEtable0.access_key) != "",' .' CONCAT(LPAD(PMEtable0.id,4,"0"), ""), LPAD(PMEtable0.id,4,"0"))', 'escape' => false, 'colattrs|LF'=>'align="center"', ); /* $ezin_opts['fdd']['status'] = array( 'name'=>'Status', 'name|LF'=>'S', 'select'=>'D', 'values'=>array(), 'values2'=> array( 'showed' => 'showed (default)', 'partly_showed' => 'partly showed (hidden from global sections)', 'hidden' => 'not showed (hidden, but accessible)', 'disabled' => 'disabled (unaccessible)'), 'values2|LF'=>array( '' => 'S?', 'showed' => 'S', 'partly_showed' => 's', 'hidden' => 'H', 'disabled' => 'D'), 'sort'=>true, 'colattrs|LF'=>'align="center"', ); */ $ezin_opts['fdd']['display'] = array( 'name'=>'Display', 'name|LF'=>'D', 'select'=>'C', 'select|LF'=>'M', 'values'=>array(), 'values2'=> array( 'enabled' => 'Enabled', 'in_normal' => 'Display in normal section', 'in_global' => 'Display in global section'), 'values2|LF'=>array( '' => 'Disabled', 'enabled' => 'E', 'in_normal' => 'N', 'in_global' => 'G'), 'sort'=>true, 'colattrs|LF'=>'align="center"', ); $template_keys = array_unique(array_merge( ezin_admin_get_template_keys($ezin_sys['tmpl']['article']), ezin_admin_get_template_keys($ezin_sys['tmpl']['article_item']))); if (count($template_keys) > 0) { $ezin_opts['fdd']['template_key'] = array( 'name'=>Platon::htmlspecialchars2('Template key'), 'sort'=>true, 'select'=>'T', 'options'=>'ACPDV', 'values2'=> array(''=>' - default template - '), 'values' => $template_keys ); } $ezin_opts['fdd']['access_key'] = array( 'name'=>Platon::htmlspecialchars2('Access key'), 'name|LF'=>'Key', 'sort'=>true, 'select'=>'T', 'options'=>'ACPDV'.($ezin_admin_action == 'pages' ? 'LF' : ''), 'colattrs|LF'=>'width="15%"', ); $ezin_opts['fdd']['datetime'] = array( 'name'=>Platon::htmlspecialchars2('Date & Time'), 'select'=>'T', 'sort'=>true, 'required'=>true, 'mask'=>'%.10s', 'options'=>($ezin_admin_action == 'pages' ? 'ACPVDRH' : 'ACPVDLF'), 'default'=>($ezin_admin_action == 'pages' ? '0000-00-00' : date('Y-m-d H:i:s')), 'colattrs|LF'=>'align="center"', ); if ($ezin_cfg['calendar'] == '1') { $ezin_opts['fdd']['calendar_flag'] = array( 'name'=>'Calendar flag', 'select'=>'T', 'sort'=>true, 'mask'=>'%.10s', 'options'=>'ACPDV', 'colattrs|LF'=>'align="center"', 'sqlw' => 'IF($val_qas = "", NULL, $val_qas)' ); } if ($ezin_cfg['featured_articles'] == '1') { $ezin_opts['fdd']['featured_articles_flag'] = array( 'name'=>'Featured articles flag', 'select'=>'T', 'sort'=>true, 'mask'=>'%.10s', 'options'=>'ACPDV', 'colattrs|LF'=>'align="center"', 'sqlw' => 'IF($val_qas = "", NULL, $val_qas)' ); } $ezin_opts['fdd']['bind_lang'] = array( 'name'=>Platon::htmlspecialchars2('Language bind'), 'select'=>'D', 'sort'=>true, 'options' => 0 && is_array($ezin_cfg['languages']) ? 'ACPVD' : '' ); $ezin_opts['fdd']['bind_theme'] = array( 'name'=>Platon::htmlspecialchars2('Theme bind'), 'select'=>'D', 'sort'=>true, 'options' => 0 && 1 ? 'ACPVD' : '' ); $ezin_opts['fdd']['accesses_count'] = array( 'name'=>Platon::htmlspecialchars2('Accesses count'), 'options'=>'VDACP'.'HR', 'default'=>'0' ); $ezin_opts['fdd']['sessions_count'] = array( 'name'=>Platon::htmlspecialchars2('Sessions count'), 'options'=>'VDACP'.'HR', 'default'=>'0' ); $ezin_opts['fdd']['message_count'] = array( 'name'=>Platon::htmlspecialchars2('Message count'), 'options'=>'VDACP'.'HR', 'default'=>'0' ); $ezin_opts['fdd']['author_id'] = array( 'name'=>'Author', 'select'=>'D', 'sort'=>true, 'required'=>true, 'strip_tags'=>true, 'values'=>array( 'table' => $ezin_sys['db']['tables']['authors'], 'column' => 'id', 'filters' => 'type = "internal"', 'description' => 'name') ); if (ezin_admin_is_blog()) { $ezin_opts['fdd']['author_id']['options'] = 'LFACPVDR'; $ezin_opts['fdd']['author_id']['default'] = $ezin_user['author_id']; } elseif ($ezin_cfg['single_author_id'] >= 0) { /* If we have just one Author in DB, we do not need to show him */ $ezin_opts['fdd']['author_id']['options'] = 'ACPVDRH'; $ezin_opts['fdd']['author_id']['default'] = $ezin_cfg['single_author_id']; } $ezin_opts['fdd']['section_id'] = array( 'name'=>'Section', 'select'=>'D', 'sort'=>true, 'required'=>true, 'strip_tags'=>true, 'values'=>array( 'table' => $ezin_sys['db']['tables']['sections'], 'orderby' => 'lang,ord,id', 'column' => 'id', 'description' => array( 'columns' => array('name', 'id', 'lang'), 'divs' => array(' (', ') ',''))), ); if (ezin_admin_is_blog()) { $ezin_opts['fdd']['section_id']['values|AP']=$ezin_opts['fdd']['section_id']['values']; $ezin_opts['fdd']['section_id']['values|AP']['filters'] = 'type = "normal"'; $ezin_opts['fdd']['section_id']['options|C'] = 'CR'; $ezin_opts['fdd']['datetime']['options|C'] = 'CR'; } if ($ezin_admin_action == 'articles') { $ezin_opts['fdd']['section_id']['values']['filters'] = 'FIND_IN_SET("articles", `select`) > 0'; } if ($ezin_admin_action == 'pages') { $ezin_opts['fdd']['section_id']['values']['filters'] = 'FIND_IN_SET("pages", `select`) > 0'; } if ($ezin_admin_action != 'pages') { $ezin_opts['fdd']['atitle'] = array( 'name'=>Platon::htmlspecialchars2('Annotation title'), 'select'=>'T', 'maxlen'=>255, 'sort'=>true, 'options'=>'ACPVD', ); } $ezin_opts['fdd']['title'] = array( 'name'=>'Title', 'select'=>'T', 'maxlen'=>255, 'sort'=>true, 'trimlen|LF'=>35, 'sql|LF'=>'IF(TRIM(title) != "", title, atitle)' ); $ezin_opts['fdd']['ghometext_wordcount'] = array( 'name'=>Platon::htmlspecialchars2('Global anotation word count'), 'select'=>'T', 'options'=>'HCAP' ); $ezin_opts['fdd']['hometext_wordcount'] = array( 'name'=>Platon::htmlspecialchars2('Anotation word count'), 'select'=>'T', 'options'=>'HCAP' ); $ezin_opts['fdd']['bodytext_wordcount'] = array( 'name'=>Platon::htmlspecialchars2('Text word count'), 'select'=>'T', 'options'=>'HCAP' ); $ezin_opts['fdd']['ghometext_flags'] = array( 'name'=>Platon::htmlspecialchars2('Global anotation flags'), 'select'=>'T', 'options'=>'HCAP' ); $ezin_opts['fdd']['hometext_flags'] = array( 'name'=>Platon::htmlspecialchars2('Anotation flags'), 'select'=>'T', 'options'=>'HCAP' ); $ezin_opts['fdd']['bodytext_flags'] = array( 'name'=>Platon::htmlspecialchars2('Text flags'), 'select'=>'T', 'options'=>'HCAP' ); if ($ezin_admin_action != 'pages') { $ezin_opts['fdd']['ghometext'] = array( 'name'=>'Global anotation', 'select'=>'T', 'textarea'=>array( 'rows'=>4, 'cols'=>65, ), 'options'=>'ACPV' ); $ezin_opts['fdd']['hometext'] = array( 'name'=>'Anotation', 'select'=>'T', 'textarea'=>array( 'rows'=>8, 'cols'=>65, ), 'options'=>'ACPV' ); } $ezin_opts['fdd']['bodytext'] = array( 'name'=>Platon::htmlspecialchars2('Article text'), 'select'=>'T', 'textarea'=>array( 'rows'=>15, 'cols'=>65, 'wrap'=>'virtual' ), 'options'=>'ACPV' ); include dirname(__FILE__).'/_credentials.inc.php'; // Execution code if (! ezin_admin_check_list_privileges($ezin_opts['options'])) { require 'inc-html/permdenied.html'; } else { /* if (! ezin_admin_check_privileges($ezin_opts['options'], isset($author_id) && $author_id == $ezin_user['author_id'])) { require 'inc-html/permdenied.html'; } */ require_once 'phpMyEdit/phpMyEdit.class.php'; $ezin_opts['execute'] = 0; $phpMyEdit = new phpMyEdit($ezin_opts); if ($phpMyEdit->get_sys_cgi_var('wordclean')) { $content = $phpMyEdit->get_data_cgi_var('bodytext'); $content = ezin_admin_word_clean($content); $phpMyEdit->myQuery(sprintf('UPDATE %s SET bodytext = "%s" WHERE id = %d', $ezin_opts['tb'], addslashes($content), $phpMyEdit->rec)); } elseif ($phpMyEdit->get_sys_cgi_var('switch')) { $datetime = $phpMyEdit->get_data_cgi_var('datetime'); if (strncmp($datetime, '0000-00-00', 10)) { $phpMyEdit->myQuery(sprintf('UPDATE %s SET datetime = "0000-00-00" WHERE id = %d AND UNIX_TIMESTAMP(datetime) != 0 AND UNIX_TIMESTAMP(datetime) IS NOT NULL', $ezin_opts['tb'], $phpMyEdit->rec)); } else { $phpMyEdit->myQuery(sprintf('UPDATE %s SET datetime = SYSDATE() WHERE id = %d AND (UNIX_TIMESTAMP(datetime) = 0 OR UNIX_TIMESTAMP(datetime) IS NULL)', $ezin_opts['tb'], $phpMyEdit->rec)); } } $phpMyEdit->execute(); } ?>