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

View file

@ -826,7 +826,7 @@ private:
void flushSSSModelRequests(); void flushSSSModelRequests();
// common vb for water display // common vb for water display
CVertexBuffer _WaterVB; CVertexBuffer _WaterVB;
bool _RequestParticlesAnimate; bool _RequestParticlesAnimate;
}; };

View file

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

View file

@ -543,14 +543,17 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
setMouseTracking(true); setMouseTracking(true);
cols = width; cols = width;
if (withColorDialog) { if (withColorDialog)
moreButton = new ColorPickerButton(this); {
moreButton->setFixedWidth(24); moreButton = new ColorPickerButton(this);
moreButton->setFixedHeight(21); moreButton->setFixedWidth(24);
moreButton->setFrameRect(QRect(2, 2, 20, 17)); moreButton->setFixedHeight(21);
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog())); moreButton->setFrameRect(QRect(2, 2, 20, 17));
} else { connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
moreButton = 0; }
else
{
moreButton = 0;
} }
eventLoop = 0; eventLoop = 0;
@ -1059,15 +1062,20 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
void ColorPickerButton::keyPressEvent(QKeyEvent *e) void ColorPickerButton::keyPressEvent(QKeyEvent *e)
{ {
if (e->key() == Qt::Key_Up if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down || e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left || 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) { qApp->sendEvent(parent(), e);
setFrameShadow(Sunken); }
update(); else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
} else { {
QFrame::keyPressEvent(e); setFrameShadow(Sunken);
update();
}
else
{
QFrame::keyPressEvent(e);
} }
} }
@ -1077,16 +1085,21 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e) void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
{ {
if (e->key() == Qt::Key_Up if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down || e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left || 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) { qApp->sendEvent(parent(), e);
setFrameShadow(Raised); }
repaint(); else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
emit clicked(); {
} else { setFrameShadow(Raised);
QFrame::keyReleaseEvent(e); repaint();
emit clicked();
}
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); // _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps // Check some caps
@ -2661,7 +2659,8 @@ bool CDriverD3D::reset (const GfxMode& mode)
#ifndef NL_NO_ASM #ifndef NL_NO_ASM
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset" CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
#endif #endif
if (_Rasterizer!=D3DDEVTYPE_REF) { if (_Rasterizer!=D3DDEVTYPE_REF)
{
HRESULT hr = _DeviceInterface->Reset (&parameters); HRESULT hr = _DeviceInterface->Reset (&parameters);
if (hr != D3D_OK) if (hr != D3D_OK)
{ {

View file

@ -75,7 +75,7 @@ INelContext::~INelContext()
void INelContext::contextReady() void INelContext::contextReady()
{ {
// Register the NeL Context // Register the NeL Context
// This assert doesn't work for Linux due to ELF symbol relocation // This assert doesn't work for Linux due to ELF symbol relocation

View file

@ -595,14 +595,7 @@ CREATE TABLE IF NOT EXISTS `neltool_users` (
UNIQUE KEY `user_login` (`user_name`), UNIQUE KEY `user_login` (`user_name`),
KEY `user_group_id` (`user_group_id`), KEY `user_group_id` (`user_group_id`),
KEY `user_active` (`user_active`) KEY `user_active` (`user_active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- 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);
-- -------------------------------------------------------- -- --------------------------------------------------------

View file

@ -1,30 +1,32 @@
<?php <?php
require_once('../config.php');
define('NELTOOL_LOADED', true); define('NELTOOL_LOADED', true);
// database information for nel tool // database information for nel tool
define('NELTOOL_DBHOST','localhost'); define('NELTOOL_DBHOST', $cfg['db']['tool']['host']);
define('NELTOOL_DBUSER','shard'); define('NELTOOL_DBUSER', $cfg['db']['tool']['user']);
define('NELTOOL_DBPASS',''); define('NELTOOL_DBPASS', $cfg['db']['tool']['pass']);
define('NELTOOL_DBNAME','nel_tool'); define('NELTOOL_DBNAME', $cfg['db']['tool']['name']);
// site paths definitions // site paths definitions
define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']); define('NELTOOL_SITEBASE', $_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/'); define('NELTOOL_SYSTEMBASE', dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/'); define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/'); define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');
define('NELTOOL_RRDTOOL', '/usr/bin/rrdtool'); define('NELTOOL_RRDTOOL', '/usr/bin/rrdtool');
define('NELTOOL_RRDSYSBASE', NELTOOL_SYSTEMBASE . 'graphs_output/'); define('NELTOOL_RRDSYSBASE', NELTOOL_SYSTEMBASE . 'graphs_output/');
define('NELTOOL_RRDWEBBASE', NELTOOL_SITEBASE . '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_SESSIONID', 'sid');
define('NELTOOL_DEBUG', true); define('NELTOOL_DEBUG', true);
// SQL table names // SQL table names
define('NELDB_PREFIX', 'neltool_'); define('NELDB_PREFIX', 'neltool_');
// for later use // for later use
// the config table will gather some of the settings // the config table will gather some of the settings
@ -60,9 +62,9 @@
define('NELDB_RESTART_SEQUENCE_TABLE', NELDB_PREFIX .'restart_sequences'); define('NELDB_RESTART_SEQUENCE_TABLE', NELDB_PREFIX .'restart_sequences');
define('VIEW_DELAY', 0); define('VIEW_DELAY', 0);
define('HARDWARE_REFRESH', 600); define('HARDWARE_REFRESH', 600);
define('LOCK_TIMEOUT', 1800); define('LOCK_TIMEOUT', 1800);
define('BG_IMG', 'imgs/bg_live.png'); define('BG_IMG', 'imgs/bg_live.png');
$nel_user_group_levels = array(array( 'level_id' => 0, $nel_user_group_levels = array(array( 'level_id' => 0,
'level_name' => 'Normal'), 'level_name' => 'Normal'),
@ -70,6 +72,6 @@
'level_name' => 'Administrator'), '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; 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); $db->sql_query($sql);
} }
@ -18,7 +18,7 @@
$data = null; $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 ($result = $db->sql_query($sql))
{ {
if ($db->sql_numrows($result)) if ($db->sql_numrows($result))
@ -34,7 +34,7 @@
{ {
global $db; 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 ($result = $db->sql_query($sql))
{ {
if ($db->sql_numrows($result)) if ($db->sql_numrows($result))
@ -53,7 +53,7 @@
$data = null; $data = null;
$user = trim($user); $user = $db->sql_escape_string(trim($user));
$passwd = md5(trim($passwd)); $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"; $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";
@ -120,4 +120,4 @@
unset($NELTOOL['SESSION_VARS'][$name]); unset($NELTOOL['SESSION_VARS'][$name]);
} }
?> ?>

View file

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

@ -29,7 +29,7 @@
<link href='css/jquery.iphone.toggle.css' rel='stylesheet'> <link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
<link href='css/uploadify.css' rel='stylesheet'> <link href='css/uploadify.css' rel='stylesheet'>
<link href='css/animate.min.css' rel='stylesheet'> <link href='css/animate.min.css' rel='stylesheet'>
<!-- jQuery --> <!-- jQuery -->
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
@ -158,7 +158,7 @@
</div> </div>
<footer> <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> </footer>
{/if} {/if}
</div><!--/.fluid-container--> </div><!--/.fluid-container-->
@ -303,6 +303,6 @@
<script src="js/help.js"></script> <script src="js/help.js"></script>
<!-- application script for Charisma demo --> <!-- application script for Charisma demo -->
<script src="js/custom.js"></script> <script src="js/custom.js"></script>
</body> </body>
</html> </html>

View file

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

View file

@ -24,7 +24,6 @@ include('header.php');
</div> </div>
<?php <?php
$continue = true;
$roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on"; $roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on";
$roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on"; $roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on";
@ -173,7 +172,41 @@ include('header.php');
} }
if ($roleService) { 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) { if ($roleSupport) {