function editguide($id, $edit, $gen = false) { global $guide; $success = true; if ($id[1] == '/') { $msg =& $guide[$id[0]]['subdirs'][substr($id, 2)]; } else { $msg =& $guide[$id]; } if (!isset($msg) && $gen) { $msg['gen'] = $gen; } $msg['text'] = $edit; unset($msg['cachedsb']); persist_update('guide') || ($success = false); if ($step = $msg['gen']) { include 'generate.php'; } return $success; }
$buf .= $pre . "\t"; if (!is_int($cur[0])) { $buf .= "'" . php_escape($cur[0]) . "' => "; $i = FALSE; } else { if ($i === FALSE || $cur[0] != ++$i) { $buf .= $cur[0] . ' => '; $i = $i !== FALSE && $cur[0] > $i ? $cur[0] : FALSE; } } $buf .= persist_tophp($cur[1], $pre . "\t"); if (--$nleft) { $buf .= ','; } $buf .= "\n"; } return $buf . $pre . ')'; } return "unserialize('" . php_escape(serialize($var)) . "')"; } function php_escape($str) { return strtr($str, array("\\" => "\\\\", "'" => "\\'")); } if (isset($_REQUEST['forceupdate'])) { if (persist_update()) { echo 'SUCCESS'; } else { echo 'ERROR'; } }
if (!persist_update()) { fm_close(); die('<strong>Error:</strong>Persist not writable, please see admin.'); } ?> <p style="padding:2px;border:1px solid #CC9966;"><strong>Default folder successfully changed.</strong></p> <?php } if (@$_POST['opass'] || $_POST['nopass']) { if ($_POST['nopass']) { $_POST['opass'] = ''; } if (empty($user['pass']) || $user['pass'] === pwencode($user['name'], $_POST['opass'])) { if ($_POST['npass'] && $_POST['npass'] === $_POST['npass2']) { $_PERSIST['users'][$uid]['pass'] = pwencode($user['name'], $_POST['npass']); if (!persist_update()) { fm_close(); die('<strong>Error:</strong>Persist not writable, please see admin.'); } ?> <p style="padding:2px;border:1px solid #CC9966;"><strong>Password successfully changed.</strong></p> <?php } else { if ($_POST['npass']) { ?> <p style="padding:2px 4px;border:2px solid #FF7755;"><strong><span style="color:#FF2211">Error:</span> New passwords do not match.</strong></p> <?php } else { ?> <p style="padding:2px 4px;border:2px solid #FF7755;"><strong><span style="color:#FF2211">Error:</span> You forgot to enter a new password.</strong></p> <?php
unset($_PERSIST['users'][$i]); $i--; } else { if ($_PERSIST['users'][$i]['name'] == $_POST['uname'] && $_PERSIST['users'][$i]['server'] == $_POST['server']) { unset($_PERSIST['users'][$i]); $i--; } } } } $sid = md5($_POST['uname'] . microtime() . rand() . '_s9k84ry'); $user = array('dname' => $_POST['uname'], 'name' => $_POST['uname'], 'pass' => $_POST['pass'], 'server' => $_POST['server'], 'port' => $_POST['port'], 'ftps' => $_POST['ftps'] ? true : false, 'pli' => $time, 'sid' => $sid, 'priv' => 63, 'psub' => '', 'dpsub' => ''); $_PERSIST['users'][] = $user; $_PERSIST['users'] = array_values($_PERSIST['users']); $uid = count($_PERSIST['users']) - 1; persist_update('_PERSIST', 'ftpusers.inc.php') or die('<err>Users not writable; CHMOD persist to 777.</err>'); setcookie('fmsid', $sid, $_POST['rem'] ? time() + 60 * 60 * 24 * 30 : 0); $status = 'li'; $d = ''; } } else { $status = 'nsc'; } } else { $sid = false; if ($_GET['fmsid']) { $sid = $_GET['fmsid']; } else { if ($_COOKIE['fmsid']) { $sid = $_COOKIE['fmsid']; }
echo $_POST['uname']; ?> successfully deleted.</strong></p> <?php } else { ?> <p style="padding:2px;border:1px solid #CC9966;margin-bottom:10px;"><strong>User ID/name mismatch.</strong> (User <?php echo $_POST['id'], ' is ', $_PERSIST['users'][$_POST['id']]['name'], ', not ', $_POST['uname']; ?> )</p> <?php } } else { if ($_POST['aact'] == 'togguest') { $_PERSIST['users'][0]['priv'] = $_PERSIST['users'][0]['priv'] ? 0 : 1; persist_update() or die('<strong>Error:</strong>Persist not writable, please CHMOD persist.inc.php to 777.'); update_data(); ?> <p style="padding:2px;border:1px solid #CC9966;margin-bottom:10px;"><strong>Guest account is now <?php echo $_PERSIST['users'][0]['priv'] ? 'enabled' : 'disabled'; ?> .</strong></p> <?php } else { if ($_POST['aact'] == 'settings') { $loginfirst = $_POST['nloginfirst'] ? FALSE : TRUE; update_config(); ?> <p style="padding:2px;border:1px solid #CC9966;margin-bottom:10px;"><strong>Your settings have been saved.</strong></p> <?php }
if ($_POST['login'] && $_POST['uname'] && dname2name($_POST['uname']) !== 'guest') { $uname = dname2name($_POST['uname']); $status = 'nli'; foreach ($_PERSIST['users'] as $i => $cuser) { if ($cuser['name'] === $uname) { if ($cuser['pass'] === FALSE || $cuser['pass'] === pwencode($uname, $_POST['pass'])) { if ($cuser['priv']) { $uid = $i; if (!$uid) { die('Trying to log in as guest.'); } $sid = md5($_POST['uname'] . microtime() . rand() . '_s9k84ry'); $_PERSIST['users'][$i]['sid'] = $sid; $_PERSIST['users'][$i]['pli'] = time(); $_PERSIST['users'][$i]['rem'] = $_POST['rem'] ? true : false; persist_update() or die('<err>Users not writable; CHMOD persist to 777.</err>'); $user = $cuser; setcookie('fmsid', $sid, $_POST['rem'] ? time() + 60 * 60 * 24 * 30 : 0); $status = 'li'; $d = $user['dpsub'] ? $user['dpsub'] : $user['psub']; } else { $status = 'ad'; } } break; } } } else { $sid = false; if ($_GET['fmsid']) { $sid = $_GET['fmsid'];
} } echo '<!-- Step 1 end -->'; if (!$_POST['adpass'] && !$_PERSIST['users'][1]['pass']) { $insterror = 'You must enter an admin password.'; } else { if ($step == 2 && $inst_auth && isset($_POST['postsub']) && $_POST['adpass'] === $_POST['adpassc']) { $loginfirst = $_POST['nloginfirst'] ? false : true; if (!$_PERSIST['users'][1]['pass'] || $_POST['adpass']) { $_PERSIST['users'][1]['pass'] = admin_salthash($_POST['adpass']); } $_PERSIST['users'][0]['priv'] = $_POST['enableguest'] ? 1 : 0; $_PERSIST['users'][0]['psub'] = $_POST['postsub']; include_once 'admin.lib.php'; update_config(); persist_update(); @copy('persist.inc.php', 'cache/data-backup.inc.php'); fm_recache(); $step = 3; } } if ($step == 0) { ?> <div>Please enter your administrator password to reinstall.</div> <div> </div> <?php if (isset($_POST['adpass'])) { echo '<div style="color:#EE1111;">Incorrect admin password.</div>'; } ?> <div><label>Admin username:</label></div>