Example #1
0
function write_ini()
{
    unlink(CONFIG);
    $config = new Config_Lite(CONFIG);
    foreach ($_POST as $parameter => $value) {
        $splitParameter = explode('-', $parameter);
        if ($value == "on") {
            $value = "true";
        }
        $config->set($splitParameter[0], $splitParameter[1], $value);
    }
    // save object to file
    try {
        $config->save();
    } catch (Config_Lite_Exception $e) {
        echo "\n" . 'Exception Message: ' . $e->getMessage();
    }
    $cache_new = "; <?php die(\"Access denied\"); ?>";
    // Adds this to the top of the config so that PHP kills the execution if someone tries to request the config-file remotely.
    $file = CONFIG;
    // the file to which $cache_new gets prepended
    $handle = openFile($file, "r+");
    $len = strlen($cache_new);
    $final_len = filesize($file) + $len;
    $cache_old = fread($handle, $len);
    rewind($handle);
    $i = 1;
    while (ftell($handle) < $final_len) {
        fwrite($handle, $cache_new);
        $cache_new = $cache_old;
        $cache_old = fread($handle, $len);
        fseek($handle, $i * $len);
        $i++;
    }
}
Example #2
0
 public function testFilesystem()
 {
     isFileEq(__FILE__, __FILE__);
     is(openFile(__FILE__), openFile(__FILE__));
     isFile(__FILE__);
     isDir(__DIR__);
     isNotFile(__DIR__);
     isNotFile(__FILE__ . '.qwerty');
     isNotDir(__FILE__);
     isNotDir(__DIR__ . '/qwerty');
 }
Example #3
0
 /**
  * Binary save to open file
  * @param $path
  * @return null|string
  * @deprecated See openFile()
  */
 public function openFile($path)
 {
     return openFile($path);
     // @codeCoverageIgnore
 }
<?php

