Example #1
0
function parseFile($download = false, $config)
{
    $code = "";
    $stylist = new phpStylist();
    if (!isset($config->file) || $config->file == "") {
        return false;
    }
    $code = loadFile($config->file);
    if (isset($config->iso8859)) {
        $code = utf8_encode($code);
    }
    if (!empty($code)) {
        $stylist->options = $config;
        if (isset($config->indent_with_tabs) && $config->indent_with_tabs) {
            $stylist->indent_char = "\t";
        }
        if (!empty($config->indent_size)) {
            $stylist->indent_size = $config->indent_size;
        }
        if (strpos($code, '<?') === false) {
            $code = '<?php ' . $code . ' ?>';
        }
        $formatted = $stylist->formatCode($code);
    }
    return $formatted;
}
Example #2
0
 private function loadTemplate()
 {
     if (is_file($this->_folderTemplate . '/index.html')) {
         loadFile($this->_folderTemplate . '/index.html');
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 /**
  * Загрузить библиотеку
  * @return bool Статус загрузки
  * @exception Не найден класс/адаптер библиотеки
  */
 private function loadLib()
 {
     if (loadFile($this->forlderLibrary . '/Adapter.php')) {
         if (class_exists($this->nameLibrary)) {
             return $this->{$this->nameLibrary} = new $this->nameLibrary();
         }
         return true;
     }
     return false;
 }
Example #4
0
 public function __construct()
 {
     $tempEngineSelect = C('TEMPLATE_ENGINE');
     if ("NoteEng" == $tempEngineSelect) {
         $this->tempEngine = new Templates();
     } else {
         loadFile("notephp.Smarty.{$tempEngineSelect}");
         $this->tempEngine = new Smarty();
     }
     $this->tempEngine->left_delimiter = C('SMARTY_LEFT_DELIMITER');
     $this->tempEngine->right_delimiter = C('SMARTY_RIGHT_DELIMITER');
     $this->tempEngine->cache_dir = PRO_PATH . "/" . ucfirst($GLOBALS['PROJECT_REQUEST_MODULE']) . "/Runtime/Cache";
     $this->tempEngine->compile_dir = PRO_PATH . "/" . ucfirst($GLOBALS['PROJECT_REQUEST_MODULE']) . "/Runtime/Compile";
 }
Example #5
0
 function testCallbackFieldsInvalidResponse()
 {
     $client = new Zipmark_Client('wrong_identifier', 'wrong_secret');
     $headerFile = loadFile('callback/headers_invalid.json');
     $bodyFile = loadFile('callback/body.json');
     // Headers should be an array
     $headers = json_decode($headerFile[0], true);
     // Body should be a JSON string
     $body = $bodyFile[0];
     $callback = new Zipmark_Callback($client, $headers, $body);
     $this->assertFalse($callback->isValid());
     $this->assertNull($callback->event());
     $this->assertNull($callback->objectType());
     $this->assertNull($callback->object());
 }
Example #6
0
File: map.php Project: klarclm/sgv
if (!defined('MAC_ROOT')) {
    exit('Access Denied');
}
if ($method == 'vod') {
    $tpl->P['cp'] = 'map';
    $tpl->P['cn'] = $method . $tpl->P['id'];
    echoPageCache($tpl->P['cp'], $tpl->P['cn']);
    $db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
    $sql = "SELECT * FROM {pre}vod WHERE d_hide=0 AND d_id=" . $tpl->P['id'];
    $row = $db->getRow($sql);
    if (!row) {
        showErr('System', '未找到指定数据');
    }
    $tpl->T = $MAC_CACHE['vodtype'][$row['d_type']];
    $tpl->D = $row;
    unset($row);
    $tpl->loadvod("rss");
    $tpl->replaceVod();
    $tpl->playdownlist("play");
    $tpl->playdownlist("down");
} elseif ($method == 'rss' || $method == 'baidu' || $method == 'google' || $method == '360') {
    $tpl->P['cp'] = 'map';
    $tpl->P['cn'] = $method . '-' . $tpl->P['pg'];
    echoPageCache($tpl->P['cp'], $tpl->P['cn']);
    $db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
    $tpl->H = loadFile(MAC_ROOT . '/inc/map/' . $method . '.html');
    $tpl->mark();
} else {
    showErr('System', '未找到指定系统模块');
}
Example #7
0
	header('Content-Type: image/jpg');
	$url = $_GET["url"];
}

function loadFile($sFilename, $sCharset = 'UTF-8')
{
    if (floatval(phpversion()) >= 4.3) {
        $sData = file_get_contents($sFilename);
    } else {
        if (!file_exists($sFilename)) return -3;
        $rHandle = fopen($sFilename, 'r');
        if (!$rHandle) return -2;

        $sData = '';
        while(!feof($rHandle))
            $sData .= fread($rHandle, filesize($sFilename));
        fclose($rHandle);
    }
    return $sData;
}

if( $url != "" )
{
	echo loadFile($url, "auto");
}
else
{
	echo "URL não definida";
}

?>
 public function loadViewTemplate($path)
 {
     return loadFile($path);
 }
 /**
  * Loads a source code file and compiles it.
  *
  * @param string   $sourceFile The filesystem path of the source code file.
  * @param callable $compiler   A function that transforms the source file into the final representation that will be
  *                             cached. It must have a single parameter of type string (the source code).
  * @return mixed
  */
 function loadAndCompile($sourceFile, callable $compiler)
 {
     $sourceCode = loadFile($sourceFile, false);
     if (!$sourceCode) {
         $this->fileNotFound($sourceFile);
     }
     return $compiler($sourceCode);
 }
{
    var_dump($_FILES);
    if ($_FILES['donnees-file-to-import']['error'] != 0) {
        return "Une erreur c'est produite durant le transfert";
    }
    if (is_uploaded_file($_FILES['donnees-file-to-import']['tmp_name']) === false) {
        return "Un fichier est requis";
    }
    if (!move_uploaded_file($_FILES['donnees-file-to-import']['tmp_name'], FILE_FLIGHT_DATA)) {
        return "Une erreur s'est produite durant la copie du fichier";
    }
    return TRUE;
}
$fileErr = "";
if (isset($_POST['submit'])) {
    $message = loadFile();
    if ($message === TRUE) {
        header("Location: tableau_bord_post_vol.php");
    } else {
        $fileErr = $message;
    }
}
?>
<!DOCTYPE html>
<html lang="fr-FR">
    <head>
        <title>Chargement des données</title>
        <meta name="description"
              content="Extrait les donnéesdu fichier généré par l'application embarqué">
        <meta charset="UTF-8">
        <meta name="author" content="Baptiste Thevenet">
Example #11
0
if (!defined('MAC_ROOT')) {
    exit('Access Denied');
}
if ($MAC['other']['gbook'] == 0) {
    echo 'gbook closed';
    return;
}
if ($method == 'show') {
    $tpl->C["siteaid"] = 30;
    if ($tpl->P['pg'] < 1) {
        $tpl->P['pg'] = 1;
    }
    $tpl->P['cp'] = 'app';
    $tpl->P['cn'] = 'gbook' . $tpl->P['pg'];
    //echoPageCache($tpl->P['cp'],$tpl->P['cn']);
    $tpl->H = loadFile(MAC_ROOT . "/template/" . $MAC['site']['templatedir'] . "/" . $MAC['site']['htmldir'] . "/home_gbook.html");
    $db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
    $tpl->mark();
    $tpl->H = str_replace("{maccms:gbookverify}", $MAC['other']['gbookverify'], $tpl->H);
    if (strpos($tpl->H, '{maccms:count_gbook_all}')) {
        $tpl->H = str_replace("{maccms:count_gbook_all}", $tpl->getDataCount('gbook', "all"), $tpl->H);
    }
    if (strpos($tpl->H, '{maccms:count_gbook_day}')) {
        $tpl->H = str_replace("{maccms:count_gbook_day}", $tpl->getDataCount('gbook', "day"), $tpl->H);
    }
    $tpl->pageshow();
} elseif ($method == 'save') {
    $g_vid = be("all", "g_vid");
    $g_vid = chkSql($g_vid);
    $g_name = be("all", "g_name");
    $g_name = chkSql($g_name);
Example #12
0
// Move bash_complete_zkillboard to the bash_complete folder
try {
    file_put_contents("/etc/bash_completion.d/zkillboard", file_get_contents("{$base}/bash_complete_zkillboard"));
    exec("chmod +x {$base}/../cli.php");
} catch (Exception $ex) {
    out("|r|Error! Couldn't move the bash_complete file into /etc/bash_completion.d/, please do this after the installer is done.");
}
// Now install the db structure
try {
    $sqlFiles = scandir("{$base}/sql");
    foreach ($sqlFiles as $file) {
        if (Util::endsWith($file, ".sql")) {
            $table = str_replace(".sql", "", $file);
            out("Adding table |g|{$table}|n| ... ", false, false);
            $sqlFile = "{$base}/sql/{$file}";
            loadFile($sqlFile);
            // Ensure the table starts with base parameters and doesn't inherit anything from zkillboard.com
            if (!Util::startsWith($table, "ccp_")) {
                Db::execute("truncate table {$table}");
            }
            out("|g|done");
        }
    }
} catch (Exception $ex) {
    out("|r|Error! Removing configuration file.");
    unlink($configLocation);
    throw $ex;
}
try {
    out("|g|Installing default admin user...");
    // Install the default admin user
Example #13
0
File: vod.php Project: klarclm/sgv
     if (is_array($classarr)) {
         if (empty($tpl->P["key"])) {
             $tpl->P["key"] = $classarr["c_name"];
         }
         $tpl->P["des"] = $tpl->P["des"] . "&nbsp;剧情分类为" . $classarr["c_name"];
     }
     unset($classarr);
 }
 if (!empty($tpl->P["ids"])) {
     $arr = explode(',', $tpl->P["ids"]);
     for ($i = 0; $i < count($arr); $i++) {
         $arr[$i] = intval($arr[$i]);
     }
     $tpl->P["ids"] = join(',', $arr);
 }
 $tpl->H = loadFile(MAC_ROOT_TEMPLATE . "/vod_search.html");
 $tpl->mark();
 $tpl->pageshow();
 $colarr = array('{page:des}', '{page:key}', '{page:now}', '{page:order}', '{page:by}', '{page:wd}', '{page:wdencode}', '{page:pinyin}', '{page:letter}', '{page:year}', '{page:starring}', '{page:starringencode}', '{page:directed}', '{page:directedencode}', '{page:area}', '{page:areaencode}', '{page:lang}', '{page:langencode}', '{page:typeid}', '{page:typepid}', '{page:classid}');
 $valarr = array($tpl->P["des"], $tpl->P["key"], $tpl->P["pg"], $tpl->P["order"], $tpl->P["by"], $tpl->P["wd"], urlencode($tpl->P["wd"]), $tpl->P["pinyin"], $tpl->P["letter"], $tpl->P['year'] == 0 ? '' : $tpl->P['year'], $tpl->P["starring"], urlencode($tpl->P["starring"]), $tpl->P["directed"], urlencode($tpl->P["directed"]), $tpl->P["area"], urlencode($tpl->P["area"]), $tpl->P["lang"], urlencode($tpl->P["lang"]), $tpl->P['typeid'], $tpl->P['typepid'], $tpl->P['classid']);
 $tpl->H = str_replace($colarr, $valarr, $tpl->H);
 unset($colarr, $valarr);
 $linktype = $tpl->getLink('vod', 'search', '', array('typeid' => $tpl->P['typepid']));
 $linkyear = $tpl->getLink('vod', 'search', '', array('year' => ''));
 $linkletter = $tpl->getLink('vod', 'search', '', array('letter' => ''));
 $linkarea = $tpl->getLink('vod', 'search', '', array('area' => ''));
 $linklang = $tpl->getLink('vod', 'search', '', array('lang' => ''));
 $linkclass = $tpl->getLink('vod', 'search', '', array('classid' => ''));
 $linkorderasc = $tpl->getLink('vod', 'search', '', array('order' => 'asc'));
 $linkorderdesc = $tpl->getLink('vod', 'search', '', array('order' => 'desc'));
 $linkbytime = $tpl->getLink('vod', 'search', '', array('by' => 'time'));
        $iterator++;
    }
}
$music_xml_text_en = loadFile('Amazon_product_reviews/music/music.en');
$music_array_xml_text_en = parseXMLString('text', $music_xml_text_en, false);
$iterator = 0;
foreach ($music_array_xml_text_en as $music_en) {
    if (!empty($music_en)) {
        writeFile('music_en/music_en' . $iterator . '.txt', $music_en);
        $iterator++;
    } else {
        writeFile('music_en/music_en' . $iterator . '.txt', 'translation not available');
        $iterator++;
    }
}
$music_xml_text_fr = loadFile('Amazon_product_reviews/music/music.fr');
$music_array_xml_text_fr = parseXMLString('text', $music_xml_text_fr, false);
$iterator = 0;
foreach ($music_array_xml_text_fr as $music_fr) {
    if (!empty($music_fr)) {
        writeFile('music_fr/music_fr' . $iterator . '.txt', $music_fr);
        $iterator++;
    } else {
        writeFile('music_en/music_fr' . $iterator . '.txt', 'translation not available');
        $iterator++;
    }
}
/* * ***********************
 *      FUNCTIONS
 * *********************** */
