function getCurrentCalendarDate()
{
    global $_getVar;
    $_date = array();
    $_date['year'] = date('Y');
    $_date['month'] = date('n');
    $_date['day'] = date('j');
    if (!empty($_getVar['calendardate'])) {
        $d = explode('-', $_getVar['calendardate']);
        if (!empty($d[0]) && intval($d[0])) {
            $_date['year'] = intval($d[0]);
        }
        if (!empty($d[1]) && intval($d[1])) {
            $_date['month'] = intval($d[1]);
        }
        if (!empty($d[2]) && intval($d[2])) {
            $_date['day'] = intval($d[2]);
        }
        if (($int_time = phpwcms_strtotime($_date['year'] . '/' . $_date['month'] . '/' . $_date['day'])) === false) {
            $_date['year'] = date('Y');
            $_date['month'] = date('n');
            $_date['day'] = date('j');
        } else {
            $_date['year'] = date('Y', $int_time);
            $_date['month'] = date('n', $int_time);
            $_date['day'] = date('j', $int_time);
        }
    }
    define('THIS_YEAR', $_date['year']);
    define('THIS_MONTH', $_date['month']);
    define('THIS_DAY', $_date['day']);
    $_date['next_month']['month'] = $_date['month'] == 12 ? 1 : $_date['month'] + 1;
    $_date['prev_month']['month'] = $_date['month'] == 1 ? 12 : $_date['month'] - 1;
    $_date['next_month']['year'] = $_date['next_month']['month'] == 1 ? $_date['year'] + 1 : $_date['year'];
    $_date['prev_month']['year'] = $_date['prev_month']['month'] == 12 ? $_date['year'] - 1 : $_date['year'];
    $_date['next_year']['month'] = $_date['month'];
    $_date['prev_year']['month'] = $_date['month'];
    $_date['next_year']['year'] = $_date['year'] + 1;
    $_date['prev_year']['year'] = $_date['year'] - 1;
    $_date['next_month']['day'] = $_date['day'];
    $_date['prev_month']['day'] = $_date['day'];
    $_date['next_year']['day'] = $_date['day'];
    $_date['prev_year']['day'] = $_date['day'];
    $_date['next_link'] = buildCalendarLink(buildCalendarGETValue($_date['next_month']));
    $_date['prev_link'] = buildCalendarLink(buildCalendarGETValue($_date['prev_month']));
    $_date['current_month'] = THIS_YEAR . substr('0' . THIS_MONTH, -2);
    return $_date;
}
示例#2
0
         $content['alink']['tr'][$key] .= $content['alink']['alink_template_space'];
     }
     $content['alink']['column_current'] = $content['alink']['column'];
     $content['alink']['column']++;
     //$content['alink']['column_minus'] = 1;
     $content['alink']['row_minus'] = 0;
 }
 $content['alink']['tr'][$key] .= $content['alink']['alink_template_entry'];
 $content['alink']['tr'][$key] = str_replace('{ARTICLEID}', $row['article_id'], $content['alink']['tr'][$key]);
 $content['alink']['tr'][$key] = str_replace('{CATEGORYID}', $row['article_cid'], $content['alink']['tr'][$key]);
 $content['alink']['tr'][$key] = str_replace('{COLUMN}', $content['alink']['column_current'], $content['alink']['tr'][$key]);
 $content['alink']['tr'][$key] = str_replace('{ROW}', $content['alink']['row'] - $content['alink']['row_minus'], $content['alink']['tr'][$key]);
 $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'MENUTITLE', html_specialchars($row['article_menutitle']));
 $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'TITLE', html_specialchars($row['article_title']));
 $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'SUBTITLE', html_specialchars($row['article_subtitle']));
 $content['alink']['tr'][$key] = render_cnt_date($content['alink']['tr'][$key], $row[$content['alink']['date_basis']], phpwcms_strtotime($row['article_begin']), phpwcms_strtotime($row['article_end']));
 $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'PRIO', empty($row['article_priorize']) ? '' : $row['article_priorize']);
 $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'ACTIVE', isset($content["article_id"]) && $content["article_id"] == $row['article_id'] ? 'active' : '');
 $row['article_image'] = @unserialize($row['article_image']);
 $row['article_image'] = setArticleSummaryImageData($row['article_image']);
 if (!empty($row['article_image']['list_caption'])) {
     $content['alink']['caption'] = getImageCaption($row['article_image']['list_caption']);
     $row['article_image']['list_caption'] = html_specialchars($content['alink']['caption'][0]);
     $content['alink']['caption'][3] = html_specialchars($content['alink']['caption'][3]);
     $content['alink']['caption'][1] = html_specialchars($content['alink']['caption'][1]);
 } else {
     $row['article_image']['list_caption'] = '';
     $content['alink']['caption'] = array('', '', '', '', '');
 }
 // article list image
 if (strpos($content['alink']['tr'][$key], 'IMAGE') !== false) {
示例#3
0
function formatRTDate($matches)
{
    // very cool function to render date or gmdate
    // - {DATE:DATE_FORMAT}, {GMDATE:DATE_FORMAT},
    // - {DATE:DATE_FORMAT SET:TIMESTAMP}, {GMDATE:DATE_FORMAT SET:TIMESTAMP}
    $type = strtolower($matches[1]);
    $matches = explode(' SET:', $matches[2]);
    if (empty($matches[1])) {
        return $type($matches[0]);
    }
    $matches[1] = trim($matches[1]);
    if (is_numeric($matches[1])) {
        $matches[1] = intval($matches[1]);
        return $type($matches[0], $matches[1]);
    }
    return $type($matches[0], phpwcms_strtotime($matches[1], NULL, now()));
}
function struct_articlelist($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order = 0)
{
    global $BL;
    $article = array();
    // empty article array
    $sort_array = array();
    // empty array to store all sort values for the category
    $article_order = intval($article_order);
    $max_article_count = 0;
    $show_sort = !$article_order || $article_order == 1 ? 1 : 0;
    $ao = get_order_sort($article_order);
    $count_article = 0;
    $sbutton_string = array();
    $sql = "SELECT *, ";
    $sql .= "DATE_FORMAT(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date ";
    //, article_deleted
    $sql .= "FROM " . DB_PREPEND . "phpwcms_article ";
    $sql .= "WHERE article_cid='" . $struct_id . "' AND article_deleted=0 ORDER BY " . $ao[2];
    if ($result = mysql_query($sql, $GLOBALS['db']) or die("error while browsing related articles")) {
        // 1st get max count to know the last index ($max_article_count - 1)
        $max_article_count = mysql_num_rows($result);
        // take all entryies and build new array with it
        while ($row = mysql_fetch_assoc($result)) {
            $article[$count_article] = $row;
            if ($row['article_sort'] > 0) {
                $sort_array[$count_article] = $row['article_sort'];
            }
            // count up for article array index
            $count_article++;
        }
        mysql_free_result($result);
    }
    // now check if all sort values are unique
    // if not do a re-sort for all articles
    if ($max_article_count > count(array_unique($sort_array))) {
        $article = getArticleReSorted($struct_id, $article_order);
    }
    // reset article counter
    $count_article = 0;
    /*
     * now we know ALL articles and can run array index +/-
     * to set correct sorting UP and DOWN based on article
     * listing -> so the correct sort value is used
     */
    foreach ($article as $akey => $avalue) {
        // set up correct article sorting
        // can be sorted UP
        if ($count_article == 0) {
            // this is the first in list -> so no sorting up possible
            // the sort up icon will be invisible
            $sort_up = false;
        } else {
            // this article has a pre entry
            // so use these by setting (current index - 1)
            $article[$akey]['sort_up'] = $article[$akey - 1]['article_sort'];
            $sort_up = $show_sort ? true : false;
        }
        // count up for article array index
        $count_article++;
        // can be sorted DOWN
        if ($count_article == $max_article_count) {
            // this is the last in list -> so no sorting down possible
            // the sort up icon will be invisible
            $sort_down = false;
        } else {
            // this article has a follower
            // so use these by setting (current index + 1)
            $article[$akey]['sort_down'] = $article[$akey + 1]['article_sort'];
            $sort_down = $show_sort ? true : false;
        }
        // now do some checks to be sure that all sort values
        // are different to have it sorting in the correct way
        // sort up
        if ($sort_up) {
            $sort_up = '<a href="include/inc_act/act_structure.php?do=4%7C';
            $sort_up .= $article[$akey]["article_id"] . '%7C' . $article[$akey]['sort_up'] . '%7C';
            $sort_up .= $article[$akey - 1]["article_id"] . '%7C' . $article[$akey]['article_sort'];
            $sort_up .= '" title="' . $BL['be_func_struct_sort_up'] . '">';
            $sort_up .= '<img src="img/button/sort_1_1.gif" width="11" height="11" border="0" alt="" /></a>';
        } else {
            $sort_up = '<img src="img/button/sort_1_0.gif" width="11" height="11" border="0" alt="" />';
        }
        // sort down
        if ($sort_down) {
            $sort_down = '<a href="include/inc_act/act_structure.php?do=4%7C';
            $sort_down .= $article[$akey]["article_id"] . '%7C' . $article[$akey]['sort_down'] . '%7C';
            $sort_down .= $article[$akey + 1]["article_id"] . '%7C' . $article[$akey]['article_sort'];
            $sort_down .= '" title="' . $BL['be_func_struct_sort_down'] . '">';
            $sort_down .= '<img src="img/button/sort_2_1.gif" width="11" height="11" border="0" alt="" /></a>';
        } else {
            $sort_down = '<img src="img/button/sort_2_0.gif" width="11" height="11" border="0" alt="" />';
        }
        $at = html($article[$akey]["article_title"]);
        if ($cut_article == $article[$akey]["article_id"]) {
            $a = "<tr bgColor='#B4E101'>\n";
        } elseif ($copy_article == $article[$akey]["article_id"]) {
            $a = "<tr bgColor='#B4E101'>\n";
        } else {
            $a = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
        }
        $a .= '<td width="461">';
        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">\n<tr>\n";
        $acontent_count = get_article_content_count($article[$akey]["article_id"], $GLOBALS['db']);
        if ($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
            $a .= "<td nowrap=\"nowrap\"><img src=\"img/leer.gif\" width=\"" . (14 + 14 + 14 * ($counter - 1)) . "\" height=\"1\" alt=\"\" />";
            $a .= $acontent_count ? "<a href=\"phpwcms.php?do=articles&amp;opena=" . rawurlencode($article[$akey]["article_id"] . ":" . (!empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) ? 0 : 1)) . "\">" : "";
            $a .= "<img src=\"img/symbole/plus_" . ($acontent_count ? !empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) ? "close" : "open" : "empty");
            $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"\" />" . ($acontent_count ? "</a>" : "");
        } else {
            $a .= "<td nowrap=\"nowrap\"><img src=\"img/leer.gif\" width=\"" . (14 + 29 + 14 * ($counter - 1)) . "\" height=\"1\" alt=\"\" />";
        }
        $a .= "<img src=\"img/symbole/text_1.gif\" width=\"11\" height=\"15\" ";
        $info = '<table cellspacing=0 cellpadding=1 border=0>';
        $info .= '<tr><td>' . $BL['be_func_struct_articleID'] . ':</td><td><b>' . $article[$akey]["article_id"] . '</b></td></tr>';
        if (!empty($article[$akey]["article_alias"])) {
            $info .= '<tr><td>ALIAS:</td><td><b>' . $article[$akey]["article_alias"] . '</b></td></tr>';
        }
        if (!empty($article[$akey]["article_begin"])) {
            $info .= '<tr><td>' . $BL['be_article_cnt_start'] . ':</td><td><b>' . phpwcms_strtotime($article[$akey]["article_begin"], $BL['be_longdatetime'], '&nbsp;') . '</b></td></tr>';
        }
        if (!empty($article[$akey]["article_end"])) {
            $info .= '<tr><td>' . $BL['be_article_cnt_end'] . ':</td><td><b>' . phpwcms_strtotime($article[$akey]["article_end"], $BL['be_longdatetime'], '&nbsp;') . '</b></td></tr>';
        }
        $info .= '<tr><td>' . $BL['be_cnt_sortvalue'] . ':</td><td>' . $article[$akey]["article_sort"] . '</td></tr>';
        if (isset($article[$akey]["article_end"])) {
            $info .= '<tr><td>' . $BL['be_priorize'] . ':</td><td>' . $article[$akey]["article_priorize"] . '</td></tr>';
        }
        $info .= '</table>';
        $a .= 'onmouseover="Tip(\'' . $info . '\');" onmouseout="UnTip()" alt=""';
        //$a .= getAltTitle($info);
        $a .= " /></td>\n";
        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\" alt=\"\" /></td>\n";
        $a .= '<td class="dir" width="95%"><a href="';
        $a .= rel_url(array('phpwcms-preview' => 1), array(), empty($article[$akey]["article_alias"]) ? 'aid=' . $article[$akey]["article_id"] : $article[$akey]["article_alias"]);
        $a .= '" target="_blank" title="' . $BL['be_func_struct_preview'] . ': ' . $at . '">';
        $a .= $at . "</a></td>\n</tr>\n</table></td>\n<td width=\"77\" nowrap=\"nowrap\">";
        if ($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
            $a .= "<a href=\"phpwcms.php?do=articles&amp;p=2&amp;s=1&amp;id=" . $article[$akey]["article_id"];
            $a .= "\" title=\"" . $BL['be_func_struct_edit'] . " \n[" . $at . "]\">";
            $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"></a>";
        } else {
            $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
        }
        if ($cut_article != $article[$akey]["article_id"] && !$cut_article_content) {
            $a .= "<a href=\"phpwcms.php?do=articles&amp;acut=" . $article[$akey]["article_id"];
            $a .= "\" title=\"" . $BL['be_func_struct_cut'] . " \n[" . $at . "]\">";
            $a .= "<img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        } elseif ($cut_article_content) {
            $a .= '<a href="include/inc_act/act_structure.php?do=' . rawurlencode('7|' . $cut_article_content . '|' . $article[$akey]["article_id"] . '|-10');
            $a .= '" title="' . $BL['be_func_content_paste0'];
            $a .= " [" . $at . "]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        } else {
            $a .= "<a href=\"phpwcms.php?do=articles\" title=\"" . $BL['be_func_struct_nocut'] . '">';
            $a .= "<img src=\"img/button/cut_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        }
        if ($copy_article != $article[$akey]["article_id"] && !$copy_article_content) {
            $a .= "<a href=\"phpwcms.php?do=articles&amp;acopy=" . $article[$akey]["article_id"];
            $a .= "\" title=\"" . $BL['be_func_struct_copy'] . " \n[" . $at . "]\">";
            $a .= "<img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        } elseif ($copy_article_content) {
            $a .= '<a href="include/inc_act/act_structure.php?do=' . rawurlencode('8|' . $copy_article_content . '|' . $article[$akey]["article_id"] . '|-10');
            $a .= "\" title=\"" . $BL['be_func_content_paste0'];
            $a .= " [" . $at . "]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        } else {
            $a .= "<a href=\"phpwcms.php?do=articles\" title=\"" . $BL['be_func_struct_nocopy'] . '">';
            $a .= "<img src=\"img/button/copy_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        }
        //Sortierungslink
        //davor sortieren
        $a .= $sort_up;
        //dahinter sortieren
        $a .= $sort_down;
        //switch active status
        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=3," . $article[$akey]["article_id"] . ",," . ($article[$akey]["article_aktiv"] ? 0 : 1);
        $a .= '" title="' . $BL['be_func_struct_svisible'] . '">';
        $a .= "<img src=\"img/button/visible_11x11_" . $article[$akey]["article_aktiv"] . ".gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        //delete article
        if ($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
            $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=1," . $article[$akey]["article_id"];
            $a .= "\" title=\"" . $BL['be_func_struct_del_article'] . " \n[" . $at . "]\" ";
            $a .= "onclick=\"return confirm('" . $BL['be_func_struct_del_jsmsg'] . " \\n[" . js_singlequote($at) . "] ');\">";
            $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" /></a>";
        } else {
            $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\" />";
        }
        $a .= "</td>\n</tr>\n";
        echo $a;
        $sql = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM " . DB_PREPEND . "phpwcms_articlecontent ";
        $sql .= "WHERE acontent_aid=" . $article[$akey]["article_id"] . " ORDER BY acontent_block, acontent_sorting, acontent_id";
        if ($result = mysql_query($sql, $GLOBALS['db']) or die("error while listing contents for this article")) {
            $sc = 0;
            $scc = 0;
            //Sort-Zwischenz�hler
            while ($row = mysql_fetch_row($result)) {
                $scc++;
                if ($row[2] == 0) {
                    $sc++;
                    $sbutton[$sc]["id"] = $row[0];
                    $sbutton[$sc]["sort"] = $row[1];
                    $sbutton[$sc]["block"] = $row[3];
                }
            }
        }
        if ($sc) {
            //Jetzt aufbauen der Sortieranweisung
            foreach ($sbutton as $key => $value) {
                if ($key == 1) {
                    // if 1st content part in list
                    $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\" alt=\"\" />";
                } elseif (isset($sbutton[$key - 1]["block"]) && $sbutton[$key - 1]["block"] != $sbutton[$key]["block"]) {
                    // if this content part is selected for different block than previous
                    $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\" alt=\"\" />";
                } else {
                    $sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=" . rawurlencode($sbutton[$key]["id"] . ":" . $sbutton[$key - 1]["sort"] . "|" . $sbutton[$key - 1]["id"] . ":" . $sbutton[$key]["sort"]) . "\" title=\"" . $BL['be_article_cnt_up'] . "\"><img src=\"img/button/sort_1_1.gif\" border=\"0\" alt=\"\" /></a>";
                }
                if ($key == $sc) {
                    // if this is the last content part in list
                    $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\" alt=\"\" />";
                } elseif (isset($sbutton[$key + 1]["block"]) && $sbutton[$key + 1]["block"] != $sbutton[$key]["block"]) {
                    // if this is the last content part in current block and next is different
                    $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\" alt=\"\" />";
                } else {
                    $sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=" . rawurlencode($sbutton[$key]["id"] . ":" . $sbutton[$key + 1]["sort"] . "|" . $sbutton[$key + 1]["id"] . ":" . $sbutton[$key]["sort"]) . "\" title=\"" . $BL['be_article_cnt_down'] . "\"><img src=\"img/button/sort_2_1.gif\" border=\"0\" alt=\"\" /></a>";
                }
                $sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"] . $sbutton[$key]["bottom"];
            }
            unset($sbutton);
        }
        if ($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
            if (isset($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) && $_SESSION["structure"]["article"][$article[$akey]["article_id"]]) {
                struct_articlecontentlist($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $GLOBALS['db']);
            }
        }
    }
}
     $article["article_begin"] = phpwcms_strtotime($article["article_begin"]);
     if ($article["article_begin"] == false) {
         $article["article_begin"] = date("Y-m-d H:i:s");
         $set_begin = 1;
         $article_err[] = $BL['be_article_err2'];
     } else {
         $article["article_begin"] = date("Y-m-d H:i:s", $article["article_begin"]);
         $set_begin = 1;
     }
 } else {
     $article["article_begin"] = date("Y-m-d H:i:s");
     $set_begin = 0;
 }
 if ($article["article_end"]) {
     //Check date
     $article["article_end"] = phpwcms_strtotime($article["article_end"]);
     if ($article["article_end"] == false) {
         $article["article_end"] = date("Y-m-d H:i:s", time() + 3600 * 24 * 365 * 10);
         $set_end = 1;
         $article_err[] = $BL['be_article_err4'];
     } else {
         $article["article_end"] = date("Y-m-d H:i:s", $article["article_end"]);
         $set_end = 1;
     }
 } else {
     $article["article_end"] = date("Y-m-d H:i:s", time() + 3600 * 24 * 365 * 10);
     $set_end = 0;
 }
 //Ende Check Date
 $article['image'] = array();
 $article['image']['tmpllist'] = slweg($_POST["article_tmpllist"]);