function openFile($fileName)
{
    $handle = fopen($fileName, 'rb');
    if ($handle == false) {
        throw new Exception();
    }
    while (feof($handle) === false) {
        (yield fgetcsv($handle));
    }
    fclose($handle);
}
foreach (openFile('../files/rootkey.csv') as $value) {
    print_r($value);
}
Example #5
0
    listCurrentPath();
} else {
    if ($command == "upload") {
        printUploadFile();
    } else {
        if ($command == "doupload") {
            doUpload();
        } else {
            if ($command == "delete") {
                confirmDelete();
            } else {
                if ($command == "dodelete") {
                    doDelete();
                } else {
                    if ($command == "open") {
                        openFile();
                    } else {
                        if ($command == "mkdir") {
                            printMkDir();
                        } else {
                            if ($command == "domkdir") {
                                doMkDir();
                            } else {
                                if ($command == "chacl") {
                                    $path = @$_POST["pathname"];
                                    if (!is_array($path) || !isset($path[0]) || $path[0] == "") {
                                        echo "Bitte w&auml;hlen Sie ein Verzeichnis aus, dessen ACL Sie editieren wollen";
                                        listCurrentPath();
                                    } else {
                                        handleChacl(@$_POST["pathname"][0], @$_POST["subcmd"]);
                                    }
Example #6
0
             $RETURN['requests'][$r] = json_decode('{"argonError":"pool not authenticated"}');
         }
     } else {
         $RETURN['requests'][$r] = json_decode('{"argonError":"pool does not exist"}');
     }
 } else {
     if ($REQUEST['action'] === "set pool permissions" && action_allowed($REQUEST['action'], $user_authenticated)) {
         $name = $REQUEST['name'];
         $password = $REQUEST['password'];
         $permissions = $REQUEST['permissions'];
         if (file_exists("{$directory}/pools/{$name}.json")) {
             if (openFile("{$directory}/pools/{$name}.json", "password") === $password) {
                 //*** ACTION ***
                 $owner = openFile("{$directory}/pools/{$name}.json", 'owner');
                 if ($owner === $USERNAME) {
                     $prev_permissions = openFile("{$directory}/pools/{$name}.json", "permissions");
                     if ($prev_permissions === null) {
                         $prev_permissions = array();
                     }
                     foreach ($permissions as $permission => $permissionD) {
                         $prev_permissions[$permission] = $permissions[$permission];
                     }
                     saveFile("{$directory}/pools/{$name}.json", $prev_permissions, "permissions");
                     $RETURN['requests'][$r] = json_decode('{"argonError":"updated permissions for pool"}');
                 } else {
                     $RETURN['requests'][$r] = json_decode('{"argonError":"the owner must update permissions for a pool"}');
                 }
                 //*** ACTION ***
             } else {
                 $RETURN['requests'][$r] = json_decode('{"argonError":"pool not authenticated"}');
             }
                                                                        }
                                                                    }
                                                                } else {
                                                                    echo '{"cenError":"' . $action . ' is not a valid action"}';
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - /
    }
    //close authentication if statement
    //########################################################################################################################
} else {
    // userName or groupName invalid
    echo '{"cenError":"username or groupname invalid"}';
}
//for debugging
$requests = openFile("{$directory}/requests.txt", 40000);
$requests++;
saveFile("{$directory}/requests.txt", $requests);
Example #8
0
	    <script type="text/javascript" src="https://www.google.com/jsapi"></script>

		<!--<script type="text/javascript"></script>-->
	</head>


	<!-- ~~~~~~~~~~~~~~~~~~~~ PHP Starts~~~~~~~~~~~~~~~~	 -->
	<?php 
include 'PHP/process.php';
if (isset($_POST['value'])) {
    $twitterHandle = $_POST['value'];
    search($twitterHandle);
}
if (isset($_GET['search'])) {
    $twitterHandle = $_GET['search'];
    openFile("Cache Files/cache" . $twitterHandle . ".txt");
}
//finished processing all rows; if we're connected to the google packages then render the graph
echo "<script text=\"text/javascript\">\n\t\t\t\tif(doneLoadingGoogle)\n\t\t\t\t\tdrawChart();\n\t\t\t\telse{\n\t\t\t\t\tdoneLoadingRows = true;\n\t\t\t\t}\n\t\t\t  </script>";
?>
	<!-- ~~~~~~~~~~~~~~~~~~ HTML Starts ~~~~~~~~~~~~~~~~~~~ -->

	<body>
		<div id="clouds">
			<div class="site-wrapper">

		      <div class="site-wrapper-inner">

		        <div class="cover-container">
		        <!--
		          POTENTIALLY USEFUL NAVBAR CODE
Example #9
0
        }
    } else {
        redirect(FUSION_SELF . $aidlink . "&amp;status=se&amp;error=" . $error);
    }
}
opentable($locale['400']);
if (file_exists(BASEDIR . "robots.txt")) {
    $file = BASEDIR . "robots.txt";
    echo "<form name='robotsform' method='post' action='" . FUSION_SELF . $aidlink . "'>\n";
    echo "<table class='tbl-border center' cellpadding='1' cellspacing='0' style='width:460px;'>\n";
    echo "<tr>\n";
    echo "<td class='tbl2' style='text-align:center;font-weight:bold;'>" . $locale['420'] . "</td>\n";
    echo "</tr>\n<tr>\n";
    echo "<td class='tbl1' style='text-align:center;'><a href='http://www.robotstxt.org/' target='_blank'>" . $locale['421'] . "</a></td>\n";
    echo "</tr>\n<tr>\n";
    echo "<td class='tbl1' style='text-align:center;'>";
    echo "<textarea name='robots_content' class='textbox' rows='20' cols='40' style='width:100%;'>" . openFile($file, "READ") . "</textarea>";
    echo "</td>\n";
    echo "</tr>\n<tr>\n";
    echo "<td class='tbl1' style='text-align:center;'>";
    echo "<input type='submit' name='save_robots' class='button' value='" . $locale['422'] . "' />\n";
    echo "<input type='submit' name='set_default' class='button' value='" . $locale['423'] . "' onclick=\"return confirm('" . $locale['410'] . "');\" />\n";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
    echo "</form>\n";
} else {
    echo "<div class='admin-message'>" . $locale['411'] . "</div>\n";
}
closetable();
require_once THEMES . "templates/footer.php";
Example #10
0
/**
 * writes sitemap to file
 */
function writeSitemap($FILE)
{
    global $SETTINGS, $openFile_error, $LAYOUT;
    $LAYOUT->setTitle("Writing sitemap");
    $gsg = new GsgXml($SETTINGS[PSNG_WEBSITE]);
    $numb = 0;
    $txtfilehandle = null;
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $txtfilehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_TXTSITEMAP_FILE], TRUE);
        if ($txtfilehandle === FALSE) {
            $LAYOUT->addError($openFile_error, 'Could not write sitemap');
            return FALSE;
        }
    }
    foreach ($FILE as $numb => $value) {
        if ($value[PSNG_FILE_ENABLED] != '') {
            debug($value, "Adding file " . $value[PSNG_FILE_URL]);
            if (isset($txtfilehandle)) {
                fputs($txtfilehandle, $value[PSNG_FILE_URL] . "\n");
            }
            if ($gsg->addUrl($value[PSNG_FILE_URL], FALSE, $value[PSNG_LASTMOD], FALSE, $value[PSNG_CHANGEFREQ], $value[PSNG_PRIORITY]) === FALSE) {
                $LAYOUT->addError($value[PSNG_FILE_URL], 'Could not add file to sitemap' . $gsg->errorMsg);
            }
        } else {
            debug($value[PSNG_FILE_URL], 'Not enabled, so not writing file to sitemap');
        }
    }
    $filehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_SITEMAP_FILE], TRUE);
    if ($filehandle === FALSE) {
        $LAYOUT->addError($openFile_error, 'Could not write sitemap');
        return FALSE;
    }
    $xml = $gsg->output(TRUE, $SETTINGS[PSNG_COMPRESS_SITEMAP], FALSE);
    fputs($filehandle, $xml);
    fclose($filehandle);
    if (isset($txtfilehandle)) {
        fclose($txtfilehandle);
    }
    if ($numb > 50000) {
        $LAYOUT->addWarning('Not implemented: split result into files with only 50000 entries', 'Only 50000 entries are allowed in one sitemap file at the moment!');
    }
    $LAYOUT->addSuccess('Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_SITEMAP_URL] . '" target="_blank">' . basename($SETTINGS[PSNG_SITEMAP_FILE]) . '</a>!');
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $LAYOUT->addSuccess('Txt-Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_TXTSITEMAP_URL] . '" target="_blank">' . basename($SETTINGS[PSNG_TXTSITEMAP_FILE]) . '</a>!');
    }
    $LAYOUT->addText('<form action="' . $SETTINGS[PSNG_SCRIPT] . '" method="post">' . "\n" . '<input type="hidden" name="' . PSNG_SETTINGS_ACTION . '" value="' . PSNG_ACTION_SETTINGS_PINGGOOGLE . '">' . "\n" . '<input type="Submit" value="Submit to google" name="submit">' . "\n" . '</form>' . "\n");
    return TRUE;
}
Example #11
0
/**
 * writes sitemap to file
 */
