示例#1
0
	public function renderTeaser()
	{
		$returnvalue = "";
		if (!empty($this->teaserArray))
		{
			$lang = Language::getInstance();
			if ($this->maxcount!=0)
				$count = $this->maxcount;
			else
				$count = count($this->teaserArray);
			for ($counter=0; $counter<$count; $counter++)
			{
				if ($this->settings['Teaser']['Nummeriert']==0)
				{
					$this->teaserArray[$counter]['counter']="";
				}
				else
					$this->teaserArray[$counter]['counter']=$counter+1;
				if (!($this->teaserArray[$counter]['newsdate']=='0000-00-00' || $this->teaserArray[$counter]['newsdate']==""))
				{
					$date=explode("-",$this->teaserArray[$counter]['newsdate']);
					$this->teaserArray[$counter]['newsdate'] = '<span class="date">'.$date[2].".".$date[1].".".$date[0]."</span>";
				}
				else
					$this->teaserArray[$counter]['newsdate']="";
				$this->teaserArray[$counter]['article_url'].= ".html"; 
				$tp = new templateParser(PATH.'templates/FrontEnd/TeaserTemplate.htm');
				$tp->parseTemplate($this->teaserArray[$counter]);
				$returnvalue.=$tp->display();
			}
			
		}
		return $returnvalue;
	}
示例#2
0
 /**
  * insert the data
  *
  * @since 2.4.0
  *
  * @param array $options options of the data
  */
 public function insertData($options = null)
 {
     $language = Language::getInstance();
     /* articles */
     Db::forTablePrefix('articles')->create()->set(array('title' => 'Welcome', 'alias' => 'welcome', 'author' => $options['adminUser'], 'text' => file_get_contents('database/html/articles/welcome.phtml'), 'language' => '', 'category' => 1, 'rank' => 1))->save();
     /* categories */
     Db::forTablePrefix('categories')->create()->set(array('title' => 'Home', 'alias' => 'home', 'author' => $options['adminUser'], 'language' => '', 'rank' => 1))->save();
     /* extras */
     $extrasArray = array('categories' => array('status' => 1, 'headline' => 1), 'articles' => array('status' => 1, 'headline' => 1), 'comments' => array('status' => 1, 'headline' => 1), 'languages' => array('status' => 0, 'headline' => 1), 'templates' => array('status' => 0, 'headline' => 1), 'footer' => array('status' => 0, 'headline' => 0));
     $extrasRank = 0;
     /* process extras array */
     foreach ($extrasArray as $key => $value) {
         Db::forTablePrefix('extras')->create()->set(array('title' => ucfirst($key), 'alias' => $key, 'author' => $options['adminUser'], 'text' => file_get_contents('database/html/extras/' . $key . '.phtml'), 'language' => '', 'headline' => $value['headline'], 'status' => $value['status'], 'rank' => ++$extrasRank))->save();
     }
     /* groups */
     Db::forTablePrefix('groups')->create()->set(array('name' => 'Administrators', 'alias' => 'administrators', 'description' => 'Unlimited access', 'categories' => '1, 2, 3', 'articles' => '1, 2, 3', 'extras' => '1, 2, 3', 'comments' => '1, 2, 3', 'groups' => '1, 2, 3', 'users' => '1, 2, 3', 'modules' => '1, 2, 3', 'settings' => 1, 'filter' => 0))->save();
     Db::forTablePrefix('groups')->create()->set(array('name' => 'Members', 'alias' => 'members', 'description' => 'Default members group'))->save();
     /* modules */
     if (is_dir('modules/CallHome')) {
         $callHome = new Modules\CallHome\CallHome();
         $callHome->install();
     }
     /* settings */
     $settingsArray = array('language' => 'detect', 'template' => 'default', 'title' => 'Redaxscript', 'author' => null, 'copyright' => null, 'description' => 'Ultra lightweight CMS', 'keywords' => null, 'robots' => 'all', 'email' => $options['adminEmail'], 'subject' => 'Redaxscript', 'notification' => 0, 'charset' => 'utf-8', 'divider' => ' - ', 'time' => 'H:i', 'date' => 'd.m.Y', 'homepage' => '0', 'limit' => 10, 'order' => 'asc', 'pagination' => '1', 'moderation' => '0', 'registration' => '1', 'verification' => '0', 'reminder' => '1', 'captcha' => '0', 'blocker' => '1', 'version' => $language->get('version', '_package'));
     /* process settings array */
     foreach ($settingsArray as $name => $value) {
         Db::forTablePrefix('settings')->create()->set(array('name' => $name, 'value' => $value))->save();
     }
     /* users */
     Db::forTablePrefix('users')->create()->set(array('name' => $options['adminName'], 'user' => $options['adminUser'], 'password' => sha1($options['adminPassword']) . $this->_config->get('dbSalt'), 'email' => $options['adminEmail'], 'description' => 'God admin', 'language' => '', 'groups' => '1'))->save();
 }
