Пример #1
0
 public static string[,] getCatDbAry(string argGenre, int argLng, int argFid)
 {
     int num = argLng;
     int num2 = argFid;
     string str = argGenre;
     db db = new db();
     string[,] strArray = null;
     string str2 = cls.getString(jt.itake("global.config.sys->category-ndatabase", "cfg"));
     string argFpre = cls.getString(jt.itake("global.config.sys->category-nfpre", "cfg"));
     string argString = cls.cfnames(argFpre, "id");
     string str5 = string.Concat(new object[] {
         "select * from ", str2, " where ", cls.cfnames(argFpre, "hidden"), "=0 and ", cls.cfnames(argFpre, "lng"), "=", num, " and ", cls.cfnames(argFpre, "genre"), "='", str, "' and ", cls.cfnames(argFpre, "fid"), "=", num2,
         " order by ", cls.cfnames(argFpre, "order"), " asc"
      });
     object[] objArray = db.getDataAry(str5);
     if (objArray != null)
     {
         for (int i = 0; i < objArray.Length; i++)
         {
             object[,] argAry = (object[,]) objArray[i];
             int num4 = (int) db.getValue(argAry, argString);
             string[,] strArray2 = new string[,] { { cls.toString(db.getValue(argAry, argString)), cls.toString(db.getValue(argAry, cls.cfnames(argFpre, "topic"))), cls.toString(db.getValue(argAry, cls.cfnames(argFpre, "fid"))) } };
             strArray = cls.mergeAry(cls.mergeAry(strArray, strArray2), getCatDbAry(str, num, num4));
         }
     }
     return strArray;
 }
Пример #2
0
 public bool checkUsername(string argUserid, string argUsername, string argPassword)
 {
     bool flag = false;
     int num = cls.getNum(argUserid, -1);
     string str = cls.getSafeString(argUsername);
     string str2 = cls.getSafeString(argPassword);
     if (num != -1)
     {
         db db = new db();
         string str3 = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg"));
         string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg"));
         string str5 = cls.cfnames(argFpre, "id");
         string argString = string.Concat(new object[] { "select * from ", str3, " where ", str5, "=", num, " and ", cls.cfnames(argFpre, "lock"), "=0" });
         object[] objArray = db.getDataAry(argString);
         if (objArray == null)
         {
             return flag;
         }
         object[,] argAry = (object[,]) objArray[0];
         string str7 = (string) db.getValue(argAry, cls.cfnames(argFpre, "username"));
         string str8 = (string) db.getValue(argAry, cls.cfnames(argFpre, "password"));
         if ((str7 == str) && (str8 == str2))
         {
             flag = true;
         }
     }
     return flag;
 }