function writeSitemap($FILE)
{
    global $SETTINGS, $openFile_error, $LAYOUT;
    $LAYOUT->setTitle("Writing sitemap");
    $numb = 0;
    $txtfilehandle = null;
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $txtfilehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_TXTSITEMAP_FILE], TRUE);
        if ($txtfilehandle === FALSE) {
            $LAYOUT->addError($openFile_error, 'Could not write sitemap');
            return FALSE;
        }
    }
    foreach ($FILE as $numb => $value) {
        if ($value[PSNG_FILE_ENABLED] != '') {
            debug($value, "Adding file " . $value[PSNG_FILE_URL]);
            if (isset($txtfilehandle)) {
                fputs($txtfilehandle, $value[PSNG_FILE_URL] . "\n");
            }
        } else {
            debug($value[PSNG_FILE_URL], 'Not enabled, so not writing file to sitemap');
        }
    }
    $filehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_SITEMAP_FILE], TRUE);
    if ($filehandle === FALSE) {
        $LAYOUT->addError($openFile_error, 'Could not write sitemap');
        return FALSE;
    }
    if (isset($txtfilehandle)) {
        fclose($txtfilehandle);
    }
    if ($numb > 50000) {
        $LAYOUT->addWarning('Not implemented: split result into files with only 50000 entries', 'Only 50000 entries are allowed in one sitemap file at the moment!');
    }
    include_once 'apps/app_sitemap/settings/files.inc.php';
    /* Di Modifikasi oleh Fiyo Dev. */
    $student_info = $FILES;
    // creating object of SimpleXMLElement
    // function defination to convert array to xml
    function array_to_xml($student_info, &$xml_student_info)
    {
        $no = 0;
        foreach ($student_info as $key => $value) {
            if (is_array($value)) {
                if (!is_numeric($key)) {
                    $subnode = $xml_student_info->addChild("{$key}");
                    array_to_xml($value, $subnode);
                } else {
                    $subnode = $xml_student_info->addChild("url");
                    array_to_xml($value, $subnode);
                }
            } else {
                if ($key == 'file_enabled' and $value == 1) {
                    continue;
                }
                if ($key == 'file_url') {
                    $key = 'loc';
                }
                $xml_student_info->addChild("{$key}", htmlspecialchars("{$value}"));
            }
            $no++;
        }
    }
    $xml_student_info = new SimpleXMLElement("<?xml version=\"1.0\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"></urlset>");
    array_to_xml($student_info, $xml_student_info);
    /* Di Modifikasi oleh Fiyo Dev. */
    $myfile = fopen("../" . $SETTINGS[PSNG_SITEMAP_FILE], "w") or die("Unable to open file!");
    fwrite($myfile, $xml_student_info->asXML());
    fclose($myfile);
    $LAYOUT->addSuccess('Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_CRAWLER_URL] . $SETTINGS[PSNG_SITEMAP_URL] . '" target="_blank">' . basename($SETTINGS[PSNG_SITEMAP_FILE]) . '</a>!');
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $LAYOUT->addSuccess('Txt-Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_CRAWLER_URL] . $SETTINGS[PSNG_TXTSITEMAP_FILE] . '" target="_blank">' . basename($SETTINGS[PSNG_TXTSITEMAP_FILE]) . '</a>!');
    }
    $LAYOUT->addText('<form action="?app=sitemap&action=' . PSNG_ACTION_SETTINGS_PINGGOOGLE . '" method="post" class="sitemap-wrap>' . "\n" . '<input type="hidden" name="' . PSNG_SETTINGS_ACTION . '" value="' . PSNG_ACTION_SETTINGS_PINGGOOGLE . '">' . "\n" . '<button type="Submit" value="Submit to Google" class="btn btn-primary" name="submit" class="button" style="margin:5px 0;">Submit to Google</button>' . "\n" . '</form>' . "\n");
    return TRUE;
}
/**
 * writes sitemap to file
 */
function writeSitemap($FILE)
{
    global $SETTINGS, $openFile_error, $LAYOUT;
    $LAYOUT->setTitle("Writing sitemap");
    $website = $SETTINGS[PSNG_WEBSITE];
    if (substr($website, -1, 1) == '/') {
        $website = substr($website, 0, strlen($website) - 1);
    }
    $numb = 0;
    $txtfilehandle = null;
    $htmlfilehandle = null;
    if (isset($SETTINGS[PSNG_SITEMAP_FILE]) && strlen($SETTINGS[PSNG_SITEMAP_FILE]) > 0) {
        $gsg = new GsgXml($SETTINGS[PSNG_WEBSITE]);
        $gsg->setGssHeader($SETTINGS[PSNG_GSSHEADER] == 1);
        // set usage of gss header
    }
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $txtfilehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_TXTSITEMAP_FILE], TRUE);
        if ($txtfilehandle === FALSE) {
            $LAYOUT->addError($openFile_error, 'Could not write txt sitemap file');
        }
    }
    if (isset($SETTINGS[PSNG_HTMLSITEMAP_FILE]) && strlen($SETTINGS[PSNG_HTMLSITEMAP_FILE]) > 0) {
        $htmlfilehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_HTMLSITEMAP_FILE], TRUE);
        if ($htmlfilehandle === FALSE) {
            $LAYOUT->addError($openFile_error, 'Could not write html sitemap file');
        }
    }
    if (isset($SETTINGS[PSNG_RSSSITEMAP_FILE]) && strlen($SETTINGS[PSNG_RSSSITEMAP_FILE]) > 0) {
        $rss = new UniversalFeedCreator();
        $rss->useCached();
        $rss->title = "Sitemap of " . $SETTINGS[PSNG_WEBSITE];
        // TODO use description?
        //$rss->description = "daily news from the PHP scripting world";
        $rss->link = $SETTINGS[PSNG_WEBSITE];
        $rss->syndicationURL = $SETTINGS[PSNG_WEBSITE] . $SETTINGS[PSNG_RSSSITEMAP_FILE];
        // TODO use image ???
        /*
        $image = new FeedImage();
        $image->title = "dailyphp.net logo";
        $image->url = "http://www.dailyphp.net/images/logo.gif";
        $image->link = "http://www.dailyphp.net";
        $image->description = "Feed provided by dailyphp.net. Click to visit.";
        $rss->image = $image;
        */
    }
    foreach ($FILE as $numb => $value) {
        if ($value[PSNG_FILE_ENABLED] != '') {
            debug($value, "Adding file " . $value[PSNG_FILE_URL]);
            if (isset($txtfilehandle)) {
                fputs($txtfilehandle, $value[PSNG_FILE_URL] . "\n");
            }
            if (isset($SETTINGS[PSNG_RSSSITEMAP_FILE]) && strlen($SETTINGS[PSNG_RSSSITEMAP_FILE]) > 0) {
                $item = new FeedItem();
                $item->title = $value[PSNG_FILE_TITLE];
                $item->link = $value[PSNG_FILE_URL];
                //$item->description = $data->short;
                $item->date = $value[PSNG_FILE_LASTMOD];
                //$item->source = "http://www.dailyphp.net";
                //$item->author = "John Doe";
                $rss->addItem($item);
            }
            if (isset($htmlfilehandle)) {
                // todo handle this in an external class (takes the urls and titles, writes a nice and clean sitemap file)
                fputs($htmlfilehandle, '<a href="' . $value[PSNG_FILE_URL] . '" title="' . $value[PSNG_FILE_TITLE] . '">' . $value[PSNG_FILE_TITLE] . '</a><br />' . "\n");
            }
            if (isset($SETTINGS[PSNG_SITEMAP_FILE]) && strlen($SETTINGS[PSNG_SITEMAP_FILE]) > 0) {
                if ($gsg->addUrl($value[PSNG_FILE_URL], FALSE, $value[PSNG_LASTMOD], FALSE, $value[PSNG_CHANGEFREQ], $value[PSNG_PRIORITY]) === FALSE) {
                    $LAYOUT->addError($value[PSNG_FILE_URL], 'Could not add file to sitemap' . $gsg->errorMsg);
                }
            }
        } else {
            debug($value[PSNG_FILE_URL], 'Not enabled, so not writing file to sitemap');
        }
    }
    if (isset($SETTINGS[PSNG_SITEMAP_FILE]) && strlen($SETTINGS[PSNG_SITEMAP_FILE]) > 0) {
        $filehandle = openFile($SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_SITEMAP_FILE], TRUE);
        if ($filehandle === FALSE) {
            $LAYOUT->addError($openFile_error, 'Could not write xml sitemap');
            return FALSE;
        }
        $xml = $gsg->output(TRUE, $SETTINGS[PSNG_COMPRESS_SITEMAP], FALSE);
        fputs($filehandle, $xml);
        fclose($filehandle);
    }
    if (isset($txtfilehandle)) {
        fclose($txtfilehandle);
    }
    if (isset($htmlfilehandle)) {
        fclose($htmlfilehandle);
    }
    if (isset($SETTINGS[PSNG_RSSSITEMAP_FILE]) && strlen($SETTINGS[PSNG_RSSSITEMAP_FILE]) > 0) {
        $rss->saveFeed("RSS1.0", $SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_RSSSITEMAP_FILE], false);
    }
    if (isset($SETTINGS[PSNG_HTMLSITEMAP_FILE]) && strlen($SETTINGS[PSNG_HTMLSITEMAP_FILE]) > 0) {
        $rss->saveFeed("HTML", $SETTINGS[PSNG_PAGEROOT] . $SETTINGS[PSNG_HTMLSITEMAP_FILE], false);
    }
    if ($numb > 50000) {
        $LAYOUT->addWarning('Not implemented: split result into files with only 50000 entries', 'Only 50000 entries are allowed in one sitemap file at the moment!');
    }
    $LAYOUT->addSuccess('Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_SITEMAP_URL] . '" target="_blank">' . basename($SETTINGS[PSNG_SITEMAP_FILE]) . '</a>!');
    if (isset($SETTINGS[PSNG_TXTSITEMAP_FILE]) && strlen($SETTINGS[PSNG_TXTSITEMAP_FILE]) > 0) {
        $LAYOUT->addSuccess('Txt-Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_TXTSITEMAP_FILE] . '" target="_blank">' . basename($SETTINGS[PSNG_TXTSITEMAP_FILE]) . '</a>!');
    }
    if (isset($SETTINGS[PSNG_HTMLSITEMAP_FILE]) && strlen($SETTINGS[PSNG_HTMLSITEMAP_FILE]) > 0) {
        $LAYOUT->addSuccess('HTML-Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_HTMLSITEMAP_FILE] . '" target="_blank">' . basename($SETTINGS[PSNG_HTMLSITEMAP_FILE]) . '</a>!');
    }
    if (isset($SETTINGS[PSNG_RSSSITEMAP_FILE]) && strlen($SETTINGS[PSNG_RSSSITEMAP_FILE]) > 0) {
        $LAYOUT->addSuccess('RSS-Sitemap successfuly created and saved to <a href="' . $SETTINGS[PSNG_RSSSITEMAP_FILE] . '" target="_blank">' . basename($SETTINGS[PSNG_RSSSITEMAP_FILE]) . '</a>!');
    }
    $LAYOUT->addText('<form action="' . $SETTINGS[PSNG_SCRIPT] . '" method="post">' . "\n" . '<input type="hidden" name="' . PSNG_SETTINGS_ACTION . '" value="' . PSNG_ACTION_SETTINGS_PINGGOOGLE . '">' . "\n" . '<input type="Submit" value="Submit to search engines" name="submit">' . "\n" . '</form>' . "\n");
    return TRUE;
}
Example #13
0
            $defender->addNotice($locale['415']);
        }
    }
}
opentable($locale['400']);
$file = BASEDIR . "robots.txt";
if (!file_exists($file)) {
    $defender->stop();
    $defender->addNotice($locale['411']);
}
echo openform('robotsform', 'robotsform', 'post', FUSION_SELF . $aidlink, array('downtime' => 0));
echo "<table class='table table-responsive tbl-border center'>\n<tbody>\n";
echo "<tr>\n";
echo "<td class='tbl2' style='text-align:center;font-weight:bold;'>" . $locale['420'] . "</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' style='text-align:center;'><a href='http://www.robotstxt.org/' target='_blank'>" . $locale['421'] . "</a></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' style='text-align:center;'>\n";
echo form_textarea('', 'robots_content', 'robots_content', openFile($file, 'READ'));
echo "</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' style='text-align:center;'>";
echo form_button($locale['422'], 'save_robots', 'save_robots', $locale['422'], array('class' => 'btn-primary m-r-10'));
echo form_button($locale['423'], 'set_default', 'set_default', $locale['423'], array('class' => 'btn-primary'));
add_to_jquery("\r\n    \$('#set_default').bind('click', function() { confirm('" . $locale['410'] . "'); });\r\n    ");
echo "</td>\n";
echo "</tr>\n";
echo "</tbody>\n</table>\n";
echo closeform();
closetable();
require_once THEMES . "templates/footer.php";
function packFile($dir)
{
    $newdir = analyseDir($dir);
    if (!$newdir) {
        return;
    }
    //print '//'.$newdir."\n";
    $f = openFile($newdir);
    global $CORELIST;
    global $bindjs;
    foreach ($f as $i => $k) {
        $newLine = findImport($k);
        //echo $newLine;
        $isHasMethod = 0;
        if ($newLine) {
            foreach ($CORELIST as $y) {
                if ($y == $newLine) {
                    $isHasMethod = 1;
                    break;
                }
            }
            if ($isHasMethod == 0) {
                array_push($CORELIST, $newLine);
                // print($newLine);
                //$o = analyseDir($newLine);
                // print($o);
                if ($newLine) {
                    packFile($newLine);
                } else {
                    return array_push($CORELIST, '这里打包出错');
                }
            }
        } else {
            array_push($bindjs, $k);
            if ($i == count($f) - 1) {
                array_push($bindjs, "\n");
            }
        }
    }
}
	            <span style="margin-left:54px">
	                <input type="text" name="location" placeholder="Enter Your Location">
	            </span><br><br>

	            <br>
	            <button type="submit" name="search" value="search" style="margin-left:372px; width:100px">
	                <span style="font:status-bar; font-size:20px">Search</span>
	            </button> 
	        </div>
     	</form> 

		<?php 
