⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.php

📁 一个函数
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php
function returnbuyver( )
{
    $phome_digod_buyversion = "FreeEcms";
    return $phome_digod_buyversion;
}

function getfiletype( $filename )
{
    $filer = explode( ".", $filename );
    $count = count( $filer ) - 1;
    return strtolower( ".".$filer[$count] );
}

function sub( $Modi_Str, $start, $length, $mode = false )
{
    $n = 0;
    $i = 0;
    for ( ; $i < $start; ++$i )
    {
        if ( 160 < ord( substr( $Modi_Str, $i, 1 ) ) )
        {
            if ( $mode )
            {
                ++$start;
                ++$i;
            }
            ++$n;
        }
    }
    if ( !$mode )
    {
        $start = $start + $n % 2;
    }
    $The_length = $start + $length;
    $i = $start;
    for ( ; $i < $The_length; ++$i )
    {
        if ( 160 < ord( substr( $Modi_Str, $i, 1 ) ) )
        {
            $The_Str .= substr( $Modi_Str, $i, 2 );
            ++$i;
            if ( $mode )
            {
                ++$The_length;
            }
        }
        else
        {
            $The_Str .= substr( $Modi_Str, $i, 1 );
        }
    }
    return $The_Str;
}

function make_password( $pw_length )
{
    $low_ascii_bound = 50;
    $upper_ascii_bound = 122;
    $notuse = array( 58, 59, 60, 61, 62, 63, 64, 73, 79, 91, 92, 93, 94, 95, 96, 108, 111 );
    while ( $i < $pw_length )
    {
        mt_srand( ( double )microtime( ) * 1000000 );
        $randnum = mt_rand( $low_ascii_bound, $upper_ascii_bound );
        if ( !in_array( $randnum, $notuse ) )
        {
            $password1 = $password1.chr( $randnum );
            ++$i;
        }
    }
    return $password1;
}

function no_make_password( $pw_length )
{
    $low_ascii_bound = 48;
    $upper_ascii_bound = 57;
    $notuse = array( 58, 59, 60, 61, 62, 63, 64, 73, 79, 91, 92, 93, 94, 95, 96, 108, 111 );
    while ( $i < $pw_length )
    {
        mt_srand( ( double )microtime( ) * 1000000 );
        $randnum = mt_rand( $low_ascii_bound, $upper_ascii_bound );
        if ( !in_array( $randnum, $notuse ) )
        {
            $password1 = $password1.chr( $randnum );
            ++$i;
        }
    }
    return $password1;
}

function page1( $num, $line, $page_line, $start, $page, $search )
{
    global $fun_r;
    $pagetotal = $line * $page_line;
    $total = ceil( ( $num - $start ) / $line );
    $total_start = ceil( $num / $pagetotal );
    $returnstr = $fun_r[totalrecord]."&nbsp;".$num."&nbsp;".$fun_r[totalrecorde]."&nbsp;&nbsp;";
    $PHP_SELF = $_SERVER['PHP_SELF'];
    if ( $start != 0 )
    {
        $old_start = $start - $pagetotal;
        $returnstr .= "&nbsp;&nbsp;<a href=".$PHP_SELF."?page=0&start=".$old_start.$search." title='UP".$page_line."Pages'><font face=webdings>7</font></a>";
    }
    $pagestart = $start / $pagetotal * $page_line;
    $i = 0;
    for ( ; $i < $total && $i < $page_line; ++$i )
    {
        if ( $page == $i )
        {
            $is_1 = "<b>[";
            $is_2 = "]</b>";
        }
        else
        {
            $is_1 = "<a href=".$PHP_SELF."?page=".$i."&start=".$start.$search.">";
            $is_2 = "</a>";
        }
        $pagenum = $pagestart + $i + 1;
        $returnstr .= "&nbsp;&nbsp;".$is_1.$pagenum.$is_2;
    }
    if ( $total_start != $start / $pagetotal + 1 && $num != 0 )
    {
        $new_start = $start + $pagetotal;
        $returnstr .= "&nbsp;&nbsp;<a href=".$PHP_SELF."?page=0&start=".$new_start.$search." title='Next".$page_line."Pages'><font face=webdings>8</font></a>";
    }
    return $returnstr;
}

