Exemplo n.º 1
0
function step2()
{
    global $base, $wpdb;
    $dbname = stripslashes($_POST['dbname']);
    $uname = stripslashes($_POST['uname']);
    $passwrd = stripslashes($_POST['pwd']);
    $dbhost = stripslashes($_POST['dbhost']);
    $vhost = stripslashes($_POST['vhost']);
    $prefix = 'wp_';
    // Hardcoded
    $base = stripslashes(dirname($_SERVER["SCRIPT_NAME"]));
    if ($base != "/") {
        $base .= "/";
    }
    // Test the db connection.
    define('DB_NAME', $dbname);
    define('DB_USER', $uname);
    define('DB_PASSWORD', $passwrd);
    define('DB_HOST', $dbhost);
    if (!file_exists('wp-config-sample.php')) {
        die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
    }
    $wp_config_file = file('wp-config-sample.php');
    // We'll fail here if the values are no good.
    require_once 'wp-includes/wp-db.php';
    printheader();
    $handle = fopen('wp-config.php', 'w');
    foreach ($wp_config_file as $line) {
        switch (trim(substr($line, 0, 16))) {
            case "define('DB_NAME'":
                fwrite($handle, str_replace("wordpress", $dbname, $line));
                break;
            case "define('DB_USER'":
                fwrite($handle, str_replace("'username'", "'{$uname}'", $line));
                break;
            case "define('DB_PASSW":
                fwrite($handle, str_replace("'password'", "'{$passwrd}'", $line));
                break;
            case "define('DB_HOST'":
                fwrite($handle, str_replace("localhost", $dbhost, $line));
                break;
            case "define('VHOST',":
                fwrite($handle, str_replace("VHOSTSETTING", $vhost, $line));
                break;
            case '$table_prefix  =':
                fwrite($handle, str_replace('wp_', $prefix, $line));
                break;
            case '$base = \'BASE\';':
                fwrite($handle, str_replace('BASE', $base, $line));
                break;
            case "define('DOMAIN_C":
                $domain = get_clean_basedomain();
                fwrite($handle, str_replace("current_site_domain", $domain, $line));
                break;
            case "define('PATH_CUR":
                fwrite($handle, str_replace("current_site_path", str_replace('index.php', '', $_SERVER['REQUEST_URI']), $line));
                break;
            case "define('AUTH_KEY":
            case "define('AUTH_SAL":
            case "define('LOGGED_I":
            case "define('SECURE_A":
            case "define('NONCE_KE":
                fwrite($handle, str_replace('put your unique phrase here', md5(mt_rand()) . md5(mt_rand()), $line));
                break;
            default:
                fwrite($handle, $line);
                break;
        }
    }
    fclose($handle);
    chmod('wp-config.php', 0644);
    define('VHOST', $vhost);
}
Exemplo n.º 2
0
/**
 *  presents the login screen when authenticating witth sessions
 *
 */
