Example #1
0
 public function showDBValue(&$data, $keylink)
 {
     $result = "";
     if (IsDateFieldType($this->fieldType)) {
         $result = str_format_time(db2time($data[$this->field]));
     } else {
         $numbers = parsenumbers($data[$this->field]);
         if (!count($numbers)) {
             return "";
         }
         while (count($numbers) < 3) {
             $numbers[] = 0;
         }
         $result = str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
     }
     return $this->checkForEncoding($result, $keylink);
 }
 /**
  * @param &Array data
  * @return String	 
  */
 public function getTextValue(&$data)
 {
     $result = "";
     if (IsDateFieldType($this->fieldType)) {
         return str_format_time(db2time($data[$this->field]));
     }
     $numbers = parsenumbers($data[$this->field]);
     if (!count($numbers)) {
         return "";
     }
     while (count($numbers) < 3) {
         $numbers[] = 0;
     }
     if (count($numbers) == 6) {
         return str_format_time(array(0, 0, 0, $numbers[3], $numbers[4], $numbers[5]));
     }
     // sometimes data is datetime
     return str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
 }
function format_time($time)
{
    return str_format_time($time);
}
Example #4
0
     $DMC->query($sql);
     settings_recount("logs");
     //更新Cache
     hottags_recache();
     categories_recache();
     settings_recache();
     recentLogs_recache();
     archives_recache();
     calendar_recache();
     logsTitle_recache();
     logs_sidebar_recache($arrSideModule);
 }
 //edit date
 if ($_POST['operation'] == "editdate" and $stritem != "") {
     if ($_POST['pubTime'] != "") {
         $pubtime = str_format_time($_POST['pubTime']);
         $sql = "update " . $DBPrefix . "logs set postTime='{$pubtime}' where {$stritem}";
         $DMC->query($sql);
     }
 }
 //置顶展開
 if ($_POST['operation'] == "topopen" and $stritem != "") {
     $sql = "update " . $DBPrefix . "logs set isTop='1' where {$stritem}";
     $DMC->query($sql);
 }
 //置顶隱藏
 if ($_POST['operation'] == "topclose" and $stritem != "") {
     $sql = "update " . $DBPrefix . "logs set isTop='2' where {$stritem}";
     $DMC->query($sql);
 }
 //取消置顶
