Fix For delete links double \n in files.html

1.9.x
Anibal Copitan 12 years ago
parent 9dbab31a31
commit f25aed4e08
  1. 51
      main/admin/configure_homepage.php

@ -15,30 +15,33 @@
*/
function home_tabs($file_logged_in)
{
$file_logged_out = str_replace('_logged_in','', $file_logged_in);
//variables initialization
$data_logged_out = array();
$data_logged_in = array();
//we read the file with all links
$file = file($file_logged_in);
foreach ($file as $line) {
//not logged user only sees public links
if (!preg_match('/::private/',$line)) {
$data_logged_out[] = $line;
}
//logged user only sees all links
$data_logged_in[] = $line;
}
//tabs file for logged out users
$fp = fopen($file_logged_out, 'w');
fputs($fp, implode("\n", $data_logged_out));
fclose($fp);
//tabs file for logged in users
$fp = fopen($file_logged_in, 'w');
fputs($fp, implode("\n", $data_logged_in));
fclose($fp);
$post = strpos($file_logged_in, "_logged_in");
if ($post !== false) {
$file_logged_out = str_replace('_logged_in','', $file_logged_in);
//variables initialization
$data_logged_out = array();
$data_logged_in = array();
//we read the file with all links
$file = file($file_logged_in);
foreach ($file as $line) {
$line = str_replace("\n", '',$line);
//not logged user only sees public links
if (!preg_match('/::private/',$line)) {
$data_logged_out[] = $line;
}
//logged user only sees all links
$data_logged_in[] = $line;
}
//tabs file for logged out users
$fp = fopen($file_logged_out, 'w');
fputs($fp, implode("\n", $data_logged_out));
fclose($fp);
//tabs file for logged in users
$fp = fopen($file_logged_in, 'w');
fputs($fp, implode("\n", $data_logged_in));
fclose($fp);
}
}
/**
* Code

Loading…
Cancel
Save