Example #1
0
function ReadConfigFile($path)
{
    $cfg_file = @File("{$path}");
    if (!$cfg_file) {
        return FALSE;
    }
    return $cfg_file;
}
Example #2
0
/**
 * @brief Get hash of the last git commit (on remote "origin"!)
 *
 * @note    If this method does not work, try to make a "git pull" first!
 *
 * @param integer $length       if this is smaller than 40, only the first $length characters will be returned
 *
 * @retval string       The hash of the last commit
 * @retval NULL         If this is no Git installation
 *
 * @throws Exception if there was an error
 */
function get_git_commit_hash($length = 40)
{
    $filename = BASE . '/.git/refs/remotes/origin/' . get_git_branch_name();
    if (file_exists($filename)) {
        $head = File($filename);
        $hash = $head[0];
        return substr($hash, 0, $length);
    }
    return NULL;
    // this is not a Git installation
}
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $now = date('Y-m-d H:i:s', strtotime('now'));
     $languages = [['name' => 'english', 'description' => 'the Language English', 'created_at' => $now, 'updated_at' => $now], ['name' => 'danish', 'description' => 'the Language Danish, spoken in Denmark', 'created_at' => $now, 'updated_at' => $now], ['name' => 'pashto', 'description' => 'the Language Pashto, spoken in Afghanistan', 'created_at' => $now, 'updated_at' => $now]];
     foreach ($languages as $language) {
         if (\App\Models\Language::where('name', '=', $language['name'])->exists()) {
             echo $language['name'] . " Already exists\n";
         } else {
             \App\Models\Language::create($language);
         }
     }
     //DB::table('words')->truncate();
     //Schema::drop('words');
     $passed = 0;
     $exists = 0;
     //word table - seed from a file
     //        $pashto_json = File::get(storage_path() . "/app/json_data/pashto.json");
     //	$pashto_word = json_decode($pashto_json);
     //
     //        foreach ($pashto_word as $wordObj)
     //        {
     //            if(\App\Models\Word::where('word', '=', $wordObj->s2p[0])->exists())
     //            {
     //                  echo $wordObj->s2p[0] . " Already exists\n";
     //                  $exists++;
     //            }
     //            else
     //            {
     //                 \App\Models\Word::create([
     //                    'language_id' => 3,
     //                    'user_id' => 3,
     //                    'word' => $wordObj->s2p[0],
     //                    'pronounce_audio_path' => '',
     //                    'pronounce_text' => 'pronounce_text missing',
     //                    'definition' => 'Word definition missing',
     //                    'created_at' => $now,
     //                    'updated_at' => $now,
     //                ]);
     //
     //                $passed++;
     //            }
     //        }
     foreach (File(storage_path() . "/app/danskOrde_49389.txt", FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES) as $word) {
         if (App\Models\Word::where(['language_id' => 2, 'word' => $word])->exists()) {
             echo $word . ": Already exists in Danish\n";
             $exists++;
         } else {
             App\Models\Word::create(['language_id' => 2, 'user_id' => 3, 'word' => $word, 'pronounce_audio_path' => '', 'pronounce_text' => 'pronounce_text missing', 'definition' => 'Word definition missing', 'created_at' => $now, 'updated_at' => $now]);
             $passed++;
         }
     }
     echo "\n Words Already Exists: " . $exists;
     echo "\n Words added: " . $passed . "\n";
 }
 /**
  * Tells us the svn revision of e-commerce in use.
  * @return Int
  */
 public function SvnVersion()
 {
     $svnrev = "0";
     $file = Director::baseFolder() . "/ecommerce/.svn/entries";
     if (file_exists($file)) {
         $svn = @File($file);
         if ($svn && isset($svn[3])) {
             $svnrev = $svn[3];
         }
     }
     return $svnrev;
 }
