@@ -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); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | if (!defined('INSIDE')) { |
| 30 | - die('Hack attempt!'); |
|
| 30 | + die('Hack attempt!'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | global $config; |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | if (!defined('INSIDE')) |
| 30 | 30 | { |
| 31 | - die('Hack attempt!'); |
|
| 31 | + die('Hack attempt!'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $lang_info = array( |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | protected $_repository; |
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * @var ContainerPlus $_oldRepo |
| 34 | 34 | */ |
| 35 | 35 | protected $_oldRepo; |
@@ -75,121 +75,121 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | switch ($fleet_page) { |
| 78 | - case 3: |
|
| 78 | + case 3: |
|
| 79 | 79 | |
| 80 | - case 2: |
|
| 81 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 82 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 83 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
| 80 | + case 2: |
|
| 81 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 82 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 83 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
| 84 | 84 | |
| 85 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
| 86 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 87 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 88 | - die(); |
|
| 89 | - } |
|
| 90 | - $ship_amount = floatval($ship_amount); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - $UsedPlanet = false; |
|
| 94 | - $YourPlanet = false; |
|
| 95 | - $missiontype = array(); |
|
| 96 | - if ($planet > classSupernova::$config->game_maxPlanet) { |
|
| 97 | - $target_mission = MT_EXPLORE; |
|
| 98 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 99 | - } elseif ($galaxy && $system && $planet) { |
|
| 100 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 101 | - |
|
| 102 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 103 | - |
|
| 104 | - if ($TargetPlanet['id_owner']) { |
|
| 105 | - $UsedPlanet = true; |
|
| 106 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 107 | - $YourPlanet = true; |
|
| 85 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
| 86 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 87 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 88 | + die(); |
|
| 108 | 89 | } |
| 90 | + $ship_amount = floatval($ship_amount); |
|
| 109 | 91 | } |
| 110 | 92 | |
| 111 | - if (!$UsedPlanet) { |
|
| 112 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
| 113 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 114 | - $target_mission = MT_COLONIZE; |
|
| 115 | - $planet_type = PT_PLANET; |
|
| 116 | - } else { |
|
| 117 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
| 118 | - } |
|
| 119 | - } else { |
|
| 120 | - $recyclers = 0; |
|
| 121 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 122 | - $recyclers += $fleetarray[$recycler_id]; |
|
| 93 | + $UsedPlanet = false; |
|
| 94 | + $YourPlanet = false; |
|
| 95 | + $missiontype = array(); |
|
| 96 | + if ($planet > classSupernova::$config->game_maxPlanet) { |
|
| 97 | + $target_mission = MT_EXPLORE; |
|
| 98 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 99 | + } elseif ($galaxy && $system && $planet) { |
|
| 100 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 101 | + |
|
| 102 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 103 | + |
|
| 104 | + if ($TargetPlanet['id_owner']) { |
|
| 105 | + $UsedPlanet = true; |
|
| 106 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 107 | + $YourPlanet = true; |
|
| 108 | + } |
|
| 123 | 109 | } |
| 124 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 125 | - $target_mission = MT_RECYCLE; |
|
| 126 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 127 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 128 | - if ($YourPlanet) { |
|
| 129 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 130 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 110 | + |
|
| 111 | + if (!$UsedPlanet) { |
|
| 112 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
| 113 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 114 | + $target_mission = MT_COLONIZE; |
|
| 115 | + $planet_type = PT_PLANET; |
|
| 131 | 116 | } else { |
| 132 | - // Not Your Planet |
|
| 133 | - if ($fleetarray[SHIP_SPY]) { |
|
| 134 | - // Only spy missions if any spy |
|
| 135 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 117 | + messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
| 118 | + } |
|
| 119 | + } else { |
|
| 120 | + $recyclers = 0; |
|
| 121 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 122 | + $recyclers += $fleetarray[$recycler_id]; |
|
| 123 | + } |
|
| 124 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 125 | + $target_mission = MT_RECYCLE; |
|
| 126 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 127 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 128 | + if ($YourPlanet) { |
|
| 129 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 130 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 136 | 131 | } else { |
| 137 | - // If no spies... |
|
| 138 | - if ($fleet_group_mr) { |
|
| 139 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 132 | + // Not Your Planet |
|
| 133 | + if ($fleetarray[SHIP_SPY]) { |
|
| 134 | + // Only spy missions if any spy |
|
| 135 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 140 | 136 | } else { |
| 141 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 142 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 143 | - |
|
| 144 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 145 | - |
|
| 146 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 147 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 137 | + // If no spies... |
|
| 138 | + if ($fleet_group_mr) { |
|
| 139 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 140 | + } else { |
|
| 141 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 142 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 143 | + |
|
| 144 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 145 | + |
|
| 146 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 147 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 148 | + } |
|
| 148 | 149 | } |
| 149 | 150 | } |
| 150 | 151 | } |
| 151 | 152 | } |
| 152 | 153 | } |
| 153 | 154 | } |
| 154 | - } |
|
| 155 | - |
|
| 156 | - if (!$target_mission && is_array($missiontype)) { |
|
| 157 | - $target_mission = MT_ATTACK; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | -// $sn_group_missions = sn_get_groups('missions'); |
|
| 161 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
| 162 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 163 | -// } |
|
| 164 | -// |
|
| 165 | -// |
|
| 166 | - ksort($missiontype); |
|
| 167 | - |
|
| 168 | - $speed_percent = sys_get_param_int('speed', 10); |
|
| 169 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 170 | - |
|
| 171 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 172 | - $fleet_speed = $travel_data['fleet_speed']; |
|
| 173 | - $distance = $travel_data['distance']; |
|
| 174 | - $duration = $travel_data['duration']; |
|
| 175 | - $consumption = $travel_data['consumption']; |
|
| 176 | - // No Break |
|
| 177 | - |
|
| 178 | - case 1: |
|
| 179 | - if ($galaxy && $system && $planet) { |
|
| 180 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 181 | - |
|
| 182 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - case 0: |
|
| 186 | - $template_result += array( |
|
| 187 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
| 188 | - 'thissystem' => $planetrow['system'], |
|
| 189 | - 'thisplanet' => $planetrow['planet'], |
|
| 190 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
| 191 | - ); |
|
| 192 | - // no break |
|
| 155 | + |
|
| 156 | + if (!$target_mission && is_array($missiontype)) { |
|
| 157 | + $target_mission = MT_ATTACK; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + // $sn_group_missions = sn_get_groups('missions'); |
|
| 161 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
| 162 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 163 | + // } |
|
| 164 | + // |
|
| 165 | + // |
|
| 166 | + ksort($missiontype); |
|
| 167 | + |
|
| 168 | + $speed_percent = sys_get_param_int('speed', 10); |
|
| 169 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 170 | + |
|
| 171 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 172 | + $fleet_speed = $travel_data['fleet_speed']; |
|
| 173 | + $distance = $travel_data['distance']; |
|
| 174 | + $duration = $travel_data['duration']; |
|
| 175 | + $consumption = $travel_data['consumption']; |
|
| 176 | + // No Break |
|
| 177 | + |
|
| 178 | + case 1: |
|
| 179 | + if ($galaxy && $system && $planet) { |
|
| 180 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 181 | + |
|
| 182 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + case 0: |
|
| 186 | + $template_result += array( |
|
| 187 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
| 188 | + 'thissystem' => $planetrow['system'], |
|
| 189 | + 'thisplanet' => $planetrow['planet'], |
|
| 190 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
| 191 | + ); |
|
| 192 | + // no break |
|
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
@@ -211,35 +211,35 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | switch($fleet_page) { |
| 214 | - case 1: |
|
| 215 | - require('includes/includes/flt_page1.inc'); |
|
| 216 | - break; |
|
| 217 | - |
|
| 218 | - case 2: |
|
| 219 | - require_once('includes/includes/flt_page2.inc'); |
|
| 220 | - sn_fleet_page2(); |
|
| 221 | - break; |
|
| 222 | - |
|
| 223 | - case 3: |
|
| 224 | - require_once('includes/includes/flt_page3.inc'); |
|
| 225 | - sn_fleet_page3(); |
|
| 226 | - break; |
|
| 227 | - |
|
| 228 | - case 4: |
|
| 229 | - require('includes/includes/flt_page4.inc'); |
|
| 230 | - break; |
|
| 231 | - |
|
| 232 | - case 5: |
|
| 233 | - $template = gettemplate('fleet5', true); |
|
| 234 | - $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering(); |
|
| 235 | - $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
| 236 | - // Building list of own planets & moons |
|
| 237 | - $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
| 238 | - break; |
|
| 239 | - |
|
| 240 | - default: |
|
| 241 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 242 | - |
|
| 243 | - require('includes/includes/flt_page0.inc'); |
|
| 244 | - break; |
|
| 214 | + case 1: |
|
| 215 | + require('includes/includes/flt_page1.inc'); |
|
| 216 | + break; |
|
| 217 | + |
|
| 218 | + case 2: |
|
| 219 | + require_once('includes/includes/flt_page2.inc'); |
|
| 220 | + sn_fleet_page2(); |
|
| 221 | + break; |
|
| 222 | + |
|
| 223 | + case 3: |
|
| 224 | + require_once('includes/includes/flt_page3.inc'); |
|
| 225 | + sn_fleet_page3(); |
|
| 226 | + break; |
|
| 227 | + |
|
| 228 | + case 4: |
|
| 229 | + require('includes/includes/flt_page4.inc'); |
|
| 230 | + break; |
|
| 231 | + |
|
| 232 | + case 5: |
|
| 233 | + $template = gettemplate('fleet5', true); |
|
| 234 | + $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering(); |
|
| 235 | + $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
| 236 | + // Building list of own planets & moons |
|
| 237 | + $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
| 238 | + break; |
|
| 239 | + |
|
| 240 | + default: |
|
| 241 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 242 | + |
|
| 243 | + require('includes/includes/flt_page0.inc'); |
|
| 244 | + break; |
|
| 245 | 245 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | if (!defined('IN_PHPBB')) |
| 18 | 18 | { |
| 19 | - exit; |
|
| 19 | + exit; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -24,227 +24,227 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class phpbb_hook |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * Registered hooks |
|
| 29 | - */ |
|
| 30 | - var $hooks = array(); |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Results returned by functions called |
|
| 34 | - */ |
|
| 35 | - var $hook_result = array(); |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * internal pointer |
|
| 39 | - */ |
|
| 40 | - var $current_hook = NULL; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Initialize hook class. |
|
| 44 | - * |
|
| 45 | - * @param array $valid_hooks array containing the hookable functions/methods |
|
| 46 | - */ |
|
| 47 | - function phpbb_hook($valid_hooks) |
|
| 48 | - { |
|
| 49 | - foreach ($valid_hooks as $_null => $method) |
|
| 50 | - { |
|
| 51 | - $this->add_hook($method); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if (function_exists('phpbb_hook_register')) |
|
| 55 | - { |
|
| 56 | - phpbb_hook_register($this); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Register function/method to be called within hook |
|
| 62 | - * This function is normally called by the modification/application to attach/register the functions. |
|
| 63 | - * |
|
| 64 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 65 | - * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
| 66 | - * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
| 67 | - */ |
|
| 68 | - function register($definition, $hook, $mode = 'normal') |
|
| 69 | - { |
|
| 70 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 71 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 72 | - |
|
| 73 | - // Method able to be hooked? |
|
| 74 | - if (isset($this->hooks[$class][$function])) |
|
| 75 | - { |
|
| 76 | - switch ($mode) |
|
| 77 | - { |
|
| 78 | - case 'standalone': |
|
| 79 | - if (!isset($this->hooks[$class][$function]['standalone'])) |
|
| 80 | - { |
|
| 81 | - $this->hooks[$class][$function] = array('standalone' => $hook); |
|
| 82 | - } |
|
| 83 | - else |
|
| 84 | - { |
|
| 85 | - trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
| 86 | - } |
|
| 87 | - break; |
|
| 88 | - |
|
| 89 | - case 'first': |
|
| 90 | - case 'last': |
|
| 91 | - $this->hooks[$class][$function][$mode][] = $hook; |
|
| 92 | - break; |
|
| 93 | - |
|
| 94 | - case 'normal': |
|
| 95 | - default: |
|
| 96 | - $this->hooks[$class][$function]['normal'][] = $hook; |
|
| 97 | - break; |
|
| 98 | - } |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Calling all functions/methods attached to a specified hook. |
|
| 104 | - * Called by the function allowing hooks... |
|
| 105 | - * |
|
| 106 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 107 | - * @return bool False if no hook got executed, true otherwise |
|
| 108 | - */ |
|
| 109 | - function call_hook($definition) |
|
| 110 | - { |
|
| 111 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 112 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 113 | - |
|
| 114 | - if (!empty($this->hooks[$class][$function])) |
|
| 115 | - { |
|
| 116 | - // Developer tries to call a hooked function within the hooked function... |
|
| 117 | - if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
| 118 | - { |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - // Call the hook with the arguments attached and store result |
|
| 123 | - $arguments = func_get_args(); |
|
| 124 | - $this->current_hook = array('class' => $class, 'function' => $function); |
|
| 125 | - $arguments[0] = &$this; |
|
| 126 | - |
|
| 127 | - // Call the hook chain... |
|
| 128 | - if (isset($this->hooks[$class][$function]['standalone'])) |
|
| 129 | - { |
|
| 130 | - $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
| 131 | - } |
|
| 132 | - else |
|
| 133 | - { |
|
| 134 | - foreach (array('first', 'normal', 'last') as $mode) |
|
| 135 | - { |
|
| 136 | - if (!isset($this->hooks[$class][$function][$mode])) |
|
| 137 | - { |
|
| 138 | - continue; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
| 142 | - { |
|
| 143 | - $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - $this->current_hook = NULL; |
|
| 149 | - return true; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - $this->current_hook = NULL; |
|
| 153 | - return false; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Get result from previously called functions/methods for the same hook |
|
| 158 | - * |
|
| 159 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 160 | - * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
| 161 | - */ |
|
| 162 | - function previous_hook_result($definition) |
|
| 163 | - { |
|
| 164 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 165 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 166 | - |
|
| 167 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 168 | - { |
|
| 169 | - return array('result' => $this->hook_result[$class][$function]); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - return false; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Check if the called functions/methods returned something. |
|
| 177 | - * |
|
| 178 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 179 | - * @return bool True if results are there, false if not |
|
| 180 | - */ |
|
| 181 | - function hook_return($definition) |
|
| 182 | - { |
|
| 183 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 184 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 185 | - |
|
| 186 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 187 | - { |
|
| 188 | - return true; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return false; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Give actual result from called functions/methods back. |
|
| 196 | - * |
|
| 197 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 198 | - * @return mixed The result |
|
| 199 | - */ |
|
| 200 | - function hook_return_result($definition) |
|
| 201 | - { |
|
| 202 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 203 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 204 | - |
|
| 205 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 206 | - { |
|
| 207 | - $result = $this->hook_result[$class][$function]; |
|
| 208 | - unset($this->hook_result[$class][$function]); |
|
| 209 | - return $result; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - return; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Add new function to the allowed hooks. |
|
| 217 | - * |
|
| 218 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 219 | - */ |
|
| 220 | - function add_hook($definition) |
|
| 221 | - { |
|
| 222 | - if (!is_array($definition)) |
|
| 223 | - { |
|
| 224 | - $definition = array('__global', $definition); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - $this->hooks[$definition[0]][$definition[1]] = array(); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * Remove function from the allowed hooks. |
|
| 232 | - * |
|
| 233 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 234 | - */ |
|
| 235 | - function remove_hook($definition) |
|
| 236 | - { |
|
| 237 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 238 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 239 | - |
|
| 240 | - if (isset($this->hooks[$class][$function])) |
|
| 241 | - { |
|
| 242 | - unset($this->hooks[$class][$function]); |
|
| 243 | - |
|
| 244 | - if (isset($this->hook_result[$class][$function])) |
|
| 245 | - { |
|
| 246 | - unset($this->hook_result[$class][$function]); |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - } |
|
| 27 | + /** |
|
| 28 | + * Registered hooks |
|
| 29 | + */ |
|
| 30 | + var $hooks = array(); |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Results returned by functions called |
|
| 34 | + */ |
|
| 35 | + var $hook_result = array(); |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * internal pointer |
|
| 39 | + */ |
|
| 40 | + var $current_hook = NULL; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Initialize hook class. |
|
| 44 | + * |
|
| 45 | + * @param array $valid_hooks array containing the hookable functions/methods |
|
| 46 | + */ |
|
| 47 | + function phpbb_hook($valid_hooks) |
|
| 48 | + { |
|
| 49 | + foreach ($valid_hooks as $_null => $method) |
|
| 50 | + { |
|
| 51 | + $this->add_hook($method); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if (function_exists('phpbb_hook_register')) |
|
| 55 | + { |
|
| 56 | + phpbb_hook_register($this); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Register function/method to be called within hook |
|
| 62 | + * This function is normally called by the modification/application to attach/register the functions. |
|
| 63 | + * |
|
| 64 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 65 | + * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
| 66 | + * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
| 67 | + */ |
|
| 68 | + function register($definition, $hook, $mode = 'normal') |
|
| 69 | + { |
|
| 70 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 71 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 72 | + |
|
| 73 | + // Method able to be hooked? |
|
| 74 | + if (isset($this->hooks[$class][$function])) |
|
| 75 | + { |
|
| 76 | + switch ($mode) |
|
| 77 | + { |
|
| 78 | + case 'standalone': |
|
| 79 | + if (!isset($this->hooks[$class][$function]['standalone'])) |
|
| 80 | + { |
|
| 81 | + $this->hooks[$class][$function] = array('standalone' => $hook); |
|
| 82 | + } |
|
| 83 | + else |
|
| 84 | + { |
|
| 85 | + trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
| 86 | + } |
|
| 87 | + break; |
|
| 88 | + |
|
| 89 | + case 'first': |
|
| 90 | + case 'last': |
|
| 91 | + $this->hooks[$class][$function][$mode][] = $hook; |
|
| 92 | + break; |
|
| 93 | + |
|
| 94 | + case 'normal': |
|
| 95 | + default: |
|
| 96 | + $this->hooks[$class][$function]['normal'][] = $hook; |
|
| 97 | + break; |
|
| 98 | + } |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Calling all functions/methods attached to a specified hook. |
|
| 104 | + * Called by the function allowing hooks... |
|
| 105 | + * |
|
| 106 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 107 | + * @return bool False if no hook got executed, true otherwise |
|
| 108 | + */ |
|
| 109 | + function call_hook($definition) |
|
| 110 | + { |
|
| 111 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 112 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 113 | + |
|
| 114 | + if (!empty($this->hooks[$class][$function])) |
|
| 115 | + { |
|
| 116 | + // Developer tries to call a hooked function within the hooked function... |
|
| 117 | + if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
| 118 | + { |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + // Call the hook with the arguments attached and store result |
|
| 123 | + $arguments = func_get_args(); |
|
| 124 | + $this->current_hook = array('class' => $class, 'function' => $function); |
|
| 125 | + $arguments[0] = &$this; |
|
| 126 | + |
|
| 127 | + // Call the hook chain... |
|
| 128 | + if (isset($this->hooks[$class][$function]['standalone'])) |
|
| 129 | + { |
|
| 130 | + $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
| 131 | + } |
|
| 132 | + else |
|
| 133 | + { |
|
| 134 | + foreach (array('first', 'normal', 'last') as $mode) |
|
| 135 | + { |
|
| 136 | + if (!isset($this->hooks[$class][$function][$mode])) |
|
| 137 | + { |
|
| 138 | + continue; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
| 142 | + { |
|
| 143 | + $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + $this->current_hook = NULL; |
|
| 149 | + return true; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + $this->current_hook = NULL; |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Get result from previously called functions/methods for the same hook |
|
| 158 | + * |
|
| 159 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 160 | + * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
| 161 | + */ |
|
| 162 | + function previous_hook_result($definition) |
|
| 163 | + { |
|
| 164 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 165 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 166 | + |
|
| 167 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 168 | + { |
|
| 169 | + return array('result' => $this->hook_result[$class][$function]); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + return false; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Check if the called functions/methods returned something. |
|
| 177 | + * |
|
| 178 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 179 | + * @return bool True if results are there, false if not |
|
| 180 | + */ |
|
| 181 | + function hook_return($definition) |
|
| 182 | + { |
|
| 183 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 184 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 185 | + |
|
| 186 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 187 | + { |
|
| 188 | + return true; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return false; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Give actual result from called functions/methods back. |
|
| 196 | + * |
|
| 197 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 198 | + * @return mixed The result |
|
| 199 | + */ |
|
| 200 | + function hook_return_result($definition) |
|
| 201 | + { |
|
| 202 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 203 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 204 | + |
|
| 205 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
| 206 | + { |
|
| 207 | + $result = $this->hook_result[$class][$function]; |
|
| 208 | + unset($this->hook_result[$class][$function]); |
|
| 209 | + return $result; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + return; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Add new function to the allowed hooks. |
|
| 217 | + * |
|
| 218 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 219 | + */ |
|
| 220 | + function add_hook($definition) |
|
| 221 | + { |
|
| 222 | + if (!is_array($definition)) |
|
| 223 | + { |
|
| 224 | + $definition = array('__global', $definition); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + $this->hooks[$definition[0]][$definition[1]] = array(); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * Remove function from the allowed hooks. |
|
| 232 | + * |
|
| 233 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
| 234 | + */ |
|
| 235 | + function remove_hook($definition) |
|
| 236 | + { |
|
| 237 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
| 238 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
| 239 | + |
|
| 240 | + if (isset($this->hooks[$class][$function])) |
|
| 241 | + { |
|
| 242 | + unset($this->hooks[$class][$function]); |
|
| 243 | + |
|
| 244 | + if (isset($this->hook_result[$class][$function])) |
|
| 245 | + { |
|
| 246 | + unset($this->hook_result[$class][$function]); |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | 250 | } |
@@ -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(); |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * Set template location |
|
| 83 | - * @access public |
|
| 84 | - */ |
|
| 82 | + * Set template location |
|
| 83 | + * @access public |
|
| 84 | + */ |
|
| 85 | 85 | function set_template() |
| 86 | 86 | { |
| 87 | 87 | global $user; |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * Set custom template location (able to use directory outside of phpBB) |
|
| 124 | - * @access public |
|
| 125 | - */ |
|
| 123 | + * Set custom template location (able to use directory outside of phpBB) |
|
| 124 | + * @access public |
|
| 125 | + */ |
|
| 126 | 126 | function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
| 127 | 127 | { |
| 128 | 128 | global $user; |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * Sets the template filenames for handles. $filename_array |
|
| 165 | - * should be a hash of handle => filename pairs. |
|
| 166 | - * @access public |
|
| 167 | - */ |
|
| 164 | + * Sets the template filenames for handles. $filename_array |
|
| 165 | + * should be a hash of handle => filename pairs. |
|
| 166 | + * @access public |
|
| 167 | + */ |
|
| 168 | 168 | function set_filenames($filename_array) |
| 169 | 169 | { |
| 170 | 170 | if (!is_array($filename_array)) |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Destroy template data set |
|
| 195 | - * @access public |
|
| 196 | - */ |
|
| 194 | + * Destroy template data set |
|
| 195 | + * @access public |
|
| 196 | + */ |
|
| 197 | 197 | function destroy() |
| 198 | 198 | { |
| 199 | 199 | $this->_tpldata = array('.' => array(0 => array())); |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | - * Reset/empty complete block |
|
| 205 | - * @access public |
|
| 206 | - */ |
|
| 204 | + * Reset/empty complete block |
|
| 205 | + * @access public |
|
| 206 | + */ |
|
| 207 | 207 | function destroy_block_vars($blockname) |
| 208 | 208 | { |
| 209 | 209 | if (strpos($blockname, '.') !== false) |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | - * Display handle |
|
| 235 | - * @access public |
|
| 236 | - */ |
|
| 234 | + * Display handle |
|
| 235 | + * @access public |
|
| 236 | + */ |
|
| 237 | 237 | function display($handle, $include_once = true) |
| 238 | 238 | { |
| 239 | 239 | /** |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | - * Display the handle and assign the output to a template variable or return the compiled result. |
|
| 279 | - * @access public |
|
| 280 | - */ |
|
| 278 | + * Display the handle and assign the output to a template variable or return the compiled result. |
|
| 279 | + * @access public |
|
| 280 | + */ |
|
| 281 | 281 | function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
| 282 | 282 | { |
| 283 | 283 | ob_start(); |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | - * Load a compiled template if possible, if not, recompile it |
|
| 299 | - * @access private |
|
| 300 | - */ |
|
| 298 | + * Load a compiled template if possible, if not, recompile it |
|
| 299 | + * @access private |
|
| 300 | + */ |
|
| 301 | 301 | function _tpl_load(&$handle) |
| 302 | 302 | { |
| 303 | 303 | global $user, $config; |
@@ -475,9 +475,9 @@ discard block |
||
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
| 478 | - * Assign key variable pairs from an array |
|
| 479 | - * @access public |
|
| 480 | - */ |
|
| 478 | + * Assign key variable pairs from an array |
|
| 479 | + * @access public |
|
| 480 | + */ |
|
| 481 | 481 | function assign_vars($vararray) |
| 482 | 482 | { |
| 483 | 483 | foreach ($vararray as $key => $val) |
@@ -489,9 +489,9 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
| 492 | - * Assign a single variable to a single key |
|
| 493 | - * @access public |
|
| 494 | - */ |
|
| 492 | + * Assign a single variable to a single key |
|
| 493 | + * @access public |
|
| 494 | + */ |
|
| 495 | 495 | function assign_var($varname, $varval) |
| 496 | 496 | { |
| 497 | 497 | $this->_rootref[$varname] = $varval; |
@@ -500,9 +500,9 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Assign key variable pairs from an array to a specified block |
|
| 504 | - * @access public |
|
| 505 | - */ |
|
| 503 | + * Assign key variable pairs from an array to a specified block |
|
| 504 | + * @access public |
|
| 505 | + */ |
|
| 506 | 506 | function assign_block_vars($blockname, $vararray) |
| 507 | 507 | { |
| 508 | 508 | if (strpos($blockname, '.') !== false) |
@@ -567,33 +567,33 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /** |
| 570 | - * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
| 571 | - * |
|
| 572 | - * An example of how to use this function: |
|
| 573 | - * {@example alter_block_array.php} |
|
| 574 | - * |
|
| 575 | - * @param string $blockname the blockname, for example 'loop' |
|
| 576 | - * @param array $vararray the var array to insert/add or merge |
|
| 577 | - * @param mixed $key Key to search for |
|
| 578 | - * |
|
| 579 | - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
| 580 | - * |
|
| 581 | - * int: Position [the position to change or insert at directly given] |
|
| 582 | - * |
|
| 583 | - * If key is false the position is set to 0 |
|
| 584 | - * If key is true the position is set to the last entry |
|
| 585 | - * |
|
| 586 | - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
| 587 | - * |
|
| 588 | - * If insert, the vararray is inserted at the given position (position counting from zero). |
|
| 589 | - * 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). |
|
| 590 | - * |
|
| 591 | - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
| 592 | - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
| 593 | - * |
|
| 594 | - * @return bool false on error, true on success |
|
| 595 | - * @access public |
|
| 596 | - */ |
|
| 570 | + * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
| 571 | + * |
|
| 572 | + * An example of how to use this function: |
|
| 573 | + * {@example alter_block_array.php} |
|
| 574 | + * |
|
| 575 | + * @param string $blockname the blockname, for example 'loop' |
|
| 576 | + * @param array $vararray the var array to insert/add or merge |
|
| 577 | + * @param mixed $key Key to search for |
|
| 578 | + * |
|
| 579 | + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
| 580 | + * |
|
| 581 | + * int: Position [the position to change or insert at directly given] |
|
| 582 | + * |
|
| 583 | + * If key is false the position is set to 0 |
|
| 584 | + * If key is true the position is set to the last entry |
|
| 585 | + * |
|
| 586 | + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
| 587 | + * |
|
| 588 | + * If insert, the vararray is inserted at the given position (position counting from zero). |
|
| 589 | + * 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). |
|
| 590 | + * |
|
| 591 | + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
| 592 | + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
| 593 | + * |
|
| 594 | + * @return bool false on error, true on success |
|
| 595 | + * @access public |
|
| 596 | + */ |
|
| 597 | 597 | function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
| 598 | 598 | { |
| 599 | 599 | if (strpos($blockname, '.') !== false) |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | /** |
| 680 | - * Include a separate template |
|
| 681 | - * @access private |
|
| 682 | - */ |
|
| 680 | + * Include a separate template |
|
| 681 | + * @access private |
|
| 682 | + */ |
|
| 683 | 683 | function _tpl_include($filename, $include = true) |
| 684 | 684 | { |
| 685 | 685 | // This is used to access global vars |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
| 712 | - * Include a php-file |
|
| 713 | - * @access private |
|
| 714 | - */ |
|
| 712 | + * Include a php-file |
|
| 713 | + * @access private |
|
| 714 | + */ |
|
| 715 | 715 | function _php_include($filename) |
| 716 | 716 | { |
| 717 | 717 | $file = $this->rootPhysical . $filename; |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | /** |
| 729 | - * Assign key variable pairs from an array with block support |
|
| 730 | - * @access public |
|
| 731 | - */ |
|
| 729 | + * Assign key variable pairs from an array with block support |
|
| 730 | + * @access public |
|
| 731 | + */ |
|
| 732 | 732 | function assign_recursive($values, $name = '') |
| 733 | 733 | { |
| 734 | 734 | if(isset($values['.'])) |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | for ($Option = 10; $Option >= 0; $Option--) |
| 98 | 98 | { |
| 99 | - $template->assign_block_vars('option', array( |
|
| 100 | - 'VALUE' => $Option * 10, |
|
| 101 | - )); |
|
| 99 | + $template->assign_block_vars('option', array( |
|
| 100 | + 'VALUE' => $Option * 10, |
|
| 101 | + )); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $capsObj = new ResourceCalculations(); |
@@ -165,12 +165,12 @@ discard block |
||
| 165 | 165 | int_calc_storage_bar(RES_DEUTERIUM, $capsObj); |
| 166 | 166 | |
| 167 | 167 | $template->assign_vars(array( |
| 168 | - 'PLANET_NAME' => $planetrow['name'], |
|
| 169 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 168 | + 'PLANET_NAME' => $planetrow['name'], |
|
| 169 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
| 170 | 170 | |
| 171 | - 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
| 171 | + 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
| 172 | 172 | |
| 173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
| 173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
| 174 | 174 | )); |
| 175 | 175 | |
| 176 | 176 | display($template, $lang['res_planet_production']); |