Пример #1
0
 /**
  * Clear all assigned variables
  *
  * Clears all variables assigned to Zend_View either via {@link assign()} or
  * property overloading ({@link __get()}/{@link __set()}).
  *
  * @return void
  */
 public function clearVars()
 {
     if ($this->_smarty instanceof Smarty) {
         $this->_smarty->clear_all_assign();
     } elseif (!empty($this->_smartyMethods['assign'])) {
         unset($this->_smartyMethods['assign']);
     }
 }
Пример #2
0
 public function output($pFolder)
 {
     Folder::deleteRecursive($pFolder);
     Folder::create($pFolder);
     Folder::create($pFolder . '/classes');
     $smarty = new \Smarty();
     $smarty->clear_all_assign();
     $smartyDir = "includes/libs/core/tools/docs/templates/_cache/";
     $smarty->template_dir = "includes/libs/core/tools/docs/templates";
     $smarty->cache_dir = $smartyDir;
     $smarty->compile_dir = $smartyDir;
     $classIndex = array();
     foreach ($this->packages as $className => $details) {
         $parts = explode("\\", $className);
         $class = array_pop($parts);
         while (in_array($class, $classIndex) && !empty($parts)) {
             $class = $class . '\\' . array_pop($parts);
         }
         $file = 'classes/' . str_replace('\\', '_', $class) . '.html';
         $classIndex[] = array('name' => $class, 'href' => $file);
         $smarty->clear_all_assign();
         $details['name'] = $class;
         $smarty->assign('details', $details);
         file_put_contents($pFolder . $file, Encoding::BOM() . $smarty->fetch("template.class_details.tpl"));
     }
     $this->sortName($classIndex);
     $prefixed_ndx = array();
     foreach ($classIndex as $class) {
         $firstLetter = strtoupper(substr($class['name'], 0, 1));
         if (!array_key_exists($firstLetter, $prefixed_ndx)) {
             $prefixed_ndx[$firstLetter] = array();
         }
         $prefixed_ndx[$firstLetter][] = $class;
     }
     $classIndex = $prefixed_ndx;
     $smarty->clear_all_assign();
     $smarty->assign('classIndex', $classIndex);
     file_put_contents($pFolder . '/classes.html', Encoding::BOM() . $smarty->fetch("template.classes.tpl"));
     $smarty->clear_all_assign();
     file_put_contents($pFolder . '/index.html', Encoding::BOM() . $smarty->fetch("template.index.tpl"));
 }
Пример #3
0
 public function Clear($tpl_var = NULL)
 {
     if (is_null($tpl_var)) {
         return parent::clear_all_assign();
     }
     return parent::clear_assign($tpl_var);
 }