Example #5
0
function ReadAccounts()
{
    global $password_file, $accounts, $num;
    if (file_exists("{$password_file}-{$num}")) {
        $passwd = @File("{$password_file}-{$num}");
    } else {
        $passwd = @File($password_file);
    }
    $cnt = count($passwd);
    for ($x = 0; $x < $cnt; $x++) {
        $line = ereg_replace("\n", "", $passwd[$x]);
        if (strstr($line, ":")) {
            $parts = explode(":", $line);
            $accounts[$parts[0]] = $parts[1];
        }
    }
}
Example #6
0
            include "pages/front/default.php";
        }
    }
} else {
    ## Not Authenticated. Print login.
    include "pages/logon.inc";
    exit;
}
?>
        </div>
      <div class="clearer"></div>
    </div>
  </div>
<?php 
$end = utime();
$run = $end - $start;
$gentime = substr($run, 0, 5);
echo '<br /> <div id="footer">Generated in ' . $gentime . ' seconds 
          <br /> <a href="http://www.observernms.org">Observer ' . $config['version'];
if (file_exists('.svn/entries')) {
    $svn = File('.svn/entries');
    echo '-SVN r' . trim($svn[3]);
    unset($svn);
}
echo '</a> &copy; 2006-2010 Adam Armstrong
          <br />This work is licensed under the <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GPL, version 3</a>.</div>';
?>
</body>
</html>

Example #7
0
	$file[$i] = Ereg_Replace("([\$\"\;\t])", "", $file[$i]);
	$file[$i] = Str_Replace(" =", "|", $file[$i]);
	$lang = Explode("|", $file[$i]);
	$lang[1] = MySQL_Escape_String($lang[1]);
	Query("INSERT delayed ignore INTO va_languages VALUES ('lv', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error());
	}