if (isset($_POST["search"])) {
    if ($_POST["jobName"] != "" || $_POST["jobID"] != "" || $_POST["location"] != "") {
        /* open file to search */
        $file_pointer = openFile("data.txt", "r");
        /* read info */
        $jobs = readFileFromData($file_pointer);
        /* initialize search requirements */
        $jobName = $_POST["jobName"] != "" ? $_POST["jobName"] : "";
        $jobID = $_POST["jobID"] != "" ? $_POST["jobID"] : "";
        $location = $_POST["location"] != "" ? $_POST["location"] : "";
        $jobName = htmlentities($jobName);
        $jobID = htmlentities($jobID);
        $jobID = str_pad($jobID, 6, '0', STR_PAD_LEFT);
        $location = htmlentities($location);
        if (!is_string($jobName) || !preg_match("/[0-9]*/", $jobID) || strlen($jobID) > 6 || !is_string($location)) {
            print "<p>Invalid input!</p>";
            exit;
        }
        if ($jobName != "" && strlen($jobName) > 15) {
}
for ($i = 0; $i < count($jobs); $i++) {
    if (isset($_POST["job{$i}"])) {
        if ($isLogined === "false") {
            break;
        }
        $file_pointer = openFile("usr_cart/usr_{$usn}.txt", 'a+');
        if (isJobExisted($file_pointer, $jobs[$i])) {
            print "<p>The job has already existed.</p>";
        } else {
            $file_pointer = openFile("usr_cart/usr_{$usn}.txt", 'a+');
            $line = implode("\t", $jobs[$i]);
            $line = "\n" . $line;
            writeFileAtEnd($file_pointer, $line);
        }
        $file_pointer = openFile("usr_cart/usr_{$usn}.txt", 'r');
        $lines = readFileFromData($file_pointer);
        drawTableWithoutAdd($lines);
        break;
    }
}
if ($isLogined === "true") {
    echo "<script> document.getElementById('welcome').innerHTML = 'Welcome, {$usn}'; </script>";
} else {
    echo "<script> document.getElementById('welcome').innerHTML = 'You are currently a guest. Please login or register ASAP.'; </script>";
}
//print("<p>No Login</p>");
?>
		</tbody>
	</table>
Example #17
0
                if (preg_match('#' . $filter . '#iu', $path)) {
                    $results[] = realpath($path);
                }
            } else {
                $results[] = realpath($path);
            }
        } elseif (is_dir($path) && !in_array($value, $config['exclude'], true)) {
            getFileList($path, $filter, $results);
        }
    }
    return $results;
}
/********** Replace all files *****************************************************************************************/
$list = getFileList($config['root']);
foreach ($list as $file) {
    $content = openFile($file);
    foreach ($config['defines'] as $const => $value) {
        $content = str_replace($const, $value, $content);
    }
    if (strpos($file, 'Makefile')) {
        $regexp = '/\\n# Cutline.*/ius';
        $content = preg_replace($regexp, '', $content);
    }
    if (strpos($file, '.travis.yml')) {
        $content = str_replace("  - make new-project NAME=Rulezzz\n", '', $content);
    }
    file_put_contents($file, $content);
}
/********** Change Readme file ****************************************************************************************/
rename($config['root'] . '/README.dist.md', $config['root'] . '/README.md');
/********** Self-destruction ******************************************************************************************/
 function save($method = "insert", $table = false, $data = false, $condition = false, $debug = false)
 {
     // $method = $param['method'];
     // $action = $param['action'];
     global $dbConfig;
     $mysql = 1;
     if ($dbConfig[0]['server'] == 'mssql' or $dbConfig[0]['server'] == 'sqlsrv') {
         $mysql = 0;
     }
     $filepath = CACHE . 'table/';
     if ($table) {
         if (is_array($table)) {
         } else {
             $openFile = openFile($filepath . $table);
             $tablestructure = $this->unserialTable($openFile);
             if ($data) {
                 foreach ($data as $key => $value) {
                     if (in_array($key, $tablestructure['fields'])) {
                         if ($mysql) {
                             $fields[] = "`{$key}`";
                         } else {
                             $fields[] = "{$key}";
                         }
                         $values[] = "'{$value}'";
                         if ($mysql) {
                             $field_values[] = "`{$key}` = '{$value}'";
                         } else {
                             $field_values[] = "{$key} = '{$value}'";
                         }
                     }
                 }
                 $impFields = implode(',', $fields);
                 $impValues = implode(',', $values);
                 $impfield_values = implode(',', $field_values);
                 if ($method == 'insert') {
                     $sql = array('table' => "{$table}", 'field' => "{$impFields}", 'value' => "{$impValues}");
                     $runmethod = 1;
                 } else {
                     if ($method == 'update') {
                         $sql = array('table' => "{$table}", 'field' => "{$impfield_values}", 'condition' => "{$condition}");
                         $runmethod = 2;
                     }
                 }
                 $result = $this->lazyQuery($sql, $debug, $runmethod);
                 if ($result) {
                     return true;
                 }
                 return false;
             }
         }
     }
 }
