Initial commit

This commit is contained in:
genuineparts 2025-06-02 10:01:12 +02:00
commit 43ad32700c
7085 changed files with 447606 additions and 0 deletions

View file

@ -0,0 +1,247 @@
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
global $cache;
require_once MYBB_ROOT."inc/plugins/achivements/include/hooks.php";
function achivements_info()
{
require_once MYBB_ROOT."inc/plugins/achivements/include/plugin.php";
return achivements_init_info();
}
function achivements_is_installed()
{
require_once MYBB_ROOT."inc/plugins/achivements/include/plugin.php";
return achivements_init_is_installed();
}
function achivements_install()
{
require_once MYBB_ROOT."inc/plugins/achivements/include/plugin.php";
achivements_init_install();
}
function achivements_uninstall()
{
require_once MYBB_ROOT."inc/plugins/achivements/include/plugin.php";
achivements_init_uninstall();
}
function extensions_add_settinggroup($name, $title, $description, $disporder)
{
global $db;
$setting_group = array(
'name' => 'groupsextensions_'.$db->escape_string($name),
'title' => $db->escape_string($title),
'description' => $db->escape_string($description),
'disporder' => $disporder,
'isdefault' => 0,
);
$db->insert_query('settinggroups', $setting_group);
$group = $db->insert_id();
return $group;
}
function extensions_add_settings($name, $title, $description, $optioncode, $value, $disporder, $group)
{
global $db;
$insert_array = array(
'name' => $db->escape_string($name),
'title' => $db->escape_string($title),
'description' => $db->escape_string($description),
'optionscode' => $db->escape_string($optioncode),
'value' => $db->escape_string($value),
'gid' => $group,
'disporder' => $disporder,
'isdefault' => 0,
);
$db->insert_query('settings', $insert_array);
}
function extensions_remove_settings($name)
{
global $db;
$db->delete_query("settings", "name LIKE '".$name."'");
}
function extensions_remove_templates($templates)
{
global $db;
if (!$templates)
{
return false;
}
return $db->delete_query('templates', "title IN (".$templates.")");
}
function extensions_add_template($name, $template)
{
global $db;
if (!$name || !$template)
return false;
$templateinsert = array(
"title" => $db->escape_string($name),
"template" => $db->escape_string($template),
"sid" => intval(-1)
);
return $db->insert_query("templates", $templateinsert);
}
function extensions_remove_settinggroup($name)
{
global $db;
$db->delete_query("settinggroups", "name='groupsextensions_".$name."'");
}
function extensions_lang($extension)
{
global $lang;
if ($extension == '')
return;
$lang->set_path(MYBB_ROOT."inc/plugins/achivements/extensions/languages");
$lang->load($extension);
$lang->set_path(MYBB_ROOT."inc/languages");
}
function get_achivements_posts()
{
global $db;
$posts = array();
$query = $db->simple_select('achivements_posts', '*', '', array('order_by' => 'apid', 'order_dir' => 'ASC'));
while($post = $db->fetch_array($query))
{
$posts[$post['apid']] = $post;
}
$db->free_result($query);
return $posts;
}
function get_achivements_threads()
{
global $db;
$threads = array();
$query = $db->simple_select('achivements_threads', '*', '', array('order_by' => 'atid', 'order_dir' => 'ASC'));
while($thread = $db->fetch_array($query))
{
$threads[$thread['atid']] = $thread;
}
$db->free_result($query);
return $threads;
}
function get_achivements_reputation()
{
global $db;
$reputations = array();
$query = $db->simple_select('achivements_reputation', '*', '', array('order_by' => 'arid', 'order_dir' => 'ASC'));
while($reputation = $db->fetch_array($query))
{
$reputations[$reputation['arid']] = $reputation;
}
$db->free_result($query);
return $reputations;
}
function get_achivements_timeonline()
{
global $db;
$timeonline = array();
$query = $db->simple_select('achivements_timeonline', '*', '', array('order_by' => 'toid', 'order_dir' => 'ASC'));
while($time = $db->fetch_array($query))
{
$timeonline[$time['toid']] = $time;
}
$db->free_result($query);
return $timeonline;
}
function get_achivements_regdate()
{
global $db;
$regdate = array();
$query = $db->simple_select('achivements_regdate', '*', '', array('order_by' => 'rgid', 'order_dir' => 'ASC'));
while($reg_date = $db->fetch_array($query))
{
$regdate[$reg_date['rgid']] = $reg_date;
}
$db->free_result($query);
return $regdate;
}
function get_achivements_custom()
{
global $db;
$customs = array();
$query = $db->simple_select('achivements_custom', '*', '', array('order_by' => 'acid', 'order_dir' => 'ASC'));
while($custom = $db->fetch_array($query))
{
$customs[$custom['acid']] = $custom;
}
$db->free_result($query);
return $customs;
}
function get_achivement_id($table='posts', $idtable='apid', $id)
{
global $db;
$query = $db->simple_select("achivements_{$table}", '*', "{$idtable}='{$id}'");
$result = $db->fetch_array($query);
return $result;
}
function achivements_get($orderdir='asc')
{
global $db;
static $get_achivements;
$tables_and_ids = array('posts' => 'apid', 'threads' => 'atid', 'reputation' => 'arid', 'timeonline' => 'toid', 'regdate' => 'rgid', 'custom' => 'acid');
$desc_by = array('posts', 'threads', 'reputation', 'timeonline', 'regdate', 'custom');
foreach ($desc_by as $tablas)
{
switch ($tablas)
{
case 'posts':
$order = array('order_by' => 'apid', 'order_dir' => $orderdir);
break;
case 'threads':
$order = array('order_by' => 'atid', 'order_dir' => $orderdir);
break;
case 'reputation':
$order = array('order_by' => 'arid', 'order_dir' => $orderdir);
break;
case 'timeonline':
$order = array('order_by' => 'toid', 'order_dir' => $orderdir);
break;
case 'regdate':
$order = array('order_by' => 'rgid', 'order_dir' => $orderdir);
break;
case 'custom':
$order = array('order_by' => 'acid', 'order_dir' => $orderdir);
break;
}
$query = $db->simple_select('achivements_'.$tablas, '*', '', $order);
while($achievement = $db->fetch_array($query))
{
$get_achivements[$tables_and_ids[$tablas]][$achievement[$tables_and_ids[$tablas]]] = $achievement;
}
}
return $get_achivements;
}
?>

View file

@ -0,0 +1,6 @@
<html>
<head>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,40 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: Forumrequirements.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['forumrequiements'] = "Forum Requirements";
$l['plugdes'] = "Allows access to X forums when you get the required achievements.";
$l['enable'] = "Enable extension?";
$l['enabledes'] = "Enable this extension in order to hide the forums.";
$l['message'] = "Error message";
$l['messagedes'] = "Write the error message appears when they can not see a forum because they have not met the required achievements. You can use <b>HTML</b>";
$l['valuemessage'] = "To view this forum need to gather the following achievements: <br />{achivements}";
//admin
$l['forums'] = "Forums";
$l['noforumexists'] = "The forum you selected does not exist.";
$l['achivementsrequestposts'] = "Achievements for Posts";
$l['achivementsrequestthreads'] = "Achievements for Threads";
$l['achivementsrequestreputations'] = "Achievements for Reputation";
$l['achivementsrequesttimeonline'] = "Achievements for Time Online";
$l['achivementsrequestregdate'] = "Achievements for Time Registered";
$l['achivementsrequestcustom'] = "Custom Achievements";
$l['achivementsrequestpostsdes'] = "Select the achievements of posts that users need to view this forum.";
$l['achivementsrequestthreadsdes'] = "Select the achievements of threads that users need to view this forum.";
$l['achivementsrequestreputationsdes'] = "Select the achievements of reputation that users need to view this forum.";
$l['achivementsrequesttimeonlinedes'] = "Select the achievements of time online that users need to view this forum.";
$l['achivementsrequestregdatedes'] = "Select the achievements of time registered that users need to view this forum.";
$l['achivementsrequestcustomdes'] = "Select Custom achievements users need to view this forum.";
$l['none'] = "None";
$l['success_update'] = "The forum has been updated successfully.";
$l['save'] = "Save";
?>

View file

@ -0,0 +1,15 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hello_world.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['hello_world'] = "Hello World";
$l['hello_world_extension_description'] = "A sample extension that prints hello world and prepends the content of each post to 'Hello world!'";
?>

View file

@ -0,0 +1,6 @@
<html>
<head>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,69 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: ranks.lang.php 2012-04-29 10:58Z EdsonOrdaz $
*/
$l['ranks'] = "Ranks";
$l['ranks_plug_description'] = "Add ranges for users to get certain achievements.";
$l['ranks_tab_des'] = "List of ranges. ranges shown by level up or down according to your configure it.";
//new rank
$l['newrank'] = "New Rank";
$l['newrank_tab_des'] = "Add a new range of achievements. achievements will be shown here created (posts achievements, issues, reputation, time online and time of registration, not custom achievements).";
$l['save'] = "Save";
$l['none'] = "None";
$l['nameofrank'] = "Name of rank";
$l['nameofrankdes'] = "Enter the name of the rank.";
$l['descriptionofrank'] = "Description";
$l['descriptionofrankdes'] = "Enter a description of this rank.";
$l['newrankpostsdes'] = "Select the achievement of posts that should be the user.";
$l['newrankthreadsdes'] = "Select the achievement of threads that should be the user.";
$l['newrankreputationdes'] = "Select the achievement of reputation that should be the user.";
$l['newranktimeonlinedes'] = "Select the achievement of time online that should be the user.";
$l['newrankregdatedes'] = "Select the achievement of time registered that should be the user.";
$l['imagedesnewrank'] = "Select the image you will be given as a range from your computer.";
$l['level'] = "Level";
$l['levelnewrank'] = "Enter the level you will have this range (the level can not be at zero level or be repeated).";
//validate and process rank
$l['notname'] = "You did not enter a rank name.";
$l['notdescription'] = "You must enter a description of the rank.";
$l['notlevel'] = "The level of the rank must be greater than zero.";
$l['notimage'] = "You have not selected an image from your computer.";
$l['repeatlevel'] = "The rank {1} already has the level {2}.";
$l['successnewrank'] = "The rank has been created successfully.";
$l['notcopyimage'] = "Unable to copy the image of the rank.";
$l['extnotvalidateimg'] = "Extension of the image is not valid.";
$l['notloadingimage'] = "Unable to load the image.";
//home ranks
$l['namedescription'] = "Name/Description";
$l['emptyranks'] = "There is no established range.";
$l['deletsuccessrank'] = "The rank was successfully deleted.";
$l['confirmdeleterankpoop'] = "Want to delete the range {1}?";
$l['successorderascdesc'] = "The ranges are shown by level of form {1}";
$l['asc'] = "ascendant";
$l['desc'] = "descending";
$l['showdesctable'] = "Display in descending order";
$l['showasctable'] = "View in ascending order";
//edit rank
$l['notexistrankedit'] = "There is no range selected.";
$l['imageactual'] = "Current picture";
$l['imageactualdes'] = "If you do not want to change this picture leaves the empty field below to maintain this image.";
$l['successeditrank'] = "The range has been edited successfully.";
$l['editrank'] = "Edit Rank";
$l['editrank_tab_des'] = "Edit the range changing its configuration. Run the task again to remove this range who do not bundle the achievements.";
?>

View file

@ -0,0 +1,43 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: threadbump.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['threadbump'] = "Thread Bump";
$l['threadbumpplugdes'] = "Allows bump threads every 24 hours.";
$l['enable'] = "Enable Extension?";
$l['enabledes'] = "Selects whether the extension will be activated to make bumps in threads.";
$l['message'] = "Error message from achievements";
$l['messagedes'] = "Write the error message appear when they bump can not do because they lack the required achievements. You can use <b>HTML</b>";
$l['valuemessage'] = "Bump need to make together the following achievements: <br />{achivements}";
$l['messagetime'] = "Time error message";
$l['messagetimedes'] = "Write the error message appears when they can not do because I did bump within 24 hours. You can use <b>HTML</b>";
$l['notbumpthread_time'] = "You can not bump into 2 or more items within 24 hours, waiting for the day {datetime} to bump.";
$l['achivementsrequestposts'] = "Achievements for Posts";
$l['achivementsrequestthreads'] = "Achievements for Threads";
$l['achivementsrequestreputations'] = "Achievements for Reputation";
$l['achivementsrequesttimeonline'] = "Achievements for Time Online";
$l['achivementsrequestregdate'] = "Achievements for Time Registered";
$l['achivementsrequestpostsdes'] = "Select the achievements of posts that users need to make bump.";
$l['achivementsrequestthreadsdes'] = "Select the achievements of threads that users need to make bump.";
$l['achivementsrequestreputationsdes'] = "Select the achievements of reputation that users need to make bump.";
$l['achivementsrequesttimeonlinedes'] = "Select the achievements of time online that users need to make bump.";
$l['achivementsrequestregdatedes'] = "Select the achievements of time registered that users need to make bump.";
$l['none'] = "None";
$l['save'] = "Save";
$l['success_update'] = "Data saved successfully.";
$l['bumpsuccess'] = "The issue has properly bump.";
?>

View file

@ -0,0 +1,15 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hello_world.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['hello_global'] = "Hello World!<br />This is a sample Extensions (which can be disabled!) that displays this message on all pages.";
$l['hello_postbit'] = "Hello world!";
?>

View file

@ -0,0 +1,6 @@
<html>
<head>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,34 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: ranks.lang.php 2012-04-12 10:58Z EdsonOrdaz $
*/
$l['rank'] = "Rank";
$l['listranks'] = "List of ranks";
$l['image'] = "Image";
$l['namedes'] = "Name\Description";
$l['posts'] = "Posts";
$l['threads'] = "Threads";
$l['reputation'] = "Reputation";
$l['timeonline'] = "Time Online";
$l['regdate'] = "Registered time";
$l['level'] = "Level";
$l['none'] = "None";
$l['rankby'] = "Rank of {1}";
$l['emptyranks'] = "There is no created range.";
$l['hours'] = "Hours";
$l['hour'] = "Hour";
$l['days'] = "Days";
$l['day'] = "Day";
$l['weeks'] = "Weeks";
$l['week'] = "Week";
$l['years'] = "Years";
$l['year'] = "Year";
$l['save'] = "Save";
?>