/**
Example #15
0
 function loadart()
 {
     if ($this->P['make'] != true && chkCache($this->P['cp'], $this->P['cn'])) {
         $this->H = getCache($this->P['cp'], $this->P['cn']);
     } else {
         $this->H = loadFile(MAC_ROOT_TEMPLATE . "/" . $this->T['t_tpl_art']);
         $this->C["sitetid"] = $this->D['a_type'];
         $this->C["siteid"] = $this->D['a_id'];
         $this->P['arttypeid'] = $this->T['t_id'];
         $this->P['arttypepid'] = $this->T['t_pid'];
         $this->P['similar'] = array('name' => $this->D['a_name'], 'tag' => $this->D['a_tag']);
         $GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'no';
         if ($this->P['make'] == true) {
             if (strpos($this->H, 'similar=') > 0) {
                 $GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'ok';
             }
         }
         $this->mark();
         $this->P['pageflag'] = 'art';
         $this->P['pagetype'] = 'detail';
         if ($this->P['make']) {
             return;
         }
         $this->H = str_replace("[art:page]", $this->P["pg"], $this->H);
         $arr = explode("[art:page]", $this->D["a_content"]);
         $arrlen = count($arr);
         if ($this->P['pg'] > $arrlen) {
             $this->P['pg'] = $arrlen;
         }
         $this->P['content'] = $arr[$this->P["pg"] - 1];
         $this->P['pagesize'] = 1;
         $this->P['datacount'] = $arrlen;
         $this->P['pagecount'] = $arrlen;
         $this->pageshow();
         unset($arr);
         $this->replaceArt();
         setCache($this->P['cp'], $this->P['cn'], $this->H);
     }
 }
 * This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
 * For more information, see http://creativecommons.org/licenses/by-sa/4.0/
 */
