Example #1
0
 /**
  * Get the Paginator
  * 
  * @param int    $pg
  * @param int    $all
  * @param string $text
  * @return string
  */
 public static function get($pg = 0, $all = 0, $text = '')
 {
     $go = '';
     $page1 = $pg - 2;
     $page2 = $pg - 1;
     $page3 = $pg + 1;
     $page4 = $pg + 2;
     if ($page1 > 0) {
         $go .= '<a href="' . $_SERVER['PHP_SELF'] . '?pg=' . $page1 . $text . '">' . $page1 . '</a> ';
     }
     if ($page2 > 0) {
         $go .= '<a href="' . $_SERVER['PHP_SELF'] . '?pg=' . $page2 . $text . '">' . $page2 . '</a> ';
     }
     $go .= $pg . ' ';
     if ($page3 <= $all) {
         $go .= '<a href="' . $_SERVER['PHP_SELF'] . '?pg=' . $page3 . $text . '">' . $page3 . '</a> ';
     }
     if ($page4 <= $all) {
         $go .= '<a href="' . $_SERVER['PHP_SELF'] . '?pg=' . $page4 . $text . '">' . $page4 . '</a> ';
     }
     if ($all > 3 && $all > $page4) {
         $go .= '... <a href="' . $_SERVER['PHP_SELF'] . '?pg=' . $all . $text . '">' . $all . '</a>';
     }
     if ($page1 > 1) {
         $go = '<a href="' . $_SERVER['PHP_SELF'] . '?pg=1' . $text . '">1</a> ... ' . $go;
     }
     if ($go != $pg . ' ') {
         return '<tr><td class="border" colspan="' . (array_sum(Config::getSection('Display')) + 1) . '">&#160;' . $go . '</td></tr>';
     } else {
         return '';
     }
 }
Example #2
0
 public static function DBSetup()
 {
     $config = \Config::getSection("DB1");
     if (!self::$CONNECTED) {
         R::setup('mysql:host=localhost;dbname=' . $config['dbname'], $config['username'], $config['password']);
         self::$CONNECTED = true;
     }
 }
Example #3
0
 public static function initDB($configname)
 {
     if (!self::$connected) {
         self::$connected = true;
     }
     self::$map[$configname] = new \app\model\AbstractDb(\Config::getSection($configname));
     return self::$map[$configname];
 }
Example #4
0
 /**
  * Returns a shipping handler instance
  */
 public function getShippingHandler($className)
 {
     ClassLoader::import('library.shipping.method.' . $className);
     $inst = new $className();
     $c = $this->config->getSection('shipping/' . $className);
     foreach ($c as $key => $value) {
         $value = $this->config->get($key);
         $key = substr($key, strlen($className) + 1);
         $inst->setConfigValue($key, $value);
     }
     return $inst;
 }
Example #5
0
 static function fetchSkin($templateName)
 {
     $skin = session_getSkin();
     self::addCss($skin);
     self::addJs('jquery', 'dex');
     if (Config::get('search.acEnable')) {
         self::addCss('jqueryui');
         self::addJs('jqueryui');
     }
     $skinVariables = array_merge(Config::getSection("skin-default"), Config::getSection("skin-{$skin}"));
     self::assign('skinVariables', $skinVariables);
     self::registerOutputFilters();
     return self::fetch($templateName);
 }
Example #6
0
 static function fetchSkin()
 {
     $skin = session_getSkin();
     self::addCss($skin);
     self::addJs('jquery', 'dex');
     $acEnable = self::$theSmarty->tpl_vars['acEnable']->value;
     if ($acEnable) {
         self::addCss('jqueryui');
         self::addJs('jqueryui');
     }
     $skinVariables = array_merge(Config::getSection("skin-default"), Config::getSection("skin-{$skin}"));
     self::assign('skinVariables', $skinVariables);
     self::registerOutputFilters();
     return self::fetch("pageLayout.ihtml");
 }
Example #7
0
 public function setupDB()
 {
     $config = \Config::getSection("DB1");
     R::setup("mysql:host={$config['host']};dbname={$config['dbname']}", "{$config['username']}", "{$config['password']}");
 }