View file

@ -0,0 +1,40 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: Forumrequirements.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['forumrequiements'] = "Forum Requirements";
$l['plugdes'] = "Permite el acceso a X foros cuando obtengas los logros requeridos.";
$l['enable'] = "Activar extension?";
$l['enabledes'] = "Activa esta extension para que se oculten los foros.";
$l['message'] = "Mensaje de error";
$l['messagedes'] = "Escribe el mensaje de error que les aparecera cuando no puedan ver un foro porque no han cumplido con los logros requeridos. Puedes usar <b>HTML</b>";
$l['valuemessage'] = "Para poder ver este foro necesitas juntar los siguientes logros: <br />{achivements}";
//admin
$l['forums'] = "Foros";
$l['noforumexists'] = "El foro seleccionado no existe.";
$l['achivementsrequestposts'] = "Logros por Posts";
$l['achivementsrequestthreads'] = "Logros por Temas";
$l['achivementsrequestreputations'] = "Logros por Reputaci&oacute;n";
$l['achivementsrequesttimeonline'] = "Logros por Tiempo en linea";
$l['achivementsrequestregdate'] = "Logros por Tiempo de registrado";
$l['achivementsrequestcustom'] = "Logros Personalizados";
$l['achivementsrequestpostsdes'] = "Selecciona los logros por posts que necesitan los usuarios para ver este foro.";
$l['achivementsrequestthreadsdes'] = "Selecciona los logros por temas que necesitan los usuarios para ver este foro.";
$l['achivementsrequestreputationsdes'] = "Selecciona los logros por reputaci&oacute;n que necesitan los usuarios para ver este foro.";
$l['achivementsrequesttimeonlinedes'] = "Selecciona los logros por tiempo en linea que necesitan los usuarios para ver este foro.";
$l['achivementsrequestregdatedes'] = "Selecciona los logros por tiempo de registrado que necesitan los usuarios para ver este foro.";
$l['achivementsrequestcustomdes'] = "Selecciona los logros personalizados que necesitan los usuarios para ver este foro.";
$l['none'] = "Ninguno";
$l['success_update'] = "El foro se ha actualizado correctamente.";
$l['save'] = "Guardar";
?>

View file

@ -0,0 +1,15 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hello_world.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['hello_world'] = "Hello World";
$l['hello_world_extension_description'] = "A sample extension that prints hello world and prepends the content of each post to 'Hello world!'";
?>

View file

@ -0,0 +1,6 @@
<html>
<head>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,69 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: ranks.lang.php 2012-04-29 10:58Z EdsonOrdaz $
*/
$l['ranks'] = "Rangos";
$l['ranks_plug_description'] = "Agrega rangos a los usuarios al obtener ciertos logros.";
$l['ranks_tab_des'] = "Lista de rangos. los rangos se muestra por nivel de forma ascendente o descendente segun tu lo configures.";
//new rank
$l['newrank'] = "Nuevo Rango";
$l['newrank_tab_des'] = "Agrega un nuevo rango por logros. aqui se mostraran los logros creados (logros por posts, temas, reputacion, tiempo en linea y tiempo de registrado, no por logros personalizados).";
$l['save'] = "Guardar";
$l['none'] = "Ninguno";
$l['nameofrank'] = "Nombre del rango";
$l['nameofrankdes'] = "Ingresa el nombre del rango.";
$l['descriptionofrank'] = "Descripcion";
$l['descriptionofrankdes'] = "Ingresa la descripcion de este rango.";
$l['newrankpostsdes'] = "Selecciona el logro por posts que debe tener el usuario.";
$l['newrankthreadsdes'] = "Selecciona el logro por posts que debe tener el usuario.";
$l['newrankreputationdes'] = "Selecciona el logro por reputacion que debe tener el usuario.";
$l['newranktimeonlinedes'] = "Selecciona el logro por tiempo en linea que debe tener el usuario.";
$l['newrankregdatedes'] = "Selecciona el logro por tiempo de registrado que debe tener el usuario.";
$l['imagedesnewrank'] = "Selecciona la imagen que se les dara como rango desde tu ordenador.";
$l['level'] = "Nivel";
$l['levelnewrank'] = "Ingresa el nivel que tendra este rango (El nivel no puede quedar en cero ni ser un nivel repetido).";
//validate and process rank
$l['notname'] = "No has escrito un nombre del rango.";
$l['notdescription'] = "Debes escribir una descripcion del rango.";
$l['notlevel'] = "El nivel del rango debe ser mayor a cero.";
$l['notimage'] = "No has seleccionado una imagen de tu ordenador.";
$l['repeatlevel'] = "El rango {1} ya tiene el nivel {2}.";
$l['successnewrank'] = "El rango se ha creado correctamente.";
$l['notcopyimage'] = "No se ha podido copiar la imagen del rango.";
$l['extnotvalidateimg'] = "Extension de la imagen no es valida.";
$l['notloadingimage'] = "No se ha podido cargar la imagen.";
//home ranks
$l['namedescription'] = "Nombre/Descripcion";
$l['emptyranks'] = "No hay ningun rango creado.";
$l['deletsuccessrank'] = "El rango se ha eliminado correctamente.";
$l['confirmdeleterankpoop'] = "Quieres eliminar el rango {1}?";
$l['successorderascdesc'] = "Los rangos se muestran por nivel de forma {1}";
$l['asc'] = "ascendente";
$l['desc'] = "descendente";
$l['showdesctable'] = "Mostrar en orden descendente";
$l['showasctable'] = "Mostrar en orden ascendente";
//edit rank
$l['notexistrankedit'] = "No existe el rango seleccionado.";
$l['imageactual'] = "Imagen Actual";
$l['imageactualdes'] = "Si no quieres cambiar esta imagen deja el campo de abajo vacio para mantener esta imagen.";
$l['successeditrank'] = "El rango se ha editado correctamente.";
$l['editrank'] = "Editar Rango";
$l['editrank_tab_des'] = "Edita el rango cambiando su configuracion. Ejecuta de nuevo la tarea para quitar este rango a quien no junte los logros.";
?>

View file

@ -0,0 +1,43 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: threadbump.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['threadbump'] = "Thread Bump";
$l['threadbumpplugdes'] = "Permite bumpear temas cada 24 horas.";
$l['enable'] = "Activar extension";
$l['enabledes'] = "Selecciona si la extension estara activara para bumpear temas.";
$l['message'] = "Mensaje de error de logros";
$l['messagedes'] = "Escribe el mensaje de error que les aparecera cuando no puedan bumpear porque no tienen los logros requeridos. Puedes usar <b>HTML</b>";
$l['valuemessage'] = "Para poder bumpear necesitas juntar los siguientes logros: <br />{achivements}";
$l['messagetime'] = "Mensaje de error de tiempo";
$l['messagetimedes'] = "Escribe el mensaje de error que les aparecera cuando no puedan bumpear porque ya bumpearon antes de 24 horas. Puedes usar <b>HTML</b>";
$l['notbumpthread_time'] = "No puedes bumpear 2 temas en menos de 24 horas, espera al dia {datetime} para bumpear.";
$l['achivementsrequestposts'] = "Logros por Posts";
$l['achivementsrequestthreads'] = "Logros por Temas";
$l['achivementsrequestreputations'] = "Logros por Reputaci&oacute;n";
$l['achivementsrequesttimeonline'] = "Logros por Tiempo en linea";
$l['achivementsrequestregdate'] = "Logros por Tiempo de registrado";
$l['achivementsrequestpostsdes'] = "Selecciona los logros por posts que necesitan los usuarios para poder bumpear.";
$l['achivementsrequestthreadsdes'] = "Selecciona los logros por temas que necesitan los usuarios para poder bumpear.";
$l['achivementsrequestreputationsdes'] = "Selecciona los logros por reputaci&oacute;n que necesitan los usuarios para poder bumpear.";
$l['achivementsrequesttimeonlinedes'] = "Selecciona los logros por tiempo en linea que necesitan los usuarios para poder bumpear.";
$l['achivementsrequestregdatedes'] = "Selecciona los logros por tiempo de registrado que necesitan los usuarios para poder bumpear.";
$l['none'] = "Ninguno";
$l['save'] = "Guardar";
$l['success_update'] = "Datos guardados correctamente.";
$l['bumpsuccess'] = "El tema se a bumpeado correctamente.";
?>

View file

@ -0,0 +1,15 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hello_world.lang.php 2012-04-22 10:58Z EdsonOrdaz $
*/
$l['hello_global'] = "Hello World!<br />This is a sample Extensions (which can be disabled!) that displays this message on all pages.";
$l['hello_postbit'] = "Hello world!";
?>

View file

@ -0,0 +1,6 @@
<html>
<head>
</head>
<body>
</body>
</html>

View file

@ -0,0 +1,34 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: ranks.lang.php 2012-04-12 10:58Z EdsonOrdaz $
*/
$l['rank'] = "Rango";
$l['listranks'] = "Lista de rangos";
$l['image'] = "Imagen";
$l['namedes'] = "Nombre\Descripci&oacute;n";
$l['posts'] = "Posts";
$l['threads'] = "Temas";
$l['reputation'] = "Reputaci&oacute;n";
$l['timeonline'] = "Tiempo en linea";
$l['regdate'] = "Tiempo Registrado";
$l['level'] = "Nivel";
$l['none'] = "Ninguno";
$l['rankby'] = "Rango de {1}";
$l['emptyranks'] = "No hay ningun rango creado.";
$l['hours'] = "Horas";
$l['hour'] = "Hora";
$l['days'] = "D&iacute;as";
$l['day'] = "D&iacute;a";
$l['weeks'] = "Semanas";
$l['week'] = "Semana";
$l['years'] = "A&ntilde;os";
$l['year'] = "A&ntilde;o";
$l['save'] = "Guardar";
?>

View file

@ -0,0 +1,153 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: admin.php 2012-04-29 10:58Z EdsonOrdaz $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function admin_load_rank()
{
global $lang, $cache, $mybb, $page, $db;
require_once MYBB_ROOT."inc/plugins/achivements/extensions/ranks/class_ranks.php";
require_once MYBB_ROOT."inc/plugins/achivements/extensions/ranks/forms.php";
$rankhandler = new class_extension_ranks;
if($mybb->input['action'] == "new")
{
$rankhandler->tabs('new');
if($mybb->request_method == "post")
{
$rank = array(
"name" => $db->escape_string($mybb->input['name']),
"description" => $db->escape_string($mybb->input['description']),
"apid" => intval($mybb->input['posts']),
"atid" => intval($mybb->input['threads']),
"arid" => intval($mybb->input['reputation']),
"toid" => intval($mybb->input['timeonline']),
"rgid" => intval($mybb->input['regdate']),
"image" => $_FILES['image'],
"level" => intval($mybb->input['level'])
);
$rankhandler->set_data($rank);
if(!$rankhandler->validate_rank())
{
$errors = $rankhandler->get_friendly_errors();
}
if(!$errors)
{
$rankhandler->insert_rank();
flash_message($lang->successnewrank, 'success');
admin_redirect("index.php?module=achivements-ranks");
}
}
if($errors)
{
$page->output_inline_error($errors);
}
form_new_rank();
}
elseif($mybb->input['action'] == "edit")
{
$rank = get_rank($mybb->input['rid']);
if(!$rank['rid'])
{
flash_message($lang->notexistrankedit, 'error');
admin_redirect("index.php?module=achivements-ranks");
}
if($mybb->request_method == "post")
{
$rank = array(
"rid" => intval($mybb->input['rid']),
"name" => $db->escape_string($mybb->input['name']),
"description" => $db->escape_string($mybb->input['description']),
"apid" => intval($mybb->input['posts']),
"atid" => intval($mybb->input['threads']),
"arid" => intval($mybb->input['reputation']),
"toid" => intval($mybb->input['timeonline']),
"rgid" => intval($mybb->input['regdate']),
"image" => $_FILES['image'],
"imageactual" => $mybb->input['imageactual'],
"level" => intval($mybb->input['level']),
"edit" => true
);
$rankhandler->set_data($rank);
if(!$rankhandler->validate_rank())
{
$errors = $rankhandler->get_friendly_errors();
}
if(!$errors)
{
$rankhandler->insert_rank();
flash_message($lang->successeditrank, 'success');
admin_redirect("index.php?module=achivements-ranks");
}
}
if($errors)
{
$page->output_inline_error($errors);
}
$rankhandler->tabs('edit', array('rid' => $rank['rid']));
form_edit_rank($rank['rid']);
}
elseif($mybb->input['action'] == "delete")
{
$rank = get_rank($mybb->input['rid']);
if(!$rank['rid'])
{
flash_message($lang->notexistrankedit, 'error');
admin_redirect("index.php?module=achivements-ranks");
}
@unlink(MYBB_ROOT.$rank['image']);
$db->query("DELETE FROM ".TABLE_PREFIX."ranks WHERE rid='$rank[rid]'");
flash_message($lang->deletsuccessrank, 'success');
admin_redirect("index.php?module=achivements-ranks");
}
elseif($mybb->input['order'])
{
if($mybb->input['order'] != 'asc' && $mybb->input['order'] != 'desc')
{
$mybb->input['order'] = 'asc';
}
$insertcache = array(
'order_dir' => $mybb->input['order']
);
$cache->update("ranks", $insertcache);
if($mybb->input['order'] == 'asc')
{
$ascdesc = $lang->asc;
}
elseif($mybb->input['order'] == 'desc')
{
$ascdesc = $lang->desc;
}
$lang->successorderascdesc = $lang->sprintf($lang->successorderascdesc, $ascdesc);
flash_message($lang->successorderascdesc, 'success');
admin_redirect("index.php?module=achivements-ranks");
}
else
{
$orderdir = $cache->read('ranks');
if(!$orderdir['order_dir'])
{
$insertcache = array(
'order_dir' => 'asc'
);
$cache->update("ranks", $insertcache);
}
$rankhandler->tabs();
home_ranks();
}
}
?>

