function handle($response)
{
    header('Content-type: application/json');
    $code = substr($response, 0, 4);
    $msg = substr($response, 4);
    if ($code === '0000') {
        SUCCESS($msg);
    } else {
        if ($msg == '') {
            switch (substr($code, 0, 2)) {
                case ERROR_SYSTEM:
                    $msg = 'System Error.';
                    break;
                case ERROR_INPUT:
                    $msg = '请检查输入!';
                    break;
                case ERROR_PERMISSION:
                    $msg = 'Permission Denied.';
                    break;
                default:
                    $msg = 'Error.';
                    break;
            }
        }
        ERROR($code, $msg);
    }
}
function handle($response)
{
    $code = substr($response, 0, 4);
    $msg = substr($response, 4);
    if ($code === '0000') {
        SUCCESS($msg);
    } else {
        if ($msg == '') {
            switch (substr($code, 0, 2)) {
                case ERROR_SYSTEM:
                    $msg = 'System Error.';
                    break;
                case ERROR_INPUT:
                    $msg = 'Param Error.';
                    break;
                case ERROR_PERMISSION:
                    $msg = 'Permission Denied.';
                    break;
                default:
                    $msg = 'Error.';
                    break;
            }
        }
        ERROR($code, $msg);
    }
}
Beispiel #3
0
 public function installed()
 {
     $re = $this->exists();
     if ($re) {
         return SUCCESS();
     } else {
         $table = $this->getTableName();
         return ERROR(-441, "NOT Installed. {$table} table does not exists.");
     }
 }
Beispiel #4
0
 /**
  *
  *
  * 데이터베이스 테이블이 존재하는지 하지 않는지 확인르 한다.
  *
  * @Attention 이 메소드는 언뜻 보기에는 해당 Entity 클래스가 존재하는지 확인하는 것 같지만, 사실은 데이터베이스 존재 여부만 확인을 한다.
  *
  *
  * @param $in
  * @return array
  *
  *
  * @usage php index.php "route=entity.Controller.exist&node=user"
  *
  */
 public function exist($in)
 {
     $tablename = null;
     if (isset($in['node'])) {
         $tablename = $in['node'] . "_node_entity";
     } else {
         if (isset($in['meta'])) {
             $tablename = $in['meta'] . "_meta_entity";
         } else {
             ERROR(-401, 'Wrong input');
         }
     }
     $re = parent::exists($tablename);
     if ($re) {
         return SUCCESS();
     } else {
         return ERROR(-402, "{$tablename} does not exists.");
     }
 }
Beispiel #5
0
Datei: d.php Projekt: nsdown/ffs
 static function siteBan($host, $file)
 {
     if (trim(SITEBAN_LIST) != "" && $_SERVER['HTTP_REFERER'] != "") {
         $urlarray = parse_url($_SERVER['HTTP_REFERER']);
         $url = $urlarray['host'];
         $sitelists = trim(SITEBAN_LIST);
         if (SITELIST_BAN == 0) {
             if (!strstr($sitelists, $url)) {
                 ERROR('访问出错', '此网站不允许直接连接本站文件!<br />点此重新提取文件:<a href="' . $host . '?/file/view-' . $file['id'] . '.html">' . $host . '?/file/view-' . $file['id'] . '.html</a>');
             }
         } else {
             if (strstr($sitelists, $url)) {
                 ERROR('访问出错', '此网站不允许直接连接本站文件!<br />点此重新提取文件:<a href="' . $host . '?/file/view-' . $file['id'] . '.html">' . $host . '?/file/view-' . $file['id'] . '.html</a>');
             }
         }
     }
 }
