function executeViewSuccess(&$controller, &$xoopsUser, &$render)
 {
     $csv_data = $_SESSION['user_csv_upload_data'];
     $user_handler =& $this->_getHandler();
     $user_tmp = $user_handler->create();
     $user_key = array_keys($user_tmp->gets());
     foreach ($csv_data as $data) {
         if ($data['is_new'] || $data['update']) {
             if ($data['update']) {
                 $user =& $user_handler->get($data['value'][0]['var']);
             } else {
                 $user =& $user_handler->create();
             }
             foreach ($user_key as $i => $key) {
                 $value = $data['value'][$i]['var'];
                 switch ($user_key[$i]) {
                     case 'user_regdate':
                     case 'last_login':
                         $value = userTimeToServerTime(strtotime($value));
                         break;
                     default:
                 }
                 $user->setVar($key, $value);
             }
             $user_handler->insert($user);
         }
     }
     unset($_SESSION['user_csv_upload_data']);
     $controller->executeRedirect("index.php", 1, _AD_USER_DATA_UPLOAD_DONE);
 }
Exemple #2
0
function get_event()
{
    global $xoopsDB, $xoopsUser;
    $andWebID = empty($_REQUEST['WebID']) ? "" : "and `WebID`='{$_REQUEST['WebID']}'";
    $start = date("Y-m-d", $_REQUEST['start'] / 1000);
    $andEnd = "";
    if ($_REQUEST['end']) {
        $end = date("Y-m-d", $_REQUEST['end'] / 1000);
        $andEnd = "and toCal <= '{$end}'";
    }
    $andNewsKind = empty($_REQUEST['NewsKind']) ? "" : "and NewsKind='{$_REQUEST['NewsKind']}'";
    $sql = "select * from " . $xoopsDB->prefix("tad_web_news") . " where toCal >= '{$start}' {$andEnd} {$andWebID} {$andNewsKind} order by toCal";
    //$sql = "select * from ".$xoopsDB->prefix("tad_web_news")." where 1 $andWebID $andNewsKind order by toCal";
    //die($sql);
    $result = $xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
    $i = 0;
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $out_sn , $inspector_name , $out_date , $location , $job , $job_content
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        $toCal = userTimeToServerTime(strtotime($toCal));
        $myEvents[$i]['id'] = $NewsID;
        $myEvents[$i]['title'] = $NewsTitle;
        $myEvents[$i]['rel'] = XOOPS_URL . "/modules/tad_web/{$NewsKind}.php?WebID={$WebID}&NewsID={$NewsID}";
        $myEvents[$i]['start'] = $toCal;
        $myEvents[$i]['allDay'] = true;
        $myEvents[$i]['className'] = "fc-event";
        $i++;
    }
    return json_encode($myEvents);
}
Exemple #3
0
function get_event_num()
{
    global $xoopsDB, $xoopsUser;
    //取得目前使用者可讀的群組
    $ok_cate_arr = chk_tad_cal_cate_power('enable_group');
    $all_ok_cate = implode(",", $ok_cate_arr);
    $and_ok_cate = empty($all_ok_cate) ? "and cate_sn='0'" : "and cate_sn in({$all_ok_cate})";
    $and_ok_cate2 = empty($all_ok_cate) ? "and a.sn='0'" : "and b.cate_sn in({$all_ok_cate})";
    $even_start = date("Y-m-d H:i", $_REQUEST['start'] / 1000);
    $even_end = $_REQUEST['end'] == "0000-00-00 00:00" ? "" : date("Y-m-d H:i", $_REQUEST['end'] / 1000);
    //抓出事件
    $sql = "select * from " . $xoopsDB->prefix("tad_cal_event") . " where `start` >= '{$even_start}' and `end` <= '{$even_end}' {$and_ok_cate} order by `start` , `sequence`";
    //die($sql);
    $result = $xoopsDB->query($sql) or web_error($sql);
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        if (!empty($recurrence)) {
            continue;
        }
        $startTime = strtotime($start);
        $key = date('Y-m-d', $startTime);
        $event_arr[$key]++;
        $Time_arr[$key] = userTimeToServerTime($startTime);
    }
    //抓出重複事件
    $sql = "select a.*,b.title,b.cate_sn from " . $xoopsDB->prefix("tad_cal_repeat") . " as a join " . $xoopsDB->prefix("tad_cal_event") . " as b on a.sn=b.sn where a.`start` >= '{$even_start}' and a.`end` <= '{$even_end}' {$and_ok_cate2} order by a.`start`";
    //die($sql);
    $result = $xoopsDB->queryF($sql) or web_error($sql);
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        $startTime = strtotime($start);
        $key = date('Y-m-d', $startTime);
        $event_arr[$key]++;
        $Time_arr[$key] = userTimeToServerTime($startTime);
    }
    $i = 0;
    foreach ($event_arr as $start => $title) {
        $myEvents[$i]['id'] = $i;
        $myEvents[$i]['title'] = "{$title}";
        $myEvents[$i]['start'] = $Time_arr[$start];
        $myEvents[$i]['allDay'] = 1;
        $myEvents[$i]['className'] = "blockevent";
        $i++;
    }
    return json_encode($myEvents);
}
Exemple #4
0
function eguide_dlimit_condition($eid, $exid)
{
    global $xoopsDB, $xoopsUser, $xoopsConfig;
    // check reservation count
    $uid = $xoopsUser->getVar('uid');
    $res = $xoopsDB->query("SELECT IF(exdate, exdate, edate) edate FROM " . EGTBL . " LEFT JOIN " . EXTBL . " ON eid=eidref AND exid={$exid} WHERE eid={$eid}");
    list($edate) = $xoopsDB->fetchRow($res);
    // start of day calc in default time zone
    list($y, $m, $d) = explode('-', eventdate($edate, 'Y-m-d', $xoopsConfig['default_TZ']));
    $bound = eguide_form_options('bound_time', '00:00');
    list($hour, $min) = explode(':', $bound);
    $start = userTimeToServerTime(mktime($hour, $min, 0, $m, $d, $y), $xoopsConfig['default_TZ']);
    $last = $start + 24 * 3600 - 1;
    /* +1day */
    $res = $xoopsDB->query("SELECT count(rvid) FROM " . RVTBL . " r LEFT JOIN " . EGTBL . " e ON r.eid=e.eid LEFT JOIN " . EXTBL . " x ON r.eid=x.eidref AND x.exid=r.exid WHERE r.uid={$uid} AND IF(exdate, exdate, edate) BETWEEN {$start} AND {$last}");
    list($count) = $xoopsDB->fetchRow($res);
    return $count;
}
         if (preg_match('/^(\\d+)[-\\/](\\d\\d?)[-\\/](\\d\\d?)$/', $date, $d)) {
             $yy = $d[1];
             $mm = $d[2];
             $dd = $d[3];
         } else {
             $errors[] = "{$v} - " . _MD_DATE_ERR;
             continue;
         }
         if (preg_match('/^(\\d\\d?):(\\d\\d?)/', $time, $d)) {
             $hour = $d[1];
             $min = $d[2];
         } else {
             $hour = $defh;
             $min = $defi;
         }
         $tm = userTimeToServerTime(mktime($hour, $min, 0, $mm, $dd, $yy), $xoopsUser->getVar("timezone_offset"));
         if ($tm >= $edate && $tm > $now) {
             $xoopsDB->query('INSERT INTO ' . EXTBL . "(eidref,exdate)VALUES({$eid},{$tm})");
             $exid = $xoopsDB->getInsertID();
             $updated .= sprintf("(id:%s) %s [new %s]\n", "{$eid}-{$exid}", _MD_EXTENT_DATE, formatTimestamp($tm, _MD_POSTED_FMT));
             $chg++;
         } else {
             $errors[] = "{$v} - " . _MD_DATE_ERR;
         }
     }
 }
 if ($chg) {
     $extents = get_extents($eid, true);
     $xoopsDB->query('UPDATE ' . EGTBL . " SET ldate=0 WHERE eid={$eid}");
     $res = $xoopsDB->query('SELECT * FROM ' . EGTBL . " WHERE eid={$eid}");
     $data = $xoopsDB->fetchArray($res);
Exemple #6
0
 function getEventYear($year, $cat = 0)
 {
     $user = $GLOBALS['xoopsUser'];
     $userStartTime = mktime(0, 0, 0, 1, 1, $year);
     $userEndTime = mktime(23, 59, 59, 12, 31, $year);
     $yearStart = userTimeToServerTime($userStartTime, $this->_extcalTime->_getUserTimeZone($user));
     $yearEnd = userTimeToServerTime($userEndTime, $this->_extcalTime->_getUserTimeZone($user));
     $criteriaCompo = $this->_getListCriteriaCompo($yearStart, $yearEnd, $cat, $user);
     $criteriaCompo->setOrder($this->_extcalConfig['sort_order']);
     return $this->getObjects($criteriaCompo);
 }
Exemple #7
0
	$submit_button = new XoopsFormButton("", "poll_submit", _AM_RESTART, "submit");
	$poll_form->addElement($submit_button);
	xoops_cp_header();
	echo "<h4>"._AM_POLLCONF."</h4>";
	$poll_form->display();
	xoops_cp_footer();
	exit();
}

