Esempio n. 1
0
 static function load($module_name)
 {
     if (!($path = Find::dir_in("modules", $module_name))) {
         throw new \Exception("Module '{$module_name}' not found");
     }
     if (file_exists($path . "init.php")) {
         include $path . "init.php";
     }
     // add to autoloader
     Autoload::add_path($path . "classes");
     // add module instance to stack
     $class_name = "\\Fw\\Module\\" . ucfirst($module_name);
     if (class_exists($class_name)) {
         self::register(new $class_name());
     } else {
         throw new \Exception("Module Class '{$class_name}' not found");
     }
 }
Esempio n. 2
0
 static function init()
 {
     define("DS", DIRECTORY_SEPARATOR);
     // Constants
     define('DOCROOT', dirname($_SERVER["SCRIPT_FILENAME"]) . DS);
     // Derive Some Config variables from URL
     $_base = function () {
         $_b = explode(DS, $_SERVER["SCRIPT_NAME"]);
         return substr($_SERVER["SCRIPT_NAME"], 0, strlen($_b[sizeof(explode(DS, $_SERVER["SCRIPT_NAME"])) - 1]) * -1);
     };
     \Fw\Config::set("base", $_base());
     $_SERVER["HTTPS"] = isset($_SERVER["HTTPS"]) ? $_SERVER["HTTPS"] : "off";
     if (isset($_SERVER["SERVER_NAME"])) {
         \Fw\Config::set("domain", @$_SERVER["HTTPS"] == "on" ? "https://" . $_SERVER["SERVER_NAME"] : "http://" . $_SERVER["SERVER_NAME"]);
     } else {
         \Fw\Config::set("domain", "");
     }
     // Set Application Directory to server path
     if (!Config::exists("apppath")) {
         $app_path = DOCROOT;
     } else {
         $app_path = Config::get("apppath");
     }
     // Autoload Application Class
     \Fw\Autoload::add_path($app_path . "classes");
     // PHP Composer Autoloader
     if (file_exists($app_path . "/vendor/autoload.php")) {
         include $app_path . "/vendor/autoload.php";
     }
     // Configuration
     \Fw\Config::set("docroot", DOCROOT);
     // doc root
     \Fw\Config::set("apppath", $app_path);
     // application path
     // Finder Paths
     Find::add_path_to("controllers", \Fw\Config::get("apppath") . "controllers");
     Find::add_path_to("views", Config::get("apppath") . "views");
     Find::add_path_to("assets", Config::get("apppath") . "assets");
     Find::add_path_to("assets", Config::get("apppath") . "bower_components");
     Find::add_path_to("modules", Config::get("apppath") . "modules");
 }
Esempio n. 3
0
<?php