示例#6
0
 /**
  * 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']) : $this->limit;
         $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(strtoupper($match['tagmode'])) === 'AND' ? 'AND' : 'OR');
         $default['href'] = empty($match['href']) ? '' : trim($match['href']);
         $default['place'] = empty($match['place']) ? '' : trim($match['place']);
         $default['gettype'] = empty($match['gettype']) ? '' : $match['gettype'];
         $default['teaserwords'] = empty($match['teaserwords']) ? 0 : intval($match['teaserwords']);
         if (!empty($match['expired'])) {
             $match['expired'] = strtolower(trim($match['expired']));
             $default['expired'] = in_array($match['expired'], array('hide', 'bottom', 'top')) ? $match['expired'] : '';
         } else {
             $default['expired'] = '';
         }
         if (!empty($match['expired_date'])) {
             $match['expired_date'] = strtoupper(trim($match['expired_date']));
             $default['expired_date'] = in_array($match['expired_date'], array('START', 'END')) ? $match['expired_date'] : 'END';
         } else {
             $default['expired_date'] = 'END';
         }
         $default['expired_prefix'] = empty($match['expired_prefix']) ? '' : trim($match['expired_prefix']);
         $default['expired_suffix'] = empty($match['expired_suffix']) ? '' : trim($match['expired_suffix']);
     } else {
         // base format
         // 2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3 : date_start, date_end, place
         // [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['tagmode'] = 'OR';
         $default['place'] = '';
         $default['gettype'] = '';
         $default['teaserwords'] = 0;
         $default['expired'] = '';
         $default['expired_date'] = 'END';
         $default['expired_prefix'] = '';
         $default['expired_suffix'] = '';
         if (empty($match[4])) {
             $default['tag'] = '';
         } else {
             // check for start/end date
             $match[4] = explode(':', $match[4], 2);
             if (isset($match[4][1])) {
                 $match[4][1] = explode(',', $match[4][1], 3);
                 if (!empty($match[4][1][0])) {
                     $match['date_start'] = $match[4][1][0];
                 } else {
                     $match['date_start'] = 'TODAY';
                 }
                 if (!empty($match[4][1][1])) {
                     $match['date_end'] = $match[4][1][1];
                 } else {
                     $match['date_end'] = 365 * 24 * 60 * 60 - 1;
                     // + 365 days - 1 second
                 }
                 if (!empty($match[4][1][2])) {
                     $default['place'] = trim($match[4][1][2]);
                 }
             }
         }
     }
     // check for limit
     if (isset($_POST[$this->getbasis . 'limit'])) {
         $default['items'] = intval(clean_slweg($_POST[$this->getbasis . 'limit']));
         $this->session = true;
     } elseif (isset($_GET[$this->getbasis . 'limit'])) {
         $default['items'] = intval(clean_slweg($_GET[$this->getbasis . 'limit']));
         $this->session = true;
     } elseif (!empty($_SESSION['pcal']['limit'])) {
         $default['items'] = $_SESSION['pcal']['limit'];
     }
     // check for place to search
     if (isset($_POST[$this->getbasis . 'place'])) {
         $default['place'] = clean_slweg($_POST[$this->getbasis . 'place']);
         $this->session = true;
     } elseif (isset($_GET[$this->getbasis . 'place'])) {
         $default['place'] = clean_slweg($_GET[$this->getbasis . 'place']);
         $this->session = true;
     } elseif (!empty($_SESSION['pcal']['place'])) {
         $default['place'] = $_SESSION['pcal']['place'];
     }
     // custom start date
     if (isset($_POST[$this->getbasis . 'start'])) {
         if (empty($_POST[$this->getbasis . 'start'])) {
             $match['date_start'] = $_POST[$this->getbasis . 'start_year'] . '-' . $_POST[$this->getbasis . 'start_month'] . '-' . $_POST[$this->getbasis . 'start_day'] . ' 00:00:00';
         } else {
             $match['date_start'] = $_POST[$this->getbasis . 'start'];
         }
         $match['date_start'] = clean_slweg($match['date_start']);
         $this->session = true;
     } elseif (isset($_GET[$this->getbasis . 'start'])) {
         if (empty($_GET[$this->getbasis . 'start'])) {
             $match['date_start'] = $_GET[$this->getbasis . 'start_year'] . '-' . $_GET[$this->getbasis . 'start_month'] . '-' . $_GET[$this->getbasis . 'start_day'] . ' 00:00:00';
         } else {
             $match['date_start'] = $_GET[$this->getbasis . 'start'];
         }
         $match['date_start'] = clean_slweg($match['date_start']);
         $this->session = true;
     } elseif (!empty($_SESSION['pcal']['date_start'])) {
         $match['date_start'] = $_SESSION['pcal']['date_start'];
     }
     // custom end date
     if (isset($_POST[$this->getbasis . 'end'])) {
         if (empty($_POST[$this->getbasis . 'end'])) {
             $match['date_end'] = $_POST[$this->getbasis . 'end_year'] . '-' . $_POST[$this->getbasis . 'end_month'] . '-' . $_POST[$this->getbasis . 'end_day'] . ' 23:59:59';
         } else {
             $match['date_end'] = $_POST[$this->getbasis . 'end'];
         }
         $match['date_end'] = clean_slweg($match['date_end']);
         $this->session = true;
     } elseif (isset($_GET[$this->getbasis . 'end'])) {
         if (empty($_GET[$this->getbasis . 'end'])) {
             $match['date_end'] = $_GET[$this->getbasis . 'end_year'] . '-' . $_GET[$this->getbasis . 'end_month'] . '-' . $_GET[$this->getbasis . 'end_day'] . ' 23:59:59';
         } else {
             $match['date_end'] = $_GET[$this->getbasis . 'end'];
         }
         $this->session = true;
     } elseif (!empty($_SESSION['pcal']['date_end'])) {
         $match['date_end'] = $_SESSION['pcal']['date_end'];
     }
     // set custom defined start/end date
     if (!empty($match['date_start'])) {
         $match['date_start'] = trim($match['date_start']);
         if (strtoupper($match['date_start']) == 'TODAY') {
             $this->date_start = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year']);
         } elseif (strtoupper($match['date_start']) == 'WEEKSTART') {
             $this->date_start = strtotime((intval(date('w', $this->current_date[0])) === 1 ? 'Today' : 'last Monday') . ' 00:00:00');
         } elseif (strtoupper($match['date_start']) == 'MONTHSTART') {
             $this->date_start = mktime(0, 0, 0, $this->current_date['mon'], 1, $this->current_date['year']);
         } elseif (strtoupper($match['date_start']) == 'YEARSTART') {
             $this->date_start = mktime(0, 0, 0, 1, 1, $current_date['year']);
         } else {
             $match['date_start'] = phpwcms_strtotime($match['date_start']);
             if ($match['date_start']) {
                 $this->date_start = $match['date_start'];
             }
         }
     }
     if (!empty($match['date_end'])) {
         $match['date_end'] = strtoupper(trim($match['date_end']));
         if (is_intval($match['date_end'])) {
             $this->date_end = ceil($this->date_start + $match['date_end'] * 24 * 3600);
             // Get Seconds of this day and match against 23:59:59
             $today_hours = date('G', $this->date_end) * 3600;
             $today_minutes = intval(date('i', $this->date_end)) * 60;
             $today_seconds = intval(date('s', $this->date_end));
             $total_seconds = $today_hours + $today_minutes + $today_seconds;
             $this->date_end += 24 * 3600 - $total_seconds - 1;
         } elseif ($match['date_end'] == 'TODAY') {
             $this->date_end = mktime(23, 59, 59, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year']);
         } elseif ($match['date_end'] == 'WEEKEND') {
             $this->date_end = strtotime('next Sunday 23:59:59');
         } elseif (preg_match('/(\\d+)\\s{0,1}(DAY|DAYS|WEEK|WEEKS|MONTH|MONTHS)/', $match['date_end'], $add)) {
             $this->date_end = strtotime('+' . $add[1] . ' ' . $add[2] . ' 23:59:59', $this->date_start);
         } elseif (strtoupper($match['date_end']) == 'MONTHEND') {
             $this->date_end = mktime(23, 59, 59, $this->current_date['mon'], intval(date('t', $this->current_date[0])), $this->current_date['year']);
         } elseif (strtoupper($match['date_end']) == 'YEAREND') {
             $this->date_end = mktime(23, 59, 59, 12, 31, $current_date['year']);
         } else {
             if (strlen($match['date_end']) < 12 && preg_match('/[0-9\\-]/', $match['date_end']) && strpos($match['date_end'], ':') === false) {
                 $match['date_end'] .= ' 23:59:59';
             }
             $match['date_end'] = phpwcms_strtotime($match['date_end']);
             if ($match['date_end']) {
                 $this->date_end = $match['date_end'];
             }
         }
     }
     if ($this->date_end <= $this->date_start) {
         $this->date_end = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year'] + 1) - 1;
     }
     $this->limit = $default['items'];
     $this->limit_item = $default['items'];
     $this->href = $default['href'];
     $this->gettype = $default['gettype'];
     $this->teaserwords = $default['teaserwords'];
     $this->expired = $default['expired'];
     $this->expired_date = $default['expired_date'];
     $this->expired_prefix = $default['expired_prefix'];
     $this->expired_suffix = $default['expired_suffix'];
     if ($default['template'] !== '') {
         $default['template'] = preg_replace('/[\\/\\:]/', '', $default['template']);
         if (is_file(PHPWCMS_TEMPLATE . 'calendar/' . $default['template'])) {
             $default['template'] = file_get_contents(PHPWCMS_TEMPLATE . 'calendar/' . $default['template']);
             if ($default['template']) {
                 $default['template'] = str_replace('{STARTDATE', '{LIVEDATE', $default['template']);
                 $default['template'] = str_replace('{ENDDATE', '{KILLDATE', $default['template']);
                 $this->template = $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'])) {
             $this->where_lang = "calendar_lang IN ('" . implode("','", $default['lang']) . "')";
             $where[] = $this->where_lang;
         }
     }
     if ($default['place'] !== '') {
         $places = convertStringToArray(strtolower($default['place']), ',');
         $place_items = array();
         foreach ($places as $place) {
             $place_items[] = 'calendar_where LIKE ' . _dbEscape('%' . $place . '%');
         }
         if (count($place_items)) {
             $this->where_place = '(' . implode(' OR ', $place_items) . ')';
             $where[] = $this->where_place;
         }
     }
     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)) {
                 $this->where_tag = '(' . implode(' ' . $default['tagmode'] . ' ', $tag_where) . ')';
                 $where[] = $this->where_tag;
                 $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->datetime_start = date('Y-m-d H:i:s', $this->date_start);
     $this->datetime_end = date('Y-m-d H:i:s', $this->date_end);
     $this->place = $default['place'];
     $this->getDate();
     if ($this->session && session_id()) {
         $this->session = array('date_start' => $this->datetime_start, 'date_end' => $this->datetime_end, 'place' => $default['place'], 'limit' => $default['items']);
         $_SESSION['pcal'] = isset($_SESSION['pcal']) ? array_merge($_SESSION['pcal'], $this->session) : $this->session;
     }
     return $default;
 }
    $plugin['data']['calendar_rangeend'] = date('d' . $BLM['date_delimiter'] . 'm' . $BLM['date_delimiter'] . 'Y', $plugin['data']['calendar_rangeend']);
}
// build start / date
$plugin['data']['calendar_start_date'][0] = sprintf('%02d', $plugin['data']['calendar_start_date'][0]);
$plugin['data']['calendar_start_date'][1] = sprintf('%02d', $plugin['data']['calendar_start_date'][1]);
if ($plugin['data']['calendar_start_date'][2] < 100) {
    $plugin['data']['calendar_start_date'][2] = sprintf('%02d', $plugin['data']['calendar_start_date'][2]);
}
$plugin['data']['calendar_start'] = $plugin['data']['calendar_start_date'][2] . '-' . $plugin['data']['calendar_start_date'][1] . '-';
$plugin['data']['calendar_start'] .= $plugin['data']['calendar_start_date'][0] . ' ' . $plugin['data']['calendar_start_time'] . ':00';
$plugin['data']['calendar_end_date'][0] = sprintf('%02d', $plugin['data']['calendar_end_date'][0]);
$plugin['data']['calendar_end_date'][1] = sprintf('%02d', $plugin['data']['calendar_end_date'][1]);
if ($plugin['data']['calendar_end_date'][2] < 100) {
    $plugin['data']['calendar_end_date'][2] = sprintf('%02d', $plugin['data']['calendar_end_date'][2]);
}
$plugin['data']['calendar_end'] = $plugin['data']['calendar_end_date'][2] . '-' . $plugin['data']['calendar_end_date'][1] . '-';
$plugin['data']['calendar_end'] .= $plugin['data']['calendar_end_date'][0] . ' ' . $plugin['data']['calendar_end_time'] . ':00';
// compare start against end
$plugin['data']['start_timestamp'] = phpwcms_strtotime($plugin['data']['calendar_start'], NULL, 0);
if (phpwcms_strtotime($plugin['data']['calendar_end'], NULL, 0) < $plugin['data']['start_timestamp']) {
    $plugin['data']['calendar_end'] = $plugin['data']['start_timestamp'] + 60 * 30;
    $plugin['data']['calendar_end_time'] = date('H:i', $plugin['data']['calendar_end']);
    $plugin['data']['calendar_end_date'][0] = date('d', $plugin['data']['calendar_end']);
    $plugin['data']['calendar_end_date'][1] = date('m', $plugin['data']['calendar_end']);
    $plugin['data']['calendar_end_date'][2] = date('Y', $plugin['data']['calendar_end']);
    $plugin['data']['calendar_end'] = date('Y-m-d H:i', $plugin['data']['calendar_end']);
}
// define new selected month based on given start date
$_SESSION['calendardate'] = $plugin['data']['calendar_start_date'][1] . '-' . $plugin['data']['calendar_start_date'][2];
$plugin['data']['calendar_start_date'] = implode($BLM['date_delimiter'], $plugin['data']['calendar_start_date']);
$plugin['data']['calendar_end_date'] = implode($BLM['date_delimiter'], $plugin['data']['calendar_end_date']);
echo html(phpwcms_strtotime($plugin['data']['adcampaign_changed'], $BL['be_fprivedit_dateformat'], ''));
?>
</td>
	</tr>

	<?php 
if (!empty($plugin['data']['adcampaign_created'])) {
    ?>

	<tr>
		<td align="right" class="chatlist"><?php 
    echo $BL['be_fprivedit_created'];
    ?>
:&nbsp;</td>
		<td class="v10"><?php 
    echo html(phpwcms_strtotime($plugin['data']['adcampaign_created'], $BL['be_fprivedit_dateformat'], ''));
    ?>
</td>
	</tr>

	<?php 
}
?>

	<tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>

	<tr>
		<td align="right" class="chatlist"><?php 
echo $BLM['campaign_entry'];
?>
:&nbsp;</td>
示例#9
0
    function listBackend()
    {
        $this->select = '*, ';
        $this->select .= 'IF(UNIX_TIMESTAMP(cnt_livedate)<=0, cnt_created, UNIX_TIMESTAMP(cnt_livedate)) AS cnt_startdate, ';
        $this->select .= 'UNIX_TIMESTAMP(cnt_killdate) AS cnt_enddate, ';
        $this->select .= 'IF(cnt_sort=0, IF(UNIX_TIMESTAMP(cnt_livedate)<=0, cnt_created, UNIX_TIMESTAMP(cnt_livedate)), cnt_sort) AS cnt_sortdate';
        //$this->order_by	= array('cnt_prio DESC', 'cnt_sortdate DESC');
        $this->getNews();
        $list = array();
        $x = 0;
        if (count($this->news)) {
            $list[] = '<table cellpadding="0" cellspacing="0" border="0" summary="" class="listing" style="width:100%; min-width:750px">';
            $list[] = '<tr class="header">';
            $sort_class = array('prio' => 'sort-off', 'name' => 'sort-off', 'start' => 'sort-off', 'sort' => 'sort-off', 'end' => 'sort-off');
            switch ($this->filter_sort) {
                case 'prio_asc':
                    $sort_class['prio'] = 'sort-asc';
                    break;
                case 'prio_desc':
                    $sort_class['prio'] = 'sort-desc';
                    break;
                case 'name_asc':
                    $sort_class['name'] = 'sort-asc';
                    break;
                case 'name_desc':
                    $sort_class['name'] = 'sort-desc';
                    break;
                case 'start_asc':
                    $sort_class['start'] = 'sort-asc';
                    break;
                case 'start_desc':
                    $sort_class['start'] = 'sort-desc';
                    break;
                case 'sort_asc':
                    $sort_class['sort'] = 'sort-asc';
                    break;
                case 'sort_desc':
                    $sort_class['sort'] = 'sort-desc';
                    break;
                case 'end_asc':
                    $sort_class['end'] = 'sort-asc';
                    break;
                case 'end_desc':
                    $sort_class['end'] = 'sort-desc';
                    break;
            }
            $list[] = '<th class="column colfirst news"><span class="' . $sort_class['name'] . '">' . $this->BL['be_title'] . '</span></th>';
            $list[] = '<th class="column"><span class="' . $sort_class['start'] . '">' . $this->BL['be_article_cnt_start'] . '</span></th>';
            $list[] = '<th class="column"><span class="' . $sort_class['end'] . '">' . $this->BL['be_article_cnt_end'] . '</span></th>';
            $list[] = '<th class="column"><span class="' . $sort_class['sort'] . '">' . $this->BL['be_sort_date'] . '</span></th>';
            $list[] = '<th class="column"><span class="' . $sort_class['prio'] . '">Prio</span></th>';
            $list[] = '<th class="column collast">&nbsp;</th>';
            $list[] = '</tr>';
            foreach ($this->news as $news) {
                $list[] = '<tr class="row' . ($x % 2 ? ' alt' : '') . '">';
                $news['live'] = $news['cnt_startdate'];
                $news['live'] = $news['live'] == false || $news['live'] <= 0 ? $this->BL['be_func_struct_empty'] : date($this->BL['be_shortdatetime'], $news['live']);
                $news['kill'] = phpwcms_strtotime($news['cnt_killdate'], $this->BL['be_shortdatetime'], $this->BL['be_func_struct_empty']);
                $news['sort'] = $news['cnt_sortdate'] == false || $news['cnt_sortdate'] <= 0 ? $this->BL['be_func_struct_empty'] : date($this->BL['be_shortdatetime'], $news['cnt_sortdate']);
                $list[] = '<td class="column colfirst news" style="background-image:url(img/famfamfam/lang/' . (!$news['cnt_lang'] ? 'all' : $news['cnt_lang']) . '.png)">';
                $list[] = html($news['cnt_name']);
                $list[] = '</td>';
                $list[] = '<td class="column nowrap">' . $news['live'] . '</td>';
                $list[] = '<td class="column nowrap">' . $news['kill'] . '</td>';
                $list[] = '<td class="column nowrap">' . $news['sort'] . '</td>';
                $list[] = '<td class="column">' . $news['cnt_prio'] . '</td>';
                $list[] = '<td class="column collast nowrap">

					<a href="' . $this->base_url . '&amp;cntid=' . $news['cnt_id'] . '&amp;action=edit">' . '<img src="img/button/edit_22x13.gif" border="0" alt="" /></a>' . '<a href="' . $this->base_url . '&amp;cntid=' . $news['cnt_id'] . '&amp;status=' . ($news['cnt_status'] ? '0' : '1') . '">' . '<img src="img/button/aktiv_12x13_' . $news['cnt_status'] . '.gif" border="0" alt="" /></a>' . '<a href="' . $this->base_url . '&amp;cntid=' . $news['cnt_id'] . '&amp;status=9' . '" title="' . $this->BL['be_delete_dataset'] . ' ' . html($news['cnt_name']) . '" onclick="return confirm(\'' . $this->BL['be_delete_dataset'] . ' \\n' . js_singlequote($news['cnt_name']) . '\');">' . '<img src="img/button/trash_13x13_1.gif" border="0" alt=""></a>

				</td>';
                $list[] = '</tr>';
                $x++;
            }
            $list[] = '</table>';
        }
        return implode(LF, $list);
    }
?>
</td>
			</tr>
			<tr>
			  <td class="v10" style="color:#727889" nowrap="nowrap"><?php 
echo $BL['be_article_cnt_start'];
?>
:&nbsp;</td>
			  <td class="v10"><?php 
echo phpwcms_strtotime($article["article_begin"], $BL['be_longdatetime'], '');
?>
&nbsp;&nbsp;<span style="color:#727889"><?php 
echo $BL['be_article_cnt_end'];
?>
:</span>&nbsp;<?php 
echo phpwcms_strtotime($article["article_end"], $BL['be_longdatetime'], '');
?>
</td>
			</tr>

			<tr>
			  <td class="v10" style="color:#727889" nowrap="nowrap"><?php 
echo $BL['be_cnt_sortvalue'];
?>
:&nbsp;</td>
			  <td class="v10"><?php 
echo $article["article_sort"];
?>
&nbsp;&nbsp;<span style="color:#727889"><?php 
echo $BL['be_priorize'];
?>