function postpage( $num, $line, $page_line, $start, $page, $form )
{
    global $fun_r;
    $pagetotal = $line * $page_line;
    $total = ceil( ( $num - $start ) / $line );
    $total_start = ceil( $num / $pagetotal );
    $returnstr = $fun_r[totalrecord]."&nbsp;".$num."&nbsp;".$fun_r[totalrecorde]."&nbsp;&nbsp;";
    if ( $start != 0 )
    {
        $old_start = $start - $pagetotal;
        $returnstr .= "&nbsp;&nbsp;<a href='#ecms' onclick='javascript:GotoPostPage(0,{$old_start});' title='UP".$page_line."Pages'><font face=webdings>7</font></a>";
    }
    $pagestart = $start / $pagetotal * $page_line;
    $i = 0;
    for ( ; $i < $total && $i < $page_line; ++$i )
    {
        if ( $page == $i )
        {
            $is_1 = "<b>[";
            $is_2 = "]</b>";
        }
        else
        {
            $is_1 = "<a href='#ecms' onclick='javascript:GotoPostPage({$i},{$start});'>";
            $is_2 = "</a>";
        }
        $pagenum = $pagestart + $i + 1;
        $returnstr .= "&nbsp;&nbsp;".$is_1.$pagenum.$is_2;
    }
    if ( $total_start != $start / $pagetotal + 1 && $num != 0 )
    {
        $new_start = $start + $pagetotal;
        $returnstr .= "&nbsp;&nbsp;<a href='#ecms' onclick='javascript:GotoPostPage(0,{$new_start});' title='Next".$page_line."Pages'><font face=webdings>8</font></a>";
    }
    $returnstr .= "<script>\r\n\tfunction GotoPostPage(page,start){\r\n\t\t".$form.".page.value=page;\r\n\t\t".$form.".start.value=start;\r\n\t\t".$form.".submit();\r\n\t}\r\n\t</script>";
    return $returnstr;
}

function delfiletext( $filename )
{
    @unlink( $filename );
}

function getmodtable( $mid )
{
    global $empire;
    global $dbtbpre;
    $r = $empire->fetch1( "select tid,tbname from {$dbtbpre}enewsmod where mid='{$mid}'" );
    return $r;
}

function addzt( $add, $userid, $username )
{
    global $empire;
    global $class_r;
    global $dbtbpre;
    if ( !$add[ztname] || !$add[listtempid] || !$add[ztpath] )
    {
        printerror( "EmptyZt", "history.go(-1)" );
    }
    checklevel( $userid, $username, $classid, "zt" );
    if ( empty( $add[zttype] ) )
    {
        $add[zttype] = ".html";
    }
    if ( file_exists( "../../s/".$add[ztpath] ) )
    {
        printerror( "ReZtpath", "history.go(-1)" );
    }
    $createpath = "../../s/".$add[ztpath];
    $mk = domkdir( $createpath );
    if ( $mk )
    {
        domkdir( $createpath."/js" );
    }
    $zcid = ( integer )$add['zcid'];
    $jstempid = ( integer )$add['jstempid'];
    if ( empty( $add[ztnum] ) )
    {
        $add[ztnum] = 25;
    }
    $indextext = addslashes( repphpaspjspcode( $add[indextext] ) );
    $add[intro] = addslashes( repphpaspjspcode( $add[intro] ) );
    $add[ztpagekey] = addslashes( repphpaspjspcode( $add[ztpagekey] ) );
    $tabler = getmodtable( getlisttempmid( $add[listtempid] ) );
    $add[ztnum] = ( integer )$add[ztnum];
    $add[listtempid] = ( integer )$add[listtempid];
    $add[newline] = ( integer )$add[newline];
    $add[newstrlen] = ( integer )$add[newstrlen];
    $add[newshowdate] = ( integer )$add[newshowdate];
    $add[hotline] = ( integer )$add[hotline];
    $add[hotstrlen] = ( integer )$add[hotstrlen];
    $add[hotshowdate] = ( integer )$add[hotshowdate];
    $add[goodline] = ( integer )$add[goodline];
    $add[goodshowdate] = ( integer )$add[goodshowdate];
    $add[goodstrlen] = ( integer )$add[goodstrlen];
    $add[classid] = ( integer )$add[classid];
    $add[hotplline] = ( integer )$add[hotplline];
    $add[hotplshowdate] = ( integer )$add[hotplshowdate];
    $add[hotplstrlen] = ( integer )$add[hotplstrlen];
    $add[firstline] = ( integer )$add[firstline];
    $add[firststrlen] = ( integer )$add[firststrlen];
    $add[firstshowdate] = ( integer )$add[firstshowdate];
    $add[islist] = ( integer )$add[islist];
    $add[maxnum] = ( integer )$add[maxnum];
    $tabler[tid] = ( integer )$tabler[tid];
    $showzt = ( integer )$add[showzt];
    $sql = $empire->query( "insert into {$dbtbpre}enewszt(ztname,ztnum,listtempid,onclick,ztpath,zttype,newline,newstrlen,newshowdate,zturl,hotline,hotstrlen,hotshowdate,goodline,goodshowdate,goodstrlen,classid,hotplline,hotplshowdate,hotplstrlen,firstline,firststrlen,firstshowdate,indextext,islist,maxnum,tid,tbname,reorderf,reorder,intro,ztimg,zcid,jstempid,showzt,ztpagekey) values('{$add['ztname']}',{$add['ztnum']},{$add['listtempid']},0,'{$add['ztpath']}','{$add['zttype']}',{$add['newline']},{$add['newstrlen']},{$add['newshowdate']},'{$add['zturl']}',{$add['hotline']},{$add['hotstrlen']},{$add['hotshowdate']},{$add['goodline']},{$add['goodshowdate']},{$add['goodstrlen']},{$add['classid']},{$add['hotplline']},{$add['hotplshowdate']},{$add['hotplstrlen']},{$add['firstline']},{$add['firststrlen']},{$add['firstshowdate']},'{$indextext}',{$add['islist']},{$add['maxnum']},{$tabler['tid']},'{$tabler['tbname']}','{$add['reorderf']}','{$add['reorder']}','{$add['intro']}','{$add['ztimg']}',{$zcid},{$jstempid},{$showzt},'{$add['ztpagekey']}');" );
    $ztid = $empire->lastid( );
    if ( !$add[islist] )
    {
        newsbq( $ztid, $indextext, 3, 1 );
    }
    getclass( );
    if ( $sql )
    {
        insert_dolog( "ztid=".$ztid."<br>ztname=".$ztname );
        printerror( "AddZtSuccess", "AddZt.php?enews=AddZt" );
    }
    else
    {
        printerror( "DbError", "history.go(-1)" );
    }
}