Пример #3
0
		// POST api/<controller>
		public IHttpActionResult Post([FromBody]Dictionary<string, object> value)
		{
			string sql = "INSERT INTO products ";
			string tbn = "";
			string val = "";
			foreach (var kv in value)
			{
				tbn += kv.Key + ",";
				Regex isNumeric = new Regex(@"^[\d\.]+$");
				if (isNumeric.IsMatch((string)kv.Value))
				{
					val += kv.Value + ",";
				}
				else
				{
					val += "'" + kv.Value + "',";
				}
			}
			sql += "(" + tbn.Substring(0, tbn.Length - 1) + ") VALUES (" + val.Substring(0, val.Length - 1) + ")";

			jtbc.db db = new jtbc.db(0, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/test.mdb;");
			int num = db.Insert(sql);

			Dictionary<string, object> ret = new Dictionary<string, object>();
			ret.Add("errorCode", num != 0 ? 0 : db.getRState());
			ret.Add("insertId", num);
			return Ok(ret);
		}
Пример #4
0
 public static void UpdateDatabaseNote(string argGenre, string argFilename, string argField, int argId)
 {
     string str = argGenre;
     string str2 = argFilename;
     string str3 = argField;
     int num = argId;
     db db = new db();
     string str4 = cls.getString(jt.itake("global.config.sys->upload-ndatabase", "cfg"));
     string argFpre = cls.getString(jt.itake("global.config.sys->upload-nfpre", "cfg"));
     string argString = string.Concat(new object[] {
         "update ", str4, " set ", cls.cfnames(argFpre, "valid"), "=0,", cls.cfnames(argFpre, "vlreason"), "=2 where ", cls.cfnames(argFpre, "fid"), "=", num, " and ", cls.cfnames(argFpre, "genre"), "='", str, "' and ", cls.cfnames(argFpre, "field"),
         "='", str3, "'"
      });
     db.Execute(argString);
     string[] strArray = str2.Split(new char[] { '|' });
     for (int i = 0; i < strArray.Length; i++)
     {
         string argObject = cls.getSafeString(strArray[i]);
         if (!cls.isEmpty(argObject))
         {
             db.Execute(string.Concat(new object[] {
                 "update ", str4, " set ", cls.cfnames(argFpre, "fid"), "=", num, ",", cls.cfnames(argFpre, "valid"), "=1 where ", cls.cfnames(argFpre, "genre"), "='", str, "' and ", cls.cfnames(argFpre, "field"), "='", str3,
                 "' and ", cls.cfnames(argFpre, "filename"), "='", argObject, "'"
              }));
         }
     }
 }
Пример #5
0
		// GET api/<controller>/<id>
		public IHttpActionResult GetProduct(int id)
		{
			jtbc.db db = new jtbc.db(0, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/test.mdb;");
			products = (Dictionary<string, object>[])db.getDataAry("select * from products where ID=" + id.ToString());

			Dictionary<string, object> ret = new Dictionary<string, object>();
			ret.Add("errorCode", 0);
			ret.Add("products", products);
			return Ok(ret);
		}
Пример #6
0
		// DELETE api/<controller>/<id>
		public IHttpActionResult Delete(int id)
		{
			jtbc.db db = new jtbc.db(0, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/test.mdb;");
			string sql = "DELETE FROM products WHERE ID=" + id.ToString();
			db.Execute(sql);

			Dictionary<string, object> ret = new Dictionary<string, object>();
			ret.Add("errorCode", 0);
			return Ok(ret);
		}
Пример #7
0
        public admin_plus(admin admin)
        {
            _admin = admin;
            _username = admin.username;
            _role = jt.itake(string.Format("global.{0}.user.user:sel_utype.{1}", config.adminFolder, _admin.popedom), "lng");

            string sql = "select a_lasttime, a_lastip from jtbc_admin where a_username = '******'";
            object[] data = new db().getDataAry(sql);
            if (data != null)
            {
                object[,] d = (object[,])data[0];
                _lastTime = ((DateTime)d[0, 1]).ToString();
                _lastIp = d[1, 1].ToString();
            }
        }
Пример #8
0
 public static int dataDelete(db argDb, string argDatabase, string argIdfield, string argId, string argOsql)
 {
     db db = argDb;
     string str = cls.getString(argDatabase);
     string str2 = cls.getString(argIdfield);
     string argString = cls.getString(argId);
     string argObject = cls.getString(argOsql);
     if (cls.cidary(argString))
     {
         string str5 = "delete from " + str + " where " + str2 + " in (" + argString + ")";
         if (!cls.isEmpty(argObject))
         {
             str5 = str5 + argObject;
         }
         return db.Executes(str5);
     }
     return -101;
 }
Пример #9
0
 public static int dataSwitch(db argDb, string argDatabase, string argField, string argIdfield, string argId, string argOsql)
 {
     db db = argDb;
     string str = cls.getString(argDatabase);
     string str2 = cls.getString(argField);
     string str3 = cls.getString(argIdfield);
     string argString = cls.getString(argId);
     string argObject = cls.getString(argOsql);
     if (cls.cidary(argString))
     {
         string str6 = "update " + str + " set " + str2 + "=abs(" + str2 + "-1) where " + str3 + " in (" + argString + ")";
         if (!cls.isEmpty(argObject))
         {
             str6 = str6 + argObject;
         }
         return db.Executes(str6);
     }
     return -101;
 }
Пример #10
0
 public bool ckLogin(string argUsername, string argPassword)
 {
     bool flag = true;
     if (cls.isEmpty(this.username) || cls.isEmpty(this.popedom))
     {
         db db = new db();
         string argObject = "";
         string str2 = cls.getSafeString(argUsername);
         string str3 = cls.getSafeString(argPassword);
         string str4 = cls.getString(jt.itake("global.config.admin-ndatabase", "cfg"));
         string argFpre = cls.getString(jt.itake("global.config.admin-nfpre", "cfg"));
         string argString = "select * from " + str4 + " where " + cls.cfnames(argFpre, "username") + "='" + str2 + "' and " + cls.cfnames(argFpre, "password") + "='" + str3 + "' and " + cls.cfnames(argFpre, "lock") + "=0";
         object[] objArray = db.getDataAry(argString);
         if (objArray != null)
         {
             object[,] argAry = (object[,]) objArray[0];
             int argValue = (int) db.getValue(argAry, cls.cfnames(argFpre, "id"));
             string str7 = (string) db.getValue(argAry, cls.cfnames(argFpre, "username"));
             string str8 = (string) db.getValue(argAry, cls.cfnames(argFpre, "password"));
             string str9 = (string) db.getValue(argAry, cls.cfnames(argFpre, "popedom"));
             session.set("admin-id", argValue);
             session.set("admin-username", str7);
             session.set("admin-popedom", str9);
             cookies.set("admin-username", str7);
             cookies.set("admin-password", str8);
             this.id = argValue;
             this.username = str7;
             this.popedom = str9;
             argObject = "update " + str4 + " set " + cls.cfnames(argFpre, "lasttime") + "='" + cls.getDate() + "'," + cls.cfnames(argFpre, "lastip") + "='" + request.ClientIP() + "' where " + cls.cfnames(argFpre, "username") + "='" + str2 + "'";
         }
         else
         {
             flag = false;
         }
         if (!cls.isEmpty(argObject))
         {
             db.Execute(argObject);
         }
     }
     return flag;
 }
Пример #11
0
 public bool ckLogins(string argUsername, string argPassword)
 {
     string str = argUsername;
     string argString = argPassword;
     this.username = "";
     this.popedom = "";
     session.remove("admin-id");
     session.remove("admin-username");
     session.remove("admin-popedom");
     bool flag = this.ckLogin(str, encode.md5(argString));
     int num = 0;
     if (!flag)
     {
         num = 1;
     }
     db db = new db();
     string str3 = cls.getString(jt.itake("global.config.admin-userlog-ndatabase", "cfg"));
     string argFpre = cls.getString(jt.itake("global.config.admin-userlog-nfpre", "cfg"));
     string str5 = string.Concat(new object[] {
         "insert into ", str3, " (", cls.cfnames(argFpre, "username"), ",", cls.cfnames(argFpre, "error"), ",", cls.cfnames(argFpre, "ip"), ",", cls.cfnames(argFpre, "time"), ") values ('", cls.getSafeString(str), "',", num, ",'", request.ClientIP(),
         "','", cls.getDate(), "')"
      });
     db.Execute(str5);
     return flag;
 }
Пример #12
0
        public void updateProperty(string argField, string argValue, string argType, string argUserId)
        {
            string argString = argField;
            string str2 = argValue;
            string str3 = argType;
            string str4 = argUserId;
            int argID = cls.getNum(str4, -1);
            if (argID != -1)
            {
                string argDatabase = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg"));
                string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg"));
                string str7 = cls.cfnames(argFpre, "id");
                db db = new db();
                switch (str3)
                {
                    case "0":
                        db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "=", cls.cfnames(argFpre, argString), "+", cls.getNum(str2, 0), " where ", str7, "=", argID }));
                        break;

                    case "1":
                        db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "=", cls.getNum(str2, 0), " where ", str7, "=", argID }));
                        break;

                    case "2":
                        db.Execute(string.Concat(new object[] { "update ", argDatabase, " set ", cls.cfnames(argFpre, argString), "='", encode.addslashes(str2), "' where ", str7, "=", argID }));
                        break;
                }
                dbcache.deleteCache(argDatabase, argFpre, argID);
            }
        }