Example #5
0
$tags = trim($_POST['tags']);
$edittype = $_REQUEST['edittype'];
if ($_POST['addpassword'] != "" && strlen($_POST['addpassword']) < 15) {
    $addpassword = md5($_POST['addpassword']);
} else {
    $addpassword = $_POST['addpassword'];
}
//检测输入内容为空
if ($logTitle == "" or $logContent == "" or $cateId == "") {
    $ActionMessage = $strErrNull;
    $check_info = 0;
}
if ($check_info == 1) {
    //$logContent=encode($logContent);
    $logTitle = encode($logTitle);
    $postTime = $pubTimeType == "now" ? time() : str_format_time($pubTime);
    $author = $_SESSION['username'];
    //如果是ubb编辑器
    if ($logsediter == "ubb") {
        if (empty($_POST['allowhtml'])) {
            $logContent = ubblogencode($logContent);
        } else {
            $logContent = str_replace("\r", "", $logContent);
            $logContent = str_replace("\n", "", $logContent);
            //$logContent=mysql_escape_string($logContent);
            $logContent = str_replace("'", "&#39;", $logContent);
        }
    } else {
        //$logContent=mysql_escape_string($logContent);
        $logContent = str_replace("'", "&#39;", $logContent);
    }
Example #6
0
function searchSQL($job, $seekname)
{
    global $DMC, $DBPrefix, $settingInfo;
    $searchSql = "";
    if ($seekname == "") {
        $job = "";
    } else {
        $seekname = str_replace("&amp;", "&", @urldecode($seekname));
    }
    switch ($job) {
        case "category":
            $searchSql = "";
            $sql = "select id from " . $DBPrefix . "categories where parent='{$seekname}' or id='{$seekname}'";
            if ($result = $DMC->fetchQueryAll($DMC->query($sql))) {
                $cateSql = "";
                foreach ($result as $key => $value) {
                    if (empty($cateSql)) {
                        $cateSql = "cateId='{$value['id']}'";
                    } else {
                        $cateSql .= " or cateId='{$value['id']}'";
                    }
                }
                $searchSql = $key > 0 ? " and ({$cateSql})" : " and {$cateSql}";
            }
            break;
        case "private":
            $searchSql = " and saveType=3";
            break;
        case "tags":
            $searchSql = " and concat(';',a.tags,';') like '%;{$seekname};%'";
            break;
        case "calendar":
            //与archives查找代一样。
        //与archives查找代一样。
        case "archives":
            $curYear = substr($seekname, 0, 4);
            $curMonth = substr($seekname, 4, 2);
            $curDay = substr($seekname, 6, 2);
            if ($curDay > 0) {
                $start = str_format_time($curYear . '-' . $curMonth . '-' . $curDay . " 00:00");
                $end = str_format_time($curYear . '-' . $curMonth . '-' . $curDay . " 23:59");
            } elseif ($curMonth > 0) {
                $start = str_format_time($curYear . '-' . $curMonth . '-01 00:00');
                $maxDay = gmdate("t", $start + $settingInfo['timezone'] * 3600);
                $end = str_format_time($curYear . '-' . $curMonth . '-' . $maxDay . " 23:59");
            } else {
                $start = str_format_time($curYear . '-01-01 00:00');
                $end = str_format_time($curYear . '-12-31 23:59');
            }
            $searchSql = " and a.postTime>='{$start}' and a.postTime<='{$end}'";
            break;
        case "searchTitle":
            $searchSql = " and (a.logTitle like '%{$seekname}%')";
            break;
        case "searchContent":
            $searchSql = " and (a.logContent like '%{$seekname}%')";
            break;
        case "searchAll":
            $searchSql = " and (a.logTitle like '%{$seekname}%' or a.logContent like '%{$seekname}%')";
            break;
        default:
            $searchSql = "";
            break;
    }
    //echo $searchSql;
    return $searchSql;
}
Example #7
0
function getFormattedValue($pageObject, $value, $fieldName, $strViewFormat, $strEditFormat = '', $mode = MODE_LIST)
{
    if ($strViewFormat == FORMAT_TIME && is_numeric($value)) {
        $val = '';
        $d = intval($value / 86400);
        $h = intval($value % 86400 / 3600);
        $m = intval($value % 86400 % 3600 / 60);
        $s = $value % 86400 % 3600 % 60;
        $val .= $d > 0 ? $d . 'd ' : '';
        $val .= str_format_time(array(0, 0, 0, $h, $m, $s));
    } else {
        $arrValue = array($fieldName => $value);
        $val = $pageObject->getViewControl($fieldName, $strViewFormat)->showDBValue($arrValue, "");
    }
    return $val;
}
Example #8
0
function get_other_test()
{
    global $_G;
    pload('F:spider');
    $url = format_url($_GET['url']);
    $args['from_get_type'] = format_url($_GET['from_get_type']);
    $args['author_get_type'] = format_url($_GET['author_get_type']);
    $args['dateline_get_type'] = format_url($_GET['dateline_get_type']);
    $args['from_get_rules'] = format_url($_GET['from_get_rules']);
    $args['author_get_rules'] = format_url($_GET['author_get_rules']);
    $args['dateline_get_rules'] = format_url($_GET['dateline_get_rules']);
    $login_cookie = format_cookie($_GET['login_cookie']);
    $contents = get_contents($url, array('cookie' => $login_cookie));
    $data = get_other_info($contents, $args);
    $show_time = str_format_time($data['article_dateline']);
    $show_time = $show_time ? dgmdate($show_time) : '';
    if (!$data) {
        $output = milu_lang('no_get_info');
    } else {
        $output = '<table class="tb tb2 "><tbody><tr class="header"><th width="51">' . milu_lang('field_name') . '</th><th width="220">' . milu_lang('the_get_info') . '</th><th width="80">' . milu_lang('trun_info') . '</th></tr>
		
		<tr class="td24"><td class="td25">' . milu_lang('article_from') . '</td><td class="td24">' . $data['from'] . '</td><td>' . milu_lang('no_turn') . '</td></tr>
		<tr class="td24"><td class="td25">' . milu_lang('old_author') . '</td><td class="td24">' . $data['author'] . '</td><td>' . milu_lang('no_turn') . '</td></tr>
		<tr class="td24"><td class="td25">' . milu_lang('public_time') . '</td><td class="td24">' . $data['article_dateline'] . '</td><td>' . $show_time . '</td></tr>
		
		</tr></tbody></table>';
        if ($args['dateline_get_rules']) {
            $output .= milu_lang('get_other_notice');
        }
    }
    show_pick_window(milu_lang('get_other_show'), $output, array('w' => 645, 'h' => '460', 'f' => 1));
}
Example #9
0
        $cateId = $arr_result['id'];
    } else {
        $sql = "INSERT INTO " . $DBPrefix . "categories(parent,name,orderNo,cateTitle,outLinkUrl,cateCount,isHidden) VALUES ('0','BlogBus','1','BlogBus','','" . count($logTitle) . "','0')";
        $DMC->query($sql);
        $cateId = $DMC->insertId();
    }
    $error = 0;
    $success = 0;
    $i = 0;
    foreach ($logTitle as $key => $value) {
        $i = $key + 1;
        echo "正在汇入第{$i} 条日志 ... ";
        $sql = "INSERT INTO " . $DBPrefix . "logs(cateId,logTitle,logContent,author,quoteUrl,postTime,isComment,isTrackback,isTop,weather,saveType,tags,password,logsediter) VALUES ('{$cateId}','{$logTitle[$key]}','{$logContent[$key]}','{$author[$key]}','{$quoteUrl[$key]}','{$postTime[$key]}','{$isComment[$key]}','{$isTrackback[$key]}','0','sunny','{$saveType[$key]}','{$tags[$key]}','','tiny')";
        $DMC->query($sql);
        if ($DMC->error()) {
            $error++;
            echo $DMC->error() . "<br>";
        } else {
            $logsId = $DMC->insertId();
            //增加评论
            foreach ($arr_comments[$key] as $subkey => $subvalue) {
                $subvalue['CommentText'] = encode(strip_tags($subvalue['CommentText']), "<br>");
                $comm_sql = "insert into " . $DBPrefix . "comments(author,password,logId,ip,content,postTime,isSecret,parent) values('" . $subvalue['NiceName'] . "','','" . $logsId . "','" . $subvalue['PostIP'] . "','" . $subvalue['CommentText'] . "','" . str_format_time($subvalue['CreateTime']) . "','0','0')";
                $DMC->query($comm_sql);
            }
            $success++;
            echo "<font color=red>OK</font><br>";
        }
    }
    echo "<br>共有{$i} 条日志,成功汇入{$success} 条,失败{$error} 条";
}
function GetDataInt($value, $data, $field, $format)
{
    global $strTableName;
    if ($format == FORMAT_CUSTOM && $data) {
        return CustomExpression($value, $data, $field, "");
    }
    $ret = "";
    // long binary data?
    if (IsBinaryType(GetFieldType($field))) {
        $ret = mlang_message("LONG_BINARY");
    } else {
        $ret = $value;
    }
    if ($ret === false) {
        $ret = "";
    }
    if ($format == FORMAT_DATE_SHORT) {
        $ret = format_shortdate(db2time($value));
    } else {
        if ($format == FORMAT_DATE_LONG) {
            $ret = format_longdate(db2time($value));
        } else {
            if ($format == FORMAT_DATE_TIME) {
                $ret = str_format_datetime(db2time($value));
            } else {
                if ($format == FORMAT_TIME) {
                    if (IsDateFieldType(GetFieldType($field))) {
                        $ret = str_format_time(db2time($value));
                    } else {
                        $numbers = parsenumbers($value);
                        if (!count($numbers)) {
                            return "";
                        }
                        while (count($numbers) < 3) {
                            $numbers[] = 0;
                        }
                        $ret = str_format_time(array(0, 0, 0, $numbers[0], $numbers[1], $numbers[2]));
                    }
                } else {
                    if ($format == FORMAT_NUMBER) {
                        $ret = str_format_number($value, GetFieldData($strTableName, $field, "DecimalDigits", false));
                    } else {
                        if ($format == FORMAT_CURRENCY) {
                            $ret = str_format_currency($value);
                        } else {
                            if ($format == FORMAT_CHECKBOX) {
                                $ret = "<img src=\"images/check_";
                                if ($value && $value != 0) {
                                    $ret .= "yes";
                                } else {
                                    $ret .= "no";
                                }
                                $ret .= ".gif\" border=0";
                                if (isEnableSection508()) {
                                    $ret .= " alt=\" \"";
                                }
                                $ret .= ">";
                            } else {
                                if ($format == FORMAT_PERCENT) {
                                    if ($value != "") {
                                        $ret = $value * 100 . "%";
                                    }
                                } else {
                                    if ($format == FORMAT_PHONE_NUMBER) {
                                        if (strlen($ret) == 7) {
                                            $ret = substr($ret, 0, 3) . "-" . substr($ret, 3);
                                        } else {
                                            if (strlen($ret) == 10) {
                                                $ret = "(" . substr($ret, 0, 3) . ") " . substr($ret, 3, 3) . "-" . substr($ret, 6);
                                            }
                                        }
                                    } else {
                                        if ($format == FORMAT_FILE_IMAGE) {
                                            if (!CheckImageExtension($ret)) {
                                                return "";
                                            }
                                            $thumbnailed = false;
                                            $thumbprefix = "";
                                            if ($thumbnailed) {
                                                // show thumbnail
                                                $thumbname = $thumbprefix . $ret;
                                                if (substr(GetLinkPrefix($field), 0, 7) != "http://" && !myfile_exists(getabspath(GetLinkPrefix($field) . $thumbname))) {
                                                    $thumbname = $ret;
                                                }
                                                $ret = "<a target=_blank href=\"" . htmlspecialchars(AddLinkPrefix($field, $ret)) . "\">";
                                                $ret .= "<img";
                                                if (isEnableSection508()) {
                                                    $ret .= " alt=\"" . htmlspecialchars($data[$field]) . "\"";
                                                }
                                                $ret .= " border=0";
                                                $ret .= " src=\"" . htmlspecialchars(AddLinkPrefix($field, $thumbname)) . "\"></a>";
                                            } else {
                                                if (isEnableSection508()) {
                                                    $ret = '<img alt=\\"".htmlspecialchars($data[$field])."\\" src="' . AddLinkPrefix($field, $ret) . '" border=0>';
                                                } else {
                                                    $ret = '<img src="' . htmlspecialchars(AddLinkPrefix($field, $ret)) . '" border=0>';
                                                }
                                            }
                                        } else {
                                            if ($format == FORMAT_HYPERLINK) {
                                                if ($data) {
                                                    $ret = GetHyperlink($ret, $field, $data);
                                                }
                                            } else {
                                                if ($format == FORMAT_EMAILHYPERLINK) {
                                                    $link = $ret;
                                                    $title = $ret;
                                                    if (substr($ret, 0, 7) == "mailto:") {
                                                        $title = substr($ret, 8);
                                                    } else {
                                                        $link = "mailto:" . $link;
                                                    }
                                                    $ret = '<a href="' . $link . '">' . $title . '</a>';
                                                } else {
                                                    if ($format == FORMAT_FILE) {
                                                        $iquery = "table=" . GetTableURL($strTableName) . "&field=" . rawurlencode($field);
                                                        $arrKeys = GetTableKeys($strTableName);
                                                        $keylink = "";
                                                        for ($j = 0; $j < count($arrKeys); $j++) {
                                                            $keylink .= "&key" . ($j + 1) . "=" . rawurlencode($data[$arrKeys[$j]]);
                                                        }
                                                        $iquery .= $keylink;
                                                        return '<a href="download.php?' . $iquery . '">' . htmlspecialchars($ret) . '</a>';
                                                    } else {
                                                        if (GetEditFormat($field) == EDIT_FORMAT_CHECKBOX && $format == FORMAT_NONE) {
                                                            if ($ret && $ret != 0) {
                                                                $ret = mlang_message("YES");
                                                            } else {
                                                                $ret = mlang_message("NO");
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $ret;
}
function pjtime_convert($time)
{
    if (strpos($time, "下午")) {
        $time = str_replace("下午 ", "", $time);
        $mktime = strtotime($time) + 12 * 3600;
    } elseif (strpos($time, "上午")) {
        $time = str_replace("上午 ", "", $time);
        $mktime = strtotime($time);
    } elseif (preg_match("/AM/is", $time)) {
        $time = preg_replace("/AM /is", "", $time);
        $mktime = strtotime($time);
    } elseif (preg_match("/PM/is", $time)) {
        $time = preg_replace("/PM /is", "", $time);
        $mktime = strtotime($time) + 12 * 3600;
    } else {
        $mktime = strtotime($time);
    }
    $pjtime = gmdate("Y-m-d H:i:s", $mktime);
    return str_format_time($pjtime);
}
 /**
  * Get the full caption value for the slider with the 'seconds' step type
  * @param Array dateArray
  * @return String
  */
 protected function getSecondsCaption($dateArray)
 {
     return str_format_time($dateArray);
 }
function getFormattedValue($value, $fieldName, $strViewFormat, $strEditFormat = '', $mode = MODE_LIST)
{
    if ($strViewFormat == FORMAT_TIME && is_numeric($value)) {
        $val = '';
        $d = intval($value / 86400);
        $h = intval($value % 86400 / 3600);
        $m = intval($value % 86400 % 3600 / 60);
        $s = $value % 86400 % 3600 % 60;
        $val .= $d > 0 ? $d . 'd ' : '';
        $val .= str_format_time(array(0, 0, 0, $h, $m, $s));
    } else {
        if ($strEditFormat == EDIT_FORMAT_LOOKUP_WIZARD || $strEditFormat == EDIT_FORMAT_RADIO) {
            $val = DisplayLookupWizard($fieldName, $value, null, '', $mode);
        } else {
            $val = GetDataInt($value, array($fieldName => $value), $fieldName, $strViewFormat);
        }
    }
    return $val;
}
Example #14
0
 function get_article_other($contents)
 {
     if ($this->p_arr['is_get_other'] != 1) {
         return array();
     }
     $data = (array) get_other_info($contents, $this->p_arr);
     $data['article_dateline'] = str_format_time($data['article_dateline']);
     return $data;
 }