viewgit/index.php:465 Only variables should be passed by reference [2048]
viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]
using System; using System.Data.SQLite; using System.Collections; namespace Dizzy { public class FileList { SQLiteConnection connection; public FileList() { string connectionString = "Data Source=" + GlobalConfig.ListFileName () + ";Version=3"; } public ArrayList Search(string keyword, string type, string user) { /* Facciamo qualche check per evitare utenti che inseriscono * cose a caso */ keyword.Replace("%", "\\%"); keyword.Replace(";", "\\;"); /* keyword è presumibilmente nella forma di più keyword separate da * spazi, e quindi dobbiamo sottoporla ad un "preprocessing" prima * di darla in pasto ad una query sql. Per ora assumiamo che l'utente * voglia l'unione dei risultati con le singole query. */ string [] keys = keyword.Split(' '); this.connection.Open (); // Eseguiamo la query SQLiteCommand sqlCmd = this.connection.CreateCommand (); string query = "SELECT * from files WHERE"; foreach(string k in keys) { if (query.EndsWith("'")) query += " OR name LIKE '%" + k + "%'"; else query += " name LIKE '%" + k + "%'"; } /* Concludiamo gloriosamente la query */ query += ";"; sqlCmd.CommandText = query; Log.Debug ("SQL", "Executing query " + sqlCmd.CommandText); SQLiteDataReader reader = sqlCmd.ExecuteReader (); File tmp; while(reader.Read()) { reader.GetString(2), // User reader.GetString(1), // Name reader.GetInt32(3)); // Size if ( (type == "Qualsiasi" || tmp.type.Name() == type) && (user == "" || user == tmp.user) ) { matches.Add (tmp); } } this.connection.Close (); return matches; } } }