@@ -39,8 +39,8 @@ |
||
| 39 | 39 | 0 => $row['visit_time'], // start |
| 40 | 40 | 1 => $row['visit_time'], // end |
| 41 | 41 | ) |
| 42 | - //: false |
|
| 43 | - ; |
|
| 42 | + //: false |
|
| 43 | + ; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $session_list = array(); |
@@ -50,52 +50,52 @@ |
||
| 50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
| 51 | 51 | |
| 52 | 52 | $stat_types = array( |
| 53 | - STAT_TOTAL => array( |
|
| 54 | - 'type' => 'total', |
|
| 55 | - ), |
|
| 53 | + STAT_TOTAL => array( |
|
| 54 | + 'type' => 'total', |
|
| 55 | + ), |
|
| 56 | 56 | |
| 57 | - STAT_FLEET => array( |
|
| 58 | - 'type' => 'fleet', |
|
| 59 | - ), |
|
| 57 | + STAT_FLEET => array( |
|
| 58 | + 'type' => 'fleet', |
|
| 59 | + ), |
|
| 60 | 60 | |
| 61 | - STAT_TECH => array( |
|
| 62 | - 'type' => 'tech', |
|
| 63 | - ), |
|
| 61 | + STAT_TECH => array( |
|
| 62 | + 'type' => 'tech', |
|
| 63 | + ), |
|
| 64 | 64 | |
| 65 | - STAT_BUILDING => array( |
|
| 66 | - 'type' => 'build', |
|
| 67 | - ), |
|
| 65 | + STAT_BUILDING => array( |
|
| 66 | + 'type' => 'build', |
|
| 67 | + ), |
|
| 68 | 68 | |
| 69 | - STAT_DEFENSE => array( |
|
| 70 | - 'type' => 'defs', |
|
| 71 | - ), |
|
| 69 | + STAT_DEFENSE => array( |
|
| 70 | + 'type' => 'defs', |
|
| 71 | + ), |
|
| 72 | 72 | |
| 73 | - STAT_RESOURCE => array( |
|
| 74 | - 'type' => 'res', |
|
| 75 | - ), |
|
| 73 | + STAT_RESOURCE => array( |
|
| 74 | + 'type' => 'res', |
|
| 75 | + ), |
|
| 76 | 76 | |
| 77 | - STAT_RAID_TOTAL => array( |
|
| 78 | - 'type' => 'raids', |
|
| 79 | - ), |
|
| 77 | + STAT_RAID_TOTAL => array( |
|
| 78 | + 'type' => 'raids', |
|
| 79 | + ), |
|
| 80 | 80 | |
| 81 | - STAT_RAID_WON => array( |
|
| 82 | - 'type' => 'raidswin', |
|
| 83 | - ), |
|
| 81 | + STAT_RAID_WON => array( |
|
| 82 | + 'type' => 'raidswin', |
|
| 83 | + ), |
|
| 84 | 84 | |
| 85 | - STAT_RAID_LOST => array( |
|
| 86 | - 'type' => 'raidsloose', |
|
| 87 | - ), |
|
| 85 | + STAT_RAID_LOST => array( |
|
| 86 | + 'type' => 'raidsloose', |
|
| 87 | + ), |
|
| 88 | 88 | |
| 89 | 89 | STAT_LVL_BUILDING => array( |
| 90 | - 'type' => 'lvl_minier', |
|
| 90 | + 'type' => 'lvl_minier', |
|
| 91 | 91 | ), |
| 92 | 92 | |
| 93 | 93 | STAT_LVL_TECH => array( |
| 94 | - 'type' => 'player_rpg_tech_level', |
|
| 94 | + 'type' => 'player_rpg_tech_level', |
|
| 95 | 95 | ), |
| 96 | 96 | |
| 97 | 97 | STAT_LVL_RAID => array( |
| 98 | - 'type' => 'lvl_raid', |
|
| 98 | + 'type' => 'lvl_raid', |
|
| 99 | 99 | ), |
| 100 | 100 | ); |
| 101 | 101 | stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common); |
@@ -169,14 +169,14 @@ |
||
| 169 | 169 | return classSupernova::db_changeset_apply($db_changeset); |
| 170 | 170 | } |
| 171 | 171 | /** |
| 172 | - * Функция проверяет статус транзакции |
|
| 173 | - * |
|
| 174 | - * @param null|true|false $status Должна ли быть запущена транзакция в момент проверки |
|
| 175 | - * <p>null - транзакция НЕ должна быть запущена</p> |
|
| 176 | - * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
|
| 177 | - * <p>false - всё равно - для совместимости с $for_update</p> |
|
| 178 | - * @return bool Текущий статус транзакции |
|
| 179 | - */ |
|
| 172 | + * Функция проверяет статус транзакции |
|
| 173 | + * |
|
| 174 | + * @param null|true|false $status Должна ли быть запущена транзакция в момент проверки |
|
| 175 | + * <p>null - транзакция НЕ должна быть запущена</p> |
|
| 176 | + * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
|
| 177 | + * <p>false - всё равно - для совместимости с $for_update</p> |
|
| 178 | + * @return bool Текущий статус транзакции |
|
| 179 | + */ |
|
| 180 | 180 | function sn_db_transaction_check($transaction_should_be_started = null) { |
| 181 | 181 | return classSupernova::db_transaction_check($transaction_should_be_started); |
| 182 | 182 | } |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Gorlum |
|
| 5 | - * Date: 13.04.2015 |
|
| 6 | - * Time: 6:27 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Gorlum |
|
| 5 | + * Date: 13.04.2015 |
|
| 6 | + * Time: 6:27 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | function db_account_by_user_id($user_id_safe, &$result = null) { |
| 10 | 10 | die('db_account_by_user_id() должна быть реализована в класса core_auth!'); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | class template |
| 26 | 26 | { |
| 27 | 27 | /** variable that holds all the data we'll be substituting into |
| 28 | - * the compiled templates. Takes form: |
|
| 29 | - * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
|
| 30 | - * if it's a root-level variable, it'll be like this: |
|
| 31 | - * --> $this->_tpldata[.][0][varname] == value |
|
| 32 | - */ |
|
| 28 | + * the compiled templates. Takes form: |
|
| 29 | + * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
|
| 30 | + * if it's a root-level variable, it'll be like this: |
|
| 31 | + * --> $this->_tpldata[.][0][varname] == value |
|
| 32 | + */ |
|
| 33 | 33 | var $_tpldata = array('.' => array(0 => array())); |
| 34 | 34 | var $_rootref; |
| 35 | 35 | // var $_block_counter = array(); |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | var $parsed = false; |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Set template location |
|
| 64 | - * @access public |
|
| 65 | - */ |
|
| 63 | + * Set template location |
|
| 64 | + * @access public |
|
| 65 | + */ |
|
| 66 | 66 | function set_template() |
| 67 | 67 | { |
| 68 | 68 | global $phpbb_root_path, $user; |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * Set custom template location (able to use directory outside of phpBB) |
|
| 105 | - * @access public |
|
| 106 | - */ |
|
| 104 | + * Set custom template location (able to use directory outside of phpBB) |
|
| 105 | + * @access public |
|
| 106 | + */ |
|
| 107 | 107 | function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
| 108 | 108 | { |
| 109 | 109 | global $phpbb_root_path, $user; |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | - * Sets the template filenames for handles. $filename_array |
|
| 146 | - * should be a hash of handle => filename pairs. |
|
| 147 | - * @access public |
|
| 148 | - */ |
|
| 145 | + * Sets the template filenames for handles. $filename_array |
|
| 146 | + * should be a hash of handle => filename pairs. |
|
| 147 | + * @access public |
|
| 148 | + */ |
|
| 149 | 149 | function set_filenames($filename_array) |
| 150 | 150 | { |
| 151 | 151 | if (!is_array($filename_array)) |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | - * Destroy template data set |
|
| 176 | - * @access public |
|
| 177 | - */ |
|
| 175 | + * Destroy template data set |
|
| 176 | + * @access public |
|
| 177 | + */ |
|
| 178 | 178 | function destroy() |
| 179 | 179 | { |
| 180 | 180 | $this->_tpldata = array('.' => array(0 => array())); |
@@ -182,9 +182,9 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | - * Reset/empty complete block |
|
| 186 | - * @access public |
|
| 187 | - */ |
|
| 185 | + * Reset/empty complete block |
|
| 186 | + * @access public |
|
| 187 | + */ |
|
| 188 | 188 | function destroy_block_vars($blockname) |
| 189 | 189 | { |
| 190 | 190 | if (strpos($blockname, '.') !== false) |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * Display handle |
|
| 216 | - * @access public |
|
| 217 | - */ |
|
| 215 | + * Display handle |
|
| 216 | + * @access public |
|
| 217 | + */ |
|
| 218 | 218 | function display($handle, $include_once = true) |
| 219 | 219 | { |
| 220 | 220 | global $user, $phpbb_hook, $lang, $config; |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | - * Display the handle and assign the output to a template variable or return the compiled result. |
|
| 252 | - * @access public |
|
| 253 | - */ |
|
| 251 | + * Display the handle and assign the output to a template variable or return the compiled result. |
|
| 252 | + * @access public |
|
| 253 | + */ |
|
| 254 | 254 | function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
| 255 | 255 | { |
| 256 | 256 | ob_start(); |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | - * Load a compiled template if possible, if not, recompile it |
|
| 272 | - * @access private |
|
| 273 | - */ |
|
| 271 | + * Load a compiled template if possible, if not, recompile it |
|
| 272 | + * @access private |
|
| 273 | + */ |
|
| 274 | 274 | function _tpl_load(&$handle) |
| 275 | 275 | { |
| 276 | 276 | global $user, $config; |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
| 456 | - * Assign key variable pairs from an array |
|
| 457 | - * @access public |
|
| 458 | - */ |
|
| 456 | + * Assign key variable pairs from an array |
|
| 457 | + * @access public |
|
| 458 | + */ |
|
| 459 | 459 | function assign_vars($vararray) |
| 460 | 460 | { |
| 461 | 461 | foreach ($vararray as $key => $val) |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | - * Assign a single variable to a single key |
|
| 471 | - * @access public |
|
| 472 | - */ |
|
| 470 | + * Assign a single variable to a single key |
|
| 471 | + * @access public |
|
| 472 | + */ |
|
| 473 | 473 | function assign_var($varname, $varval) |
| 474 | 474 | { |
| 475 | 475 | $this->_rootref[$varname] = $varval; |
@@ -478,9 +478,9 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
| 481 | - * Assign key variable pairs from an array to a specified block |
|
| 482 | - * @access public |
|
| 483 | - */ |
|
| 481 | + * Assign key variable pairs from an array to a specified block |
|
| 482 | + * @access public |
|
| 483 | + */ |
|
| 484 | 484 | function assign_block_vars($blockname, $vararray) |
| 485 | 485 | { |
| 486 | 486 | if (strpos($blockname, '.') !== false) |
@@ -545,33 +545,33 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | /** |
| 548 | - * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
| 549 | - * |
|
| 550 | - * An example of how to use this function: |
|
| 551 | - * {@example alter_block_array.php} |
|
| 552 | - * |
|
| 553 | - * @param string $blockname the blockname, for example 'loop' |
|
| 554 | - * @param array $vararray the var array to insert/add or merge |
|
| 555 | - * @param mixed $key Key to search for |
|
| 556 | - * |
|
| 557 | - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
| 558 | - * |
|
| 559 | - * int: Position [the position to change or insert at directly given] |
|
| 560 | - * |
|
| 561 | - * If key is false the position is set to 0 |
|
| 562 | - * If key is true the position is set to the last entry |
|
| 563 | - * |
|
| 564 | - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
| 565 | - * |
|
| 566 | - * If insert, the vararray is inserted at the given position (position counting from zero). |
|
| 567 | - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). |
|
| 568 | - * |
|
| 569 | - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
| 570 | - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
| 571 | - * |
|
| 572 | - * @return bool false on error, true on success |
|
| 573 | - * @access public |
|
| 574 | - */ |
|
| 548 | + * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
| 549 | + * |
|
| 550 | + * An example of how to use this function: |
|
| 551 | + * {@example alter_block_array.php} |
|
| 552 | + * |
|
| 553 | + * @param string $blockname the blockname, for example 'loop' |
|
| 554 | + * @param array $vararray the var array to insert/add or merge |
|
| 555 | + * @param mixed $key Key to search for |
|
| 556 | + * |
|
| 557 | + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
| 558 | + * |
|
| 559 | + * int: Position [the position to change or insert at directly given] |
|
| 560 | + * |
|
| 561 | + * If key is false the position is set to 0 |
|
| 562 | + * If key is true the position is set to the last entry |
|
| 563 | + * |
|
| 564 | + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
| 565 | + * |
|
| 566 | + * If insert, the vararray is inserted at the given position (position counting from zero). |
|
| 567 | + * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). |
|
| 568 | + * |
|
| 569 | + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
| 570 | + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
| 571 | + * |
|
| 572 | + * @return bool false on error, true on success |
|
| 573 | + * @access public |
|
| 574 | + */ |
|
| 575 | 575 | function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
| 576 | 576 | { |
| 577 | 577 | if (strpos($blockname, '.') !== false) |
@@ -655,9 +655,9 @@ discard block |
||
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | /** |
| 658 | - * Include a separate template |
|
| 659 | - * @access private |
|
| 660 | - */ |
|
| 658 | + * Include a separate template |
|
| 659 | + * @access private |
|
| 660 | + */ |
|
| 661 | 661 | function _tpl_include($filename, $include = true) |
| 662 | 662 | { |
| 663 | 663 | global $lang, $config; |
@@ -686,9 +686,9 @@ discard block |
||
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
| 689 | - * Include a php-file |
|
| 690 | - * @access private |
|
| 691 | - */ |
|
| 689 | + * Include a php-file |
|
| 690 | + * @access private |
|
| 691 | + */ |
|
| 692 | 692 | function _php_include($filename) |
| 693 | 693 | { |
| 694 | 694 | global $phpbb_root_path; |
@@ -705,9 +705,9 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
| 708 | - * Assign key variable pairs from an array with block support |
|
| 709 | - * @access public |
|
| 710 | - */ |
|
| 708 | + * Assign key variable pairs from an array with block support |
|
| 709 | + * @access public |
|
| 710 | + */ |
|
| 711 | 711 | function assign_recursive($values, $name = '') |
| 712 | 712 | { |
| 713 | 713 | if(isset($values['.'])) |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * search.php |
|
| 4 | - * |
|
| 5 | - * 1.3 copyright (c) 2009-2010 by Gorlum for http://supernova.ws |
|
| 6 | - * [%] Fixed search of players without alliance |
|
| 7 | - * 1.2 - Security checks & tests by Gorlum for http://supernova.ws |
|
| 8 | - * @version 1.1 |
|
| 9 | - * @copyright 2009 by angelus_ira for Project. XNova |
|
| 10 | - * @copyright 2008 by ??????? for XNova |
|
| 11 | - */ |
|
| 3 | + * search.php |
|
| 4 | + * |
|
| 5 | + * 1.3 copyright (c) 2009-2010 by Gorlum for http://supernova.ws |
|
| 6 | + * [%] Fixed search of players without alliance |
|
| 7 | + * 1.2 - Security checks & tests by Gorlum for http://supernova.ws |
|
| 8 | + * @version 1.1 |
|
| 9 | + * @copyright 2009 by angelus_ira for Project. XNova |
|
| 10 | + * @copyright 2008 by ??????? for XNova |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 14 | 14 | |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Some helpers to sweeten dev's life |
|
| 4 | - */ |
|
| 3 | + * Some helpers to sweeten dev's life |
|
| 4 | + */ |
|
| 5 | 5 | |
| 6 | 6 | /* |
| 7 | 7 | * debug.class.php :: Clase Debug, maneja reporte de eventos |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | for ($Option = 10; $Option >= 0; $Option--) |
| 94 | 94 | { |
| 95 | - $template->assign_block_vars('option', array( |
|
| 96 | - 'VALUE' => $Option * 10, |
|
| 97 | - )); |
|
| 95 | + $template->assign_block_vars('option', array( |
|
| 96 | + 'VALUE' => $Option * 10, |
|
| 97 | + )); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $caps_real = eco_get_planet_caps($user, $planetrow, 3600); |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | int_calc_storage_bar(RES_DEUTERIUM); |
| 164 | 164 | |
| 165 | 165 | $template->assign_vars(array( |
| 166 | - 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | - 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | - 'PLANET_CORE_TEXT' => classLocale::$lang['uni_planet_density_types'][$planet_density_index], |
|
| 166 | + 'PLANET_NAME' => $planetrow['name'], |
|
| 167 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | + 'PLANET_DENSITY_INDEX' => $planet_density_index, |
|
| 169 | + 'PLANET_CORE_TEXT' => classLocale::$lang['uni_planet_density_types'][$planet_density_index], |
|
| 170 | 170 | |
| 171 | - 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 171 | + 'PRODUCTION_LEVEL' => floor($caps_real['efficiency'] * 100), |
|
| 172 | 172 | |
| 173 | - 'PAGE_HINT' => classLocale::$lang['res_hint'], |
|
| 173 | + 'PAGE_HINT' => classLocale::$lang['res_hint'], |
|
| 174 | 174 | )); |
| 175 | 175 | |
| 176 | 176 | display($template, classLocale::$lang['res_planet_production']); |
@@ -48,106 +48,106 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | switch($mode) { |
| 51 | - case 'write': |
|
| 52 | - $error_list = array(); |
|
| 53 | - $template = gettemplate('msg_message_compose', true); |
|
| 51 | + case 'write': |
|
| 52 | + $error_list = array(); |
|
| 53 | + $template = gettemplate('msg_message_compose', true); |
|
| 54 | 54 | |
| 55 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
| 56 | - if($recipient_name) { |
|
| 57 | - $recipient_row = db_user_by_username($recipient_name); |
|
| 58 | - } |
|
| 55 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
| 56 | + if($recipient_name) { |
|
| 57 | + $recipient_row = db_user_by_username($recipient_name); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - if(!$recipient_row) { |
|
| 61 | - $recipient_id = sys_get_param_id('id'); |
|
| 62 | - $recipient_row = db_user_by_id($recipient_id); |
|
| 63 | 60 | if(!$recipient_row) { |
| 64 | - $recipient_id = 0; |
|
| 61 | + $recipient_id = sys_get_param_id('id'); |
|
| 62 | + $recipient_row = db_user_by_id($recipient_id); |
|
| 63 | + if(!$recipient_row) { |
|
| 64 | + $recipient_id = 0; |
|
| 65 | + } |
|
| 65 | 66 | } |
| 66 | - } |
|
| 67 | - |
|
| 68 | - if($recipient_row) { |
|
| 69 | - $recipient_id = $recipient_row['id']; |
|
| 70 | - $recipient_name = $recipient_row['username']; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if($recipient_id == $user['id']) { |
|
| 74 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - $re = 0; |
|
| 78 | - $subject = sys_get_param_str('subject'); |
|
| 79 | - while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
| 80 | - $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix'])); |
|
| 81 | - $re++; |
|
| 82 | - } |
|
| 83 | - $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false; |
|
| 84 | 67 | |
| 85 | - if(sys_get_param_str('msg_send')) { |
|
| 86 | - $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
| 68 | + if($recipient_row) { |
|
| 69 | + $recipient_id = $recipient_row['id']; |
|
| 70 | + $recipient_name = $recipient_row['username']; |
|
| 71 | + } |
|
| 87 | 72 | |
| 88 | - if(!$recipient_id) { |
|
| 89 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
| 73 | + if($recipient_id == $user['id']) { |
|
| 74 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
| 90 | 75 | } |
| 91 | 76 | |
| 92 | - $text = sys_get_param_str('text'); |
|
| 93 | - if(!$text) { |
|
| 94 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
| 77 | + $re = 0; |
|
| 78 | + $subject = sys_get_param_str('subject'); |
|
| 79 | + while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) { |
|
| 80 | + $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix'])); |
|
| 81 | + $re++; |
|
| 95 | 82 | } |
| 83 | + $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false; |
|
| 96 | 84 | |
| 97 | - if(empty($error_list)) { |
|
| 98 | - $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
| 85 | + if(sys_get_param_str('msg_send')) { |
|
| 86 | + $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
| 99 | 87 | |
| 100 | - $user_safe_name = db_escape($user['username']); |
|
| 101 | - $recipient_name = db_escape($recipient_name); |
|
| 102 | - msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
| 88 | + if(!$recipient_id) { |
|
| 89 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
| 90 | + } |
|
| 103 | 91 | |
| 104 | - //$recipient_id = 0; |
|
| 105 | - //$recipient_name = ''; |
|
| 106 | - //$subject = ''; |
|
| 107 | - $text = ''; |
|
| 92 | + $text = sys_get_param_str('text'); |
|
| 93 | + if(!$text) { |
|
| 94 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
| 95 | + } |
|
| 108 | 96 | |
| 109 | - $msg_sent = true; |
|
| 110 | - } else { |
|
| 111 | - $subject = sys_get_param_str_unsafe('subject'); |
|
| 112 | - $text = sys_get_param_str_unsafe('text'); |
|
| 113 | - } |
|
| 114 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
| 115 | - } |
|
| 97 | + if(empty($error_list)) { |
|
| 98 | + $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
| 116 | 99 | |
| 117 | - $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
| 100 | + $user_safe_name = db_escape($user['username']); |
|
| 101 | + $recipient_name = db_escape($recipient_name); |
|
| 102 | + msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
| 118 | 103 | |
| 119 | - $template->assign_vars(array( |
|
| 120 | - 'RECIPIENT_ID' => $recipient_id, |
|
| 121 | - 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
| 122 | - 'SUBJECT' => htmlspecialchars($subject), |
|
| 123 | - 'TEXT' => htmlspecialchars($text), |
|
| 124 | - )); |
|
| 104 | + //$recipient_id = 0; |
|
| 105 | + //$recipient_name = ''; |
|
| 106 | + //$subject = ''; |
|
| 107 | + $text = ''; |
|
| 125 | 108 | |
| 126 | - foreach($error_list as $error_message) { |
|
| 127 | - $template->assign_block_vars('result', $error_message); |
|
| 128 | - } |
|
| 109 | + $msg_sent = true; |
|
| 110 | + } else { |
|
| 111 | + $subject = sys_get_param_str_unsafe('subject'); |
|
| 112 | + $text = sys_get_param_str_unsafe('text'); |
|
| 113 | + } |
|
| 114 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
| 115 | + } |
|
| 129 | 116 | |
| 130 | - $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
| 131 | - while($message_row = db_fetch($message_query)) { |
|
| 132 | - $template->assign_block_vars('messages', array( |
|
| 133 | - 'ID' => $message_row['message_id'], |
|
| 134 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 135 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 136 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 137 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
| 117 | + $subject = $subject ? $subject : classLocale::$lang['msg_subject_default']; |
|
| 138 | 118 | |
| 139 | - 'FROM_ID' => $message_row['message_sender'], |
|
| 119 | + $template->assign_vars(array( |
|
| 120 | + 'RECIPIENT_ID' => $recipient_id, |
|
| 121 | + 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
| 122 | + 'SUBJECT' => htmlspecialchars($subject), |
|
| 123 | + 'TEXT' => htmlspecialchars($text), |
|
| 140 | 124 | )); |
| 141 | - } |
|
| 142 | 125 | |
| 143 | - break; |
|
| 126 | + foreach($error_list as $error_message) { |
|
| 127 | + $template->assign_block_vars('result', $error_message); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
| 131 | + while($message_row = db_fetch($message_query)) { |
|
| 132 | + $template->assign_block_vars('messages', array( |
|
| 133 | + 'ID' => $message_row['message_id'], |
|
| 134 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 135 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 136 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 137 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
| 138 | + |
|
| 139 | + 'FROM_ID' => $message_row['message_sender'], |
|
| 140 | + )); |
|
| 141 | + } |
|
| 144 | 142 | |
| 145 | - case 'delete': |
|
| 146 | - $query_add = ''; |
|
| 143 | + break; |
|
| 147 | 144 | |
| 148 | - $message_range = sys_get_param_str('message_range'); |
|
| 145 | + case 'delete': |
|
| 146 | + $query_add = ''; |
|
| 149 | 147 | |
| 150 | - switch($message_range) { |
|
| 148 | + $message_range = sys_get_param_str('message_range'); |
|
| 149 | + |
|
| 150 | + switch($message_range) { |
|
| 151 | 151 | case 'unchecked': |
| 152 | 152 | case 'checked': |
| 153 | 153 | $marked_message_list = sys_get_param('mark', array()); |
@@ -171,65 +171,65 @@ discard block |
||
| 171 | 171 | case 'all': |
| 172 | 172 | $query_add = $query_add ? $query_add : true; |
| 173 | 173 | break; |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | 176 | if($query_add) { |
| 177 | 177 | $query_add = $query_add === true ? '' : $query_add; |
| 178 | 178 | db_message_list_delete($user, $query_add); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - case 'show': |
|
| 182 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
| 183 | - $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
| 184 | - } else { |
|
| 185 | - if($current_class == MSG_TYPE_NEW) { |
|
| 186 | - $SubUpdateQry = array(); |
|
| 187 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
| 188 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
| 189 | - $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
| 190 | - $user[$message_class['name']] = 0; |
|
| 181 | + case 'show': |
|
| 182 | + if($current_class == MSG_TYPE_OUTBOX) { |
|
| 183 | + $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
| 184 | + } else { |
|
| 185 | + if($current_class == MSG_TYPE_NEW) { |
|
| 186 | + $SubUpdateQry = array(); |
|
| 187 | + foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
| 188 | + if($message_class_id != MSG_TYPE_OUTBOX) { |
|
| 189 | + $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
| 190 | + $user[$message_class['name']] = 0; |
|
| 191 | + } |
|
| 191 | 192 | } |
| 193 | + $SubUpdateQry = implode(',', $SubUpdateQry); |
|
| 194 | + } else { |
|
| 195 | + $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
| 196 | + $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
| 197 | + |
|
| 198 | + $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
| 199 | + $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
| 192 | 200 | } |
| 193 | - $SubUpdateQry = implode(',', $SubUpdateQry); |
|
| 194 | - } else { |
|
| 195 | - $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
| 196 | - $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
| 197 | 201 | |
| 198 | - $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
| 199 | - $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
| 202 | + db_user_set_by_id($user['id'], $SubUpdateQry); |
|
| 203 | + $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
| 200 | 204 | } |
| 201 | 205 | |
| 202 | - db_user_set_by_id($user['id'], $SubUpdateQry); |
|
| 203 | - $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - if(sys_get_param_int('return')) { |
|
| 207 | - header('Location: messages.php'); |
|
| 208 | - die(); |
|
| 209 | - } |
|
| 206 | + if(sys_get_param_int('return')) { |
|
| 207 | + header('Location: messages.php'); |
|
| 208 | + die(); |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - $template = gettemplate('msg_message_list', true); |
|
| 212 | - while($message_row = db_fetch($message_query)) { |
|
| 213 | - $template->assign_block_vars('messages', array( |
|
| 214 | - 'ID' => $message_row['message_id'], |
|
| 215 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 216 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 217 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 218 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
| 219 | - |
|
| 220 | - 'FROM_ID' => $message_row['message_sender'], |
|
| 221 | - 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
| 222 | - 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
| 223 | - )); |
|
| 224 | - } |
|
| 211 | + $template = gettemplate('msg_message_list', true); |
|
| 212 | + while($message_row = db_fetch($message_query)) { |
|
| 213 | + $template->assign_block_vars('messages', array( |
|
| 214 | + 'ID' => $message_row['message_id'], |
|
| 215 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
| 216 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
| 217 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
| 218 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
| 219 | + |
|
| 220 | + 'FROM_ID' => $message_row['message_sender'], |
|
| 221 | + 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
| 222 | + 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
| 223 | + )); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - $current_class_text = classLocale::$lang['msg_class'][$current_class]; |
|
| 226 | + $current_class_text = classLocale::$lang['msg_class'][$current_class]; |
|
| 227 | 227 | |
| 228 | - $template->assign_vars(array( |
|
| 229 | - "MESSAGE_CLASS" => $current_class, |
|
| 230 | - "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
| 231 | - )); |
|
| 232 | - break; |
|
| 228 | + $template->assign_vars(array( |
|
| 229 | + "MESSAGE_CLASS" => $current_class, |
|
| 230 | + "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
| 231 | + )); |
|
| 232 | + break; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if(!$template) { |