コード例 #1
0
function RefreshZwave2($node, $name)
{
    global $domoticzurl;
    $zwaveurl = $domoticzurl . 'ozwcp/refreshpost.html';
    $zwavedata = array('fun' => 'racp', 'node' => $node);
    $zwaveoptions = array('http' => array('header' => 'Content-Type: application/x-www-form-urlencoded\\r\\n', 'method' => 'POST', 'content' => http_build_query($zwavedata)));
    $zwavecontext = stream_context_create($zwaveoptions);
    for ($k = 1; $k <= 5; $k++) {
        sleep(1);
        $result = file_get_contents($zwaveurl, false, $zwavecontext);
        logwrite('RefreshZwave node ' . $node . ' ' . $name . ' ' . $result);
        if ($result == 'OK') {
            break;
        }
        sleep(1);
    }
}
コード例 #2
0
ファイル: wx.php プロジェクト: snamper/xiaoshuhaochi
 public function responseMsg()
 {
     if ($this->checkSignature()) {
         //get post data, May be due to the different environments
         $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
         //extract post data
         if (!empty($postStr)) {
             logwrite('postStr:' . $postStr);
             $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
             $fromUsername = $postObj->FromUserName;
             $toUsername = $postObj->ToUserName;
             $keyword = trim($postObj->Content);
             $time = time();
             //  logwrite('myclass:'.$postObj->MsgType);
             $condo = trim($postObj->MsgType);
             if (ISSHOP != 0) {
                 include hopedir . "wx/wx_b_shop.php";
                 $this->wxback = new wx_b_shop($postObj, ISSHOP);
             } else {
                 include hopedir . "wx/wx_b.php";
                 $this->wxback = new wx_b($postObj);
             }
             call_user_func(array($this->wxback, $condo));
             exit;
             $textTpl = "<xml>\n\t\t\t\t\t\t\t<ToUserName><![CDATA[%s]]></ToUserName>\n\t\t\t\t\t\t\t<FromUserName><![CDATA[%s]]></FromUserName>\n\t\t\t\t\t\t\t<CreateTime>%s</CreateTime>\n\t\t\t\t\t\t\t<MsgType><![CDATA[%s]]></MsgType>\n\t\t\t\t\t\t\t<Content><![CDATA[%s]]></Content>\n\t\t\t\t\t\t\t<FuncFlag>0</FuncFlag>\n\t\t\t\t\t\t\t</xml>";
             if (!empty($keyword)) {
                 $msgType = "text";
                 $contentStr = "Welcome to wechat world!";
                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                 echo $resultStr;
             } else {
                 echo "Input something...";
             }
         } else {
             echo "";
             exit;
         }
     }
     echo '';
     exit;
 }
