Example #1
0
 function write(XMLWriter $xml, $data)
 {
     foreach ($data as $_key => $value) {
         // check the key isnt a number, (numeric keys invalid in XML)
         if (is_numeric($_key)) {
             $key = 'element';
         } else {
             if (!is_string($_key) || empty($_key) || strncmp($_key, '_', 1) === 0) {
                 continue;
             } else {
                 $key = $_key;
             }
         }
         $xml->startElement($key);
         // if the key is numeric, add an ID attribute to make tags properly unique
         if (is_numeric($_key)) {
             $xml->writeAttribute('id', $_key);
         }
         // if the value is an array recurse into it
         if (is_array($value)) {
             write($xml, $value);
         } else {
             $xml->text($value);
         }
         $xml->endElement();
     }
 }
function publish($table, $menu)
{
    global $mysql;
    // get the new menu
    $section = $_POST['menu'];
    $menu = $_POST['menu'];
    $title = $_POST['title'];
    // CLEAR CURRENT TABLE
    $sql = "TRUNCATE TABLE " . $table;
    $query = $mysql->sql_query($sql);
    // INSERT NEW DATA IN THE TABLE
    $fields = array('type', 'txt_fr', 'txt_en', 'price');
    $insert = array();
    foreach ($_POST['type'] as $key => $_) {
        $item = array();
        foreach ($fields as $field) {
            $var = $_POST[$field][$key];
            $value = $var ? '\'' . mysqli_real_escape_string($mysql->cndb, stripslashes($var)) . '\'' : 'NULL';
            array_push($item, $value);
        }
        array_push($insert, '(' . implode(',', $item) . ')');
    }
    $sql = 'INSERT INTO ' . $table . ' (' . implode(',', $fields) . ') VALUES ' . implode(',', $insert) . ';';
    $query = $mysql->sql_query($sql);
    write($table, 2);
    save($table, $menu);
}
function output(array $values)
{
    foreach (LANGS as $lang) {
        if (array_key_exists($lang, $values)) {
            write($lang, $values['file'], $values['key'], $values[$lang]);
        }
    }
}
function shutdown()
{
    global $socket;
    if (!empty($socket)) {
        write("QUIT");
        fclose($socket);
    }
}
Example #5
0
function postToSlack($message)
{
    $slackHookUrl = env('SLACK_HOOK_URL');
    if (!empty($slackHookUrl)) {
        runLocally('curl -s -S -X POST --data-urlencode payload="{\\"channel\\": \\"#' . env('SLACK_CHANNEL_NAME') . '\\", \\"username\\": \\"Release Bot\\", \\"text\\": \\"' . $message . '\\"}"' . env('SLACK_HOOK_URL'));
    } else {
        write('Configure the SLACK_HOOK_URL to post to slack');
    }
}
Example #6
0
 public static function waitForPort($waiting_message, $ip, $port)
 {
     write($waiting_message);
     while (!self::portAlive($ip, $port)) {
         sleep(1);
         write('.');
     }
     writeln("<fg=green>Up!</fg=green> Connect at <fg=yellow>=> {$ip}:{$port}</fg=yellow>");
 }
Example #7
0
function execCurl($options)
{
    static $n = 1;
    $ch = curl_init('https://www.yiqihao.com/events/worldcupresult');
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    curl_close($ch);
    write($result);
    echo "{$n}<br/>";
    $n++;
}
Example #8
0
function write($str)
{
    static $firstTime = true;
    if ($firstTime) {
        ob_start();
        ob_implicit_flush(false);
        $firstTime = false;
        write(str_repeat(' ', 1024 * 4));
    }
    echo $str, ob_get_clean();
    flush();
}
Example #9
0
function criaXML($response)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('bvs');
    write($xml, $response);
    $xml->endElement();
    header("Content-Type:text/xml");
    echo $xml->outputMemory(true);
    die;
}
Example #10
0
 function write(IPGXMLWriter $xmlWriter, $data)
 {
     foreach ($data as $key => $value) {
         if (is_array($value)) {
             $xmlWriter->StartElement($key);
             write($xmlWriter, $value);
             $xmlWriter->EndElement($key);
             continue;
         }
         $xmlWriter->WriteElement($key, $value);
     }
 }