Пример #13
0
 public static int dataDelete(db argDb, string argDatabase, string argIdfield, string argId)
 {
     return dataDelete(argDb, argDatabase, argIdfield, argId, "");
 }
Пример #14
0
 public static int getTopID(db argDb, string argDatabase, string argIdfield)
 {
     db db = argDb;
     string str = argDatabase;
     string str2 = argIdfield;
     int num = -1;
     string argString = "select max(" + str2 + ") from " + str;
     object[] objArray = db.getDataAry(argString);
     if (objArray != null)
     {
         num = cls.toInt32(db.getValue((object[,]) objArray[0], 0));
     }
     return num;
 }
Пример #15
0
        public static string itransferStandard(string argStrings)
        {
            int num7;
            object obj2;
            string argTemplate = "";
            string argString = argStrings;
            string argXInfostr = cls.getParameter(argString, "tpl");
            string argObject = cls.getParameter(argString, "tplid");
            string str8 = cls.getParameter(argString, "tplstr");
            string str9 = cls.getParameter(argString, "type");
            string ngenre = cls.getParameter(argString, "genre");
            string str11 = cls.getParameter(argString, "ndatabase");
            string str12 = cls.getParameter(argString, "nfpre");
            string str13 = cls.getParameter(argString, "osql");
            string str14 = cls.getParameter(argString, "osqlorder");
            string str15 = cls.getParameter(argString, "ocname");
            string str16 = cls.getParameter(argString, "ocmode");
            string str17 = cls.getParameter(argString, "rowfilter");
            string str18 = cls.getParameter(argString, "baseurl");
            string str19 = cls.getParameter(argString, "vars");
            int num = cls.getNum(cls.getParameter(argString, "topx"), -1);
            int num2 = cls.getNum(cls.getParameter(argString, "cls"), -1);
            int num3 = cls.getNum(cls.getParameter(argString, "class"), -1);
            int argLng = cls.getNum(cls.getParameter(argString, "lng"), -1);
            int num5 = cls.getNum(cls.getParameter(argString, "bid"), -1);
            int num6 = cls.getNum(config.dbtype, 0);
            if (argLng == -1)
            {
                argLng = cls.getNum(config.nlng, -1);
            }
            if (num <= 0)
            {
                return argTemplate;
            }
            if (cls.isEmpty(str18) && (!cls.isEmpty(ngenre) && (ngenre != config.ngenre)))
            {
                str18 = cls.getActualRoute(ngenre);
                if (cls.getRight(str18, 1) != "/")
                {
                    str18 = str18 + "/";
                }
            }
            if (cls.isEmpty(ngenre))
            {
                ngenre = config.ngenre;
            }
            string str20 = "";
            string argFpre = "";
            string str22 = "";
            if (!cls.isEmpty(str11))
            {
                str20 = cls.getString(str11);
                argFpre = cls.getString(str12);
            }
            else if (cls.isEmpty(str15))
            {
                str20 = cls.getString(jt.itake("global." + ngenre + ":config.ndatabase", "cfg"));
                argFpre = cls.getString(jt.itake("global." + ngenre + ":config.nfpre", "cfg"));
            }
            else
            {
                str20 = cls.getString(jt.itake("global." + ngenre + ":config.ndatabase-" + str15, "cfg"));
                argFpre = cls.getString(jt.itake("global." + ngenre + ":config.nfpre-" + str15, "cfg"));
            }
            str22 = cls.cfnames(argFpre, "id");
            if (cls.isEmpty(str20))
            {
                return argTemplate;
            }
            string str23 = "";
            string str24 = "";
            switch (str9)
            {
                case "new":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " desc";
                    break;

                case "-new":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " asc";
                    break;

                case "@new":
                    str23 = "select * from " + str20 + " where 1=1";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " desc";
                    break;

                case "top":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                    str24 = " order by " + str22 + " desc";
                    break;

                case "-top":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                    str24 = " order by " + str22 + " asc";
                    break;

                case "@top":
                    str23 = "select * from " + str20 + " where 1=1";
                    str24 = " order by " + str22 + " desc";
                    break;

                case "commendatory":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0 and " + cls.cfnames(argFpre, "commendatory") + "=1";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " desc";
                    break;

                case "-commendatory":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "hidden") + "=0 and " + cls.cfnames(argFpre, "commendatory") + "=1";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " asc";
                    break;

                case "@commendatory":
                    str23 = "select * from " + str20 + " where " + cls.cfnames(argFpre, "commendatory") + "=1";
                    str24 = " order by " + cls.cfnames(argFpre, "time") + " desc";
                    break;

                case "up":
                    str23 = string.Concat(new object[] { "select * from ", str20, " where ", cls.cfnames(argFpre, "hidden"), "=0 and ", str22, ">", num5 });
                    str24 = " order by " + str22 + " asc";
                    break;

                case "down":
                    str23 = string.Concat(new object[] { "select * from ", str20, " where ", cls.cfnames(argFpre, "hidden"), "=0 and ", str22, "<", num5 });
                    str24 = " order by " + str22 + " desc";
                    break;
            }
            if (num2 != -1)
            {
                string str25 = category.getClassChildIds(ngenre, argLng, cls.toString(num2));
                if (!cls.isEmpty(str25))
                {
                    string str29 = str23;
                    str23 = str29 + " and " + cls.cfnames(argFpre, "class") + " in (" + str25 + ")";
                }
            }
            if (num3 != -1)
            {
                obj2 = str23;
                str23 = string.Concat(new object[] { obj2, " and ", cls.cfnames(argFpre, "class"), "=", num3 });
            }
            if ((argLng != -1) && (argLng != -100))
            {
                obj2 = str23;
                str23 = string.Concat(new object[] { obj2, " and ", cls.cfnames(argFpre, "lng"), "=", argLng });
            }
            if (!cls.isEmpty(str13))
            {
                str23 = str23 + str13;
            }
            if (!cls.isEmpty(str14))
            {
                str24 = str14;
            }
            str23 = str23 + str24;
            if ((num6 >= 0) && (num6 < 10))
            {
                str23 = string.Concat(new object[] { "select top ", num, " *", cls.getLRStr(str23, "select *", "rightr") });
            }
            if ((num6 >= 10) && (num6 < 20))
            {
                str23 = str23 + " limit 0," + num;
            }
            if (!cls.isEmpty(str8))
            {
                argTemplate = str8;
            }
            else if (!cls.isEmpty(argObject))
            {
                string[,] strArray = getJtbcElement(argObject);
                if ((strArray != null) && (strArray.GetLength(1) == 2))
                {
                    argTemplate = strArray[0, 1];
                }
            }
            else if (argXInfostr.IndexOf(".") != -1)
            {
                argTemplate = jt.itake(argXInfostr, "tpl");
            }
            else
            {
                argTemplate = jt.itake("global.tpl_transfer." + argXInfostr, "tpl");
            }
            if (!cls.isEmpty(str19))
            {
                string[] strArray2 = str19.Split(new char[] { '|' });
                num7 = 0;
                while (num7 < strArray2.Length)
                {
                    string str26 = strArray2[num7];
                    if (!cls.isEmpty(str26))
                    {
                        string[] strArray3 = str26.Split(new char[] { '=' });
                        if (strArray3.Length == 2)
                        {
                            argTemplate = argTemplate.Replace("{$" + strArray3[0] + "}", strArray3[1]);
                        }
                    }
                    num7++;
                }
            }
            object[] objArray = new db().getDataAry(str23);
            if (objArray != null)
            {
                string newValue = "";
                int num8 = 0;
                string str2 = cls.ctemplate(ref argTemplate, "{@}");
                for (int i = 0; i < objArray.Length; i++)
                {
                    if (cls.isEmpty(str17) || !cls.cinstr(str17, cls.toString(i + 1), ","))
                    {
                        num8++;
                        string str4 = str2;
                        object[,] objArray2 = (object[,]) objArray[i];
                        num7 = 0;
                        while (num7 < objArray2.GetLength(0))
                        {
                            objArray2[num7, 0] = cls.getLRStr((string) objArray2[num7, 0], argFpre, "rightr");
                            str4 = str4.Replace("{$" + cls.toString(objArray2[num7, 0]) + "}", encode.htmlencode(cls.toString(objArray2[num7, 1]), "1"));
                            num7++;
                        }
                        config.rstAry = objArray2;
                        str4 = str4.Replace("{$-genre}", ngenre).Replace("{$-lng}", cls.toString(argLng)).Replace("{$-baseurl}", str18).Replace("{$-i}", cls.toString(num8));
                        for (num7 = 2; num7 < 7; num7++)
                        {
                            int num10 = num8 % num7;
                            str4 = str4.Replace("{$-!mod" + num7 + "}", cls.toString(num10));
                            if (num10 != 0)
                            {
                                str4 = str4.Replace("{$-!mod" + num7 + "-string}", "");
                            }
                            else
                            {
                                str4 = str4.Replace("{$-!mod" + num7 + "-string}", cls.toString(str16));
                            }
                        }
                        str4 = jt.creplace(str4);
                        newValue = newValue + str4;
                    }
                }
                argTemplate = argTemplate.Replace(config.jtbccinfo, newValue);
            }
            else
            {
                argTemplate = "";
            }
            return jt.creplace(argTemplate);
        }