Example #19
0
$vars['iTime'] = 1;
$vars['ground'] = null;
$vars['moreCarrot'] = 0;
/* ** Element ** */
$vars['static'] = array();
$vars['dynamic'] = array();
$vars['prize'] = array();
$vars['turnEatRabbit'] = 0;
$vars['turnEatWolf'] = 0;
$vars['turnSleepRabbit'] = 0;
$vars['turnSleepWolf'] = 0;
/* ** File ** */
// $vars['fileConf'] = openFile('conf');
$vars['fileLog'] = openFileCSV('log');
$vars['fileWorldDraw'] = openFileCSV('world');
$vars['fileDebug'] = openFile('debug');
/* ** Statistics ** */
// Weather per day
$vars['countWeather'] = array(0, 0, 0, 0);
// Population of elements per day
$vars['amountRabbit'] = array();
$vars['amountWolf'] = array();
$vars['amountCarrot'] = array();
// Hunted rabbits per day
$vars['huntedRabbit'] = array();
// Eaten carrots per day
$vars['eatenCarrot'] = array();
// Dead rabbits and wolves for not eating
$vars['deadEatRabbit'] = array();
$vars['deadEatWolf'] = array();
// Dead rabbits and wolves for not sleeping
Example #20
0
function resetFile(&$file, &$handle)
{
    closeFile($handle);
    openFile($file, $handle);
}
Example #21
0
 function save($method = "insert", $table = false, $data = false, $condition = false, $debug = false)
 {
     // $method = $param['method'];
     // $action = $param['action'];
     $filepath = CODEKIR_TMP . 'table/';
     if ($table) {
         if (is_array($table)) {
         } else {
             $openFile = openFile($filepath . $table);
             $tablestructure = $this->unserialTable($openFile);
             if ($data) {
                 foreach ($data as $key => $value) {
                     if (in_array($key, $tablestructure['fields'])) {
                         $fields[] = $key;
                         $values[] = "'{$value}'";
                         $field_values[] = "{$key} = '{$value}'";
                     }
                 }
                 $impFields = implode(',', $fields);
                 $impValues = implode(',', $values);
                 $impfield_values = implode(',', $field_values);
                 if ($method == 'insert') {
                     $sql = array('table' => "{$table}", 'field' => "{$impFields}", 'value' => "{$impValues}");
                     $runmethod = 1;
                 } else {
                     if ($method == 'update') {
                         $sql = array('table' => "{$table}", 'field' => "{$impfield_values}", 'condition' => "{$condition}");
                         $runmethod = 2;
                     }
                 }
                 $result = $this->lazyQuery($sql, $debug, $runmethod);
                 if ($result) {
                     return true;
                 }
                 return false;
             }
         }
     }
 }