header("Content-type: text/html; charset=utf-8");
error_reporting(0);
include "search.class.php";
include "tpl.class.php";
$tpl = new Template();
$ga = new Find();
if ($_POST['keyword'] && $_POST['by'] != '4' && $_POST['by'] != '5') {
    if ($ga->Zing()) {
        $arr = $ga->arr;
        $main = $tpl->get('theme/list_song');
        $row = $tpl->get_block($main, 'list_row', 1);
        $html = "";
        for ($i = 1; $i <= count($arr) - 2; $i++) {
            if ($i % 2 != 0) {
                $class = "class=even";
            } else {
                $class = "";
            }
            $html .= $tpl->assign($row, array('song.NAME' => $ga->cut_string($arr[$i]['name'], 27, true), 'song.SINGER' => $ga->cut_string($arr[$i]['singer'], 27, true), 'song.ID' => $arr[$i]['id'], 'song.KAT' => $arr[$i]['kat'], 'song.CAT' => $arr[$i]['cat'], 'song.KBS' => $arr[$i]['kbs'], 'song.TYPE' => $arr[$i]['type'], 'song.RATE' => $arr[$i]['rate'], 'song.CLASS' => $class, 'song.NUM' => $i, 'server' => URL_SERVER));
        }
        # Phân Trang
        if ($ga->page > 1) {
            $prev = $ga->page - 1;
            $pre = '<a href="javascript:void(0);" onclick="loadAjax(\'' . $ga->keyword . '\',\'' . $prev . '\',\'' . $_POST['by'] . '\',\'' . $ga->total . '\');"><img src="theme/img/prev.png" style="border:0px solid;"></a>';
        }
        if ($ga->page < $ga->result) {
            $next = $ga->page + 1;
            $ne = '<a href="javascript:void(0);" onclick="loadAjax(\'' . $ga->keyword . '\',\'' . $next . '\',\'' . $_POST['by'] . '\',\'' . $ga->total . '\');"><img src="theme/img/next.png" style="border:0px solid;"></a>';
        }
Esempio n. 4
0
 /**
  * FindAny command constructor.
  *
  * @ignore
  * @param \tranduchieu\FileMaker\FileMaker $fm FileMaker object the command was created by.
  * @param string $layout Layout name to find a random record from.
  */
 function __construct($fm, $layout)
 {
     parent::__construct($fm, $layout);
 }
Esempio n. 5
0
if (!defined('E_DEPRECATED')) {
    define('E_DEPRECATED', 8192);
}
// Disable warnings, notices and deprecation messages.
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
require_once 'inc/find.class.php';
$STDERR = fopen('php://stderr', 'w+');
if (php_sapi_name() != "cli") {
    fwrite($STDERR, "Must be run from the command line.\n");
    exit(1);
}
if (!(function_exists("date_default_timezone_set") ? @date_default_timezone_set('UTC') : @putenv("TZ=UTC"))) {
    echo fwrite($STDERR, "Timezone could not be set to UTC.");
    exit(1);
}
$find = new Find();
$directory = NULL;
$cliargs = array_slice($_SERVER['argv'], 1);
$syntax = "Syntax: php find.php [OPTIONS] <directory-to-scan>\nUse -h for full help or visit diskusagereports.com/docs.\n";
$syntax_long = <<<EOT
Syntax: php find.php [OPTIONS] <directory-to-scan>

<directory-to-scan>
The directory that the list of sub-directories and files will be created for.

The OPTIONS are:

      -d <delim>
      The field delimiter for each line in the output.
      The default is the NULL character.
Esempio n. 6
0
 public function perform()
 {
     $data = ['type' => 'FIND_VALUE', 'key_id' => \Kademlia\Node::binId2hex($this->needle_id)];
     $results = parent::perform($data);
     $node_list = new \Kademlia\NodeList();
     $values = [];
     foreach ($results as $res) {
         $nodes = $this->parseNodeList($res['data']);
         $values = array_merge($values, $this->parseValues($res['data']));
         $node_list->addNodeList($nodes);
     }
     $emitted_result = ['node_list' => $node_list, 'values' => $values];
     if ($this->settings->verbosity >= 4) {
         print \Kademlia\Node::binId2hex($this->settings->own_node_id) . ": FindValue process found these nodes\n";
         var_dump($emitted_result['node_list']);
         print \Kademlia\Node::binId2hex($this->settings->own_node_id) . ": end of FindNode process found nodes\n";
     }
     $type = 'done';
     if (count($values) > 0) {
         $type = 'success';
     }
     $this->emit($type, $emitted_result);
 }
Esempio n. 7
0
if (!defined('E_DEPRECATED')) {
    define('E_DEPRECATED', 8192);
}
// Disable warnings, notices and deprecation messages.
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
require_once 'inc/find.class.php';
$STDERR = fopen('php://stderr', 'w+');
if (php_sapi_name() != "cli") {
    fwrite($STDERR, "Must be run from the command line.\n");
    exit(1);
}
if (!(function_exists("date_default_timezone_set") ? @date_default_timezone_set('UTC') : @putenv("TZ=UTC"))) {
    echo fwrite($STDERR, "Timezone could not be set to UTC.");
    exit(1);
}
$find = new Find();
$directory = NULL;
$force32Bit = false;
$cliargs = array_slice($_SERVER['argv'], 1);
$syntax = "Syntax: php find.php [-d <char|'null'>] [-ds <char>] [--force32bit]\n                     [-] <directory-to-scan>\nUse -h for full help or visit diskusagereports.com/docs.\n";
$syntax_long = <<<EOT

Syntax: php find.php [-d <char|'null'>] [-ds <char>] [--force32bit]
                     [-] <directory-to-scan>

Arguments:

-d <char|'null'>
Optionally specify the field delimiter for each line in the output.
Must be a single ASCII character or the word 'null' for the null character.
The default is the space character.