Пример #16
0
 public static string itransferSQL(string argStrings)
 {
     int num;
     string argTemplate = "";
     string argString = argStrings;
     string argObject = cls.getParameter(argString, "sql");
     string argXInfostr = cls.getParameter(argString, "tpl");
     string str8 = cls.getParameter(argString, "tplid");
     string str9 = cls.getParameter(argString, "tplstr");
     string str10 = cls.getParameter(argString, "genre");
     string str11 = cls.getParameter(argString, "ocmode");
     string str12 = cls.getParameter(argString, "rowfilter");
     string str13 = cls.getParameter(argString, "baseurl");
     string str14 = cls.getParameter(argString, "vars");
     if (cls.isEmpty(argObject))
     {
         return argTemplate;
     }
     if (!(cls.getLRStr(argObject, " ", "left").ToLower() == "select"))
     {
         return argTemplate;
     }
     string str16 = argObject;
     string ngenre = config.ngenre;
     if (cls.isEmpty(str13) && (!cls.isEmpty(str10) && (str10 != ngenre)))
     {
         str13 = cls.getActualRoute(str10);
         if (cls.getRight(str13, 1) != "/")
         {
             str13 = str13 + "/";
         }
     }
     if (cls.isEmpty(str10))
     {
         str10 = ngenre;
     }
     if (!cls.isEmpty(str9))
     {
         argTemplate = str9;
     }
     else if (!cls.isEmpty(str8))
     {
         string[,] strArray = getJtbcElement(str8);
         if ((strArray != null) && (strArray.GetLength(1) == 2))
         {
             argTemplate = strArray[0, 1];
         }
     }
     else if (argXInfostr.IndexOf(".") != -1)
     {
         argTemplate = jt.itake(argXInfostr, "tpl");
     }
     else
     {
         argTemplate = jt.itake("global.tpl_transfer." + argXInfostr, "tpl");
     }
     if (!cls.isEmpty(str14))
     {
         string[] strArray2 = str14.Split(new char[] { '|' });
         num = 0;
         while (num < strArray2.Length)
         {
             string str18 = strArray2[num];
             if (!cls.isEmpty(str18))
             {
                 string[] strArray3 = str18.Split(new char[] { '=' });
                 if (strArray3.Length == 2)
                 {
                     argTemplate = argTemplate.Replace("{$" + strArray3[0] + "}", strArray3[1]);
                 }
             }
             num++;
         }
     }
     object[] objArray = new db().getDataAry(str16);
     if (objArray != null)
     {
         string newValue = "";
         int num2 = 0;
         string str2 = cls.ctemplate(ref argTemplate, "{@}");
         for (int i = 0; i < objArray.Length; i++)
         {
             if (cls.isEmpty(str12) || !cls.cinstr(str12, cls.toString(i + 1), ","))
             {
                 num2++;
                 string str4 = str2;
                 object[,] objArray2 = (object[,]) objArray[i];
                 num = 0;
                 while (num < objArray2.GetLength(0))
                 {
                     str4 = str4.Replace("{$" + cls.toString(objArray2[num, 0]) + "}", encode.htmlencode(cls.toString(objArray2[num, 1]), "1"));
                     num++;
                 }
                 config.rstAry = objArray2;
                 str4 = str4.Replace("{$-genre}", str10).Replace("{$-baseurl}", str13).Replace("{$-i}", cls.toString(num2));
                 for (num = 2; num < 7; num++)
                 {
                     int num4 = num2 % num;
                     str4 = str4.Replace("{$-!mod" + num + "}", cls.toString(num4));
                     if (num4 != 0)
                     {
                         str4 = str4.Replace("{$-!mod" + num + "-string}", "");
                     }
                     else
                     {
                         str4 = str4.Replace("{$-!mod" + num + "-string}", cls.toString(str11));
                     }
                 }
                 str4 = jt.creplace(str4);
                 newValue = newValue + str4;
             }
         }
         argTemplate = argTemplate.Replace(config.jtbccinfo, newValue);
     }
     else
     {
         argTemplate = "";
     }
     return jt.creplace(argTemplate);
 }