Example #11
0
function write(XMLWriter $xml, $data)
{
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            $xml->startElement($key);
            write($xml, $value);
            $xml->endElement();
            continue;
        }
        $xml->writeElement($key, $value);
    }
}
 function run($request)
 {
     $tables = array("ProductGroup", "ProductGroup_Live", "Product", "Product_Live");
     if (class_exists("ProductVariation")) {
         $tables[] = "ProductVariation";
     }
     //todo: make list based on buyables rather than hard-coded.
     foreach ($tables as $tableName) {
         $classErrorCount = 0;
         $removeCount = 0;
         $updateClassCount = 0;
         $rowCount = DB::query("SELECT COUNT(\"ImageID\") FROM \"{$tableName}\" WHERE ImageID > 0;")->value();
         DB::alteration_message("<h2><strong>CHECKING {$tableName} ( {$rowCount} records ):</strong></h2>");
         $rows = DB::query("SELECT \"ImageID\", \"{$tableName}\".\"ID\" FROM \"{$tableName}\" WHERE ImageID > 0;");
         if ($rows) {
             foreach ($rows as $row) {
                 $remove = false;
                 $classErrorCount += DB::query("\r\n\t\t\t\t\t\tSELECT COUNT (\"File\".\"ID\")\r\n\t\t\t\t\t\tFROM \"File\"\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\"File\".\"ID\" = " . $row["ImageID"] . "\r\n\t\t\t\t\t\t\tAND  (\r\n\t\t\t\t\t\t\t \"ClassName\" = 'Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = 'ProductVariation_Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = ''\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t")->value();
                 DB::query("\r\n\t\t\t\t\t\tUPDATE \"File\"\r\n\t\t\t\t\t\tSET \"ClassName\" = 'Product_Image'\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\"File\".\"ID\" = " . $row["ImageID"] . "\r\n\t\t\t\t\t\t\tAND  (\r\n\t\t\t\t\t\t\t \"ClassName\" = 'Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = 'ProductVariation_Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = ''\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t");
                 $image = Product_Image::get()->byID($row["ImageID"]);
                 if (!$image) {
                     $remove = true;
                 } elseif (!$image->getTag()) {
                     $remove = true;
                 }
                 if ($remove) {
                     $removeCount++;
                     DB::query("UPDATE \"{$tableName}\" SET \"ImageID\" = 0 WHERE \"{$tableName}\".\"ID\" = " . $row["ID"] . " AND \"{$tableName}\".\"ImageID\" = " . $row["ImageID"] . ";");
                 } elseif (!is_a($image, Object::getCustomClass("Product_Image"))) {
                     $updateClassCount++;
                     $image = $image->newClassInstance("Product_Image");
                     $image - write();
                 }
             }
         }
         if ($classErrorCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> there were {$classErrorCount} files with the wrong class names.  These have been fixed.", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> there were no files with the wrong class names. ", "created");
         }
         if ($removeCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> Removed {$removeCount} image(s) from products and variations because they do not exist in the file-system or database", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> All product images are accounted for", "created");
         }
         if ($updateClassCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> {$removeCount} image(s) did not match the requirement 'instanceOF Product_Image', this has been corrected.", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> All product images instancesOF Product_Image", "created");
         }
     }
 }
Example #13
0
function error($code)
{
    global $message, $text, $score, $timeused;
    echo $code . '\\n';
    $text = 'err';
    $message = $code . '<br>เกรดเดอร์จะหยุดทำงาน และสามารถ start grader ด้วยตัวเองได้แล้ว';
    $score = 0;
    $timeused = 0;
    degrade();
    write();
    shell_exec('sh /home/otog/otog/judge/run.sh');
    die;
}
 protected function addRoute($route, $class, $routes)
 {
     if (file_exists('apps/' . $class . '.php')) {
         if (empty($routes[$route])) {
             file_put_contents('configs/router_config.ini', "\n" . $route . "=" . $class, FILE_APPEND);
         } else {
             write("Error: the route '" . $route . "' already exists.");
         }
         require_once 'apps/' . $class . '.php';
         $description = $class::description();
         write('[ ' . $route . ' ] - ' . $description);
     } else {
         write("Error: the class you specified doesn't exist in apps");
     }
 }
 /**
  * @brief function handling what the script does
  */
 protected function run(&$params)
 {
     $routes = parse_ini_file('configs/router_config.ini');
     if (!empty($routes[$params[1]])) {
         unset($routes[$params[1]]);
         $data = "";
         foreach ($routes as $route => $class) {
             $data .= $route . "=" . $class . "\n";
         }
         file_put_contents('configs/router_config.ini', $data);
         write("route '" . $params[1] . "' removed.");
     } else {
         write("Error: the app you wanted to remove isn't listed in 'configs/router_config.ini'.");
     }
 }