if ( $op == "restart_ok" ) {
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header('index.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
    }
	$poll = new XoopsPoll($poll_id);
	if ( !empty($end_time) ) {
		$end_time = userTimeToServerTime(strtotime($end_time), $xoopsUser->timezone());
		$poll->setVar("end_time", $end_time);
	} else {
		$poll->setVar("end_time", time() + (86400 * 10));
	}
	if ( $notify == 1 && $end_time > time() ) {
		// if notify, set mail status to "not mailed"
		$poll->setVar("mail_status", POLL_NOTMAILED);
	} else {
		// if not notify, set mail status to already "mailed"
		$poll->setVar("mail_status", POLL_MAILED);
	}
	if ( $reset == 1 ) {
		// reset all logs
		XoopsPollLog::deleteByPollId($poll->getVar("poll_id"));
		XoopsPollOption::resetCountByPollId($poll->getVar("poll_id"));
Exemple #8
0
    $poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id"));
    $poll_form->addElement($poll_id_hidden);
    $submit_button = new XoopsFormButton("", "poll_submit", _MD_POLL_RESTART, "submit");
    $poll_form->addElement($submit_button);
    //include XOOPS_ROOT_PATH."/header.php";
    echo "<h4>" . _MD_POLL_POLLCONF . "</h4>";
    $poll_form->display();
    //include XOOPS_ROOT_PATH."/footer.php";
    //exit();
}
if ($op == "restart_ok") {
    $poll = new XoopsPoll($poll_id);
    $end_time = empty($_POST['end_time']) ? "" : $_POST['end_time'];
    if (!empty($end_time)) {
        $timezone = is_object($xoopsUser) ? $xoopsUser->timezone() : null;
        $poll->setVar("end_time", userTimeToServerTime(strtotime($end_time), $timezone));
    } else {
        $poll->setVar("end_time", time() + 86400 * 10);
    }
    if (!empty($_POST["notify"]) && $end_time > time()) {
        // if notify, set mail status to "not mailed"
        $poll->setVar("mail_status", POLL_NOTMAILED);
    } else {
        // if not notify, set mail status to already "mailed"
        $poll->setVar("mail_status", POLL_MAILED);
    }
    if (!empty($_POST["reset"])) {
        // reset all logs
        XoopsPollLog::deleteByPollId($poll->getVar("poll_id"));
        XoopsPollOption::resetCountByPollId($poll->getVar("poll_id"));
    }
# Logtick main page
# $Id: editlog.php,v 1.2 2008/03/22 05:34:39 nobu Exp $
include '../../mainfile.php';
include 'functions.php';
if (!is_object($xoopsUser)) {
    redirect_header('index.php', 3, _NOPERM);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
$logid = intval($_GET['logid']);
if (isset($_POST['store'])) {
    $logid = intval($_POST['logid']);
    $values = array();
    $values[] = 'comment=' . $xoopsDB->quoteString(trim($myts->stripSlashesGPC($_POST['comment'])));
    $values[] = 'pcat=' . intval($_POST['catid']);
    $values[] = 'mtime=' . userTimeToServerTime(strtotime($_POST['mdate']));
    $values[] = 'lspan=' . span2sec($myts->stripSlashesGPC($_POST['span']));
    $res = $xoopsDB->query("UPDATE " . TLOG . " SET " . join(',', $values) . " WHERE logid=" . $logid);
    echo $xoopsDB->error();
    redirect_header('index.php', 1, _MD_LOGTICK_STORED);
    exit;
} else {
    if (isset($_POST['delete'])) {
        $logid = intval($_POST['logid']);
        $res = $xoopsDB->query("DELETE FROM " . TLOG . " WHERE logid={$logid}");
        redirect_header('index.php', 1, _MD_LOGTICK_DELETED);
        exit;
    }
}
include XOOPS_ROOT_PATH . '/header.php';
$xoopsOption['template_main'] = 'logtick_editlog.html';
Exemple #10
0
        $stime = userTimeToServerTime(mktime(0, 0, 0, $ym[1] - 1, 1, $ym[0]));
        $ym = explode('-', formatTimestamp(time(), 'Y-m'));
        $ltime = userTimeToServerTime(mktime(0, 0, 0, $ym[1], 1, $ym[0]) - 1);
        $cond .= " AND ctime BETWEEN {$stime} AND {$ltime}";
        break;
    case 'y0':
        // start this year
        $ym = explode('-', formatTimestamp(time(), 'Y-m'));
        $stime = userTimeToServerTime(mktime(0, 0, 0, 1, 1, $ym[0]));
        $cond .= " AND ctime>{$stime}";
        break;
    case 'y1':
        $ym = explode('-', formatTimestamp(time(), 'Y-m'));
        $stime = userTimeToServerTime(mktime(0, 0, 0, 1, 1, $ym[0] - 1));
        $ym = explode('-', formatTimestamp(time(), 'Y-m'));
        $ltime = userTimeToServerTime(mktime(0, 0, 0, 1, 1, $ym[0]) - 1);
        $cond .= " AND ctime BETWEEN {$stime} AND {$ltime}";
        break;
    default:
        $range = "all";
        break;
}
$res = $xoopsDB->query('SELECT * FROM ' . CCMES . " WHERE {$cond} ORDER BY msgid");
$items = get_form_attribute($form['defs']);
$labels = array('ID', _MD_POSTDATE, _CC_STATUS, _MD_CONTACT_FROM, _MD_CONTACT_TO);
$n = $mpos = -1;
foreach ($items as $item) {
    if (empty($item['label'])) {
        continue;
    }
    // skip comment
Exemple #11
0
function get_event()
{
    global $xoopsDB, $xoopsUser, $xoopsModuleConfig;
    $cate_sn = intval($_REQUEST['cate_sn']);
    //取得目前使用者可讀的群組
    $ok_cate_arr = chk_tad_cal_cate_power('enable_group');
    $all_ok_cate = implode(",", $ok_cate_arr);
    $and_ok_cate = empty($all_ok_cate) ? "and cate_sn='0'" : "and cate_sn in({$all_ok_cate})";
    $and_ok_cate2 = empty($all_ok_cate) ? "and a.sn='0'" : "and b.cate_sn in({$all_ok_cate})";
    $even_start = date("Y-m-d H:i", $_REQUEST['start'] / 1000);
    $even_end = $_REQUEST['end'] == "0000-00-00 00:00" ? "" : date("Y-m-d H:i", $_REQUEST['end'] / 1000);
    $and_cate_sn = empty($cate_sn) ? "" : "and `cate_sn` = '{$cate_sn}'";
    $and_cate_sn2 = empty($cate_sn) ? "" : "and b.`cate_sn` = '{$cate_sn}'";
    //抓出事件
    $sql = "select * from " . $xoopsDB->prefix("tad_cal_event") . " where `start` >= '{$even_start}' and `end` <= '{$even_end}' {$and_ok_cate} {$and_cate_sn} order by `start` , `sequence`";
    //die($sql);
    $result = $xoopsDB->query($sql) or web_error($sql);
    $i = 0;
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        if (!empty($recurrence)) {
            continue;
        }
        $allDay = $allday == '1' ? true : false;
        //正確顯示行事曆事件條
        $startTime = userTimeToServerTime(strtotime($start));
        $endTime = userTimeToServerTime(strtotime($end));
        if (empty($endTime)) {
            $endTime = $startTime + 86400;
        }
        //計算應顯示數字用
        $day = ceil(($endTime - $startTime) / 86400);
        if (empty($day)) {
            $day = 1;
        }
        $start = date('Y-m-d H:i', $startTime);
        $end = date('Y-m-d H:i', $endTime);
        if ($allDay) {
            $endTime = strtotime($end) - 86400;
        }
        //避免截掉半個中文字
        $title_num = $xoopsModuleConfig['title_num'] * 3 * $day;
        $event_title = xoops_substr(strip_tags($title), 0, $title_num);
        $myEvents[$i]['id'] = $sn;
        $myEvents[$i]['title'] = "{$event_title}";
        //$myEvents[$i]['url']="event.php?sn=$sn";
        $myEvents[$i]['rel'] = XOOPS_URL . "/modules/tad_cal/event.php?op=view&sn={$sn}";
        $myEvents[$i]['start'] = $startTime;
        if (!empty($end)) {
            $myEvents[$i]['end'] = $endTime;
        }
        $myEvents[$i]['allDay'] = $allDay;
        $myEvents[$i]['className'] = "my{$cate_sn}";
        $i++;
    }
    //抓出重複事件
    $sql = "select a.*,b.title,b.cate_sn from " . $xoopsDB->prefix("tad_cal_repeat") . " as a join " . $xoopsDB->prefix("tad_cal_event") . " as b on a.sn=b.sn where a.`start` >= '{$even_start}' and a.`end` <= '{$even_end}' {$and_ok_cate2} {$and_cate_sn2} order by a.`start`";
    //die($sql);
    $result = $xoopsDB->queryF($sql) or web_error($sql);
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        $allDay = $allday == '1' ? true : false;
        //正確顯示行事曆事件條
        $DBstartTime = strtotime($start);
        $startTime = userTimeToServerTime(strtotime($start));
        $endTime = userTimeToServerTime(strtotime($end));
        if (empty($endTime)) {
            $endTime = $startTime + 86400;
        }
        //計算應顯示數字用
        $day = ceil(($endTime - $startTime) / 86400);
        if (empty($day)) {
            $day = 1;
        }
        $start = date('Y-m-d H:i', $startTime);
        $end = date('Y-m-d H:i', $endTime);
        if ($allDay) {
            $endTime = strtotime($end) - 86400;
        }
        //避免截掉半個中文字
        $title_num = $xoopsModuleConfig['title_num'] * 3 * $day;
        //if(empty($title_num))$title_num=21;
        $event_title = xoops_substr(strip_tags($title), 0, $title_num);
        $myEvents[$i]['id'] = $sn;
        $myEvents[$i]['title'] = "* {$event_title}";
        //$myEvents[$i]['url']="event.php?sn=$sn&stamp=$startTime";
        $myEvents[$i]['rel'] = XOOPS_URL . "/modules/tad_cal/event.php?op=view&sn={$sn}&stamp={$DBstartTime}";
        $myEvents[$i]['start'] = $startTime;
        if (!empty($end)) {
            $myEvents[$i]['end'] = $endTime;
        }
        $myEvents[$i]['allDay'] = $allDay;
        $myEvents[$i]['className'] = "my{$cate_sn}";
        $i++;
    }
    return json_encode($myEvents);
}
Exemple #12
0
function getDateField($p)
{
    global $xoopsUser;
    if (empty($_POST["{$p}ymd"])) {
        return 0;
    }
    list($y, $m, $d) = split('-', $_POST["{$p}ymd"]);
    if (isset($_POST["{$p}time"])) {
        // accept 'HH:mm' format
        list($hour, $min) = split(':', $_POST["{$p}time"]);
    } else {
        $hour = $_POST["{$p}hour"];
        $min = $_POST["{$p}min"];
    }
    return userTimeToServerTime(mktime($hour, $min, 0, $m, $d, $y), $xoopsUser->getVar("timezone_offset"));
}
Exemple #13
0
    $op_hidden = new XoopsFormHidden("op", "restart_ok");
    $poll_form->addElement($op_hidden);
    $poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id"));
    $poll_form->addElement($poll_id_hidden);
    $submit_button = new XoopsFormButton("", "poll_submit", _AM_RESTART, "submit");
    $poll_form->addElement($submit_button);
    xoops_cp_header();
    echo "<h4>" . _AM_POLLCONF . "</h4>";
    $poll_form->display();
    xoops_cp_footer();
    exit;
}
if ($op == "restart_ok") {
    $poll = new XoopsPoll($_POST['poll_id']);
    if (!empty($_POST['end_time'])) {
        $end_time = userTimeToServerTime(strtotime($_POST['end_time']), $xoopsUser->timezone());
        $poll->setVar("end_time", $end_time);
    } else {
        $poll->setVar("end_time", time() + 86400 * 10);
    }
    if ($_POST['notify'] == 1 && $end_time > time()) {
        // if notify, set mail status to "not mailed"
        $poll->setVar("mail_status", POLL_NOTMAILED);
    } else {
        // if not notify, set mail status to already "mailed"
        $poll->setVar("mail_status", POLL_MAILED);
    }
    if ($_POST['reset'] == 1) {
        // reset all logs
        XoopsPollLog::deleteByPollId($poll->getVar("poll_id"));
        XoopsPollOption::resetCountByPollId($poll->getVar("poll_id"));