-See : http://dev.euphorik.ch/wiki/euk/Home
\ No newline at end of file
+See : https://dev.euphorik.ch/projects/euk/wiki
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="ERLANG_MODULE" version="4">
- <component name="FacetManager">
- <facet type="erlang" name="Erlang">
- <configuration />
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- </content>
- <orderEntry type="jdk" jdkName="Erlang 17" jdkType="Erlang SDK" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
-</module>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="CompilerConfiguration">
- <option name="DEFAULT_COMPILER" value="Javac" />
- <resourceExtensions />
- <wildcardResourcePatterns>
- <entry name="!?*.java" />
- <entry name="!?*.form" />
- <entry name="!?*.class" />
- <entry name="!?*.groovy" />
- <entry name="!?*.scala" />
- <entry name="!?*.flex" />
- <entry name="!?*.kt" />
- <entry name="!?*.clj" />
- <entry name="!?*.aj" />
- </wildcardResourcePatterns>
- <annotationProcessing>
- <profile default="true" name="Default" enabled="false">
- <processorPath useClasspath="true" />
- </profile>
- </annotationProcessing>
- </component>
- <component name="CopyrightManager" default="" />
- <component name="DependencyValidationManager">
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
- </component>
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
- <component name="IdProvider" IDEtalkID="B6AEF54337EB68A2965D2FCB524498D7" />
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$//euphorik.iml" filepath="$PROJECT_DIR$//euphorik.iml" />
- </modules>
- </component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true">
- <output url="file://$PROJECT_DIR$/out" />
- </component>
- <component name="VcsDirectoryMappings">
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
- </component>
-</project>
\ No newline at end of file
<body>\r
<div id="container">\r
<erl>\r
- % permet de prédéfinir la "class" du logo pour un ekMaster...\r
+ % To redefine the logo class for the ekMasters.\r
out(A) ->\r
- Est_ek_master = euphorik_bd:is_ek_master_from_cookie(yaws_api:find_cookie_val("cookie", A)),\r
- {ehtml, {'div', [{id, "logo"}] ++ if Est_ek_master -> [{class, "ekMaster"}]; true -> [] end}}.\r
-\r
+ Is_ek_master = euphorik_bd:is_ek_master_from_cookie(yaws_api:find_cookie_val("cookie", A)),\r
+ {ehtml, {'div', [{id, "logo"}] ++ if Is_ek_master -> [{class, "ekMaster"}]; true -> [] end}}.\r
</erl>\r
<div id="info" style="display:none" ><div id="icone"></div><div class="close" ></div><div class="message" ></div><div class="buttons"></div></div>\r
<div id="waitbar" style="display:none" ><div class="image"></div></div>\r
<erl>\r
% parse les styles disponible\r
out(A) ->\r
- Stlyes_dir = A#arg.docroot ++ "/styles",\r
- {ok, Liste_dir} = file:list_dir(Stlyes_dir),\r
+ Styles_dir = A#arg.docroot ++ "/styles",\r
+ {ok, Liste_dir} = file:list_dir(Styles_dir),\r
{ehtml,\r
lists:foldr(\r
fun(Dir, Acc) ->\r
- case file:consult(Stlyes_dir ++ "/" ++ Dir ++ "/infos.txt") of\r
+ case file:consult(Styles_dir ++ "/" ++ Dir ++ "/infos.txt") of\r
{ok, [{nom, Nom}]} ->\r
[{option, [{value, Dir}], Nom} | Acc];\r
_ ->\r
// along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
/*jslint laxbreak:true */
-\r
+
// all euphorik is contained in this object
var euphorik = {};
// le main
$(document).ready(
- function() {
+ function() {
var fragment = new Fragment();
var formater = new euphorik.Formater();
- var util = new euphorik.Util(formater);
+ var util = new euphorik.Util(formater);
var communication = new euphorik.Communication(
function(data) { util.messageDialog(data.error_message); },
function() { util.showWaitBar(); },
);
var client = new euphorik.Client(util, communication);
var pages = new euphorik.Pages(fragment, communication);
-
+
// Client authentification with the cookie information (if it exists).
client.connectionCookie();
-
+
$("#menuCss").change(function() { client.setCss("styles/" + $("option:selected", this).attr("value") + "/euphorik.css"); });
- // FIXME : doesn't work under Opera
- // see : http://dev.jquery.com/ticket/2892#preview
$(window).unload(function() { client.flush(); });
-
+
$("#menu .minichat").click(function() { pages.displayPage("minichat"); });
$("#menu .admin").click(function() { pages.displayPage("admin"); });
$("#menu .profile").click(function() { pages.displayPage("profile"); });
});
$("#menu .register").click(function(){ pages.displayPage("register"); });
$("#menu .about").click(function(){ pages.displayPage("about"); });
-
- // TODO : simplification : such link[1] should be created and automatically open the right page without\r
- // explicitly add a page.\r
+
+ // TODO: simplification : such link[1] should be created and automatically open the right page without
+ // explicitly add a page.
// [1] : <a class="pageLink" href="termes_of_use">Terms of use</a>
$("#footer .termsOfUse").click(function(){ pages.displayPage("terms_of_use"); });
-
+
pages.addPage(new euphorik.PageMinichat(client, formater, util, communication), true);
pages.addPage(new euphorik.PageAdmin(client, formater, util, communication));
pages.addPage(new euphorik.PageProfile(client, formater, util));
pages.addPage(new euphorik.PageRegister(client, formater, util));
pages.addPage(new euphorik.PageAbout(client, formater, util, communication));
pages.addPage("terms_of_use");
-
+
pages.displayPage(); // display the default page
}
);
nouveau_user(Cookie, Profile) ->\r
F = fun() ->\r
Id = nouvel_id(user),\r
- User = #user{id = Id, cookie = Cookie, date_creation = now(), date_derniere_connexion = now(), profile = Profile},\r
+ User = #user{id = Id, cookie = Cookie, date_creation = erlang:timestamp(), date_derniere_connexion = erlang:timestamp(), profile = Profile},\r
mnesia:write(User),\r
User\r
end,\r
nouveau_user(Login, Password, Cookie, Profile) ->\r
F = fun() ->\r
Id = nouvel_id(user),\r
- User = #user{id = Id, cookie = Cookie, login = Login, password = Password, date_creation = now(), date_derniere_connexion = now(), profile = Profile#profile{pseudo = Login}},\r
+ User = #user{id = Id, cookie = Cookie, login = Login, password = Password, date_creation = erlang:timestamp(), date_derniere_connexion = erlang:timestamp(), profile = Profile#profile{pseudo = Login}},\r
mnesia:write(User),\r
User\r
end,\r
fun() ->\r
case mnesia:wread({user, User_id}) of\r
[User] ->\r
- mnesia:write(User#user{date_derniere_connexion = now()});\r
+ mnesia:write(User#user{date_derniere_connexion = erlang:timestamp()});\r
_ ->\r
mnesia:abort("update_date_derniere_connexion: User inconnu")\r
end\r
case mnesia:wread({user, Auteur_id}) of\r
[#user{profile = Profile} = Auteur] ->\r
% comparaison entre la date du dernier poste et maintenant (gestion du flood)\r
- Now = now(),\r
+ Now = erlang:timestamp(),\r
Delta = euphorik_common:delta_date_ms(Auteur#user.date_derniere_connexion, Now),\r
Nouvel_indice_flood = Auteur#user.indice_flood + if Delta =< ?DUREE_SPAM -> 2; true -> -1 end,\r
Auteur_maj = Auteur#user{\r
resultat_transaction(mnesia:transaction(\r
fun() ->\r
Id = nouvel_id(minichat),\r
- mnesia:write(#minichat{id = Id, auteur_id = 0, date = now(), pseudo = Profile#profile.pseudo, contenu = Mess, racine_id = Id}),\r
+ mnesia:write(#minichat{id = Id, auteur_id = 0, date = erlang:timestamp(), pseudo = Profile#profile.pseudo, contenu = Mess, racine_id = Id}),\r
Id\r
end\r
)).\r
list_ban() ->\r
resultat_transaction(mnesia:transaction(\r
fun() ->\r
- Now = now(),\r
+ Now = erlang:timestamp(),\r
e(qlc:keysort(1, q([\r
{\r
IP#ip_table.ip,\r
fun() ->\r
case mnesia:wread({ip_table, IP}) of\r
[IP_tuple] ->\r
- mnesia:write(IP_tuple#ip_table{ban = now(), ban_duration = Duration});\r
+ mnesia:write(IP_tuple#ip_table{ban = erlang:timestamp(), ban_duration = Duration});\r
_ ->\r
- mnesia:write(#ip_table{ip = IP, ban = now(), ban_duration = Duration})\r
+ mnesia:write(#ip_table{ip = IP, ban = erlang:timestamp(), ban_duration = Duration})\r
end\r
end\r
).\r
]), [{tmpdir, ?KEY_SORT_TEMP_DIR}]) of\r
[{Ban, Ban_duration}] ->\r
Echeance = date_plus_minutes(Ban, Ban_duration),\r
- Now = now(),\r
+ Now = erlang:timestamp(),\r
if Echeance < Now -> % l'échéance est passée\r
false;\r
true ->\r
)).\r
\r
\r
-% Ban est une date tel que retourner par now().\r
+% Ban est une date tel que retourner par erlang:timestamp().\r
% Ban_duration est un temps en minutes.\r
% retourne une date.\r
date_plus_minutes(Ban, Ban_duration) ->\r
fun() ->\r
case e(q([I || I <- mnesia:table(ip_table), I#ip_table.ip =:= IP]), [{tmpdir, ?KEY_SORT_TEMP_DIR}]) of\r
[] ->\r
- mnesia:write(#ip_table{ip = IP, date_last_try_register = now()}),\r
+ mnesia:write(#ip_table{ip = IP, date_last_try_register = erlang:timestamp()}),\r
true;\r
[T] ->\r
- Delta = euphorik_common:delta_date_ms(T#ip_table.date_last_try_register, now()),\r
+ Delta = euphorik_common:delta_date_ms(T#ip_table.date_last_try_register, erlang:timestamp()),\r
if T#ip_table.nb_try_register =:= ?NB_MAX_FLOOD_REGISTER, Delta < ?TEMPS_BAN_FLOOD_REGISTER ->\r
false;\r
true ->\r
mnesia:write(T#ip_table{\r
ip = IP,\r
- date_last_try_register = now(),\r
+ date_last_try_register = erlang:timestamp(),\r
nb_try_register = T#ip_table.nb_try_register + if Delta < ?TEMPS_FLOOD_REGISTER -> 1; T#ip_table.nb_try_register > 0 -> -1; true -> 0 end\r
}),\r
true\r
% crée l'utilisateur root\r
mnesia:transaction(fun() ->\r
mnesia:write(#proprietes{nom = version, valeur = ?VERSION_BD}),\r
- User = #user{id = 0, profile = #profile{pseudo = "Sys"}, login = "Sys", date_creation = now(), date_derniere_connexion = now(), ek_master = true},\r
+ User = #user{id = 0, profile = #profile{pseudo = "Sys"}, login = "Sys", date_creation = erlang:timestamp(), date_derniere_connexion = erlang:timestamp(), ek_master = true},\r
mnesia:write(User),\r
User\r
end),\r
end.
-% Retourne la difference entre deux timestamp (erlang:now()) en miliseconde
+% Retourne la difference entre deux timestamp (erlang:timestamp()) en miliseconde
delta_date_ms(D1, D2) ->
1000000000 * abs(element(1, D1) - element(1, D2)) + 1000 * abs(element(2, D1) - element(2, D2)) + trunc(abs(element(3, D1) - element(3, D2)) / 1000).
\r
% Renvoie un string() représentant un cookie en base 36. Il y a 10^32 possibillités.\r
generer_cookie() ->\r
- {A1, A2, A3} = now(),\r
+ {A1, A2, A3} = erlang:timestamp(),\r
random:seed(A1, A2, A3),\r
erlang:integer_to_list(random:uniform(trunc(math:pow(10, 32))), 36).\r
\r
mnesia:write(#minichat{\r
id = Id,\r
auteur_id = random:uniform(10000),\r
- date = now(),\r
+ date = erlang:timestamp(),\r
pseudo = "Test",\r
contenu = "Blabla blabla bla.",\r
racine_id = random:uniform(10000)\r
{\r
id, % integer\r
auteur_id, % -> #user.id\r
- date, % erlang:now()\r
+ date, % erlang:timestamp()\r
pseudo, % chaine de caractère\r
contenu, % chaine de caractère\r
racine_id = undefined, % la racine, par défaut correspond à l'id du message\r
login = [], % string()\r
password = [], % string() (md5)\r
profile = #profile{},\r
- date_creation, % erlang:now()\r
- date_derniere_connexion, % erlang:now(), est mis à jour lors de n'importe quelle activitée (envoie de message par exemple)\r
+ date_creation, % erlang:timestamp()\r
+ date_derniere_connexion, % erlang:timestamp(), est mis à jour lors de n'importe quelle activitée (envoie de message par exemple)\r
indice_flood = 0, % integer() est incrémenté lorsque l'utilisateur envoie trop rapidement des messages.\r
ek_master = false,\r
last_ip = undefined % integer(), undefined si inconnu\r
id,\r
id_user,\r
id_minichat = undefined, % l'id du message associé\r
- date_create, % erlang:now()\r
- date_post = undefined, % date à laquelle le troll est affiché sur la page principale. undefined initialement puis erlang:now() quand affiché\r
+ date_create, % erlang:timestamp()\r
+ date_post = undefined, % date à laquelle le troll est affiché sur la page principale. undefined initialement puis erlang:timestamp() quand affiché\r
content % chaine de caractère\r
}).\r
% le premier argument est le nom du noeud est peut valoir :
% - yaws : noeud de production
% - yaws_dev : noeud de pre-production
-main([Nom_node]) when Nom_node =:= "yaws"; Nom_node =:= "yaws_dev" ->
+main([Nom_node]) when Nom_node =:= "yaws"; Nom_node =:= "yaws_dev" ->
Node = list_to_atom(Nom_node ++ atom_to_list(hote())),
net_kernel:start([flynux, shortnames]),
io:format("rechargement des modules..~n"),
rpc:call(Node, mnesia, restore, [Fichier2, [{default_op, recreate_tables}]]),
rpc:call(yaws@overnux, file, delete, [Fichier]),
rpc:call(Node, file, delete, [Fichier2]).
-
\ No newline at end of file