Пример #17
0
 public static int dataSwitch(db argDb, string argDatabase, string argField, string argIdfield, string argId)
 {
     return dataSwitch(argDb, argDatabase, argField, argIdfield, argId, "");
 }
Пример #18
0
 public bool Login(string argUsername, string argPassword, string argRemember)
 {
     bool flag = false;
     this.Logout();
     string argValue = cls.getSafeString(argUsername);
     string str2 = encode.md5(cls.getSafeString(argPassword));
     int num = cls.getNum(argRemember, 0);
     db db = new db();
     string str3 = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg"));
     string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg"));
     string argString = cls.cfnames(argFpre, "id");
     string str6 = "select * from " + str3 + " where " + cls.cfnames(argFpre, "username") + "='" + argValue + "' and " + cls.cfnames(argFpre, "password") + "='" + str2 + "' and " + cls.cfnames(argFpre, "lock") + "=0";
     object[] objArray = db.getDataAry(str6);
     if (objArray == null)
     {
         return flag;
     }
     object[,] argAry = (object[,]) objArray[0];
     string str7 = cls.toString(db.getValue(argAry, argString));
     if (num == 0)
     {
         cookies.set(this.ngenre + "-userid", str7);
         cookies.set(this.ngenre + "-username", argValue);
         cookies.set(this.ngenre + "-password", str2);
     }
     else
     {
         cookies.set(this.ngenre + "-userid", str7, 0x1e13380);
         cookies.set(this.ngenre + "-username", argValue, 0x1e13380);
         cookies.set(this.ngenre + "-password", str2, 0x1e13380);
     }
     session.set(this.ngenre + "-nuserid", str7);
     session.set(this.ngenre + "-nusername", argValue);
     db.Execute("update " + str3 + " set " + cls.cfnames(argFpre, "prelasttime") + "=" + cls.cfnames(argFpre, "lasttime") + " where " + argString + "=" + str7);
     db.Execute("update " + str3 + " set " + cls.cfnames(argFpre, "lasttime") + "='" + cls.getDate() + "' where " + argString + "=" + str7);
     return true;
 }
