Ejemplo n.º 1
0
 protected function LoadDriver($Driver)
 {
     if (!isset($this->CacheCache[$Driver])) {
         $ClassName = 'RD_Cache_' . $Driver;
         RD::RequireClass($ClassName);
         $this->CacheCache[$Driver] = RDC::CreateObject($ClassName, array($this->main));
         $this->CacheCache[$Driver]->Setup();
     }
     return;
 }
Ejemplo n.º 2
0
 public function Store()
 {
     $count = func_num_args();
     $args = func_get_args();
     if (!isset($this->StoreCache[$this->DefaultStoreDriver])) {
         $ClassName = 'RD_Store_' . $this->DefaultStoreDriver;
         RD::RequireClass($ClassName);
         $this->StoreCache[$this->DefaultStoreDriver] = new $ClassName($this->main);
         $this->StoreCache[$this->DefaultStoreDriver]->Setup();
     }
     if ($count == 1) {
         return $this->StoreCache[$this->DefaultStoreDriver]->Load($args[0]);
     } elseif ($count == 2) {
         return $this->StoreCache[$this->DefaultStoreDriver]->Save($args[0], &$args[1]);
     } else {
         throw new RDE('RDM_Store: cant do anything');
     }
 }
Ejemplo n.º 3
0
<?php

RD::ClassRequire('RD_RapiDev_Module_Link');
class RDM_Link extends RD_RapiDev_Module_Link
{
}
Ejemplo n.º 4
0
<?php