コード例 #3
0
ファイル: notify_url.php プロジェクト: snamper/xiaoshuhaochi
    $info = mysql_query("SELECT * from `" . $cfg['tablepre'] . "onlinelog` where id = " . $invoice . " ");
    $backinfog = mysql_fetch_assoc($info);
    if (!empty($backinfog)) {
        if ($backinfog['status'] == 0 && $backinfog['cost'] == $mc_gross) {
            if ($backinfog['type'] == 'order') {
                //更新此状态为1
                //更新订单
                mysql_query("UPDATE  `" . $cfg['tablepre'] . "onlinelog` SET  `status` =  1 where `id`=" . $invoice . " ");
                mysql_query("UPDATE  `" . $cfg['tablepre'] . "order` SET  `paystatus` =  1 where `id`=" . $backinfog['upid'] . "");
            } elseif ($backinfog['type'] == 'acount') {
                mysql_query("UPDATE  `" . $cfg['tablepre'] . "onlinelog` SET  `status` =  1 where `id`=" . $invoice . " ");
                mysql_query("UPDATE  `" . $cfg['tablepre'] . "member` SET  `cost` =  `cost`+" . $backinfog['cost'] . " where `uid`=" . $backinfog['upid'] . "");
                $info = mysql_query("SELECT * from `" . $cfg['tablepre'] . "member` where uid = " . $backinfog['upid'] . " ");
                $memberinfo = mysql_fetch_assoc($info);
                $dotime = time();
                mysql_query("INSERT INTO `" . $cfg['tablepre'] . "memberlog` (`id` ,`userid` ,`type` ,`addtype` ,`result` ,`addtime` ,`content` ,`title` ,`acount` )VALUES (NULL , '" . $memberinfo['uid'] . "', '2', '1', '" . $backinfog['cost'] . "', '" . $dotime . "', '在线充值', '使用支付宝在线充值" . $backinfog['cost'] . "元', '" . $memberinfo['cost'] . "');");
            }
            logwrite('支付成功' . $txn_id);
        } else {
            logwrite('金额不一致,返回ID' . $txn_id);
        }
    } else {
        logwrite('获取待支付ID失败,返回ID' . $txn_id);
    }
    mysql_close($lnk);
} else {
    if (strcmp($res, "INVALID") == 0) {
        // log for manual investigation
        logwrite('支付失败');
    }
}
コード例 #4
0
ファイル: function.php プロジェクト: snamper/xiaoshuhaochi
function error($type, $msg)
{
    if ($type == 'sql') {
        logwrite($msg);
    }
}
コード例 #5
0
ファイル: onsen.php プロジェクト: bee7813993/save_webradio
function downloadfiles($url, $filename)
{
    global $errormsg;
    $fp = fopen($filename, "w");
    if ($fp == false) {
        print "file open failed :{$filename}";
        return false;
    }
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $ret = curl_exec($ch);
    if ($ret == true) {
        logwrite("Success download : {$filename} url : {$url}");
    } else {
        logwrite("Download failed  : {$filename} url : {$url}" . curl_error($ch));
        $errormsg = curl_error($ch);
    }
    curl_close($ch);
    fclose($fp);
}
コード例 #6
0
            die('Unable to connect to database [' . $db->connect_error . ']');
        }
        $buiten = $_REQUEST['buiten'];
        $living = $_REQUEST['living'];
        $badkamer = $_REQUEST['badkamer'];
        $kamer = $_REQUEST['kamer'];
        $tobi = $_REQUEST['tobi'];
        $alex = $_REQUEST['alex'];
        $zolder = $_REQUEST['zolder'];
        $query = "INSERT INTO `temp` (`stamp`,`buiten`,`living`,`badkamer`,`kamer`,`tobi`,`alex`,`zolder`) VALUES ('{$stamp}','{$buiten}','{$living}','{$badkamer}','{$kamer}','{$tobi}','{$alex}','{$zolder}');";
        if (!($result = $db->query($query))) {
            die('There was an error running the query [' . $query . ' - ' . $db->error . ']');
        }
        $db->close();
    } elseif (isset($_REQUEST['value']) && isset($_REQUEST['table'])) {
        logwrite($_REQUEST['device'], $_REQUEST['value'], $_REQUEST['table']);
    }
}
function logwrite($device, $value, $table)
{
    $time = microtime(true);
    $dFormat = "Y-m-d H:i:s";
    $mSecs = $time - floor($time);
    $mSecs = substr(number_format($mSecs, 3), 1);
    $stamp = sprintf("%s%s", date($dFormat), $mSecs);
    $db = new mysqli('localhost', 'kodi', 'kodi', 'domotica');
    if ($db->connect_errno > 0) {
        die('Unable to connect to database [' . $db->connect_error . ']');
    }
    $query = "INSERT INTO `{$table}` (`stamp`,`device`,`value`) VALUES ('{$stamp}','{$device}','{$value}');";
    if (!($result = $db->query($query))) {
コード例 #7
0
ファイル: admin.php プロジェクト: serj-43/db-script
function testcfgs()
{
    global $sd, $pr, $mycol, $mycols, $ADM, $tbl;
    global $gmheader, $gmplevel, $prauth, $prauthcnt;
    global $dbheader, $dbplevel, $prdbdata, $prdbdatacnt;
    global $edheader, $edplevel, $edcontent, $edcnt;
    global $dnheader, $dnplevel, $dncontent, $dncnt;
    global $pgheader, $pgplevel, $pgcontent, $pgcnt;
    global $stheader, $stplevel, $stcontent, $stcnt;
    global $lsheader, $lsplevel, $lscontent, $lscnt;
    global $filheader, $filplevel, $fildata, $filcount;
    $error = 0;
    $war = 0;
    $fixed = 0;
    //счетчик ошибок
    #inside func
    $mserror = "<red>==></red>";
    $mswar = "<yel>==></yel>";
    $msfixed = "<grn>==></grn>";
    echo "---------------------------<br>";
    // проверка dbdata.cfg
    $tbl = 1;
    $edit = 0;
    // edit - флаг запуска записи
    $silent = 0;
    global $silent;
    while ($tbl < $prdbdatacnt - 1) {
        $exist = 1;
        if ($prdbdata[$tbl][12] != "fdb") {
            $code = readdescripters();
            $fixmsg = $code[7];
            $warnmsg = $code[8];
            if (strlen($fixmsg) > 15) {
                echo "{$msfixed} " . $fixmsg;
                $fixed++;
            }
            if (strlen($warnmsg) > 15) {
                echo "{$mswarn} " . $warnmsg;
                $warn++;
            }
            if ($code == -1) {
                echo "{$mserror} SQL " . cmsg(A_T_DB) . " " . $prdbdata[$tbl][0], " " . cmsg(NOREP) . "<br>";
                $exist = 0;
                $error++;
                $errortables[] = $prdbdata[$tbl];
                //continue;//added cont  for test
            }
        }
        if ($prdbdata[$tbl][12] == "fdb") {
            global $mzcnt;
            //		$filbas=$prdbdata[$tbl][0];
            $mycols = 0;
            $code = readdescripters();
            $fixmsg = $code[7];
            $warnmsg = $code[8];
            if (strlen($fixmsg) > 15) {
                echo "{$msfixed} " . $fixmsg;
                $fixed++;
            }
            if (strlen($warnmsg) > 15) {
                echo "{$mswarn} " . $warnmsg;
                $warn++;
            }
            if ($code == -1) {
                echo "{$mserror} DAT  " . cmsg(A_T_DB) . " " . $prdbdata[$tbl][0] . " " . cmsg(NOREP) . "<br>";
                $error++;
                //$tbl++; именно эта параша всё сбивала.
                $errortables[] = $prdbdata[$tbl];
                //continue; remove as tes
            }
            $mycols = $mzcnt;
            $mycolsreal = $code[6];
        }
        // К этому моменту  уже должны быть базы обновлены
        if ($prdbdata[$tbl][12] == "1") {
            echo "{$msfixed} " . cmsg(TB) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_UDBT) . " -sql-<br>";
            $prdbdata[$tbl][12] = "mysql";
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][12] === false or $prdbdata[$tbl][12] === "0") {
            echo "{$msfixed}  " . cmsg(TB) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_UDBT) . " -fdb-<br>";
            $prdbdata[$tbl][12] = "fdb";
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][9] == "" and $prdbdata[$tbl][12] == "mysql") {
            echo "{$msfixed} " . cmsg(TB) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_NC_DEF) . " <br>";
            $prdbdata[$tbl][9] = "default";
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][5] == "" and $prdbdata[$tbl][1] !== "") {
            echo "{$msfixed} " . cmsg(A_SF_NAMTBL) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_CPY_MIRR) . "<br>";
            $prdbdata[$tbl][5] = $prdbdata[$tbl][1];
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][1] == "" and $prdbdata[$tbl][5] !== "") {
            echo "{$msfixed} " . cmsg(A_SF_NAMMIRR) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_CPY_NAMTBL) . "<br>";
            $prdbdata[$tbl][1] = $prdbdata[$tbl][5];
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][0] == "" and $prdbdata[$tbl][1] !== "") {
            echo "{$msfixed} " . cmsg(A_SF_NOFLNM) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_CPY_MIRR2) . "<br>";
            $prdbdata[$tbl][0] = $prdbdata[$tbl][5];
            $fixed++;
            $edit = 1;
        }
        if ($prdbdata[$tbl][15] == $prdbdata[$tbl][11] and $prdbdata[$tbl][15] !== "") {
            $prdbdata[$tbl][15]++;
            echo "{$msfixed} " . $prdbdata[$tbl][1] . " " . cmsg("ID!=") . " " . $prdbdata[$tbl][15] . " <br>";
            $fixed++;
            $edit = 1;
        }
        if ($exist == 1) {
            if ($prdbdata[$tbl][14] == "" or $prdbdata[$tbl][14] < 0) {
                echo "{$msfixed} " . cmsg(A_R_TB) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_DEF) . "<br>";
                $prdbdata[$tbl][14] = 0;
                $fixed++;
                $edit = 1;
            }
            if ($prdbdata[$tbl][13] < $prdbdata[$tbl][14]) {
                $prdbdata[$tbl][13] = $prdbdata[$tbl][14] + 1;
                echo "{$msfixed}  " . cmsg(A_R_TB) . cmsg(T_WR) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_R_RW_ERR) . cmsg(FIXED) . "<br>";
                $fixed++;
                $edit = 1;
            }
            $writerights = $prdbdata[$tbl][13];
            if ($writerights !== "d") {
                settype($writerights, "integer");
                if ($writerights == "") {
                    $prdbdata[$tbl][13] = $prdbdata[$tbl][14] + 1;
                    echo "{$msfixed} " . cmsg(A_R_TB) . cmsg(T_WR) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_R_RW_ERR) . cmsg(FIXED) . "<br>";
                    $fixed++;
                    $edit = 1;
                }
            }
            if ($prdbdata[$tbl][10] > $mycols) {
                echo "{$mserror} " . cmsg(A_T_FROW1) . $prdbdata[$tbl][10] . ") ( " . cmsg(ITB) . " " . $prdbdata[$tbl][1] . cmsg(A_MCOLS) . "{$mycols} <br>";
                $error++;
            }
            if ($prdbdata[$tbl][11] > $mycols) {
                echo "{$mserror}  " . cmsg(A_T_CROW1) . $prdbdata[$tbl][11] . ") ( " . cmsg(ITB) . " " . $prdbdata[$tbl][1] . cmsg(A_MCOLS) . "{$mycols} <br>";
                $error++;
            }
            if ($prdbdata[$tbl][4] > $mycols) {
                echo "{$mserror}  " . cmsg(A_T_CGROW1) . $prdbdata[$tbl][4] . ") ( " . cmsg(ITB) . " " . $prdbdata[$tbl][1] . cmsg(A_MCOLS) . "{$mycols} <br>";
                $error++;
            }
            if ($prdbdata[$tbl][8] > $mycols) {
                echo "{$mswar}  " . cmsg(A_T_SCROW1) . $prdbdata[$tbl][8] . ")  " . cmsg(ITB) . " " . $prdbdata[$tbl][1] . cmsg(A_MCOLS) . "{$mycols} <br>";
                $warn++;
            }
            if ($prdbdata[$tbl][8] !== false and $prdbdata[$tbl][3] === false) {
                echo "{$mswar} " . cmsg(A_T_SCRPRS) . $prdbdata[$tbl][8] . ") " . cmsg(ITB) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_F_EMP) . "<br>";
                $war++;
            }
            $fields = count($prdbdata[$tbl]);
            if ($fields < 199) {
                //echo
                echo "{$mswar} Registered table " . $prdbdata[$tbl][1] . " have " . $fields . " header fields but must have 202 , requires run update350.php or manual fix <br>";
                $warn++;
                /*
                	$fixadd="";
                for ($a1=$fields-2;$a1++;$a1<202) {//$fixadd.="¦";// echo $a1." ";
                	$prdbdata[$tbl][$a1]="0";
                if ($a1==202) { if ($OSTYPE=="LINUX") $prdbdata[$tbl][$a1].="\n"; //  исправление соединения строк
                				if ($OSTYPE=="WINDOWS") $prdbdata[$tbl][$a1].="\r\n";
                				break;
                }
                
                //die ("a1==202 !!!!!!!!!!!!!!!!!!!!!"); возможно добавление WINDOWS вызовет баг - не проверено
                //$ax++; if ($ax>700) { echo "a1=$a1; ax=$ax; fixadd=$fixadd";exit;}
                } // F*****G SHsIT   ВИСНЕТ"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                */
            }
            //исправляем если конфиг слишком короткий. не знаю в чем дело - но автоисправление длины алиаса почему то не пашет как надо
            //
            //$plinkname=$data[12];
            //.//...$exist=0;// чезахерня?
        }
        //end EXIST list
        //ho "prb ".$prdbdata[$tbl][17]." M<br>";
        //Временно отключено после расширения глючть не будет   writefullcsv вызывает ошибку если нет \n
        if (count($prdbdata[$tbl]) > 40) {
            $a = $prdbdata[$tbl][17];
            //echo "ept 17=$a<br>";
            if (strlen(trim($a)) < 2 or $a === " ") {
                $ungroup = 1;
            }
            if (strlen(trim($a)) > 1) {
                $ungroup = 0;
            }
            if ($ungroup == 1 and $prdbdata[$tbl][12] == "mysql" and $prdbdata[$tbl][9] == true) {
                echo "{$msfixed} " . cmsg(A_SF_GRP_TBL) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_NO) . " (" . $prdbdata[$tbl][17] . cmsg(A_DEF_GRP) . $prdbdata[$tbl][9] . ")<br>";
                $prdbdata[$tbl][17] = $prdbdata[$tbl][9];
                $fixed++;
                $edit = 1;
                $ungroup = 0;
            }
            //CFG OPT FUTURE  TODO:  отключаемое 2 реж 1-база может отличатся от 2-база вс=базе.
            if ($pr[38]) {
                if ($prdbdata[$tbl][12] == "mysql" and $prdbdata[$tbl][9] !== $prdbdata[$tbl][17]) {
                    echo "{$msfixed} " . cmsg(A_SF_GRP_TBL) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_GRP_DECL) . " " . $prdbdata[$tbl][17] . ")-->(" . $prdbdata[$tbl][9] . ")<br>";
                    $prdbdata[$tbl][17] = $prdbdata[$tbl][9];
                    $fixed++;
                    $edit = 1;
                    $ungroup = 0;
                }
            }
            if ($ungroup == 1 and $prdbdata[$tbl][12] == "fdb") {
                echo "{$msfixed} " . cmsg(A_SF_GRP_TBL) . " " . $prdbdata[$tbl][1] . " " . cmsg(A_SF_NO) . " (" . $prdbdata[$tbl][17] . cmsg(A_DEF_GRP) . "fdb)<br>";
                $prdbdata[$tbl][17] = "fdb";
                $fixed++;
                $edit = 1;
                $ungroup = 0;
            }
            //CFG OPT FUTURE  TODO:  отключаемое 2 реж 1-база может отличатся от 2-база вс=базе.AS Mysql
        }
        //*/$prdbdata[$tbl][18]="\n"; поможе если все таки достигнули крайнее число колонок.
        $tbl++;
    }
    echo "<br>" . cmsg(A_SF_ALLDB) . ($prdbdatacnt - 2) . "<br>---------------------------------------<br>";
    ##проверка на факт редактирования должна быть обязательно везде - незачем постоянно делать сохранения.
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/dbdata.cfg", "w", 1));
        writefullcsv($tempdescr, $dbheader, $dbplevel, $prdbdata);
        $edit = 0;
        fclose($tempdescr);
    }
    unset($tempdescr, $dbheader, $dbplevel, $prdbdata);
    // проверкa gmdata.cfg
    // CFG OPT FUTURE  TODO:   СОЗДАНИЕ ПАПОК ПОЛЬЗОВАТЕЛЕЙ И ФАЙЛА ПО УМОЛЧАНИЮ -  В ЗАВИС ОТ ИНСТАНЦИИ ПО ТИПУ _DATA .. САП
    $cnt = 1;
    $admins = 0;
    $users = 0;
    while ($cnt < $prauthcnt) {
        if (strlen($prauth[$cnt][1]) < 32 and $prauth[$cnt][0] == true) {
            echo "{$msfixed} " . cmsg(A_SF_U_NOCYPH) . $prauth[$cnt][0] . " " . cmsg(A_SF_U_CYHP) . "<br>";
            $fixed++;
            $edit = 1;
            $prauth[$cnt][1] = hashgen($prauth[$cnt][1]);
        }
        if ($prauth[$cnt][1][0] !== "!" and $prauth[$cnt][0] == true) {
            echo "{$mswar} " . cmsg(A_SF_U_NOCYPH) . " " . $prauth[$cnt][0] . " " . cmsg(A_OLD_ENC) . "<br>";
            $war++;
        }
        $su = $su + $prauth[$cnt][42];
        $admins = $admins + $prauth[$cnt][2];
        $a = $prauth[$cnt][10];
        if ($a) {
            $users = $users + 1;
        }
        $cnt++;
    }
    echo "<br>" . cmsg(A_SU) . " {$su} " . cmsg(A_T_ADMFRUSR) . " {$admins} " . cmsg(A_IZ) . " {$users} " . cmsg(A_USRS) . ".<br>---------------------------------------<br>";
    ###rewrite cfg### :)))
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/gmdata.cfg", "w", 1));
        writefullcsv($tempdescr, $gmheader, $gmplevel, $prauth);
        $edit = 0;
        fclose($tempdescr);
    }
    unset($tempdescr, $gmheader, $gmplevel, $prauth);
    /*
    
    // проверка editor.cfg  files.cfg ???
      $cnt=1;
      while ($cnt<$edcnt) {
      $cnt++;
       if (($edcontent[$cnt][0]!=="")AND($edcontent[$cnt][1]=="")) {echo "$mswar ".cmsg (A_T_EDAT)." $cnt (".$edcontent[$cnt][0]." (".$prdbdata[$edcontent[$cnt][0]][0].")) ".cmsg (A_T_EDATEMP)."<br>";$war++;}
     } echo "<br> ".cmsg (A_T_EDCFGS)." ".($edcnt-2)."<br>---------------------------------------<br>";
    
    
       ###rewrite cfg### :)))
     if ($edit==1) {
    	 @$tempdescr=csvopen ("_conf/editor.cfg","w",1);
       writefullcsv ($tempdescr,$edheader,$edplevel,$edcontent);$edit=0;
     }
     unset ($tempdescr,$edheader,$edplevel,$edcontent);
    */
    // проверка pages.cfg
    $cnt = 1;
    while ($cnt < $pgcnt) {
        //if ($cnt>10) { echo "Страница $cnt (".$pgcontent[$cnt][1].") не может быть обслужена из за встроенных ограничений.<br>"; $war++;}
        if ($pgcontent[$cnt][1] === "") {
            echo "{$mserror}  " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") " . cmsg(A_T_PGNOCONN) . ".<br>";
            $error++;
        }
        if (strpos($pgcontent[$cnt][1], "readfile.php") !== false) {
            echo "{$msfixed} " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") up to 3.5.18+.<br>";
            $pgcontent[$cnt][1] = str_replace("readfile.php", "r.php", $pgcontent[$cnt][1]);
            $fixed++;
            $edit = 1;
        }
        if (strpos($pgcontent[$cnt][1], "edit.php") !== false) {
            echo "{$msfixed} " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") up to 3.6.1+.<br>";
            $pgcontent[$cnt][1] = str_replace("edit.php", "login.php", $pgcontent[$cnt][1]);
            $fixed++;
            $edit = 1;
        }
        if (strpos($pgcontent[$cnt][1], "writefile.php") !== false) {
            echo "{$msfixed}  " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") up to 3.5.18+.<br>";
            $pgcontent[$cnt][1] = str_replace("writefile.php", "w.php", $pgcontent[$cnt][1]);
            $fixed++;
            $edit = 1;
        }
        if ($pgcontent[$cnt][3] === "") {
            echo "{$mswar}  " . cmsg(A_PAGE) . "{$cnt} (" . $pgcontent[$cnt][1] . ") " . cmsg(A_T_PGNOHDR) . ".<br>";
            $war++;
        }
        if ($pgcontent[$cnt][6] > 0 and $pgcontent[$cnt][7] < 4) {
            echo "{$mswar}  " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") " . cmsg(A_T_PGUPTM) . $dbc[7] . "<br>";
            $war++;
        }
        if ($pgcontent[$cnt][4] == 1 and $pgcontent[$cnt][2] == false) {
            echo "{$mserror} " . cmsg(A_PAGE) . " {$cnt} (" . $pgcontent[$cnt][1] . ") " . cmsg(A_T_PGRDR) . ".<br>";
            $error++;
        }
        $cnt++;
    }
    echo "<br>" . cmsg(A_T_ALLPG) . ($pgcnt - 2) . "<br>---------------------------------------<br>";
    ###rewrite cfg### :)))
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/pages.cfg", "w", 1));
        writefullcsv($tempdescr, $pgheader, $pgplevel, $pgcontent);
        $edit = 0;
    }
    unset($tempdescr, $pgheader, $pgplevel, $pgcontent);
    // проверка denywords.cfg
    $cnt = 1;
    while ($cnt < $dncnt) {
        if (strlen($dncontent[$cnt][0]) < 4) {
            echo "{$mswar} Длина слова (" . $dncontent[$cnt][0] . ") мала =" . strlen($dncontent[$cnt][0]) . ", это может вызвать ошибки <br>";
            $warn++;
        }
        $cnt++;
    }
    echo "<br>" . cmsg(A_DNW_ALL) . " " . ($dncnt - 2) . "<br>---------------------------------------<br>";
    ###rewrite cfg### :)))
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/denywords.cfg", "w", 1));
        writefullcsv($tempdescr, $dnheader, $dnplevel, $dncontent);
        $edit = 0;
        unset($tempdescr, $dnheader, $dnplevel, $dncontent);
    }
    $date = date("d.m.Y H:i:s");
    // текущая дата
    $dateinunix = strdbstounixtime($date);
    // переводим обычную dbs дату в юникс
    // прове files.cfg
    $cnt = 1;
    $edit = 0;
    while ($cnt < $filcount - 1) {
        //echo "filcount mlya $filcount , count fildata-= ".count ($fildata)."<br>";// zaebalo  gde counter?
        if ($debug) {
            echo $fildata[$cnt][4] . "=" . $fildata[$cnt][9] . "<br>";
        }
        // debug
        $downloadedfiles = $downloadedfiles + $fildata[$cnt][9];
        //
        ////if (1==1) { echo "$fildata";};  при удалении сохранять 2 в колонку об удалении
        // Извините, файл найти не удалось -  Возможно файл устарел , перемещён или не соответствует правилам хостинга
        $datarazm = $fildata[$cnt][8];
        $xdataupload = strdbstounixtime($datarazm);
        $dataskac = $fildata[$cnt][10];
        $xdatalastload = strdbstounixtime($dataskac);
        if (is_dir($fildata[$cnt][5])) {
            $fildata[$cnt][6] = 2;
        }
        //папки не имеет смысла пытаться удалять
        //важно после попытки удаления программа более не пытается удалять уже удаленные файлы помечая их флагом 2 в колонке удаления.
        $razn = $dateinunix - $xdatalastload;
        $toomanydays = 1295684 * 2;
        if ($razn > $toomanydays) {
            // echo "File <font color=blue>".$fildata[$cnt][5]."</font> (ID ".$fildata[$cnt][0]." is hosted> 30 days ($datarazm)<br>";//noaction
            // если файл есть уже 30 дней то можно проверять и дату последней скачки если она конечно же есть
            if ($debug) {
                echo "[debug] this file is dara rasm= {$datarazm} ({$xdataupload}) datascac={$dataskac}  ({$xdatalastload}) razn={$razn}<br>";
            }
            $razn2 = $dateinunix - $xdatalastload;
            if (!($fildata[$cnt][6] == 2)) {
                if ($xdatalastload < 1) {
                    echo "File  <blu>" . $fildata[$cnt][5] . "</blu> ни разу не загружался. <br>";
                }
            }
            // затычка
            if ($xdatalastload > 0 and !($fildata[$cnt][6] == 2)) {
                if ($razn2 > $toomanydays) {
                    echo "File <blu>" . $fildata[$cnt][5] . "</blu> (ID " . $fildata[$cnt][0] . " is outdated ({$dataskac})<br>";
                    $enableremove = 1;
                }
                if ($enableremove) {
                    if ($pr[88]) {
                        if (file_exists($fildata[$cnt][5])) {
                            echo "<red>Auto removing outdated file " . $fildata[$cnt][5] . "   !</red><br>";
                            logwrite("A_CHECK:Remove outdated file " . $fildata[$cnt][5]);
                            $fildata[$cnt][6] = 2;
                            $edit = 1;
                            //  знак удаленного файла - не проверяется
                            unlink($fildata[$cnt][5]);
                            $enableremove = 0;
                        }
                    }
                }
            }
        }
        if (!($fildata[$cnt][6] == 2)) {
            if (!file_exists($fildata[$cnt][5])) {
                if ($pr[85]) {
                    echo "{$msfixed} ";
                }
                echo "" . $fildata[$cnt][5] . " " . cmsg("LNK_NOT");
                if ($pr[85]) {
                    echo " " . cmsg("LNK_RMV");
                    $fildata[$cnt] = "";
                    $fixed++;
                    $edit = 1;
                }
                // ЭТОПРАВИЛЬНОЕ УДАЛЕНИЕ!!
                echo "<br>";
            }
        }
        $cnt++;
    }
    echo "<br>" . cmsg(A_FIL_DWN) . ": {$downloadedfiles}<br>";
    echo "<br>" . cmsg(A_FIL_ALL) . " " . (count($fildata) - 2) . "<br>---------------------------------------<br>";
    ###rewrite cfg### :)))
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/files.cfg", "w", 1));
        writefullcsv($tempdescr, $filheader, $filplevel, $fildata);
        $edit = 0;
        unset($tempdescr, $filheader, $filplevel, $fildata);
    }
    //-------------------------------
    //
    //
    //проверкa styles
    $cnt = 1;
    while ($cnt < $stcnt) {
        echo "";
        break;
    }
    echo "<br>" . cmsg(A_STL_ALL) . " " . ($stcnt - 2) . "<br>---------------------------------------<br>";
    //планируется стили подключать  просто как папки
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/styles.cfg", "w", 1));
        writefullcsv($tempdescr, $stheader, $stplevel, $stcontent);
        $edit = 0;
        unset($tempdescr, $stheader, $stplevel, $stcontent);
    }
    // проверка  langset
    $cnt = 1;
    while ($cnt < $lscnt) {
        echo "";
        break;
    }
    echo "<br>" . cmsg(A_LNG_ALL) . " " . ($lscnt - 2) . "<br>---------------------------------------<br>";
    if ($edit == 1) {
        @($tempdescr = csvopen("_conf/langset.cfg", "w", 1));
        writefullcsv($tempdescr, $lsheader, $lsplevel, $lscontent);
        $edit = 0;
        unset($tempdescr, $lsheader, $lsplevel, $lscontent);
    }
    global $vpropcheck;
    if ($vpropcheck > 1.0) {
        $error + 1;
        msgexiterror("cfgnewcrit", "property", "disable");
    }
    if ($vpropcheck < -1.0) {
        $error + 1;
        msgexiterror("cfgoldcrit", "property", "disable");
    }
    if ($vpropcheck > 0.8) {
        $error + 1;
        msgexiterror("cfgnewwarn", "noexit", "disable");
    }
    if ($vpropcheck < -0.8) {
        $error + 1;
        msgexiterror("cfgoldwarn", "noexit", "disable");
    }
    echo "=============================<br>=============================<br>";
    echo "" . cmsg(A_T_ALLERR) . " : " . ($error + $war + $fixed) . "<br>";
    echo "" . cmsg(A_T_FROM) . " :<br>" . cmsg(A_T_CRIT) . " {$error} <br>" . cmsg(A_T_NOCRIT) . " {$war} <br> " . cmsg(A_T_FIXED) . " {$fixed} <br>";
    if ($error + $warn > 0) {
        echo "" . cmsg(A_T_REC) . " ";
    }
    $data = "";
    if ($debug) {
        print_r($errortables);
    }
    if ($errortables) {
        echo "<form action=\"admin.php\"><br>";
        checkbox(0, "yes");
        echo count($errortables);
        for ($a = 0; $a < count($errortables); $a++) {
            $data .= $errortables[$a][0] . ";" . $errortables[$a][1] . "?";
        }
        global $sd;
        if ($sd[19] == "utf-8") {
            $data = iconvx("windows-1251", "utf-8", $data);
        }
        //if ($sd[19]=="utf-8") $data=iconvx("utf-8","windows-1251",$data);
        $data = base64_encode($data);
        $fileforerrtname = "_local" . add_endslash("") . "errt";
        unlink($fileforerrtname);
        $errtfile = fopen($fileforerrtname, "a");
        fwrite($errtfile, $data);
        fclose($errtfile);
        //hidekey ("errt",$data);
        hidekey("count", count($errortables));
        submitkey("write", "ADM_DEL_OFF_TABLES");
        echo "</form>";
        dispref();
    }
}
コード例 #8
0
function deurbel()
{
    global $a, $i;
    if ($a == "On") {
        sw($i['deurbel'], 'Off', 'Deurbel reset');
    }
    logwrite(__FUNCTION__, $a, 'log');
}
コード例 #9
0
ファイル: wx_s.php プロジェクト: snamper/xiaoshuhaochi
 function savemenu($info)
 {
     if ($this->checktoken()) {
         //	$data['body'] = json_encode($info);
         //	echo $str;
         /*
               	   $strpost = json_encode($info);
               	   logwrite($strpost);
               	   $strpost= preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", $strpost);
         */
         logwrite($info);
         $info = $this->vpost('https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $this->access_token, $info);
         $info = json_decode($info, true);
         if (isset($info['errcode'])) {
             if ($info['errcode'] == 0) {
                 return true;
             } else {
                 $this->errId = $info['errcode'];
                 return false;
             }
         }
         $this->errId('-1');
         return false;
     } else {
         return false;
     }
 }
コード例 #10
0
ファイル: filemgr.php プロジェクト: serj-43/db-script
function filemgr($cmd, $stroka, $path, $fileforaction, $mask, $pid)
{
    // is a part filemgr- fileio
    //hidekey ("pid",$pid);
    global $defaultpath, $protect, $prauth, $ADM, $pr, $sd;
    //..,$file
    global $filemgrmod, $daysleft, $codekey, $noscreenmode, $maxmgrs, $OSTYPE, $coreredir;
    global $multiaction, $scriptpath, $scriptpath;
    if ($codekey == 4) {
        needupgrade();
    }
    $file = $fileforaction;
    global $filscheader, $filscdata, $filscplevel, $filsccount, $languageprofile;
    if ($filscdata) {
        if ($filsccount < 1) {
            echo "Filemgr don't have configured scripts<br>";
        } else {
            echo "";
        }
        //additional keys by   filescript.cfg and starting it
        // 4.3.4добавлено: cmsg не отрабатывает теперь значения начинающиеся с точки
        // filescript для генерации кнопок исполнения скриптов ,  заданных администраторами.
        // dbscore - исправлена ошибка из за которой иногда не вычислялся count
        //версия конфигов при создании конфигурации теперь берется из ядра
        //..+++if (!$unauthorized) { //незарегистрированные в любом случае не будут видеть список пользователей ресурса в раздаче.
        // теперь репозитории работать будут раздельно, проприетарная версия будет отличатся только возможностью подключать специальные модули.
        //если вы не планируете их заказывать можно использоватьобычную версию.
        $keylanguage = 1;
        //if not detected;  function detectlanguageidfromheader
        for ($i = 0; $i < 30; $i++) {
            //echo "DEBUG ibane $filscheader[$i],  languageprofile=$languageprofile<br>";
            // echo  "iDEBUG (".substr($filscheader[$i],0,6)."==".substr($languageprofile,0,6).") <br>";
            if (substr($filscheader[$i], 0, 6) == substr($languageprofile, 0, 6)) {
                $keylanguage = $i;
            }
            // теперь хрен открутится, правда ограничились 6 знаками но пофиг , главное ?  не пролезет
            // if (strpos ($filscheader[$i],$languageprofile)) $keylanguage=$i;
            // ну вот почему всегда вместо простой функции приходится городить черт знает что.
            //  if ($filscheader[$i]==$languageprofile) $keylanguage=$i; // придется сделать по дебильному - ибо // что за ? - откуда оно взялось блджад!!!!
        }
        if ($keylanguage == 29) {
            $keylanguage = 1;
        }
        //if
    }
    //..потом добавим проверку на дебильный символ в конце любой строки с утф...вообще бы в парсере как то опознавание глючны файлов сделать
    if ($filscdata) {
        //echo "<br>DEBUG Script:$cmd Key=$keylanguage Lang=$languageprofile Selected=".$filscheader[$keylanguage]."<br>";
        for ($i = 1; $i < $filsccount; $i++) {
            // echo "debug $i = $filscdata[$i][$keylanguage]   , key=[$keylanguage]<br>";
            // plevel checking NOT added!!!!  graphical icon NOT released!  CFG OPT FUTURE disable all scripts not added
            //echo "  if (".$filscdata[$i][$keylanguage]."==$cmd) <br>";
            if ($filscdata[$i][$keylanguage] . $pid === $cmd) {
                $plevelrequired = $filscdata[$i][3];
                $directcommand = $filscdata[$i][2];
                if ($debug) {
                    echo "DEBUG Command= {$directcommand} (rightsreq={$plevelrequired})<br>";
                }
            }
            //path2 redirector?
            if (strlen($directcommand) < 2) {
                continue;
            }
            $massivedynamics = 0;
            if ($debug) {
                echo "DEBUG for (i=1;i<" . strlen($directcommand) . ");{$i}++) {<br>";
            }
            $parsedcommand = $directcommand;
            //echo "здесь должен быть выход ибо сцуко виснет ";
            for ($i = 1; $i < strlen($directcommand) + 5; $i++) {
                $a1 = strpos($directcommand, "%", $i + 0) + 1;
                if ($a1) {
                    $massivedynamics++;
                    $a2 = strpos($directcommand, "%", 0 + $a1 + 1);
                    //this is first   просто это первый , общественный российский.
                    //echo "Try to corrent schetckik -LAAA!!!$i+$a2-1!!!!!!!new $i==$a2!!!!!!!!!!!!!!!!;<br>       ";
                    $oldi = $i;
                    //$i=$i+($a2-1);  почти верно
                    $i = $a2;
                    //echo "old i=$oldi  new i=$i<br>";
                    if ($oldi > $i) {
                        //echo "Logic error, breaking cycling<br>";
                        $i = $oldi;
                        $i = 100500;
                        continue;
                    }
                    $firstcoord[$massivedynamics] = $a1;
                    $lastcoord[$massivedynamics] = $a2;
                    $cut = substr($directcommand, $a1, $a2 - $a1);
                    $cutnow[$massivedynamics] = $cut;
                    $cutwprc = substr($directcommand, $a1 - 1, $a2 - $a1 + 2);
                    $cutwpercent[$massivedynamics] = $cutwprc;
                    $md = $massivedynamics;
                    if ($debug) {
                        echo "DEBUG Parse [{$i}] param=:: f=" . $firstcoord[$md] . " ; a2-l=" . $lastcoord[$md] . ";- is cut=" . $cutnow[$md] . " = %%::<blu>" . $cutwpercent[$md] . "</blu> = <grn>" . ${$cut} . "</grn><br>";
                    }
                    $replaceto = ${$cut};
                    // fukken shit - admin.php?/   а где все остальное?  крап$parsedcommand=str_replace ($parsedcommand, $cutwprc,$replaceto, $count=1);
                    $parsedcommand = str_replace($cutwprc, $replaceto, $parsedcommand, $count = 2);
                }
                //al@al-desktop:/media# mencoder
                //mencoder: relocation error: mencoder: symbol codec_wav_tags, version LIBAVFORMAT_52 not defined in file libavformat.so.52 with link time reference
            }
        }
        if ($debug) {
            echo "DEBUG Parsed command :: {$parsedcommand}<br>";
        }
        if ($parsedcommand) {
            echo " executing (if you enable system () of course )...<br>";
            $x = system($parsedcommand);
            //ping
            $f = fopen("_logs/cmd.log", "w");
            if ($f) {
                fwrite($f, $x);
            }
            fclose($f);
            lprint("5MIN");
            if ($debug) {
                echo "DEBUG {$x}";
            }
        }
        //    ob_flush () ;
        ////exit;
    }
    //echo "ACTION:cmd=$cmd,str ok,path ok,file=$fileforaction,pid=$pid>";// -+++-
    $path = str_replace("\\\\", "\\", $path);
    // проверка на вшивость -
    //$path=str_replace ("/","\\",$path);
    if ($cmd == cmsg("FMG_CPY_F") and $prauth[$ADM][12]) {
        global $path2;
        copy($path . $fileforaction, $path2 . $fileforaction);
        echo "copy({$path}{$fileforaction},{$path2});";
        echo cmsg("CP_END");
    }
    if ($cmd == cmsg("FMG_MOV_F") and $prauth[$ADM][12]) {
        global $path2;
        copy($path . $fileforaction, $path2 . $fileforaction);
        unlink($path . $fileforaction);
        echo cmsg("MOV_END");
    }
    if ($pr[101]) {
        if ($cmd == cmsg("FMG_DOWNLOAD") and $prauth[$ADM][9]) {
            ob_clean();
            $err = sendfile($path . "/" . $fileforaction);
        }
    }
    //костыль, ибо на некоторых тупых компьютерах почему то пропадает косая и соответственно файл скачать невозможно. куда она пропадает никто не знает.
    if ($cmd == cmsg("FMG_DOWNLOAD") and $prauth[$ADM][9]) {
        ob_clean();
        $err = sendfile($path . $fileforaction);
    }
    if ($cmd == cmsg("FMG_UPLOAD") and $prauth[$ADM][36] or $cmd == cmsg("FMG_DUMP_UPLOAD") and $prauth[$ADM][36]) {
        $path = del_endslash($path);
        //	if ($codekey==7) demo ();
        //<input type="hidden" name="MAX_FILE_SIZE" value="8000000000">
        ?>
<form enctype="multipart/form-data" action="filemgr.php" method="post">
	<input name=userfile type=file class=buttonS> <input type=Submit name=go class=buttonS>
	<input type = hidden name = path value ="<?php 
        echo $path;
        ?>
"><?php 
        hidekey("pid", $pid);
        if ($cmd == cmsg("FMG_DUMP_UPLOAD")) {
            echo "Dump loading.<br>";
        }
        echo "</form>";
        hidekey("write", $cmd);
        exit;
        //moved from non-function zone
    }
    //возможно сюда присобачим кнопку удаления из админки точнее ссылки с нее из w.php :)
    //if (($cmd==cmsg("FMG_UNSHARE"))and($prauth[$ADM][36])) {    echo "not implemented";}
    if ($cmd == cmsg("FMG_SHARE") and $prauth[$ADM][36] or $coreredir == "SH_UPDD_FL") {
        $path = del_endslash($path);
        // -- SHARE STEP 1 --
        if ($multiaction) {
            global $filearrcount;
            // 0
            if ($filearrcount > 0) {
                exit;
            }
            // disables FMG_SHARE for cycle executing;  only one action allowed for one or multiaction files.
            global $fileforaction;
            $filearrcount = count($fileforaction);
        }
        // праздник главное вовремя закончить  тогда он ьудет долго помниться как приятное событие
        // multiaction==1  CFG OPT FUTURE  должен добавлять много файлов по идее, однако пока отрабатывается по файлу за раз.
        if ($multiaction) {
            echo "Multiaction mode.  Selected files={$filearrcount}<br>";
        }
        //..if ($multiaction==1) {global $filearrcount;$stroka.=$filearrcount;};
        if (!$multiaction) {
            $file = $path . "/" . $fileforaction;
        }
        if ($multiaction) {
            for ($a = 0; $a < $filearrcount; $a++) {
                $file[$a] = $path . "/" . $fileforaction[$a];
                echo "File {$a}: {$fileforaction[$a]}<br>;";
            }
            $filelistmassive = base64_encode(implode($fileforaction, "¦"));
            //список и число объектов надо передать вместе с multiaction
        }
        //лучше всего массив с файлами передать в виде одной переменной
        if ($coreredir == "SH_UPDD_FL") {
            // maybe
            if (!$multiaction) {
                global $destinationfilename, $filesizeinmb;
                $file = $destinationfilename;
            }
            if ($multiaction) {
                global $destinationfilename, $filesizeinmb;
                echo "SH_UPDD_FL unimplemented<br>";
                echo "I dont know where i take destfilename {$destinationfilename} -- {$file} (file)<bR>";
                //   $file=$destinationfilename;
            }
        }
        ?>
<form enctype="multipart/form-data" action="filemgr.php" method="post"><?php 
        if (!$multiaction) {
            echo "File: {$file}<br>";
        }
        //Sif (!$multiaction) {   echo "File: $file<br>";}
        lprint(GEN_OPT);
        echo "<br>";
        radio("share", "#GENLNK_UNREG", "GENLNK_UNREG");
        echo "<br>";
        radio("share", "FMG_UNSHARE", "FMG_UNSHARE");
        echo "<br>";
        if (!$pr[70]) {
            radio("share", "GENLNK_REG", "GENLNK_REG");
            if ($ADM < 1) {
                lprint("FILE_UNAUTH_NOTE");
            }
            echo "<br>";
            if ($ADM > 0) {
                radio("share", "GEN_PLVL_USR", "GEN_PLVL_USR");
                echo "<select name=groupplevels>";
                for ($a = 0; $a < 10; $a++) {
                    echo "<option>" . $a;
                }
                echo "</select>";
                //if ($ADM<1) lprint ("FILE_UNAUTH_NOTE"); - check unauthorized access
                echo "<br>";
                //незарегистрированные в любом случае не будут видеть список пользователей ресурса в раздаче.
                radio("share", "GENLNK_USR", "GENLNK_USR");
                echo "<br>";
                echo "<select name=\"username[]\" multiple size=15>";
                for ($a = 1; $a < count($prauth); $a++) {
                    echo "<option>" . $prauth[$a][0] . "";
                    $cnt++;
                }
                echo "</select>";
            }
            echo "<br>";
        }
        lprint(COMM);
        inputtext("commfile", 15, $commfile);
        echo "<br>";
        if ($prauth[$ADM][2]) {
            checkbox(1, "yes");
            lprint(GEN_FL_EPX);
        } else {
            hidekey("yes", 1);
        }
        checkbox(1, "srchen");
        lprint(GEN_FILENSRCH);
        echo "<br>";
        if ($coreredir == "SH_UPDD_FL") {
            hidekey("coreredir", "step2");
        }
        if (!$multiaction) {
            hidekey("file", $file);
        }
        if ($multiaction) {
            hidekey("multiactionsign", $multiaction);
            hidekey("file", $filelistmassive);
            $path = add_endslash($path);
            hidekey("pathmulti", base64_encode($path));
            hidekey("filelistmassive", $filelistmassive);
            //посылаем дважды на пробу   и каждый раз нихрена нет почему то  какого ???
            hidekey("filearrcount", $filearrcount);
        }
        submitkey("go", "FMG_SHARE");
        // кнопка раздать файл
        hidekey("pid", $pid);
        ?>
</form>
<?php 
        echo " ";
        hidekey("write", $cmd);
        if ($multiaction == 1) {
            exit;
        }
        //   !
        ////moved from non-function zone -- SHARE STEP 1 -- ENDING
        //ЭТО ОКончание первого шага раздачи
    }
    //
    //	echo "Мы получили из пред сессии  $cmd $fileforaction!<br> <BR>";   ikonki mlya !
    //echo "<br>".cmsg ("FMG_MHLP")."<br>";  ХЕЛП ОТКЛЮЧЕН
    if ($noscreenmode == false) {
        echo "";
    }
    //тут пишем команды и выполняем их
    //echo "628_Failure-- protect::";print_r ($protect); неправильно обрабатывался массив  почему то вместо него шла переменная о_О CFG OPT FUTURE
    if (is_Array($protect)) {
        if (!$prauth[$ADM][38]) {
            $protect[] = "*.php";
        }
    }
    // скрываем файлы скрипта чтобы их никто не стер.
    //$protect[]="*.key";// не снимать комментарий - безопасность снизится до 0
    //if ($OSTYPE=="LINUX") if (($sd[10])AND($ADM==0)) $path=$path."/";  //bug with unregistered users  folder lost /
    //if ($OSTYPE=="WINDOWS") if (($sd[10])AND($ADM==0)) $path=$path."\\";
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_ENTER") and $prauth[$ADM][7]) {
            $path = $path . $fileforaction . "\\";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_ENTER") and $prauth[$ADM][7]) {
            $path = $path . $fileforaction . "/";
        }
    }
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = $stroka . ":/";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = "/media/{$stroka}/";
        }
    }
    if ($OSTYPE == "LINUXALT") {
        if ($cmd == cmsg("FMG_DRV") and $prauth[$ADM][8]) {
            $path = "/mnt/{$stroka}/";
        }
    }
    //CFG OPT FUTURE
    if ($OSTYPE == "WINDOWS") {
        if ($cmd == cmsg("FMG_EXIT") and $prauth[$ADM][7]) {
            $path = dirname($path) . "\\";
        }
    }
    //$path=folderupdir ($path);
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_EXIT") and $prauth[$ADM][7]) {
            $path = dirname($path) . "/";
        }
    }
    if ($cmd == cmsg("FMG_SRCH") and $prauth[$ADM][7]) {
        $file = $path . $fileforaction;
        // далее скрипт рассчитан на эту переменную, к томуже массив стереть надо:)
        $a = searchplus($file, $fileforaction, $stroka);
        if ($pr[12]) {
            $act = "FILEMGR_SRCH {$cmd} {$file} word={$stroka}";
            logwrite($act);
        }
        // логируемся
        //if ($a==false) die ("<br>Ошибка!Файл $file не найден!!!.<br>");
        echo " <form action=filemgr.php method=post>";
        hidekey("pid", $pid);
        hidekey("write", $cmd);
        submitkey("cmd" . $pid, "FMG_RESET");
        echo "</form>";
        exit;
    }
    //If ($prauth[$ADM][2]==true) {
    // blocked commands
    if ($cmd == cmsg("FMG_MKDIR") and $prauth[$ADM][12]) {
        //if ($codekey==7) demo ();
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        $err = mkdir($path . $stroka);
    }
    //if ($cmd==cmsg("FMG_DELALL")) $err=rmdir ($path.$fileforaction);
    if ($cmd == cmsg("FMG_JOINFIL") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        $err = joinfiles($path, $mask, $protect, $stroka);
    }
    if ($cmd == cmsg("FMG_DELALL") and $prauth[$ADM][13]) {
        // rmdir теперь  полное удаление (!)
        if ($codekey == 7) {
            demo();
        }
        if ($prauth[$ADM][5] == true) {
            if ($stroka == "accept") {
                $err = kill_dir($path . $fileforaction);
            } else {
                echo "Вы не сказали accept";
            }
        } else {
            msgexiterror("notright", "", "disable");
            exit;
        }
        // круто удаляет отключим
    }
    if ($cmd == cmsg("FMG_EXECUTE") and $prauth[$ADM][8]) {
        if ($codekey == 7) {
            demo();
        }
        echo cmsg("FMG_MOD_IN") . "<br>";
        require $filemgrmod;
        echo cmsg("FMG_MOD_OUT") . "<br>";
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_UNRAR") and $prauth[$ADM][12]) {
            $file = $path . $fileforaction;
            //rar_open rar_list PHP by standart is unsupported!!!
            $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
            // elf  elfkz  удаляем расширение рар
            @mkdir($path . $unrared);
            echo "Creating folder {$unrared}<br>";
            $extractionpoint = $path . $unrared;
            echo "Extracting to " . $extractionpoint . ";<br>";
            $zip = system("unrar x \"{$file}\" \"{$extractionpoint}\"");
            echo "<br>Result={$zip}  ";
            //echo '"unrar e \"'.$file.'\" \"'.$extractionpoint.'\""'; echo " <br>";
        }
    }
    if ($OSTYPE == "LINUX") {
        if ($cmd == cmsg("FMG_RAR") and $prauth[$ADM][12]) {
            $file = $path . $fileforaction;
            //rar_open rar_list PHP by standart is unsupported!!!
            $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
            // elf  elfkz  удаляем расширение рар
            // @mkdir ($path.$unrared);
            // echo "Creating folder $unrared<br>";
            $extractionpoint = $path . $unrared;
            echo "Archiving to  to " . $fileforaction . ".rar;<br>";
            $zip = system("rar a \"{$fileforaction}\".rar \"{$file}\"");
            echo "<br>Result={$zip}  ";
            //echo '"unrar e \"'.$file.'\" \"'.$extractionpoint.'\""'; echo " <br>";
        }
    }
    if ($cmd == cmsg("FMG_UNZIP") and $prauth[$ADM][12]) {
        $file = $path . $fileforaction;
        //rar_open rar_list PHP by standart is unsupported!!!
        $zip = zip_open($file);
        $unrared = substr($fileforaction, 0, strrpos($fileforaction, '.'));
        // elf  elfkz  удаляем расширение рар
        @mkdir($path . $unrared);
        if ($zip) {
            while ($zip_entry = zip_read($zip)) {
                echo "Name: " . zip_entry_name($zip_entry) . "\n";
                echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
                echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
                echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n";
                if (zip_entry_open($zip, $zip_entry, "r")) {
                    echo "File Contents:\n";
                    $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                    //echo "$buf\n";
                    $x = fopen($path . zip_entry_name($zip_entry), "w");
                    @fwrite($x, $buf);
                    @fclose($x);
                    zip_entry_close($zip_entry);
                }
                echo "\n";
            }
            zip_close($zip);
        }
    }
    if ($cmd == cmsg("FMG_TEST")) {
        //at this moment start new script
        echo cmsg("FMG_MOD_IN") . "<br>";
        require "mp3runonce.php";
        echo cmsg("FMG_MOD_OUT") . "<br>";
    }
    if ($cmd == cmsg("FMG_DEL") and $prauth[$ADM][13]) {
        if ($codekey == 7) {
            demo();
        }
        @($err1 = unlink($path . $fileforaction));
        @($err2 = rmdir($path . $fileforaction));
    }
    if ($cmd == cmsg("FMG_NEW") and $prauth[$ADM][12]) {
        //if ($codekey==7) demo ();
        //echo "ibane ug if ($multiaction==1) {global $filearrcount;$stroka.=$filearrcount;};<br>";
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        @($err = fopen($path . $stroka, "r"));
        if ($err == false) {
            $err = fopen($path . $stroka, "a");
        }
    }
    if ($cmd == cmsg("FMG_REN") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        if ($multiaction == 1) {
            global $filearrcount;
            $stroka .= $filearrcount;
        }
        $err = rename($path . $fileforaction, $path . $stroka);
    }
    if ($cmd == cmsg("FMG_EDIT") and $prauth[$ADM][12]) {
        if ($codekey == 7) {
            demo();
        }
        $err = simpleedit($path . $fileforaction, $stroka);
    }
    if ($pr[12]) {
        $act = "FILEMGR_CMD {$cmd} {$file}({$path} {$fileforaction}) word={$stroka}";
        if ($cmd) {
            if ($cmd !== cmsg("FMG_ENTER") and $cmd !== cmsg("FMG_EXIT")) {
                logwrite($act);
            }
        }
    }
    // логируемся
    // } else { echo "<br><font color=red id=errfnt>".cmsg ("LIM")."</font>".cmsg ("FMG_HLP2");}
    #selectin files using  fileio.php
    if (!$path or $cmd == cmsg("FMG_RESET")) {
        $path = $defaultpath;
        $mask = "*.*";
        $file = "";
        $stroka = "";
    }
    //$path=str_replace ("//","/",$path);проверка на вшивость -
    if ($err) {
        echo "{$err} <br>";
    }
    //global disables visual menu for executing action
    if (!$multiaction) {
        // start menu show
        // маска для файла может быть поиск по части имени и поиск по формату
        //выделить обращение к директории и режим парсинга (маска)
        //насчет маски - возможно стоит ее добавить в поисковик МЕ
        if ($pid == 1) {
            if ($pr[86]) {
                if ($pr[87] or $prauth[$ADM][7]) {
                    //либо право на чтение у юзера, либо разрешение искать всем.
                    echo "<br><form action=filemgr.php method=post>";
                    lprint("SRCH_FILE");
                    inputtxt("searchfilenew", 30);
                    submitkey("start", "DALEE");
                    echo "</form>";
                    if ($searchfilenew) {
                        echo $searchfilenew;
                    }
                }
            }
        }
        echo "<form action=filemgr.php method=post>";
        hidekey("write", $cmd);
        //выделить отдельно модуль создания меню выбора файла.
        $file = getdirdata($path, $mask, $protect);
        //print_r ($file);
        if ($file) {
            asort($file);
        }
        $dircnt = count($file);
        if ($ADM > 0) {
            echo "<font color=blue>{$path}</font><br>";
        }
        hidekey("pid", $pid);
        // cобственно это и мешает многооконной идее ))   вроде теперь кое-
        for ($a = 1; $a < $maxmgrs + 1; $a++) {
            // save pid data
            $strokaname = "stroka" . $a;
            $pathname = "path" . $a;
            $fileforactionname = "fileforaction" . $a;
            $maskname = "mask" . $a;
            global ${$strokaname}, ${$pathname}, ${$fileforactionname}, ${$maskname};
            ${$pathname} = str_replace("\\\\", "\\", ${$pathname});
            ${$pathname} = str_replace("\\\\", "\\", ${$pathname});
            if ($OSTYPE == "WINDOWS") {
                $path = str_replace("\\\\", "\\", $path);
            }
            // проверка на вшивость -
            if ($OSTYPE == "LINUX") {
                $path = str_replace("\\\\", "\\", $path);
            }
            // проверка на вшивость -xc
            hidekey("stroka" . $a, ${$strokaname});
            hidekey("mask" . $a, ${$maskname});
            hidekey("path" . $a, ${$pathname});
            hidekey("fileforaction" . $a, ${$fileforactionname});
        }
        //lprint ("FMG_CREATE");
        if ($ADM > 0) {
            inputtext("stroka" . $pid, 15, $stroka);
        }
        //<textarea type = text name=stroka<?=$pid  cols= 15 rows=1 wrap=NONE><?=$stroka; </textarea>
        if ($ADM > 0) {
            $hidefolder = $prauth[$ADM][52];
        } else {
            $hidefolder = $pr[73];
        }
        if (!$hidefolder) {
            lprint("FMG_MASK");
            inputtext("mask" . $pid, 15, $mask);
        }
        //<textarea type = text name=mask<?=$pid  cols= 7 rows=1 wrap=NONE><?=$mask; </textarea> <?
        if ($noscreenmode) {
            if ($prauth[$ADM][7]) {
                //FMG.pid удален
                echo "generate cmd{$pid}<br>";
                //$cmdx="cmd".$pid;
                //работает но передает только вторую букву [1] FIXED?
                submitkey("cmd", "FMG_SRCH");
                submitkey("cmd", "FMG_ENTER");
                submitkey("cmd", "FMG_EXIT");
            }
            if ($prauth[$ADM][8]) {
                submitkey("cmd", "FMG_DRV");
                if ($filemgrmod and $prauth[$ADM][2] == true) {
                    submitkey("cmd", "FMG_EXECUTE");
                }
            }
            if ($prauth[$ADM][12]) {
                submitkey("cmd", "FMG_MKDIR");
                submitkey("cmd", "FMG_JOINFIL");
                submitkey("cmd", "FMG_UNZIP");
                submitkey("cmd", "FMG_TEST");
                if ($OSTYPE == "LINUX") {
                    submitkey("cmd", "FMG_UNRAR");
                }
                if ($OSTYPE == "LINUX") {
                    submitkey("cmd", "FMG_RAR");
                }
                submitkey("cmd", "FMG_REN");
                submitkey("cmd", "FMG_EDIT");
                submitkey("cmd", "FMG_NEW");
            }
            if ($prauth[$ADM][13]) {
                submitkey("cmd", "FMG_DELALL");
                submitkey("cmd", "FMG_DEL");
            }
            if ($prauth[$ADM][9]) {
                submitkey("cmd", "FMG_DOWNLOAD");
            }
            if ($prauth[$ADM][36]) {
                submitkey("cmd", "FMG_UPLOAD");
            }
            if ($prauth[$ADM][54]) {
                submitkey("cmd", "FMG_SHARE");
                //	 submitkey ("cmd","FMG_UNSHARE");
            }
            if (!$pr[75]) {
                submitkey("cmd", "FMG_REF");
                submitkey("cmd", "FMG_RESET");
            }
            if (!$hidefolder) {
                submitkey("cmd", "FMG_MASKAPPLY");
            }
            //scripting showkey mechanism
            if ($filscdata) {
                echo "<br>Configured scripts:<br>";
                for ($i = 1; $i < $filsccount; $i++) {
                    // echo "debug $i = $filscdata[$i][$keylanguage]   , key=[$keylanguage]<br>";
                    if ($filscdata[$i][$keylanguage] == "") {
                        continue;
                    }
                    submitkey("cmd", "." . $filscdata[$i][$keylanguage]);
                }
                //  fwrite ($a,"ID¦NAME¦Script¦Plevel¦keynames-icon¦russian¦english¦f1_russian¦f1_english¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦".$addOSenter);
                /*.*1¦mencoder %path%%file% -oac mp3lame -ovc x264 -o %path%%file%.avi¦0¦0¦перекодить в h264¦encode h264¦0¦0¦0¦0¦0
                2¦mencoder %path%%file% -oac mp3lame -ovc mpg -o %path%%file%.avi¦0¦0¦перекодить в mpeg¦encode mpeg¦0¦0¦0¦0¦0¦0
                */
            }
        }
        if ($noscreenmode == false) {
            if ($prauth[$ADM][7]) {
                submitimg("cmd" . $pid, "FMG_SRCH", "_ico/target.png");
                submitimg("cmd" . $pid, "FMG_ENTER", "_ico/openfolder.png");
                submitimg("cmd" . $pid, "FMG_EXIT", "_ico/folderup.png");
            }
            if ($prauth[$ADM][8]) {
                submitimg("cmd" . $pid, "FMG_DRV", "_ico/drv.png");
                submitimg("cmd" . $pid, "FMG_EXECUTE", "_ico/execute.png");
            }
            if ($prauth[$ADM][12]) {
                submitimg("cmd" . $pid, "FMG_MKDIR", "_ico/newfolder.png");
                submitimg("cmd" . $pid, "FMG_REN", "_ico/rename.png");
                submitimg("cmd" . $pid, "FMG_EDIT", "_ico/editfmg.png");
                submitimg("cmd" . $pid, "FMG_NEW", "_ico/newfile.png");
                submitimg("cmd" . $pid, "FMG_JOINFIL", "_ico/joinfiles.png");
                submitimg("cmd" . $pid, "FMG_UNZIP", "_ico/backup.png");
                submitimg("cmd" . $pid, "FMG_TEST", "_ico/apply_f2.png");
                if ($OSTYPE === "LINUX") {
                    submitimg("cmd" . $pid, "FMG_UNRAR", "_ico/backup.png");
                }
                if ($OSTYPE === "LINUX") {
                    submitimg("cmd" . $pid, "FMG_RAR", "_ico/backup.png");
                }
            }
            if ($prauth[$ADM][13]) {
                if ($prauth[$ADM][5] == true) {
                    submitimg("cmd" . $pid, "FMG_DELALL", "_ico/removefolder.png");
                }
                submitimg("cmd" . $pid, "FMG_DEL", "_ico/removefile.png");
            }
            if ($prauth[$ADM][9]) {
                submitimg("cmd" . $pid, "FMG_DOWNLOAD", "_ico/download.png");
            }
            if ($prauth[$ADM][36]) {
                if (!$pr[75]) {
                    submitimg("cmd" . $pid, "FMG_UPLOAD", "_ico/upload.png");
                }
                if ($pr[75]) {
                    submitimg("cmd" . $pid, "FMG_UPLOAD", "_ico/uploadalt.png");
                }
            }
            if ($prauth[$ADM][54]) {
                submitimg("cmd" . $pid, "FMG_SHARE", "_ico/w_accept.png");
                //submitimg ("cmd".$pid,"FMG_UNSHARE","_ico/w_close.png");
            }
            if (!$pr[75]) {
                submitimg("cmd" . $pid, "FMG_REF", "_ico/refresh.png");
                submitimg("cmd" . $pid, "FMG_RESET", "_ico/reset.png");
            }
            if (!$hidefolder) {
                submitimg("cmd" . $pid, "FMG_MASKAPPLY", "_ico/stargreen.png");
            }
        }
        if ($pid == 1 and $prauth[$ADM][12]) {
            // только 1 раз исполняется этот блок .  на 1 пиде.
            echo "<br>";
            echo cmsg("FMG2");
            submitimg("cmd" . $pid, "FMG_CPY_F", "_ico/copyfile.png");
            echo " ";
            submitimg("cmd" . $pid, "FMG_MOV_F", "_ico/movefile.png");
            echo " ";
            //submitimg ("cmd".$pid,"FMG_CPY_FLD","_ico/copyfolder.png");echo " ";
            submitimg("cmd" . $pid, "FMG_MOV_FLD", "_ico/movefolder.png");
            echo " ";
        }
        ?>
 <input type = hidden name = path<?php 
        echo $pid;
        ?>
 value ="<?php 
        echo $path;
        ?>
" >
<?php 
        if ($hidefolder) {
            unset($file);
        }
        //no filelist
        if ($file) {
            echo "<BR>" . cmsg("FMG_FILDB") . ":<select name =fileforaction" . $pid . "[] multiple size = " . $prauth[$ADM][49] . ">";
            sort($file);
            //нет реакции... print_r ($file); echo "Rewefkowe";
            for ($a = 0; $a < $dircnt; $a++) {
                if ($file[$a][0] === ".") {
                    continue;
                }
                if ($file[$a][0] === "..") {
                    continue;
                }
                if ($file[$a][0] === false) {
                    continue;
                }
                if ($file[$a][1]) {
                    $dir = "==>";
                } else {
                    $dir = "";
                }
                $fsizer = "";
                if ($dir !== "==>") {
                    $fsize = $file[$a][2];
                    // settype ($fsizer,"string");
                    if ($fsize < 1024) {
                        $fsizer = "[" . round($fsize, 1) . "b]";
                    }
                    if ($fsize < 1) {
                        $fsizer = "";
                    }
                    if ($fsize > 1024) {
                        $fsizer = "[" . round($fsize / 1024, 1) . "Kb]";
                    }
                    if ($fsize > 1024 * 1024) {
                        $fsizer = "[" . round($fsize / 1024 / 1024, 2) . "Mb]";
                    }
                    if ($fsize > 1024 * 1024 * 1024) {
                        $fsizer = "[" . round($fsize / 1024 / 1024 / 1024, 2) . "Gb]";
                    }
                }
                //$filesizemb=$file[$a][2]/1024;
                echo "<option value=\"" . $file[$a][0] . "\">" . $dir . $file[$a][0] . "" . $fsizer . "</option>";
            }
            // size (".$file[$a][2].")
            if ($pr[11] == 1) {
                //protected cmds
            }
            echo "</select></form>";
        }
        echo "<br>";
        $dbsdiskfree = round((int) (@disk_free_space($path) / (1024 * 1024 * 1024)), 1);
        $dbsdisktotal = (int) (@disk_total_space($path) / (1024 * 1024 * 1024));
        if ($pid == 1) {
            if ($ADM) {
                echo "Selected : Free " . $dbsdiskfree . "Gb ";
            }
            // сделать переключатель дисков или что то вроде указателя
            if ($ADM) {
                echo "\\" . $dbsdisktotal . "Gb<br>";
            }
            $disks = explode(",", $pr[79]);
            for ($a = 0; $a < count($disks); $a++) {
                $diskfree[$a] = round(@disk_free_space($disks[$a]) / (1024 * 1024 * 1024), 1);
                //Gb
                $disktotal[$a] = round(@disk_total_space($disks[$a]) / (1024 * 1024 * 1024), 1);
                //Gb
                if (!$pr[80]) {
                    echo "Disk " . $a . ":: " . $diskfree[$a] . "Gb \\ " . $disktotal[$a] . "Gb.<br>";
                }
                $avgfree = $avgfree + $diskfree[$a];
                $avgtotal = $avgtotal + $disktotal[$a];
            }
            $avgfree = $avgfree;
            $avgtotal = $avgtotal;
            echo " Summary :Free " . $avgfree . "Gb ";
            echo "\\" . $avgtotal . "Gb";
            echo "<br>";
        }
        //only pid 1 shows
    }
    // start menu show
}
コード例 #11
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function regesterphone()
 {
     $regestercode = Mysite::$app->config['regestercode'];
     $checkcode = ICookie::get('regphonecode');
     $checkphone = ICookie::get('regphone');
     $checktime = ICookie::get('regtime');
     $code_back = IReq::get('code_back');
     if (!empty($checkcode)) {
         $backtime = $checktime - time();
         if ($backtime > 0) {
             echo 'showsend(\'' . $checkphone . '\',' . $backtime . ')';
             exit;
         }
     }
     if (!empty($this->member['uid'])) {
         echo 'noshow(\'已登陆\')';
         exit;
     }
     $phone = IFilter::act(IReq::get('phone'));
     if (!IValidate::suremobi($phone)) {
         echo 'noshow(\'手机号码格式不正确\')';
         exit;
     }
     $userinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "member where phone='" . $phone . "' ");
     if (!empty($userinfo) && $code_back == "0") {
         echo 'noshow(\'手机号码已注册\')';
         exit;
     }
     $makecode = mt_rand(1000, 9999);
     $sendmobile = new mobile();
     $contents = '【小树好吃】您的验证码是:' . $makecode;
     if (Mysite::$app->config['smstype'] == 2) {
         //139邮箱转发短信
         //使用sms10086cn发送/
         $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
         $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $phone . '&nr=' . urlencode($contents) . '&dxlbid=27';
         $contentcccc = file_get_contents($weblink);
         logwrite('验证短信发送:' . $contentcccc);
     } else {
         //使用sms10086cn发送/
         $phoneids = array();
         $phoneids[] = $phone;
         $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
         if ($chekcinfo) {
             $data = array("phone" => $phone, "addtime" => time(), "code" => $makecode, "is_send" => $chekcinfo);
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'mobile', $data);
         }
         logwrite('验证短信发送:' . $chekcinfo);
     }
     ICookie::set('regphonecode', $makecode, 600);
     ICookie::set('regphone', $phone, 600);
     $longtime = time() + 60;
     ICookie::set('regtime', $longtime, 60);
     echo 'showsend(\'' . $phone . '\',60)';
     exit;
 }