function loginscreen($message = "<h3>Login to PhpLabWare</h3>")
{
    global $_SERVER, $system_settings;
    $PHP_SELF = $_SERVER['PHP_SELF'];
    if ($system_settings['secure_server']) {
        $server = getenv('HTTP_HOST');
        if (!$server) {
            $server = $_SERVER['HTTP_HOST'];
        }
        $addres = "https://{$server}{$PHP_SELF}";
    } else {
        $addres = $PHP_SELF;
    }
    $addres = url_get_string($addres);
    // prevent cross-site scripting:
    $addres = strip_xss_stuff($addres);
    printheader("Login to PhpLabWare");
    echo "<noscript><br><align='center'><b><div id='nojs'>Javascript is not used.  Although navigation of phplabware is possible without javascript, it is not actively supported and will limit functionality drastically.  Please enable JavaScript to view this page properly.</div></b></align></br></noscript>\n";
    echo "<form name='loginform' method='post' action='{$addres}' onSubmit='this.javascript_enabled.value=\"true\"'>\n";
    echo "<input type='hidden' name='logon' value='true'>\n";
    echo "<input type='hidden' name='javascript_enabled' value='0'>\n";
    echo "<table align=center>\n";
    echo "<tr><td colspan=2 align='center'>{$message}</td>\n";
    $imstring = randomimage("frontims");
    if ($imstring) {
    }
    echo "<td rowspan=6>&nbsp;&nbsp&nbsp;{$imstring}</td>";
    echo "</tr>\n";
    echo "<tr><td>Your login name:</td>\n";
    echo "<td><input name='user' size=10 value=''></td></tr>\n";
    echo "<tr><td>Password:</td>\n";
    echo "<td><input type='password' name='pwd' size=10 value=''></td></tr>\n";
    echo "<tr><td colspan=2 align='center'>";
    if ($system_settings["secure_server"]) {
        echo "<input type='checkbox' name='ssl' checked>Keep a secure connection";
    }
    echo "</td></tr>\n";
    echo "<tr><td colspan=2 align='center'>";
    echo "<input type='submit' name='submit' value='Login'></td></tr>\n";
    echo "<tr><td colspan=2 align='center'>";
    //echo "Note:  Cookies must be enabled beyond this point</td></tr>\n";
    echo "</table>\n</form>\n";
    printfooter();
}
Exemplo n.º 3
0
function generate()
{
    global $edit, $langmessage, $set, $pagenum, $menu, $templatepath, $selected, $LNEversion, $prefix, $out;
    $edit = 0;
    $count = 0;
    $go_sm = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset\n\t\n      xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n\t\n      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\t\n      xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n\n\t<url>\n\n\t<loc>http://" . sv(SERVER_NAME) . "/</loc>\n\n\t<priority>0.6</priority>\n\n\t<lastmod>" . date('Y-m-d') . "</lastmod>\n\n\t<changefreq>daily</changefreq>\n</url>\n";
    while ($menu[$count][0] != "") {
        $result1 = dbquery("SELECT * FROM " . $prefix . "paginas WHERE page=\"" . str_replace("_", "", $menu[$count][3]) . "\"");
        $row1 = fetch_array($result1);
        if ($row1['template'] != "") {
            $template2 = $row1['template'];
        } else {
            $template2 = $set['template'];
        }
        $row1['description'] = decode($row1['description']);
        $out = "";
        $pagenum = str_replace("''", "'", $menu[$count][3]);
        $pagenum = str_replace("_", "", $pagenum);
        if (!strval(strstr($menu[$count][3], "*"))) {
            $selected['index'] = $menu[$count][0];
            $selected['name'] = $menu[$count][4];
            $selected['link'] = $menu[$count][3];
            //query page record for template
            $page = "<?php \$pagenum=\"" . $pagenum . "\"; require_once \"./LightNEasy/runtime.php\"; ?>\n";
            $page .= file_get_contents("templates/" . $template2 . "/template.php");
            $go_sm .= "<url>\n\n\t\t\t<loc>http://" . sv(SERVER_NAME) . dirname(sv(REQUEST_URI)) . $menu[$count][3] . ".php</loc>\n\n\t\t\t<priority>0.5</priority>\n\n\t\t\t<lastmod>" . date('Y-m-d') . "</lastmod>\n\n\t\t\t<changefreq>daily</changefreq>\n\n\t\t\t</url>\n";
            if (!($fp = fopen($pagenum . ".php", "w"))) {
                die($langmessage[110] . $pagenum . ".php");
            }
            $contnt = html_entity_decode(stripslashes($row1['content']));
            //Look in the content for header modules
            while ($page != "") {
                if ($pagearray = explode($set['openfield'], $page, 2)) {
                    $out .= $pagearray[0];
                    $page = $pagearray[1];
                    if ($pagearray = explode($set['closefield'], $page, 2)) {
                        $command = trim($pagearray[0]);
                        $page = $pagearray[1];
                        switch ($command) {
                            case "content":
                                contentmarkers($contnt);
                                $out .= "<?php content(\"" . $pagenum . "\"); ?>";
                                break;
                            case "header":
                                $out .= printheader(1, $selected['name'], $row1['description'], $template2);
                                break;
                            case "footer":
                                $out .= "<?php print footer(); ?>";
                                break;
                            case "search":
                                $out .= "<?php print searchform(); ?>";
                                break;
                            case "homelink":
                                $out .= "<a href=\"" . $set['homepath'] . "\">{$langmessage['111']}</a>";
                                break;
                            case "image":
                                $out .= "templates/" . $set['template'] . "/images/";
                                break;
                            case "extra":
                                $out .= "<?php print extra(\"" . $selected['link'] . "\"); ?>\n";
                                break;
                            case "login":
                                $out .= "<?php print loginout(); ?>\n";
                                break;
                            case "loginform":
                                $out .= "<?php print loginform(); ?>\n";
                                break;
                            case "mainmenu":
                                $out .= "<?php print mainmenu(1); ?>\n";
                                break;
                            case "mainmenu1":
                                $out .= "<?php print mainmenu(1,1); ?>\n";
                                break;
                            case "mainmenu2":
                                $out .= "<?php print mainmenu(1,2); ?>\n";
                                break;
                            case "mainmenu3":
                                $out .= "<?php print mainmenu(1,3); ?>\n";
                                break;
                            case "treemenu":
                                $out .= "<?php print treemenu(1); ?>\n";
                                break;
                            case "fullmenu":
                                $out .= "<?php print fullmenu(1); ?>\n";
                                break;
                            case "expmenu":
                                $out .= "<?php print expmenu(1); ?>\n";
                                break;
                            case "submenu":
                                $out .= "<?php print submenu(1); ?>\n";
                                break;
                            case "selected":
                                $out .= $selected['name'];
                                break;
                            case "sitemap":
                                $out .= sitemap(1);
                                break;
                            case "subtitle":
                                $out .= $set['subtitle'];
                                break;
                            case "title":
                                $out .= '<a href="' . $set['homepath'] . '">' . $set['title'] . '</a>';
                                break;
                            default:
                                if (strpos($command, "plugin") !== false) {
                                    $aa = explode(" ", $command, 2);
                                    $pluginpath = "plugins/" . trim($aa[1]);
                                    if (file_exists($pluginpath . "/first.mod")) {
                                        $out = file_get_contents($pluginpath . "/first.mod") . $out;
                                    }
                                    if (file_exists($pluginpath . "/header.mod")) {
                                        $out = str_replace("</head>", file_get_contents($pluginpath . "/header.mod") . "\n</head>", $out);
                                    }
                                    if (file_exists($pluginpath . "/onload.mod")) {
                                        $out = str_replace("<body", "<body onload=\"" . file_get_contents($pluginpath . "/onload.mod") . "\"", $out);
                                    }
                                    if (file_exists($pluginpath . "/include.mod")) {
                                        $out .= "<?php include \"plugins/" . trim($aa[1]) . "/include.mod\"; ?>\n";
                                    }
                                    if (file_exists($pluginpath . "/place.mod")) {
                                        $out .= file_get_contents("{$pluginpath}/place.mod");
                                    }
                                } elseif (strpos($command, "extra") !== false) {
                                    $aa = explode(" ", $command, 2);
                                    $out .= "<?php print extra(\"" . $selected['link'] . "\"," . $aa[1] . "); ?>";
                                } else {
                                    $found = false;
                                    $addons = fetch_all(dbquery("SELECT * FROM " . $prefix . "addons WHERE active=1"));
                                    foreach ($addons as $addon) {
                                        if ($command == $addon['name']) {
                                            $out .= "<?php require_once \"addons/" . $addon['name'] . "/main.php\"; print " . $addon['fname'] . "(); ?>";
                                            $found = true;
                                            break;
                                        } elseif (substr($command, 0, strlen($addon['name'])) == $addon['name']) {
                                            $found = true;
                                            $out .= "<?php require_once \"addons/" . $addon['name'] . "/main.php\"; ";
                                            $bb = trim(substr($command, strlen($addon['name'])));
                                            $aa = explode(" ", $bb);
                                            if ($aa[3] != "") {
                                                $out .= "print " . $addon['fname'] . "('{$aa['0']}','{$aa['1']}','{$aa['2']}','{$aa['3']}')";
                                            } elseif ($aa[2] != "") {
                                                $out .= "print " . $addon['fname'] . "('{$aa['0']}','{$aa['1']}','{$aa['2']}')";
                                            } elseif ($aa[1] != "") {
                                                $out .= "print " . $addon['fname'] . "('{$aa['0']}','{$aa['1']}')";
                                            } else {
                                                $out .= "print " . $addon['fname'] . "('{$aa['0']}')";
                                            }
                                            $out .= "; ?>";
                                            break;
                                        }
                                    }
                                    if (!$found) {
                                        $out .= $command;
                                    }
                                }
                        }
                    } else {
                        break;
                    }
                } else {
                    break;
                }
            }
            if ($page != "") {
                $out .= $page;
            }
            fwrite($fp, $out);
            fclose($fp);
            @chmod($menu[$count][3] . ".php", 0755);
            if (file_exists($menu[$count][3] . ".html")) {
                unlink($menu[$count][3] . ".html");
            }
        }
        $count++;
    }
    $go_sm .= "</urlset>\n";
    $fp_go = fopen('sitemap.xml', 'w');
    fwrite($fp_go, $go_sm);
    fclose($fp_go);
    unset($_SESSION[$set['password']]);
    setcookie('userpass', "", time() - 60);
    setcookie('userhandle', "", time() - 60);
    session_destroy();
    unset($_GET['do']);
    header("Location: index.php");
}
Exemplo n.º 4
0
/***************************************************************************
  * Copyright (c) 2003 by Nico Stuurman<*****@*****.**>                       *
  * ------------------------------------------------------------------------ *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/
// Needs get/postvars:tablename
// optional get/postvar: viewnameid
/// main include thingies
require './include.php';
require './includes/db_inc.php';
require './includes/general_inc.php';
require './includes/report_inc.php';
printheader($httptitle);
navbar($USER['permissions']);
if ($USER['permissions'] < $WRITE) {
    echo "<h4 align='center'>You do not have sufficient priveleges to create or edit views</h4>\n";
    printfooter();
    exit;
}
if (isset($_POST['tablename'])) {
    $_GET['tablename'] = $_POST['tablename'];
}
$tableinfo = new tableinfo($db);
if ($_GET['viewid']) {
    $viewid = $_GET['viewid'];
} else {
    $viewid = $_POST['viewid'];
}
Exemplo n.º 5
0
     $out .= expmenu(0);
     break;
 case "extra":
     $out .= extra();
     break;
 case "footer":
     $out .= $set['footer'];
     break;
 case "fullmenu":
     $out .= fullmenu(0);
     break;
 case "search":
     $out .= searchform();
     break;
 case "header":
     $out .= printheader(0, $selected['name'], $selected['description']);
     break;
 case "homelink":
     $out .= '<a href="' . $set['homepath'] . "\">{$langmessage['111']}</a>";
     break;
 case "image":
     $out .= "./templates/" . $selected['template'] . "/images/";
     break;
 case "login":
     $out .= loginout();
     break;
 case "loginform":
     $out .= loginform();
     break;
 case "mainmenu":
     $out .= mainmenu(0);
Exemplo n.º 6
0
    $pivot_dir = $dir . "/pivot";
    $pivot_url = "pivot";
} elseif (file_exists($dir . "/pv_core.php")) {
    $pivot_dir = $dir;
    $pivot_url = ".";
} else {
    die("Didn't find the Pivot directory!");
}
// removing lots of spam can take quite a while..
set_time_limit(0);
if ($_REQUEST["submit"] == "Remove Spam") {
    printheader("Removed");
    spam();
} else {
    if ($_REQUEST["submit"] == "List Spam") {
        printheader("Listing");
        echo form("Remove Spam");
        spam();
    } elseif ($_REQUEST["action"] == "help") {
        $link = sprintf("index.php?session=%s&amp;menu=admin&amp;func=admin&amp;do=spamwasher", $Pivot_Vars['session']);
        echo '
    <h2>Help</h2>

    <p>This tool helps you remove spam from comments and trackbacks in your Pivot.</p>
    <p>It has it\'s <a href="http://forum.pivotlog.net/viewtopic.php?t=9572">own thread</a>
    in the Pivot forum.  If you still have any questions after
    reading this page, ask your questions there.</p>

    <br />
    <h3>A warning</h3>
    <p class="warn"><b>The script has no undo-function.</b><br />
Exemplo n.º 7
0
    echo "</tr>\n";
    echo "</table>\n";
    printfooter();
}
if (!$version && $pwd) {
    // we connected to an empty database and have the password
    // now create the initial tables
    //$db->debug = true;
    include "./dd/0_001_inc.php";
}
// $version is known, so we have a working database and must now authenticate
if ($version) {
    $system_settings = unserialize(get_cell($db, "settings", "settings", "id", 1));
    include "./includes/auth_inc.php";
    allowonly($SUPER, $USER["permissions"]);
    printheader("Settings");
    navbar($USER["permissions"]);
    // insert database updates here
    if ($version < $version_code) {
        $test = true;
        // Creates table antibodies
        if ($version < 0.0021) {
            include "./dd/0_0021_inc.php";
        }
        // Creates table protocols
        if ($version < 0.0022) {
            include "./dd/0_0022_inc.php";
        }
        // Creates table pdfs
        if ($version < 0.0023) {
            include "./dd/0_0023_inc.php";
Exemplo n.º 8
0
<?php

// login.php - Generic script for PhpLabWare
// login.php - author: Nico Stuurman
include './include.php';
printheader('PhpLabWare');
navbar($USER['permissions']);
echo "<h3 align=center>Welcome to PhpLabWare</h3>\n";
printfooter();
Exemplo n.º 9
0
				<div class="color_box" id="orange">
					<a href="http://www.nomadicmatt.com/"><h1>NOMADIC MATT</h1></a>
				</div>
			</div>

			<div id="right_col" >
				<div class="color_box" id="black">
					<a href="http://www.ourawesomeplanet.com/"><h1>OUR AWSOME PLANET</h1></a>
				</div>	
				<div class="articles">

					<?php 
include 'scripts/getsetarticle.php';
$id = getlastid();
for ($i = $id; $i > $id - 4; $i--) {
    printheader($i);
}
?>

				</div>			
			</div>			
			<div id="cleared"></div>
		</div>
		<footer>
			<div class="inline"><a href="index.php"><h1>Explore The World</h1></a></div>
			<div class="inline" id="copyright">
				<p>Creatred by Yakov Yusipenko</p>
				<p>Contact me <a href="mailto:myemail@explore.world">myemail@explore.world</a></p>
			</div>
		</footer>
	</div>
Exemplo n.º 10
0
  * Dumps table content in tab-delimited file                                *
  * Takes 'tablename' as a get variable                                      *
  *                                                                          *
  * Copyright (c) 2003 by Nico Stuurman                                      *
  * ------------------------------------------------------------------------ *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
*  option) any later version.                                              *
  \**************************************************************************/