FOR($i = 0; $i < Count($file_en); $i++) {
	$file_en[$i] = Ereg_Replace("([\$\"\;\t])", "", $file_en[$i]);
	$file_en[$i] = Str_Replace("( =)|(\\\\)", "|", $file_en[$i]);
	$lang = Explode("|", $file_en[$i]);
	$lang[1] = MySQL_Escape_String($lang[1]);
	Query("INSERT delayed ignore INTO va_languages VALUES ('lv', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error());
	}

UnSet($file);
$file = File("scripts/languages/it.php");

FOR($i = 0; $i < Count($file); $i++) {
	$file[$i] = Ereg_Replace("([\$\"\;\t])", "", $file[$i]);
	$file[$i] = Str_Replace(" =", "|", $file[$i]);
	$lang = Explode("|", $file[$i]);
	$lang[1] = MySQL_Escape_String($lang[1]);
	Query("INSERT delayed ignore INTO va_languages VALUES ('it', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error());
	}
FOR($i = 0; $i < Count($file_en); $i++) {
	$file_en[$i] = Ereg_Replace("([\$\"\;\t])", "", $file_en[$i]);
	$file_en[$i] = Str_Replace("( =)|(\\\\)", "|", $file_en[$i]);
	$lang = Explode("|", $file_en[$i]);
	$lang[1] = MySQL_Escape_String($lang[1]);
	Query("INSERT delayed ignore INTO va_languages VALUES ('it', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error());
	}
Example #8
0
 function SendMailing($mailing)
 {
     if (strlen($this->error)) {
         return $this->error;
     }
     if (!isset($this->mailings[$mailing])) {
         return $this->OutputError("it was not specified a valid mailing");
     }
     if (isset($this->mailings[$mailing]["Envelope"])) {
         return $this->OutputError("the mailing was not yet ended");
     }
     $this->ResetMessage();
     $base_path = $this->mailings[$mailing]["BasePath"];
     if (GetType($header_lines = @File($base_path . ".h")) != "array") {
         return $this->OutputPHPError("could not read the mailing headers file " . $base_path . ".h", $php_errormsg);
     }
     for ($line = 0; $line < count($header_lines); ++$line) {
         $header_name = $this->Tokenize($header_lines[$line], ": ");
         $this->headers[$header_name] = trim($this->Tokenize("\n"));
     }
     if (!($envelope_file = @fopen($base_path . ".e", "rb"))) {
         return $this->OutputPHPError("could not open the mailing envelope file " . $base_path . ".e", $php_errormsg);
     }
     for ($bcc = $data = "", $position = 0; !feof($envelope_file) || strlen($data);) {
         if (GetType($break = strpos($data, chr(0), $position)) != "integer") {
             if (GetType($chunk = @fread($envelope_file, $this->file_buffer_length)) != "string") {
                 fclose($envelope_file);
                 return $this->OutputPHPError("could not read the mailing envelop file " . $base_path . ".e", $php_errormsg);
             }
             $data = substr($data, $position) . $chunk;
             $position = 0;
             continue;
         }
         if ($break == $position) {
             break;
         }
         switch ($data[$position]) {
             case "F":
                 $this->headers["Return-Path"] = substr($data, $position + 1, $break - $position - 1);
                 break;
             case "T":
                 $bcc .= (strlen($bcc) == 0 ? "" : ", ") . substr($data, $position + 1, $break - $position - 1);
                 break;
             default:
                 return $this->OutputError("invalid mailing envelope file " . $base_path . ".e");
         }
         $position = $break + 1;
     }
     fclose($envelope_file);
     if (strlen($bcc) == 0) {
         return $this->OutputError("the mailing envelop file " . $base_path . ".e does not contain any recipients");
     }
     $this->headers["Bcc"] = $bcc;
     if (!($body_file = @fopen($base_path . ".b", "rb"))) {
         return $this->OutputPHPError("could not open the mailing body file " . $base_path . ".b", $php_errormsg);
     }
     for ($data = ""; !feof($body_file);) {
         if (GetType($chunk = @fread($body_file, $this->file_buffer_length)) != "string") {
             fclose($body_file);
             return $this->OutputPHPError("could not read the mailing body file " . $base_path . ".b", $php_errormsg);
         }
         $data .= $chunk;
     }
     fclose($body_file);
     if (strlen($error = $this->StartSendingMessage())) {
         return $error;
     }
     if (strlen($error = $this->SendMessageHeaders($this->headers)) == 0 && strlen($error = $this->SendMessageBody($data)) == 0) {
         $error = $this->EndSendingMessage();
     }
     $this->StopSendingMessage();
     return $error;
 }
Example #9
0
function LoadComp($__FILE__)
{
    #-------------------------------------------------------------------------------
    $__args__ = Array_Slice(Func_Get_Args(), 2);
    #-------------------------------------------------------------------------------
    Debug(SPrintF("Load file: '%s'", $__FILE__));
    #-------------------------------------------------------------------------------
    $GLOBALS['__COUNTER_COMPS']++;
    #-------------------------------------------------------------------------------
    # get file
    $FileContent = File($__FILE__);
    #-------------------------------------------------------------------------------
    # delete last string
    unset($FileContent[SizeOf($FileContent) - 1]);
    #-------------------------------------------------------------------------------
    # delete first string
    unset($FileContent[0]);
    #-------------------------------------------------------------------------------
    # create text from array
    $FileContent = Implode("\n", $FileContent);
    #-------------------------------------------------------------------------------
    # get result
    $CompResult = eval($FileContent);
    /*if($CompResult === FALSE) {
    		Debug($__FILE__);
    		return ERROR | @Trigger_Error(1000);
    	}*/
    #-------------------------------------------------------------------------------
    return $CompResult;
    #-------------------------------------------------------------------------------
}
Example #10
0
 function SendMailing($mailing)
 {
     if (strlen($this->error)) {
         return $this->error;
     }
     if (!isset($this->mailings[$mailing])) {
         return $this->OutputError("it was not specified a valid mailing");
     }
     if (isset($this->mailings[$mailing]["Envelope"])) {
         return $this->OutputError("the mailing was not yet ended");
     }
     $this->ResetMessage();
     $base_path = $this->mailings[$mailing]["BasePath"];
     if (GetType($header_lines = @File($base_path . ".h")) != "array") {
         return $this->OutputPHPError("could not read the mailing headers file " . $base_path . ".h", $php_errormsg);
     }
     if (!($envelope_file = @fopen($base_path . ".e", "rb"))) {
         return $this->OutputPHPError("could not open the mailing envelope file " . $base_path . ".e", $php_errormsg);
     }
     for ($return_path = $data = ""; !feof($envelope_file) || strlen($data);) {
         if (GetType($break = strpos($data, chr(0))) != "integer") {
             if (GetType($chunk = @fread($envelope_file, $this->file_buffer_length)) != "string") {
                 fclose($envelope_file);
                 return $this->OutputPHPError("could not read the mailing envelop file " . $base_path . ".e", $php_errormsg);
             }
             $data .= $chunk;
             continue;
         }
         if ($break == 0) {
             break;
         }
         switch ($data[0]) {
             case "F":
                 $return_path = substr($data, 1, $break - 1);
                 break;
             default:
                 return $this->OutputError("invalid mailing envelope file " . $base_path . ".e");
         }
         break;
     }
     fclose($envelope_file);
     if (strlen($return_path) == 0) {
         return $this->OutputError("envelope file " . $base_path . ".e does not contain a return path");
     }
     $headers = $this->FormatHeader("Date", gmdate("D, d M Y H:i:s -0000")) . "\n";
     for ($has = array(), $line = 0; $line < count($header_lines); $line++) {
         $header = $this->Tokenize($header_lines[$line], ":");
         switch (strtolower($header)) {
             case "return-path":
             case "bcc":
             case "date":
             case "content-length":
                 break;
             case "from":
             case "to":
             case "cc":
             case "message-id":
                 $has[strtolower($header)] = 1;
             default:
                 $headers .= $this->FormatHeader($header, trim($this->Tokenize("\n"))) . "\n";
                 break;
         }
     }
     if (!isset($has["from"])) {
         $headers .= $this->FormatHeader("From", "<" . $return_path . ">") . "\n";
     }
     if (!isset($has["to"]) && !isset($has["cc"])) {
         $headers .= $this->FormatHeader("Cc", "recipient list not shown: ;") . "\n";
     }
     if (!isset($has["message-id"])) {
         $micros = $this->Tokenize(microtime(), " ");
         $seconds = $this->Tokenize("");
         $this->Tokenize($return_path, "@");
         $host = $this->Tokenize("@");
         if ($host[strlen($host) - 1] == "-") {
             $host = substr($host, 0, strlen($host) - 1);
         }
         $headers .= $this->FormatHeader("Message-ID", "<" . strftime("%Y%m%d%H%M%S", $seconds) . substr($micros, 1, 5) . ".qmail@" . $host . ">") . "\n";
     }
     if (!($body_file = @fopen($base_path . ".b", "rb"))) {
         return $this->OutputPHPError("could not open the mailing body file " . $base_path . ".b", $php_errormsg);
     }
     for ($body = ""; !feof($body_file);) {
         if (GetType($chunk = @fread($body_file, $this->file_buffer_length)) != "string") {
             fclose($body_file);
             return $this->OutputPHPError("could not read the mailing body file " . $base_path . ".b", $php_errormsg);
         }
         $body .= $chunk;
     }
     fclose($body_file);
     $command = $this->qmail_path . "/qmail-queue 1<" . $base_path . ".e";
     if (!($pipe = @popen($command, "w"))) {
         return $this->OutputPHPError("it was not possible to open qmail-queue input pipe", $php_errormsg);
     }
     if (!@fputs($pipe, $headers . "\n" . $body) || !@fflush($pipe)) {
         return $this->OutputPHPError("it was not possible to write qmail-queue input pipe", $php_errormsg);
     }
     return ($rc = pclose($pipe) >> 8) ? "qmail-queue error " . $rc : "";
 }
Example #11
0
File: gb.php Project: xplhak/WebGen
        </li>
        
        <li>
            <input type="button" value="Zanechat vzkaz" Accesskey="Z" onclick="add_news()" />
        </li>
    </ul>
</form>

<hr />

<div id="messages">
<?php 
/*
 * Zobrazi zpravy s guest booku
 */
$data = File("gb_data.txt");
$lines = count($data) - 1;
for ($i = $lines; $i != -1; $i--) {
    list($name, $email, $url, $msg, $date) = explode("|", $data[$i]);
    ?>


    <div class="gb_msg">
        <div class="gb_header">
            <span><?php 
    echo Date("d. F H:i", $date);
    ?>
</span>
            
            <?php 
    if ($email == "@" || $email == "") {
Example #12
0
 public function getSubversionRevision($cache = true)
 {
     if ($cache && isset($this->cache['getSubversionRevision'])) {
         return $this->cache['getSubversionRevision'];
     }
     // This will work for Subverson 1.6 clients and below
     if (file_exists("../.svn/entries")) {
         $svn = File("../.svn/entries");
         $this->cache['getSubversionRevision'] = (int) $svn[3];
         return $this->cache['getSubversionRevision'];
     }
     // Check the previous directories recursively looking for wc.db (Subversion 1.7)
     $searchDepth = 3;
     // Max search depth. 3 should handle 99% of checkouts.
     // Do we have PDO? And do we have the SQLite PDO driver?
     if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) {
         $searchDepth = 0;
         // Don't even bother...
     }
     for ($i = 1; $i <= $searchDepth; $i++) {
         $dotdot .= '../';
         if (!@file_exists("{$dotdot}.svn/wc.db")) {
             continue;
         }
         $wcdb = new PDO("sqlite:{$dotdot}.svn/wc.db");
         $result = $wcdb->query('SELECT "changed_revision" FROM "NODES" WHERE "repos_path" = "' . basename(realpath('..')) . '"');
         $this->cache['getSubversionRevision'] = (int) $result->fetchColumn();
         return $this->cache['getSubversionRevision'];
     }
     if ($this->canRun('exec')) {
         exec('svnversion ' . realpath('..'), $out, $return);
         // For this to work, svnversion must be in your PHP's PATH enviroment variable
         if ($return === 0 && $out[0] != "Unversioned directory") {
             $this->cache['getSubversionRevision'] = (int) $out[0];
             return $this->cache['getSubversionRevision'];
         }
     }
     $this->cache['getSubversionRevision'] = false;
     return false;
 }
 * @package    observium
 * @subpackage definitions
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
// Full list defined constants:
// OBSERVIUM_EDITION, OBSERVIUM_PRODUCT, OBSERVIUM_PRODUCT_LONG,
// OBSERVIUM_VERSION, OBSERVIUM_VERSION_LONG, OBSERVIUM_TRAIN, OBSERVIUM_URL
define('OBSERVIUM_EDITION', 'pro');
define('OBSERVIUM_PRODUCT', 'Observium');
define('OBSERVIUM_PRODUCT_LONG', 'Observium 专业版');
define('OBSERVIUM_URL', 'http://www.observium.org');
$observium_version = "0.SVN.ERROR";
$svn_new = TRUE;
if (is_file($config['install_dir'] . '/.svn/entries')) {
    $svn = File($config['install_dir'] . '/.svn/entries');
    if ((int) $svn[0] < 12) {
        // SVN version < 1.7
        $svn_rev = trim($svn[10]);
        list($svn_date) = explode("T", trim($svn[9]));
        $svn_new = FALSE;
        if (preg_match('/stable/', trim($svn[4]), $matches)) {
            $svn_train = 'stable';
        } elseif (preg_match('/trunk/', trim($svn[4]), $matches)) {
            $svn_train = 'rolling';
        }
    }
}
if ($svn_new) {
    // SVN version >= 1.7
    $svn = shell_exec($config['svn'] . ' info ' . $config['install_dir']);