コード例 #12
0
ファイル: orderclass.php プロジェクト: snamper/xiaoshuhaochi
    function sendmess($orderid)
    {
        $smtp = new ISmtp(Mysite::$app->config['smpt'], 25, Mysite::$app->config['emailname'], Mysite::$app->config['emailpwd'], false);
        $sendmobile = new mobile();
        $wx_s = new wx_s();
        $orderinfo = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "order  where id= '" . $orderid . "'   ");
        $orderdet = $this->mysql->getarr("select *  from " . Mysite::$app->config['tablepre'] . "orderdet  where order_id= '" . $orderid . "'   ");
        $shopinfo = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "shop  where id= '" . $orderinfo['shopid'] . "'   ");
        $tempdata = array('orderinfo' => $orderinfo, 'orderdet' => $orderdet, 'sitename' => Mysite::$app->config['sitename']);
        $contents = '';
        $checknotice = isset($shopinfo['noticetype']) ? explode(',', $shopinfo['noticetype']) : array();
        $contents = '';
        $appcheck = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "applogin where uid = '" . $orderinfo['shopuid'] . "'   ");
        if (!empty($appcheck)) {
            /* $appCls = new appclass();
               $backinfo = $appCls->sendmsg($appcheck['userid'],$appcheck['channelid'],Mysite::$app->config['sitename'].'订单提醒','您有新的订单,单号:'.$orderinfo['dno'],$messagetype=1);
               logwrite('APP发送:'.$backinfo);*/
        }
        if (in_array(1, $checknotice)) {
            if (Mysite::$app->config['allowedsendshop'] == 1) {
                if (IValidate::suremobi($orderinfo['shopphone'])) {
                    $default_tpl = new config('tplset.php', hopedir);
                    $tpllist = $default_tpl->getInfo();
                    if (!isset($tpllist['shopphonetpl']) || empty($tpllist['shopphonetpl'])) {
                        // logwrite('短信发送商家模板加载失败');
                    } else {
                        $contents = Mysite::$app->statichtml($tpllist['shopphonetpl'], $tempdata);
                        if (Mysite::$app->config['smstype'] == 2) {
                            //139邮箱转发短信
                            //使用sms10086cn发送/
                            $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                            $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $orderinfo['shopphone'] . '&nr=' . urlencode($contents) . '&dxlbid=27';
                            $contentcccc = file_get_contents($weblink);
                            logwrite('短信sms10086cn发送结果:' . $contentcccc);
                        } else {
                            //使用sms10086cn发送/
                            $phoneids = array();
                            $phoneids[] = $orderinfo['shopphone'];
                            $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                            logwrite('亿美短信接口发送结果:' . $chekcinfo);
                        }
                    }
                } else {
                    logwrite('短信发送商家' . $shopinfo['shopname'] . '联系电话错误');
                }
            }
        }
        if (in_array(3, $checknotice)) {
            $wechat = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop_wechat where shopid=" . $orderinfo['shopid']);
            $wx_s = array();
            if (!empty($wechat)) {
                $wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'], $orderinfo['shopid']);
            }
            if (!empty($orderinfo['shopuid']) && !empty($wechat)) {
                $wechat = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "shop_wechat where shopid=" . $orderinfo['shopid']);
                //if (!empty($wechat)) {
                //$wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'],$orderinfo['shopid']);
                //找到要发送的商户微信openid
                $openid_list = $this->mysql->getarr("select openid from " . Mysite::$app->config['tablepre'] . "shop_wxuser where shopid=" . $orderinfo['shopid'] . " and is_merchant=1");
                $payarrr = array('outpay' => '到付', 'open_acout' => '余额支付');
                $orderpastatus = $orderinfo['paystatus'] == 1 ? '已支付' : '未支付';
                $orderpaytype = isset($payarrr[$orderinfo['paytype']]) ? $payarrr[$orderinfo['paytype']] : '在线支付';
                $tempdata = array('orderinfo' => $orderinfo, 'orderdet' => $orderdet, 'sitename' => Mysite::$app->config['sitename']);
                $temp_content = $orderinfo['buyername'] . '在' . Mysite::$app->config['sitename'] . '下单成功' . '\\n';
                $temp_content .= '下单时间:' . date('m-d H:i', $orderinfo['addtime']) . '\\n';
                $temp_content .= '配送时间:' . date('m-d H:i', $orderinfo['posttime']) . '\\n';
                $temp_content .= '支付方式' . $orderpaytype . ',' . $orderpastatus . ' ' . '\\n';
                $temp_content .= '收货人:' . $orderinfo['buyername'] . '\\n';
                $temp_content .= '地址:' . $orderinfo['buyeraddress'] . '\\n';
                $temp_content .= '联系电话:' . $orderinfo['buyerphone'] . '\\n';
                $temp_content .= '单号:' . $orderinfo['dno'] . '\\n';
                $temp_content .= '总价:' . $orderinfo['allcost'] . '元,配送费:' . $orderinfo['shopps'] . '元\\n';
                $temp_content .= '备注:' . $orderinfo['content'] . '\\n';
                foreach ($orderdet as $km => $vc) {
                    $temp_content .= $vc['goodsname'] . '(' . $vc['goodscount'] . '份)\\n';
                }
                if (!empty($openid_list)) {
                    if (!empty($temp_content)) {
                        foreach ($openid_list as $key => $value) {
                            if ($wx_s->sendmsg($temp_content, $value['openid'])) {
                            } else {
                                logwrite('微信客服发送错误:' . $wx_s->err());
                            }
                        }
                    }
                }
                //}
                //$wxshop = $this->mysql->select_one("select *  from ".Mysite::$app->config['tablepre']."wxuser  where uid= '".$orderinfo['shopuid']."'   ");
                /*if(!empty($wxshop)){
                
                                       $payarrr = array('outpay'=>'到付','open_acout'=>'余额支付');
                                       $orderpastatus = $orderinfo['paystatus'] == 1?'已支付':'未支付';
                                       $orderpaytype = isset($payarrr[$orderinfo['paytype']])?$payarrr[$orderinfo['paytype']]:'在线支付';
                                       $tempdata = array('orderinfo'=>$orderinfo,'orderdet'=>$orderdet,'sitename'=>Mysite::$app->config['sitename']);
                                       $temp_content = $orderinfo['buyername'].'在'.Mysite::$app->config['sitename'].'下单成功'.'\n';
                                       $temp_content .='下单时间:'.date('m-d H:i',$orderinfo['addtime']).'\n';
                                       $temp_content .='配送时间:'.date('m-d H:i',$orderinfo['posttime']).'\n';
                                       $temp_content .='支付方式'.$orderpaytype.','.$orderpastatus.' '.'\n';
                                       $temp_content .='收货人:'.$orderinfo['buyername'].'\n';
                                       $temp_content .='地址:'.$orderinfo['buyeraddress'].'\n';
                                       $temp_content .='联系电话:'.$orderinfo['buyerphone'].'\n';
                                       $temp_content .='单号:'.$orderinfo['dno'].'\n';
                                       $temp_content .='总价:'.$orderinfo['allcost'].'元,配送费:'.$orderinfo['shopps'].'元\n';
                                       $temp_content .='备注:'.$orderinfo['content'].'\n';
                                       foreach($orderdet as $km=>$vc){
                                         $temp_content .=$vc['goodsname'].'('.$vc['goodscount'].'份)\n';
                                       }
                                       //增加超连接
                                       $time = time();
                                     $tempstr = md5(Mysite::$app->config['wxtoken'].$time);
                                     $tempstr = substr($tempstr,3,15);
                                     $dolink = Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=shopshoworder&id='.$orderinfo['id'];
                                     $backinfo = '';
                                     if(!empty($dolink)){
                                                $templink = $dolink;
                                             for($i=0;$i<strlen($templink);$i++){
                                               $backinfo .= ord($templink[$i]).',';
                                         }
                                   }
                
                                       $linkstr =  Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=index&openid='.$wxshop['openid'].'&actime='.$time.'&sign='.$tempstr.'&backinfo='.$backinfo;
                                       $temp_content .= '<a href=\''.trim($linkstr).'\'>查看详情</a>';
                
                                       if(!empty($temp_content)){
                                          $wx_s = new wx_s($wechat['token'], $wechat['appid'], $wechat['secret'],$orderinfo['shopid']);
                                          if($wx_s->sendmsg($temp_content,$wxshop['openid'])){
                
                                          }else{
                                             logwrite('微信客服发送错误:'.$wx_s->err());
                                          }
                
                                       }
                                   }*/
            }
            if (!empty($orderinfo['buyeruid']) && !empty($wechat)) {
                //2015-06-25查不到$shopid把$shopid改成$shopinfo['id']
                $wxbuyer = $this->mysql->select_one("select *  from " . Mysite::$app->config['tablepre'] . "shop_wxuser where shopid='" . $shopinfo['id'] . "' and uid= '" . $orderinfo['buyeruid'] . "'   ");
                if (!empty($wxbuyer)) {
                    if (empty($contents)) {
                        $default_tpl = new config('tplset.php', hopedir);
                        $tpllist = $default_tpl->getInfo();
                        if (!isset($tpllist['shopphonetpl']) || empty($tpllist['shopphonetpl'])) {
                        } else {
                            $contents = Mysite::$app->statichtml($tpllist['userbuytpl'], $tempdata);
                        }
                    }
                    if (!empty($contents)) {
                        /*$time = time();
                                                 $tempstr = md5(Mysite::$app->config['wxtoken'].$time);
                                                 $tempstr = substr($tempstr,3,15);
                                                 $dolink = Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=ordershow&orderid='.$orderinfo['id'];
                        
                        
                                                 $backinfo = '';
                                                 if(!empty($dolink)){
                                                        $templink = $dolink;
                                                     for($i=0;$i<strlen($templink);$i++){
                                                       $backinfo .= ord($templink[$i]).',';
                                                     }
                                                 }
                                               // $backinfo =  str_replace(array('"',',','&'),array('-','^','@'),json_encode($dolink));
                                               //shopshoworder
                                               $linkstr =  Mysite::$app->config['siteurl'].'/index.php?controller=wxsite&action=index&openid='.$wxbuyer['openid'].'&actime='.$time.'&sign='.$tempstr.'&backinfo='.$backinfo;
                                               $contents .= '<a href=\''.trim($linkstr).'\'>查看详情</a>';*/
                        if ($wx_s->sendmsg($contents, $wxbuyer['openid'])) {
                        } else {
                            logwrite('微信客服发送错误:' . $wx_s->err());
                        }
                    }
                }
            }
        }
        if (!empty($shopinfo['machine_code']) && !empty($shopinfo['mKey'])) {
            $payarrr = array('outpay' => '到付', 'open_acout' => '余额支付');
            $orderpastatus = $orderinfo['paystatus'] == 1 ? '已支付' : '未支付';
            $orderpaytype = isset($payarrr[$orderinfo['paytype']]) ? $payarrr[$orderinfo['paytype']] : '在线支付';
            $temp_content = '';
            foreach ($orderdet as $km => $vc) {
                $temp_content .= $vc['goodsname'] . '(' . $vc['goodscount'] . '份) \\n ';
            }
            $msg = '商家:' . $shopinfo['shopname'] . '
订餐热线:' . Mysite::$app->config['litel'] . '
订单状态:' . $orderpaytype . ',(' . $orderpastatus . ')
姓名:' . $orderinfo['buyername'] . '
电话:' . $orderinfo['buyerphone'] . '
地址:' . $orderinfo['buyeraddress'] . '
下单时间:' . date('m-d H:i', $orderinfo['addtime']) . '
配送时间:' . date('m-d H:i', $orderinfo['posttime']) . '
*******************************
' . $temp_content . '
*******************************

配送费:' . $orderinfo['shopps'] . '元
合计:' . $orderinfo['allcost'] . '元
※※※※※※※※※※※※※※
谢谢惠顾,欢迎下次光临
订单编号' . $orderinfo['dno'] . '
备注' . $orderinfo['content'] . '
';
            $this->dosengprint($msg, $shopinfo['machine_code'], $shopinfo['mKey']);
        }
        if (in_array(2, $checknotice)) {
            //同时使用邮件通知
            if (Mysite::$app->config['noticeshopemail'] == 1) {
                //同时使用邮件通知
                if (IValidate::email($shopinfo['email'])) {
                    $default_tpl = new config('tplset.php', hopedir);
                    $tpllist = $default_tpl->getInfo();
                    if (!isset($tpllist['emailorder']) || empty($tpllist['emailorder'])) {
                        logwrite('邮件发送商家模板加载失败');
                    } else {
                        //surelink
                        //算方计算
                        $time = time();
                        $tempstr = md5($orderinfo['dno'] . $time);
                        $tempstr = substr($tempstr, 3, 15);
                        $tempstr = md5($orderinfo['shopuid'] . $tempstr);
                        $tempstr = substr($tempstr, 3, 15);
                        $tempdata['surelink'] = Mysite::$app->config['siteurl'] . '/index.php?controller=site&action=makeshow&id=' . $orderinfo['id'] . '&actime=' . $time . '&sign=' . $tempstr . '&status=1';
                        $tempdata['closelink'] = Mysite::$app->config['siteurl'] . '/index.php?controller=site&action=makeshow&id=' . $orderinfo['id'] . '&actime=' . $time . '&sign=' . $tempstr . '&status=2';
                        $emailcontent = Mysite::$app->statichtml($tpllist['emailorder'], $tempdata);
                        $title = '您有一笔' . Mysite::$app->config['sitename'] . '新订单,请尽快处理';
                        $info = $smtp->send($shopinfo['email'], Mysite::$app->config['emailname'], $title, $emailcontent, "", "HTML", "", "");
                    }
                } else {
                    logwrite('商家' . $shopinfo['shopname'] . '邮箱地址' . $shopinfo['shopemail'] . '错误');
                }
            }
        }
        $contents = '';
        if (Mysite::$app->config['allowedsendbuyer'] == 1) {
            if (IValidate::suremobi($orderinfo['buyerphone'])) {
                $default_tpl = new config('tplset.php', hopedir);
                $tpllist = $default_tpl->getInfo();
                if (!isset($tpllist['userbuytpl']) || empty($tpllist['userbuytpl'])) {
                    logwrite('短信发送会员模版失败');
                } else {
                    $contents = Mysite::$app->statichtml($tpllist['userbuytpl'], $tempdata);
                    if (Mysite::$app->config['smstype'] == 2) {
                        //139邮箱转发短信
                        //使用sms10086cn发送
                        $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                        $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $orderinfo['buyerphone'] . '&nr=' . urlencode($contents) . '&dxlbid=27';
                        $contentcccc = file_get_contents($weblink);
                        logwrite('短信sms10086cn发送结果:' . $contentcccc);
                    } else {
                        //使用sms10086cn发送
                        $phoneids = array();
                        $phoneids[] = $orderinfo['buyerphone'];
                        $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                        logwrite('亿美短信接口发送结果:' . $chekcinfo);
                    }
                    logwrite($contents);
                }
            }
        }
    }