Example #16
0
function template($parent, $code)
{
    $template = file_get_contents(dirname(__FILE__) . DS . 'template.php');
    $filename = str_replace('\\', '/', $parent . '/' . $code);
    $file = dirname(__FILE__) . DS . 'src' . DS . "Cypher/StatusCodes{$filename}.php";
    $namespace = "EndyJasmi\\Cypher\\StatusCodes{$parent}";
    $path = "EndyJasmi\\Cypher\\StatusCodes{$parent}";
    $parent = array_pop(explode('\\', $parent));
    $error = $code;
    $template = str_replace('{namespace}', $namespace, $template);
    $template = str_replace('{path}', $path, $template);
    $template = str_replace('{parent}', $parent, $template);
    $template = str_replace('{error}', $error, $template);
    var_dump($file);
    // var_dump($template);
    write($file, $template);
}
Example #17
0
function getXml($results)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->setIndent(true);
    // new
    $xml->setIndentString("    ");
    // new
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('root');
    write($xml, $results);
    $xml->endElement();
    $xml->endDocument();
    // new
    $data = $xml->outputMemory(true);
    //$file = file_put_contents(APPPATH . '../uploads/data.xml', $data);
    return $data;
}
Example #18
0
 function write(XMLWriter $xml, $data)
 {
     foreach ($data as $key => $value) {
         if (is_array($value)) {
             if (is_numeric($key)) {
                 #The only time a numeric key would be used is if it labels an array with non-uniqe keys
                 write($xml, $value);
                 continue;
             } else {
                 $xml->startElement($key);
                 write($xml, $value);
                 $xml->endElement();
                 continue;
             }
         }
         $xml->writeElement($key, $value);
     }
 }
Example #19
0
function save($items, $publish)
{
    global $mysql;
    $table = 't_output_vins_admin';
    $fields = 'id_produit, parent, sys_order, type, label';
    $values = '';
    $mysql->delete_db($table, '1=1');
    foreach ($items as $item) {
        $id = $item->id;
        $parent = $item->parent;
        $order = $item->index;
        $type = $item->type;
        $label = addslashes($item->label);
        $values = "{$id}, '{$parent}', {$order}, '{$type}', '{$label}'";
        $sql = "INSERT INTO {$table} ({$fields}) values ({$values})";
        $mysql->sql_query($sql);
        if ($type == 'promo' || $type == 'vins-au-verre' || $type == 'demi-bouteilles') {
            $catvin = $item->catvin ? $item->catvin : 0;
            $regiondumonde = $item->regiondumonde ? $item->regiondumonde : 0;
            $pays = $item->pays ? $item->pays : 0;
            $region = $item->region ? $item->region : 0;
            $sousregion = $item->sousregion ? $item->sousregion : 0;
            switch ($type) {
                case 'promo':
                    $table_promo_verre = 't_promotions_admin';
                    break;
                case 'vins-au-verre':
                    $table_promo_verre = 't_output_vins_verre_admin';
                    break;
                case 'demi-bouteilles':
                    $table_promo_verre = 't_output_demi_bouteilles_admin';
                    break;
            }
            $set = "id_cat_vin={$catvin}, id_region_du_monde={$regiondumonde}, id_pays={$pays}, id_region={$region}, id_sous_region={$sousregion}";
            $where = "id={$id}";
            $mysql->update_db($table_promo_verre, $set, $where);
        }
    }
    if ($publish == 'true') {
        publish($items);
        write('t_output_vins_admin', 1);
    }
}
 function index_action()
 {
     if (!checkfile('plugins', 0)) {
         $plugins = $this->plugin->GetPage(array('isshow' => 0));
         foreach ($plugins as $k => $v) {
             $v['isinstalled'] = 1;
             $pluginlist[] = $v;
         }
         $plugins = $this->_getAllPlugins();
         foreach ($plugins as $k => $v) {
             $v['isinstalled'] = 0;
             $pluginlist[] = $v;
         }
         write('plugins', $pluginlist);
     } else {
         $pluginlist = read('plugins');
     }
     include ROOT_PATH . '/views/admin/plugin.php';
 }