示例#3
0
 /**
  * Init
  */
 public function __construct()
 {
     // Create instance of Language class
     $this->language = Language::getInstance();
     // Create instance of DB class
     $this->db = DB::getInstance();
 }
 /**
  * Get Text Language
  *
  * @return  Language
  */
 public static function getLanguage()
 {
     if (is_null(static::$lang)) {
         static::$lang = Language::getInstance();
     }
     return static::$lang;
 }
 /**
  * Init
  */
 public function __construct()
 {
     // Create instance of Request class
     $this->request = Request::getInstance();
     // Create instance of Language class
     $this->language = Language::getInstance();
     // Create instance of View class
     $this->view = new View();
 }
示例#6
0
 public function __construct()
 {
     $this->_viewFilePath = NULL;
     //$this->_path   = PathService::getInstance();
     $this->_languageService = Language::getInstance();
     $existed = in_array("airy.view", stream_get_wrappers());
     if ($existed) {
         stream_wrapper_unregister("airy.view");
     }
     stream_wrapper_register('airy.view', 'StreamHelper');
 }
 /**
  * init the class
  *
  * @since 2.4.0
  *
  * @param array $moduleArray custom module setup
  */
 public function init($moduleArray = array())
 {
     /* merge module setup */
     if (is_array($moduleArray)) {
         static::$_moduleArray = array_merge(static::$_moduleArray, $moduleArray);
     }
     /* load the language */
     if (array_key_exists('alias', static::$_moduleArray)) {
         $registry = Registry::getInstance();
         $language = Language::getInstance();
         $language->load(array('modules/' . static::$_moduleArray['alias'] . '/languages/en.json', 'modules/' . static::$_moduleArray['alias'] . '/languages/' . $registry->get('language') . '.json'));
     }
 }
示例#8
0
    public function renderTeaser($teaserArray,$maxcount=0, $type)
    {
        $returnvalue=NULL;
        if (!empty($teaserArray))
        {
            $lang = Language::getInstance();

            $returnvalue.='<div class="'.Configuration::getInstance()->get($type, 'class') .'_outer">';
            $returnvalue.='<div class="'.Configuration::getInstance()->get($type, 'class') .'_inner">'; 
            if ($maxcount!=0)
                $count = $maxcount;
            else
                $count = count($teaserArray);
            if ($maxcount > count($teaserArray) )
                $count = count($teaserArray);
            for ($counter=0; $counter<$count; $counter++)
            {
                 $langArray=$lang->getLanguageArray();
                if ($teaserArray[$counter]['language_id']==$lang->getDefaultLanguage())
                    $langString="";
                else
                    $langString=$langArray[$teaserArray[$counter]['language_id']]['Name']."/";
                $tp = new templateParser(TEMPLATEPATH.Configuration::getInstance()->get("Design","theme").'/'.Configuration::getInstance()->get($type, 'template'));
                $templateArray=array();
                $templateArray['article_teaserhead']  = $teaserArray[$counter]['article_teaserhead'];
                $templateArray['article_teaser_content']  = $teaserArray[$counter]['article_teaser_content'];
                $templateArray['article_url']=($teaserArray[$counter]['article_url']=="/"?"/":$teaserArray[$counter]['article_url'].'.html"');
                $templateArray['newsdate']="";
                if ($teaserArray[$counter]['newsdate']!='' || $teaserArray[$counter]['newsdate']!='0000-00-00')
                {
                    $date=explode("-",$teaserArray[$counter]['newsdate']);
                    $templateArray['newsdate'] = $date[2].".".$date[1].".".$date[0];
                }
                $modulo= Configuration::getInstance()->get($type, 'modulo');
                if ($modulo==1)
                    $templateArray['counter']=$counter+1;
                else
                    $templateArray['counter']=$counter%Configuration::getInstance()->get($type, 'modulo');
                $tp->parseTemplate($templateArray);
                $returnvalue.= $tp->display();
            }
            $returnvalue.='</div>';
            $returnvalue.='</div>';
        }
        return $returnvalue;
    }