set_time_limit(100000);
ini_set('display_errors', 1);
error_reporting(E_ALL);
/**
 * @see https://github.com/neitanod/forceutf8
 */
require_once 'Encoding.php';
/**
 * @see https://github.com/boudinfl/taln-archives
 */
$path = './input_taln_file.bib';
$encode = new Encoding();
$content = $encode->toUTF8(loadFile($path));
$articles = parseBibTex($content);
foreach ($articles as $article) {
    $authors = parseAuthors($article);
    $url = parseUrl($article);
    $ScholarUrlsResult = getLinksOfScholarResult(googleScholarResearch($authors));
    $SERPUrlsResult = getLinksOfGoogleResult(launchGoogleRequestAndGetResults($authors));
    writeFile(basename($path), $url, $ScholarUrlsResult, $SERPUrlsResult);
}
/* * ***********************
 *      FUNCTIONS
 * *********************** */
function googleScholarResearch($authors)
{
    $url = 'https://scholar.google.fr/scholar?hl=fr&q=' . rawurlencode($authors);
    $content = file_get_contents($url);
Example #17
0
function get_license($sequence_of_image, $license_num)
{
    global $license_names_array;
    // load unique license data
    $current_user = wp_get_current_user();
    $license_unique_number = $_GET['sessionid'] . "_" . $_SESSION['nzshpcrt_cart'][$sequence_of_image]->product_id;
    $agreement_number = $license_unique_number;
    //uniqid();
    $agreement_date = date("m.d.y");
    $customer_name = $current_user->last_name . " " . $current_user->first_name;
    if (trim($customer_name) == '') {
        if (isset($_SESSION['collected_data'])) {
            $customer_name_from_form = trim($_SESSION['collected_data'][1]) . " " . trim($_SESSION['collected_data'][2]);
            $customer_name = $customer_name_from_form;
        }
    }
    //echo("<pre>".print_r($current_user,true)."</pre>");
    //echo("<pre>".print_r($_SESSION['nzshpcrt_cart'],true)."</pre>");
    //echo("<pre>".print_r($_SESSION['collected_data'],true)."</pre>");
    if (isset($_SESSION['collected_data'][5]) && trim($_SESSION['collected_data'][5]) != '') {
        $media_name = "«" . trim($_SESSION['collected_data'][5]) . "»";
    } elseif (isset($current_user->user_description) && $current_user->user_description != '') {
        $media_name = "«" . $current_user->user_description . "»";
    } else {
        $media_name = "[не указано]";
    }
    if (isset($current_user->discount)) {
        $_discount = $current_user->discount;
    } else {
        $_discount = 0;
    }
    if (isset($_SESSION['nzshpcrt_cart'])) {
        $price = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->price;
        if (isset($current_user->discount)) {
            $price = round($price * (100 - $_discount) / 100);
        }
        $image_name = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->name;
        $image_number = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->product_id;
        $author_name = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->author;
    }
    //load License template
    $filename = '';
    //pokazh($license_num,"license_num");
    switch ($license_num) {
        case 1:
            $filename = getcwd() . "/wp-content/plugins/wp-shopping-cart/" . "license_limited_template.htm";
            break;
        case 2:
            $filename = getcwd() . "/wp-content/plugins/wp-shopping-cart/" . "license_standard_template.htm";
            break;
        case 3:
            $filename = getcwd() . "/wp-content/plugins/wp-shopping-cart/" . "license_extended_template.htm";
            break;
        default:
            $filename = getcwd() . "/wp-content/plugins/wp-shopping-cart/" . "license_limited_template.htm";
            break;
    }
    if (isset($current_user) && $current_user->ID == 106) {
        $content = "<div style='color:red;'>Демонстрационная лицензия</div>";
        $content .= loadFile($filename);
    } else {
        $content = loadFile($filename);
    }
    if (isset($current_user) && $current_user->ID == 106) {
        $agreement_number = "XXXXXXX";
        $customer_name = "Демо-пользователь";
        $image_number = "XXXX-номер изображения";
        $image_name = "Название рисунка";
        $author_name = "Имя автора";
        $media_name = "Название компании покупателя";
        $price = "XXX-Цена";
    }
    // replace placeholders
    $content = str_replace('#agreement_number#', $agreement_number, $content);
    $content = str_replace('#agreement_date#', $agreement_date, $content);
    $content = str_replace('#customer_name#', $customer_name, $content);
    $content = str_replace('#image_number#', $image_number, $content);
    $content = str_replace('#image_name#', $image_name, $content);
    $content = str_replace('#author_name#', $author_name, $content);
    $content = str_replace('#media_name#', $media_name, $content);
    $content = str_replace('#price#', $price, $content);
    // save_license
    $license_filename = $agreement_number . ".htm";
    save_license($content, $license_filename);
    $license_names_array[] = $license_filename;
    // output content
    return $content;
}
Example #18
0
<?php

if (!defined('MAC_ROOT')) {
    exit('Access Denied');
}
if ($method != '') {
    $m = be('get', 'm');
    $f = $method;
    $s = substr($m, strpos($m, '.'), strlen($m) - strpos($m, '.'));
    $path = MAC_ROOT_TEMPLATE . '/label_' . $f . $s;
    if (($s == '.html' || $s == '.htm' || $s == '.xml' || $s == '.js') && @file_exists($path)) {
        $tpl->P['cp'] = 'app';
        $tpl->P['cn'] = $m . $tpl->P['pg'];
        echoPageCache($tpl->P['cp'], $tpl->P['cn']);
        $db = new AppDb($MAC['db']['server'], $MAC['db']['user'], $MAC['db']['pass'], $MAC['db']['name']);
        $tpl->H = loadFile($path);
        $tpl->mark();
        $tpl->pageshow();
    } else {
        showErr('System', '未找到指定自定义页面');
    }
} else {
    showErr('System', '未找到指定系统模块');
}
Example #19
0
 /**
  * Loads and runs a PHP file, searching for it on the include path, stripping the BOM (if one is present) and throwing
  * catchable exceptions instead of fatal errors.
  *
  * @param string $filename
  * @return mixed|null The value returned from the executed code, or `null` if no `return` is called.
  */
 static function exec($filename)
 {
     $code = loadFile($filename);
     if (!$code) {
         throw new RuntimeException("Can't load file {$filename}", 1);
     }
     if (!self::validate($code, $out)) {
         throw new RuntimeException("Failed executing file {$filename}.\n\n{$out}", 2);
     }
     return self::catchErrorsOn(function () use($code) {
         self::run($code);
     });
 }
Example #20
0
 protected function createView()
 {
     $prop = $this->props;
     $ctx = $this->context;
     $controller = $prop->class;
     // Resolve controller for the view (if applicable).
     if (!exists($controller) && exists($prop->view)) {
         $controller = $ctx->findControllerForView($prop->view);
     }
     if (exists($prop->template)) {
         if (exists($controller)) {
             $subComponent = $this->makeShadowController($controller, $prop);
             $subComponent->template = $prop->template;
             $this->setShadowDOM($subComponent);
         } else {
             $this->template = $prop->template;
         }
     } elseif (exists($prop->view)) {
         if (exists($controller)) {
             $subComponent = $this->makeShadowController($controller, $prop);
             $subComponent->templateUrl = $prop->view;
             $this->setShadowDOM($subComponent);
         } else {
             $this->templateUrl = $prop->view;
         }
     } else {
         if (exists($prop->file)) {
             $fileContent = loadFile($prop->file);
             if ($fileContent === false) {
                 throw new FileIOException($prop->file, 'read', explode(PATH_SEPARATOR, get_include_path()));
             }
             echo $fileContent;
             return;
         } else {
             if ($prop->styles) {
                 $ctx->getAssetsService()->outputStyles();
                 return;
             } else {
                 if ($prop->scripts) {
                     $ctx->getAssetsService()->outputScripts();
                     return;
                 }
             }
         }
     }
     parent::createView();
 }
Example #21
0
// Get a list of all tables
$tableResult = Db::query("show tables", array(), 0);
$tables = array();
foreach ($tableResult as $row) {
    $table = array_pop($row);
    $tables[$table] = true;
}
// Now install the db structure
try {
    $sqlFiles = scandir("{$base}/sql");
    foreach ($sqlFiles as $file) {
        if (Util::endsWith($file, ".sql")) {
            $table = str_replace(".sql", "", $file);
            out("Updating table |g|{$table}|n| ... ", false, false);
            $sqlFile = "{$base}/sql/{$file}";
            loadFile($sqlFile, $table);
            out("|w|done|n|");
            $tables[$table] = false;
        }
    }
    foreach ($tables as $table => $drop) {
        if ($drop && Util::startsWith($table, "zz_")) {
            out("|r|Dropping table: |g|{$table}|n|\n", false, false);
            Db::execute("drop table {$table}");
        }
    }
} catch (Exception $ex) {
    out("|r|Error!|n|");
    throw $ex;
}
$count = Db::execute("INSERT IGNORE INTO zz_users (username, moderator, admin, password) VALUES ('admin', 1, 1, '\$2y\$10\$maxuZ/qozcjIgr7ZSnrWJemywbThbPiJDYIuOk9eLxF0pGE5SkNNu')");
Example #22
0
<?php

require 'functions.php';
$targetpath = 'images';
loadFile($targetpath);
header('Location: index.php');
 $content = loadFile($dir . basename($file));
 $xml_content = simplexml_load_file($dir . basename($file));
 $authors = $xml_content->feature[0]['authors'];
 $title = $xml_content->feature[0]['title'];
 for ($i = 2; $i < count($xml_content); $i++) {
     $type = (string) $xml_content->feature[$i]['type'];
     $obfuscation = (string) $xml_content->feature[$i]['manual_obfuscation'];
     $this_lang = (string) $xml_content->feature[$i]['this_language'];
     $src_lang = (string) $xml_content->feature[$i]['source_language'];
     $this_offset = intval($xml_content->feature[$i]['this_offset']);
     $this_lenght = intval($xml_content->feature[$i]['this_length']);
     $src_offset = intval($xml_content->feature[$i]['source_offset']);
     $src_lenght = intval($xml_content->feature[$i]['source_length']);
     $src_txt = (string) $xml_content->feature[$i]['source_reference'];
     $src_ref = (string) basename($src_txt, '.txt');
     $src_content = loadFile($src_dir . $src_txt);
     $this_feature_content = $encode->toUTF8(substr($encode->toLatin1($this_content), $this_offset, $this_lenght));
     $src_feature_content = $encode->toUTF8(substr($encode->toLatin1($src_content), $src_offset + 1, $src_lenght + 1));
     writeFile($this_lang . '/SUSP_' . $j . '_' . ($i - 2) . '.txt', $this_feature_content);
     writeFile($src_lang . '/SRC_' . $j . '_' . ($i - 2) . '.txt', $src_feature_content);
     $noiseNumber = substr_count($this_feature_content, ' vna ');
     $noiseNumber += substr_count($this_feature_content, ' vn ');
     $noiseNumber += substr_count($this_feature_content, ' i ');
     $noise = $noiseNumber >= 5 ? 'true' : 'false';
     $textualEquivalent = new TextualEquivalent($name, $this_lang, $this_offset, $this_lenght, $this_feature_content, $src_ref, $src_lang, $src_offset, $src_lenght, $src_feature_content, $type, $obfuscation, $noise);
     $string = '<?xml version="1.0" encoding="UTF-8"?>' . chr(10);
     $string .= '<info>' . chr(10);
     $string .= '<sourceIDDoc>' . $src_ref . '</sourceIDDoc>' . chr(10);
     $string .= '<sourceTextLanguage>' . $src_lang . '</sourceTextLanguage>' . chr(10);
     $string .= '<sourceTextOffset>' . $src_offset . '</sourceTextOffset>' . chr(10);
     $string .= '<sourceTextLength>' . $src_lenght . '</sourceTextLength>' . chr(10);
    return $buffer;
}
$admin = new administration();
//$kmlIdArray = $admin->getKmlByOwner($user_id);
// kml is being deleted
if (!empty($delKmlId)) {
    $result = $admin->deleteKml($delKmlId, $user_id);
    if (!$result) {
        echo "<script language='javascript'>";
        echo "alert('KML could not be deleted!');";
        echo "</script>";
    }
} elseif ($clientFilename) {
    $serverFilename = "../tmp/kml" . time() . ".xml";
    copy($clientFilename, $serverFilename);
    $kmlDoc = loadFile($serverFilename);
    $kmlObj = new KML();
    if ($kmlObj->parseKml($kmlDoc)) {
        $geoJSON = $kmlObj->toGeoJSON();
        setGeoJson($geoJSON);
    } else {
        echo "<script language='javascript'>";
        echo "alert('KML load failed. See the error log for details.');";
        echo "</script>";
    }
} elseif ($kmlUrl) {
    $connector = new connector($kmlUrl);
    $kmlDoc = $connector->file;
    $kmlObj = new KML();
    if ($kmlObj->parseKml($kmlDoc)) {
        $geoJSON = $kmlObj->toGeoJSON();
Example #25
0
File: make.php Project: klarclm/sgv
     $start = intval($p['start']);
 }
 if (!isNum($start)) {
     $start = 1;
 }
 $arr = explode(',', $ids);
 $len = count($arr);
 if ($num >= $len) {
     showMsg('专题数据列表页面生成完毕!', '?m=make-option');
     return;
 }
 $id = $arr[$num];
 $tpl->T = $MAC_CACHE[$tab . 'topic'][$id];
 $tpl->P[$tab . 'topicid'] = $id;
 $tpl->P['id'] = $id;
 $tpl->H = loadFile(MAC_ROOT_TEMPLATE . "/" . $tpl->T['t_tpl']);
 if (empty($pagesize)) {
     $pagesize = $tpl->getPageListSizeByCache($tab, 'topic');
 }
 if (!isNum($pagesize)) {
     $pagesize = 10;
 }
 if (empty($datacount)) {
     $sql = 'select count(*) from {pre}' . $tab . ' where ' . $pre . '_id IN ( select r_b from {pre}' . $tab . '_relation where r_type=2 and r_a=' . $id . ')';
     $datacount = $db->getOne($sql);
     $pagecount = ceil($datacount / $pagesize);
 }
 if ($datacount == 0) {
     $pagecount = 1;
 }
 echo '正在开始生成专题<font color=red>' . $tpl->T["t_name"] . '</font>的列表,共<font color=red>' . $pagecount . '</font>页<br>';
Example #26
0
function get_license($sequence_of_image, $license_num)
{
    // load unique license data
    $current_user = wp_get_current_user();
    //echo("<pre>".print_r($current_user,true)."</pre>");
    //echo("<pre>".print_r($_SESSION['nzshpcrt_cart'],true)."</pre>");
    $agreement_number = uniqid();
    $agreement_date = date("m.d.y");
    $customer_name = $current_user->last_name . " " . $current_user->first_name;
    if (isset($current_user->user_description) && $current_user->user_description != '') {
        $media_name = "«" . $current_user->user_description . "»";
    } else {
        $media_name = '[не указано]';
    }
    if (isset($current_user->discount) && $current_user->discount != '') {
        $discount = (int) $current_user->discount;
    } else {
        $discount = 0;
    }
    if (isset($_SESSION['nzshpcrt_cart'])) {
        $price = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->price;
        $percent_to_pay = 100 - $discount;
        $price = $price / 100 * $percent_to_pay;
        $image_name = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->name;
        $image_number = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->product_id;
        $author_name = $_SESSION['nzshpcrt_cart'][$sequence_of_image]->author;
    }
    //pokazh($current_user);
    if (isset($current_user) && $current_user->ID == 106) {
        echo "<div style='color:red;'>Демонстрационная лицензия</div>";
        $agreement_number = "XXXXXXX";
        $customer_name = "Демо-пользователь";
        $image_number = "XXXX-номер изображения";
        $image_name = "Название рисунка";
        $author_name = "Имя автора";
        $media_name = "Название компании покупателя";
        $price = "XXX-Цена";
    }
    //load License template
    $filename = '';
    //pokazh($license_num,"-license_num");
    switch ($license_num) {
        case 1:
            $filename = getcwd() . "/" . "license_limited_template.htm";
            break;
        case 2:
            $filename = getcwd() . "/" . "license_standard_template.htm";
            break;
        case 3:
            $filename = getcwd() . "/" . "license_extended_template.htm";
            break;
        default:
            $filename = getcwd() . "/" . "license_limited_template.htm";
            break;
    }
    $content = loadFile($filename);
    //echo $filename;
    //echo $content;
    // replace placeholders
    $content = str_replace('#agreement_number#', $agreement_number, $content);
    $content = str_replace('#agreement_date#', $agreement_date, $content);
    $content = str_replace('#customer_name#', $customer_name, $content);
    $content = str_replace('#image_number#', $image_number, $content);
    $content = str_replace('#image_name#', $image_name, $content);
    $content = str_replace('#author_name#', $author_name, $content);
    $content = str_replace('#media_name#', $media_name, $content);
    $content = str_replace('#price#', $price, $content);
    // output content
    echo $content;
}
Example #27
0
    chdir($returndir);
}
function void($x)
{
}
$file = file(WCFTEST_STANDALONE_PATH . 'config.inc.php');
$const = null;
foreach ($file as $row) {
    if (preg_match('/define\\(\'([A-Z]+_DIR)\'/', $row, $res)) {
        $const = $res[1];
    }
}
if (!$const) {
    throw new Exception('cannot find standalone installation #1');
}
// load wcf config
loadFile(WCFTEST_STANDALONE_PATH . 'config.inc.php');
$standalone_dir = constant($const);
if (!$standalone_dir) {
    throw new Exception('cannot find standalone installation #2');
}
// load global file, including autoloader
loadFile($standalone_dir . RELATIVE_WCF_DIR . 'global.php');
loadFile(WCFTEST_STANDALONE_PATH . 'options.inc.php');
$GLOBALS['packageDirs'][] = WCF_DIR;
// base classes
require_once 'WCFTest.php';
require_once 'WCFModelTest.php';
require_once 'WCFDirectoryTest.php';
require_once 'WCFHTTPTest.php';
require_once 'WCFNullWrapper.php';
<?php

$profileName = getRequestParam("profile_name");
$fileContents = loadFile($profileName);
echo $fileContents;
function getRequestParam($key)
{
    return $_GET[$key];
}
function loadFile($profileName)
{
    $filePath = $_SERVER['DOCUMENT_ROOT'] . "/viking-saga/" . $profileName . ".txt";
    $myfile = fopen($filePath, "r") or die("Unable to open file!");
    $fileContents = fread($myfile, filesize($filePath));
    fclose($myfile);
    return $fileContents;
}
function saveFile($fileContents)
{
    $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/viking-saga/ethlore.txt", "wb");
    fwrite($fp, $fileContents);
    fclose($fp);
}
function fill_invoice($filename, $invoice_number = '', $invoice_date = '', $smi = '', $client_details = '', $product_list = '', $total = '', $count = '', $invoice_period = '', $contract_number = '', $contract_date = '')
{
    if ($invoice_number == '') {
        $invoice_number = '____';
    }
    $today = getdate();
    if ($invoice_date == '') {
        $invoice_date = $today[mday] . "." . $today[mon] . "." . $today[year];
    }
    if ($client_details == '') {
        $client_details = 'данные покупателя неизвестны';
    }
    if ($product_list == '') {
        $product_list = '<tr><td colspan=6> нет </td></tr>';
    }
    if ($total == '') {
        $total = 0;
    }
    if ($count == '') {
        $count = 0;
    }
    $content = loadFile($filename);
    $total_rub_text = "<b>" . capitalizefirst(num2str($total)) . "</b>";
    // replace placeholders
    $content = str_replace('{invoice_number}', $invoice_number, $content);
    $content = str_replace('{invoice_date}', $invoice_date, $content);
    $content = str_replace('{smi}', $smi, $content);
    $content = str_replace('{client_details}', $client_details, $content);
    $content = str_replace('{product_list}', $product_list, $content);
    $content = str_replace('{total}', $total, $content);
    $content = str_replace('{count}', $count, $content);
    $content = str_replace('{total_rub_text}', $total_rub_text, $content);
    $content = str_replace('{invoice_period}', $invoice_period, $content);
    $content = str_replace('{contract_number}', $contract_number, $content);
    $content = str_replace('{contract_date}', $contract_date, $content);
    // output content
    //pokazh($content);
    return $content;
}
Example #30
0
 /**
  * Загрузить приложение
  * @access private
  * @return bool Статус загрузки
  */
 private function loadApp($typeApp)
 {
     if (loadFile($this->folderAppendix . $typeApp)) {
         $nameApp = $this->nameAppendix;
         $typeApp = substr($typeApp, 1, -4);
         if ($typeApp != 'model') {
             $this->typeAppendix = $typeApp;
         }
         $nameClass = $nameApp . '_' . $typeApp;
         return class_exists($nameClass) ? $this->{$nameClass} = new $nameClass() : true;
     }
     return false;
 }