View file

@ -0,0 +1,204 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: class_ranks.php 2012-04-15 10:58Z EdsonOrdaz $
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
class class_extension_ranks extends DataHandler
{
public $tabs;
public function tabs($location='home', $options=array())
{
global $page, $lang;
//die(var_dump($location))
$tabs["home"] = array(
'title' => $lang->ranks,
'link' => "index.php?module=achivements-ranks",
'description' => $lang->ranks_tab_des
);
$tabs["new"] = array(
'title' => $lang->newrank,
'link' => "index.php?module=achivements-ranks&action=new",
'description' => $lang->newrank_tab_des
);
if($location == "edit")
{
$tabs["edit"] = array(
'title' => $lang->editrank,
'link' => "index.php?module=achivements-ranks&action=edit&rid=$options[rid]",
'description' => $lang->editrank_tab_des
);
}
$page->output_nav_tabs($tabs, $location);
}
public function validate_rank()
{
global $lang, $db;
$rank = &$this->data;
if(empty($rank['name']))
{
$this->set_error($lang->notname);
}
if(empty($rank['description']))
{
$this->set_error($lang->notdescription);
}
if(empty($rank['level']))
{
$this->set_error($lang->notlevel);
}
if(empty($rank['image']) && $rank['edit'] == false)
{
$this->set_error($lang->notimage);
}
$query = $db->simple_select("ranks", "*", "level='{$rank['level']}'");
$level = $db->fetch_array($query);
if($level['rid'] && $rank['edit'] == false)
{
$lang->repeatlevel = $lang->sprintf($lang->repeatlevel, $level['name'], $rank['level']);
$this->set_error($lang->repeatlevel);
return false;
}
if($rank['edit'] == true && $level['rid'] != $rank['rid'] && !is_null($level['rid']))
{
$lang->repeatlevel = $lang->sprintf($lang->repeatlevel, $level['name'], $rank['level']);
$this->set_error($lang->repeatlevel);
return false;
}
$db->free_result($query);
if(count($this->get_errors()) < 1)
{
$this->validate_image();
}
$this->set_validated(true);
if(count($this->get_errors()) > 0)
{
return false;
}
else
{
return true;
}
}
public function validate_image()
{
global $lang;
$rank = &$this->data;
if(!$imagen['name'] || !$imagen['tmp_name'])
{
$imagen = $rank['image'];
}
if($rank['imageactual'] && $imagen['error'] > 0)
{
$rank['image'] = $rank['imageactual'];
$this->set_data($rank);
return false;
}
if(!is_uploaded_file($imagen['tmp_name']))
{
$this->set_error($lang->notcopyimage);
return false;
}
$ext = get_extension(my_strtolower($imagen['name']));
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext))
{
$this->set_error($lang->extnotvalidateimg);
return false;
}
$path = MYBB_ROOT."inc/plugins/achivements/extensions/ranks/upload";
$filename = "rank_".date('d_m_y_g_i_s').'.'.$ext;
$moved = @move_uploaded_file($imagen['tmp_name'], $path."/".$filename);
if(!$moved)
{
$this->set_error($lang->notcopyimage);
return false;
}
@my_chmod($path."/".$filename, '0644');
if($imagen['error'])
{
@unlink($path."/".$filename);
$this->set_error($lang->notloadingimage);
return false;
}
switch(my_strtolower($imagen['type']))
{
case "image/gif":
$img_type = 1;
break;
case "image/jpeg":
case "image/x-jpg":
case "image/x-jpeg":
case "image/pjpeg":
case "image/jpg":
$img_type = 2;
break;
case "image/png":
case "image/x-png":
$img_type = 3;
break;
default:
$img_type = 0;
}
if($img_type == 0)
{
@unlink($path."/".$filename);
$this->set_error($lang->extnotvalidateimg);
return false;
}
@unlink(MYBB_ROOT.$rank['imageactual']);
$rank['image'] = "inc/plugins/achivements/extensions/ranks/upload/".$filename;
$this->set_data($rank);
return true;
}
public function insert_rank()
{
global $lang, $db;
if(!$this->get_validated())
{
die($lang->not_validate);
}
if(count($this->get_errors()) > 0)
{
die($lang->infonotvalid);
}
$rank = &$this->data;
$insert = array(
"name" => $rank['name'],
"description" => $rank['description'],
"apid" => $rank['apid'],
"atid" => $rank['atid'],
"arid" => $rank['arid'],
"toid" => $rank['toid'],
"rgid" => $rank['rgid'],
"image" => $rank['image'],
"level" => $rank['level']
);
if($rank['edit'] == true)
{
$db->update_query("ranks", $insert, "rid=".$rank['rid']);
}
else
{
$rid = $db->insert_id();
$insert['rid'] = $rid;
$db->insert_query("ranks", $insert);
}
}
}
?>

View file

