EMS - snider59 - 07-10-2009
J'ai traduit ce mod !
Et pas a la légère ^^
Il permet d'ajouté une new en haut du forum !
RE: EMS - gronemo - 27-10-2009
Ok et bien merci =)
RE: EMS - Flopan - 24-11-2009
Citation :Please make sure IN_MYBB is defined."); } $plugins->add_hook("global_start", "EMS_globals"); $plugins->add_hook("admin_config_menu", "EMS_nav"); $plugins->add_hook("admin_config_action_handler", "EMS_actionhandler"); $plugins->add_hook("admin_load", "EMS_admin"); function ems_info() { return array( "name" => "Messages importants", "description" => "Il peux publier des messages en haut du forum avec 8 couleur.", "website" => "", "author" => "Nitemare et Traduit par binboum", "authorsite" => "", "version" => "4.1.3", "guid" => "", "compatibility" => "14*" ); } function EMS_install(){ global $db; $db->query("CREATE TABLE `".TABLE_PREFIX."ems` ( `eid` int(11) NOT NULL auto_increment, `message` varchar(255) NOT NULL, `type` varchar(100) NOT NULL, `index` tinyint(1) NOT NULL default '1', `author` int(10) NOT NULL, `created` int(25) NOT NULL, `order` smallint(10) NOT NULL default '1', PRIMARY KEY (`eid`) ) ENGINE=MyISAM"); $boardmsg_text_template = array( "title" => "boardmessage_styles", "template" => '', "sid" => "-1", ); $db->insert_query("templates", $boardmsg_text_template); } function EMS_is_installed() { global $db; if($db->table_exists("ems")){ return true; } return false; } function EMS_activate(){ require MYBB_ROOT.'/inc/adminfunctions_templates.php'; find_replace_templatesets( "header", '#'.preg_quote('').'#', '
{$messagestyle}{$boardmessage}' ); } function EMS_deactivate(){ require MYBB_ROOT.'/inc/adminfunctions_templates.php'; find_replace_templatesets( "header", '#'.preg_quote('
{$messagestyle}{$boardmessage}').'#', '', 0 ); } function EMS_uninstall() { global $db; $db->drop_table("ems"); $db->delete_query("templates", "title = 'boardmessage_styles'"); } function EMS_globals(){ global $db, $mybb, $templates, $boardmessage, $messagestyle; $query = $db->query("SELECT * FROM ".TABLE_PREFIX."ems ORDER BY `order` ASC"); $sql = Array(); While ($row = $db->fetch_array($query)){ $sql[]= $row; } $mess = $sql; if (count($mess) != 0 ){ for ($i=0; $i <= $db->num_rows($query)-1; $i++) { if ($mess[$i]['index'] == true){ if ($_SERVER['SCRIPT_FILENAME'] == MYBB_ROOT."index.php"){ $message = $message."
".$mess[$i]['message']."
"; } }else{ $message = $message."
".$mess[$i]['message']."
"; } } } eval("\$messagestyle = \"".$templates->get("boardmessage_styles")."\";"); $boardmessage = doEMSsmilies($message); } function doEMSsmilies($message, $url="") { global $db, $cache; if($url != "") { if(substr($url, strlen($url) -1) != "/") { $url = $url."/"; } } $smiliecache = $cache->read("smilies"); if(is_array($smiliecache)) { reset($smiliecache); foreach($smiliecache as $sid => $smilie) { $message = str_replace($smilie['find'], "".$smilie[", $message); } } return $message; } function EMS_nav($sub_menu){ $sub_menu[] = array( "id" => "ems", "title" => "EMS Alert", "link" => "index.php?module=config/ems" ); } function EMS_actionhandler(&$action) { $action['ems'] = array('active' => 'ems', 'file' => ''); } function EMS_admin(){ global $mybb, $db, $page, $lang; require_once("../inc/functions_time.php"); if($page->active_action != "ems") { return; } if ($mybb->input['add']){ $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); add_form(); $page->output_footer(); exit; }elseif ($mybb->input['do_add']){ $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); if (!$mybb->input['message']){ flash_message("Vous devez entrer un message", 'error'); add_form(); }elseif (!$mybb->input['type']){ flash_message("Vous devez s�lectionner un type de messages", 'error'); add_form($mybb->input['message']); }elseif (!$mybb->input['local']){ flash_message("Vous devez choisir un mod", 'error'); add_form($mybb->input['message']); }else{ if ($mybb->input['local'] == "index"){ $index = true; }else if ($mybb->input['local'] == "whole"){ $index = false; } $time = adodb_getdate(); $stuff = Array( "message" => $db->escape_string($mybb->input['message']), "type" => $mybb->input['type'], "order" => revert_nums($mybb->input['order']), "created" => $time[0], "index" => $index, "author" => $mybb->user['uid']); $db->insert_query("ems", $stuff); flash_message("Messages publier !", 'success'); admin_redirect("index.php?module=config/ems"); } $page->output_footer(); exit; }elseif ($mybb->input['edit']){ $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); edit_form(); $page->output_footer(); exit; }elseif ($mybb->input['do_edit']){ $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); if (!$mybb->input['message']){ flash_message("You must enter a message", 'error'); edit_form(); }elseif (!$mybb->input['type']){ flash_message("You must select an alert type", 'error'); edit_form(); }elseif (!$mybb->input['local']){ flash_message("You must select an alert location", 'error'); add_form($mybb->input['message']); }else{ if ($mybb->input['local'] == "index"){ $index = true; }else if ($mybb->input['local'] == "whole"){ $index = false; } $stuff = Array( "message" => $db->escape_string($mybb->input['message']), "order" => revert_nums($mybb->input['order']), "type" => $mybb->input['type'], "index" => $index); $db->update_query("ems", $stuff, "eid = '".$mybb->input['eid']."'"); flash_message("ID du messages:".$mybb->input['eid']." modification reussi", 'success'); admin_redirect("index.php?module=config/ems"); } $page->output_footer(); exit; }elseif ($mybb->input['delete']){ $query = $db->query("SELECT * FROM ".TABLE_PREFIX."ems WHERE eid = '".$mybb->input['eid']."'"); $message = $db->fetch_array($query); $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); $form = new Form("index.php?module=config/ems", "post"); $table = new Table; $table->construct_header("Delete Alert",array('class' => 'align_center', 'colspan' => 1)); $table->construct_cell("Voulez vous vraiment suppprimer le message acvec cette ID :".$message['eid']." and starting: ".turn($message['message']),array('class' => 'align_center')); $table->construct_row(); $table->construct_cell($form->generate_hidden_field('eid', $message['eid']). $form->generate_submit_button("Supprimer", array('name' => 'do_delete')) ." ". $form->generate_submit_button("Annuler", array('name' => 'cancel')) ,array('class' => 'align_center')); $table->construct_row(); $table->output("
Messages importants
"); $form->end(); $page->output_footer(); exit; }elseif ($mybb->input['do_delete']){ $db->delete_query("ems", "eid = '".$mybb->input['eid']."'"); flash_message("ID du messagages :".$mybb->input['eid']." suprimation reussi", 'success'); admin_redirect("index.php?module=config/ems"); }else{ $query = $db->query("SELECT * FROM ".TABLE_PREFIX."ems"); $sql = Array(); While ($row = $db->fetch_array($query)){ $sql[]= $row; } $mess = $sql; $page->add_breadcrumb_item("EMS system"); $page->output_header("EMS Alert system"); $table = new Table; $table->construct_header("Messages importants",array('class' => 'align_center', 'colspan' => 6)); $form = new Form("index.php?module=config/ems", "post"); $table->construct_cell("ID",array('class' => 'align_center','width' => '65')); $table->construct_cell("Messages",array('class' => 'align_center')); $table->construct_cell("Ordre", array('class' => 'align_center','width' => '100')); $table->construct_cell("Type", array('class' => 'align_center','width' => '100')); $table->construct_cell("creer", array('class' => 'align_center','width' => '175')); $table->construct_cell("Auteur", array('class' => 'align_center','width' => '250')); $table->construct_row(); for ($i = 0; $i <= count($mess)-1; $i++) { switch($mess[$i]['type']){ Case "yellow": $colour = "#FFF6BF"; break; Case "blue": $colour = "#ADCBE7"; break; Case "red": $colour = "#FFB2B2"; break; Case "green": $colour = "#D6ECA6"; break; Case "black": $colour = "#B2B2B2"; break; Case "purple": $colour = "#E0B2FF"; break; Case "orange": $colour = "#FFC57F"; break; Case "light_blue": $colour = "#9BFFFF"; break; } switch($mess[$i]['index']){ Case true: $index = "Pages acceuille"; break; Case false: $index = "Tout le site"; break; } $table->construct_cell($form->generate_radio_button("eid", $mess[$i]['eid'], $mess[$i]['eid']),array('class' => 'align_center','style' => 'background: '.$colour.';', 'width' => '75')); $table->construct_cell(doEMSsmilies($mess[$i]['message'],"../"),array('class' => 'align_center','style' => 'background: '.$colour.';')); $table->construct_cell($mess[$i]['order'],array('class' => 'align_center','style' => 'background: '.$colour.';')); $table->construct_cell(ucfirst($mess[$i]['type'])."
".$index,array('class' => 'align_center','style' => 'background: '.$colour.';','width' => '100')); $user = get_user($mess[$i]['author']); //adodb_date() //$mess[$i]['created'] $temp = adodb_getdate(); $table->construct_cell( adodb_date("d/m/Y h:i:s A",$mess[$i]['created']),array('class' => 'align_center','style' => 'background: '.$colour.';','width' => '175')); $table->construct_cell($user['username'],array('class' => 'align_center','style' => 'background: '.$colour.';','width' => '250')); $table->construct_row(); } $table->construct_cell( $form->generate_submit_button("Ajouter", array('name' => 'add')) ." ". $form->generate_submit_button("Modifier", array('name' => 'edit')) ." ". $form->generate_submit_button("Supprimer", array('name' => 'delete')) ,array('colspan' => '6','class' => 'align_center')); $table->construct_row(); $table->output("
Messages importants
"); $form->end(); $page->output_footer(); exit; } } function turn($data, $length="25"){ if (strlen($data) >= $length){ return substr($data,0,$length-3)."..."; }else{ return $data; } } function Add_form($message_text = ""){ global $db, $mybb, $page; $form = new Form("index.php?module=config/ems", "post"); $table = new Table; $table->construct_header("Ajoute un messages",array('class' => 'align_center', 'colspan' => 1)); $table->construct_cell($form->generate_text_area("message",$message_text),array('class' => 'align_center')); $table->construct_row(); $options = "Rouge"; $options .= "Bleu"; $options .= "Vert"; $options .= "Jaune"; $options .= "Noir"; $options .= "Violet"; $options .= "Orange"; $options .= "Bleu clair"; $table->construct_cell("Messages : ".$form->generate_radio_button("local","index","Pages acceuille",Array("checked" => 1))." ".$form->generate_radio_button("local","whole","Tout le site")."
Type de messages: Ordre: ",array('class' => 'align_center')); $table->construct_row(); $table->construct_cell( $form->generate_submit_button("Ajouter", array('name' => 'do_add')) ." ". $form->generate_reset_button("Annuler", array('name' => 'reset')) ,array('class' => 'align_center')); $table->construct_row(); $table->output("
Messages importants
"); $form->end(); } function edit_form(){ global $db, $mybb, $page; if (!$mybb->input['eid']){ flash_message("Vous devez s�lectionner une premier messages.", 'error'); admin_redirect("index.php?module=config/ems"); } $query = $db->query("SELECT * FROM ".TABLE_PREFIX."ems WHERE eid = '".$mybb->input['eid']."'"); $message = $db->fetch_array($query); $form = new Form("index.php?module=config/ems", "post"); $table = new Table; $table->construct_header("Modification ID : ".$mybb->input['eid'],array('class' => 'align_center', 'colspan' => 1)); $table->construct_cell($form->generate_text_area("message", $message['message']),array('class' => 'align_center')); $table->construct_row(); if ($message["type"] == "red"){ $options .= "Rouge"; }else{ $options .= "Rouge"; } if ($message["type"] == "blue"){ $options .= "Bleu"; }else{ $options .= "Bleu"; } if ($message["type"] == "green"){ $options .= "Vert"; }else{ $options .= "Vert"; } if ($message["type"] == "yellow"){ $options .= "Jaune"; }else{ $options .= "Jaune"; } if ($message["type"] == "black"){ $options .= "Noir"; }else{ $options .= "Noir"; } if ($message["type"] == "purple"){ $options .= "Violet"; }else{ $options .= "Violet"; } if ($message["type"] == "orange"){ $options .= "Orange"; }else{ $options .= "Orange"; } if ($message["type"] == "light_blue"){ $options .= "Bleu clair"; }else{ $options .= "Bleu clair"; } if ($message["index"] == true){ $radio1 = Array("checked" => 1); }else{ $radio2 = Array("checked" => 1); } $table->construct_cell("Messages ID: ".$form->generate_radio_button("local","index","Pages acceuille", $radio1)." ".$form->generate_radio_button("local","whole","Toute le site",$radio2)."
Type de messages: Ordre: ",array('class' => 'align_center')); $table->construct_row(); $table->construct_cell($form->generate_hidden_field('eid', $message['eid']). $form->generate_submit_button("Modifier", array('name' => 'do_edit')) ." ". $form->generate_reset_button("Annuler", array('name' => 'reset')) ,array('class' => 'align_center')); $table->construct_row(); $table->output("
Messages importants
"); $form->end(); } function select_order_options($premade = ""){ if ($premade == "1" || !$premade){ $options .= "1"; }else{ $options .= "1"; } if ($premade == "2"){ $options .= "2"; }else{ $options .= "2"; } if ($premade == "3"){ $options .= "3"; }else{ $options .= "3"; } if ($premade == "4"){ $options .= "4"; }else{ $options .= "4"; } if ($premade == "5"){ $options .= "5"; }else{ $options .= "5"; } if ($premade == "6"){ $options .= "6"; }else{ $options .= "6"; } if ($premade == "7"){ $options .= "7"; }else{ $options .= "7"; } if ($premade == "2"){ $options .= "8"; }else{ $options .= "8"; } if ($premade == "2"){ $options .= "9"; }else{ $options .= "9"; } if ($premade == "2"){ $options .= "10"; }else{ $options .= "10"; } return $options; } function revert_nums($value){ switch($value){ Case "one": $returner = "1"; break; Case "two": $returner = "2"; break; Case "three": $returner = "3"; break; Case "four": $returner = "4"; break; Case "five": $returner = "5"; break; Case "six": $returner = "6"; break; Case "seven": $returner = "7"; break; Case "eight": $returner = "8"; break; Case "nine": $returner = "9"; break; Case "ten": $returner = "10"; break; } return $returner; } ?>
ça me dit ça !
RE: EMS - norico - 28-11-2009
remplace <? par <?php
RE: EMS - lechtidu56 - 28-11-2009
Moi quand je met un message avec EMS ma shoutbox disparaît :p
Pourquoi ?
RE: EMS - Cacao741 - 05-12-2009
Salut à toussent,
Bon snider59 le copier coller sur google jolie mais se n'est pas comme sa que sa marchera !
Je ves le traduire !
J'éditerai quand jorai fini !!
Cordialement, Cacao741 and Drowba !
RE: EMS - IntoxX - 05-12-2009
à toussent ?
Houlà, j'aurai bien fais une traduction avec vérification orthographique mais je suis pris par le temps là :s
RE: EMS - snider59 - 22-12-2009
Le but c'est pas d'avoir un beaux module blabla...
Il est en francais c'est déja sa...
Personne le voie a par vous sa change quoi ?
RE: EMS - iPlay - 14-03-2010
Cacao741 a écrit :Salut à toussent,
Bon snider59 le copier coller sur google jolie mais se n'est pas comme sa que sa marchera !
Je ves le traduire !
J'éditerai quand jorai fini !!
Cordialement, Cacao741 and Drowba !
Oh My God :]
Merci du partage !
|