Sorry Flip-Flop,
deiner Aussage muss ich widersprechen. Mittlerweile funktioniert es bei mir, dass bei einer Eingabe der Artikel-ID im Feld "AID/Alias/URL" ein Link erzeugt wird. Dies funktioniert allerdings nur bei Eingabe der Artikel-ID (AID) als reine Zahl. Alle Eingaben mit Buchstaben drin werden gelöscht.
Zur Sicherheit noch meine Konfigurationsdateien, die sich von deinen auch zu unterscheiden scheinen:
phpwcmsCalendar.class.php
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
/**
* phpwcms Calendar frontend render class
*/
class phpwcmsCalendar {
var $mode = 'simple';
var $dates = array();
/**
* Initialize class
*/
function phpwcmsCalendar() {
// current
$this->current_date = getdate();
// set today 00:00:00 as start date
$this->date_start = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year']);
// by default date_start + 1 year
$this->date_end = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year'] + 1) - 1;
$this->dbReset();
}
/**
* Reset db base vars
*/
function dbReset() {
$this->where = '';
$this->select = '*';
$this->join_on = '';
$this->group_by = '';
$this->order_by = 'calendar_start ASC';
$this->limit = 0;
}
function defaultTemplate() {
$this->template = '';
$this->href = '';
}
/**
* search string for calendar tag and parse
*/
function parse(& $string) {
if( preg_match_all('/\{CALENDAR:(.*?)\}/s', $string, $matches) ) {
if( isset($matches[1]) ) {
foreach($matches[1] as $key => $value) {
$this->parse_match($value);
$result = $this->render();
// replace calendar by result
$string = str_replace($matches[0][$key], $result, $string);
}
$string = html_parser($string);
}
}
}
function render() {
$items = array();
foreach($this->dates as $key => $date) {
$date['calendar_refid'] = intval($date['calendar_refid']);
if($date['calendar_refid'] > 0) {
$href = 'index.php?aid='.$date['calendar_refid'];
} else {
$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
}
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
$items[$key] = render_cnt_template($items[$key], 'TITLE', html_specialchars($date['calendar_title']));
$items[$key] = render_cnt_template($items[$key], 'TEXT', plaintext_htmlencode($date['calendar_teaser']));
$items[$key] = render_cnt_template($items[$key], 'PLACE', html_specialchars($date['calendar_where']));
$items[$key] = render_cnt_date($items[$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']);
//---------------
// 0 :1 :2 :3 :4 :5 :6 :7 :8
// dbid:filename:hash:extension:width:height:caption:position:zoom
// $image = ($crow["acontent_image"]) ? explode(":", $crow["acontent_image"]) : false ;
// http://de.php.net/manual/de/function.serialize.php
// http://de.php.net/unserialize
$image_temp = @unserialize($date['calendar_object']);
// dumpVar ($image_temp);
$image_id = $image_temp['image']['id'];
$image_name = $image_temp['image']['name'];
$image_zoom = getImageCaption($image_temp['image']['zoom']);
$image_light = getImageCaption($image_temp['image']['lightbox']);
// following is default for the exploded $caption
// [0] caption text
// [1] alt text for image
// [2] link -> array(0 => link, 1 => target)
// [3] title text -> if empty alt text will be used
// [4] copyright information
$image_capt = getImageCaption($image_temp['image']['caption']);
// dumpVar ($image_capt);
$image_text = $image_capt[0];
$image_alt = $image_capt[1];
$image_link = $image_capt[2];
$image_title = $image_capt[3];
$image_copyr = $image_capt[4];
// get segments: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT%
$image_calendar = '<img src="'.PHPWCMS_URL.'img/cmsimage.php/100x100/'.$image_id.'" alt="'.$image_alt.'" />';
// dumpVar ($image_calendar);
// Bildaufbereitung f�r zoom u. LightBox siehe Bilder div
// /include/inc_front/content/cnt29.article.inc.php
//----------------
// KH Wysiwyg http://forum.phpwcms.org/viewtopic.php?p=107020#p107020
$items[$key] = render_cnt_template($items[$key], 'TEXTLONG', $date['calendar_text']);
// KH Bilder http://forum.phpwcms.org/viewtopic.php?p=107159#p107159
$items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);
}
return implode(LF, $items);
}
/**
* Parse matched replacement tag
*/
function parse_match($match='') {
$default = array();
$match = trim($match);
// set query defaults
$this->dbReset();
$this->defaultTemplate();
if($match !== '' && strpos($match, '=') !== FALSE ) {
// oh yes fix, in case LF was converted to <br /> by phpwcms
$match = str_replace('<br />', LF, $match);
// result is a normal array
$match = parse_ini_str($match, false);
$default['items'] = isset($match['items']) ? intval($match['items']) : 0;
$default['template'] = empty($match['template']) ? '' : trim($match['template']);
$default['lang'] = empty($match['lang']) ? '' : trim($match['lang']);
$default['tag'] = empty($match['tag']) ? '' : trim($match['tag']);
$default['tagmode'] = empty($match['tagmode']) ? 'OR' : ( trim($match['tagmode']) == 'AND' ? 'AND' : 'OR' );
$default['href'] = empty($match['href']) ? '' : trim($match['href']);
} else {
// base format
// 2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3
// [item count,[template[,language(en de - separated by space)[, href, tags, tag, tag, tag]]]]
$match = explode(',', $match, 5);
$default['items'] = intval($match[0]);
$default['lang'] = empty($match[1]) ? '' : $match[1];
$default['template'] = empty($match[2]) ? '' : trim($match[2]) ;
$default['href'] = empty($match[3]) ? '' : trim($match[3]);
$default['tag'] = empty($match[4]) ? '' : $match[4];
$default['tagmode'] = 'OR';
}
$this->limit = $default['items'];
$this->href = $default['href'];
if($default['template'] !== '') {
$default['template'] = preg_replace('/[\/\\:]/', '', $default['template']);
if(is_file(PHPWCMS_TEMPLATE.'calendar/'.$default['template'])) {
$this->template = file_get_contents(PHPWCMS_TEMPLATE.'calendar/'.$default['template']);
$this->template = str_replace('{STARTDATE', '{LIVEDATE', $this->template);
$this->template = str_replace('{ENDDATE', '{KILLDATE', $this->template);
} else {
$default['template'] = '';
}
}
$where = array();
if($default['lang'] !== '') {
$default['lang'] = str_replace(',', ' ', preg_replace('/[^a-z\-]/', '', strtolower($default['lang'])));
$default['lang'] = array_intersect( convertStringToArray( $default['lang'], ' '), $GLOBALS['phpwcms']['allowed_lang']);
if(count($default['lang'])) {
$where[] = "calendar_lang IN ('" . implode("','", $default['lang']) . "')";
}
}
if($default['tag'] !== '') {
$default['tag'] = convertStringToArray( strtolower( $default['tag'] ), ',');
if(count($default['tag'])) {
$tag_where = array();
foreach($default['tag'] as $tag) {
$tag_where[] = "cat_name='".aporeplace($tag)."'";
}
if(count($tag_where)) {
$where[] = '(' . implode(' '.$default['tagmode'] . ' ', $tag_where) . ')';
$this->join_on = 'LEFT JOIN '.DB_PREPEND.'phpwcms_categories ON cat_pid=calendar_id';
$this->group_by = 'calendar_id';
}
};
}
$this->where = implode(' AND ', $where);
$this->getDate();
return $default;
}
function getDate() {
// 1 daily
// 2 Every weekday (Mon-Fri)
// 3 Every Mon., Wed. and Fri.
// 4 Every Tues. and Thurs.
// 5 Weekly
// 6 Monthly
// 7 yearly
if(is_string($this->order_by) && trim($this->order_by) != '') {
$this->order_by = ' ORDER BY '.$this->order_by;
} else {
$this->order_by = '';
}
if(is_int($this->limit) && $this->limit > 0) {
$this->limit = ' LIMIT '.$this->limit;
} else {
$this->limit = '';
}
if(is_string($this->group_by) && trim($this->group_by) != '') {
$this->group_by = ' GROUP BY '.$this->group_by;
} else {
$this->group_by = '';
}
$sql = 'SELECT '. $this->select .', ';
$sql .= "UNIX_TIMESTAMP(calendar_start) AS calendar_start_date, ";
$sql .= "UNIX_TIMESTAMP(calendar_end) AS calendar_end_date ";
$sql .= ' FROM '.DB_PREPEND.'phpwcms_calendar pc ';
$sql .= $this->join_on;
$sql .= ' WHERE ';
$sql .= 'calendar_status = 1 AND ';
$sql .= "calendar_start >= '".aporeplace( date('Y-m-d H:i:s', $this->date_start) )."' AND ";
$sql .= "calendar_start <= '".aporeplace( date('Y-m-d H:i:s', $this->date_end) )."'";
if(!empty($this->where)) {
$sql .= ' AND ' . $this->where;
}
$sql .= $this->group_by;
$sql .= $this->order_by;
$sql .= $this->limit;
$this->dates = _dbQuery($sql);
if( !$this->dates ) {
$this->dates = array();
}
}
}
?>
init-calendar.php
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
/**
* Usage: sample Replacement Tag
*
* {CALENDAR:
* items=100
* template=dates_list_de.html
* lang=de
* tagmode=OR
* href=index.php?calendar
* }
*
* OR
*
* {CALENDAR:2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3}
* [item count,[template[,language(en de - separated by space)[, href, tags, tag, tag, tag]]]]
*
**/
if(strpos($content['all'], '{CALENDAR:')) {
$GLOBALS['block']['css']['calendar'] = 'calendar.css'; // +kh: including the css file
include(PHPWCMS_TEMPLATE.'inc_script/phpwcmsCalendar.class.php');
$myCal = & new phpwcmsCalendar();
$myCal->parse($content['all']);
}
?>
Mein Template:
Code: Select all
<div class="calendar">
<div class="date">
<div style="float:left;"><img src="{SITE}img/cmsimage.php/25x25/524" valign=center /></div>
<div style="margin-left: 35px;"><strong>{STARTDATE:l lang=DE} <br> {STARTDATE:d.m.}</strong><strong class="year">{STARTDATE:Y}</strong></div>
</div>
{SPACER:100x5}
[TITLE]<h3>[HREF]<a href="{HREF}">[/HREF]{TITLE}[HREF]</a>[/HREF]</h3>[/TITLE]
[TEXT]<div class="teaser">{TEXT}</div>[/TEXT]
<!-- [TEXTLONG]<div class="textlong">{TEXTLONG}</div>[/TEXTLONG] -->
{SPACER:100x5}
[PLACE]<p class="place">Ort: {PLACE}</p>[/PLACE]
[IMAGE_CALENDAR]<div class="image_teaser">{IMAGE_CALENDAR}</div>[/IMAGE_CALENDAR]
</div>
soweit, so gut,
Martin