@ -0,0 +1,225 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: forms.php 2012-04-15 10:58Z EdsonOrdaz $
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function home_ranks()
{
global $db, $lang, $mybb, $cache;
$query = $db->simple_select('ranks', 'COUNT(rid) AS rids', '', array('limit' => 1));
$quantity = $db->fetch_field($query, "rids");
$pagina = intval($mybb->input['page']);
$perpage = 10;
if($pagina > 0)
{
$start = ($pagina - 1) * $perpage;
$pages = $quantity / $perpage;
$pages = ceil($pages);
if($pagina > $pages || $pagina <= 0)
{
$start = 0;
$pagina = 1;
}
}
else
{
$start = 0;
$pagina = 1;
}
$pageurl = "index.php?module=achivements-ranks";
$table = new Table;
$table->construct_header($lang->image, array("width" => "5%","class" => "align_center"));
$table->construct_header($lang->namedescription);
$table->construct_header($lang->achivements, array("width" => "20%","class" => "align_center"));
$table->construct_header($lang->options, array("width" => "10%","class" => "align_center"));
$table->construct_row();
$orderdir = $cache->read("ranks");
$query = $db->simple_select("ranks", '*', '', array('order_by' => 'level', 'order_dir' => $orderdir['order_dir'], 'limit' => $start.", ".$perpage));
while($rank = $db->fetch_array($query))
{
$achivements = achivements_get();
$lang->confirmdeleterank = $lang->sprintf($lang->confirmdeleterankpoop, $rank['name']);
if(!empty($achivements['apid'][$rank['apid']]['apid']))
{
$logros .= "<img src=\"../".$achivements['apid'][$rank['apid']]['image']."\" title=\"".$achivements['apid'][$rank['apid']]['name']."\" /> ";
}
if(!empty($achivements['atid'][$rank['atid']]['atid']))
{
$logros .= "<img src=\"../".$achivements['atid'][$rank['atid']]['image']."\" title=\"".$achivements['atid'][$rank['atid']]['name']."\"/> ";
}
if(!empty($achivements['arid'][$rank['arid']]['arid']))
{
$logros .= "<img src=\"../".$achivements['arid'][$rank['arid']]['image']."\" title=\"".$achivements['arid'][$rank['arid']]['name']."\"/> ";
}
if(!empty($achivements['toid'][$rank['toid']]['toid']))
{
$logros .= "<img src=\"../".$achivements['toid'][$rank['toid']]['image']."\" title=\"".$achivements['toid'][$rank['toid']]['name']."\"/> ";
}
if(!empty($achivements['rgid'][$rank['rgid']]['rgid']))
{
$logros .= "<img src=\"../".$achivements['rgid'][$rank['rgid']]['image']."\" title=\"".$achivements['rgid'][$rank['rgid']]['name']."\"/> ";
}
if(!$logros)
{
$logros = $lang->none;
}
$table->construct_cell("<img src=\"../$rank[image]\" title=\"$rank[name]\">",array("class" => "align_center"));
$table->construct_cell("<strong><a href=\"index.php?module=achivements-ranks&action=edit&rid=$rank[rid]\" />$rank[name]</a></strong><br /><small>$rank[description]</small>");
$table->construct_cell($logros ,array("class" => "align_center"));
$popup = new PopupMenu("rid_$rank[rid]", $lang->options);
$popup->add_item($lang->edit, "index.php?module=achivements-ranks&action=edit&rid=$rank[rid]");
$popup->add_item($lang->delete, "index.php?module=achivements-ranks&action=delete&rid={$rank['rid']}&my_post_key={$mybb->post_code}\" target=\"_self\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirmdeleterank}')");
$Popuss = $popup->fetch();
$table->construct_cell($Popuss, array('class' => 'align_center'));
$table->construct_row();
unset($logros);
}
if($table->num_rows() == 1)
{
$table->construct_cell($lang->emptyranks, array('colspan' => 4, 'class' => 'align_center'));
$table->construct_row();
}
if($orderdir['order_dir'] == 'asc')
{
$show = "<a href=\"index.php?module=achivements-ranks&order=desc\" />{$lang->showdesctable}</a>";
}
else
{
$show = "<a href=\"index.php?module=achivements-ranks&order=asc\" />{$lang->showasctable}</a>";
}
$table->output("<div style=\"float:right;\">$show</div>".$lang->ranks);
echo multipage($quantity, (int)$perpage, (int)$pagina, $pageurl);
}
function form_new_rank()
{
global $mybb, $page, $lang, $db;
$achivements = achivements_get();
$posts = array();
$threads = array();
$reputation = array();
$timeonline = array();
$regdate = array();
$posts[0] = $lang->none;
$threads[0] = $lang->none;
$reputation[0] = $lang->none;
$timeonline[0] = $lang->none;
$regdate[0] = $lang->none;
if($achivements)
{
foreach($achivements['apid'] as $apid => $achivement)
{
$posts[$achivement['apid']] = $achivement['name'];
}
foreach($achivements['atid'] as $atid => $achivement)
{
$threads[$achivement['atid']] = $achivement['name'];
}
foreach($achivements['arid'] as $arid => $achivement)
{
$reputation[$achivement['arid']] = $achivement['name'];
}
foreach($achivements['toid'] as $toid => $achivement)
{
$timeonline[$achivement['toid']] = $achivement['name'];
}
foreach($achivements['rgid'] as $rgid => $achivement)
{
$regdate[$achivement['rgid']] = $achivement['name'];
}
}
$form = new Form("index.php?module=achivements-ranks&action=new", "post", "save",1);
$form_container = new FormContainer($lang->newrank);
$form_container->output_row($lang->nameofrank."<em>*</em>", $lang->nameofrankdes, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->descriptionofrank."<em>*</em>", $lang->descriptionofrankdes, $form->generate_text_area('description', $mybb->input['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->posts."<em>*</em>", $lang->newrankpostsdes, $form->generate_select_box("posts", $posts, $mybb->input['posts'], array('id' => 'posts')), 'posts');
$form_container->output_row($lang->threads."<em>*</em>", $lang->newrankthreadsdes, $form->generate_select_box("threads", $threads, $mybb->input['threads'], array('id' => 'threads')), 'threads');
$form_container->output_row($lang->reputation."<em>*</em>", $lang->newrankreputationdes, $form->generate_select_box("reputation", $reputation, $mybb->input['reputation'], array('id' => 'reputation')), 'reputation');
$form_container->output_row($lang->timeonline."<em>*</em>", $lang->newranktimeonlinedes, $form->generate_select_box("timeonline", $timeonline, $mybb->input['timeonline'], array('id' => 'timeonline')), 'timeonline');
$form_container->output_row($lang->regdate."<em>*</em>", $lang->newrankregdatedes, $form->generate_select_box("regdate", $regdate, $mybb->input['regdate'], array('id' => 'regdate')), 'regdate');
$form_container->output_row($lang->image,$lang->imagedesnewrank, $form->generate_file_upload_box("image", array('style' => 'width: 310px;')), 'file');
$form_container->output_row($lang->level."<em>*</em>", $lang->levelnewrank, $form->generate_text_box('level', $mybb->input['level'], array('id' => 'level')), 'level');
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save, array('name' => 'save'));
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
}
function form_edit_rank($id)
{
global $mybb, $page, $lang, $db;
$rank = get_rank($id);
$achivements = achivements_get();
$posts = array();
$threads = array();
$reputation = array();
$timeonline = array();
$regdate = array();
$posts[0] = $lang->none;
$threads[0] = $lang->none;
$reputation[0] = $lang->none;
$timeonline[0] = $lang->none;
$regdate[0] = $lang->none;
foreach($achivements['apid'] as $apid => $achivement)
{
$posts[$achivement['apid']] = $achivement['name'];
}
foreach($achivements['atid'] as $atid => $achivement)
{
$threads[$achivement['atid']] = $achivement['name'];
}
foreach($achivements['arid'] as $arid => $achivement)
{
$reputation[$achivement['arid']] = $achivement['name'];
}
foreach($achivements['toid'] as $toid => $achivement)
{
$timeonline[$achivement['toid']] = $achivement['name'];
}
foreach($achivements['rgid'] as $rgid => $achivement)
{
$regdate[$achivement['rgid']] = $achivement['name'];
}
$form = new Form("index.php?module=achivements-ranks&action=edit&rid=$rank[rid]", "post", "save",1);
$form_container = new FormContainer($lang->newrank);
echo $form->generate_hidden_field("rid", $rank['rid']);
echo $form->generate_hidden_field("imageactual", $rank['image']);
$form_container->output_row($lang->nameofrank."<em>*</em>", $lang->nameofrankdes, $form->generate_text_box('name', $rank['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->descriptionofrank."<em>*</em>", $lang->descriptionofrankdes, $form->generate_text_area('description', $rank['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->posts."<em>*</em>", $lang->newrankpostsdes, $form->generate_select_box("posts", $posts, $rank['apid'], array('id' => 'posts')), 'posts');
$form_container->output_row($lang->threads."<em>*</em>", $lang->newrankthreadsdes, $form->generate_select_box("threads", $threads, $rank['atid'], array('id' => 'threads')), 'threads');
$form_container->output_row($lang->reputation."<em>*</em>", $lang->newrankreputationdes, $form->generate_select_box("reputation", $reputation, $rank['arid'], array('id' => 'reputation')), 'reputation');
$form_container->output_row($lang->timeonline."<em>*</em>", $lang->newranktimeonlinedes, $form->generate_select_box("timeonline", $timeonline, $rank['toid'], array('id' => 'timeonline')), 'timeonline');
$form_container->output_row($lang->regdate."<em>*</em>", $lang->newrankregdatedes, $form->generate_select_box("regdate", $regdate, $rank['rgid'], array('id' => 'regdate')), 'regdate');
$form_container->output_row($lang->imageactual,$lang->imageactualdes, "<img src='../".$rank['image']."' />", 'imageactual_des');
$form_container->output_row($lang->image,$lang->imagedesnewrank, $form->generate_file_upload_box("image", array('style' => 'width: 310px;')), 'file');
$form_container->output_row($lang->level."<em>*</em>", $lang->levelnewrank, $form->generate_text_box('level', $rank['level'], array('id' => 'level')), 'level');
$form_container->end();
$buttons[] = $form->generate_submit_button($lang->save, array('name' => 'save'));
$form->output_submit_wrapper($buttons);
$form->end();
$page->output_footer();
}
?>

View file

@ -0,0 +1,41 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hooks.php 2012-04-29 10:58Z EdsonOrdaz $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("postbit", "postbit_extension_rank");
$plugins->add_hook("member_profile_end", "profile_extension_rank");
function postbit_extension_rank(&$post)
{
global $db, $templates, $lang;
extensions_lang('ranks');
$query = $db->simple_select("ranks", '*', "rid='".$post['rank']."'");
$rank = $db->fetch_array($query);
eval("\$post['rankpostbit'] = \"".$templates->get("ranks_postbit")."\";");
}
function profile_extension_rank()
{
global $mybb, $templates, $rankprofile, $theme, $memprofile, $db, $lang;
extensions_lang('ranks');
$lang->rankby = $lang->sprintf($lang->rankby, $memprofile['username']);
$query = $db->simple_select("ranks", '*', "rid='".$memprofile['rank']."'");
$rank = $db->fetch_array($query);
eval("\$rankprofile = \"".$templates->get("ranks_profile")."\";");
}
?>

View file

@ -0,0 +1,160 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: plugin.php 2012-04-29 10:58Z EdsonOrdaz $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function information_extension_rank()
{
global $lang;
extensions_lang('ranks');
return array(
'name' => 'Ranks',
'description' => $lang->ranks_plug_description,
'version' => '1.0',
'website' => 'http://www.mybb-es.com/',
'author' => 'Edson Ordaz',
'authorsite' => 'http://www.mybb-es.com/',
'achivements' => '*',
'admin_icon' => 'inc/plugins/achivements/extensions/ranks/ranks.png'
);
}
function active_extension_rank()
{
global $db, $lang;
extensions_lang('ranks');
$collation = $db->build_create_table_collation();
if(!$db->table_exists('ranks'))
{
$db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."ranks` (
`rid` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '',
`description` TEXT NOT NULL,
`apid` int(10) NOT NULL DEFAULT 0,
`atid` int(10) NOT NULL DEFAULT 0,
`arid` int(10) NOT NULL DEFAULT 0,
`toid` int(10) NOT NULL DEFAULT 0,
`rgid` int(10) NOT NULL DEFAULT 0,
`image` varchar(250) NOT NULL DEFAULT '',
`level` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`rid`)
) ENGINE=MyISAM{$collation}");
}
if(!$db->field_exists("rank", "users"))
{
$db->add_column("users", "rank", "int(10) unsigned NOT NULL default '0'");
}
require_once MYBB_ROOT."inc/plugins/achivements/extensions/ranks/task.php";
if(!file_exists(MYBB_ROOT."inc/tasks/ranks.php"))
{
create_task();
}else{
create_task_tools();
}
extensions_add_template('ranks', '<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->listranks}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="8">
<strong>{$lang->listranks}</span></td>
</tr>
<tr>
<td class="tcat" width="5%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat"><strong>{$lang->namedes}</strong></td>
<td class="tcat" width="5%" align="center"><strong>{$lang->posts}</strong></td>
<td class="tcat" width="5%" align="center"><strong>{$lang->threads}</strong></td>
<td class="tcat" width="5%" align="center"><strong>{$lang->reputation}</strong></td>
<td class="tcat" width="15%" align="center"><strong>{$lang->timeonline}</strong></td>
<td class="tcat" width="15%" align="center"><strong>{$lang->regdate}</strong></td>
<td class="tcat" width="5%" align="center"><strong>{$lang->level}</strong></td>
</tr>
{$ranks}
</table>
{$footer}
</body>
</html>');
extensions_add_template('ranks_list', '<tr>
<td class="{$trow}" align="center"><img src="{$rank[\'image\']}" /></td>
<td class="{$trow}"><strong>{$rank[\'name\']}</strong><br /><span class="smalltext">{$rank[\'description\']}</span></td>
<td class="{$trow}" align="center">{$rank[\'posts\']}</td>
<td class="{$trow}" align="center">{$rank[\'threads\']}</td>
<td class="{$trow}" align="center">{$rank[\'reputation\']}</td>
<td class="{$trow}" align="center">{$timeonline}</td>
<td class="{$trow}" align="center">{$regdate}</td>
<td class="{$trow}" align="center">{$rank[\'level\']}</td>
</tr>');
extensions_add_template('ranks_postbit', '<br />{$lang->rank}: <img src="{$rank[\'image\']}" alt="{$rank[\'name\']}" title="{$rank[\'name\']}" /><br />');
extensions_add_template('ranks_profile', '<br />
<table id="achivements" border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->rankby}</strong></td>
</tr>
<tr>
<td class="trow1" width="10%">
<img src="{$rank[\'image\']}" alt="{$rank[\'name\']}" title="{$rank[\'name\']}" />
</td>
<td class="trow1" valign="top" align="left">
<strong>{$rank[\'name\']}</strong><br /><span class="smalltext">{$rank[\'description\']}</span>
</td>
</tr>
</table>');
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('member_profile', '#{\$profilefields}#', '{\$profilefields}<!-- profile_rank -->{\$rankprofile}<!-- /profile_rank -->');
find_replace_templatesets('postbit', '#'.preg_quote('{$post[\'user_details\']}').'#', "{\$post['user_details']}<!-- postbit_rank -->{\$post['rankpostbit']}<!-- /postbit_rank -->");
find_replace_templatesets('postbit_classic', '#'.preg_quote('{$post[\'user_details\']}').'#', "{\$post['user_details']}<!-- postbit_rank -->{\$post['rankpostbit']}<!-- /postbit_rank -->");
}
function deactivate_rank_extension()
{
global $db;
$query = $db->simple_select('ranks');
while($ranks = $db->fetch_array($query))
{
$delete_images = @unlink(MYBB_ROOT.$ranks['image']);
}
if($db->table_exists('ranks'))
{
$db->drop_table('ranks');
}
if($db->field_exists("rank", "users"))
{
$db->drop_column("users", "rank");
}
$db->delete_query("datacache", "title='ranks'");
extensions_remove_templates("'ranks', 'ranks_list', 'ranks_postbit', 'ranks_profile'");
$db->delete_query('tasks', 'file=\'ranks\'');
if(file_exists(MYBB_ROOT."inc/tasks/ranks.php"))
{
@unlink(MYBB_ROOT.'inc/tasks/ranks.php');
}
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('member_profile', '#\<!--\sprofile_rank\s--\>(.+)\<!--\s/profile_rank\s--\>#is', '', 0);
find_replace_templatesets('postbit', '#\<!--\spostbit_rank\s--\>(.+)\<!--\s/postbit_rank\s--\>#is', '', 0);
find_replace_templatesets('postbit_classic', '#\<!--\spostbit_rank\s--\>(.+)\<!--\s/postbit_rank\s--\>#is', '', 0);
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

View file

@ -0,0 +1,135 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: task.php 2012-04-15 10:58Z EdsonOrdaz $
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function create_task()
{
$file = fopen(MYBB_ROOT."inc/tasks/ranks.php", 'w');
fwrite($file, task());
fclose($file);
}
function create_task_tools()
{
global $db, $lang;
$lang->load('ranks');
$new_task_ranks = array(
"title" => "Ranks",
"description" => $lang->ranks_plug_description,
"file" => "ranks",
"minute" => '0',
"hour" => '0',
"day" => '*',
"month" => '*',
"weekday" => '*',
"nextrun" => TIME_NOW + (1*24*60*60),
"enabled" => '1',
"logging" => '1'
);
$db->insert_query("tasks", $new_task_ranks);
}
function task()
{
$task = <<<TASK_RANKS
<?php
/**
* MyBB 1.6
* Copyright 2012 Edson Ordaz, All Rights Reserved
*
* Email: nicedo_eeos@hotmail.com
* WebSite: http://www.mybb-es.com
*
* \$Id: ranks.php 2012-05-16Z Edson Ordaz \$
*/
function task_ranks(\$task)
{
global \$db, \$mybb, \$lang;
require_once MYBB_ROOT."inc/plugins/achivements.php";
\$ranks = array();
\$query = \$db->simple_select("ranks", '*', '', array('order_by' => 'level', 'order_dir' => 'desc'));
while(\$rank = \$db->fetch_array(\$query))
{
\$ranks[\$rank['rid']] = \$rank;
}
\$db->free_result(\$query);
\$users = array();
\$taskusersoffline = '';
if(\$mybb->settings['achivements_taskuseroffline'] == 0)
{
\$taskusersoffline = "lastactive >= '{\$task['lastrun']}'";
}
\$query = \$db->simple_select("users", "*", \$taskusersoffline);
while(\$user = \$db->fetch_array(\$query))
{
\$users[\$user['uid']] = \$user;
}
\$countusers = 0;
\$achivements = achivements_get();
foreach(\$users as \$uid => \$user)
{
\$logros = @unserialize(\$user['achivements']);
\$error = 0;
\$rid = 0;
foreach(\$ranks as \$rank)
{
if(\$logros['apid'][\$rank['apid']]['apid'] != \$achivements['apid'][\$rank['apid']]['apid'])
{
++\$error;
}
if(\$logros['atid'][\$rank['atid']]['atid'] != \$achivements['atid'][\$rank['atid']]['atid'])
{
++\$error;
}
if(\$logros['arid'][\$rank['arid']]['arid'] != \$achivements['arid'][\$rank['arid']]['arid'])
{
++\$error;
}
if(\$logros['toid'][\$rank['toid']]['toid'] != \$achivements['toid'][\$rank['toid']]['toid'])
{
++\$error;
}
if(\$logros['rgid'][\$rank['rgid']]['rgid'] != \$achivements['rgid'][\$rank['rgid']]['rgid'])
{
++\$error;
}
if(\$error == 0)
{
\$rid = intval(\$rank['rid']);
break;
}
elseif(\$error > 0)
{
\$error = 0;
continue;
}
}
if(\$error == 0)
{
\$db->update_query('users', array('rank' => \$rid), 'uid=\''.\$uid.'\'');
++\$countusers;
}
}
\$lang->tasklogranks = \$lang->sprintf('have been changed to {1} users range', \$countusers);
add_task_log(\$task, \$lang->tasklogranks);
}
?>
TASK_RANKS;
create_task_tools();
return $task;
}
?>

View file

@ -0,0 +1,425 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: hooks.php 2013-08-20 10:58Z EdsonOrdaz $
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("member_profile_end", "profile_achivements");
$plugins->add_hook("postbit", "postbit_achivements");
$plugins->add_hook("usercp_start", "usercp_achivements");
$plugins->add_hook("modcp_start", "modcp_achivements");
function postbit_achivements(&$post)
{
global $templates, $mybb, $lang;
$lang->load("achivements", false, true);
static $static_achievements;
$post['achivements'] = getarchivements($post['uid']);
if (!$post['achivements'])
{
$achivements = $lang->notachivements;
}
else
{
$num_achiviements = 0;
foreach($post['achivements'] as $column => $logro)
{
if($logro['showpostbit'] == 1)
{
++$num_achiviements;
$achivements .= "<img src=\"".htmlspecialchars_uni($logro['image'])."\" title=\"".htmlspecialchars_uni($logro['name'])."\" /> ";
if ($num_achiviements >= $mybb->settings['achivements_maxpostbit'])
break;
else
continue;
}
if ($num_achiviements >= $mybb->settings['achivements_maxpostbit'])
break;
else
continue;
}
if(!$achivements)
{
$achivements = $lang->achshide;
}
}
if($mybb->settings['achivements_showachvpostbit'] == 1)
{
eval("\$post['achivementspostbit'] = \"".$templates->get("achivements_postbit")."\";");
}
}
function profile_achivements()
{
global $mybb, $memprofile, $templates, $lang, $theme, $achivements, $achivementsprofile;
$lang->load("achivements", false, true);
$memprofile['achivements'] = getarchivements($memprofile['uid']);
if(!$memprofile['achivements'])
{
$lang->achisemptytableprofile = $lang->sprintf($lang->achisemptytableprofile, $memprofile['username']);
$achivements = $lang->achisemptytableprofile;
}
else
{
foreach($memprofile['achivements'] as $archivement)
{
if($archivement['showprofile'] == 1)
{
$achivements .= "<img src=\"".htmlspecialchars_uni($archivement['image'])."\" title=\"".htmlspecialchars_uni($archivement['name'])."\" /> ";
}
}
if(!$achivements)
{
$lang->achishidetableprofile = $lang->sprintf($lang->achishidetableprofile, $memprofile['username']);
$achivements = $lang->achishidetableprofile;
}
}
$lang->achsmemprofile = $lang->sprintf($lang->achsmemprofile, $memprofile['username']);
if($mybb->settings['achivements_showachvprofile'] == 1)
{
eval("\$achivementsprofile = \"".$templates->get("achivements_profile")."\";");
}
}
function usercp_achivements()
{
global $mybb,$db,$templates,$theme,$lang,$headerinclude,$header,$footer,$usercpnav;
if($mybb->input['action'] != "achivements" && $mybb->input['action'] != "do_achivements")
{
return;
}
if($mybb->input['action'] == "do_achivements" && $mybb->request_method == "post")
{
verify_post_check($mybb->input['my_post_key']);
$mybb->user['achivements'] = getarchivements($mybb->user['uid']);
if($mybb->input['profile'])
{
$db->update_query('user_achivements', array('showprofile' => 0), '`uid`='.$mybb->user['uid']);
if($mybb->input['showachivement'])
{
foreach($mybb->input['showachivement'] as $achs)
{
$db->update_query('user_achivements', array('showprofile' => 1), '`uid`='.$mybb->user['uid'].' AND `aid`='.$achs);
}
}
}
if($mybb->input['postbit'])
{
$db->update_query('user_achivements', array('showpostbit' => 0), '`uid`='.$mybb->user['uid']);
if($mybb->input['showachivement'])
{
$count = 0;
foreach($mybb->input['showachivement'] as $achs)
{
$db->update_query('user_achivements', array('showpostbit' => 1), '`uid`='.$mybb->user['uid'].' AND `aid`='.$achs);
++$count;
if($count >= $mybb->settings['achivements_maxpostbit'])
break;
else
continue;
}
}
}
redirect("usercp.php", $lang->redirect_profileupdated);
}
if($errors)
{
$errors = inline_error($errors);
}
$lang->load("achivements", false, true);
add_breadcrumb($lang->nav_usercp, "usercp.php");
add_breadcrumb($lang->achivements, "usercp.php");
static $static_achievements;
$mybb->user['achivements'] = getarchivements($mybb->user['uid']);
if(!$mybb->user['achivements'])
{
$achivements = "<span class='smalltext'>{$lang->achisemptytableprofileusercp}</span>";
$currentachivements = "<span class='smalltext'>{$lang->achisemptytableprofileusercp}</span>";
$currentachivementspostbit = "<span class='smalltext'>{$lang->achisemptytableprofileusercp}</span>";
}
else
{
$intshow = 0;
$intshowpostbit = 0;
$currentachivements = "<small>{$lang->achivementsshowprofilecurrent}</small><br />";
$lang->achivementsshowpostbitcurrent = $lang->sprintf($lang->achivementsshowpostbitcurrent, $mybb->settings['achivements_maxpostbit']);
$currentachivementspostbit = "<small>{$lang->achivementsshowpostbitcurrent}</small><br />";
$countachs = 1;
$postbit = 0;
//die(var_dump($mybb->user['achivements']));
foreach($mybb->user['achivements'] as $archivement)
{
if($archivement['showprofile'] == 1)
{
$intshow = 1;
$currentachivements .= "<img src=\"".htmlspecialchars_uni($archivement['image'])."\" title=\"".htmlspecialchars_uni($archivement['name'])."\" /> ";
}
if($archivement['showpostbit'] == 1 && $postbit == 0)
{
$intshowpostbit = 1;
$currentachivementspostbit .= "<img src=\"".htmlspecialchars_uni($archivement['image'])."\" title=\"".htmlspecialchars_uni($archivement['name'])."\" /> ";
if($countachs >= intval($mybb->settings['achivements_maxpostbit']))
{
$postbit = 1;
}else{
$postbit = 0;
}
++$countachs;
}
}
if($intshowpostbit == 0)
{
$currentachivementspostbit = "<small>{$lang->notachshowpostbit}</small>";
}
if($intshow == 0)
{
$currentachivements = "<small>{$lang->notachshowprofile}</small>";
}
foreach($mybb->user['achivements'] as $ach)
{
$achivement .= "<img src=\"".htmlspecialchars_uni($ach['image'])."\" title=\"".htmlspecialchars_uni($ach['name'])."\" /> ";
eval("\$achivements .= \"".$templates->get("achivements_usercp_all")."\";");
unset($achivement);
}
}
eval("\$achivementsusercp = \"".$templates->get("achivements_usercp")."\";");
output_page($achivementsusercp);
}
function modcp_achivements()
{
global $templates, $modcp_nav, $lang, $mybb, $db;
global $headerinclude, $header, $errors, $theme, $cache, $footer;
$lang->load("achivements", false, true);
$lang->load("admin/achivements", false, true);
if($mybb->settings['achivements_modcp'] == 1)
{
eval("\$nav_achivements = \"".$templates->get("achivements_modcp_nav")."\";");
$modcp_nav = str_replace('<!--modcp_achivements-->', $nav_achivements, $modcp_nav);
}
if($mybb->input['action'] == "achivements" && $mybb->usergroup['canmodcp'] == 1 && $mybb->settings['achivements_modcp'] == 1)
{
add_breadcrumb($lang->nav_modcp, "modcp.php");
add_breadcrumb($lang->achivements, 'modcp.php?action=achivements');
if($mybb->input['mod'] == "give")
{
$query = $db->simple_select('achivements_custom', '*', "acid='".intval($mybb->input['acid'])."'");
$custom = $db->fetch_array($query);
if(!$custom['acid'])
{
error_no_permission();
}
if($custom['modcp'] == 0)
{
error_no_permission();
}
if($mybb->request_method == "post")
{
$query = $db->simple_select("users", '*', "username='".$db->escape_string($mybb->input['username'])."'");
$user = $db->fetch_array($query);
if(!$user['uid'])
{
error_no_permission();
}
$achivements = unserialize($user['achivements']);
$acid = intval($custom['acid']);
if(!empty($achivements['acid'][$acid]['acid']))
{
$lang->repeatcustom = $lang->sprintf($lang->repeatcustom, $user['username'], $custom['name']);
redirect("modcp.php?action=achivements", $lang->repeatcustom);
}
$achivements['acid'][$acid] = array('acid' => $acid, 'name' => $db->escape_string($custom['name']), 'image' => $db->escape_string($custom['image']), 'showprofile' => 1, 'showpostbit' => 0);
$updateuser = array(
'achivements' => serialize($achivements)
);
$lang->successachcustom = $lang->sprintf($lang->successachcustom, $custom['name'], $user['username']);
$db->update_query("users", $updateuser,"uid=".$user['uid']);
$add = array(
'user' => $mybb->user['uid'],
'give' => $user['uid'],
'dateline' => TIME_NOW,
'log' => 'give',
'acid' => $custom['acid'],
'ipaddress' => get_ip()
);
$add = serialize($add);
add_log_custom_modcp($add);
require_once MYBB_ROOT."inc/plugins/achivements/include/mp.php";
$sendmp = unserialize($mybb->settings['achivements_sendmp']);
if($sendmp['custom'] == 1)
{
send_mp_achivement_new($user['uid'], 'custom', $custom['acid']);
}
redirect("modcp.php?action=achivements", $lang->successachcustom);
exit;
}
$lang->giveuserform = $lang->sprintf($lang->giveuserform, $custom['name']);
eval("\$give = \"".$templates->get("achivements_modcp_give")."\";");
output_page($give);
exit;
}
elseif($mybb->input['mod'] == "quit")
{
$query = $db->simple_select('achivements_custom', '*', "acid='".intval($mybb->input['acid'])."'");
$custom = $db->fetch_array($query);
if(!$custom['acid'])
{
error_no_permission();
}
if($custom['modcp'] == 0)
{
error_no_permission();
}
if($mybb->request_method == "post")
{
$query = $db->simple_select("users", '*', "username='".$db->escape_string($mybb->input['username'])."'");
$user = $db->fetch_array($query);
if(!$user['uid'])
{
error_no_permission();
}
$achivements = unserialize($user['achivements']);
$acid = intval($custom['acid']);
if(empty($achivements['acid'][$acid]['acid']))
{
$lang->notcustomuser = $lang->sprintf($lang->notcustomuser, $user['username'], $custom['name']);
redirect("modcp.php?action=achivements", $lang->notcustomuser);
}
unset($achivements['acid'][$acid]);
if(empty($achivements['acid']))
{
unset($achivements['acid']);
}
$updateuser = array(
'achivements' => serialize($achivements)
);
$db->update_query("users", $updateuser,"uid=".$user['uid']);
$add = array(
'user' => $mybb->user['uid'],
'revoke' => $user['uid'],
'dateline' => TIME_NOW,
'log' => 'revoke',
'acid' => $custom['acid'],
'ipaddress' => get_ip()
);
$add = serialize($add);
add_log_custom_modcp($add);
$lang->successachivementcustomdelete = $lang->sprintf($lang->successachivementcustomdelete, $user['username'], $custom['name']);
redirect("modcp.php?action=achivements", $lang->successachivementcustomdelete);
exit;
}
$lang->quitcustom = $lang->sprintf($lang->quitcustom, $custom['name']);
eval("\$quit = \"".$templates->get("achivements_modcp_quit")."\";");
output_page($quit);
exit;
}
$query = $db->simple_select('achivements_custom', '*', 'modcp="1"', array('order_by' => 'acid', 'order_dir' => 'DESC'));
while($custom = $db->fetch_array($query))
{
$trow = alt_trow();
eval("\$custom_achivements .= \"".$templates->get("achivements_modcp_list")."\";");
}
if(empty($custom_achivements))
{
$custom_achivements = "<tr><td class=\"trow1\" align=\"center\" colspan=\"10\">{$lang->emptycustom_modules}</td></tr>";
}
eval("\$modcpachivements = \"".$templates->get("achivements_modcp")."\";");
output_page($modcpachivements);
}
}
function add_log_custom_modcp($log)
{
global $db, $lang;
$log = unserialize($log);
$user = get_user(intval($log['user']));
//$custom = getcustom($log['acid']);
if($log['log'] == 'add')
{
$lang->logadd = $lang->sprintf($lang->logadd, $custom['name']);
$loginsert = $lang->logadd;
}
elseif($log['log'] == 'quit')
{
$lang->logdelete = $lang->sprintf($lang->logdelete, $custom['name']);
$loginsert = $lang->logdelete;
}
elseif($log['log'] == 'give')
{
$give = get_user($log['give']);
$username = format_name($give['username'], $give['usergroup'], $give['displaygroup']);
$profilelink = build_profile_link($username, $give['uid'], "_blank");
$lang->loggive = $lang->sprintf($lang->loggive, $custom['name'], $profilelink);
$loginsert = $lang->loggive;
}
elseif($log['log'] == 'revoke')
{
$revoke = get_user($log['revoke']);
$username = format_name($revoke['username'], $revoke['usergroup'], $revoke['displaygroup']);
$profilelink = build_profile_link($username, $revoke['uid'], "_blank");
$lang->logrevoke = $lang->sprintf($lang->logrevoke, $custom['name'], $profilelink);
$loginsert = $lang->logrevoke;
}
elseif($log['log'] == 'truncate')
{
$db->query("truncate ".TABLE_PREFIX."achivements_customlog");
$loginsert = $lang->logtruncate;
}
$lid = $db->insert_id();
$updatelog = array(
"lid" => $lid,
"user" => intval($log['user']),
"log" => $loginsert,
"dateline" => intval($log['dateline']),
"ipaddress" => $log['ipaddress']
);
$db->insert_query("achivements_customlog", $updatelog);
}
function getarchivements($uid)
{
global $db;
$query = $db->query("SELECT * FROM `".TABLE_PREFIX."achivements` a LEFT JOIN `".TABLE_PREFIX."user_achivements` ua ON ua.`aid`=a.`id` WHERE ua.uid='".intval($uid)."'");
while($row = $db->fetch_array($query)){
$custom[] = $row;
}
$db->free_result($query);
return $custom;
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,592 @@
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function delete_images_unlink()
{
global $db;
$query = $db->simple_select('achivements');
$delete_images = array();
while($achivement_img = $db->fetch_array($query))
{
$delete_images[] = @unlink(MYBB_ROOT.$achivement_img['image']);
}
}
$tables[] = array('name' => 'achivements', 'insert' => "CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."achivements` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '',
`description` varchar(200) NOT NULL DEFAULT '',
`type` enum('post','threads','rep','time','regdate','custom','archivements'),
`requirement` int(11) NOT NULL DEFAULT 0,
`requirement_unit` varchar(20) NOT NULL DEFAULT 0,
`required_achivements` TEXT NOT NULL DEFAULT '',
`requirement_text` TEXT NOT NULL DEFAULT '',
`modcp` tinyint(1) NOT NULL DEFAULT 0,
`image` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM");
$tables[] = array('name' => 'user_achivements', 'insert' => "CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."user_achivements` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL,
`aid` int(11) unsigned NOT NULL,
`showprofile` tinyint(1) unsigned NOT NULL DEFAULT 0,
`showpostbit` tinyint(1) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `aid` (`aid`)
) ENGINE=MyISAM");
$templates[] = array(
"title" => 'achivements',
"template" => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->achivements}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
<td valign="top">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementsbyposts}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->posts}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$posts}
</table>
<br />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementsbythreads}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->threads}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$threads}
</table>
<br />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementsbyreputation}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->reputation}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$reputation}
</table>
<br />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementsbytimeonline}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="15%" align="center"><strong>{$lang->timeonline}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$timeonline}
</table>
<br />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementsbyregdate}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="15%" align="center"><strong>{$lang->regdate}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$regdate}
</table>
</td>
</tr>
</table>
<br />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4">
<strong>{$lang->achivementscustom}</span></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><strong>{$lang->image}</strong></td>
<td class="tcat" width="15%" align="center"><strong>{$lang->requirement}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->name}</strong></td>
<td class="tcat"><strong>{$lang->description}</strong></td>
</tr>
{$custom}
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_empty',
"template" => $db->escape_string('<tr><td class="trow1" colspan="4" align="center">{$lang->achiviementstableempty}</td></tr>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_list',
"template" => $db->escape_string('<tr>
<td class="{$color}" width="10%" align="center"><img src="{$achivements[\'image\']}" /></td>
<td class="{$color}" width="10%" align="center">{$achivements[\'value\']}</td>
<td class="{$color}" width="20%">{$achivements[\'name\']}</td>
<td class="{$color}">{$achivements[\'description\']}</td>
</tr>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_profile',
"template" => $db->escape_string('<br />
<table id="achivements" border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->achsmemprofile}</strong></td>
</tr>
<tr>
<td class="trow1">
{$achivements}
</td>
</tr>
</table>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_postbit',
"template" => $db->escape_string('{$lang->achivements}: {$achivements}'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
//add templates v2.1
$templates[] = array(
"title" => 'achivements_usercp',
"template" => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->achivements}</title>
{$headerinclude}
<script languaje="javascript">
function select_all_achivements(){
for (i=0;i<document.achivements_form.elements.length;i++)
if(document.achivements_form.elements[i].type == "checkbox")
document.achivements_form.elements[i].checked=1
}
function unselect_all_achivements(){
for (i=0;i<document.achivements_form.elements.length;i++)
if(document.achivements_form.elements[i].type == "checkbox")
document.achivements_form.elements[i].checked=0
}
</script>
</head>
<body>
{$header}
<form method="post" name="achivements_form" enctype="multipart/form-data" action="usercp.php">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
{$errors}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->achivements}</strong></td>
</tr>
<tr>
<td class="tcat"><strong>{$lang->achivementscurrentprofile}</strong></td>
</tr>
<tr>
<td class="trow1">{$currentachivements}</td>
</tr>
<tr>
<td class="tcat"><strong>{$lang->achivementscurrentpostbit}</strong></td>
</tr>
<tr>
<td class="trow1">{$currentachivementspostbit}</td>
</tr>
<tr>
<td class="tcat"><strong>{$lang->myachivements}</strong></td>
</tr>
<tr>
<td class="trow2">
<a href="javascript:select_all_achivements()"><small>{$lang->markall}</small></a> |
<a href="javascript:unselect_all_achivements()"><small>{$lang->marknone}</small></a><br />
{$achivements}</td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="do_achivements" />
<input type="submit" class="button" name="profile" value="{$lang->showinprofile}" />
<input type="submit" class="button" name="postbit" value="{$lang->showinpostbit}" />
</div>
</td>
</tr>
</table>
</form>
{$footer}
</body>
</html>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_usercp_all',
"template" => $db->escape_string('<label for="{$ach[\'name\']}"><input type="checkbox" name="showachivement[]" value="{$ach[\'id\']}" /> {$achivement}</label>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_modcp',
"template" => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->achivements}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$modcp_nav}
<td valign="top">
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="4"><strong>{$lang->custom_modules}</strong></td>
</tr>
<tr>
<td class="tcat" width="10%" align="center"><span class="smalltext"><strong>{$lang->image}</strong></span>
<td class="tcat"><span class="smalltext"><strong>{$lang->namedescription}</strong></span>
<td class="tcat" width="20%" align="center" colspan="2"><span class="smalltext"><strong>{$lang->option}</strong></span>
</td>
<tr>
{$custom_achivements}
</tr>
</table>
</td>
</tr>
</table>
{$footer}
</body>
</html>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_modcp_give',
"template" => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->giveachivements}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$modcp_nav}
<td valign="top">
<form action="modcp.php?action=achivements" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="mod" value="{$mybb->input[\'mod\']}" />
<input type="hidden" name="id" value="{$mybb->input[\'id\']}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->giveuserform}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->user}</strong>:</td>
<td class="trow2"><input type="text" class="textbox" id="username" name="username" size="40" maxlength="85" tabindex="1" /></td>
</table>
<br />
<div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->giveachivements}"/></div>
</form>
</td>
</tr>
</table>
{$footer}
<script type="text/javascript" src="jscripts/autocomplete.js?ver=1400"></script>
<script type="text/javascript">
<!--
if(use_xmlhttprequest == "1")
{
new autoComplete("username", "xmlhttp.php?action=get_users", {valueSpan: "username"});
}
// -->
</script>
</body>
</html>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_modcp_quit',
"template" => $db->escape_string('<html>
<head>
<title>{$mybb->settings[\'bbname\']} - {$lang->quitachivement}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$modcp_nav}
<td valign="top">
<form action="modcp.php?action=achivements" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="mod" value="{$mybb->input[\'mod\']}" />
<input type="hidden" name="acid" value="{$mybb->input[\'acid\']}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->quitcustom}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->user}</strong>:</td>
<td class="trow2"><input type="text" class="textbox" id="username" name="username" size="40" maxlength="85" tabindex="1" /></td>
</table>
<br />
<div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->quitachivement}"/></div>
</form>
</td>
</tr>
</table>
{$footer}
<script type="text/javascript" src="jscripts/autocomplete.js?ver=1400"></script>
<script type="text/javascript">
<!--
if(use_xmlhttprequest == "1")
{
new autoComplete("username", "xmlhttp.php?action=get_users", {valueSpan: "username"});
}
// -->
</script>
</body>
</html>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_modcp_nav',
"template" => $db->escape_string('<tr>
<td class="trow1 smalltext">
<a href="modcp.php?action=achivements" style="display: block;padding: 1px 0 1px 23px;background: url(inc/plugins/achivements/include/images/modcp.png) no-repeat left center;">{$lang->custom_modules}</a></td>
</tr>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$templates[] = array(
"title" => 'achivements_modcp_list',
"template" => $db->escape_string('<tr>
<td class="{$trow}" align="center"><img src="{$custom[\'image\']}" title="{$custom[\'name\']}" /></td>
<td class="{$trow}"><strong>{$custom[\'name\']}</strong><br /><span class="smalltext">{$custom[\'reason\']}</span></td>
<td class="{$trow}" width="10%" align="center"><a href="modcp.php?action=achivements&mod=give&id={$custom[\'id\']}" />{$lang->give}</a></td>
<td class="{$trow}" width="10%" align="center"><a href="modcp.php?action=achivements&mod=quit&id={$custom[\'id\']}" />{$lang->quit}</a></td>
</tr>'),
"sid" => -1,
"version" => 1604,
"dateline" => TIME_NOW,
);
$fields[] = array('table' => 'users', 'column' => 'threads', 'insert' => 'int(11) unsigned NOT NULL default \'0\'');
function settings_insert()
{
global $lang;
$lang->load('achivements');
$settings_achivements[] = array(
"name" => "achivements_enable",
"title" => $lang->enable,
"description" => $lang->enable_des,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 1,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_showachvprofile",
"title" => $lang->showachvprofile,
"description" => $lang->showachvprofiledes,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 2,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_showachvpostbit",
"title" => $lang->showachvpostbit,
"description" => $lang->showachvpostbitdes,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 3,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_sendmp",
"title" => $lang->sendmpachivements,
"description" => $lang->sendmpachivements_des,
"optionscode" => "textarea",
"value" => "",
"disporder" => 4,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_subjectmp",
"title" => $lang->titlemp,
"description" => $lang->titlempdes,
"optionscode" => "textarea",
"value" => $lang->subjectvalue,
"disporder" => 5,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_bodymp",
"title" => $lang->bodymp,
"description" => $lang->bodympdes,
"optionscode" => "textarea",
"value" => $lang->bodyvalue,
"disporder" => 6,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_usermp",
"title" => $lang->user,
"description" => $lang->usersendmp,
"optionscode" => "text",
"value" => "1",
"disporder" => 7,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_rebuild",
"title" => $lang->rebuild,
"description" => $lang->rebuild,
"optionscode" => "yesno",
"value" => "0",
"disporder" => 8,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_maxpostbit",
"title" => $lang->maxpostbit,
"description" => $lang->maxpostbitdes,
"optionscode" => "text",
"value" => "15",
"disporder" => 9,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_taskuseroffline",
"title" => $lang->taskoffline,
"description" => $lang->taskofflinedes,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 10,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_modcp",
"title" => $lang->canmodcpachs,
"description" => $lang->canmodcpachsdes,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 11,
"gid" => 0
);
$settings_achivements[] = array(
"name" => "achivements_showonlycurrent",
"title" => $lang->showonlycurrent,
"description" => $lang->showonlycurrentdes,
"optionscode" => "yesno",
"value" => "1",
"disporder" => 12,
"gid" => 0
);
return $settings_achivements;
}
function count_threads_update()
{
global $db;
$query = $db->simple_select("users", "uid");
while($user = $db->fetch_array($query))
{
$users[$user['uid']] = $user;
}
foreach($users as $user)
{
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "uid = '".$user['uid']."'");
$threads_count = intval($db->fetch_field($query, "threads"));
$db->update_query("users", array("threads" => $threads_count), "uid = '".$user['uid']."'");
}
}
function create_task_tools()
{
global $db, $lang;
$lang->load('achivements');
$new_task_achivements = array(
"title" => "Achivements",
"description" => $lang->desctaks,
"file" => "achivements",
"minute" => '0',
"hour" => '0',
"day" => '*',
"month" => '*',
"weekday" => '*',
"nextrun" => TIME_NOW + (1*24*60*60),
"enabled" => '0',
"logging" => '1'
);
$db->insert_query("tasks", $new_task_achivements);
}
?>

View file

@ -0,0 +1,107 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: mp.php 2012-05-27 10:58Z EdsonOrdaz $
*/
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function get_achivement($table, $id)
{
global $db;
$query = $db->simple_select('achivements_'.$table, '*', $id);
$achivement = $db->fetch_array($query);
$read = array(
"name" => $achivement['name'],
"image" => $achivement['image'],
"description" => $achivement['description'],
"reason" => $achivement['reason']
);
return $read;
}
function send_mp_achivement_new($uid, $table, $id)
{
global $mybb;
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
$user = get_user($uid);
switch($table)
{
case 'posts':
$achivement = get_achivement('posts', "apid='".$id."'");
break;
case 'threads':
$achivement = get_achivement('threads', "atid='".$id."'");
break;
case 'reputation':
$achivement = get_achivement('reputation', "arid='".$id."'");
break;
case 'timeonline':
$achivement = get_achivement('timeonline', "toid='".$id."'");
break;
case 'regdate':
$achivement = get_achivement('regdate', "rgid='".$id."'");
break;
case 'custom':
$achivement = get_achivement('custom', "acid='".$id."'");
break;
case 'achivement':
$achivement = get_achivement('achivement', "aaid='".$id."'");
break;
}
$message = $mybb->settings['achivements_bodymp'];
$message = str_replace('{user}', $user['username'], $message);
$message = str_replace('{bburl}', $mybb->settings['bburl'], $message);
$message = str_replace('{bbname}', $mybb->settings['bbname'], $message);
$message = str_replace('{name}', $achivement['name'], $message);
if($table == 'custom')
{
$message = str_replace('{description}', $achivement['reason'], $message);
}
else
{
$message = str_replace('{description}', $achivement['description'], $message);
}
$message = str_replace('{image}', "[img]".$mybb->settings['bburl']."/".$achivement['image']."[/img]", $message);
$pm = array(
"subject" => $mybb->settings['achivements_subjectmp'],
"message" => $message,
"icon" => -1,
"fromid" => intval($mybb->settings['achivements_usermp']),
"toid" => array($user['uid']),
"do" => '',
"pmid" => ''
);
$pm['options'] = array(
"signature" => 1,
"disablesmilies" => 0,
"savecopy" => 0,
"readreceipt" => 0
);
$pm['saveasdraft'] = 0;
$pmhandler->admin_override = 1;
$pmhandler->set_data($pm);
if($pmhandler->validate_pm())
{
$pmhandler->insert_pm();
}
}
?>

View file

@ -0,0 +1,132 @@
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function achivements_init_info()
{
global $lang;
$lang->load('achivements');
return array(
"name" => "Achivements",
"description" => $lang->achivements_description,
"website" => "http://coppertopia.net/",
"author" => "genuine",
"version" => "1.0",
"compatibility" => "16*",
);
}
function achivements_init_is_installed()
{
global $db;
if ($db->table_exists('achivements') && $db->table_exists('user_achivements'))
{
$return = true;
}else{
$return = false;
}
return $return;
}
function achivements_init_install()
{
global $db, $cache;
require_once MYBB_ROOT."inc/plugins/achivements/include/install.php";
$collation = $db->build_create_table_collation();
foreach($tables as $table){
if(!$db->table_exists($table['name']))
{
$db->query($table['insert'].$collation);
}
}
foreach($fields as $field)
{
if(!$db->field_exists($field['column'], $field['table']))
{
$db->add_column($field['table'], $field['column'], $field['insert']);
}
}
count_threads_update();
if(file_exists(MYBB_ROOT."inc/tasks/achivements.php"))
{
create_task_tools();
}
foreach(settings_insert() as $installsettings)
{
$db->insert_query("settings", $installsettings);
}
foreach($templates as $template)
{
$db->insert_query("templates", $template);
}
rebuildsettings();
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('member_profile', '#{\$profilefields}#', '{\$profilefields}<!-- Profile_achivements -->{\$achivementsprofile}<!-- /Profile_achivements -->');
find_replace_templatesets('usercp_nav_profile', '#{\$changesigop}#', '{\$changesigop}<!-- usercp_achivements --><div><a href="usercp.php?action=achivements" class="usercp_nav_item" style="padding-left: 40px;background: url(inc/plugins/achivements/include/images/achivements_usercp.png) no-repeat left center;">Achivements</a></div><!-- /usercp_achivements -->');
find_replace_templatesets('modcp_nav', '#{\$lang->mcp_nav_editprofile}</a></td></tr>#', '{\$lang->mcp_nav_editprofile}</a></td></tr><!--modcp_achivements-->');
find_replace_templatesets('postbit', '#'.preg_quote('{$post[\'user_details\']}').'#', "{\$post['user_details']}<!-- postbit_achivements -->{\$post['achivementspostbit']}<!-- /postbit_achivements -->");
find_replace_templatesets('postbit_classic', '#'.preg_quote('{$post[\'user_details\']}').'#', "{\$post['user_details']}<!-- postbit_achivements -->{\$post['achivementspostbit']}<!-- /postbit_achivements -->");
change_admin_permission("achivements", true, 1);
change_admin_permission("achivements", "posts", 0);
change_admin_permission("achivements", "threads", 0);
change_admin_permission("achivements", "reputation", 0);
change_admin_permission("achivements", "timeonline", 0);
change_admin_permission("achivements", "regdate", 0);
change_admin_permission("achivements", "custom", 0);
change_admin_permission("achivements", "achivements", 0);
change_admin_permission("achivements", "settings", 0);
change_admin_permission("achivements", "extensions", 0);
change_admin_permission("achivements", "config", 0);
}
function achivements_init_uninstall()
{
global $db, $cache;
require_once MYBB_ROOT."inc/plugins/achivements/include/install.php";
delete_images_unlink();
foreach($tables as $table){
if($db->table_exists($table['name']))
{
$db->drop_table($table['name']);
}
}
foreach($fields as $field)
{
if($db->field_exists($field['column'], $field['table']))
{
$db->drop_column($field['table'], $field['column']);
}
}
$db->delete_query('tasks', 'file=\'achivements\'');
$db->delete_query("settings","name LIKE 'achivements_%'");
$db->delete_query("templates","title LIKE 'achivements%'");
rebuildsettings();
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('member_profile', '#\<!--\sProfile_achivements\s--\>(.+)\<!--\s/Profile_achivements\s--\>#is', '', 0);
find_replace_templatesets('usercp_nav_profile', '#\<!--\susercp_achivements\s--\>(.+)\<!--\s/usercp_achivements\s--\>#is', '', 0);
find_replace_templatesets('modcp_nav', '#\<!--modcp_achivements-->#is', '', 0);
find_replace_templatesets('postbit', '#\<!--\spostbit_achivements\s--\>(.+)\<!--\s/postbit_achivements\s--\>#is', '', 0);
find_replace_templatesets('postbit_classic', '#\<!--\spostbit_achivements\s--\>(.+)\<!--\s/postbit_achivements\s--\>#is', '', 0);
change_admin_permission("achivements", false, -1);
change_admin_permission("achivements", "posts", -1);
change_admin_permission("achivements", "threads", -1);
change_admin_permission("achivements", "reputation", -1);
change_admin_permission("achivements", "timeonline", -1);
change_admin_permission("achivements", "regdate", -1);
change_admin_permission("achivements", "custom", -1);
change_admin_permission("achivements", "achivements", -1);
change_admin_permission("achivements", "settings", -1);
change_admin_permission("achivements", "extensions", -1);
change_admin_permission("achivements", "config", -1);
}
?>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,75 @@
<?php
//Global
$l['achivements'] = "Achievements";
$l['image'] = "Image";
$l['name'] = "Name";
$l['description'] = "Description";
$l['achiviementstableemptydate'] = "No {1}";
$l['hours'] = "Hours";
$l['hour'] = "Hour";
$l['days'] = "Days";
$l['day'] = "Day";
$l['weeks'] = "Weeks";
$l['week'] = "Week";
$l['months'] = "Months";
$l['month'] = "Month";
$l['years'] = "Years";
$l['year'] = "Year";
//Posts
$l['posts'] = "Posts";
$l['achivementsbyposts'] = "Achievements for Posts";
//Threads
$l['threads'] = "Threads";
$l['achivementsbythreads'] = "Achievements for Threads";
//Reputation
$l['reputation'] = "Reputation";
$l['achivementsbyreputation'] = "Achievements for Reputation";
//TimeOnline
$l['timeonline'] = "Online-Time";
$l['achivementsbytimeonline'] = "Achievements for Online-Time";
//RegDate
$l['regdate'] = "Time Registered";
$l['achivementsbyregdate'] = "Achievements for Time Registered";
//RegDate
$l['requirement'] = "Requires";
$l['achivementscustom'] = "Other Achievements";
//profile and postbit
$l['achsmemprofile'] = "{1} Achievements";
$l['achisemptytableprofile'] = "The user {1} does not have any achievements.";
//usercp V2.1
$l['achivementscurrentprofile'] = "Current achievements in profile";
$l['achivementscurrentpostbit'] = "Current achievements in postbit";
$l['myachivements'] = "My Achivements";
$l['markall'] = "Mark all";
$l['marknone'] = "Unmark all";
$l['showinprofile'] = "Show in profile";
$l['showinpostbit'] = "Show in Postbit";
$l['achivementsshowprofilecurrent'] = "Achievements displayed in your profile.";
$l['notachshowprofile'] = "There is no achievement shown in your profile.";
$l['achisemptytableprofileusercp'] = "You do not have any achievements.";
$l['achivementsshowpostbitcurrent'] = "Achievements displayed in your postbit, remember that you can only display {1} achievements.<br />Note* Although more choices of {1} accomplishments only keep the first {1} and the other not be saved.";
$l['notachshowpostbit'] = "There is no achievement shown in your postbit.";
$l['achishidetableprofile'] = "The user {1} has hidden achievements.";
$l['achshide'] = "Hidden";
//modcp v2.2
$l['namedescription'] = "Name / Description";
$l['option'] = "Options";
$l['give'] = "Give";
$l['quit'] = "Quit";
//v2.4
$l['notachivements'] = "No achivements";
?>

View file

@ -0,0 +1,313 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 MyBB-Es Team, All Rights Reserved
*
* Website: http://www.mybb-es.com.com
*
* $Id: achivements.lang.php 2013-08-20 10:58Z EdsonOrdaz $
*/
$l['achivements'] = "Achievements";
$l['achivements_description'] = "Great achievements automated system.";
$l['desctaks'] = "Add users to automatically medals.";
/***** MODULE_META *****/
$l['posts'] = "Posts";
$l['threads'] = "Threads";
$l['reputation'] = "Reputation";
$l['timeonline'] = "Online-Time";
$l['regdate'] = "Time Registered";
$l['custom'] = "Custom";
$l['setts'] = "Settings";
$l['permisions_posts'] = "Can edit achievements for posts?";
$l['permisions_threads'] = "Can edit achievements for Threads?";
$l['permisions_reputation'] = "Can edit achievements for Reputation";
$l['permisions_timeonline'] = "Can edit achievements for Online-Time?";
$l['permisions_regdate'] = "Can edit achievements for registration time?";
$l['permisions_custom'] = "Can edit custom achievements?";
$l['permisions_settings'] = "Can configure achievement?";
/***** ACHIVEMENTS *****/
/***********************/
//Global achivements
$l['newachivements'] = "New Achievement";
$l['newnnameachivements'] = "Name";
$l['newnnameachivements_des'] = "Enter the name of this achievement.";
$l['description'] = "Description";
$l['description_des'] = "Enter a description of the achievement.";
$l['image'] = "Image";
$l['image_des'] = "Select the image for the achievement.";
$l['savenewachivements'] = "Save Achievement";
$l['notname'] = "You have not entered a name for the achievement.";
$l['notdescription'] = "You have not added a description for the achievement.";
$l['errornotcopyachivement'] = "Failed to upload the image.";
$l['extimageachivementerror'] = "Extension of the image is not valid.";
$l['errorloadingachivement'] = "Failed to upload the image.";
$l['successachivement'] = "The achievement has been saved successfully.";
$l['successdeleteachivement'] = "The achievement was successfully removed.";
$l['noneeditachivement'] = "There is no achievement that you try to edit.";
$l['confirmdeleteachivements'] = "Do you want to delete the achievement {1}?";
$l['imageusedactual'] = "current image";
$l['imageusedactual_des'] = "This is the current image, if you do not select a new one it will not be replaced.";
$l['imagenewup'] = "New Image";
$l['successeditachivements'] = "Achivement {1} successfully edited.";
$l['edittab'] = "Edit achievement.";
$l['hours'] = "Hours";
$l['hour'] = "Hour";
$l['days'] = "Days";
$l['day'] = "Day";
$l['weeks'] = "Weeks";
$l['week'] = "Week";
$l['months'] = "Months";
$l['month'] = "Month";
$l['years'] = "Years";
$l['year'] = "Year";
//Posts
$l['posts_modules_destab'] = "Here are listed all the achievements for posts. These achievements are given automatically when the user gets the required posts.";
$l['posts_modules'] = "Achievements for Posts";
$l['newachivementsbyposts'] = "New achievement for posts";
$l['newpostsachivements'] = "Posts";
$l['newpostsachivements_des'] = "Enter the number of posts that the user must have to receive this achievement.";
$l['emptyposts_modules'] = "There is no achievement for posts";
$l['newachivements_postdes'] = "Add a new achievement for posts.";
$l['notposts'] = "You have not entered a number of posts for the achievement.";
//Threads
$l['threads_modules_destab'] = "Here are listed all the achievements for Threads. These achievements are given automatically when the user gets the required Threadcount.";
$l['threads_modules'] = "Achievements by Threads";
$l['newachivementsbythreads'] = "New achievement for threads";
$l['newthreadsachivements'] = "Threads";
$l['newthreadsachivements_des'] = "Enter the number of threads that the user must have to receive this achievement.";
$l['emptythreads_modules'] = "There is no achievement for threads";
$l['newachivements_threadsdes'] = "Add a new achievement for threads.";
$l['notthreads'] = "You have not entered a number of threads for the achievement.";
//Reputation
$l['reputation_modules_destab'] = "Here are listed all the achievements for reputation.";
$l['reputation_modules'] = "Reputation achievements";
$l['newachivementsbyreputation'] = "New achievement for reputation";
$l['newreputationachivements'] = "Reputation";
$l['newreputationachivements_des'] = "Enter the number of reputation that the user must have to receive this achievement.";
$l['emptyreputation_modules'] = "There is no achievement for reputation";
$l['newachivements_reputationdes'] = "Add a new achievement for reputation.";
$l['notreputation'] = "You have not entered a reputation for the achievement.";
//Time Online
$l['timeonline_modules_destab'] = "Here are listed all the achievements of time online.";
$l['timeonline_modules'] = "Achievements of Time Online";
$l['newachivementsbytimeonline'] = "New achievement of timeonline";
$l['timeonline_des'] = "Enter the number of time online you must have a user for this achievement.";
$l['emptytimeonline_modules'] = "There is no achievement of time online";
$l['newachivements_timeonlinedes'] = "Add a new achievement for time online.";
$l['nottimeonline'] = "You're not logged a number of online time to give the achievement.";
//Reg Date
$l['regdate_modules_destab'] = "Here are listed all the achievements of registered time.";
$l['regdate_modules'] = "Achievements of Time registered";
$l['newachivementsbyregdate'] = "New achievement registered time";
$l['regdate_des'] = "Enter the number of time that must be registered user to receive this achievement.";
$l['emptyregdate_modules'] = "There are no achievement of time registered";
$l['newachivements_regdatedes'] = "Add a new achievement registered by time.";
$l['notregdate'] = "You're not logged a number of registered time to give the achievement.";
//Custom
$l['custom_modules_destab'] = "Here are listed all the custom achievements.";
$l['custom_modules'] = "Custom achievements";
$l['newachivementsbycustom'] = "New custom achievement";
$l['emptycustom_modules'] = "There is no achievement customized";
$l['newachivements_customdes'] = "Add a new customized achievement.";
$l['requirement'] = "Requires";
$l['requirement_des'] = "A text that explains what is required for this Achivement.";
$l['reason'] = "Reason";
$l['reason_des'] = "Enter a reason why you give the achievement to the user.";
$l['user'] = "User";
$l['user_des'] = "Enter the name of the user that this achievement daras customized.";
$l['notreason'] = "You must enter a reason to give the achievement.";
$l['notuserexist'] = "No such user you want to achievement.";
//Settings
$l['setts_modules_destab'] = "Panel plugin config achivements.";
$l['rebuildthreads'] = "Recount Threads";
$l['confirmrecountthreads'] = "Count to rebuild the threads?";
$l['success_recount_threads'] = "The count of threads has been reconstructed correctly.";
$l['enable'] = "Enable";
$l['enable_des'] = "Enable / disable the plugin. If disabled not lost user data (the gains are still displayed unless you disable these options).";
$l['showachvprofile'] = "Achievement Profile";
$l['showachvprofiledes'] = "Show achievements in the users profile?";
$l['showachvpostbit'] = "Achievements in Postbit";
$l['showachvpostbitdes'] = "Show achievements in postbit for users?";
$l['sendmpachivements'] = "Send PM";
$l['sendmpachivementsdes'] = "Mark if you want the user to receive a PM to be one of the following achievements";
$l['titlemp'] = "Subject PM";
$l['titlempdes'] = "Write the title of the private message.";
$l['bodymp'] = "Message from PM";
$l['bodympdes'] = "Enter your message private message. Write
<ul>
<li>{user} to show the user name</li>
<li>{bbname} to show the forum name</li>
<li>{bburl} to show the url of the forum</li>
<li>{name} to display the name of the achievement</li>
<li>{description} to display the description / reason for the achievement</li>
<li>{image} to show the image of achievement</li>
</ul>";
$l['usersendmp'] = "Write the name of the user that sent the PM.";
$l['usersendmpnotexists'] = "The user who sent the PM does not exist.";
$l['notsubjectmp'] = "You did not enter a title the PM";
$l['notbodymp'] = "Have not written the post of PM";
$l['rebuild'] = "refresh achievements";
$l['rebuilddes'] = "If you deleted an achievement and the user will see your achievement vacuum activate it, go to work programs and executes the task; Then come back and clear this option. <br /><font color='red'><b>NOTE*</font></b> When you select this option to send private messages to users of all his achievements have been obtained even if they are old (if you enabled the option to send MP)";
$l['maxpostbit'] = "Achievements maxima of postbit";
$l['maxpostbitdes'] = "Enter the maximium number of achievements that will be displayed in the user\\'s postbit.";
$l['savesettings'] = "Save Settings";
//values MP
$l['subjectvalue'] = "You received an achievement";
$l['bodyvalue'] = "Hi [b]{user}[/b] This is an automatic message from [url={bburl}][b]{bbname}[/b][/url] Please don\\'t reply.
-----------------------------
Name of achievement: {name}
Description: {description}
Image of achievement: {image}
-----------------------------
The achievement you have been given in an automatic way to remove it or hide it from your postbit / profile go to control panel and edit them";
//\\ *************** NEW VERSION 2.0 *************** //\\
/********************* Extensions **********************/
$l['newextensions'] = "New Extension";
$l['extensions'] = "Extensions";
$l['extension'] = "Extension";
$l['version'] = "Version";
$l['created_by'] = "Created By";
$l['configs'] = "Configurations";
$l['permisions_extensions'] = "&#191;You can configure the extensions?";
$l['permisions_config'] = "&#191;You can configure the settings extensions?";
$l['extensions_modules_destab'] = "Here you can display the list of extensions you can add to extend the operation of the plugin
Achivements. To install an extension you put it to inc/plugins/achivements/extensions/ and here we will show the extent to
to activate it.";
$l['configs_modules_destab'] = "Here are the settings for each extension (if the extension has options to set).";
$l['controls'] = "Controls";
$l['no_extensions'] = "No extensions to install.";
$l['enable_disable'] = "Enable/Disable";
$l['activate'] = "Active";
$l['deactivate'] = "Deactivate";
$l['invalidpostkey'] = "The authorization code does not match. Please make sure you are correctly accessing the page.";
$l['error_invalid_extension'] = "The selected extension does not exist.";
$l['success_extension_activated'] = "The selected extension has been successfully activated.";
$l['success_extension_deactivated'] = "The selected extension has been successfully deactivated.";
$l['error_versions'] = "The version of this extension is not compatible with the current version of the plugin achivements.";
//config
$l['configextensions'] = "Extension Settings";
$l['groupsconfigs'] = "Setting groups";
$l['configview'] = "{1} Settings";
$l['no_settingsextensions'] = "No extensions configuration.";
$l['save_settings'] = "Save Setting";
$l['error_invalid_gid'] = "Not found the setting with the specified search.";
$l['error_no_settings_found'] = "There were no settings in this group.";
$l['success_settings_updated'] = "The settings were updated successfully.";
//******* VERSION 2.1 ************
$l['giveuser'] = "Give another user";
$l['notcustomexist'] = "There selected custom achievement.";
$l['giveachivements'] = "Give achievement";
$l['taskoffline'] = "Give users offline achievements";
$l['taskofflinedes'] = "Achievements also want to give users that have not been active before the last execution of the task?";
$l['noexistachivementdelete'] = "There is no achievement that you try to delete.";
//search custom
$l['search_customdes'] = "Looking for some achievement entering the name of the achievement or the name of the user who received the achievement. It is not necessary to enter the full name you can enter only part of the name and the list of all the achievements that contain those letters.";
$l['search'] = "Search";
$l['searchbyach'] = "Search by achievement";
$l['searchbyuser'] = "Search by username";
$l['nameachivement'] = "Name of achievement";
$l['nameachivementdes'] = "Enter the name of the achievement or part of the name.";
$l['searchbyname'] = "Search by Name";
$l['searchbyuserbutton'] = "Search by User";
$l['nameuser'] = "User name";
$l['nameuserdes'] = "Enter the user name, you write just a fragment of the name and you will leave the option of self complement.";
$l['emptysearchbyname'] = "There is no achievement that contains '<strong>{1}</strong>'";
$l['emptysearchbyuser'] = "The user does not have any personal achievement.";
//v2.2
//new system custom achivements
$l['give_user'] = "Give the user";
$l['quit_user'] = "Remove a user";
$l['successachcustom'] = "The personal achievement {1} was delivered correctly to the user {2}.";
$l['repeatcustom'] = "The {1} user already has the personal achievement {2}.";
$l['user_desquitcustom'] = "Enter the name of the user that you take away this achievement customized.";
$l['quitcustom'] = "Remove personal achievement: {1}";
$l['quitachivement'] = "remove achievement";
$l['notcustomuser'] = "The user {1} does not have the personal achievement {2}";
$l['successachivementcustomdelete'] = "It has robbed {1} achieving {2}";
$l['giveuserform'] = "Give personal achievement: {1}";
$l['viewachivements'] = "View Achievements";
$l['viewachivements_des_tab'] = "Enter the username and sees all his achievements have customized.";
$l['user_view'] = "Enter the user name you want to see all achievements";
$l['notuserexistview'] = "No such user you want to see their accomplishments.";
$l['custom_modulesbyuser'] = "Achievements custom {1}";
//tab log custom achivement
$l['log'] = "Log";
$l['logdestab'] = "Personalized record of achievement! Here is the show created, deleted and achievements that are delivered to users and to be removed. Also if done from moderation panel";
$l['emptycustomlog_modules'] = "Log is empty";
$l['date'] = "Date";
$l['information'] = "Information";
$l['ip'] = "IP";
$l['clearlog'] = "Clear Log";
$l['clearlogconfirm'] = "Want to clear your log?";
$l['successclearlog'] = "The log has been properly emptied.";
$l['logadd'] = "Create new achievement: <strong>{1}</strong>";
$l['logdelete'] = "eliminate achievement: <strong>{1}</strong>";
$l['loggive'] = "Achieving <strong>{1}</strong> has been delivered to the user {2}";
$l['logrevoke'] = "Achieving <strong>{1}</strong> has been taken from the user {2}";
$l['logtruncate'] = "Log eliminated";
//new config
$l['canmodcpachs'] = "Give custom achievements from ModCP?";
$l['canmodcpachsdes'] = "Want achievements that may occur from the ModCP custom? This will allow moderators and super moderators can provide custom achievements.";
$l['modcp'] = "Show ModCP";
$l['modcpdes'] = "Want this achievement is displayed in the moderation panel? (if enabled)";
$l['mod_cp'] = "ModCP";
//edit custom achivement
$l['editcustom'] = "Edit personal achievement: {1}";
$l['namereason'] = "Name / Reason";
$l['langmod'] = "Achieving {1} now {2} on the moderation panel";
$l['show'] = "Sample";
$l['hide'] = "Hide";
//*********** VERSION 2.4 ***************//
$l['permisions_achivements'] = "&#191;You can configure achievements for achievements?";
$l['achivements_modules'] = "Achievements for achievements";
$l['achivements_modules_destab'] = "Here are listed all the achievements for achievements. These achievements are given automatically when the user meeting the required achievements.";
$l['newachivements_achivementsdes'] = "Add a new achievement for achievements.";
$l['newachivementsbyachivements'] = "new achievement for achievements.";
$l['achivementsdes'] = "Select the achievements you need to gather the user to get this achievement.";
$l['namedescription'] = "Name/Description";
$l['emptyachivements_modules'] = "There is no achievement for achievements.";
$l['notachivements'] = "No achivements";
//*********** VERSION 2.5 ***************//
$l['showonlycurrent'] = "Show current achieved";
$l['showonlycurrentdes'] = "Remove the old achievement only show new achievements?";
?>

View file

@ -0,0 +1,305 @@
<?php
/**
* MyBB 1.6
* Copyright 2012 Edson Ordaz, All Rights Reserved
*
* Email: edsordaz@gmail.com
* WebSite: http://www.mybb-es.com
*
* $Id: achivements.php 2012-05-27Z Edson Ordaz $
*
* UPDATED: Version 2.5
*
* + Pone todos los logros (de postbit y de perfil) como
* visibles para todo el foro (tomando en cuenta que los del
* postbit solo mostrara los que el administrador tiene permitido.
* + Se agrega nueva configuracion para dar logros a usuarios inactivos.
* + Se dan logros por logros
*/
function task_achivements($task)
{
global $db, $mybb;
if($mybb->settings['achivements_enable'] == 1)
{
require_once MYBB_ROOT."inc/plugins/achivements/include/mp.php";
$achivements = array();
$query = $db->simple_select('achivements');
while ($achivement = $db->fetch_array($query))
{
$achivements[] = $achivement;
}
$db->free_result($query);
$userachivements = array();
$uquery = $db->simple_select("user_achivements", "*");
while($usera = $db->fetch_array($uquery))
{
$userachivements[$usera['uid']][$usera['aid']] = true;
}
$users = array();
$taskusersoffline = '';
if($mybb->settings['achivements_taskuseroffline'] == 0)
{
$taskusersoffline = "`lastactive` >= '{$task['lastrun']}'";
}
$query = $db->simple_select("users", "*", $taskusersoffline);
while($user = $db->fetch_array($query))
{
$users[$user['uid']] = $user;
}
$insert_achivements = array();
$countachivements = 0;
$countusers = 0;
$max_postcount=0;
$max_threadcount=0;
$max_repcount=0;
$max_timecount=0;
$max_regdatecount=0;
foreach ($users as $uid => $user)
{
$sendmp = unserialize($mybb->settings['achivements_sendmp']);
foreach($achivements as $achivement)
{
switch($achivement['type'])
{
case "post":
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
if($achivement['requirement'] <= intval($user['postnum']))
{
if($mybb->settings['achivements_showonlycurrent'] == 1)
{
if($max_postcount < $achivement['requirement'])
{
$max_postcount = $achivement['requirement'];
++$countachivements;
unset($insert_achivements[$uid]['posts']);
$insert_achivements[$uid]['posts'][] = $achivement['id'];
if($sendmp['posts'] == 1)
{
send_mp_achivement_new($uid, 'posts', $achivement['id']);
}
}
}
else
{
++$countachivements;
$insert_achivements[$uid]['posts'][] = $achivement['id'];
if($sendmp['posts'] == 1)
{
send_mp_achivement_new($uid, 'posts', $achivement['id']);
}
}
}
}
break;
case "threads":
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
if($achivement['requirement'] <= intval($user['threads']))
{
if($mybb->settings['achivements_showonlycurrent'] == 1)
{
if($max_threadcount < $achivement['requirement'])
{
$max_threadcount = $achivement['requirement'];
++$countachivements;
unset($insert_achivements[$uid]['threads']);
$insert_achivements[$uid]['threads'][] = $achivement['id'];
if($sendmp['threads'] == 1)
{
send_mp_achivement_new($uid, 'threads', $achivement['id']);
}
}
}
else
{
++$countachivements;
$insert_achivements[$uid]['threads'][] = $achivement['id'];
if($sendmp['threads'] == 1)
{
send_mp_achivement_new($uid, 'threads', $achivement['id']);
}
}
}
}
break;
case "rep":
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
if($achivement['requirement'] <= intval($user['reputation']))
{
if($mybb->settings['achivements_showonlycurrent'] == 1)
{
if($max_repcount < $achivement['requirement'])
{
$max_repcount = $achivement['requirement'];
++$countachivements;
unset($insert_achivements[$uid]['rep']);
$insert_achivements[$uid]['rep'][] = $achivement['id'];
if($sendmp['reputation'] == 1)
{
send_mp_achivement_new($uid, 'reputation', $achivement['id']);
}
}
}
else
{
++$countachivements;
$insert_achivements[$uid]['rep'][] = $achivement['id'];
if($sendmp['reputation'] == 1)
{
send_mp_achivement_new($uid, 'reputation', $achivement['id']);
}
}
}
}
break;
case "time":
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
switch($achivement['requirement_unit'])
{
case "hours":
$timeonline = $achivement['requirement']*60*60;
break;
case "days":
$timeonline = $achivement['requirement']*60*60*24;
break;
case "weeks":
$timeonline = $achivement['requirement']*60*60*24*7;
case "months":
$timeonline = $achivement['requirement']*60*60*24*30;
break;
case "years":
$timeonline = $achivement['requirement']*60*60*24*365;
break;
}
if($timeonline <= intval($user['reputation']))
{
if($mybb->settings['achivements_showonlycurrent'] == 1)
{
if($max_timecount < $timeonline)
{
$max_timecount = $timeonline;
++$countachivements;
unset($insert_achivements[$uid]['time']);
$insert_achivements[$uid]['time'][] = $achivement['id'];
if($sendmp['timeonline'] == 1)
{
send_mp_achivement_new($uid, 'timeonline', $achivement['id']);
}
}
}
else
{
++$countachivements;
$insert_achivements[$uid]['time'][] = $achivement['id'];
if($sendmp['timeonline'] == 1)
{
send_mp_achivement_new($uid, 'timeonline', $achivement['id']);
}
}
}
}
break;
case "regdate":
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
switch($achivement['requirement_unit'])
{
case "hours":
$regdate = $achivement['requirement']*60*60;
break;
case "days":
$regdate = $achivement['requirement']*60*60*24;
break;
case "weeks":
$regdate = $achivement['requirement']*60*60*24*7;
case "months":
$regdate = $achivement['requirement']*60*60*24*30;
break;
case "years":
$regdate = $achivement['requirement']*60*60*24*365;
break;
}
$rdate = TIME_NOW - $regdate;
if(intval($user['regdate']) <= $rdate)
{
if($mybb->settings['achivements_showonlycurrent'] == 1)
{
if($max_regdatecount < intval($user['regdate']))
{
$max_regdatecount = intval($user['regdate']);
++$countachivements;
unset($insert_achivements[$uid]['regdate']);
$insert_achivements[$uid]['regdate'][] = $achivement['id'];
if($sendmp['regdate'] == 1)
{
send_mp_achivement_new($uid, 'regdate', $achivement['id']);
}
}
}
else
{
++$countachivements;
$insert_achivements[$uid]['regdate'][] = $achivement['id'];
if($sendmp['regdate'] == 1)
{
send_mp_achivement_new($uid, 'regdate', $achivement['id']);
}
}
}
}
break;
case "archivements":
$achs = explode('|',$achivement['required_achivements']);;
$error = 0;
if(!empty($achs))
{
foreach($achs as $ar)
{
if(empty($userachivements[$uid][$ar]))
{
++$error;
}
}
if($error == 0)
{
if (!isset($userachivements[$uid][$achivement['id']]) || empty($userachivements[$uid][$achivement['id']]))
{
++$countachivements;
$insert_achivements[$uid]['archivements'][] = $achivement['id'];
if($sendmp['achivements'] == 1)
{
send_mp_achivement_new($uid, 'achivement', $achivement['id']);
}
}
}
}
break;
}
}
++$countusers;
}
foreach($insert_achivements as $uid => $ach){
foreach($ach as $key => $v){
foreach($v as $a){
$update = array(
"uid" => $uid,
"aid" => $a,
"showprofile"=>1,
"showpostbit"=>1
);
$db->insert_query("user_achivements", $update);
}
}
}
$tasklog = "Checked {$countusers} Users and gave out {$countachivements} Achivements in total.";
}else{
$tasklog = "Achivements deactivated.";
}
add_task_log($task, $tasklog);
}
?>