Some fix after removed @

This commit is contained in:
Vasily Komrakov 2016-03-13 04:37:28 +03:00
commit af9c67c7ec
13 changed files with 51 additions and 27 deletions

View file

@ -257,7 +257,7 @@ function file_write ($str, $file, $max_size = LOG_MAX_SIZE, $lock = true, $repla
{ {
$bytes_written = false; $bytes_written = false;
if ($max_size && filesize($file) >= $max_size) if (file_exists($file) && $max_size && filesize($file) >= $max_size)
{ {
$old_name = $file; $ext = ''; $old_name = $file; $ext = '';
if (preg_match('#^(.+)(\.[^\\/]+)$#', $file, $matches)) if (preg_match('#^(.+)(\.[^\\/]+)$#', $file, $matches))

View file

@ -30,7 +30,7 @@ function cron_get_file_lock ()
function cron_track_running ($mode) function cron_track_running ($mode)
{ {
define('CRON_STARTMARK', TRIGGERS_DIR .'cron_started_at_'. date('Y-m-d_H-i-s') .'_by_pid_'. getmypid()); defined('CRON_STARTMARK') or define('CRON_STARTMARK', TRIGGERS_DIR .'cron_started_at_'. date('Y-m-d_H-i-s') .'_by_pid_'. getmypid());
if ($mode == 'start') if ($mode == 'start')
{ {

View file

@ -2029,7 +2029,7 @@ function get_topic_icon ($topic, $is_unread = null)
$folder = $images['folder_locked']; $folder = $images['folder_locked'];
$folder_new = $images['folder_locked_new']; $folder_new = $images['folder_locked_new'];
} }
else if ($topic['tracker_status']) else if (isset($topic['tracker_status']))
{ {
$folder = ($t_hot) ? $images['folder_dl_hot'] : $images['folder_dl']; $folder = ($t_hot) ? $images['folder_dl_hot'] : $images['folder_dl'];
$folder_new = ($t_hot) ? $images['folder_dl_hot_new'] : $images['folder_dl_new']; $folder_new = ($t_hot) ? $images['folder_dl_hot_new'] : $images['folder_dl_new'];

View file

@ -496,10 +496,14 @@ function cron_touch_lock_file ($lock_file)
function cron_enable_board () function cron_enable_board ()
{ {
rename(BB_DISABLED, BB_ENABLED); if (file_exists(BB_DISABLED)) {
rename(BB_DISABLED, BB_ENABLED);
}
} }
function cron_disable_board () function cron_disable_board ()
{ {
rename(BB_ENABLED, BB_DISABLED); if (file_exists(BB_ENABLED)) {
rename(BB_ENABLED, BB_DISABLED);
}
} }

View file

@ -2,6 +2,9 @@
if (!defined('BB_ROOT')) die(basename(__FILE__)); if (!defined('BB_ROOT')) die(basename(__FILE__));
/** @var \TorrentPier\Di $di */
$di = \TorrentPier\Di::getInstance();
$show_canceled_in_count_mode = false; $show_canceled_in_count_mode = false;
$title_date_format = 'Y-m-d'; $title_date_format = 'Y-m-d';
$dl_list_sql_limit = 300; // DL-List overall limit $dl_list_sql_limit = 300; // DL-List overall limit
@ -12,15 +15,15 @@ $dl_users_div_style_overflow = "padding: 6px; height: $dl_users_overflow_div_he
$template->assign_vars(array('DL_BUTTONS' => false)); $template->assign_vars(array('DL_BUTTONS' => false));
$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !($_GET['dl'] === 'names')); $count_mode = ($bb_cfg['bt_dl_list_only_count'] && !($di->request->get('dl') === 'names'));
$dl_topic = ($t_data['tracker_status'] && !($bb_cfg['bt_dl_list_only_1st_page'] && $start)); $dl_topic = (isset($t_data['tracker_status']) && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && $_GET['dl'] === 'names'))); $show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && $di->request->get('dl') === 'names')));
$show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']); $show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
// link to clear DL-List // link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false)); $template->assign_vars(array('S_DL_DELETE' => false));
if ($is_auth['auth_mod'] && $t_data['tracker_status']) if ($is_auth['auth_mod'] && isset($t_data['tracker_status']))
{ {
$s_dl_delete = "<a href=\"dl_list.php?mode=dl_delete&amp;". POST_TOPIC_URL ."=$topic_id&amp;sid=". $userdata['session_id'] .'">'. $lang['DL_LIST_DEL'] .'</a>'; $s_dl_delete = "<a href=\"dl_list.php?mode=dl_delete&amp;". POST_TOPIC_URL ."=$topic_id&amp;sid=". $userdata['session_id'] .'">'. $lang['DL_LIST_DEL'] .'</a>';
$template->assign_vars(array('S_DL_DELETE' => $s_dl_delete)); $template->assign_vars(array('S_DL_DELETE' => $s_dl_delete));

View file

@ -2333,8 +2333,8 @@ $lang['BOARD_DISABLE_EXPL'] = 'disable board when this job is run';
$lang['RUN_COUNTER'] = 'Run counter'; $lang['RUN_COUNTER'] = 'Run counter';
$lang['JOB_REMOVED'] = 'The problem has been removed successfully'; $lang['JOB_REMOVED'] = 'The problem has been removed successfully';
$lang['SCRIPT_DUPLICATE'] = 'Script <b>'. $_POST['cron_script'] .'</b> already exists!'; $lang['SCRIPT_DUPLICATE'] = 'Script <b> $_POST["cron_script"] </b> already exists!';
$lang['TITLE_DUPLICATE'] = 'Task Name <b>'. $_POST['cron_title'] .'</b> already exists!'; $lang['TITLE_DUPLICATE'] = 'Task Name <b> $_POST["cron_title"] </b> already exists!';
$lang['CLICK_RETURN_JOBS_ADDED'] = '%sReturn to the addition problem%s'; $lang['CLICK_RETURN_JOBS_ADDED'] = '%sReturn to the addition problem%s';
$lang['CLICK_RETURN_JOBS'] = '%sBack to the Task Scheduler%s'; $lang['CLICK_RETURN_JOBS'] = '%sBack to the Task Scheduler%s';

View file

@ -2333,8 +2333,8 @@ $lang['BOARD_DISABLE_EXPL'] = 'отключать форум, когда зад
$lang['RUN_COUNTER'] = 'Кол-во запусков'; $lang['RUN_COUNTER'] = 'Кол-во запусков';
$lang['JOB_REMOVED'] = 'Задача была успешно удалена'; $lang['JOB_REMOVED'] = 'Задача была успешно удалена';
$lang['SCRIPT_DUPLICATE'] = 'Скрипт <b>'. $_POST['cron_script'] .'</b> уже существует!'; $lang['SCRIPT_DUPLICATE'] = 'Скрипт <b> $_POST["cron_script"] </b> уже существует!';
$lang['TITLE_DUPLICATE'] = 'Название задачи <b>'. $_POST['cron_title'] .'</b> уже существует!'; $lang['TITLE_DUPLICATE'] = 'Название задачи <b> $_POST["cron_title"] </b> уже существует!';
$lang['CLICK_RETURN_JOBS_ADDED'] = '%sВернуться к добавлению задачи%s'; $lang['CLICK_RETURN_JOBS_ADDED'] = '%sВернуться к добавлению задачи%s';
$lang['CLICK_RETURN_JOBS'] = '%sВернуться к планировщику задач%s'; $lang['CLICK_RETURN_JOBS'] = '%sВернуться к планировщику задач%s';

View file

@ -2333,8 +2333,8 @@ $lang['BOARD_DISABLE_EXPL'] = 'відключати форум, коли зав
$lang['RUN_COUNTER'] = 'Кількість запусків'; $lang['RUN_COUNTER'] = 'Кількість запусків';
$lang['JOB_REMOVED'] = 'Завдання було успішно видалено'; $lang['JOB_REMOVED'] = 'Завдання було успішно видалено';
$lang['SCRIPT_DUPLICATE'] = 'Скрипт <b>'. $_POST['cron_script'] .'</b> вже існує!'; $lang['SCRIPT_DUPLICATE'] = 'Скрипт <b> $_POST["cron_script"] </b> вже існує!';
$lang['TITLE_DUPLICATE'] = 'Назва завдання <b>'. $_POST['cron_title'] .'</b> вже існує!'; $lang['TITLE_DUPLICATE'] = 'Назва завдання <b> $_POST["cron_title"] </b> вже існує!';
$lang['CLICK_RETURN_JOBS_ADDED'] = '%sПовернутися до додавання задачі%s'; $lang['CLICK_RETURN_JOBS_ADDED'] = '%sПовернутися до додавання задачі%s';
$lang['CLICK_RETURN_JOBS'] = '%sПовернутися до планувальника завдань%s'; $lang['CLICK_RETURN_JOBS'] = '%sПовернутися до планувальника завдань%s';

View file

@ -3,6 +3,10 @@
define('BB_SCRIPT', 'posting'); define('BB_SCRIPT', 'posting');
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT ."common.php"); require(BB_ROOT ."common.php");
/** @var \TorrentPier\Di $di */
$di = \TorrentPier\Di::getInstance();
require(INC_DIR .'bbcode.php'); require(INC_DIR .'bbcode.php');
require(INC_DIR .'functions_post.php'); require(INC_DIR .'functions_post.php');
@ -11,13 +15,13 @@ $user->session_start();
$page_cfg['load_tpl_vars'] = ['post_icons']; $page_cfg['load_tpl_vars'] = ['post_icons'];
$submit = (bool) $_REQUEST['post']; $submit = $di->request->request->has('post');
$preview = (bool) $_REQUEST['preview']; $preview = $di->request->request->has('preview');
$delete = (bool) $_REQUEST['delete']; $delete = $di->request->request->has('delete');
$forum_id = (int) $_REQUEST[POST_FORUM_URL]; $forum_id = $di->request->request->getInt(POST_FORUM_URL);
$topic_id = (int) $_REQUEST[POST_TOPIC_URL]; $topic_id = $di->request->request->getInt(POST_TOPIC_URL);
$post_id = (int) $_REQUEST[POST_POST_URL]; $post_id = $di->request->request->getInt(POST_POST_URL);
$mode = (string) $_REQUEST['mode']; $mode = (string) $_REQUEST['mode'];
@ -26,7 +30,7 @@ $confirm = isset($_POST['confirm']);
$orig_word = $replacement_word = []; $orig_word = $replacement_word = [];
// Set topic type // Set topic type
$topic_type = ($_POST['topictype']) ? (int) $_POST['topictype'] : POST_NORMAL; $topic_type = $di->request->request->getInt('topictype', POST_NORMAL);
$topic_type = in_array($topic_type, [POST_NORMAL, POST_STICKY, POST_ANNOUNCE]) ? $topic_type : POST_NORMAL; $topic_type = in_array($topic_type, [POST_NORMAL, POST_STICKY, POST_ANNOUNCE]) ? $topic_type : POST_NORMAL;
$selected_rg = $switch_rg_sig = $switch_poster_rg_sig = 0; $selected_rg = $switch_rg_sig = $switch_poster_rg_sig = 0;

View file

@ -819,7 +819,7 @@ else
'ATTACH' => $topic['attach_ext_id'], 'ATTACH' => $topic['attach_ext_id'],
'STATUS' => $topic['topic_status'], 'STATUS' => $topic['topic_status'],
'TYPE' => $topic['topic_type'], 'TYPE' => $topic['topic_type'],
'DL' => $topic['tracker_status'], 'DL' => isset($topic['tracker_status']) ? $topic['tracker_status'] : null,
'POLL' => $topic['topic_vote'], 'POLL' => $topic['topic_vote'],
'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '',

View file

@ -9,6 +9,11 @@ $di = \TorrentPier\Di::getInstance();
/** @var \TorrentPier\Db\Adapter $db */ /** @var \TorrentPier\Db\Adapter $db */
$db = $di->db; $db = $di->db;
///** @var \Symfony\Component\HttpFoundation\Request $request */
//$request = $di->request;
//$request->request->has()
//$id = $db->insert(BB_USERS, [ //$id = $db->insert(BB_USERS, [
// 'username' => 'user_' . rand(1, 50) // 'username' => 'user_' . rand(1, 50)
//]); //]);

View file

@ -4,6 +4,9 @@ define('BB_SCRIPT', 'forum');
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT . 'common.php'); require(BB_ROOT . 'common.php');
/** @var \TorrentPier\Di $di */
$di = \TorrentPier\Di::getInstance();
$page_cfg['include_bbcode_js'] = true; $page_cfg['include_bbcode_js'] = true;
$show_last_topic = true; $show_last_topic = true;
@ -231,7 +234,8 @@ $select_tpp = '';
if ($is_auth['auth_mod']) if ($is_auth['auth_mod'])
{ {
if ($req_tpp = abs(intval($_REQUEST['tpp'])) AND in_array($req_tpp, $bb_cfg['allowed_topics_per_page']))
if ($req_tpp = $di->request->query->getInt('tpp') AND in_array($req_tpp, $bb_cfg['allowed_topics_per_page']))
{ {
$topics_per_page = $req_tpp; $topics_per_page = $req_tpp;
} }
@ -260,7 +264,7 @@ $sel_previous_days = array(
if (!empty($_REQUEST['topicdays'])) if (!empty($_REQUEST['topicdays']))
{ {
if ($req_topic_days = abs(intval($_REQUEST['topicdays'])) AND isset($sel_previous_days[$req_topic_days])) if ($req_topic_days = $di->request->query->getInt('topicdays') AND isset($sel_previous_days[$req_topic_days]))
{ {
$sql = " $sql = "
SELECT COUNT(*) AS forum_topics SELECT COUNT(*) AS forum_topics
@ -485,7 +489,7 @@ foreach ($topic_rowset as $topic)
'ATTACH' => $topic['attach_ext_id'], 'ATTACH' => $topic['attach_ext_id'],
'STATUS' => $topic['topic_status'], 'STATUS' => $topic['topic_status'],
'TYPE' => $topic['topic_type'], 'TYPE' => $topic['topic_type'],
'DL' => ($topic['tracker_status'] && !$forum_data['allow_reg_tracker']), 'DL' => (isset($topic['tracker_status']) && !$forum_data['allow_reg_tracker']),
'POLL' => $topic['topic_vote'], 'POLL' => $topic['topic_vote'],
'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '',

View file

@ -3,6 +3,10 @@
define('BB_SCRIPT', 'topic'); define('BB_SCRIPT', 'topic');
define('BB_ROOT', './'); define('BB_ROOT', './');
require(BB_ROOT .'common.php'); require(BB_ROOT .'common.php');
/** @var \TorrentPier\Di $di */
$di = \TorrentPier\Di::getInstance();
require(INC_DIR .'bbcode.php'); require(INC_DIR .'bbcode.php');
$datastore->enqueue(array( $datastore->enqueue(array(
@ -29,7 +33,7 @@ $select_ppp = '';
if ($userdata['session_admin']) if ($userdata['session_admin'])
{ {
if ($req_ppp = abs(intval($_REQUEST['ppp'])) AND in_array($req_ppp, $bb_cfg['allowed_posts_per_page'])) if ($req_ppp = $di->request->query->getInt('ppp') AND in_array($req_ppp, $bb_cfg['allowed_posts_per_page']))
{ {
$posts_per_page = $req_ppp; $posts_per_page = $req_ppp;
} }