[5606] | 1 | <?php |
---|
| 2 | |
---|
[7982] | 3 | include_once (PHPWG_ROOT_PATH.'/include/constants.php'); |
---|
| 4 | include_once (REGFLUXBB_PATH.'include/constants.php'); |
---|
[5606] | 5 | |
---|
[7982] | 6 | |
---|
| 7 | function Register_FluxBB_admin_menu($menu) |
---|
| 8 | { |
---|
| 9 | array_push($menu, array( |
---|
| 10 | 'NAME' => 'Register FluxBB', |
---|
[9885] | 11 | 'URL' => get_root_url().'admin.php?page=plugin-'.basename(REGFLUXBB_PATH) |
---|
| 12 | ) |
---|
| 13 | ); |
---|
[7982] | 14 | return $menu; |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | function Register_FluxBB_Adduser($register_user) |
---|
| 19 | { |
---|
| 20 | global $errors, $conf; |
---|
| 21 | |
---|
| 22 | // Exclusion of Adult_Content users |
---|
| 23 | if ($register_user['username'] != "16" and $register_user['username'] != "18") |
---|
| 24 | { |
---|
| 25 | // Warning : FluxBB uses Sha1 hash instead of md5 for Piwigo! |
---|
| 26 | FluxBB_Adduser($register_user['id'], $register_user['username'], sha1($_POST['password']), $register_user['email']); |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | function Register_FluxBB_Deluser($user_id) |
---|
| 32 | { |
---|
| 33 | FluxBB_Deluser(FluxBB_Searchuser($user_id), true); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | function Register_FluxBB_InitPage() |
---|
| 38 | { |
---|
| 39 | global $conf, $user; |
---|
| 40 | |
---|
| 41 | if (isset($_POST['validate']) and !is_admin()) |
---|
| 42 | { |
---|
| 43 | if (!empty($_POST['use_new_pwd'])) |
---|
| 44 | { |
---|
| 45 | $query = ' |
---|
| 46 | SELECT '.$conf['user_fields']['username'].' AS username |
---|
| 47 | FROM '.USERS_TABLE.' |
---|
| 48 | WHERE '.$conf['user_fields']['id'].' = \''.$user['id'].'\' |
---|
| 49 | ;'; |
---|
| 50 | |
---|
| 51 | list($username) = pwg_db_fetch_row(pwg_query($query)); |
---|
| 52 | |
---|
| 53 | FluxBB_Updateuser($user['id'], stripslashes($username), sha1($_POST['use_new_pwd']), $_POST['mail_address']); |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | function UAM_Bridge() |
---|
| 60 | { |
---|
| 61 | global $conf, $user; |
---|
| 62 | |
---|
| 63 | $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); |
---|
| 64 | |
---|
| 65 | // Check if UAM is installed and if bridge is set - Exception for admins and webmasters |
---|
| 66 | $query =' |
---|
| 67 | SELECT user_id, status |
---|
| 68 | FROM '.USER_INFOS_TABLE.' |
---|
| 69 | WHERE user_id = '.$user['id'].' |
---|
| 70 | ;'; |
---|
| 71 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 72 | |
---|
| 73 | if ($data['status'] <> "admin" and $data['status'] <> "webmaster") |
---|
| 74 | { |
---|
| 75 | if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'true') |
---|
| 76 | { |
---|
| 77 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
| 78 | |
---|
| 79 | // Getting unvalidated users group else Piwigo's default group |
---|
| 80 | if (isset($conf_UAM[2]) and $conf_UAM[2] != '-1') |
---|
| 81 | { |
---|
| 82 | $Waitingroup = $conf_UAM[2]; |
---|
| 83 | } |
---|
| 84 | else |
---|
| 85 | { |
---|
| 86 | $query = ' |
---|
| 87 | SELECT id |
---|
| 88 | FROM '.GROUPS_TABLE.' |
---|
| 89 | WHERE is_default = "true" |
---|
| 90 | LIMIT 1 |
---|
| 91 | ;'; |
---|
| 92 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 93 | $Waitingroup = $data['id']; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | // check if logged in user is in a Piwigo's validated or unvalidated users group |
---|
| 97 | $query = ' |
---|
| 98 | SELECT * |
---|
| 99 | FROM '.USER_GROUP_TABLE.' |
---|
| 100 | WHERE user_id = '.$user['id'].' |
---|
| 101 | AND group_id = '.$Waitingroup.' |
---|
| 102 | ;'; |
---|
| 103 | $count = pwg_db_num_rows(pwg_query($query)); |
---|
| 104 | |
---|
| 105 | // Check if logged in user is in a FluxBB's unvalidated group |
---|
| 106 | $query = " |
---|
| 107 | SELECT group_id |
---|
| 108 | FROM ".FluxBB_USERS_TABLE." |
---|
| 109 | WHERE id = ".FluxBB_Searchuser($user['id'])." |
---|
| 110 | ;"; |
---|
| 111 | |
---|
| 112 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 113 | |
---|
| 114 | // Logged in user switch to the default FluxBB's group if he'is validated |
---|
| 115 | if ($count == 0 and $data['group_id'] = $conf_Register_FluxBB[7]) |
---|
| 116 | { |
---|
| 117 | $query = " |
---|
| 118 | SELECT conf_value |
---|
| 119 | FROM ".FluxBB_CONFIG_TABLE." |
---|
| 120 | WHERE conf_name = 'o_default_user_group' |
---|
| 121 | ;"; |
---|
| 122 | |
---|
[14918] | 123 | $o_user_group = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[7982] | 124 | |
---|
| 125 | $query = " |
---|
| 126 | UPDATE ".FluxBB_USERS_TABLE." |
---|
[14918] | 127 | SET group_id = ".$o_user_group['conf_value']." |
---|
[7982] | 128 | WHERE id = ".FluxBB_Searchuser($user['id'])." |
---|
| 129 | ;"; |
---|
| 130 | pwg_query($query); |
---|
| 131 | } |
---|
| 132 | } |
---|
| 133 | } |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | |
---|
[8043] | 137 | function Register_FluxBB_RegistrationCheck($errors, $user) |
---|
[7982] | 138 | { |
---|
[8043] | 139 | global $conf; |
---|
[7982] | 140 | |
---|
| 141 | //Because FluxBB is case insensitive on login name, we have to check if a similar login already exists in FluxBB's user table |
---|
| 142 | // If "test" user already exists, "TEST" or "Test" (and so on...) can't register |
---|
| 143 | $query = " |
---|
| 144 | SELECT username |
---|
| 145 | FROM ".FluxBB_USERS_TABLE." |
---|
[8043] | 146 | WHERE LOWER(".stripslashes('username').") = '".strtolower($user['username'])."' |
---|
[7982] | 147 | ;"; |
---|
| 148 | |
---|
[8043] | 149 | $count = pwg_db_num_rows(pwg_query($query)); |
---|
[7982] | 150 | |
---|
[8043] | 151 | if ($count > 0) |
---|
| 152 | { |
---|
| 153 | array_push($errors, l10n('this login is already used')); |
---|
| 154 | } |
---|
| 155 | return $errors; |
---|
[7982] | 156 | } |
---|
| 157 | |
---|
| 158 | |
---|
[5606] | 159 | function FluxBB_Linkuser($pwg_id, $bb_id) |
---|
| 160 | { |
---|
| 161 | $query = " |
---|
| 162 | SELECT pwg.id as pwg_id, bb.id as bb_id |
---|
| 163 | FROM ".USERS_TABLE." pwg, ".FluxBB_USERS_TABLE." bb |
---|
| 164 | WHERE pwg.id = ".$pwg_id." |
---|
| 165 | AND bb.id = ".$bb_id." |
---|
| 166 | AND pwg.username = bb.username |
---|
| 167 | ;"; |
---|
| 168 | |
---|
[5635] | 169 | $data = pwg_db_fetch_row(pwg_query($query)); |
---|
[5606] | 170 | |
---|
| 171 | if (!empty($data)) |
---|
| 172 | { |
---|
| 173 | $subquery = " |
---|
| 174 | DELETE FROM ".Register_FluxBB_ID_TABLE." |
---|
| 175 | WHERE id_user_pwg = '".$pwg_id."' |
---|
| 176 | OR id_user_FluxBB = '".$bb_id."' |
---|
| 177 | ;"; |
---|
| 178 | |
---|
| 179 | $subresult = pwg_query($subquery); |
---|
| 180 | |
---|
| 181 | $subquery = " |
---|
| 182 | INSERT INTO ".Register_FluxBB_ID_TABLE." |
---|
| 183 | (id_user_pwg, id_user_FluxBB) |
---|
| 184 | VALUES (".$pwg_id.", ".$bb_id.") |
---|
| 185 | ;"; |
---|
| 186 | |
---|
| 187 | $subresult = pwg_query($subquery); |
---|
| 188 | } |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | |
---|
| 193 | function FluxBB_Unlinkuser($bb_id) |
---|
| 194 | { |
---|
| 195 | $query = " |
---|
| 196 | DELETE FROM ".Register_FluxBB_ID_TABLE." |
---|
| 197 | WHERE id_user_FluxBB = ".$bb_id." |
---|
| 198 | ;"; |
---|
| 199 | |
---|
| 200 | $result = pwg_query($query); |
---|
| 201 | } |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | function FluxBB_Adduser($pwg_id, $login, $password, $adresse_mail) |
---|
| 206 | { |
---|
[7982] | 207 | global $errors, $conf; |
---|
[5606] | 208 | |
---|
| 209 | $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); |
---|
| 210 | |
---|
| 211 | $registred = time(); |
---|
| 212 | $registred_ip = $_SERVER['REMOTE_ADDR']; |
---|
[6815] | 213 | |
---|
| 214 | // Check if UAM is installed and if bridge is set - Exception for admins and webmasters |
---|
| 215 | if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_FluxBB[6]) and $conf_Register_FluxBB[6] == 'true') |
---|
| 216 | { |
---|
| 217 | $o_default_user_group = $conf_Register_FluxBB[7]; |
---|
| 218 | } |
---|
| 219 | else |
---|
| 220 | { |
---|
| 221 | $query = " |
---|
[5606] | 222 | SELECT conf_value |
---|
| 223 | FROM ".FluxBB_CONFIG_TABLE." |
---|
| 224 | WHERE conf_name = 'o_default_user_group' |
---|
| 225 | ;"; |
---|
| 226 | |
---|
[6815] | 227 | $o_default_user_group = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 228 | } |
---|
[6791] | 229 | |
---|
| 230 | // Check for FluxBB version 1.4.x and get the correct value |
---|
| 231 | $query1 = " |
---|
[5606] | 232 | SELECT conf_value |
---|
| 233 | FROM ".FluxBB_CONFIG_TABLE." |
---|
[6791] | 234 | WHERE conf_name = 'o_default_timezone' |
---|
| 235 | ;"; |
---|
| 236 | |
---|
| 237 | $count1 = pwg_db_num_rows(pwg_query($query1)); |
---|
| 238 | |
---|
| 239 | // Check for FluxBB version 1.2.x and get the correct value |
---|
| 240 | $query2 = " |
---|
| 241 | SELECT conf_value |
---|
| 242 | FROM ".FluxBB_CONFIG_TABLE." |
---|
[5606] | 243 | WHERE conf_name = 'o_server_timezone' |
---|
| 244 | ;"; |
---|
| 245 | |
---|
[6791] | 246 | $count2 = pwg_db_num_rows(pwg_query($query2)); |
---|
[5606] | 247 | |
---|
[6791] | 248 | if ($count1 == 1 and $count2 == 0) |
---|
| 249 | { |
---|
| 250 | $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query1)); |
---|
| 251 | } |
---|
| 252 | else if ($count1 == 0 and $count2 == 1) |
---|
| 253 | { |
---|
| 254 | $o_default_timezone = pwg_db_fetch_assoc(pwg_query($query2)); |
---|
| 255 | } |
---|
| 256 | |
---|
| 257 | |
---|
[5606] | 258 | $query = " |
---|
| 259 | SELECT conf_value |
---|
| 260 | FROM ".FluxBB_CONFIG_TABLE." |
---|
| 261 | WHERE conf_name = 'o_default_lang' |
---|
| 262 | ;"; |
---|
| 263 | |
---|
[5635] | 264 | $o_default_lang = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[5606] | 265 | |
---|
| 266 | $query = " |
---|
| 267 | SELECT conf_value |
---|
| 268 | FROM ".FluxBB_CONFIG_TABLE." |
---|
| 269 | WHERE conf_name = 'o_default_style' |
---|
| 270 | ;"; |
---|
| 271 | |
---|
[5635] | 272 | $o_default_style = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[7982] | 273 | |
---|
| 274 | $query = " |
---|
| 275 | INSERT INTO ".FluxBB_USERS_TABLE." ( |
---|
[5606] | 276 | username, |
---|
| 277 | ". ( isset($o_default_user_group['conf_value']) ? 'group_id' : '' ) .", |
---|
| 278 | password, |
---|
| 279 | email, |
---|
[6791] | 280 | ". ( isset($o_default_timezone['conf_value']) ? 'timezone' : '' ) .", |
---|
[5606] | 281 | ". ( isset($o_default_lang['conf_value']) ? 'language' : '' ) .", |
---|
| 282 | ". ( isset($o_default_style['conf_value']) ? 'style' : '' ) .", |
---|
| 283 | registered, |
---|
| 284 | registration_ip, |
---|
| 285 | last_visit |
---|
| 286 | ) |
---|
| 287 | VALUES( |
---|
[5635] | 288 | '".pwg_db_real_escape_string($login)."', |
---|
[5606] | 289 | ". ( isset($o_default_user_group['conf_value']) ? "'".$o_default_user_group['conf_value']."'" : '' ) .", |
---|
| 290 | '".$password."', |
---|
| 291 | '".$adresse_mail."', |
---|
[6791] | 292 | ". ( isset($o_default_timezone['conf_value']) ? "'".$o_default_timezone['conf_value']."'" : '' ) .", |
---|
[5606] | 293 | ". ( isset($o_default_lang['conf_value']) ? "'".$o_default_lang['conf_value']."'" : '' ) .", |
---|
| 294 | ". ( isset($o_default_style['conf_value']) ? "'".$o_default_style['conf_value']."'" : '' ) .", |
---|
| 295 | '".$registred."', |
---|
| 296 | '".$registred_ip."', |
---|
| 297 | '".$registred."' |
---|
| 298 | ) |
---|
| 299 | ;"; |
---|
| 300 | |
---|
| 301 | $result = pwg_query($query); |
---|
| 302 | |
---|
[5635] | 303 | $bb_id = pwg_db_insert_id(); |
---|
[5606] | 304 | |
---|
| 305 | FluxBB_Linkuser($pwg_id, $bb_id); |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | |
---|
| 309 | |
---|
| 310 | function FluxBB_Searchuser($id_user_pwg) |
---|
| 311 | { |
---|
| 312 | $query = " |
---|
[14918] | 313 | SELECT id_user_FluxBB, id_user_pwg |
---|
| 314 | FROM ".Register_FluxBB_ID_TABLE." |
---|
[5606] | 315 | WHERE id_user_pwg = ".$id_user_pwg." |
---|
| 316 | LIMIT 1 |
---|
| 317 | ;"; |
---|
| 318 | |
---|
[5635] | 319 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[5606] | 320 | |
---|
| 321 | if (!empty($data)) |
---|
| 322 | return $data['id_user_FluxBB']; |
---|
| 323 | else |
---|
| 324 | return '0'; |
---|
| 325 | } |
---|
| 326 | |
---|
| 327 | |
---|
| 328 | |
---|
| 329 | function FluxBB_Deluser($id_user_FluxBB, $SuppTopicsPosts) |
---|
| 330 | { |
---|
| 331 | global $conf; |
---|
| 332 | |
---|
| 333 | $conf_Register_FluxBB = isset($conf['Register_FluxBB']) ? explode(";" , $conf['Register_FluxBB']) : array(); |
---|
| 334 | |
---|
| 335 | $query0 = " |
---|
| 336 | SELECT username, id FROM ".FluxBB_USERS_TABLE." |
---|
| 337 | WHERE id = ".$id_user_FluxBB." |
---|
| 338 | LIMIT 1 |
---|
| 339 | ;"; |
---|
| 340 | |
---|
[5635] | 341 | $data0 = pwg_db_fetch_assoc(pwg_query($query0)); |
---|
[5606] | 342 | |
---|
[7982] | 343 | // If True, delete related topics and posts |
---|
[5606] | 344 | if ($SuppTopicsPosts and $conf_Register_FluxBB[3]) |
---|
| 345 | { |
---|
[7982] | 346 | // Delete posts and topics of this user |
---|
[5606] | 347 | $subquery = " |
---|
| 348 | DELETE FROM ".FluxBB_POSTS_TABLE." |
---|
| 349 | WHERE poster_id = ".$id_user_FluxBB." |
---|
| 350 | ;"; |
---|
| 351 | |
---|
| 352 | $subresult = pwg_query($subquery); |
---|
| 353 | |
---|
[7982] | 354 | // Delete topics of this user |
---|
[5606] | 355 | $subquery = " |
---|
| 356 | DELETE FROM ".FluxBB_TOPICS_TABLE." |
---|
[5635] | 357 | WHERE BINARY poster = BINARY '".pwg_db_real_escape_string($data0['username'])."' |
---|
[5606] | 358 | ;"; |
---|
| 359 | |
---|
| 360 | $subresult = pwg_query($subquery); |
---|
| 361 | } |
---|
| 362 | |
---|
[7982] | 363 | // Delete user's subscriptions |
---|
[5606] | 364 | $subquery = " |
---|
| 365 | DELETE FROM ".FluxBB_SUBSCRIPTIONS_TABLE." |
---|
| 366 | WHERE user_id = ".$id_user_FluxBB." |
---|
| 367 | ;"; |
---|
| 368 | |
---|
| 369 | $subresult = pwg_query($subquery); |
---|
| 370 | |
---|
[7982] | 371 | // Delete user's account |
---|
[5606] | 372 | $subquery = " |
---|
| 373 | DELETE FROM ".FluxBB_USERS_TABLE." |
---|
| 374 | WHERE id = ".$id_user_FluxBB." |
---|
| 375 | ;"; |
---|
| 376 | |
---|
| 377 | $subresult = pwg_query($subquery); |
---|
| 378 | |
---|
| 379 | FluxBB_Unlinkuser($id_user_FluxBB); |
---|
| 380 | } |
---|
| 381 | |
---|
| 382 | |
---|
| 383 | |
---|
| 384 | function FluxBB_Updateuser($pwg_id, $username, $password, $adresse_mail) |
---|
| 385 | { |
---|
| 386 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
| 387 | |
---|
| 388 | $query = " |
---|
| 389 | SELECT id_user_FluxBB as FluxBB_id |
---|
| 390 | FROM ".Register_FluxBB_ID_TABLE." |
---|
| 391 | WHERE id_user_pwg = ".$pwg_id." |
---|
| 392 | ;"; |
---|
| 393 | |
---|
[5635] | 394 | $row = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[5606] | 395 | |
---|
| 396 | if (!empty($row)) |
---|
| 397 | { |
---|
| 398 | $query = " |
---|
| 399 | UPDATE ".FluxBB_USERS_TABLE." |
---|
[5635] | 400 | SET username = '".pwg_db_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."' |
---|
[5606] | 401 | WHERE id = ".$row['FluxBB_id']." |
---|
| 402 | ;"; |
---|
| 403 | |
---|
| 404 | $result = pwg_query($query); |
---|
| 405 | |
---|
| 406 | FluxBB_Linkuser($pwg_id, $row['FluxBB_id']); |
---|
| 407 | } |
---|
| 408 | else |
---|
| 409 | { |
---|
| 410 | $query = " |
---|
| 411 | SELECT id as FluxBB_id |
---|
| 412 | FROM ".FluxBB_USERS_TABLE." |
---|
[5635] | 413 | WHERE BINARY username = BINARY '".pwg_db_real_escape_string($username)."' |
---|
[5606] | 414 | ;"; |
---|
| 415 | |
---|
[5635] | 416 | $row = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[5606] | 417 | |
---|
| 418 | if (!empty($row)) |
---|
| 419 | { |
---|
| 420 | $query = " |
---|
| 421 | UPDATE ".FluxBB_USERS_TABLE." |
---|
[5635] | 422 | SET username = '".pwg_db_real_escape_string($username)."', email = '".$adresse_mail."', password = '".$password."' |
---|
[5606] | 423 | WHERE id = ".$row['FluxBB_id']." |
---|
| 424 | ;"; |
---|
| 425 | |
---|
| 426 | $result = pwg_query($query); |
---|
| 427 | |
---|
| 428 | FluxBB_Linkuser($pwg_id, $row['FluxBB_id']); |
---|
| 429 | } |
---|
| 430 | } |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | |
---|
| 434 | function RegFluxBB_Infos($dir) |
---|
| 435 | { |
---|
| 436 | $path = $dir; |
---|
| 437 | |
---|
| 438 | $plg_data = implode( '', file($path.'main.inc.php') ); |
---|
| 439 | if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) ) |
---|
| 440 | { |
---|
| 441 | $plugin['name'] = trim( $val[1] ); |
---|
| 442 | } |
---|
| 443 | if (preg_match("|Version: (.*)|", $plg_data, $val)) |
---|
| 444 | { |
---|
| 445 | $plugin['version'] = trim($val[1]); |
---|
| 446 | } |
---|
| 447 | if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) ) |
---|
| 448 | { |
---|
| 449 | $plugin['uri'] = trim($val[1]); |
---|
| 450 | } |
---|
| 451 | if ($desc = load_language('description.txt', $path.'/', array('return' => true))) |
---|
| 452 | { |
---|
| 453 | $plugin['description'] = trim($desc); |
---|
| 454 | } |
---|
| 455 | elseif ( preg_match("|Description: (.*)|", $plg_data, $val) ) |
---|
| 456 | { |
---|
| 457 | $plugin['description'] = trim($val[1]); |
---|
| 458 | } |
---|
| 459 | if ( preg_match("|Author: (.*)|", $plg_data, $val) ) |
---|
| 460 | { |
---|
| 461 | $plugin['author'] = trim($val[1]); |
---|
| 462 | } |
---|
| 463 | if ( preg_match("|Author URI: (.*)|", $plg_data, $val) ) |
---|
| 464 | { |
---|
| 465 | $plugin['author uri'] = trim($val[1]); |
---|
| 466 | } |
---|
| 467 | if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid=')) |
---|
| 468 | { |
---|
| 469 | list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']); |
---|
| 470 | if (is_numeric($extension)) $plugin['extension'] = $extension; |
---|
| 471 | } |
---|
| 472 | // IMPORTANT SECURITY ! |
---|
| 473 | $plugin = array_map('htmlspecialchars', $plugin); |
---|
| 474 | |
---|
| 475 | return $plugin ; |
---|
| 476 | } |
---|
| 477 | |
---|
| 478 | function regfluxbb_obsolete_files() |
---|
| 479 | { |
---|
| 480 | if (file_exists(REGFLUXBB_PATH.'obsolete.list') |
---|
| 481 | and $old_files = file(REGFLUXBB_PATH.'obsolete.list', FILE_IGNORE_NEW_LINES) |
---|
| 482 | and !empty($old_files)) |
---|
| 483 | { |
---|
| 484 | array_push($old_files, 'obsolete.list'); |
---|
| 485 | foreach($old_files as $old_file) |
---|
| 486 | { |
---|
| 487 | $path = REGFLUXBB_PATH.$old_file; |
---|
| 488 | if (is_file($path)) |
---|
| 489 | { |
---|
| 490 | @unlink($path); |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | } |
---|
| 494 | } |
---|
| 495 | ?> |
---|