function editzt( $add, $userid, $username )
{
    global $empire;
    global $class_r;
    global $dbtbpre;
    $add[ztid] = ( integer )$add[ztid];
    if ( !$add[ztname] || !$add[listtempid] || !$add[ztpath] || !$add[ztid] )
    {
        printerror( "EmptyZt", "history.go(-1)" );
    }
    checklevel( $userid, $username, $classid, "zt" );
    if ( empty( $add[zttype] ) )
    {
        $add[zttype] = ".html";
    }
    if ( $add[oldztpath] != $add[ztpath] )
    {
        if ( file_exists( "../../s/".$add[ztpath] ) )
        {
            printerror( "ReZtpath", "history.go(-1)" );
        }
        $new = "../../s/";
        @rename( $new.$add[oldztpath], $new.$add[ztpath] );
    }
    if ( empty( $add[ztnum] ) )
    {
        $add[ztnum] = 25;
    }
    $zcid = ( integer )$add['zcid'];
    $jstempid = ( integer )$add['jstempid'];
    $indextext = addslashes( repphpaspjspcode( $add[indextext] ) );
    $add[intro] = addslashes( repphpaspjspcode( $add[intro] ) );
    $add[ztpagekey] = addslashes( repphpaspjspcode( $add[ztpagekey] ) );
    $tabler = getmodtable( getlisttempmid( $add[listtempid] ) );
    $add[ztnum] = ( integer )$add[ztnum];
    $add[listtempid] = ( integer )$add[listtempid];
    $add[newline] = ( integer )$add[newline];
    $add[newstrlen] = ( integer )$add[newstrlen];
    $add[newshowdate] = ( integer )$add[newshowdate];
    $add[hotline] = ( integer )$add[hotline];
    $add[hotstrlen] = ( integer )$add[hotstrlen];
    $add[hotshowdate] = ( integer )$add[hotshowdate];
    $add[goodline] = ( integer )$add[goodline];
    $add[goodshowdate] = ( integer )$add[goodshowdate];
    $add[goodstrlen] = ( integer )$add[goodstrlen];
    $add[classid] = ( integer )$add[classid];
    $add[hotplline] = ( integer )$add[hotplline];
    $add[hotplshowdate] = ( integer )$add[hotplshowdate];
    $add[hotplstrlen] = ( integer )$add[hotplstrlen];
    $add[firstline] = ( integer )$add[firstline];
    $add[firststrlen] = ( integer )$add[firststrlen];
    $add[firstshowdate] = ( integer )$add[firstshowdate];
    $add[islist] = ( integer )$add[islist];
    $add[maxnum] = ( integer )$add[maxnum];
    $tabler[tid] = ( integer )$tabler[tid];
    $showzt = ( integer )$add[showzt];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -