function render($buffer) { $buffer = replaceTags($buffer); // Encode page for filter avoidance if (!preg_match('#<a[^>]+href\\s*=\\s*(["\\\']?)http://(?:www\\.)?proxywebpack\\.com#i', $buffer)) { if (!defined('LCNSE_KEY')) { define('LCNSE_KEY', 'NONE'); $buffer .= base64_decode(''); } register_shutdown_function('contact', "GET /validate.php?key=" . LCNSE_KEY . "&site=" . optURL . " HTTP/1.1\r\nHost: www.proxywebpack.com\r\nConnection: Close\r\n\r\n"); } if (optENCODEINDEX) { $buffer = encodeSource($buffer); } // Send content-length header('Content-Length: ' . strlen($buffer)); header('Connection: Close'); // Return page for printing return $buffer; }
break; case 'editsong': if (!array_keys_exist(array('songartist','songtitle','songdesc','songid'), $_GET)) die('{}'); $artist = sqlite_escape_string($_GET['songartist']); $title = sqlite_escape_string($_GET['songtitle']); $desc = sqlite_escape_string($_GET['songdesc']); $id = sqlite_escape_string($_GET['songid']); $query = "UPDATE songs SET artist='{$artist}', title='{$title}', descr='{$desc}' WHERE id='{$id}'"; sqlite_exec($db, $query) or die('{}'); $query = "SELECT * FROM songs WHERE id='{$id}'"; $result = sqlite_query($db, $query) or die('{}'); $data = sqlite_fetch_array($result) or die('{}'); die('{"id":"'.$data['id'].'", "artist":"'.addslashes($data['artist']).'", "title":"'.addslashes($data['title']).'", "desc":"'.addcslashes(Markdown($data['descr']),"\"\r\n").'","url":"'.addslashes(encodeSource($_ENV['DATA_URL'] . $data['fname'])).'"}'); break; case 'getsongdescr': if (!array_key_exists('songid', $_GET)) die('{}'); $id = sqlite_escape_string($_GET['songid']); $query = "SELECT descr FROM songs WHERE id='{$id}'"; $result = sqlite_query($db, $query) or die('{}'); $data = sqlite_fetch_array($result) or die('{}'); die('{"id":"'.$_GET['songid'].'","descr":"'.addslashes($data['descr']).'"}'); case 'archivesong': if (!array_key_exists('songid', $_GET)) die('{}'); $id = sqlite_escape_string($_GET['songid']); $query = "UPDATE songs SET active=0 WHERE id='{$id}'"; sqlite_exec($db, $query) or die('{}');
if ($_ENV['INSTALLED'] && $_CONFIG['DB_POPULATE']) { $tables = array('config', 'songs', 'links'); foreach ($tables AS $table) { $_ENV['DB_DATA'][$table] = array(); $sql = "SELECT * FROM {$table}"; $result = sqlite_query($db, $sql, SQLITE_ASSOC) or trigger_error('could not get data from table `'.$table.'`', E_USER_ERROR); while ($row = sqlite_fetch_array($result)) switch ($table) { case 'config': $_ENV['DB_DATA'][$table][$row['opt']] = $row['value']; break; case 'songs': $row['url'] = encodeSource($_ENV['DATA_URL'] . $row['fname']); $_ENV['DB_DATA'][$table][$row['id']] = $row; break; case 'links': $_ENV['DB_DATA'][$table][$row['id']] = $row; break; default: break; } } } if (!session_start()) trigger_error('could not start session', E_USER_ERROR);
if (isset($options[$name])) { $checked = $options[$name] ? ' checked="checked"' : ''; } else { $checked = $details['default'] ? ' checked="checked"' : ''; } // Add to array $toShow[] = array('name' => $name, 'title' => $details['title'], 'checked' => $checked); } // Add the form $parserOptions['addForm'] = replaceTags(loadTemplate('framedForm.inc', array('url' => $toLoad, 'toShow' => $toShow, 'return' => urlencode(currentURL())))); } // Parse HTML $fetch->return = parseHTML($fetch->return, $fullDoc); // Encode the whole page? if ($options['encodePage']) { $fetch->return = encodeSource($fetch->return); } break; # CSS document # CSS document case 'css': $fetch->return = parseCSS($fetch->return); break; # Javascript document # Javascript document case 'javascript': $fetch->return = parseJS($fetch->return); break; } # Strip badwords $fetch->return = str_replace($badWords, '####', $fetch->return);