RD::RequireClass('RD_DAO');
class RD_DAO_History extends RD_DAO
{
    public function insert($update = false, $dataObject = false, $delayed = false)
    {
        $Return = parent::insert($update, $dataObject, $delayed);
        $this->MakeHistoryEntry('insert');
        return $Return;
    }
    public function update($dataObject = false, $return = false)
    {
        $Return = parent::update($dataObject, $return);
        $this->MakeHistoryEntry('update');
        return $Return;
    }
    public function delete($useWhere = false)
    {
        $Array = $this->toArray();
        $Return = parent::delete($useWhere);
        $this->MakeHistoryEntry('delete', $Array, true);
        return $Return;
    }
    public function MakeHistoryEntry($Command, $Array = false, $delete = false)
    {
        if (isset(DB_DataObject2::$INI[$this->_database][$this->__table . '_History'])) {
            $History = RD::$Self->DB($this->_database, $this->__table . '_History');
            if (!$Array) {
                $Array = $this->toArray();
            }
Ejemplo n.º 5
0
<?php

RD::ClassRequire('RD_RapiDev_Module_Process');
class RDM_Process extends RD_RapiDev_Module_Process
{
}
Ejemplo n.º 6
0
 public function Setup()
 {
     RD::RequireClass('RD_Element');
     return;
 }
Ejemplo n.º 7
0
<?php

RD::RequireClass('RD_RapiDev_Module_Compression');
class RDM_Compression extends RD_RapiDev_Module_Compression
{
}
Ejemplo n.º 8
0
<?php

RD::RequireClass('RD_RapiDev_Module_Store');
class RDM_Store extends RD_RapiDev_Module_Store
{
}
Ejemplo n.º 9
0
<?php

RD::RequireClass('RD_RapiDev_Module_Validate');
class RDM_Validate extends RD_RapiDev_Module_Validate
{
}
Ejemplo n.º 10
0
<?php

RD::RequireClass('RD_RapiDev_View');
class RD_View extends RD_RapiDev_View
{
}
Ejemplo n.º 11
0
<?php

RD::RequireClass('RD_RapiDev_Module_Form');
class RDM_Form extends RD_RapiDev_Module_Form
{
}
Ejemplo n.º 12
0
<?php

RD::RequireClass('RD_RapiDev_Module_Element');
class RDM_Element extends RD_RapiDev_Module_Element
{
}
Ejemplo n.º 13
0
 public function ViewGenerate()
 {
     RDD::Log('Generate new View', TRACE, 1200);
     $this->LoadSmarty();
     RD::RequireClass('RD_View');
     $RD_View = new RD_View($this->main);
     return $RD_View;
 }
Ejemplo n.º 14
0
<?php

RD::RequireClass('RD_RapiDev_Module_Cache');
class RDM_Cache extends RD_RapiDev_Module_Cache
{
}
Ejemplo n.º 15
0
<?php

RD::RequireClass('RD_RapiDev_Module_Page');
class RDM_Page extends RD_RapiDev_Module_Page
{
}
Ejemplo n.º 16
0
<?php

RD::RequireClass('RD_RapiDev_Module_Area');
class RDM_Area extends RD_RapiDev_Module_Area
{
}
Ejemplo n.º 17
0
<?php

RD::ClassRequire('RD_RapiDev_Module_Mail');
class RDM_Mail extends RD_RapiDev_Module_Mail
{
}
Ejemplo n.º 18
0
 /**
  * Delete messages.
  *
  *     RD::delete();
  *
  *     // Delete error messages
  *     RD::delete(RD::ERROR);
  *
  *     // Delete error AND alert messages
  *     RD::delete(array(RD::ERROR, RD::ALERT));
  *
  * @param  mixed  $type  message type (e.g. RD::SUCCESS, array(RD::ERROR, RD::ALERT))
  */
 public static function delete($type = NULL)
 {
     if ($type === NULL) {
         // Delete everything!
         Session::instance()->delete(RD::$storage_key);
     } else {
         // Deletion by type happens in get(), too weird?
         RD::get($type, NULL, TRUE);
     }
 }
Ejemplo n.º 19
0
 public function Setup()
 {
     $this->LoadDataobject2();
     $options =& PEAR::getStaticProperty('DB_DataObject2', 'options');
     if (!is_array($options)) {
         $options = array();
     }
     $locations = array();
     foreach ($this->getRoots() as $ROOT) {
         if (is_dir($ROOT . DIR_SEP . 'daos')) {
             $locations[] = $ROOT . DIR_SEP . 'daos';
         }
     }
     if (empty($locations)) {
         RDD::Log('DAO needs a location to work');
         return;
     }
     $options['db_driver'] = $this->Driver;
     $options['schema_location'] = $locations;
     $options['class_location'] = $locations;
     // TODO
     // $options['require_prefix'] =
     $options['class_prefix'] = $this->Prefix;
     $options['extends'] = $this->Extends;
     $options['extends_location'] = '';
     $options['debug'] = 0;
     $options['generator_class_rewrite'] = true;
     $options['quote_identifiers'] = 1;
     $options['proxy'] = false;
     RD::RequireClass($this->Extends);
     return;
 }
Ejemplo n.º 20
0
 public function RequireClass($ClassName)
 {
     $Exist = RD::ExistClass($ClassName);
     if ($Exist === true) {
         return;
     } elseif ($Exist) {
         require_once $Exist;
     }
     if (!class_exists($ClassName, false) && !interface_exists($ClassName, false)) {
         $File = $Line = 'unknown';
         $BackTrace = reset(debug_backtrace());
         if (isset($BackTrace['file']) && !empty($BackTrace['file'])) {
             $File = $BackTrace['file'];
         }
         if (isset($BackTrace['line']) && !empty($BackTrace['line'])) {
             $Line = $BackTrace['line'];
         }
         $Message = 'Cant requirre the Class or Interface "';
         $Message .= $ClassName . '" You required in file: "';
         $Message .= $File . '" on line: "' . $Line . '"';
         throw new RDE($Message);
     }
     return;
 }
Ejemplo n.º 21
0
<?php

RD::RequireClass('RD_RapiDev_Page_CRUD');
abstract class RD_Page_CRUD extends RD_RapiDev_Page_CRUD
{
}
Ejemplo n.º 22
0
<?php

RD::RequireClass('RD_Util_Paging');
function smarty_function_pager($params, &$smarty)
{
    if (!isset($params['PageSize'])) {
        $params['PageSize'] = 1;
    }
    if (!isset($params['CurrentPage'])) {
        $params['CurrentPage'] = 1;
    }
    if (!isset($params['PageVar'])) {
        $params['PageVar'] = 'paging_page';
    }
    if (!isset($params['URL'])) {
        $params['URL'] = $_SERVER['PHP_SELF'] . '?' . $params['PageVar'] . '=%d';
    }
    if (!isset($params['Max'])) {
        $params['Count'] = 1;
    } else {
        $params['Count'] = $params['Max'];
    }
    if (isset($params['Template'])) {
        $Template = $params['Template'];
        unset($params['Template']);
    }
    $Paging = new RD_Util_Paging();
    $Paging->SetFrom($params);
    $OldTplVars = $smarty->_tpl_vars;
    $smarty->assign($params);
    $smarty->assign($Paging->GetPaging());
Ejemplo n.º 23
0
<?php

RD::RequireClass('RD_RapiDev_Module_User');
class RDM_User extends RD_RapiDev_Module_User
{
}
Ejemplo n.º 24
0
<?php

RD::RequireClass('RD_RapiDev_Module_Title');
class RDM_Title extends RD_RapiDev_Module_Title
{
}
Ejemplo n.º 25
0
<?php

RD::RequireClass('RD_RapiDev_Data');
class RD_Data extends RD_RapiDev_Data
{
}
    {
        //if you don't want to output directly
        ob_start();
        $this->directory_children($dir);
        $con = ob_get_contents();
        ob_end_clean();
        return $con;
    }
    public function directory_children($param)
    {
        $cleanPath = realpath($dir) . DIRECTORY_SEPARATOR;
        $scanDir = scandir($cleanPath);
        // read directory content
        echo "<ul>";
        foreach ($scanDir as $file) {
            //skip loop if find . ..
            if ($file == "." || $file == "..") {
                continue;
            }
            echo "<li>";
            echo $file;
            if (is_dir($cleanPath . $file) && is_readable($cleanPath . $file)) {
                $this->directory_children($cleanPath . $file);
            }
            echo "</li>";
        }
        echo "</ul>";
    }
}
$rd = new RD();
echo $rd->directory("E:\\Virtual_Windows\\wamp\\www\\PHP-Tutorial");
Ejemplo n.º 27
0
 public function Link($LinkConfig = array())
 {
     $this->Hook('LinkPreInit');
     $this->LinkConfig = $LinkConfig;
     $this->Hook('LinkInit');
     $js = false;
     $url = false;
     $ignore_entities = false;
     $define_anchor = false;
     $random_chunk = false;
     $use_query = true;
     $prefer_query = false;
     $nopage = false;
     if (isset($this->LinkConfig['js'])) {
         $js = !$this->LinkConfig['js'] == '0';
         unset($this->LinkConfig['js']);
     }
     if (isset($this->LinkConfig['alt'])) {
         $alt = $this->LinkConfig['alt'];
         unset($this->LinkConfig['alt']);
     } else {
         $alt = '';
     }
     if (isset($this->LinkConfig['nopage'])) {
         $nopage = !$this->LinkConfig['nopage'] == '0';
         unset($this->LinkConfig['nopage']);
     }
     if (isset($this->LinkConfig['defanchor'])) {
         $define_anchor = !$this->LinkConfig['defanchor'] == '0';
         unset($this->LinkConfig['defanchor']);
     }
     if (isset($this->LinkConfig['random_chunk'])) {
         $random_chunk = !$this->LinkConfig['random_chunk'] == '0';
         unset($this->LinkConfig['random_chunk']);
     }
     if (isset($this->LinkConfig['use_query'])) {
         $use_query = !$this->LinkConfig['use_query'] == '0';
         unset($this->LinkConfig['use_query']);
     }
     if (isset($this->LinkConfig['prefer_query'])) {
         $prefer_query = !$this->LinkConfig['prefer_query'] == '0';
         unset($this->LinkConfig['prefer_query']);
     }
     if (isset($this->LinkConfig['ignore_entities'])) {
         $ignore_entities = !$this->LinkConfig['ignore_entities'] == '0';
         unset($this->LinkConfig['ignore_entities']);
     }
     if (isset($this->LinkConfig['img'])) {
         $img = '<img src="' . $this->LinkConfig['img'] . '" alt="' . $alt . '" />';
         unset($this->LinkConfig['img']);
     }
     if (isset($this->LinkConfig['anchor'])) {
         $anchor = $this->LinkConfig['anchor'];
         unset($this->LinkConfig['anchor']);
     } else {
         $anchor = '';
     }
     if (!isset($this->LinkConfig['class'])) {
         $this->LinkConfig['class'] = '';
     }
     if (isset($this->LinkConfig['ifpageclass']) && $this->LinkConfig['page'] == $this->GetPage()) {
         $this->LinkConfig['class'] = $this->LinkConfig['ifpageclass'] . ' ' . $this->LinkConfig['class'];
     }
     if (!empty($this->LinkConfig['class'])) {
         $class = ' class="' . $this->LinkConfig['class'] . '"';
     } else {
         $class = '';
     }
     unset($this->LinkConfig['class']);
     if (isset($this->LinkConfig['ifpageclass'])) {
         unset($this->LinkConfig['ifpageclass']);
     }
     if (isset($this->LinkConfig['id'])) {
         $id = ' id="' . $this->LinkConfig['id'] . '"';
         unset($this->LinkConfig['id']);
     } else {
         $id = '';
     }
     if (isset($this->LinkConfig['text'])) {
         if ($ignore_entities) {
             $text = $this->LinkConfig['text'];
         } else {
             $text = htmlentities(html_entity_decode($this->LinkConfig['text'], ENT_QUOTES), ENT_QUOTES);
         }
         unset($this->LinkConfig['text']);
     }
     if (!empty($this->LinkConfig['extra'])) {
         $extra = ' ' . $this->LinkConfig['extra'];
         unset($this->LinkConfig['extra']);
     } else {
         $extra = '';
     }
     if (isset($this->LinkConfig['target'])) {
         $target = $this->LinkConfig['target'];
         if ($href) {
             $target .= '.';
         } else {
             $target = ' target="' . $target . '"';
         }
         unset($this->LinkConfig['target']);
     }
     if (isset($this->LinkConfig['url'])) {
         $url = !$this->LinkConfig['url'] == '0';
         unset($this->LinkConfig['url']);
     }
     if (isset($this->LinkConfig['id_field']) && isset($this->LinkConfig['id_value'])) {
         $this->LinkConfig[$this->LinkConfig['id_field']] = $this->LinkConfig['id_value'];
         unset($this->LinkConfig['id_field']);
         unset($this->LinkConfig['id_value']);
     }
     if ($nopage) {
         if (isset($this->LinkConfig['page'])) {
             unset($this->LinkConfig['page']);
         }
     }
     $this->Hook('LinkPostInit');
     $this->Hook('LinkPreStart');
     $ConfigList = array();
     // TODO: Formcount implementieren
     /* if (isset($_SESSION['formcount'])&&!isset($this->LinkConfig['nofc'])) {
     			$this->LinkConfig['formcount'] = $_SESSION['formcount'];
     		} else {
     			unset($this->LinkConfig['nofc']);
     		} */
     if ($use_query) {
         $query = $this->GetGet();
         if (isset($query['formclean'])) {
             unset($query['formclean']);
         }
         if ($prefer_query) {
             $this->LinkConfig = array_merge($this->LinkConfig, $query);
         } else {
             $this->LinkConfig = array_merge($query, $this->LinkConfig);
         }
     }
     $this->Hook('LinkStart');
     if (isset($this->LinkConfig['file']) && !empty($this->LinkConfig['file'])) {
         $file = $this->LinkConfig['file'];
         unset($this->LinkConfig['file']);
     } else {
         if (isset($_SERVER['REDIRECT_URL'])) {
             $file = $_SERVER['REDIRECT_URL'];
         } else {
             $file = RD::PHP_SELF();
         }
     }
     if (isset($this->LinkConfig['host'])) {
         $host = $this->LinkConfig['host'];
         unset($this->LinkConfig['host']);
         if (substr($host, -1, 1) == '/' && (substr($file, 0, 1) == '/' || substr($PHP_SELF, 0, 1) == '/')) {
             $host = substr($host, 0, strlen($host) - 1);
         }
     } else {
         $host = '';
     }
     foreach ($this->LinkConfig as $var => $val) {
         if (is_array($val)) {
             foreach ($val as $val_key => $val_val) {
                 $ConfigList[] = self::urlEncode($var) . '[' . self::urlEncode($val_key) . ']=' . self::urlEncode($val_val);
             }
         } else {
             $ConfigList[] = self::urlEncode($var) . '=' . self::urlEncode($val);
         }
     }
     $gets = implode($js ? "&" : "&amp;", $ConfigList);
     if ($random_chunk) {
         $random = '' . mt_rand();
     } else {
         $random = '';
     }
     if (!empty($gets)) {
         $gets = "?" . $gets;
         if (!empty($random)) {
             $get .= ($js ? "&" : "&amp;") . $random;
         }
     } else {
         $gets = '';
         if (!empty($random)) {
             $get .= "?" . $random;
         }
     }
     $this->Hook('LinkPostStart');
     $this->Link = $host . $file . $gets;
     $this->Hook('LinkPreFinish');
     if ($js) {
         if (isset($target)) {
             $result = $target . ".document.location.href='" . $this->Link . "'";
         } else {
             $result = "document.location.href='" . $this->Link . "'";
         }
     } elseif ($url) {
         $result = $this->Link;
     } else {
         $result = '<a ' . $class . $id;
         if ($define_anchor) {
             $result .= ' name="' . $anchor . '" />';
         } else {
             if (isset($target)) {
                 $result .= ' ' . $target . ' ';
             }
             $result .= ' href="' . $this->Link . '"' . $extra . '>';
             if (isset($img) && !empty($img)) {
                 $result .= $img;
             } elseif (isset($text) && !empty($text)) {
                 $result .= $text;
             } else {
                 $result .= $this->Link;
             }
             $result .= '</a>';
         }
     }
     $this->LinkResult = $result;
     $this->Hook('LinkFinish');
     $result = $this->LinkResult;
     unset($this->LinkConfig);
     unset($this->LinkResult);
     unset($this->Link);
     $this->Hook('LinkPostFinish');
     return $result;
 }
Ejemplo n.º 28
0
<?php

RD::RequireClass('RD_RapiDev_Module_DAO');
class RDM_DAO extends RD_RapiDev_Module_DAO
{
}
Ejemplo n.º 29
0
 /**
  * Creates needed object and loads all needed methods for the object
  **/
 public function CallPage()
 {
     if ($this->PagesAllowed === false) {
         return;
     }
     if (!$this->GoToCheck()) {
         return;
     }
     if ($this->PagesAllowed !== true && is_array($this->PagesAllowed)) {
         $Access = false;
         foreach ($this->PagesAllowed as $PageAllowed) {
             $Length = strlen($PageAllowed);
             if (substr($this->Page, 0, $Length) == $PageAllowed) {
                 $Access = true;
                 break;
             }
         }
         if (!$Access) {
             throw new Exception('RDM_Page: not allowed to access the Page: "' . $this->Page . '"');
         }
     }
     $this->Hook('PageStart');
     $RunCache = array();
     foreach ($this->Pages as $Key => $PagePart) {
         $FileName = self::$Directory;
         $ClassName = self::$ClassPrefix;
         for ($i = 0; $i <= $Key; $i++) {
             $FileName .= DIR_SEP . $this->Pages[$i];
             $ClassName .= '_' . ucfirst($this->Pages[$i]);
         }
         if (!isset($this->PageCache[$ClassName])) {
             try {
                 RD::RequireClass($ClassName);
             } catch (Exception $e) {
                 $FileName .= '.php';
                 if ($File = $this->File($FileName)) {
                     require_once $File;
                 }
             }
             if (class_exists($ClassName)) {
                 RDD::Log('Page class ' . $ClassName . ' loaded into RunCache', TRACE, 1221);
                 $this->PageCache[$ClassName] = new $ClassName($this->main);
             } else {
                 RDD::Log('Page class ' . $ClassName . ' or file ' . $FileName . ' not exist', WARN);
                 continue;
             }
         }
         $RunCache[$ClassName] = $this->PageCache[$ClassName];
     }
     if (!empty($RunCache)) {
         $MethodStack = array(self::$PageStart);
         $PageDepth = count($this->Pages);
         $TempPageStack = array();
         for ($i = 0; $i < $PageDepth - 1; $i++) {
             $TempPageStack[] = $this->Pages[$i];
             $MethodStack[] = implode(self::$FunctionSeparator, $TempPageStack) . self::$FunctionSeparator . self::$PageStart;
         }
         $MethodStack[] = implode(self::$FunctionSeparator, $this->Pages);
         while (!empty($TempPageStack)) {
             $MethodStack[] = implode(self::$FunctionSeparator, $TempPageStack) . self::$FunctionSeparator . self::$PageEnd;
             array_pop($TempPageStack);
         }
         $MethodStack[] = self::$PageEnd;
         foreach ($MethodStack as $Method) {
             foreach ($RunCache as $PageClass) {
                 $PageMethod = self::$FunctionPrefix . $Method;
                 RDD::Log('Trying PageMethod: "' . $PageMethod . '" on "' . get_class($PageClass) . '"', TRACE, 1211);
                 if ($PageClass->MethodExists($PageMethod)) {
                     $PageClass->{$PageMethod}();
                     if (!$this->GoToCheck()) {
                         return;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 30
0
 /**
  * @param string|Route $uri where to redirect to
  * @param null   $code      Which redirect code to use (302 default)
  * @param bool   $if_ajax   Should the redirect be performed during an ajax request?
  */
 public static function redirect($uri = '', $code = null, $if_ajax = false)
 {
     // if this is called during ajax request, check if we should actually redirect
     if (Request::initial()->is_ajax() && $if_ajax == false) {
         return;
     }
     if ($code == null) {
         $code = 302;
     }
     RD::persist();
     return parent::redirect($uri, $code);
 }