コード例 #13
0
 public function run($setindex = '')
 {
     IUrl::beginUrl();
     $controller = IUrl::getInfo('controller');
     $action = IUrl::getInfo('action');
     $Taction = empty($action) ? $this->defaultAction : $action;
     $info = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
     $sitekey = isset($this->config['sitekey']) ? $this->config['sitekey'] : '';
     //if ($this->getkey() != $sitekey) {
     //	echo 'error! 关注好资源222-www.mx800.com';
     //	exit();
     //}
     /*
     		$hostcheck = array('wmr.xiaoshuhaochi.com', 'wmr.xiaoshuhaochi.com', 'xiaoshuhaochi.com');
     
     		if (!in_array($info, $hostcheck)) {
     			echo 'error! 关注好资源111-www.mx800.com';
     			exit();
     		}*/
     if ($controller === NULL) {
         $controller = $this->defaultController;
     }
     $this->controller = $controller;
     $this->Taction = $Taction;
     if ($controller == 'site' && $Taction == 'index') {
         if (is_mobile_request()) {
             $this->controller = 'html5';
         }
     }
     spl_autoload_register('Mysite::autoload');
     $filePath = hopedir . '/lib/Smarty/libs/Smarty.class.php';
     if (!class_exists('smarty')) {
         include_once $filePath;
     }
     if ($controller == 'adminpage') {
         $smarty = new Smarty();
         $smarty->assign('siteurl', Mysite::$app->config['siteurl']);
         $smarty->cache_lifetime = 0;
         $smarty->caching = false;
         $smarty->template_dir = hopedir . '/templates/';
         $smarty->compile_dir = hopedir . '/templates_c/adminpage';
         $smarty->cache_dir = hopedir . '/smarty_cache';
         $smarty->left_delimiter = '<{';
         $smarty->right_delimiter = '}>';
         $module = IUrl::getInfo('module');
         $module = empty($module) ? 'index' : $module;
         $doaction = Mysite::$app->getAction() == 'index' ? 'system' : Mysite::$app->getAction();
         $this->Taction = $doaction;
         $this->siteset();
         if (!file_exists(hopedir . '/module/' . Mysite::$app->getAction() . '/adminmethod.php')) {
         } else {
             include hopedir . '/module/' . Mysite::$app->getAction() . '/adminmethod.php';
             $method = new method();
             $method->init();
             if (method_exists($method, $module)) {
                 call_user_func(array($method, $module));
             }
         }
         $datas = $this->getdata();
         if (is_array($datas)) {
             foreach ($datas as $key => $value) {
                 $smarty->assign($key, $value);
             }
         }
         $nowID = ICookie::get('myaddress');
         $lng = ICookie::get('lng');
         $lat = ICookie::get('lat');
         $mapname = ICookie::get('mapname');
         $adminshopid = ICookie::get('adminshopid');
         $smarty->assign('myaddress', $nowID);
         $smarty->assign('mapname', $mapname);
         $smarty->assign('adminshopid', $adminshopid);
         $smarty->assign('lng', $lng);
         $smarty->assign('lat', $lat);
         $smarty->assign('controlname', Mysite::$app->getController());
         $smarty->assign('Taction', Mysite::$app->getAction());
         $smarty->assign('urlshort', Mysite::$app->getController() . '/' . Mysite::$app->getAction());
         $templtepach = hopedir . '/templates/adminpage/' . Mysite::$app->getAction() . '/' . $module . '.html';
         if (file_exists($templtepach)) {
         } else {
             if (file_exists(hopedir . '/module/' . Mysite::$app->getAction() . '/adminpage/' . $module . '.html')) {
                 $smarty->compile_dir = hopedir . '/templates_c/adminpage/' . Mysite::$app->getAction();
                 $templtepach = hopedir . '/module/' . Mysite::$app->getAction() . '/adminpage/' . $module . '.html';
             } else {
                 logwrite('模板不存在 ');
                 $smarty->assign('msg', '模板文件不存在');
                 $smarty->assign('sitetitle', '错误提示');
                 $errorlink = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
                 $smarty->assign('errorlink', $errorlink);
                 $templtepach = hopedir . '/templates/adminpage/public/error.html';
             }
         }
         $smarty->assign('tmodule', $module);
         $smarty->assign('tempdir', 'adminpage');
         $smarty->registerPlugin('function', 'ofunc', 'FUNC_function');
         $smarty->registerPlugin('block', 'oblock', 'FUNC_block');
         $smarty->display($templtepach);
         exit;
     } else {
         $smarty = new Smarty();
         $smarty->assign('siteurl', Mysite::$app->config['siteurl']);
         $smarty->cache_lifetime = 0;
         $smarty->caching = false;
         $smarty->template_dir = hopedir . '/templates';
         $smarty->compile_dir = hopedir . '/templates_c/' . Mysite::$app->config['sitetemp'];
         $smarty->cache_dir = hopedir . '/smarty_cache';
         $smarty->left_delimiter = '<{';
         $smarty->right_delimiter = '}>';
         $this->siteset();
         if (!file_exists(hopedir . 'module/' . Mysite::$app->getController() . '/method.php')) {
             $this->setController = 'site';
             $this->setAction = 'error';
         } else {
             include hopedir . 'module/' . Mysite::$app->getController() . '/method.php';
             $method = new method();
             $method->init();
             if (method_exists($method, $Taction)) {
                 call_user_func(array($method, $Taction));
             }
         }
         $datas = $this->getdata();
         if (is_array($datas)) {
             foreach ($datas as $key => $value) {
                 $smarty->assign($key, $value);
             }
         }
         $nowID = ICookie::get('myaddress');
         $lng = ICookie::get('lng');
         $lat = ICookie::get('lat');
         $mapname = ICookie::get('mapname');
         $adminshopid = ICookie::get('adminshopid');
         $smarty->assign('myaddress', $nowID);
         $smarty->assign('mapname', $mapname);
         $smarty->assign('adminshopid', $adminshopid);
         $smarty->assign('lng', $lng);
         $smarty->assign('lat', $lat);
         $smarty->assign('controlname', Mysite::$app->getController());
         $smarty->assign('Taction', Mysite::$app->getAction());
         $smarty->assign('urlshort', Mysite::$app->getController() . '/' . Mysite::$app->getAction());
         $templtepach = hopedir . '/templates/' . Mysite::$app->config['sitetemp'] . '/' . Mysite::$app->getController() . '/' . Mysite::$app->getAction() . '.html';
         if (file_exists($templtepach)) {
         } else {
             if (file_exists(hopedir . '/module/' . Mysite::$app->getController() . '/template/' . Mysite::$app->getAction() . '.html')) {
                 $smarty->compile_dir = hopedir . '/templates_c/system';
                 $templtepach = hopedir . '/module/' . Mysite::$app->getController() . '/template/' . Mysite::$app->getAction() . '.html';
             } else {
                 logwrite('模板不存在 ');
                 $smarty->assign('msg', '模板文件不存在');
                 $smarty->assign('sitetitle', '错误提示');
                 $errorlink = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
                 $smarty->assign('errorlink', $errorlink);
                 $templtepach = hopedir . '/templates/' . Mysite::$app->config['sitetemp'] . '/public/error.html';
             }
         }
         $smarty->assign('tempdir', Mysite::$app->config['sitetemp']);
         $smarty->registerPlugin('function', 'ofunc', 'FUNC_function');
         $smarty->registerPlugin('block', 'oblock', 'FUNC_block');
         $smarty->display($templtepach);
     }
 }