Beispiel #6
0
            }
            /*输出数据*/
            $sc = '';
            $resa = $res['data'];
            foreach ($resa as $key) {
                if (strlen($key['name']) >= 50) {
                    $key['name'] = CUT_STR($key['name'], 40);
                }
                $sc = $sc . '
			 <p class="filename"><a href="' . URL . '?/file/view-' . $key['id'] . '.html">' . str_replace(strtolower($str), '<span style=color:red>' . $str . '</span>', strtolower($key['name'])) . '</a></p>
			 <p class="fileinfo">分享码:' . $key['id'] . ' |文件类型:' . $key['type'] . ' | 文件大小:' . STR_FILESIZE($key['size']) . ' | 上传时间:' . date('Y-m-d h:i', $key['time']) . ' | 下载次数:' . $key['down'] . '</p>
			';
            }
            $FFS['html']['path'] = MOP . 'index.html';
            $FFS['html']['tag']['{html:title}'] = SITE_NAM . '-文件搜索';
            $FFS['html']['tag']['{html:keywords}'] = SITE_KEY;
            $FFS['html']['tag']['{html:des}'] = SITE_DES;
            $FFS['html']['tag']['{html:searchword}'] = $str;
            $FFS['html']['tag']['{html:tongji}'] = stripslashes(SITE_TONGJI);
            $FFS['html']['tag']['{html:ICP}'] = SITE_ICP;
            $FFS['html']['tag']['{html:filter}'] = '<a href="?/so/' . $str . '&page=1&type=">全部</a> | <a href="?/so/' . $str . '&page=1&type=txt">TXT</a> | <a href="?/so/' . $str . '&page=1&type=doc">DOC</a> | <a href="?/so/' . $str . '&page=1&type=zip">ZIP</a> | <a href="?/so/' . $str . '&page=1&type=rar">RAR</a>  | <a href="?/so/' . $str . '&page=1&type=jpg">JPG</a> | <a href="?/so/' . $str . '&page=1&type=mp3">MP3</a> | <a href="?/so/' . $str . '&page=1&type=torrent">TORRENT</a> | <a href="?/so/' . $str . '&page=1&type=exe">EXE</a>';
            $FFS['html']['tag']['{html:resc}'] = $resc;
            $FFS['html']['tag']['{html:search}'] = $sc;
            $FFS['html']['tag']['{html:pages}'] = $page_li;
            $FFS['html']['tag']['{html:nextpage}'] = $nextpage;
            $FFS['html']['tag']['{html:previouspage}'] = $previouspage;
        }
    } else {
        ERROR('运行提示', '当前系统核心版本过低,请升级到C-120226');
    }
}
Beispiel #7
0
          <td>' . date('Y-m-d H:i', $re['time']) . '</td>
		  <td>' . date('Y-m-d H:i', $re['last']) . '</td>
          <td>' . $re['down'] . '次</td>
        </tr>
';
                }
                $FFS['html']['tag']['{html:data}'] = !empty($_GET['data']) ? $_GET['data'] : '';
                $FFS['html']['tag']['{html:counts}'] = $resc;
                $FFS['html']['tag']['{html:filelist}'] = $filelist;
                $FFS['html']['tag']['{html:pages}'] = $page_li;
                $FFS['html']['tag']['{html:nextpage}'] = $nextpage;
                $FFS['html']['tag']['{html:previouspage}'] = $previouspage;
                if (!empty($_POST['files_del'])) {
                    if ($_POST['files_del']) {
                        $select = $_POST['select'];
                        if ($select != "") {
                            $del_num = count($select);
                            for ($i = 0; $i <= $del_num; $i++) {
                                FILE_DELETE($select[$i]);
                            }
                            STR_EDITNOTICE('Delete_Files_Is_Ok!');
                            FILE_MAKEDB();
                        }
                    }
                }
            }
        }
    } else {
        ERROR('运行提示', '当前系统核心版本过低,请升级到C-110924');
    }
}
Beispiel #8
0
 public function categoryDelete()
 {
     $id = hi('id');
     if (empty($id)) {
         return ERROR(-457, 'Input category id');
     }
     $c = category()->load($id);
     if (empty($c)) {
         return ERROR(-458, "Category by that id - {$id} does not exists.");
     }
     category()->load($id)->delete();
     return SUCCESS();
 }
