<?php

require 'class.base.php';
require 'class.html.php';
require 'class.diary.php';
$base_instance = new base();
$html_instance = new html();
$diary_instance = new diary();
if (isset($_GET['year'])) {
    $year = (int) $_GET['year'];
} else {
    exit;
}
$year_overview = $diary_instance->get_year_view($year);
$html_instance->add_parameter(array('TEXT_CENTER' => '<p>' . $year_overview));
$html_instance->process();
<?php

require 'class.base.php';
require 'class.html.php';
require 'class.diary.php';
$base_instance = new base();
$html_instance = new html();
$diary_instance = new diary();
$userid = $base_instance->get_userid();
if (empty($_GET['month'])) {
    $month = date('n');
} else {
    $month = (int) $_GET['month'];
}
if (empty($_GET['year'])) {
    $year = date('Y');
} else {
    $year = (int) $_GET['year'];
}
$days = $diary_instance->get_days_in_month($month, $year);
$all = '<br><div align="center" class="header">Monthly Reminder Overview &nbsp;&nbsp; <a href="show-reminder-monthly-overview.php">[Normal View]</a></div><p>';
for ($day = 1; $day <= $days; $day++) {
    $timestamp = mktime(0, 0, 0, $month, $day, $year);
    $day_of_the_week = date('w', $timestamp) + 1;
    $day_of_the_week_text = date('l', $timestamp);
    $all .= '<table width="80%" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" class="pastel2"><tr><td colspan="5" style="background-image: url(\'pics/gradient.jpg\');border-bottom:1px solid ' . _BLOCK_LINE_COLOR . '">&nbsp;<b>' . $day_of_the_week_text . ', ' . $day . '.' . $month . '.' . $year . '</b></td></tr>';
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['REMINDER']['DATE']} WHERE user={$userid} AND day={$day} AND (month={$month} OR month=0) AND (year={$year} OR year=0)");
    for ($index = 1; $index <= sizeof($data); $index++) {
        $ID = $data[$index]->ID;
        $title = $data[$index]->title;
        $all .= '<tr bgcolor="#ffffff"><td width="40"><a href="javascript:void(window.open(\'edit-reminder-date.php?reminder_id=' . $ID . '\',\'\',\'width=600,height=620,top=100,left=100\'))">[Edit]</a></td><td width="50"><a href="javascript:void(window.open(\'delete-reminder-date.php?reminder_id=' . $ID . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a></td><td>' . $title . '</td></tr>';
Example #3
0
 /**
  * 添加关系
  */
 public static final function append()
 {
     $error = array();
     $online = front::online();
     $get = array('s_type' => isset($_GET['s_type']) ? $_GET['s_type'] : '', 't_type' => isset($_GET['t_type']) ? $_GET['t_type'] : '', 's_id' => isset($_GET['s_id']) ? (int) $_GET['s_id'] : '0', 't_id' => isset($_GET['t_id']) ? (int) $_GET['t_id'] : '0');
     $s_list = null;
     if ($get['s_type'] == 'channel') {
         $s_list = channel::get_channel_select(0, 0, $get['s_id'], null, null);
     } elseif ($get['s_type'] == 'address') {
         $s_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } elseif ($get['s_type'] == 'book') {
         $s_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } elseif ($get['s_type'] == 'diary') {
         $s_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } elseif ($get['s_type'] == 'doc') {
         $s_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } elseif ($get['s_type'] == 'site') {
         $s_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } elseif ($get['s_type'] == 'user') {
         $s_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name'));
         if ($s_lists) {
             $s_list = make_option($s_lists, $get['s_id']);
         }
     } else {
     }
     $t_list = null;
     if ($get['t_type'] == 'channel') {
         $t_list = channel::get_channel_select(0, 0, $get['t_id'], null, null);
     } elseif ($get['t_type'] == 'address') {
         $t_lists = address::selects('address_id as id,name', null, array('user_id' => $online->user_id), array('ORDER BY address_id DESC'), array('id', 'column|table=address' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } elseif ($get['t_type'] == 'book') {
         $t_lists = book::selects('book_id as id,concat_ws(\',\',create_date,item_txt,remark,ccy,amount,otype) as name', null, array('user_id' => $online->user_id), array('ORDER BY create_date DESC,book_id DESC'), array('id', 'column|table=book' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } elseif ($get['t_type'] == 'diary') {
         $t_lists = diary::selects('diary_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY diary_id DESC'), array('id', 'column|table=diary' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } elseif ($get['t_type'] == 'doc') {
         $t_lists = doc::selects('doc_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY doc_id DESC'), array('id', 'column|table=doc' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } elseif ($get['t_type'] == 'site') {
         $t_lists = site::selects('site_id as id,title as name', null, array('user_id' => $online->user_id), array('ORDER BY site_id DESC'), array('id', 'column|table=site' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } elseif ($get['t_type'] == 'user') {
         $t_lists = user::selects('user_id as id,username as name', null, array('user_id' => $online->user_id), array('ORDER BY user_id DESC'), array('id', 'column|table=user' => 'name'));
         if ($t_lists) {
             $t_list = make_option($t_lists, $get['t_id']);
         }
     } else {
     }
     // 表单处理
     while (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
         // 数据消毒
         $post = array('s_type' => isset($_POST['s_type']) ? $_POST['s_type'] : '', 't_type' => isset($_POST['t_type']) ? $_POST['t_type'] : '', 's_id' => isset($_POST['s_id']) ? (int) $_POST['s_id'] : '0', 't_id' => isset($_POST['t_id']) ? (int) $_POST['t_id'] : '0', 'user_id' => $online->user_id);
         if (!$post['s_type']) {
             $error['s_type'] = '请选择源类型';
         }
         if (!$post['t_type']) {
             $error['t_type'] = '请选择目标类型';
         }
         if (!$post['s_id']) {
             $error['s_id'] = '请选择源内容';
         }
         if (!$post['t_id']) {
             $error['t_id'] = '请选目标内容';
         }
         if (!$error['t_id']) {
             if ($post['s_type'] == $post['t_type'] && $post['s_id'] == $post['t_id']) {
                 $error['t_id'] = '不能和自己关联';
             }
         }
         if (!$error['t_id']) {
             $related_id = self::selects('related_id', null, array('user_id' => $online->user_id, 's_id' => $post['s_id'], 's_type' => $post['s_type'], 't_id' => $post['t_id'], 't_type' => $post['t_type']), null, array('column' => 'related_id'));
             if (!$related_id) {
                 $related_id = self::selects('related_id', null, array('user_id' => $online->user_id, 's_id' => $post['t_id'], 's_type' => $post['t_type'], 't_id' => $post['s_id'], 't_type' => $post['s_type']), null, array('column' => 'related_id'));
             }
             if ($related_id) {
                 $error['t_id'] = '目标内容已经关联,请重新选择';
             }
         }
         if (!empty($error)) {
             break;
         }
         // 数据入库
         $related = new self();
         $related->related_id = null;
         $related->struct($post);
         $related->insert();
         $error = '添加成功';
         front::view2('error.tpl', compact('error'));
         return;
     }
     $types = array('address' => '地址', 'book' => '账本', 'channel' => '分类', 'diary' => '日志', 'doc' => '文章', 'site' => '网址', 'user' => '用户');
     front::view2(__CLASS__ . '.' . 'form.tpl', compact('post', 'get', 'error', 'types', 's_list', 't_list'));
 }
Example #4
0
<?php

require 'class.base.php';
require 'class.html.php';
require 'class.diary.php';
$base_instance = new base();
$html_instance = new html();
$diary_instance = new diary();
$userid = $base_instance->get_userid();
if (isset($_REQUEST['day'])) {
    $day = (int) $_REQUEST['day'];
}
if (isset($_REQUEST['month'])) {
    $month = (int) $_REQUEST['month'];
}
if (isset($_REQUEST['year'])) {
    $year = (int) $_REQUEST['year'];
}
if (isset($_REQUEST['diary_id'])) {
    $diary_id = (int) $_REQUEST['diary_id'];
}
$all_text = '';
if (isset($_POST['save'])) {
    $error = '';
    $title = $_POST['title'];
    $diary_text = $_POST['diary_text'];
    if ($title) {
        $title = trim($title);
        if (strlen($title) > 100) {
            $error .= '<li> Title is too long (Max. 100 Characters)';
        }
<?php

require 'class.base.php';
require 'class.html.php';
require 'class.diary.php';
$base_instance = new base();
$html_instance = new html();
$diary_instance = new diary();
$userid = $base_instance->get_userid();
if (empty($_GET['month'])) {
    $month = date('n');
} else {
    $month = (int) $_GET['month'];
}
if (empty($_GET['year'])) {
    $year = date('Y');
} else {
    $year = (int) $_GET['year'];
}
$days = $diary_instance->get_month_view2($month, $year);
$all = '<br><div align="center" class="header">Monthly Reminder Overview &nbsp;&nbsp; <a href="show-reminder-monthly-list-overview.php">[List View]</a></div><p>';
$all .= $days;
$html_instance->add_parameter(array('TEXT_CENTER' => "{$all}"));
$html_instance->process();