Пример #19
0
		// GET api/<controller>
		public IHttpActionResult GetAllUsers()
		{
			jtbc.db db = new jtbc.db(0, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/test.mdb;");
			users = (Dictionary<string, object>[])db.getDataAry("select * from users");

			Dictionary<string, object> ret = new Dictionary<string, object>();
			ret.Add("errorCode", 0);
			ret.Add("users", users);
			return Ok(ret);
		}
Пример #20
0
 public static object[,] getDBAry(string argDatabase, string argFPre, int argID)
 {
     object[,] objArray = null;
     string str = cls.getString(argDatabase);
     string argFpre = cls.getString(argFPre);
     int num = argID;
     db db = new db();
     string argString = string.Concat(new object[] { "select * from ", str, " where ", cls.cfnames(argFpre, "id"), "=", num });
     object[] objArray2 = db.getDataAry(argString);
     if (objArray2 != null)
     {
         objArray = (object[,]) objArray2[0];
     }
     return objArray;
 }
Пример #21
0
        public static string itransferMultiGenre(string argStrings)
        {
            int num6;
            string argTemplate = "";
            string argString = argStrings;
            string argXInfostr = cls.getParameter(argString, "tpl");
            string argObject = cls.getParameter(argString, "tplid");
            string str8 = cls.getParameter(argString, "tplstr");
            string str9 = cls.getParameter(argString, "type");
            string str10 = cls.getParameter(argString, "genre");
            string str11 = cls.getParameter(argString, "field");
            string str12 = cls.getParameter(argString, "osql");
            string str13 = cls.getParameter(argString, "osqlorder");
            string str14 = cls.getParameter(argString, "ocmode");
            string str15 = cls.getParameter(argString, "rowfilter");
            string str16 = cls.getParameter(argString, "baseurl");
            string str17 = cls.getParameter(argString, "vars");
            int num = cls.getNum(cls.getParameter(argString, "topx"), -1);
            int num2 = cls.getNum(cls.getParameter(argString, "lng"), -1);
            int num3 = cls.getNum(config.dbtype, 0);
            if (num2 == -1)
            {
                num2 = cls.getNum(config.nlng, -1);
            }
            if (num <= 0)
            {
                return argTemplate;
            }
            string ngenre = config.ngenre;
            if (cls.isEmpty(str10))
            {
                return argTemplate;
            }
            string str19 = "";
            string str20 = "";
            str19 = str19 + "select * from (";
            foreach (string str21 in str10.Split(new char[] { '&' }))
            {
                string str22 = cls.getString(jt.itake("global." + str21 + ":config.ndatabase", "cfg"));
                string argFpre = cls.getString(jt.itake("global." + str21 + ":config.nfpre", "cfg"));
                if (!cls.isEmpty(str22))
                {
                    string str29;
                    str19 = str19 + "select " + cls.cfnames(argFpre, "id") + " as un_id,";
                    foreach (string str24 in str11.Split(new char[] { '&' }))
                    {
                        str29 = str19;
                        str19 = str29 + cls.cfnames(argFpre, str24) + " as un_" + str24 + ",";
                    }
                    str29 = str19;
                    str19 = str29 + cls.cfnames(argFpre, "time") + " as un_time, '" + str21 + "' as un_genre from " + str22;
                    switch (str9)
                    {
                        case "new":
                            str19 = str19 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                            str20 = " order by un_time desc";
                            break;

                        case "-new":
                            str19 = str19 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                            str20 = " order by un_time desc";
                            break;

                        case "@new":
                            str19 = str19 + " where 1=1";
                            str20 = " order by un_time desc";
                            break;

                        case "commendatory":
                            str29 = str19;
                            str19 = str29 + " where " + cls.cfnames(argFpre, "hidden") + "=0 and " + cls.cfnames(argFpre, "commendatory") + "=1";
                            str20 = " order by un_time desc";
                            break;

                        case "-commendatory":
                            str29 = str19;
                            str19 = str29 + " where " + cls.cfnames(argFpre, "hidden") + "=0 and " + cls.cfnames(argFpre, "commendatory") + "=1";
                            str20 = " order by un_time desc";
                            break;

                        case "@commendatory":
                            str19 = str19 + " where " + cls.cfnames(argFpre, "commendatory") + "=1";
                            str20 = " order by un_time desc";
                            break;

                        default:
                            str19 = str19 + " where " + cls.cfnames(argFpre, "hidden") + "=0";
                            str20 = " order by un_time desc";
                            break;
                    }
                    if ((num2 != -1) && (num2 != -100))
                    {
                        object obj2 = str19;
                        str19 = string.Concat(new object[] { obj2, " and ", cls.cfnames(argFpre, "lng"), "=", num2 });
                    }
                    str19 = str19 + " union all ";
                }
            }
            if (str19.IndexOf(" union all ") != -1)
            {
                str19 = cls.getLRStr(str19, " union all ", "leftr");
            }
            str19 = str19 + ") t1 where 1=1";
            if (!cls.isEmpty(str12))
            {
                str19 = str19 + str12;
            }
            if (!cls.isEmpty(str13))
            {
                str20 = str13;
            }
            str19 = str19 + str20;
            if ((num3 >= 0) && (num3 < 10))
            {
                str19 = string.Concat(new object[] { "select top ", num, " *", cls.getLRStr(str19, "select *", "rightr") });
            }
            if ((num3 >= 10) && (num3 < 20))
            {
                str19 = str19 + " limit 0," + num;
            }
            if (!cls.isEmpty(str8))
            {
                argTemplate = str8;
            }
            else if (!cls.isEmpty(argObject))
            {
                string[,] strArray3 = getJtbcElement(argObject);
                if ((strArray3 != null) && (strArray3.GetLength(1) == 2))
                {
                    argTemplate = strArray3[0, 1];
                }
            }
            else if (argXInfostr.IndexOf(".") != -1)
            {
                argTemplate = jt.itake(argXInfostr, "tpl");
            }
            else
            {
                argTemplate = jt.itake("global.tpl_transfer." + argXInfostr, "tpl");
            }
            if (!cls.isEmpty(str17))
            {
                string[] strArray4 = str17.Split(new char[] { '|' });
                num6 = 0;
                while (num6 < strArray4.Length)
                {
                    string str25 = strArray4[num6];
                    if (!cls.isEmpty(str25))
                    {
                        string[] strArray5 = str25.Split(new char[] { '=' });
                        if (strArray5.Length == 2)
                        {
                            argTemplate = argTemplate.Replace("{$" + strArray5[0] + "}", strArray5[1]);
                        }
                    }
                    num6++;
                }
            }
            db db = new db();
            object[] objArray = db.getDataAry(str19);
            if (objArray != null)
            {
                string newValue = "";
                int num7 = 0;
                string str2 = cls.ctemplate(ref argTemplate, "{@}");
                for (int i = 0; i < objArray.Length; i++)
                {
                    if (cls.isEmpty(str15) || !cls.cinstr(str15, cls.toString(i + 1), ","))
                    {
                        num7++;
                        string str4 = str2;
                        object[,] argAry = (object[,]) objArray[i];
                        num6 = 0;
                        while (num6 < argAry.GetLength(0))
                        {
                            argAry[num6, 0] = cls.getLRStr((string) argAry[num6, 0], "un_", "rightr");
                            str4 = str4.Replace("{$" + cls.toString(argAry[num6, 0]) + "}", encode.htmlencode(cls.toString(argAry[num6, 1]), "1"));
                            num6++;
                        }
                        config.rstAry = argAry;
                        string argRoutestr = cls.toString(db.getValue(argAry, "genre"));
                        string str27 = "";
                        if (!cls.isEmpty(str16))
                        {
                            str27 = str16;
                        }
                        else if (argRoutestr != ngenre)
                        {
                            str27 = cls.getActualRoute(argRoutestr);
                            if (cls.getRight(str27, 1) != "/")
                            {
                                str27 = str27 + "/";
                            }
                        }
                        str4 = str4.Replace("{$-genre}", encode.htmlencode(argRoutestr)).Replace("{$-baseurl}", str27).Replace("{$-i}", cls.toString(num7));
                        for (num6 = 2; num6 < 7; num6++)
                        {
                            int num9 = num7 % num6;
                            str4 = str4.Replace("{$-!mod" + num6 + "}", cls.toString(num9));
                            if (num9 != 0)
                            {
                                str4 = str4.Replace("{$-!mod" + num6 + "-string}", "");
                            }
                            else
                            {
                                str4 = str4.Replace("{$-!mod" + num6 + "-string}", cls.toString(str14));
                            }
                        }
                        str4 = jt.creplace(str4);
                        newValue = newValue + str4;
                    }
                }
                argTemplate = argTemplate.Replace(config.jtbccinfo, newValue);
            }
            else
            {
                argTemplate = "";
            }
            return jt.creplace(argTemplate);
        }
Пример #22
0
 public int getUserID(string argUsername)
 {
     int num = 0;
     string str = cls.getSafeString(argUsername);
     db db = new db();
     string str2 = cls.getString(jt.itake("global." + this.ngenre + ":config.ndatabase", "cfg"));
     string argFpre = cls.getString(jt.itake("global." + this.ngenre + ":config.nfpre", "cfg"));
     string argString = cls.cfnames(argFpre, "id");
     string str5 = "select * from " + str2 + " where " + cls.cfnames(argFpre, "username") + "='" + str + "'";
     object[] objArray = db.getDataAry(str5);
     if (objArray != null)
     {
         object[,] argAry = (object[,]) objArray[0];
         num = cls.toInt32(db.getValue(argAry, argString));
     }
     return num;
 }