Moved check_clock_src to portal/includes/functions.php and renamed it to check_file_src;
Edited includes/acp/acp_portal.php to we can use functions outside of the module class upon submitting; Added possibility to move blocks i.e. from left to right column
This commit is contained in:
@@ -160,7 +160,15 @@ class acp_portal
|
|||||||
{
|
{
|
||||||
$func = array($c_class, $null['submit']);
|
$func = array($c_class, $null['submit']);
|
||||||
$args = ($module_id != 0) ? array($cfg_array[$config_name], $config_name, $module_id) : $config_name;
|
$args = ($module_id != 0) ? array($cfg_array[$config_name], $config_name, $module_id) : $config_name;
|
||||||
call_user_func_array($func, $args);
|
|
||||||
|
if(method_exists($c_class, $null['submit']))
|
||||||
|
{
|
||||||
|
call_user_func_array($func, $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
call_user_func_array($null['submit'], $args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -400,6 +408,31 @@ class acp_portal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif($c_class->columns & column_string_const(column_num_string($module_data['module_column'] + 2)))
|
||||||
|
{
|
||||||
|
if ($module_data !== false)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order + 1
|
||||||
|
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||||
|
AND module_column = ' . ($module_data['module_column'] + 2);
|
||||||
|
$db->sql_query($sql);
|
||||||
|
$updated = $db->sql_affectedrows();
|
||||||
|
if ($updated)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_column = module_column + 2
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order - 1
|
||||||
|
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||||
|
AND module_column = ' . $module_data['module_column'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
||||||
@@ -450,6 +483,31 @@ class acp_portal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif($c_class->columns & column_string_const(column_num_string($module_data['module_column'] - 2)))
|
||||||
|
{
|
||||||
|
if ($module_data !== false)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order + 1
|
||||||
|
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||||
|
AND module_column = ' . ($module_data['module_column'] - 2);
|
||||||
|
$db->sql_query($sql);
|
||||||
|
$updated = $db->sql_affectedrows();
|
||||||
|
if ($updated)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_column = module_column - 2
|
||||||
|
WHERE module_id = ' . $module_id;
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
|
||||||
|
SET module_order = module_order - 1
|
||||||
|
WHERE module_order >= ' . $module_data['module_order'] . '
|
||||||
|
AND module_column = ' . $module_data['module_column'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['UNABLE_TO_MOVE'] . adm_back_link($this->u_action));
|
||||||
|
|||||||
@@ -918,6 +918,38 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
|||||||
|
|
||||||
return $user->lang['PORTAL_BASIC_UNINSTALL'];
|
return $user->lang['PORTAL_BASIC_UNINSTALL'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check if the entered source file actually exists
|
||||||
|
*/
|
||||||
|
function check_file_src($value, $key, $module_id)
|
||||||
|
{
|
||||||
|
global $db, $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
|
$error = '';
|
||||||
|
|
||||||
|
$sql = 'SELECT st.theme_path
|
||||||
|
FROM ' . STYLES_THEME_TABLE . ' st
|
||||||
|
LEFT JOIN ' . STYLES_TABLE . ' s
|
||||||
|
ON (st.theme_id = s.style_id)
|
||||||
|
WHERE s.style_active = 1';
|
||||||
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
while($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if(!file_exists($phpbb_root_path . 'styles/' . $row['theme_path'] . '/theme/images/portal/' . $value))
|
||||||
|
{
|
||||||
|
$error .= $user->lang['B3P_FILE_NOT_FOUND'] . ': styles/' . $row['theme_path'] . '/theme/images/portal/' . $value . '<br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if(!empty($error))
|
||||||
|
{
|
||||||
|
trigger_error($error . adm_back_link(append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=portal&mode=config&module_id=' . $module_id)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -63,7 +63,7 @@ class portal_clock_module
|
|||||||
'title' => 'ACP_PORTAL_CLOCK_SETTINGS',
|
'title' => 'ACP_PORTAL_CLOCK_SETTINGS',
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'legend1' => 'ACP_PORTAL_CLOCK_SETTINGS',
|
'legend1' => 'ACP_PORTAL_CLOCK_SETTINGS',
|
||||||
'board3_clock_src_' . $module_id => array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => true, 'submit_type' => 'custom', 'submit' => 'check_clock_src'),
|
'board3_clock_src_' . $module_id => array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => true, 'submit_type' => 'custom', 'submit' => 'check_file_src'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -88,36 +88,6 @@ class portal_clock_module
|
|||||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||||
return $db->sql_query($sql);
|
return $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* check if the entered clock src file actually exists
|
|
||||||
*/
|
|
||||||
function check_clock_src($value, $key, $module_id)
|
|
||||||
{
|
|
||||||
global $db, $phpbb_root_path, $phpEx, $user;
|
|
||||||
|
|
||||||
$sql = 'SELECT st.theme_path
|
|
||||||
FROM ' . STYLES_THEME_TABLE . ' st
|
|
||||||
LEFT JOIN ' . STYLES_TABLE . ' s
|
|
||||||
ON (st.theme_id = s.style_id)
|
|
||||||
WHERE s.style_active = 1';
|
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
if(!file_exists($phpbb_root_path . 'styles/' . $row['theme_path'] . '/theme/images/portal/' . $value))
|
|
||||||
{
|
|
||||||
$error = $user->lang['B3P_FILE_NOT_FOUND'] . ': styles/' . $row['theme_path'] . '/theme/images/portal/' . $value . '<br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if(isset($error))
|
|
||||||
{
|
|
||||||
trigger_error($error . adm_back_link(append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=portal&mode=config&module_id=' . $module_id)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user