Пример #4
0
function combat_report($pid, $sid)
{
    global $combat;
    if (COMBAT_VERBOSE) {
        start_timer(1);
        echo "Erstelle Kampfbericht...";
    }
    $combat_smarty = new Smarty();
    global $__base_inc_dir;
    $combat_smarty->template_dir = $__base_inc_dir . "battle/templates/";
    $combat_smarty->compile_dir = $__base_inc_dir . "battle/templates_c";
    $combat_smarty->config_dir = $__base_inc_dir . "battle/configs/";
    $combat_smarty->cache_dir = $__base_inc_dir . "battle/cache/";
    $puid = get_uid_by_pid($pid);
    if ($pid) {
        if ($puid) {
            $puname = get_name_by_uid($puid);
        } else {
            $puname = "no owner";
        }
        if ($pid == -1) {
            $combat_smarty->assign("location", "SimOrbit");
        } else {
            $combat_smarty->assign("location", get_planetname($pid) . " ({$puname})");
        }
    } else {
        $combat_smarty->assign("location", get_systemname($sid));
    }
    $invader_id = combat_get_conqueror($pid);
    if (!$invader_id) {
        $combat_smarty->assign("invasion", "");
    } else {
        $combat["shots_fired"]++;
        if ($invader_id < 0 && $invader_id > -100) {
            $combat_smarty->assign("invasion", "Planet1 has been invaded by Side2");
        } elseif ($invader_id == -100) {
            $combat_smarty->assign("invasion", "Planetary combat, production was delayed.");
        } else {
            $combat_smarty->assign("invasion", get_planetname($pid) . " has been invaded by " . get_name_by_uid($invader_id));
        }
    }
    // Admiraele berichten
    $query = $GLOBALS["db"]->query("SELECT SUM(c1.challenge) AS xp_earned, c2.admiral_id AS admiral_id, c2.uid \nAS uid FROM combat c1 INNER JOIN combat c2 ON (c1.killed_by=c2.id) WHERE c2.admiral_id <> 0 \nGROUP BY c2.admiral_id") or die("Admiral-XP: " . $GLOBALS["db"]->error);
    while ($result = $query->fetch_assoc()) {
        if (!is_array($results[$result["uid"]]["admirals"])) {
            $aidx = 0;
        } else {
            $aidx = sizeof($results[$result["uid"]]["admirals"]);
        }
        $results[$result["uid"]]["admirals"][$aidx]["name"] = dlookup("name", "admirals", "id=" . $result["admiral_id"]);
        if (is_null(dlookup("killed_by", "combat", "admiral_carried=" . $result["admiral_id"]))) {
            $results[$result["uid"]]["admirals"][$aidx]["xp"] = dlookup("value", "admirals", "id=" . $result["admiral_id"]);
            $results[$result["uid"]]["admirals"][$aidx]["newxp"] = dlookup("value", "admirals", "id=" . $result["admiral_id"]) + $result["xp_earned"];
            $results[$result["uid"]]["admirals"][$aidx]["lvlup"] = calculate_admiral_level(dlookup("value", "admirals", "id=" . $result["admiral_id"]) + $result["xp_earned"]) != calculate_admiral_level(dlookup("value", "admirals", "id=" . $result["admiral_id"]));
        }
    }
    $users_query = $GLOBALS["db"]->query("SELECT DISTINCT uid, aid FROM combat") or die($GLOBALS["db"]->error);
    if (!$users_query) {
        return false;
    }
    while ($users_result = $users_query->fetch_assoc()) {
        // Feinde
        $results_query = $GLOBALS["db"]->query("SELECT alliance2 FROM diplomacy dp WHERE status=0 AND \nalliance1=" . $users_result["aid"]) or die($GLOBALS["db"]->error);
        if (!$results_query) {
            return false;
        }
        while (list($results[$users_result["uid"]]["enemies"][]) = $results_query->fetch_row()) {
        }
        // Schiffe gesamt
        $namefield = "CONCAT(p.name, ' ', IF(c.position='L','[unloaded]',\nIF(c.position='T','[on transport]',IF(c.position='U','[landed]',IF(IFNULL(c.killed_special,'')='E',\n'[disabled]',IF(IFNULL(c.killed_special,'')='R', '[captured]', ''))))))";
        $results_query = $GLOBALS["db"]->query("SELECT {$namefield} AS name, \nSUM(c.count_max) AS count FROM combat c INNER JOIN production p \nUSING (prod_id) WHERE uid=" . $users_result["uid"] . " GROUP BY p.name, c.position, c.killed_special") or die($GLOBALS["db"]->error);
        if (!$results_query) {
            return false;
        }
        while ($unit = $results_query->fetch_assoc()) {
            $results[$users_result["uid"]]["ships"][$unit["name"]] = $unit["count"];
        }
        // Schiffe zerstört
        $results_query = $GLOBALS["db"]->query("SELECT {$namefield} AS name, SUM(c.count_max-c.count) AS count,\nIFNULL(c.killed_special,'') AS killed_special FROM combat c INNER JOIN production p \nUSING (prod_id) WHERE uid=" . $users_result["uid"] . " GROUP BY p.name, c.position, c.killed_special") or die($GLOBALS["db"]->error);
        if (!$results_query) {
            return false;
        }
        while ($unit = $results_query->fetch_assoc()) {
            if ($unit["killed_special"] != "E" && $unit["killed_special"] != "R") {
                $results[$users_result["uid"]]["destroyed_ships"][$unit["name"]] = $unit["count"];
            }
        }
        // Schiffe lebendig
        $results_query = $GLOBALS["db"]->query("SELECT {$namefield} AS name, SUM(c.count) AS count,\nIFNULL(c.killed_special,'') AS killed_special FROM combat c INNER JOIN production p \nUSING (prod_id) WHERE c.killed_by IS NULL AND uid=" . $users_result["uid"] . " GROUP BY p.name, c.position, \nc.killed_special") or die($GLOBALS["db"]->error);
        if (!$results_query) {
            return false;
        }
        while ($unit = $results_query->fetch_assoc()) {
            if ($unit["killed_special"] != "E" && $unit["killed_special"] != "R") {
                $results[$users_result["uid"]]["remaining_ships"][$unit["name"]] = $unit["count"];
            }
        }
    }
    // Planetare Schilde berichten
    $query = $GLOBALS["db"]->query("SELECT 'Planetary shields' AS name, SUM(c.shield) AS shieldsum, \nSUM(c.shield_max) AS maxsum FROM combat c INNER JOIN production p USING (prod_id) WHERE c.special \nLIKE 'H%'") or die($GLOBALS["db"]->error);
    while ($result = $query->fetch_assoc()) {
        if ($result["maxsum"] > 0) {
            $results[$puid]["ships"][$result["name"]] = $result["maxsum"];
            $results[$puid]["destroyed_ships"][$result["name"]] = $result["maxsum"] - $result["shieldsum"];
            $results[$puid]["remaining_ships"][$result["name"]] = $result["shieldsum"];
        }
    }
    $combat_smarty->assign("results", $results);
    $users_query = $GLOBALS["db"]->query("SELECT DISTINCT uid FROM combat") or die($GLOBALS["db"]->error);
    if (!$users_query) {
        return false;
    }
    while ($users_result = $users_query->fetch_assoc()) {
        if ($users_result["uid"] < 0) {
            $users[$users_result["uid"]] = "BattleSim Side " . $users_result["uid"] * -1;
        } else {
            $users[$users_result["uid"]] = get_name_by_uid($users_result["uid"]);
        }
    }
    $combat_smarty->assign("users", $users);
    ob_start();
    $combat_smarty->display("battlereport.tpl");
    $report = ob_get_contents();
    ob_end_clean();
    $combat_smarty->clear_all_assign();
    // Report abspeichern
    if (BATTLE_DESTROY && $combat["shots_fired"] > 0) {
        $week = dlookup("week", "timeinfo");
        $sth = $GLOBALS["db"]->query("INSERT INTO battlereports SET pid={$pid}, sid={$sid}, \nreport='" . addslashes($report) . "', week={$week}") or die($GLOBALS["db"]->error);
        $report_id = $GLOBALS["db"]->insert_id;
        $query = $GLOBALS["db"]->query("SELECT DISTINCT uid FROM combat") or die($GLOBALS["db"]->error);
        while (list($id) = $query->fetch_row()) {
            $sth = $GLOBALS["db"]->query("INSERT INTO battlereports_user (uid, rid) VALUES ({$id}, {$report_id})") or die($GLOBALS["db"]->error);
        }
        $query = $GLOBALS["db"]->query("SELECT DISTINCT aid FROM combat") or die($GLOBALS["db"]->error);
        while (list($id) = $query->fetch_row()) {
            $sth = $GLOBALS["db"]->query("INSERT INTO battlereports_alliance (aid, rid) VALUES ({$id}, {$report_id})") or die($GLOBALS["db"]->error);
        }
    }
    if (COMBAT_VERBOSE) {
        echo "OK! (" . round(read_timer(1), 4) . "s)" . COMBAT_NEWLINE . COMBAT_NEWLINE;
    }
    if (!BATTLE_DESTROY) {
        echo "{$report}" . COMBAT_NEWLINE . COMBAT_NEWLINE;
    }
}
Пример #5
0
 /**
  * Creates a Smarty object.
  *
  * @return Smarty    initialized (cleared) Smarty context.
  * @throws Exception the execute method will catch
  *                   and rethrow as a <code>BuildException</code>
  */
 public function initControlContext()
 {
     $this->context->clear_all_assign();
     return $this->context;
 }
