This commit is contained in:
botanic 2014-09-05 18:46:33 -07:00
commit 1d15bdfab3
13 changed files with 118 additions and 66 deletions

View file

@ -147,7 +147,6 @@ namespace NLMISC
bool DebugNeedAssert;
bool NoAssert;
bool AlreadyCreateSharedAmongThreads;
};
/** This class implements the context interface for the a library module.
@ -184,6 +183,7 @@ namespace NLMISC
virtual void setNoAssert(bool noAssert);
virtual bool getAlreadyCreateSharedAmongThreads();
virtual void setAlreadyCreateSharedAmongThreads(bool b);
private:
/// Pointer to the application context.
INelContext *_ApplicationContext;

View file

@ -543,13 +543,16 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
setMouseTracking(true);
cols = width;
if (withColorDialog) {
if (withColorDialog)
{
moreButton = new ColorPickerButton(this);
moreButton->setFixedWidth(24);
moreButton->setFixedHeight(21);
moreButton->setFrameRect(QRect(2, 2, 20, 17));
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
} else {
}
else
{
moreButton = 0;
}
@ -1061,12 +1064,17 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) {
|| e->key() == Qt::Key_Right)
{
qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
}
else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
{
setFrameShadow(Sunken);
update();
} else {
}
else
{
QFrame::keyPressEvent(e);
}
}
@ -1079,13 +1087,18 @@ void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) {
|| e->key() == Qt::Key_Right)
{
qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
}
else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
{
setFrameShadow(Raised);
repaint();
emit clicked();
} else {
}
else
{
QFrame::keyReleaseEvent(e);
}

View file

@ -1511,8 +1511,6 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
}
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps
@ -2661,7 +2659,8 @@ bool CDriverD3D::reset (const GfxMode& mode)
#ifndef NL_NO_ASM
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
#endif
if (_Rasterizer!=D3DDEVTYPE_REF) {
if (_Rasterizer!=D3DDEVTYPE_REF)
{
HRESULT hr = _DeviceInterface->Reset (&parameters);
if (hr != D3D_OK)
{

View file

@ -595,14 +595,7 @@ CREATE TABLE IF NOT EXISTS `neltool_users` (
UNIQUE KEY `user_login` (`user_name`),
KEY `user_group_id` (`user_group_id`),
KEY `user_active` (`user_active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `neltool_users`
--
INSERT INTO `neltool_users` (`user_id`, `user_name`, `user_password`, `user_group_id`, `user_created`, `user_active`, `user_logged_last`, `user_logged_count`, `user_menu_style`) VALUES
(1, 'guest', '084e0343a0486ff05530df6c705c8bb4', 1, 1405357395, 1, 0, 0, 0);
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View file

@ -1,16 +1,18 @@
<?php
require_once('../config.php');
define('NELTOOL_LOADED', true);
// database information for nel tool
define('NELTOOL_DBHOST','localhost');
define('NELTOOL_DBUSER','shard');
define('NELTOOL_DBPASS','');
define('NELTOOL_DBNAME','nel_tool');
define('NELTOOL_DBHOST', $cfg['db']['tool']['host']);
define('NELTOOL_DBUSER', $cfg['db']['tool']['user']);
define('NELTOOL_DBPASS', $cfg['db']['tool']['pass']);
define('NELTOOL_DBNAME', $cfg['db']['tool']['name']);
// site paths definitions
define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_SITEBASE', $_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE', dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');
@ -18,7 +20,7 @@
define('NELTOOL_RRDSYSBASE', NELTOOL_SYSTEMBASE . 'graphs_output/');
define('NELTOOL_RRDWEBBASE', NELTOOL_SITEBASE . 'graphs_output/');
define('NELTOOL_SITETITLE', 'Ryzom Admin');
define('NELTOOL_SITETITLE', 'Ryzom Core Admin');
define('NELTOOL_SESSIONID', 'sid');
define('NELTOOL_DEBUG', true);
@ -70,6 +72,6 @@
'level_name' => 'Administrator'),
);
$restart_notification_emails = array('vl@ryzom.com');
$restart_notification_emails = array('support@ryzomcore.org');
?>

View file

@ -8,7 +8,7 @@
{
global $db;
$sql = "UPDATE ". NELDB_USER_TABLE ." SET user_logged_count=user_logged_count+1,user_logged_last=". time() ." WHERE user_id=". $user_id;
$sql = "UPDATE ". NELDB_USER_TABLE ." SET user_logged_count=user_logged_count+1,user_logged_last=". time() ." WHERE user_id=". (int)$user_id;
$db->sql_query($sql);
}
@ -18,7 +18,7 @@
$data = null;
$sql = "SELECT * FROM ". NELDB_USER_TABLE ." LEFT JOIN ". NELDB_GROUP_TABLE ." ON (user_group_id=group_id) WHERE user_id=". $nelid;
$sql = "SELECT * FROM ". NELDB_USER_TABLE ." LEFT JOIN ". NELDB_GROUP_TABLE ." ON (user_group_id=group_id) WHERE user_id=". (int)$nelid;
if ($result = $db->sql_query($sql))
{
if ($db->sql_numrows($result))
@ -34,7 +34,7 @@
{
global $db;
$sql = "SELECT user_name FROM ". NELDB_USER_TABLE ." WHERE user_id=". $group_id;
$sql = "SELECT user_name FROM ". NELDB_USER_TABLE ." WHERE user_id=". (int)$group_id;
if ($result = $db->sql_query($sql))
{
if ($db->sql_numrows($result))
@ -53,7 +53,7 @@
$data = null;
$user = trim($user);
$user = $db->sql_escape_string(trim($user));
$passwd = md5(trim($passwd));
$sql = "SELECT * FROM ". NELDB_USER_TABLE ." LEFT JOIN ". NELDB_GROUP_TABLE ." ON (user_group_id=group_id) WHERE user_name='". $user ."' AND user_password='". $passwd ."' AND user_active=1 AND group_active=1";

View file

@ -251,6 +251,10 @@ class sql_db
return false;
}
}
function sql_escape_string($str)
{
return mysqli_real_escape_string($this->db_connect_id, $str);
}
function sql_error($query_id = 0)
{
$result["message"] = mysqli_error($this->db_connect_id);

View file

@ -0,0 +1,6 @@
Options -Indexes
Options -ExecCGI
<Files *.*>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>

View file

@ -158,7 +158,7 @@
</div>
<footer>
{if $permission > 1}<p class="pull-right">AMS 0.9.0 Powered by: <a href="http://usman.it/free-responsive-admin-template">Charisma</a></p>{/if}
{if $permission > 1}<p class="pull-right">AMS 0.9.1 Powered by: <a href="http://usman.it/free-responsive-admin-template">Charisma</a></p>{/if}
</footer>
{/if}
</div><!--/.fluid-container-->

View file

@ -112,6 +112,8 @@ function update_database_structure($continue_r, $con, $file) {
<?php
$continue = true;
// Change to root directory
if (!chdir("../")) {
printalert("danger", "Cannot change to public PHP root directory");

View file

@ -24,7 +24,6 @@ include('header.php');
</div>
<?php
$continue = true;
$roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on";
$roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on";
@ -173,7 +172,41 @@ include('header.php');
}
if ($roleService) {
// TODO: Create the default admin user
// Create the default shard admin user
if (!chdir("admin/")) {
printalert("danger", "Cannot change to admin tools directory");
$continue = false;
}
if ($continue) {
try {
require_once('common.php');
} catch (Exception $e) {
printalert("danger", "Failed to include NeL <em>admin/common.php</em>");
$continue = false;
}
}
if ($continue) {
try {
require_once('functions_tool_administration.php');
} catch (Exception $e) {
printalert("danger", "Failed to include NeL <em>admin/functions_tool_administration.php</em>");
$continue = false;
}
}
if ($continue) {
$adminGroup = 1;
$result = tool_admin_users_add($_POST["toolsAdminUsername"], $_POST["toolsAdminPassword"], (string)$adminGroup, (string)1);
if ($result == "") {
printalert("success", "Added shard admin to NeL tools database");
} else {
printalert("danger", "Failed to add shard admin to NeL tools database<br>" . htmlentities($result));
$continue = false;
}
}
if (!chdir("../")) {
printalert("danger", "Cannot change to public PHP root directory");
$continue = false;
}
}
if ($roleSupport) {