コード例 #14
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function apilogin()
 {
     //	$reload =  IFilter::act(IReq::get('reload'));
     logwrite('baoc');
     //	logwrite($reload);
     $links = empty($reload) ? IUrl::creatUrl('html5/index') : $reload;
     $openid = IFilter::act(IReq::get('openid'));
     //openid='.$this->obj->FromUserName.'&='.$time.'&=
     $actime = IFilter::act(IReq::get('actime'));
     $sign = IFilter::act(IReq::get('sign'));
     $mycode = Mysite::$app->config['wxtoken'];
     $checkstr = md5($mycode . $actime);
     $checkstr = substr($checkstr, 3, 15);
     logwrite('判断是否是微信openid:' . $openid . '##actime' . $actime . '#sign=' . $sign);
     if ($checkstr == $sign && !empty($openid)) {
         logwrite('报信微信用户信息' . '判断用户是否被添加到 数据');
         $checkinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "wxuser where openid ='" . $openid . "' ");
         if (!empty($checkinfo)) {
             ICookie::set('logintype', 'wx', 86400);
             ICookie::set('wxopenid', $openid, 86400);
             logwrite('报信微信用户信息' . $openid);
         }
     }
     echo 'xxxxxxxxxxx';
     exit;
     exit;
 }
コード例 #15
0
function resetsecurity($idx, $name = NULL)
{
    global $domoticzurl, $errors;
    $reply = json_decode(file_get_contents($domoticzurl . 'json.htm?type=command&param=resetsecuritystatus&idx=' . $idx . '&switchcmd=Normal'), true);
    if ($reply['status'] == 'OK') {
        $reply = 'OK';
    } else {
        $reply = 'ERROR';
        $errors = $errors + 1;
    }
    logwrite('Reset security status of  ' . $name . ' = ' . $reply);
    $actions = $actions + 1;
    usleep($Usleep);
    return $reply;
}
コード例 #16
0
$client = getClient();
$service = new Google_Service_Calendar($client);
$optParams = array('maxResults' => 5, 'orderBy' => 'startTime', 'singleEvents' => TRUE, 'timeMin' => date('c'));
$results = $service->events->listEvents($calendarId, $optParams);
if (count($results->getItems()) > 0) {
    foreach ($results->getItems() as $event) {
        if (isset($event->start->dateTime)) {
            $start = strtotime($event->start->dateTime);
        }
        if (empty($start)) {
            $start = strtotime($event->start->date);
        }
        $datetime = strftime("%a %e %b %k:%M:%S", $start);
        if ($start <= $vijfsec) {
            $user = '******';
            logwrite('GCal Event: ' . $event->getSummary() . ' at ' . $datetime);
            $item = explode(" ", $event->getSummary());
            $action = strtolower($item[0]);
            if ($action == "licht") {
                $action = "schakel";
            } else {
                if ($action == "dim") {
                    $action = "dimmer";
                } else {
                    if ($action == "opstaan") {
                        $action = "wake";
                    } else {
                        if ($action == "slaap") {
                            $action = "sleep";
                        }
                    }
コード例 #17
0
        if ($domoticzconnection == 2) {
            telegram('Geen verbinding met Domoticz');
        }
        if ($domoticzconnection == 4) {
            telegram('Domoticzonnection = ' . $domoticzconnection . ', restarting domoticz');
            telegram(shell_exec('/var/www/secure/restart_domoticz > /dev/null 2>&1 &'));
        } else {
            if ($domoticzconnection > 5) {
                telegram('Domoticzonnection = ' . $domoticzconnection . ', rebooting domoticz');
                telegram(shell_exec('/var/www/secure/reboot > /dev/null 2>&1 &'));
            }
        }
    }
}
if ($authenticated) {
    echo '<hr>Number of vars: ' . count(get_defined_vars()) . '<br/><pre>';
}
print_r(get_defined_vars());
echo '</pre>';
if ($actions >= 1) {
    if (isset($argv[1]) && $arg[1] == "All") {
        $msg = 'D' . number_format($domotime, 2) . '|P' . number_format($phptime, 2) . '|T' . number_format($execution, 2) . '|M' . $rpimem . '|C' . $rpicpu . '|E' . $errors . '|TE' . $totalerrors . '|' . $argv[1] . ' -> ' . $actions . ' actions';
    } else {
        if (isset($argv[1])) {
            $msg = 'D' . number_format($domotime, 2) . '|P' . number_format($phptime, 2) . '|T' . number_format($execution, 2) . '|E' . $errors . '|TE' . $totalerrors . '|' . $argv[1] . ' -> ' . $actions . ' actions';
        } else {
            $msg = 'D' . number_format($domotime, 2) . '|P' . number_format($phptime, 2) . '|T' . number_format($execution, 2) . '|E' . $errors . '|TE' . $totalerrors . ' -> ' . $actions . ' actions';
        }
    }
    logwrite($msg);
}
コード例 #18
0
ファイル: yprint.php プロジェクト: snamper/xiaoshuhaochi
<?php

/*
 * 采用单例模式,防止传输多个XML
 */
define('hopedir', dirname(__FILE__) . DIRECTORY_SEPARATOR);
$Mconfig = (include hopedir . "config/hopeconfig.php");
date_default_timezone_set("Asia/Hong_Kong");
include hopedir . '/lib/function.php';
include hopedir . '/wx/mysql_class.php';
header("Content-Type:text/html;charset=utf-8");
$Printer = NetPrinterClass::getInstance();
$mysql = new mysql_class();
logwrite('答应测试');
if (isset($Printer->params['id']) && isset($Printer->params['sta'])) {
    if ($Printer->checkinput()) {
        //  echo 'sign right';
        //  $this->mysql->update(Mysite::$app->config['tablepre'].'wxback',$data,"id='".$id."'");
        $orderid = $Printer->params['id'];
        //    usr=355841021188485&id=0003&ord=2&sta=0&sgn=E04A80BE97167584E7452FF54865171E
        if ($Printer->params['sta'] == 0) {
            if (!empty($orderid)) {
                $data['is_print'] = 1;
                $mysql->update($Mconfig['tablepre'] . 'order', $data, "id='" . $orderid . "'");
            }
        } else {
            $data['orderid'] = $orderid;
            $data['status'] = $Printer->params['sta'];
            $mysql->insert($Mconfig['tablepre'] . 'printlog', $data);
        }
    } else {
コード例 #19
0
ファイル: mysql_class.php プロジェクト: snamper/xiaoshuhaochi
 private function error($sql = "")
 {
     $error = "Mysql_error:" . mysql_error() . "(" . mysql_errno() . ")";
     $error .= $sql == "" ? "" : "Sql:'{$sql}'";
     logwrite($error);
     return false;
 }
コード例 #20
0
ファイル: method.php プロジェクト: snamper/xiaoshuhaochi
 function setphone()
 {
     $checksend = Mysite::$app->config['ordercheckphone'];
     if ($checksend == 1) {
         if (!empty($this->member['uid'])) {
             echo 'removesend()';
             exit;
         }
         $phone = IFilter::act(IReq::get('phone'));
         if (IValidate::suremobi($phone)) {
             $checkphone = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "mobile where phone ='" . $phone . "'   order by addtime desc limit 0,50");
             if (!empty($checkphone)) {
                 if ($checkphone['is_send'] == 1) {
                     echo 'removesend()';
                     exit;
                 }
                 $bijiaotime = time() - 180;
                 if ($checkphone['addtime'] > $bijiaotime) {
                     //验证码还有效
                     $backtime = 180 - (time() - $checkphone['addtime']);
                     ICookie::set('phonecode', $checkphone['code'], $backtime);
                     echo 'showsend(\'' . $phone . '\',' . $backtime . ')';
                     exit;
                 }
             }
             //重新发送验证码
             $data['code'] = mt_rand(10000, 99999);
             $data['phone'] = $phone;
             $data['addtime'] = time();
             $data['is_send'] = 0;
             ICookie::set('phonecode', $data['code'], 180);
             /*调用发送*/
             /* usercodetpl*/
             $default_tpl = new config('tplset.php', hopedir);
             $tpllist = $default_tpl->getInfo();
             if (!isset($tpllist['usercodetpl']) || empty($tpllist['usercodetpl'])) {
                 // logwrite('短信发送商家模板加载失败');
                 echo 'alert(\'发送失败,请联系管理员设置模板\')';
                 exit;
             } else {
                 $sendmobile = new mobile();
                 $tempdata['code'] = $data['code'];
                 $tempdata['sitename'] = Mysite::$app->config['sitename'];
                 $contents = Mysite::$app->statichtml($tpllist['usercodetpl'], $tempdata);
                 if (Mysite::$app->config['smstype'] == 2) {
                     //139邮箱转发短信
                     //使用sms10086cn发送/
                     $APIServer = 'http://www.sms-10086.cn/Service.asmx/sendsms?';
                     $weblink = $APIServer . 'zh=' . trim(Mysite::$app->config['sms86ac']) . '&mm=' . trim(Mysite::$app->config['sms86pd']) . '&hm=' . $phone . '&nr=' . urlencode($contents) . '&dxlbid=27';
                     $contentcccc = file_get_contents($weblink);
                     logwrite('验证短信发送:' . $contentcccc);
                 } else {
                     //使用sms10086cn发送/
                     $phoneids = array();
                     $phoneids[] = $phone;
                     $chekcinfo = $sendmobile->sendsms($phoneids, $contents);
                     logwrite('验证短信发送:' . $chekcinfo);
                 }
             }
             $this->mysql->insert(Mysite::$app->config['tablepre'] . 'mobile', $data);
             echo 'showsend(\'' . $phone . '\',180)';
             exit;
         } else {
             echo 'alert(\'不是手机号\')';
             exit;
         }
     } else {
         echo '';
         exit;
     }
 }
コード例 #21
0
ファイル: w.php プロジェクト: serj-43/db-script
        }
        if ($a == 0) {
            $skipped++;
        }
        if ($a == -1) {
            $errt = cmsg("WF_EX_FAIL");
            $ermsg = "{$a}<br>";
            $multicmd = "ignored";
        }
        if ($pr[12]) {
            if ($multicmd[0] = "\n") {
                $multicmd[0] = " ";
                $multicmd[1] = " ";
            }
            $act = "EXECUTE {$multicmd} ";
            logwrite($act);
        }
    }
    // логируемся
    if ($countqueries - 1 > 1) {
        echo "<br>" . cmsg(WF_SEND_SQL_E_T) . " " . ($cntque - 1 - $error) . "/" . ($countqueries - 1) . "<br>";
        if ($skipped) {
            echo cmsg("BCK_SKIP") . $skipped . "<br>";
        }
        if ($error) {
            echo cmsg("BCK_ERR") . $error . "<br>";
        }
    }
}
echo "</form>";
// конечный тег для всего
コード例 #22
0
ファイル: wx_b.php プロジェクト: snamper/xiaoshuhaochi
 public function __call($name, $arguments)
 {
     // Note: value of $name is case sensitive.
     logwrite("Calling object method" . $name . " ");
     $this->Rtext('未定义的操作');
 }
コード例 #23
0
    return $result;
}
function Zwavecancelaction()
{
    global $domoticzurl;
    $zwaveurl = $domoticzurl . 'ozwcp/admpost.html';
    $zwavedata = array('fun' => 'cancel');
    $zwaveoptions = array('http' => array('header' => 'Content-Type: application/x-www-form-urlencoded\\r\\n', 'method' => 'POST', 'content' => http_build_query($zwavedata)));
    $zwavecontext = stream_context_create($zwaveoptions);
    $result = file_get_contents($zwaveurl, false, $zwavecontext);
}
if (!empty($argv[1]) && !empty($argv[2])) {
    RefreshZwave2($argv[1], $argv[2]);
    //$mc->set('RefreshZwave'.$argv[1], $time);
} else {
    logwrite("RefreshZwave: no idx or name defined");
}
sleep(3);
if ($mc->get('deadnodes') < $eenmin) {
    foreach ($devices as $node => $data) {
        if ($node == "result") {
            foreach ($data as $index => $eltsNode) {
                if ($eltsNode["State"] == "Dead") {
                    telegram('Node ' . $eltsNode['NodeID'] . ' ' . $eltsNode['Description'] . ' (' . $eltsNode['Name'] . ') marked as dead, reviving ' . ZwaveHasnodefailed($eltsNode['NodeID']));
                    sleep(2);
                    Zwavecancelaction();
                    //shell_exec('/var/www/secure/reboot.sh');
                }
            }
        }
    }
コード例 #24
0
function resetsecurity($idx, $name = NULL)
{
    global $domoticzurl, $log, $actions;
    $reply = json_decode(curl($domoticzurl . 'json.htm?type=command&param=resetsecuritystatus&idx=' . $idx . '&switchcmd=Normal'), true);
    if ($reply['status'] == 'OK') {
        $reply = 'OK';
        $actions = $actions + 1;
    } else {
        $reply = 'ERROR';
    }
    if ($log) {
        logwrite('Reset security status of  ' . $name . ' = ' . $reply);
    }
    return $reply;
}