$objPHPPresentation = new PhpPresentation();
// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPresentation->getProperties()->setCreator('PHPOffice')->setLastModifiedBy('PHPPresentation Team')->setTitle('Sample 03 Title')->setSubject('Sample 03 Subject')->setDescription('Sample 03 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$currentSlide = $objPHPPresentation->getActiveSlide();
// Create a shape (drawing)
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')->setDescription('PHPPresentation logo')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shape = $currentSlide->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
// Save serialized file
$basename = basename(__FILE__, '.php');
echo date('H:i:s') . ' Write to serialized format' . EOL;
$objWriter = IOFactory::createWriter($objPHPPresentation, 'Serialized');
$objWriter->save('results/' . basename(__FILE__, '.php') . '.phppt');
// Read from serialized file
echo date('H:i:s') . ' Read from serialized format' . EOL;
$objPHPPresentationLoaded = IOFactory::load('results/' . basename(__FILE__, '.php') . '.phppt');
// Save file
echo write($objPHPPresentationLoaded, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
Example #22
0
        }
    }
}
$pmtitle = htmlspecialchars($pm['title']);
//sender's custom title overwrites this below, so save it here
MakeCrumbs(array("Main" => "./", "Private messages" => "private.php", $pmtitle => ""), $links);
$pm['num'] = "preview";
$pm['posts'] = $user['posts'];
$pm['id'] = "???";
$pm['uid'] = $user['id'];
$copies = explode(",", "title,name,displayname,picture,sex,powerlevel,avatar,postheader,signature,signsep,regdate,lastactivity,lastposttime");
foreach ($copies as $toCopy) {
    $pm[$toCopy] = $user[$toCopy];
}
if ($draftEditor) {
    write("\n\t<script type=\"text/javascript\">\n\t\t\twindow.addEventListener(\"load\",  hookUpControls, false);\n\t</script>\n");
    $qUser = "******" . $pm['userto'];
    $rUser = Query($qUser);
    if (!NumRows($rUser)) {
        if ($_POST['action'] == __("Send")) {
            Kill(__("Unknown user."));
        }
    }
    $user = Fetch($rUser);
    if ($_POST['action'] == __("Preview")) {
        $pm['text'] = $_POST['text'];
        $pmtitle = $_POST['title'];
    }
    if ($_POST['action'] == __("Discard Draft")) {
        Query("delete from pmsgs where id = " . $pmid);
        Query("delete from pmsgs_text where pid = " . $pmid);
#
#
#
#
#
#
#
#
# get settings
require "../settings.php";
require "../core-settings.php";
# decide what to do
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "cancel":
            $OUTPUT = write($_POST);
            break;
        default:
            # Display default output
            if (isset($_GET['cashid'])) {
                $OUTPUT = confirm($_GET['cashid']);
            } else {
                $OUTPUT = "<li class=err> Invalid use of mudule";
            }
    }
} else {
    # Display default output
    if (isset($_GET['cashid'])) {
        $OUTPUT = confirm($_GET['cashid']);
    } else {
        $OUTPUT = "<li class=err> Invalid use of mudule";
Example #24
0
     $_SESSION['username'] = $_POST['username'];
     $_SESSION['email'] = $_POST['email'];
     $_SESSION['password'] = $_POST['password'];
     echo 200;
     break;
 case 1:
     if (isset($_SESSION['organization'])) {
         $params = $params . '&username='******'organization'] . '&email=' . $_SESSION['email'] . '&password='******'password'];
         write("case 1-creating organization:\n" . $params);
         //TODO remove test case
         echo 200;
         // testing only
         // createOrgAccount();
     } else {
         $params = $params . '&firstname=' . $_SESSION['firstname'] . '&lastname=' . $_SESSION['lastname'] . '&username='******'username'] . '&email=' . $_SESSION['email'] . '&password='******'password'];
         write("case 1-creating single user:\n" . $params);
         //TODO remove test
         echo 200;
         // testing only
         // createUser($params);
     }
     break;
 case 2:
     // login
     if (isset($_POST['email'], $_POST['password'])) {
         login($params);
     }
     break;
 case 3:
     // create event
     echo 'test';