Beispiel #9
0
                $FFS['html']['tag']['{html:pages}'] = $page_li;
                $FFS['html']['tag']['{html:nextpage}'] = $nextpage;
                $FFS['html']['tag']['{html:previouspage}'] = $previouspage;
            }
        } elseif (VAL == 'agreement.html') {
            $FFS['html']['path'] = ROT . 'app/index/agreement.html';
            $FFS['html']['tag']['{html:title}'] = '用户条款--' . SITE_NAM;
            $FFS['html']['tag']['{html:name}'] = SITE_NAM;
            $FFS['html']['tag']['{html:keywords}'] = SITE_KEY;
            $FFS['html']['tag']['{html:des}'] = SITE_DES;
            $FFS['html']['tag']['{html:tongji}'] = stripslashes(SITE_TONGJI);
            $FFS['html']['tag']['{html:ICP}'] = SITE_ICP;
            $FFS['html']['tag']['{html:reportKey}'] = "";
            $FFS['html']['tag']['{html:yourEmail}'] = !empty($_COOKIE['email']) ? $_COOKIE['email'] : '';
        } elseif (VAL == 'about.html') {
            $FFS['html']['path'] = ROT . 'app/index/about.html';
            $FFS['html']['tag']['{html:title}'] = '关于FFS-Mini在线分享--' . SITE_NAM;
            $FFS['html']['tag']['{html:name}'] = SITE_NAM;
            $FFS['html']['tag']['{html:keywords}'] = SITE_KEY;
            $FFS['html']['tag']['{html:des}'] = SITE_DES;
            $FFS['html']['tag']['{html:tongji}'] = stripslashes(SITE_TONGJI);
            $FFS['html']['tag']['{html:ICP}'] = SITE_ICP;
            $FFS['html']['tag']['{html:reportKey}'] = "";
            $FFS['html']['tag']['{html:yourEmail}'] = !empty($_COOKIE['email']) ? $_COOKIE['email'] : '';
        } else {
            ERROR('错误页面', '错误的页面访问');
        }
    } else {
        ERROR('运行提示', '当前系统核心版本过低,请升级到C-111022');
    }
}
Beispiel #10
0
        define('MOD', 'admin');
        define('VAL', 'index');
        define('MOP', ROT . 'app/admin/');
    }
}
if (stripos($_SERVER['QUERY_STRING'], '/') !== false) {
    $url_query = substr($_SERVER['QUERY_STRING'], 1);
    $url_query = explode('/', $url_query);
    define('MOD', $url_query[0]);
    define('VAL', $url_query[1]);
    define('MOP', ROT . "app/{$url_query[0]}/");
}
if (file_exists(MOP)) {
    include MOP . 'Engine.php';
} else {
    ERROR('出错啦!', '无效的访问请求,目标应用扩展不存在。');
}
/*举报*/
if (!empty($_POST['reportBtn'])) {
    $result = FILE_REPORT(trim($_POST['id']), trim($_POST['email']), $_POST['content']);
    setcookie('email', trim($_POST['email']));
    if ($result) {
        echo "<script type=\"text/javascript\">alert('举报成功,我们会尽快处理,感谢您的参与!');</script>";
        echo "<script type=\"text/javascript\">window.location.href='{$_SERVER['HTTP_REFERER']}';</script>";
    } else {
        echo "<script type=\"text/javascript\">alert('此文件已经被举报,我们正在处理,感谢您的参与!');</script>";
        echo "<script type=\"text/javascript\">window.location.href='{$_SERVER['HTTP_REFERER']}';</script>";
    }
}
/*页面输出判断*/
/*如果有页面输出,输出页面。*/
Beispiel #11
0
Datei: d.php Projekt: nsdown/ffs
            ERROR('提取错误啦', '只能分享MP3格式的文件哦!');
        } elseif ($info['size'] > PLAY_LIT * 1024 * 1024) {
            ERROR('提取错误啦', '目前只能分享小于' . STR_FILESIZE(PLAY_LIT * 1024 * 1024) . '的文件');
        } elseif ($maxtime < $gettime && $nowtime - $gettime > PLAY_LMT * 24 * 3600) {
            ERROR('该文件下载链接已过期', '<a href="' . URL . '?/mp/play-' . $id . '.html' . '">点击此处重新提取文件。</a>');
        } else {
            FILE_OUTPUT($info, PLAY_LSP);
        }
    } elseif (strpos($link[0], 'randomlist') === 0) {
        include 'app/mp/config.php';
        $nowtime = mktime();
        $gettime = substr($link[0], 10, 10);
        $id = explode('|', substr($link[0], 20, -4));
        shuffle($id);
        $maxtime = $nowtime + PLAY_DMT * 24 * 3600;
        $info = FILE_REINFO(strtoupper($id[0]));
        if ($info == false) {
            ERROR('提取错误啦', '该分享码无效或已被删除。');
        } elseif ($info['type'] != 'mp3') {
            ERROR('提取错误啦', '只能分享MP3格式的文件哦!');
        } elseif ($info['size'] > PLAY_LIT * 1024 * 1024) {
            ERROR('提取错误啦', '目前只能分享小于' . STR_FILESIZE(PLAY_LIT * 1024 * 1024) . '的文件');
        } elseif ($maxtime < $gettime && $nowtime - $gettime > PLAY_LMT * 24 * 3600) {
            ERROR('该文件下载链接已过期', '<a href="' . URL . '?/mp/play-' . $id . '.html' . '">点击此处重新提取文件。</a>');
        } else {
            FILE_OUTPUT($info, PLAY_LSP);
        }
    }
} else {
    header('location:index.php');
}
Beispiel #12
0
function SITE_CLOSE()
{
    if (SITE_CLOSE == 0) {
        ERROR('站点暂时关闭', SITE_CLOSE_REASON);
    }
}
        if (($sqlUser = @mysql_query('UPDATE `user`
			SET `level` = "' . $level . '"
			WHERE `uid` = "' . $uid . '";')) === false) {
            handle(ERROR_SYSTEM . '01');
        }
        handle('0000');
        break;
    case 'resetPassword':
        if (!checkAuthority(9)) {
            handle(ERROR_PERMISSION . '01');
        }
        $_p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        $currentUser = new User();
        $currentUser->uid = $uid = getRequest('uid');
        $username = json_decode($currentUser->getData(), true)['username'];
        $pwd = '';
        for ($_i = 0; $_i < 10; $_i++) {
            $pwd .= $_p[mt_rand(0, strlen($_p) - 1)];
        }
        $password = password_hash(md5($username . md5($pwd) . '.cc'), PASSWORD_BCRYPT);
        if (($sqlUser = @mysql_query('UPDATE `user`
			SET `password` = "' . $password . '"
			WHERE `uid` = "' . $uid . '";')) === false) {
            handle(ERROR_SYSTEM . '01');
        }
        handle('0000{"password":"******"}');
        break;
    default:
        ERROR(ERROR_INPUT . '02', 'Request Error.');
        break;
}
Beispiel #14
0
 function m_SAVE_EDIT()
 {
     if (!($batch_number = $_POST['batch_number'])) {
         return false;
     }
     //db();
     if (!($sql = mysql_query(" select * from epay where 1 and batch_number='{$batch_number}' limit 1 "))) {
         ERROR("Error in progress");
         return false;
     }
     if (mysql_num_rows($sql) != 1) {
         if (!($sql = mysql_query(" insert into epay (res_num,batch_number,memo,pay_from,pay_value,pay_date) values ('" . BRING_NEW_RES_NUM() . "','" . $_POST['batch_number'] . "','" . $_POST['memo'] . "','" . $_POST['pay_from'] . "','" . $_POST['pay_value'] . "','" . date("U") . "') "))) {
             ERROR("Error in progress");
             return false;
         }
     } else {
         if (!($sql2 = mysql_query(" update epay set\tpay_from='" . $_POST['pay_from'] . "', memo='" . $_POST['memo'] . "' where 1 and batch_number='{$batch_number}' limit 1 "))) {
             ERROR("Error in security:310");
             return false;
         }
     }
     return true;
 }
Beispiel #15
0
 public function editForm()
 {
     if (login()) {
         echo template('user', 'edit_form');
     } else {
         return ERROR(-40119, "Login first");
     }
 }
Beispiel #16
0
 public function fileDelete()
 {
     sys()->log("ajaxFileDelete() : id=" . $this->in['id']);
     $data = data($this->in['id']);
     if ($data) {
         if ($code = $data->delete()) {
             return ERROR($code, "failed to delete file");
         } else {
             return SUCCESS(array('id' => $this->in['id']));
         }
     } else {
         return ERROR(-4333, "Entity does not exists.");
     }
 }