// this may take a long time.  Simply kill me if I hang
ini_set('max_execution_time', '0');
require './include.php';
require './includes/db_inc.php';
require './includes/general_inc.php';
printheader($httptitle, false);
navbar($USER['permissions']);
if (!$USER['permissions'] & $SUPER) {
    echo "<h3 align='center'>Sorry, this page is not for you.</h3>\n";
    printfooter($db, $USER);
    exit;
}
// Three GET variables are useful:
// tablename
// fields - let's you export only a subset of columns
// valuesOnly - switch wether or not values should be 'expanded'
$tablename = $_GET['tablename'];
$tableid = get_cell($db, 'tableoftables', 'id', 'tablename', $tablename);
if (!$tableid) {
    echo "<h3>This script will dump the contents of a table in a tab-delimited file. The contents of that file can be imported into phplabware or any other database program.</h3>";
    $r = $db->execute("SELECT id,tablename FROM tableoftables");
Exemplo n.º 11
0
function notFound($type)
{
    http_response_code(404);
    printheader($type . ' Not Found');
    print "<h1>" . $type . " Not Found</h1>" . "\n";
}
Exemplo n.º 12
0
<?php

// logout.php - kills the current session
// logout.php - author: Nico Stuurman
include './includes/functions_inc.php';
include './includes/init_inc.php';
if (isset($system_settings['tmpdir'])) {
    session_save_path($system_settings['tmpdir']);
}
session_start();
if (isset($system_settings['homeURL'])) {
    $head = "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=" . $system_settings['homeURL'] . "'>\n";
}
if ($_SESSION['PHP_AUTH_USER']) {
    printheader('Loging out', $head);
    navbar(false);
    session_destroy();
    echo "&nbsp;<br><h3 align='center'>Thanks for logging out!</h5><br>&nbsp;";
} else {
    printheader('Loging out');
    navbar(false);
    echo "&nbsp;<br><h3 align='center'>You better login first!</hr><br>&nbsp;";
}
printfooter();
Exemplo n.º 13
0
    printheader($title);
    navbar($USER['permissions']);
    echo $result;
    show_user_form('me');
    printfooter($db, $USER);
    exit;
}
// Only a groupadmin and sysadmin are allowed to view the remainder
allowonly($ADMIN, $USER['permissions']);
// set title and print headers
$title .= 'User administration';
// extend title if user is an admin
if (!($USER['permissions'] & $SUPER)) {
    $title .= ' in group ' . get_cell($db, 'groups', 'name', 'id', $USER['groupid']);
}
printheader($title);
navbar($USER['permissions']);
// Check whether modify or delete button has been chosen
$del = false;
$mod = false;
if ($_POST) {
    //determine wether or not the remove-command is given and act on it
    while (list($key, $val) = each($_POST)) {
        if (substr($key, 0, 3) == "del") {
            $delarray = explode("_", $key);
            $del = true;
        }
        if (substr($key, 0, 3) == "mop") {
            $modarray = explode("_", $key);
            $mod = true;
        }
Exemplo n.º 14
0
    }
    echo "<table align='center'>\n";
    echo "<tr><td>New Group Name:</td>\n";
    echo "<td><input type='text' name='groupname' value='{$groupname}'></td></tr>\n";
    echo "<tr><td colspan=2 align='center'>";
    if ($groupid) {
        echo "<input type='submit' name='submit' value='Modify Group'>";
    } else {
        echo "<input type='submit' name='submit' value='Add Group'>";
    }
    echo "</td></tr>\n";
    echo "</table>\n";
    echo "</form>\n";
}
/****************************************************************/
printheader("Groups of PhpLabware");
navbar($USER["permissions"]);
// when the 'Add a new Group' button has been chosen:
if ($add) {
    group_form("", "");
} elseif ($mod == "true") {
    group_form($groupid, $groupname);
} else {
    // print header of table
    echo "<table border=\"1\" align=center >\n";
    echo "<caption>\n";
    // first handle addition of a new group
    if ($submit == "Add Group") {
        if ($test = add_new_group($db, $groupname)) {
            echo "</caption>\n</table>\n";
            echo "<table align='center'><caption>{$test}</caption></table>";
Exemplo n.º 15
0
}
/**
 * The user who will own the imported records
 * This way we default to the one doing the import
 */
if ($ownerid) {
    $USERAS = getUserInfo($db, false, $ownerid);
}
if (!isset($USERAS)) {
    $USERAS = $USER;
}
/**
 * Print header and do further checks on permissions
 */
$httptitle .= ' Import data';
printheader($httptitle, false, $jsfile);
$tmpdir = $system_settings['tmpdir'];
if (!($permissions & $USER)) {
    navbar($USER['permissions']);
    echo "<h3 align='center'><b>Sorry, this page is not for you</B></h3>";
    printfooter($db, $USER);
    exit;
}
navbar($USER['permissions']);
/**
 * interpret a date string according to the system settings
 * this can fail when importing data from another continent
 */
function mymktime($datestring)
{
    global $system_settings;
Exemplo n.º 16
0
function makeCaptions($new_captions)
{
    global $baseURL, $scriptPath, $dir, $jheadBinary;
    # If there are new captions
    if (!empty($new_captions)) {
        # Get the old captions
        $captions = get_captions(true);
        # Append new captions to those already there
        foreach ($new_captions as $i => $c) {
            # Base 64 was the best way (I thought of) of dealing with oddly named images in the input form.
            $captions[base64_decode($i)][] = trim($c);
            # If the jhead binary is executable.
            if (is_executable($jheadBinary)) {
                setExifCaption(base64_decode($i), trim($c));
            }
        }
        # Write the captions to disk.
        @file_put_contents($scriptPath . "cache/" . $dir . "captions.txt", serialize($captions));
        # If the function was called from AJAX... (Only one update at a time).
        if (count($new_captions) == 1) {
            exit;
        }
    }
    $captions = get_captions();
    $folder_scan_results = folder_scan();
    $images_with_thumbs = images_with_thumbnails($folder_scan_results['images']);
    foreach ($images_with_thumbs as $idx => $image) {
        if (!array_key_exists($image, $captions)) {
            $captions[$image] = getExifCaption($image);
        }
    }
    /*
    Ajax Function. Compressed version of "The Ultimate Ajax Object"
    http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object
    */
    $title = "Captions: " . $dir;
    if (function_exists("printheader")) {
        printheader($title);
    } else {
        html_header($title);
    }
    ?>
	<script type="text/javascript">
		function ajaxObject(b,a){var c=this;this.updating=false;this.abort=function(){if(c.updating){c.updating=false;c.AJAX.abort();c.AJAX=null}};this.update=function(g,e){if(c.updating){return false}c.AJAX=null;if(window.XMLHttpRequest){c.AJAX=new XMLHttpRequest()}else{c.AJAX=new ActiveXObject("Microsoft.XMLHTTP")}if(c.AJAX==null){return false}else{c.AJAX.onreadystatechange=function(){if(c.AJAX.readyState==4){c.updating=false;c.callback(c.AJAX.responseText,c.AJAX.status,c.AJAX.responseXML);c.AJAX=null}};c.updating=new Date();if(/post/i.test(e)){var f=d+"?"+c.updating.getTime();c.AJAX.open("POST",f,true);c.AJAX.setRequestHeader("Content-type","application/x-www-form-urlencoded");c.AJAX.setRequestHeader("Content-Length",g.length);c.AJAX.send(g)}else{var f=d+"?"+g+"&timestamp="+(c.updating.getTime());c.AJAX.open("GET",f,true);c.AJAX.send(null)}return true}};var d=b;this.callback=a||function(){}};
		// Update the caption. Setup to be called in an 'on change' so that all the comments are saved automatically
		// and Submit doesn't need to be pressed.
		function updateCaption(object) {
			var myRequest = new ajaxObject("<?php 
    echo rrawurlencode($baseURL . "captions/" . $dir);
    ?>
");
			myRequest.update(encodeURIComponent(object.name)+"="+encodeURIComponent(object.value),"POST");
			//location.reload();
		}
	</script>
<a href="<?php 
    echo rrawurlencode($baseURL . $dir);
    ?>
">Return To Gallery</a>
<form action="<?php 
    echo rrawurlencode($baseURL . "captions/" . $dir);
    ?>
" method="POST">
	<table>
		<tr>
			<td align="right">
				Album Title:
			</td>
			<td>
				<input type="text" name="<?php 
    echo base64_encode('title');
    ?>
" id="title" size="20" value="<?php 
    echo $captions['title'];
    ?>
" tabindex="1" onchange="updateCaption(this)">
			</td>
		</tr>
<?php 
    if (count($images_with_thumbs)) {
        foreach ($images_with_thumbs as $idx => $image) {
            $pictures .= "\t<tr><td align=\"right\">";
            $pictures .= "<a href=\"" . rrawurlencode($baseURL . $dir . $image) . "\"><img src=\"" . rrawurlencode($baseURL . "cache/" . $dir . "preview/" . $image) . "\" alt=\"" . htmlentities($image) . "\"></a>";
            $pictures .= "</td><td valign=\"bottom\"><textarea id=\"caption{$idx}\" name=\"" . base64_encode($image) . "\" rows=\"20\" cols=\"30\" tabindex=\"" . ($idx + 2) . "\" onchange=\"updateCaption(this)\">" . $captions[$image] . "</textarea></td></tr>\n";
        }
    }
    echo $pictures;
    ?>
	<tr>
		<td colspan="2" align="center">
			<input type="submit" value="Change Captions">
		</td>
	</tr>
	</table>
</form>
<?php 
    if (function_exists("printfooter")) {
        printfooter($title);
    } else {
        html_footer($title);
    }
}
Exemplo n.º 17
0
<?php

require_once "07-PHP-functions3.php";
$default_header = "rgfdssss";
echo printheader();
echo printheader('12234');