Example #25
0
/**
 * Execute commands on local machine.
 * @param string $command Command to run locally.
 * @param int $timeout (optional) Override process command timeout in seconds.
 * @return Result Output of command.
 * @throws \RuntimeException
 */
function runLocally($command, $timeout = 60)
{
    $command = env()->parse($command);
    if (isVeryVerbose()) {
        writeln("<comment>Run locally</comment>: {$command}");
    }
    $process = new Symfony\Component\Process\Process($command);
    $process->setTimeout($timeout);
    $process->run(function ($type, $buffer) {
        if (isDebug()) {
            if ('err' === $type) {
                write("<fg=red>></fg=red> {$buffer}");
            } else {
                write("<fg=green>></fg=green> {$buffer}");
            }
        }
    });
    if (!$process->isSuccessful()) {
        throw new \RuntimeException($process->getErrorOutput());
    }
    return new Result($process->getOutput());
}
<?php

include_once 'Sample_Header.php';
// New Word Document
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true);
//1.Use EastAisa FontStyle
$section->addText(htmlspecialchars('中文楷体样式测试'), array('name' => '楷体', 'size' => 16, 'color' => '1B2232'));
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}
function handle_dead_resource_channel($resource)
{
    global $msgsock;
    if (!is_resource($resource)) {
        return;
    }
    $cid = get_channel_id_from_resource($resource);
    if ($cid === false) {
        my_print("Resource has no channel: {$resource}");
        # Make sure the provided resource gets closed regardless of it's status
        # as a channel
        remove_reader($resource);
        close($resource);
    } else {
        my_print("Handling dead resource: {$resource}, for channel: {$cid}");
        # Make sure we close other handles associated with this channel as well
        channel_close_handles($cid);
        # Notify the client that this channel is dead
        $pkt = pack("N", PACKET_TYPE_REQUEST);
        packet_add_tlv($pkt, create_tlv(TLV_TYPE_METHOD, 'core_channel_close'));
        packet_add_tlv($pkt, create_tlv(TLV_TYPE_REQUEST_ID, generate_req_id()));
        packet_add_tlv($pkt, create_tlv(TLV_TYPE_CHANNEL_ID, $cid));
        # Add the length to the beginning of the packet
        $pkt = pack("N", strlen($pkt) + 4) . $pkt;
        write($msgsock, $pkt);
    }
    return;
}
Example #28
0
    }
    $test = @fopen("lib/test.txt", "w");
    if ($test === FALSE) {
        Kill(format("PHP does not seem to have write access to the /{1} directory ({0}/{1}). This is required for proper functionality. Please contact your hosting provider for information on how to make that directory writable.", $_SERVER['DOCUMENT_ROOT'], "lib"), "Filesystem permission error");
    } else {
        fclose($test);
        unlink("lib/test.txt");
    }
    $test = @fopen("img/avatars/test.txt", "w");
    if ($test === FALSE) {
        Kill(format("PHP does not seem to have write access to the /{1} directory ({0}/{1}). This is required for proper functionality. Please contact your hosting provider for information on how to make that directory writable.", $_SERVER['DOCUMENT_ROOT'], "img/avatars"), "Filesystem permission error");
    } else {
        fclose($test);
        unlink("img/avatars/test.txt");
    }
    write("\n\t<form action=\"install.php\" method=\"post\">\n\t\t<table class=\"outline margin width50\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\tInstallation options\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t<label for=\"dbs\">Database server</label>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell0\">\n\t\t\t\t\t<input type=\"text\" id=\"dbs\" name=\"dbserv\" style=\"width: 98%;\" value=\"{0}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t<label for=\"dbn\">Database name</label>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell0\">\n\t\t\t\t\t<input type=\"text\" id=\"dbn\" name=\"dbname\" style=\"width: 98%;\" value=\"{3}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t<label for=\"dun\">Database user name</label>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell1\">\n\t\t\t\t\t<input type=\"text\" id=\"dun\" name=\"dbuser\" style=\"width: 98%;\" value=\"{1}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t<label for=\"dpw\">Database user password</label>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell1\">\n\t\t\t\t\t<input type=\"password\" id=\"dpw\" name=\"dbpass\" style=\"width: 98%;\" value=\"{2}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\tOptions\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell1\">\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"b\" name=\"addbase\" />\n\t\t\t\t\t\tAdd starting forums and the usual Super Mario rankset\n\t\t\t\t\t</label>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"Install\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t<strong>Warning</strong> &mdash;\n\t\t\t\t\tWhen updating, <em>back up your database</em> before you press the \"Install\" button and don't check the \"add starting forums\" box.\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n", $dbserv, $dbuser, $dbpass, $dbname);
} else {
    if ($_POST['action'] == "Install") {
        print "<div class=\"outline faq\">";
        print "Trying to connect to database&hellip;<br />";
        $dbserv = $_POST['dbserv'];
        $dbuser = $_POST['dbuser'];
        $dbpass = $_POST['dbpass'];
        $dbname = $_POST['dbname'];
        //2005: no such server
        //1045: no such user
        @mysql_connect($dbserv, $dbuser, $dbpass) or Kill(mysql_errno() == 2005 ? format("Could not connect to any database server at {0}. Usually, the database server runs on the same system as the web server, in which case \"localhost\" would suffice. If not, the server could be (temporarily) offline, nonexistant, or maybe you entered a full URL instead of just a hostname (\"http://www.mydbserver.com\" instead of just \"mydb.com\").", $dbserv) : format("The database server has rejected your username and/or password."), "Database connectivity error");
        mysql_select_db($dbname) or Kill(format("Could not select database \"{0}\". Even though we could connect to the database server, there does not seem to be a database by that name on that server. Perhaps you forgot to add it before trying to install?", $dbname), "Database selection error");
        print "Writing database configuration file&hellip;<br />";
        $dbcfg = @fopen("lib/database.php", "w+") or Kill(format("Could not open \"lib/{0}.php\" for writing. This has been checked for earlier, so if you see this error now, something very strange is going on.", "database"), "Mysterious filesystem permission error");
        fwrite($dbcfg, "<?php\n");
Example #29
0
</div>
				<div graph id=graph5><?php 
write('#loading');
?>
</div>
				<div graph id=graph6><?php 
write('#loading');
?>
</div>
				<!---->
				<div graph id=graph7><?php 
write('#loading');
?>
</div>
				<div graph id=graph8><?php 
write('#loading');
?>
</div>
				<!---->
				<div style="width:98%;padding:1em 0;margin-bottom:1em;border:none">
					For further details on energy consumption &amp; opportunities to reduce GHG emissions go to 
					<b>Detailed GHG Assessment</b> (<a href=#>&uarr;</a>)
				</div>
				<script>
					(function(){
						//hide inactive graphs
						if(Global.Configuration.ActiveStages.water==0)
						{
							document.querySelector("#graph3").style.display="none"
							document.querySelector("#graph5").style.display="none"
							document.querySelector("#graph7").style.display="none"
$shape1 = clone $shape;
$shape1->getLegend()->setVisible(false);
$shape1->setName('PHPPowerPoint Weekly Downloads');
$shape1->getTitle()->setText('PHPPowerPoint Weekly Downloads');
$shape1->getPlotArea()->setType($lineChart1);
$shape1->getPlotArea()->getAxisY()->setFormatCode('#,##0');
$currentSlide->addShape($shape1);
// Create templated slide
echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
$currentSlide = createTemplatedSlide($objPHPPowerPoint);
// Create a line chart (that should be inserted in a shape)
echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL;
$lineChart2 = clone $lineChart;
$series2 = $lineChart2->getData();
$series2[0]->getFill()->setFillType(Fill::FILL_SOLID);
$lineChart2->setData($series2);
// Create a shape (chart)
echo date('H:i:s') . ' Create a shape (chart)' . EOL;
echo date('H:i:s') . ' Differences with previous : Values on right axis and Legend hidden' . EOL;
$shape2 = clone $shape;
$shape2->getLegend()->setVisible(false);
$shape2->setName('PHPPowerPoint Weekly Downloads');
$shape2->getTitle()->setText('PHPPowerPoint Weekly Downloads');
$shape2->getPlotArea()->setType($lineChart2);
$shape2->getPlotArea()->getAxisY()->setFormatCode('#,##0');
$currentSlide->addShape($shape2);
// Save file
echo EOL . write($objPHPPowerPoint, basename(__FILE__, '.php'), $writers);
if (!CLI) {
    include_once 'Sample_Footer.php';
}