Пример #6
0
 /**
  * Clear all assigned variables
  *
  * Clears all variables assigned to Zend_View either via
  * {@link assign()} or property overloading
  * ({@link __get()}/{@link __set()}).
  *
  * @return void
  */
 public function clearVars()
 {
     $this->smarty->clear_all_assign();
 }
Пример #7
0
$smarty->assign("Contact_Phone", $Contact_Phone);
$smarty->assign("Contact_Fax", $Contact_Fax);
$smarty->assign("SUPPORT_EMAIL", $SUPPORT_EMAIL);
$smarty->assign("SITE_ADV_SUPPORT_TEXT", $SITE_ADV_SUPPORT_TEXT);
$smarty->assign("SITE_JS", SITE_JS);
$smarty->assign("S_JQUERY", S_JQUERY);
$smarty->assign("CK_EDITOR_PATH", CK_EDITOR_PATH);
$smarty->assign("CK_EDITOR_URL", CK_EDITOR_URL);
$smarty->assign("SITE_JS_AJAX", SITE_JS_AJAX);
$smarty->assign("SITE_VALIDATION_JS", SITE_VALIDATION_JS);
$smarty->assign("SITE_CONTENT_JS", SITE_CONTENT_JS);
// $smarty->assign("S_PROTOTYPE",S_PROTOTYPE);
$smarty->assign("SITE_CO_URL", SITE_CO_URL);
$smarty->assign("COPYRIGHT_TEXT", $COPYRIGHT_TEXT);
$smarty->assign("PRJ_DB_PREFIX", PRJ_DB_PREFIX);
$smarty->assign("PRJ_CONST_PREFIX", PRJ_CONST_PREFIX);
$smarty->assign("bodyid", $bodyid);
$smarty->assign("bodycls", $bodycls);
$smarty->assign("dvid", $dvid);
$smarty->assign("mdivid", $mdivid);
$smarty->assign("cssfile", $cssfile);
$curSessid = isset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ID']) ? $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ID'] : '';
$smarty->assign("curSessid", $curSessid);
//Prints($_SESSION);exit;
//display index file tpl
$smarty->display("index.tpl");
$smarty->clear_all_assign();
$dbobj->MySQLClose();
unset($dbobj);
include_once S_SECTIONS . "/member/atlast.php";
exit;
Пример #8
0
 function clear()
 {
     $this->smarty->clear_all_assign();
     $this->smarty->assign('context', $this->context);
 }
Пример #9
0
 /**
  * template variable setter
  *
  * clear previous Smarty assignments
  *
  * @param  array $variables
  * @return SimpleMail_Template_SmartyRenderer
  */
 public function setVariables(array $variables)
 {
     $this->smarty->clear_all_assign();
     return parent::setVariables($variables);
 }
Пример #10
0
 public function unsetAll()
 {
     $this->tpl->clear_all_assign();
 }