Example #22
0
            addNotice("danger", $locale['415']);
        }
    }
}
opentable($locale['400']);
$file = BASEDIR . "robots.txt";
if (!file_exists($file)) {
    $defender->stop();
    addNotice("danger", $locale['411']);
}
echo openform('robotsform', 'post', FUSION_SELF . $aidlink);
echo "<table class='table table-responsive center'>\n<tbody>\n";
echo "<tr>\n";
echo "<th class='tbl2 text-center'>" . $locale['420'] . "</th>\n";
echo "</tr>\n<tbody>\n<tr>\n";
echo "<td class='tbl1' style='text-align:center;'><a href='http://www.robotstxt.org/' target='_blank'>" . $locale['421'] . "</a></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='text-center'>\n";
echo form_textarea('robots_content', '', openFile($file, 'READ'), array('height' => "300px"));
echo "</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1' style='text-align:center;'>";
echo form_button('save_robots', $locale['422'], $locale['422'], array('class' => 'btn-primary m-r-10'));
echo form_button('set_default', $locale['423'], $locale['423'], array('class' => 'btn-default'));
echo "</td>\n";
echo "</tr>\n";
echo "</tbody>\n</table>\n";
echo closeform();
closetable();
add_to_jquery("\$('#set_default').bind('click', function() { confirm('" . $locale['410'] . "'); });");
require_once THEMES . "templates/footer.php";
Example #23
0
function storeSettings($SETTINGS, $filename, $keyname)
{
    global $openFile_error;
    $file = openFile($filename, TRUE);
    if ($file === FALSE) {
        return $openFile_error;
    }
    fputs($file, "<?php\n");
    foreach ($SETTINGS as $key => $val) {
        if (is_array($val)) {
            foreach ($val as $key2 => $val2) {
                fputs($file, '$' . $keyname . "['" . stringToVariableName($key) . "']['" . stringToVariableName($key2) . "'] = '" . stringToVariableName($val2) . "';\n");
            }
            continue;
        }
        fputs($file, '$' . $keyname . "['" . stringToVariableName($key) . "'] = '" . stringToVariableName($val) . "';\n");
    }
    fputs($file, "?>\n");
    fclose($file);
    return NULL;
}
 function updateData($id, $debug = false)
 {
     global $path;
     $sql = array('table' => "tmp_merger", 'field' => "*", 'condition' => "id = '{$id}' ORDER BY id DESC ", 'limit' => 1);
     $aset = $this->db->lazyQuery($sql, $debug);
     if ($aset) {
         // pr($aset);
         foreach ($aset as $key => $value) {
             $getFile = openFile($path . '/log/' . $aset[0]['data']);
             $unserial = unserialize($getFile);
             // print($unserial);
             if ($unserial) {
                 $count = 1;
                 $logCount = 1;
                 $olah_tgl = date('Y-m-d');
                 $this->updateLog($value['id'], 1);
                 // $this->db->begin();
                 $errorReport = array();
                 foreach ($unserial as $key => $val) {
                     $table = $this->getTableKibAlias($val['TipeAset']);
                     $sql = array('table' => "{$table['listTableOri']}", 'field' => "MAX( CAST( noRegister AS SIGNED ) ) AS noRegister", 'condition' => "kodeKelompok = '{$val[kodeKelompok]}' AND kodeSatker = '{$val['kodeSatker']}' AND kodeLokasi = '{$val['kodeLokasi']}'");
                     $resultnoreg = $this->db->lazyQuery($sql, $debug);
                     $logIt = $this->db->logIt($tabel = array($table['listTableOri']), $Aset_ID = $val['Aset_ID'], $kd_riwayat = 3, $noDokumen = "MTS-MERGER", $tglProses = $olah_tgl, $text = "Sukses Mutasi");
                     if ($logIt) {
                         $val['noRegister'] = intval($resultnoreg[0]['noRegister'] + 1);
                         $updateTblAset = $this->updateTblAset($val);
                         if (!$updateTblAset) {
                             $errorReport[] = 1;
                         }
                         $updateTblKib = $this->updateTblKib($val);
                         if (!$updateTblKib) {
                             $errorReport[] = 1;
                         }
                         // $updateTblLogKib = $this->updateTblLogKib($val);
                         // if (!$updateTblLogKib)$errorReport[] = 1;
                         $updateMutasi = $this->updateMutasi($val);
                         if (!$updateMutasi) {
                             $errorReport[] = 1;
                         }
                         $updateMutasiAset = $this->updateMutasiAset($val);
                         if (!$updateMutasiAset) {
                             $errorReport[] = 1;
                         }
                         $updateUsulan = $this->updateUsulan($val);
                         if (!$updateUsulan) {
                             $errorReport[] = 1;
                         }
                         $val['eventid'] = $aset[0]['id'];
                         $insertLog = $this->insertLog($val);
                         if ($count == 200) {
                             sleep(1);
                             $count = 1;
                         } else {
                             $count++;
                         }
                         echo "insert data ke - {$logCount} \n";
                         $logCount++;
                     }
                 }
                 if (count($errorReport) > 0) {
                     echo "rollback data \n";
                     // $this->db->rollback();
                     $this->updateLog($value['id'], 3);
                 } else {
                     echo "commit data \n";
                     // $this->db->commit();
                     $this->updateLog($value['id'], 2);
                 }
             }
         }
     }
 }