示例#9
0
 /**
  * insert the data
  *
  * @since 2.4.0
  *
  * @param array $optionArray options of the installation
  */
 public function insertData($optionArray = null)
 {
     $language = Language::getInstance();
     $language->init();
     /* articles */
     Db::forTablePrefix('articles')->create()->set(['title' => 'Welcome', 'alias' => 'welcome', 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/articles/welcome.phtml'), 'category' => 1, 'comments' => 1, 'rank' => 1])->save();
     /* categories */
     Db::forTablePrefix('categories')->create()->set(['title' => 'Home', 'alias' => 'home', 'author' => $optionArray['adminUser'], 'rank' => 1])->save();
     /* extras */
     $extrasArray = ['categories' => ['category' => null, 'headline' => 1, 'status' => 1], 'articles' => ['category' => null, 'headline' => 1, 'status' => 1], 'comments' => ['category' => null, 'headline' => 1, 'status' => 1], 'languages' => ['category' => null, 'headline' => 1, 'status' => 0], 'templates' => ['category' => null, 'headline' => 1, 'status' => 0], 'teaser' => ['category' => 1, 'headline' => 0, 'status' => 0]];
     $extrasRank = 0;
     /* process extras array */
     foreach ($extrasArray as $key => $value) {
         Db::forTablePrefix('extras')->create()->set(['title' => ucfirst($key), 'alias' => $key, 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/extras/' . $key . '.phtml'), 'category' => $value['category'], 'headline' => $value['headline'], 'status' => $value['status'], 'rank' => ++$extrasRank])->save();
     }
     /* comments */
     Db::forTablePrefix('comments')->create()->set(['author' => $optionArray['adminUser'], 'email' => $optionArray['adminEmail'], 'text' => file_get_contents('database/html/comments/hello.phtml'), 'article' => 1, 'rank' => 1])->save();
     /* groups */
     Db::forTablePrefix('groups')->create()->set(['name' => 'Administrators', 'alias' => 'administrators', 'description' => 'Unlimited access', 'categories' => '1, 2, 3', 'articles' => '1, 2, 3', 'extras' => '1, 2, 3', 'comments' => '1, 2, 3', 'groups' => '1, 2, 3', 'users' => '1, 2, 3', 'modules' => '1, 2, 3', 'settings' => 1, 'filter' => 0])->save();
     Db::forTablePrefix('groups')->create()->set(['name' => 'Members', 'alias' => 'members', 'description' => 'Default members group'])->save();
     /* modules */
     if (is_dir('modules/CallHome')) {
         $callHome = new Modules\CallHome\CallHome();
         $callHome->install();
     }
     if (is_dir('modules/Validator')) {
         $validator = new Modules\Validator\Validator();
         $validator->install();
     }
     /* settings */
     $settingArray = ['language' => 'detect', 'template' => 'default', 'title' => $language->get('name', '_package'), 'author' => $optionArray['adminName'], 'copyright' => null, 'description' => $language->get('description', '_package'), 'keywords' => null, 'robots' => null, 'email' => $optionArray['adminEmail'], 'subject' => $language->get('name', '_package'), 'notification' => 0, 'charset' => 'utf-8', 'divider' => ' - ', 'time' => 'H:i', 'date' => 'd.m.Y', 'homepage' => 0, 'limit' => 10, 'order' => 'asc', 'pagination' => 1, 'registration' => 1, 'verification' => 0, 'recovery' => 1, 'moderation' => 0, 'captcha' => 0, 'version' => $language->get('version', '_package')];
     /* process settings array */
     foreach ($settingArray as $name => $value) {
         Db::forTablePrefix('settings')->create()->set(['name' => $name, 'value' => $value])->save();
     }
     /* users */
     $passwordHash = new Hash(Config::getInstance());
     $passwordHash->init($optionArray['adminPassword']);
     Db::forTablePrefix('users')->create()->set(['name' => $optionArray['adminName'], 'user' => $optionArray['adminUser'], 'password' => $passwordHash->getHash(), 'email' => $optionArray['adminEmail'], 'description' => 'God admin', 'groups' => '1'])->save();
 }
示例#10
0
unset($glob);
$GLOBALS['config']->merge('config', '', $config_default);
// Initialize debug
$GLOBALS['debug'] = Debug::getInstance();
//Initialize sessions
$GLOBALS['session'] = Session::getInstance();
//Initialize Smarty
$GLOBALS['smarty'] = new Smarty();
$GLOBALS['smarty']->muteExpectedErrors();
$GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING;
$GLOBALS['smarty']->compile_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->config_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->cache_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->debugging = false;
//Initialize language
$GLOBALS['language'] = Language::getInstance();
//Initialize hooks
$GLOBALS['hooks'] = HookLoader::getInstance();
//Initialize SEO
$GLOBALS['seo'] = SEO::getInstance();
if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
    $_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']);
    // Remove /~username/ from seo_path
    $GLOBALS['seo']->getItem($_GET['seo_path']);
}
//Initialize SSL
$GLOBALS['ssl'] = SSL::getInstance();
//Initialize GUI
$GLOBALS['gui'] = GUI::getInstance();
//Initialize Taxes
$GLOBALS['tax'] = Tax::getInstance();
 /**
  * Init
  */
 public function __construct()
 {
     // Debug mode
     if (RENDERPAGE_DEBUG) {
         self::$forceCompile = true;
     }
     // Create instance of Language class
     $this->language = Language::getInstance();
 }
 /**
  * language
  *
  * @since 2.6.0
  *
  * @param string $key
  * @param string $index
  *
  * @return string
  */
 public static function language($key = null, $index = null)
 {
     $language = Language::getInstance();
     return $language->get($key, $index);
 }
示例#13
0
文件: TreeBuilder.php 项目: hlag/svs
 private function showBreadCrumb($leaf,$id)
 {
     $returnvalue=NULL;
     $languageArray = Language::getInstance()->getLanguageArray();
     if ($this->lang==1)
         $language="";
     else
         $language = "";//$languageArray[$this->lang]['Name']."/";
     if (empty($leaf))
     {
         return "";
     }
     else
     {
         $ulshow=false;
         $returnvalue2=NULL;
         for ($zaehler=0; $zaehler< count($leaf);$zaehler++ )
         {
             //echo $leaf[$zaehler]['article_id'].$leaf[$zaehler]['article_linktext'];
             if ($leaf[$zaehler]['mark']==true && $leaf[$zaehler]['article_url']!='')
             {
                 $ulshow=true;
                 $returnvalue2.="<li>"."";
                 $inaktive = false;
                 if (isset($this->flavourArray[$id]) && $leaf[$zaehler]['article_id']==$this->flavourArray[$id])
                     $inaktive=true;
                 if (isset($this->flavourArray2[$id])&& $leaf[$zaehler]['article_id']==$this->flavourArray2[$id])
                     $inaktive=true;
                // if ($leaf[$zaehler]['article_id']==1000023)
                // echo $leaf[$zaehler]['article_id'];
                 
                 if ($leaf[$zaehler]['article_type']==4 && !empty($leaf[$zaehler]['alias_external_link']))
                 {
                     $returnvalue2.="<a href=\"".$leaf[$zaehler]['alias_external_link']."\" target=\"_blank\">".$leaf[$zaehler]['article_linktext']."</a>";
                 }
                 else
                 {
                     if ($id==$leaf[$zaehler]['article_id'] || $inaktive)
                     {
                         $parameter = "";
                         if (isset($leaf[$zaehler]['link_parameter']))
                         {
                             if (($leaf[$zaehler]['mark'] && !isset($leaf[$zaehler]['module_mark'])) || (isset($leaf[$zaehler]['module_mark'])&& $leaf[$zaehler]['module_mark']))
                             {
                                 if ($this->settings['Menuestruktur']['showInactiveWithLink'])
                                     $returnvalue2.='<span class="inactive"><a  href="'.$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").'>'.$leaf[$zaehler]['article_linktext']."</a></span>";
                                 else
                                     $returnvalue2.='<span class="inactive">'.$leaf[$zaehler]['article_linktext']."</span>";
                                 
                             }
                             else
                             {
                                 $parameter="?".$leaf[$zaehler]['link_parameter'];
                                 $returnvalue2.="<a href=\"".$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").">".$leaf[$zaehler]['article_linktext']."</a>";      
                             }
                         }
                         else
                         {
                             if ($this->settings['Menuestruktur']['showInactiveWithLink'])
                                 $returnvalue2.='<span class="inactive"><a href="'.$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").'>'.$leaf[$zaehler]['article_linktext']."</a></span>";
                             else
                                 $returnvalue2.='<span class="inactive">'.$leaf[$zaehler]['article_linktext']."</span>";
                         }
                     }
                     else
                     {
                         $parameter = "";
                         if (isset($temp[$zaehler]['link_parameter']))
                             $parameter="?".$temp[$zaehler]['link_parameter'];
                         $returnvalue2.="<a href=\"".$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html\"").">".$leaf[$zaehler]['article_linktext']."</a>";
                     }
                 }
                 if (isset($leaf[$zaehler]['show_navi']) && $leaf[$zaehler]['show_navi'])
                     $returnvalue2.=$this->showBreadCrumb($leaf[$zaehler]['Child'], $id);
                 $returnvalue2.="</li>"."";
             }
         }
         if ($ulshow)
         {
             $returnvalue.="<ul>";
             $returnvalue.=$returnvalue2;
             $returnvalue.="</ul>"."";
         }
         return $returnvalue;
     }
 }
示例#14
0
文件: Article.php 项目: hlag/svs
    public function updateArticleinDatabase($myArray)
    {    
        require_once(PATH."lib/article/GenerateInsertUpdateArray.php");
        Logger::getInstance()->Log('updateArticleinDatabase', LOG_ABLAUF);
        // [-] 22.07.2008 JA
        $time=getdate();
        $myArray['last_modified']=$time['year']."-".$time['mon']."-".$time['mday'];
        if (isset($myArray['facebook']))
            $myArray['facebook']=1;
        else
            $myArray['facebook']=0;
        if (isset($myArray['twitter']))
            $myArray['twitter']=1;
        else
            $myArray['twitter']=0;
        if (isset($myArray['viewable']))
            $myArray['viewable']=1;
        else
            $myArray['viewable']=0;
        if (isset($myArray['published']))
            $myArray['published']=1;
        else
            $myArray['published']=0;
        Logger::getInstance()->Log("updateArticleinDatabase", LOG_ABLAUF);
        Logger::getInstance()->Log($myArray, LOG_ABLAUF);
        AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getArticleTable(), $myArray, 'UPDATE', 'article_id = '.$myArray['ID']);


        /*$SQLQuery="UPDATE `".AGDO::getInstance()->getDBConnector()->getArticleTable()."` SET "    .(isset($myArray['publish'])?"`published` = '1'":"`published` = '0'")." , "
                                            .(isset($myArray['viewable'])?"`viewable` = '1'":"`viewable` = '0'")
                                            .(", `last_modified` = '".$today."'")
                                            ." WHERE `article_id` = '".$myArray['ID']."'";
         $temp=AGDO::getInstance()->Execute($SQLQuery);*/
         for ($counter=1; $counter <= Language::getInstance()->getNumberOfLanguages(); $counter++)
         {

                $myArray['article_id']=$myArray['ID'];
                $generater = new GenerateInsertUpdateArray(); 
                //$insertArray = $this->generateInsertUpdateArray($myArray,$this->languageArray[$counter]['short'], $counter, 'UPDATE');
                $insertArray = $generater->generate($myArray,$this->languageArray[$counter]['short'], $counter, 'UPDATE');
                Logger::getInstance()->Log('insertArchive', LOG_ABLAUF);
                $article = AGDO::getInstance()->GetAll("SELECT * FROM ".AGDO::getInstance()->getDBConnector()->getDescriptionTable()." WHERE article_id = ".$myArray['ID']." and language_id = ".$counter);
                AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getArchiveTable(), $article['0'], 'INSERT');
                AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getDescriptionTable(),$insertArray,'UPDATE', '`article_id` = '.$myArray['ID'].' AND language_id = '.$counter);
                if (isset($myArray['kopfbild_rekursiv_'.$this->languageArray[$counter]['short']]))
                    $this->updateRecursive($myArray['ID'], "kopfbild", $myArray['kopfbild_'.$this->languageArray[$counter]['short']], $counter);
                if (isset($myArray['article_teaser_link_1_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
                    $this->updateRecursive($myArray['ID'], "article_teaser_link_1", $myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']], $counter);
                if (isset($myArray['article_teaser_link_2_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
                    $this->updateRecursive($myArray['ID'], "article_teaser_link_2", $myArray['article_teaser_link_2_'.$this->languageArray[$counter]['short']], $counter);
                if (isset($myArray['article_teaser_link_3_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
                    $this->updateRecursive($myArray['ID'], "article_teaser_link_3", $myArray['article_teaser_link_3_'.$this->languageArray[$counter]['short']], $counter);
                if (isset($myArray['article_teaser_link_4_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
                    $this->updateRecursive($myArray['ID'], "article_teaser_link_4", $myArray['article_teaser_link_4_'.$this->languageArray[$counter]['short']], $counter);
                if (isset($myArray['template_rekursiv']))
                    $this->updateRecursive($myArray['ID'], "template", $myArray['template'], $counter);
                if (isset($myArray['farbe_rekursiv_de']))
                    $this->updateRecursive($myArray['ID'], "farbe", $myArray['farbe_de'], $counter);

                if (isset($myArray['Additional_Content_rekursiv_'.$this->languageArray[$counter]['short']]))
                {
                    if (isset($myArray['Additional_Content_'.$this->languageArray[$counter]['short']]))
                        $this->updateRecursive($myArray['ID'], "Additional_Content", $myArray['Additional_Content_'.$this->languageArray[$counter]['short']], $counter);
                    else
                        $this->updateRecursive($myArray['ID'], "Additional_Content", 0, $counter);
                }
                if (isset($myArray['Modul_rekursiv_'.$this->languageArray[$counter]['short']]))
                {
                    $this->updateRecursive($myArray['ID'], "Module", $myArray['Modul_'.$this->languageArray[$counter]['short']], $counter);
                }

                if (isset($myArray['social_media_recursive']))
                {
                    if (isset($myArray['facebook']) && $myArray['facebook']==1)
                    {
                        $this->updateRecursiveArticleTable($myArray['ID'], 'facebook', 1 , $counter);
                        $this->updateRecursive($myArray['ID'], 'facebook_type', $myArray['facebook_type_'.$this->languageArray[$counter]['short']], $counter);
                    }
                    else
                    {
                        $this->updateRecursiveArticleTable($myArray['ID'], 'facebook', 0 , $counter);
                        $this->updateRecursive($myArray['ID'], 'facebook_type', $myArray['facebook_type_'.$this->languageArray[$counter]['short']], $counter);
                    }
                    if (isset($myArray['twitter']) && $myArray['twitter']==1)
                        $this->updateRecursiveArticleTable($myArray['ID'], 'twitter', 1 , $counter);
                    else
                        $this->updateRecursiveArticleTable($myArray['ID'], 'twitter', 0 , $counter);
                }
                if (isset($myArray['login_rekursiv']))
                {
                    if (isset($myArray['GroupID']))
                        $this->updateRecursive($myArray['ID'], "GroupID", $myArray['GroupID'], $counter);
                    else
                        $this->updateRecursive($myArray['ID'], "GroupID", 0, $counter);
                    if (isset($myArray['UserID']))
                        $this->updateRecursive($myArray['ID'], "UserID", $myArray['UserID'], $counter);
                    else
                        $this->updateRecursive($myArray['ID'], "UserID", 0, $counter);
                }

         }

         if (isset($myArray['add_alias_1_check']))
        {
            $this->addAlias($myArray['ID'], $myArray['add_alias_1']);
            $this->addAlias($myArray['ID'], $myArray['add_alias_1']);
            unset($myArray['add_alias_1_check']);
        }
        if (isset($myArray['add_alias_2_check']))
        {
            $this->addAlias($myArray['ID'], $myArray['add_alias_2']);
            unset($myArray['add_alias_2_check']);
        }
        if (isset($myArray['add_alias_3_check']))
        {
            $this->addAlias($myArray['ID'], $myArray['add_alias_3']);
            unset($myArray['add_alias_3_check']);
        }
    }
示例#15
0
文件: index.php 项目: Norfaer/tinymvc
<?php

try {
    define('VERSION', '1.0.0a');
    chdir(__DIR__);
    require_once 'core/helper/error.php';
    require_once 'core/autoloader.class.php';
    if (file_exists('config.php')) {
        require_once 'config.php';
    }
    $autoloader = Autoloader::getInstance();
    $registry = Registry::getInstance();
    $registry['load'] = $autoloader;
    $registry['request'] = Request::getInstance();
    $registry['response'] = Response::getInstance();
    $registry['language'] = Language::getInstance();
    $router = Router::getInstance();
    $router->dispatch();
    $registry->response->output();
} catch (Exception $e) {
    ob_end_clean();
    $backtrace = $e->getTrace();
    include 'core/helper/error.tpl';
}
示例#16
0
 /**
  * breadcrumb
  *
  * @since 2.3.0
  *
  * @return string
  */
 public static function breadcrumb()
 {
     $breadcrumb = new Breadcrumb(Registry::getInstance(), Language::getInstance());
     $breadcrumb->init(array('className' => array('list' => 'list_breadcrumb', 'divider' => 'divider')));
     return $breadcrumb->render();
 }
示例#17
0
 /**
  * Rendering a layout. It also renders the views that the layout contains.
  * @throws AiryException
  */
 public function render()
 {
     //To get the layout file
     $layoutContent = file_get_contents($this->_layoutPath);
     $this->prepareContent($layoutContent);
     //Fetch each views
     $viewContents = array();
     foreach ($this->_layout as $contentKey => $viewComponent) {
         //check if it is an array that contains module controller action
         if (is_array($viewComponent)) {
             $moduleName = MvcReg::getModuleName();
             $moduleName = isset($viewComponent[self::MODULE]) ? $viewComponent[self::MODULE] : $moduleName;
             try {
                 if (isset($viewComponent[self::CONTROLLER])) {
                     $controllerName = $viewComponent[self::CONTROLLER];
                 } else {
                     throw new AiryException('Layout is missing controller');
                 }
                 if (isset($viewComponent[self::ACTION])) {
                     $actionName = $viewComponent[self::ACTION];
                 } else {
                     throw new AiryException('Layout is missing controller');
                 }
                 $paramString = "";
                 if (isset($viewComponent[self::PARAMS])) {
                     $paramString = $this->getParamString($viewComponent[self::PARAMS]);
                 }
                 $HttpServerHost = PathService::getAbsoluteHostURL();
                 $config = Config::getInstance();
                 $LeadingUrl = $HttpServerHost . "/" . $config->getLeadFileName();
                 $mvcKeywords = $config->getMVCKeyword();
                 $moduleKey = $mvcKeywords['module'];
                 $controllerKey = $mvcKeywords['controller'];
                 $actionKey = $mvcKeywords['action'];
                 $moduleName = RouterHelper::hyphenToCamelCase($moduleName);
                 $controllerName = RouterHelper::hyphenToCamelCase($controllerName, TRUE);
                 $actionName = RouterHelper::hyphenToCamelCase($actionName);
                 $actionPath = $moduleKey . "=" . $moduleName . "&" . $controllerKey . "=" . $controllerName . "&" . $actionKey . "=" . $actionName;
                 $url = $LeadingUrl . "?" . $actionPath . $paramString;
                 //check if it is already signed in
                 //if yes, add current action into allow action query string
                 if (Authentication::isLogin($moduleName)) {
                     $filename = "mca_file" . microtime(true);
                     $md5Filename = md5($filename);
                     $content = $moduleName . ";" . $controllerName . ";" . $actionName;
                     $content = md5($content);
                     FileCache::saveFile($md5Filename, $content);
                     $url = $url . '&' . self::ALLOW_THIS_ACTION . '=' . $md5Filename;
                 }
                 $viewContent = $this->getData($url);
                 $viewContents[$contentKey] = $viewContent;
             } catch (Exception $e) {
                 $errorMsg = sprintf("View Exception: %s", $e->getMessage());
                 throw new AiryException($errorMsg);
             }
         } else {
             if ($viewComponent instanceof AppView) {
                 //Use $this->_view->render();
                 $viewComponent->setInLayout(true);
                 $viewContent = $viewComponent->render();
                 $viewContents[$contentKey] = $viewContent;
             } else {
                 $viewContent = file_get_contents($viewComponent);
                 $viewContent = Language::getInstance()->replaceWordByKey($viewContent);
                 $viewContents[$contentKey] = $viewContent;
             }
         }
     }
     /**
      * Deal with layout variables 
      */
     if (!is_null($this->_variables)) {
         foreach ($this->_variables as $name => $value) {
             if ($value instanceof UIComponent || $value instanceof JUIComponent) {
                 $htmlValue = $value->render();
                 $newHtmlValue = Language::getInstance()->replaceWordByKey($htmlValue);
                 ${$name} = $newHtmlValue;
             } else {
                 ${$name} = $value;
             }
         }
     }
     //Loop through each contents
     //Replace view components with keywords
     $layoutContent = $this->composeContent($layoutContent, $viewContents);
     //Check if inserting doctype at the beginning of the view content
     if (!$this->_noDoctype) {
         if (is_null($this->_doctype)) {
             $this->setDoctype();
         }
     }
     $layoutContent = $this->_doctype . $layoutContent;
     //Stream output
     $existed = in_array("airy.layout", stream_get_wrappers());
     if ($existed) {
         stream_wrapper_unregister("airy.layout");
     }
     stream_wrapper_register('airy.layout', 'StreamHelper');
     $fp = fopen("airy.layout://layout_content", "r+");
     fwrite($fp, $layoutContent);
     fclose($fp);
     include "airy.layout://layout_content";
 }
 public function __construct($slave = false, $domain = false, $server = false)
 {
     $parametro = new Parametros();
     if ($domain == false) {
         if (defined('URL_BASE_FULL')) {
             $urlBase = explode('/', URL_BASE_FULL);
             $urlBase = $urlBase[0];
         } else {
             $urlBase = 'none';
         }
     } else {
         $urlBase = $domain;
     }
     $lang = false;
     if (file_exists(ETC . 'company.inc.php')) {
         require ETC . 'company.inc.php';
         if (isset($company[$urlBase])) {
             if (is_array($company[$urlBase])) {
                 if (isset($company[$urlBase]['LANGUAGE'])) {
                     $lang = $company[$urlBase]['LANGUAGE'];
                 }
                 if (isset($company[$urlBase]['CONFIGFILE'])) {
                     if (file_exists(ETC . $company[$urlBase]['CONFIGFILE'])) {
                         require ETC . $company[$urlBase]['CONFIGFILE'];
                     } else {
                         header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
                         //header('HTTP/1.0 500 Error company file');
                         echo "Error company file";
                         exit;
                     }
                 } else {
                     header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
                     //header('HTTP/1.0 500 Error company param');
                     echo "Error company param";
                     exit;
                 }
                 if (isset($company[$urlBase]['TIMEZONE'])) {
                     date_default_timezone_set($company[$urlBase]['TIMEZONE']);
                     ini_set('date.timezone', $company[$urlBase]['TIMEZONE']);
                 }
                 if (isset($company[$urlBase]['DEC_POINT'])) {
                     $DEC_POINT = $company[$urlBase]['DEC_POINT'];
                 }
                 if (isset($company[$urlBase]['THOUSANDS_SEP'])) {
                     $THOUSANDS_SEP = $company[$urlBase]['THOUSANDS_SEP'];
                 }
             } else {
                 if (file_exists(ETC . $company[$urlBase])) {
                     require ETC . $company[$urlBase];
                 } else {
                     header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
                     //header('HTTP/1.0 500 Error company param');
                     echo "Error company file";
                     exit;
                 }
             }
         } else {
             header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
             //header('HTTP/1.0 500 Error company param');
             echo "Error company not found";
             exit;
         }
     } else {
         require ETC . 'config.inc.php';
     }
     if (!defined('DEC_POINT')) {
         if (isset($DEC_POINT)) {
             define('DEC_POINT', $DEC_POINT);
         } else {
             define('DEC_POINT', ',');
         }
     }
     if (!defined('THOUSANDS_SEP')) {
         if (isset($THOUSANDS_SEP)) {
             define('THOUSANDS_SEP', $THOUSANDS_SEP);
         } else {
             define('THOUSANDS_SEP', '.');
         }
     }
     $conn = $parametro->get("ConnectBD", true);
     $this->logs = new Logs($parametro);
     if ($conn) {
         $conexion = new Connect($parametro, $this->logs, $slave);
         $parametro = new Parametrosdb($parametro, $conexion);
         $this->conexion = $conexion;
     }
     if ($server == true) {
         $this->parametro = $parametro;
         $this->basic = new Basic($parametro, $conexion, $this->logs, false);
         $this->curl = new curl($parametro, $this->logs);
         $this->language = Language::getInstance();
     } else {
         $this->parametro = $parametro;
         $this->plantilla = new plantilla($lang);
         $this->protect = new Protect($parametro, $conexion, $this->logs, $lang);
         $this->language = Language::getInstance();
         $this->basic = new Basic($parametro, $conexion, $this->logs, $this->language);
         $this->bmonitor = new bmonitor($parametro, $conexion, $this->logs, $this->language, $this->protect, $this->basic, $this->plantilla);
         $this->generate = new generate($parametro, $conexion, $this->logs, $this->language, $this->protect, $this->basic, $this->plantilla);
         $this->graph = new Graph($parametro, $conexion, $this->logs);
         $this->charts = new Charts($parametro, $conexion, $this->logs);
         $this->curl = new curl($parametro, $this->logs);
     }
 }
示例#19
0
$config = Config::getInstance();
/* config */
$dbUrl = getenv('DB_URL');
if ($dbUrl) {
    $config->parse($dbUrl);
} else {
    $config->set('dbType', 'sqlite');
    $config->set('dbHost', ':memory:');
}
/* database */
Db::construct($config);
Db::init();
/* installer */
$installer = new Installer($config);
$installer->init();
$installer->rawDrop();
$installer->rawCreate();
$installer->insertData(['adminName' => 'Test', 'adminUser' => 'test', 'adminPassword' => 'test', 'adminEmail' => '*****@*****.**']);
/* test user */
Db::forTablePrefix('users')->whereIdIs(1)->findOne()->set(['password' => 'test', 'description' => 'test', 'language' => 'en'])->save();
/* test module */
if (is_dir('modules/TestDummy')) {
    $testDummy = new Modules\TestDummy\TestDummy();
    $testDummy->install();
}
/* language */
$language = Language::getInstance();
$language->init();
/* hook */
Hook::construct($registry);
Hook::init();
示例#20
0
 /**
  * Load messages and errors from the query string.
  */
 public static function loadFromQuery()
 {
     $messages = Request::query('msg');
     if (!empty($messages)) {
         $lang = Language::getInstance();
         $messages = explode(',', $messages);
         foreach ($messages as $message) {
             self::message($lang->translate($message));
         }
     }
     $errors = Request::query('err');
     if (!empty($errors)) {
         $lang = Language::getInstance();
         $errors = explode(',', $errors);
         foreach ($errors as $error) {
             self::error($lang->translate($error));
         }
     }
 }
示例#21
0
文件: seo.class.php 项目: Geotex/v6
 /**
  * Get categories
  *
  * @param bool $rebuild
  */
 private function _getCategoryList($rebuild = false)
 {
     $language = Session::getInstance()->has('language', 'client') ? Session::getInstance()->get('language', 'client') : Language::getInstance()->current();
     if ($rebuild || ($this->_cat_dirs = Cache::getInstance()->read('seo.category.list.' . $language)) === false) {
         //   if (($results = $GLOBALS['db']->select('CubeCart_category', array('cat_id', 'cat_name', 'cat_parent_id'), array('hide' => '0'), array('cat_id' => 'DESC'))) !== false) {
         if (($results = $GLOBALS['db']->select('CubeCart_category', array('cat_id', 'cat_name', 'cat_parent_id'), false, array('cat_id' => 'DESC'))) !== false) {
             foreach ($results as $result) {
                 $this->_cat_dirs[$result['cat_id']] = $result;
             }
             // Write over with translations
             if (($translations = $GLOBALS['db']->select('CubeCart_category_language', array('cat_id', 'cat_name'), array('language' => $language))) !== false) {
                 foreach ($translations as $translation) {
                     $this->_cat_dirs[$translation['cat_id']]['cat_name'] = $translation['cat_name'];
                 }
             }
             if (!empty($this->_cat_dirs)) {
                 $GLOBALS['cache']->write($this->_cat_dirs, 'seo.category.list.' . $language);
             }
         }
     }
 }
示例#22
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 public function testSetUp()
 {
     $this->object = Language::getInstance('../../../testfiles/test_config.ini');
 }