Example #8
0
 /**
  * listArchive
  *
  * @todo refactoring to ListData
  * @param string $down
  * @return string
  */
 public function listArchive($down = '')
 {
     $zip = $this->_open();
     $list = $zip->listContent();
     if (!$list) {
         if (Config::get('Gmanager', 'mode') == 'FTP') {
             Gmanager::getInstance()->ftpArchiveEnd();
         }
         return '<tr class="border"><td colspan="' . (array_sum(Config::getSection('Display')) + 1) . '">' . Helper_View::message(Language::get('archive_error') . '<br/>' . $zip->errorInfo(true), Helper_View::MESSAGE_ERROR_EMAIL) . '</td></tr>';
     } else {
         $r_current = Helper_View::getRawurl($this->_name);
         $l = '';
         if ($down) {
             $list = array_reverse($list);
         }
         $s = sizeof($list);
         for ($i = 0; $i < $s; ++$i) {
             $r_name = Helper_View::getRawurl($list[$i]['filename']);
             if ($list[$i]['folder']) {
                 $type = 'DIR';
                 $name = htmlspecialchars($list[$i]['filename'], ENT_NOQUOTES);
                 $size = ' ';
                 $down = ' ';
             } else {
                 $type = htmlspecialchars(Helper_System::getType($list[$i]['filename']), ENT_NOQUOTES);
                 $name = '<a href="?c=' . $r_current . '&amp;f=' . $r_name . '">' . htmlspecialchars(Helper_View::strLink($list[$i]['filename'], true), ENT_NOQUOTES) . '</a>';
                 $size = Helper_View::formatSize($list[$i]['size']);
                 $down = '<a href="change.php?get=' . $r_current . '&amp;f=' . $r_name . '">' . Language::get('get') . '</a>';
             }
             $l .= '<tr class="border"><td class="check"><input name="check[]" type="checkbox" value="' . $r_name . '"/></td>';
             if (Config::get('Display', 'name')) {
                 $l .= '<td>' . $name . '</td>';
             }
             if (Config::get('Display', 'down')) {
                 $l .= '<td>' . $down . '</td>';
             }
             if (Config::get('Display', 'type')) {
                 $l .= '<td>' . $type . '</td>';
             }
             if (Config::get('Display', 'size')) {
                 $l .= '<td>' . $size . '</td>';
             }
             if (Config::get('Display', 'change')) {
                 $l .= '<td><a href="change.php?c=' . $r_current . '&amp;f=' . $r_name . '">' . Language::get('ch') . '</a></td>';
             }
             if (Config::get('Display', 'del')) {
                 $l .= '<td><a onclick="return Gmanager.delNotify();" href="change.php?go=del_zip_archive&amp;c=' . $r_current . '&amp;f=' . $r_name . '">' . Language::get('dl') . '</a></td>';
             }
             if (Config::get('Display', 'chmod')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'date')) {
                 $l .= '<td>' . strftime(Config::get('Gmanager', 'dateFormat'), $list[$i]['mtime']) . '</td>';
             }
             if (Config::get('Display', 'uid')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'gid')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'n')) {
                 $l .= '<td>' . ($i + 1) . '</td>';
             }
             $l .= '</tr>';
         }
         if (Config::get('Gmanager', 'mode') == 'FTP') {
             Gmanager::getInstance()->ftpArchiveEnd();
         }
         $prop = $zip->properties();
         if (isset($prop['comment']) && $prop['comment'] != '') {
             if (mb_convert_encoding($prop['comment'], 'UTF-8', 'UTF-8') != $prop['comment']) {
                 $prop['comment'] = mb_convert_encoding($prop['comment'], 'UTF-8', Config::get('Gmanager', 'altEncoding'));
             }
             $l .= '<tr class="border"><td>' . Language::get('comment_archive') . '</td><td colspan="' . (array_sum(Config::getSection('Display')) + 1) . '"><pre>' . htmlspecialchars($prop['comment'], ENT_NOQUOTES) . '</pre></td></tr>';
         }
         return $l;
     }
 }
Example #9
0
 public function __construct()
 {
     $this->minified = new Minifier(array('echo' => false, 'encode' => false, 'gzip' => false));
     self::$BUILD_PATH = BUILD_PATH . 'resources_cache/';
     $this->const = Config::getSection("CLIENT_CONST");
 }
Example #10
0
 public static function invoke($_conf = array())
 {
     try {
         Browser::time("invoked");
         $global_config = array_merge(array('CONTROLLER' => 'web.php', 'DEFAULT_DB' => 'DB1', 'CONSOLE_FUN' => 'console.log', 'RX_MODE_DEBUG' => FALSE, 'PROJECT_ROOT_DIR' => "./"), $_conf);
         // Loads all the Constants
         define('PROJECT_ROOT_DIR', $global_config['PROJECT_ROOT_DIR']);
         define('PROJECT_ID', md5(PROJECT_ROOT_DIR . $global_config['CONTROLLER']));
         FileUtil::$PROJECT_ROOT_DIR = PROJECT_ROOT_DIR;
         include_once 'constants.php';
         ob_start();
         session_start();
         Config::load(PROJECT_ROOT_DIR . "app/meta/project.properties", PROJECT_ROOT_DIR . "config/project.properties", $global_config);
         // Initialze Rudrax
         self::init();
         Browser::time("After Init");
         $config = Config::getSection("GLOBAL");
         $db_connect = false;
         Browser::time("Before DB Connect");
         /**
          * NOTE:- NO need to connect DB automatically, it should be connecte donly when required;
          */
         // if (isset ( $config ["DEFAULT_DB"] )) {
         // $RDb = self::getDB ( $config ["DEFAULT_DB"] );
         // $db_connect = true;
         // }
         Browser::time("Before-First Reload");
         // Define Custom Request Plugs
         if (FIRST_RELOAD) {
             ClassUtil::scan();
         }
         self::findAndExecuteController();
         self::invokeController();
         return null;
         Browser::time("Before Saving");
         Config::save();
         Browser::time("Invoked:Ends");
     } catch (Exception $e) {
         print_line($e->getMessage());
         print_line($e->getTraceAsString());
     }
 }
