Changeset 5439 in spip-zone
- Timestamp:
- Sep 17, 2006, 9:30:05 PM (15 years ago)
- Location:
- _plugins_/habillages/unstable
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/habillages/unstable/exec/config_habillages.php
r5394 r5439 12 12 include_spip ("base/abstract_sql"); 13 13 include_spip("inc/espace_prive"); 14 14 include_spip("inc/plugin"); 15 16 17 if ($connect_statut != '0minirezo' OR !$connect_toutes_rubriques) { 15 18 debut_page('« '._T('habillageprive:titre_page').' »', 'configurations', 'habillage_prive','',_DIR_PLUGIN_HABILLAGES.'/img_pack/habillage_prive.css'); 16 17 if ($connect_statut != '0minirezo' OR !$connect_toutes_rubriques) {18 19 echo _T('avis_non_acces_page'); 19 20 exit; 20 21 } 21 22 23 // mettre a jour le theme prive pour en profiter tout de suite 24 if (($c=_request('theme'))!==NULL){ 25 include_spip('inc/meta'); 26 ecrire_meta('habillage_prive',$c); 27 ecrire_metas(); 28 } 29 30 debut_page('« '._T('habillageprive:titre_page').' »', 'configurations', 'habillage_prive','',_DIR_PLUGIN_HABILLAGES.'/img_pack/habillage_prive.css'); 22 31 if ($connect_statut == '0minirezo' AND $connect_toutes_rubriques ) { 23 32 … … 56 65 echo " de votre navigation dans l'espace privé et que c'est un peu cahotique).</small><br />"; 57 66 echo '<form action="'.generer_url_ecrire('config_habillages').'" method="post">'; 58 59 60 # define("_OPTIONS_FILE", "mes_options.php"); 61 $options_file = "mes_options.php"; 62 $img_directory = "img_pack"; 63 $plugin_directory = _DIR_PLUGIN_HABILLAGES; 64 $theme = $_REQUEST['theme']; 65 $theme_path = "$plugin_directory/prive/themes/$theme"; 66 $theme_xml = "$theme_path/theme.xml"; 67 $theme_duplicated = "img_pack/theme.xml"; 68 69 # Si le fichier mes_options.php est disponible. 70 # Tester, dans le cas ou il existe, si il est accessible en ecriture. 71 # Si il est accessible en ecriture : on lance la gestion des habillages de l'espace prive. 72 73 # Sinon on met un message d'avertissement. 74 # private_warning(); 75 76 # Si le fichier mes_options.php n'est pas disponible. 77 # Tester, dans le cas ou il n'existe pas, si on peut le creer. 78 # Si on peut le creer : on le cree et on lance la gestion des habillages de l'espace prive. 79 80 # Sinon on met un message d'avertissement. 81 # private_warning(); 82 83 # Sinon mettre un message d'avertissement. 84 # private_warning(); 85 86 87 # if (!is_writable($options_file)) { 88 # echo "Votre fichier $options_file n'est pas accessible en ecriture."; 89 # } 90 # else { 91 #Inserer le code. 92 #} 93 94 # N'agir d'abord que si l'utilisateur a choisi un theme qui n'est pas initial et si le 95 # fichier mes_options.php. 96 if ($theme != "" AND $theme != "initial" AND file_exists($options_file)) { 97 // Si le fichier inc/mes_options.php existe deja 98 ###echo "option existe"; 99 # Ouvrir et lire le fichier... 100 $open_options_file = fopen($options_file, 'r'); 101 $options_file_size = filesize ($options_file); 102 $read_options_file = fread ($open_options_file, $options_file_size); 103 # ...definir les chaines recherchees... 104 $search_comment_backup = eregi("//backup_define\(\'_DIR_IMG_PACK\', \(\'(.*)\'\)\)\;", $read_options_file, $comment_backup); 105 $search_define = eregi("(.*)define\(\'_DIR_IMG_PACK\'(.*)", $read_options_file, $define_content); 106 # ... et reagir en fonction de ce qui est trouve dans mes_options.php. 107 108 if ($search_comment_backup) { 109 ###echo "commentaire backup trouve dans mes options"; 110 fclose($open_options_file); 111 112 # Debut routine. 113 if (file_exists($theme_duplicated) AND file_exists($theme_xml)) { 114 ###echo "theme.xml existe dans img_pack"; 115 $open_theme_xml = fopen($theme_xml, 'r'); 116 $theme_xml_size = filesize ($theme_xml); 117 $read_theme_xml = fread ($open_theme_xml, $theme_xml_size); 118 $search_theme_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_xml, $theme_name); 119 $search_theme_version = eregi("<version>(.*)</version>", $read_theme_xml, $theme_version); 120 121 $open_theme_duplicated = fopen($theme_duplicated, 'r'); 122 $theme_duplicated_size = filesize ($theme_duplicated); 123 $read_theme_duplicated = fread ($open_theme_duplicated, $theme_duplicated_size); 124 $search_duplicated_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_duplicated, $duplicated_name); 125 $search_duplicated_version = eregi("<version>(.*)</version>", $read_theme_duplicated, $duplicated_version); 126 127 if ($theme_name[1] != $duplicated_name[1]) { 128 ###echo "le theme choisi n'est pas le même que dans img_pack UN"; 129 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 130 mkdir ("img_pack", 0700); 131 mkdir ("img_pack/icones_barre", 0700); 132 mkdir ("img_pack/icones", 0700); 133 } 134 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 135 rename ("img_pack", "img_pack_backup"); 136 mkdir ("img_pack", 0700); 137 mkdir ("img_pack/icones_barre", 0700); 138 mkdir ("img_pack/icones", 0700); 139 } 140 141 $img_pack_path = opendir ($theme_path.'/img_pack/'); 142 while ($fichier = readdir ($img_pack_path)) { 143 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 144 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 145 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 146 } 147 } 148 149 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 150 while ($fichier_two = readdir ($img_pack_sub_one)) { 151 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 152 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 153 } 154 } 155 156 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 157 while ($fichier_three = readdir ($img_pack_sub_two)) { 158 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 159 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 160 } 161 } 162 163 } 164 else if ($theme_name[1] == $duplicated_name[1]) { 165 ###echo "le theme choisi est le même que dans img_pack TROIS"; 166 if (($duplicated_version[1] != $theme_version[1]) AND ($duplicated_version[1] < $theme_version[1])) { 167 168 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 169 mkdir ("img_pack", 0700); 170 mkdir ("img_pack/icones_barre", 0700); 171 mkdir ("img_pack/icones", 0700); 172 } 173 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 174 rename ("img_pack", "img_pack_backup"); 175 mkdir ("img_pack", 0700); 176 mkdir ("img_pack/icones_barre", 0700); 177 mkdir ("img_pack/icones", 0700); 178 } 179 180 $img_pack_path = opendir ($theme_path.'/img_pack/'); 181 while ($fichier = readdir ($img_pack_path)) { 182 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 183 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 184 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 185 } 186 } 187 188 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 189 while ($fichier_two = readdir ($img_pack_sub_one)) { 190 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 191 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 192 } 193 } 194 195 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 196 while ($fichier_three = readdir ($img_pack_sub_two)) { 197 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 198 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 199 } 200 } 201 } 202 } 203 } 204 205 else if (file_exists($theme_duplicated) AND !file_exists($theme_xml)) { 206 ###echo "fichier theme.xml n'exite pas dans le theme"; 207 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 208 ###echo "backup existe, pas img_pack"; 209 mkdir ("img_pack", 0700); 210 mkdir ("img_pack/icones_barre", 0700); 211 mkdir ("img_pack/icones", 0700); 212 } 213 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 214 ###echo "backup n'existe pas, img_pack si"; 215 rename ("img_pack", "img_pack_backup"); 216 mkdir ("img_pack", 0700); 217 mkdir ("img_pack/icones_barre", 0700); 218 mkdir ("img_pack/icones", 0700); 219 } 220 else if (is_dir('img_pack_backup') AND is_dir('img_pack')){ 221 ###echo "backup existe, img_pack aussi"; 222 } 223 224 225 $img_pack_path = opendir ($theme_path.'/img_pack/'); 226 while ($fichier = readdir ($img_pack_path)) { 227 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 228 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 229 } 230 } 231 232 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 233 while ($fichier_two = readdir ($img_pack_sub_one)) { 234 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 235 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 236 } 237 } 238 239 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 240 while ($fichier_three = readdir ($img_pack_sub_two)) { 241 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 242 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 243 } 244 } 245 } 246 247 else if (!file_exists($theme_duplicated)){ 248 ###echo "le theme.xml existe pas dans img_pack"; 249 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 250 mkdir ("img_pack", 0700); 251 mkdir ("img_pack/icones_barre", 0700); 252 mkdir ("img_pack/icones", 0700); 253 } 254 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 255 rename ("img_pack", "img_pack_backup"); 256 mkdir ("img_pack", 0700); 257 mkdir ("img_pack/icones_barre", 0700); 258 mkdir ("img_pack/icones", 0700); 259 } 260 261 $img_pack_path = opendir ($theme_path.'/img_pack/'); 262 while ($fichier = readdir ($img_pack_path)) { 263 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 264 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 265 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 266 } 267 } 268 269 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 270 while ($fichier_two = readdir ($img_pack_sub_one)) { 271 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 272 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 273 } 274 } 275 276 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 277 while ($fichier_three = readdir ($img_pack_sub_two)) { 278 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 279 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 280 } 281 } 282 } 283 # Fin routine 284 } 285 286 else if (!$search_comment_backup AND $search_define) { 287 ###echo "commentaire backup options pas trouvé mais define"; 288 fclose($open_options_file); 289 # Definir un fichier de sauvegarde. 290 $backup_file = "$options_file.backup"; 291 # Renommer le fichier mes_options.php afin de preserver sa virginite. 292 rename($options_file, $backup_file); 293 $open_backup_file = fopen($backup_file, 'r'); 294 $backup_file_size = filesize ($backup_file); 295 $read_backup_file = fread ($open_backup_file, $backup_file_size); 296 $new_content = "//backup_define('_DIR_IMG_PACK'"; 297 $insert_new_content = ereg_replace("define\(\'_DIR_IMG_PACK\'", $new_content, $read_backup_file); 298 $open_options_file = fopen($options_file, 'w+'); 299 $write = fwrite($open_options_file, $insert_new_content); 300 fclose($open_backup_file); 301 fclose($open_options_file); 302 303 # Debut routine. 304 if (file_exists($theme_duplicated)) { 305 ###echo "theme.xml existe dans img_pack"; 306 $open_theme_xml = fopen($theme_xml, 'r'); 307 $theme_xml_size = filesize ($theme_xml); 308 $read_theme_xml = fread ($open_theme_xml, $theme_xml_size); 309 $search_theme_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_xml, $theme_name); 310 $search_theme_version = eregi("<version>(.*)</version>", $read_theme_xml, $theme_version); 311 312 $open_theme_duplicated = fopen($theme_duplicated, 'r'); 313 $theme_duplicated_size = filesize ($theme_duplicated); 314 $read_theme_duplicated = fread ($open_theme_duplicated, $theme_duplicated_size); 315 $search_duplicated_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_duplicated, $duplicated_name); 316 $search_duplicated_version = eregi("<version>(.*)</version>", $read_theme_duplicated, $duplicated_version); 317 318 if ($theme_name[1] != $duplicated_name[1]) { 319 ###echo "le theme choisi n'est pas le même que dans img_pack"; 320 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 321 mkdir ("img_pack", 0700); 322 mkdir ("img_pack/icones_barre", 0700); 323 mkdir ("img_pack/icones", 0700); 324 } 325 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 326 rename ("img_pack", "img_pack_backup"); 327 mkdir ("img_pack", 0700); 328 mkdir ("img_pack/icones_barre", 0700); 329 mkdir ("img_pack/icones", 0700); 330 } 331 332 $img_pack_path = opendir ($theme_path.'/img_pack/'); 333 while ($fichier = readdir ($img_pack_path)) { 334 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 335 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 336 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 337 } 338 } 339 340 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 341 while ($fichier_two = readdir ($img_pack_sub_one)) { 342 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 343 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 344 } 345 } 346 347 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 348 while ($fichier_three = readdir ($img_pack_sub_two)) { 349 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 350 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 351 } 352 } 353 354 } 355 else if ($theme_name[1] == $duplicated_name[1]) { 356 ###echo "le theme choisi est le même que dans img_pack UN"; 357 if (($duplicated_version[1] != $theme_version[1]) AND ($duplicated_version[1] < $theme_version[1])) { 358 359 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 360 mkdir ("img_pack", 0700); 361 mkdir ("img_pack/icones_barre", 0700); 362 mkdir ("img_pack/icones", 0700); 363 } 364 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 365 rename ("img_pack", "img_pack_backup"); 366 mkdir ("img_pack", 0700); 367 mkdir ("img_pack/icones_barre", 0700); 368 mkdir ("img_pack/icones", 0700); 369 } 370 371 $img_pack_path = opendir ($theme_path.'/img_pack/'); 372 while ($fichier = readdir ($img_pack_path)) { 373 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 374 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 375 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 376 } 377 } 378 379 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 380 while ($fichier_two = readdir ($img_pack_sub_one)) { 381 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 382 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 383 } 384 } 385 386 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 387 while ($fichier_three = readdir ($img_pack_sub_two)) { 388 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 389 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 390 } 391 } 392 } 393 } 394 395 } 396 397 else if (!file_exists($theme_duplicated)){ 398 ###echo "le theme.xml existe pas dans img_pack"; 399 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 400 mkdir ("img_pack", 0700); 401 mkdir ("img_pack/icones_barre", 0700); 402 mkdir ("img_pack/icones", 0700); 403 } 404 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 405 rename ("img_pack", "img_pack_backup"); 406 mkdir ("img_pack", 0700); 407 mkdir ("img_pack/icones_barre", 0700); 408 mkdir ("img_pack/icones", 0700); 409 } 410 411 $img_pack_path = opendir ($theme_path.'/img_pack/'); 412 while ($fichier = readdir ($img_pack_path)) { 413 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 414 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 415 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 416 } 417 } 418 419 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 420 while ($fichier_two = readdir ($img_pack_sub_one)) { 421 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 422 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 423 } 424 } 425 426 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 427 while ($fichier_three = readdir ($img_pack_sub_two)) { 428 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 429 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 430 } 431 } 432 } 433 # Fin routine 434 } 435 436 } 437 438 else if ($theme != "" AND $theme != "initial" AND !file_exists($options_file)) { 439 440 # Routines a mettre en fonction. 441 if (file_exists($theme_duplicated)) { 442 ###echo "theme.xml existe dans img_pack"; 443 $open_theme_xml = fopen($theme_xml, 'r'); 444 $theme_xml_size = filesize ($theme_xml); 445 $read_theme_xml = fread ($open_theme_xml, $theme_xml_size); 446 $search_theme_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_xml, $theme_name); 447 $search_theme_version = eregi("<version>(.*)</version>", $read_theme_xml, $theme_version); 448 449 $open_theme_duplicated = fopen($theme_duplicated, 'r'); 450 $theme_duplicated_size = filesize ($theme_duplicated); 451 $read_theme_duplicated = fread ($open_theme_duplicated, $theme_duplicated_size); 452 $search_duplicated_name = eregi("\<prefixe>(.*)</prefixe>", $read_theme_duplicated, $duplicated_name); 453 $search_duplicated_version = eregi("<version>(.*)</version>", $read_theme_duplicated, $duplicated_version); 454 455 if ($theme_name[1] != $duplicated_name[1]) { 456 ###echo "le theme choisi n'est pas le meme que dans img_pack"; 457 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 458 mkdir ("img_pack", 0700); 459 mkdir ("img_pack/icones_barre", 0700); 460 mkdir ("img_pack/icones", 0700); 461 } 462 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 463 rename ("img_pack", "img_pack_backup"); 464 mkdir ("img_pack", 0700); 465 mkdir ("img_pack/icones_barre", 0700); 466 mkdir ("img_pack/icones", 0700); 467 } 468 469 $img_pack_path = opendir ($theme_path.'/img_pack/'); 470 while ($fichier = readdir ($img_pack_path)) { 471 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 472 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 473 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 474 } 475 } 476 477 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 478 while ($fichier_two = readdir ($img_pack_sub_one)) { 479 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 480 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 481 } 482 } 483 484 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 485 while ($fichier_three = readdir ($img_pack_sub_two)) { 486 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 487 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 488 } 489 } 490 491 } 492 else if ($theme_name[1] == $duplicated_name[1]) { 493 ###echo "le theme choisi est le même que dans img_pack DEUX"; 494 if (($duplicated_version[1] != $theme_version[1]) AND ($duplicated_version[1] < $theme_version[1])) { 495 496 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 497 mkdir ("img_pack", 0700); 498 mkdir ("img_pack/icones_barre", 0700); 499 mkdir ("img_pack/icones", 0700); 500 } 501 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 502 rename ("img_pack", "img_pack_backup"); 503 mkdir ("img_pack", 0700); 504 mkdir ("img_pack/icones_barre", 0700); 505 mkdir ("img_pack/icones", 0700); 506 } 507 508 $img_pack_path = opendir ($theme_path.'/img_pack/'); 509 while ($fichier = readdir ($img_pack_path)) { 510 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 511 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 512 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 513 } 514 } 515 516 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 517 while ($fichier_two = readdir ($img_pack_sub_one)) { 518 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 519 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 520 } 521 } 522 523 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 524 while ($fichier_three = readdir ($img_pack_sub_two)) { 525 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 526 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 527 } 528 } 529 } 530 } 531 532 } 533 534 else if (!file_exists($theme_duplicated)){ 535 ###echo "le theme.xml existe pas dans img_pack"; 536 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 537 mkdir ("img_pack", 0700); 538 mkdir ("img_pack/icones_barre", 0700); 539 mkdir ("img_pack/icones", 0700); 540 } 541 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 542 rename ("img_pack", "img_pack_backup"); 543 mkdir ("img_pack", 0700); 544 mkdir ("img_pack/icones_barre", 0700); 545 mkdir ("img_pack/icones", 0700); 546 } 547 548 $img_pack_path = opendir ($theme_path.'/img_pack/'); 549 while ($fichier = readdir ($img_pack_path)) { 550 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 551 copy ("$theme_path/img_pack/$fichier","img_pack/$fichier"); 552 copy ("$theme_path/theme.xml","img_pack/theme.xml"); 553 } 554 } 555 556 $img_pack_sub_one = opendir ($theme_path.'/img_pack/icones_barre/'); 557 while ($fichier_two = readdir ($img_pack_sub_one)) { 558 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 559 copy ("$theme_path/img_pack/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 560 } 561 } 562 563 $img_pack_sub_two = opendir ($theme_path.'/img_pack/icones/'); 564 while ($fichier_three = readdir ($img_pack_sub_two)) { 565 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 566 copy ("$theme_path/img_pack/icones/$fichier_three","img_pack/icones/$fichier_three"); 567 } 568 } 569 } 570 } 571 572 else if ($theme == "initial") { 573 ###echo "veut revenir initial"; 574 if (is_dir('img_pack_backup') AND !is_dir('img_pack')) { 575 mkdir ("img_pack", 0700); 576 mkdir ("img_pack/icones_barre", 0700); 577 mkdir ("img_pack/icones", 0700); 578 } 579 else if (!is_dir('img_pack_backup') AND is_dir('img_pack')){ 580 rename ("img_pack", "img_pack_backup"); 581 mkdir ("img_pack", 0700); 582 mkdir ("img_pack/icones_barre", 0700); 583 mkdir ("img_pack/icones", 0700); 584 } 585 586 $img_pack_backup_one = opendir ('img_pack_backup/'); 587 while ($fichier = readdir ($img_pack_backup_one)) { 588 if ($fichier != "." && $fichier != ".." && $fichier != ".svn" && $fichier != "icones_barre" && $fichier != "icones") { 589 copy ("img_pack_backup/$fichier","img_pack/$fichier"); 590 } 591 } 592 593 $img_pack_backup_two = opendir ('img_pack_backup/icones_barre/'); 594 while ($fichier_two = readdir ($img_pack_backup_two)) { 595 if ($fichier_two != "." && $fichier_two != ".." && $fichier_two != ".svn") { 596 copy ("img_pack_backup/icones_barre/$fichier_two","img_pack/icones_barre/$fichier_two"); 597 } 598 } 599 600 $img_pack_backup_three = opendir ('img_pack_backup/icones/'); 601 while ($fichier_three = readdir ($img_pack_backup_three)) { 602 if ($fichier_three != "." && $fichier_three != ".." && $fichier_three != ".svn") { 603 copy ("img_pack_backup//icones/$fichier_three","img_pack/icones/$fichier_three"); 604 } 605 } 606 607 unlink ("img_pack/theme.xml"); 608 } 609 67 610 68 echo "<a name='access-c' href='#access-c' accesskey='c'></a><div class='cadre-r'><div style='position: relative;'><div class='cadre-titre' style='margin: 0px;'>"; 611 echo '<INPUT type=radio name="theme" value="initial"'; 612 if ($_REQUEST['theme'] == "initial") { 613 echo "checked"; 614 } 69 echo '<INPUT type=radio name="theme" value=""'; 70 if ($GLOBALS['meta']['habillage_prive'] == "") 71 echo "checked='checked'"; 615 72 echo ">"; 616 73 echo "<strong>Revenir à l'habillage d'origine</strong>"; 617 74 echo '</div></div><div class="cadre-padding" style="overflow:hidden;">'; 618 echo "</div></div><div style='height: 5px;'></div>"; 619 620 $dossier = opendir (_DIR_PLUGIN_HABILLAGES.'/prive/themes/'); 621 while ($fichier = readdir ($dossier)) { 622 if ($fichier != "." && $fichier != "..") { 623 echo "<a name='access-c' href='#access-c' accesskey='c'></a><div class='cadre-r'><div style='position: relative;'><div class='cadre-titre' style='margin: 0px;'>"; 624 echo '<INPUT type=radio name="theme" value="'.$fichier.'"'; 625 if ($_REQUEST['theme'] == "" AND file_exists($theme_duplicated)) { 626 if (fopen($theme_duplicated, 'r') == TRUE) { 627 ###echo "Pas de theme choisi et le fichier theme est reconnu dans img_pack"; 628 $open_theme_duplicated_file = fopen($theme_duplicated, 'r'); 629 $theme_duplicated_file_size = filesize ($theme_duplicated); 630 $read_theme_duplicated = fread ($open_theme_duplicated_file, $theme_duplicated_file_size); 631 # Mettre dans l'expression reguliere ci-dessous la possibilite de reconnaitre le prefixe 632 # meme si le prefixe n'est pas colle aux balises <prefixes>. 633 $search_duplicated_name = eregi("<prefixe>(.*)</prefixe>", $read_theme_duplicated, $duplicated_name); 634 if ($duplicated_name[1] == $fichier) { 635 echo " checked"; 636 } 637 fclose($open_theme_duplicated_file); 638 } 639 } 640 else if ($_REQUEST['theme'] == $fichier) { 641 echo " checked"; 642 } 643 echo ">"; 644 645 $theme_file = $plugin_directory.'/prive/themes/'.$fichier.'/theme.xml'; 646 if (file_exists($theme_file)) { 647 $open_theme_file = fopen($theme_file, 'r'); 648 $theme_file_size = filesize ($theme_file); 649 $read_theme_file = fread ($open_theme_file, $theme_file_size); 650 $search_theme_name = eregi("<nom>(.*)</nom>", $read_theme_file, $theme_name); 651 $search_theme_author = eregi("<auteur>(.*)</auteur>", $read_theme_file, $theme_author); 652 $search_theme_version = eregi("<version>(.*)</version>", $read_theme_file, $theme_version); 653 $search_theme_description = eregi("<description>(.*)</description>", $read_theme_file, $theme_description); 654 echo '<strong>'.$theme_name[1].'</strong> version '.$theme_version[1].'</div></div><div class="cadre-padding" style="overflow:hidden;">'; 655 echo '<i><medium>Auteur : '.$theme_author[1].'</medium></i><br />'; 656 echo '<small>'.$theme_description[1].'</small>'; 657 echo "</div></div><div style='height: 5px;'></div>"; 658 fclose($open_theme_file); 659 } 660 661 else { 662 echo '<strong>'.$fichier.'</strong>'; 663 echo '</div></div><div class="cadre-padding" style="overflow:hidden;">'; 664 echo "</div></div><div style='height: 5px;'></div>"; 665 } 666 } 667 } 668 closedir ($dossier); 75 echo "</div></div><div style='height: 5px;'></div>"; 76 77 $liste_themes = preg_files(_DIR_PLUGIN_HABILLAGES.'/prive/themes/',"/theme[.]xml$"); 78 foreach ($liste_themes as $fichier){ 79 $c = dirname($fichier)."/img_pack/"; 80 echo "<a name='access-c' href='#access-c' accesskey='c'></a><div class='cadre-r'><div style='position: relative;'><div class='cadre-titre' style='margin: 0px;'>"; 81 echo '<INPUT type=radio name="theme" value="'.$c.'"'; 82 if ($GLOBALS['meta']['habillage_prive'] == $c) 83 echo "checked='checked'"; 84 echo ">"; 85 86 lire_fichier($fichier, $texte); 87 $arbre = parse_plugin_xml($texte); 88 $arbre = $arbre['theme'][0]; 89 90 $theme_name = applatit_arbre($arbre['nom']); 91 $theme_author = applatit_arbre($arbre['auteur']); 92 $theme_version = applatit_arbre($arbre['version']); 93 $theme_description = applatit_arbre($arbre['description']); 94 echo '<strong>'.$theme_name.'</strong> version '.$theme_version.'</div></div><div class="cadre-padding" style="overflow:hidden;">'; 95 echo '<i><medium>Auteur : '.$theme_author.'</medium></i><br />'; 96 echo '<small>'.$theme_description.'</small>'; 97 echo "</div></div><div style='height: 5px;'></div>"; 98 } 669 99 670 100 echo '<input type="submit" value="'._T('valider').'"/>'; -
_plugins_/habillages/unstable/habillages.php
r5380 r5439 7 7 if($flux['args']=='configuration') 8 8 $flux['data']['config_habillages']= new Bouton( 9 '../'._DIR_PLUGIN_HABILLAGES.'/img_pack/habillage_prive-22.png', 'Habillages', generer_url_ecrire("config_habillages"));9 _DIR_PLUGIN_HABILLAGES.'/img_pack/habillage_prive-22.png', 'Habillages', generer_url_ecrire("config_habillages")); 10 10 return $flux; 11 11 }
Note: See TracChangeset
for help on using the changeset viewer.