Example #11
0
 /**
  * listArchive
  *
  * @todo refactoring to ListData
  * @param string $down
  * @return string
  */
 public function listArchive($down = '')
 {
     $rar = $this->_open();
     $list = $rar->getEntries();
     if (!$list) {
         if (Config::get('Gmanager', 'mode') == 'FTP') {
             Gmanager::getInstance()->ftpArchiveEnd();
         }
         return '<tr class="border"><td colspan="' . (array_sum(Config::getSection('Display')) + 1) . '">' . Helper_View::message(Language::get('archive_error'), Helper_View::MESSAGE_ERROR_EMAIL) . '</td></tr>';
     } else {
         $r_current = Helper_View::getRawurl($this->_name);
         $l = '';
         $i = 0;
         if ($down) {
             $list = array_reverse($list);
         }
         foreach ($list as $entry) {
             $r_name = Helper_View::getRawurl($entry->getName());
             if ($entry->isDirectory()) {
                 $type = 'DIR';
                 $name = htmlspecialchars($entry->getName(), ENT_NOQUOTES);
                 $size = ' ';
                 $down = ' ';
             } else {
                 $type = htmlspecialchars(Helper_System::getType($entry->getName()), ENT_NOQUOTES);
                 $name = '<a href="?c=' . $r_current . '&amp;f=' . $r_name . '">' . htmlspecialchars(Helper_View::strLink($entry->getName(), true), ENT_NOQUOTES) . '</a>';
                 $size = Helper_View::formatSize($entry->getUnpackedSize());
                 $down = '<a href="change.php?get=' . $r_current . '&amp;f=' . $r_name . '">' . Language::get('get') . '</a>';
             }
             $l .= '<tr class="border"><td class="check"><input name="check[]" type="checkbox" value="' . $r_name . '"/></td>';
             if (Config::get('Display', 'name')) {
                 $l .= '<td>' . $name . '</td>';
             }
             if (Config::get('Display', 'down')) {
                 $l .= '<td>' . $down . '</td>';
             }
             if (Config::get('Display', 'type')) {
                 $l .= '<td>' . $type . '</td>';
             }
             if (Config::get('Display', 'size')) {
                 $l .= '<td>' . $size . '</td>';
             }
             if (Config::get('Display', 'change')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'del')) {
                 $l .= '<td>' . Language::get('dl') . '</td>';
             }
             if (Config::get('Display', 'chmod')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'date')) {
                 $l .= '<td>' . strftime(Config::get('Gmanager', 'dateFormat'), strtotime($entry->getFileTime())) . '</td>';
             }
             if (Config::get('Display', 'uid')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'gid')) {
                 $l .= '<td> </td>';
             }
             if (Config::get('Display', 'n')) {
                 $l .= '<td>' . ++$i . '</td>';
             }
             $l .= '</tr>';
         }
         if (Config::get('Gmanager', 'mode') == 'FTP') {
             Gmanager::getInstance()->ftpArchiveEnd();
         }
         return $l;
     }
 }
Example #12
0
 /**
  * getListIncorrectSearchString
  *
  * @return string
  */
 public static function getListIncorrectSearchString()
 {
     return '<div class="list1"><th colspan="' . (array_sum(Config::getSection('Display')) + 1) . '">' . Language::get('regexp_error') . '</th></div>';
 }
Example #13
0
 /**
  * getListNotFoundData
  *
  * @return string
  */
 public static function getListNotFoundData()
 {
     return '<tr class="border"><th colspan="' . (array_sum(Config::getSection('Display')) + 1) . '">' . Language::get('directory_not_found') . '</th></tr>';
 }
Example #14
0
<?php

/**
 * Created by PhpStorm.
 * User: iMCDb
 * Date: 10/18/15
 * Time: 3:16 AM
 */
namespace app\utils;

class Maple
{
    public static $ALLOWED_TAGS;
    public static $SITE_KEY;
}
$SETTINGS = \Config::getSection("SETTINGS");
Maple::$ALLOWED_TAGS = $SETTINGS["allowed_tags"];
Maple::$SITE_KEY = $SETTINGS["sitekey"];
Example #15
0
 public static function initDB($configname)
 {
     if (!self::$connected) {
         include_once "db/AbstractDb.php";
         self::$connected = true;
     }
     self::$map[$configname] = new AbstractDb(Config::getSection($configname));
     return self::$map[$configname];
 }