コード例 #1
0
 /**
  * Volltextsuche ausfuehren 
  *
  * *Description* 
  * 
  * @param $term string, $page string
  *
  * @return string
  */
 public function startSearch($term = NULL, $page)
 {
     if (!empty($term)) {
         if ($page == 'search') {
             //Ergebnisse aus DB Tabelle holen
             $searchRequest = $this->result->getSearch($term);
             $arrResult = array();
             foreach ($searchRequest as $key => $value) {
                 $arrResult[$key] = preg_replace('/{%\\S*%}/', '', $value);
             }
             //Suchergebnis zurück geben
             return \View\Search::ViewResult($arrResult);
         } else {
             $term = \Controller\Helpers::Clean($term);
             if (!URL_REWRITING) {
                 $s = '&';
             } else {
                 $s = '?';
             }
             if (!empty($_GET)) {
                 foreach ($_GET as $k => $v) {
                     if ($k != 'site') {
                         $param .= '&' . $k . '=' . $v;
                     }
                 }
             }
             $filename = \Controller\Helpers::buildLink('search') . $s . $param;
             $this->response->modifyHeader('location', $filename, TRUE);
         }
     }
 }
コード例 #2
0
 /**
  * Bibliotheken aufrufen
  *
  * *Description* Status der jeweiligen Bibliotheken an superglobale Varaible übergeben.
  * Pfad der gewählten Bibliothek zurück geben.
  * 
  * @param array | string
  *
  * @return array
  */
 public function addLibrary($call = array())
 {
     $path = '';
     /** Status in GLOBALS setzen */
     if (is_array($call)) {
         $arr_libraries = $call;
     } else {
         $arr_libraries = array($call);
     }
     if (!empty($arr_libraries)) {
         $globArrLibrary = \Controller\Helpers::getGlobals('Library') ? \Controller\Helpers::getGlobals('Library') : array();
         if (!empty($globArrLibrary) and is_array($globArrLibrary) and !in_array($arr_libraries, $globArrLibrary)) {
             \Controller\Helpers::setGlobals('Library', array_merge($arr_libraries, $globArrLibrary));
         } elseif (!empty($globArrLibrary) and is_array($globArrLibrary)) {
             \Controller\Helpers::setGlobals('Library', $globArrLibrary);
         } else {
             \Controller\Helpers::setGlobals('Library', $arr_libraries);
         }
         /** Pfad holen und zurück geben */
         foreach ($arr_libraries as $lib) {
             if (is_array($globArrLibrary) and !in_array($lib, $globArrLibrary)) {
                 $arr_files = $this->get_libraries->getLibrary($lib);
                 foreach ($arr_files as $files) {
                     $path[] = $files;
                 }
             }
         }
     }
     return $path;
 }
コード例 #3
0
 /**
  * Kontakt-Formular validieren
  *
  * *Description* 
  * 
  * @param array
  *
  * @return array
  */
 public function validFormContact($param)
 {
     // clean send Data
     $send = \Controller\Helpers::Clean($param);
     // Required Content, Adress, Subject ...
     foreach ($this->data as $key => $value) {
         if (array_key_exists($key, $send)) {
             $this->data[$key] = !empty($send[$key]) ? $send[$key] : $key . ' no specification';
         } else {
             break;
             $this->data = array();
         }
     }
 }
コード例 #4
0
 private final function buildMenu($menuArray)
 {
     $list = '';
     foreach ($menuArray as $node) {
         if ($node['page'] == \Controller\Helpers::getGlobals('Page')) {
             $activ = ' class="activ"';
         } else {
             $activ = '';
         }
         $list .= "\n\t\t\t\t<li>\n\t\t\t\t\t" . '<a href="' . \Controller\Helpers::buildLink($node['page']) . '" title="' . $node['title'] . '"' . $activ . '>' . $node['anchor'] . "</a>\n";
         if (!empty($node['children'])) {
             $list .= "\n\t\t\t\t<ul>\n";
             $list .= $this->buildMenu($node['children']);
             $list .= "\t\t\t\t</ul>\n";
         }
         $list .= "\t\t\t\t</li>\n";
     }
     return $list;
 }
コード例 #5
0
    public function sitemap($pages)
    {
        $sitemap = $this->xmlHeader;
        $sitemap .= "\n\t<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n\txsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" \n\txmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n\t\t\t";
        // Content start here
        foreach ($pages as $page) {
            if ($page['indexation'] == 'index') {
                $sitemap .= '
		<url>
			<loc>' . \Controller\Helpers::buildLink($page['page']) . '</loc>
      		<lastmod>' . $page['created'] . '</lastmod>
      		<changefreq>monthly</changefreq>
   		</url>
				';
            }
        }
        $sitemap .= "\n\t</urlset>\n";
        return $sitemap;
    }
コード例 #6
0
 /**
  * Installtion, Erstellen von Datenbanktabellen ausfuehren 
  *
  * *Description* 
  * 
  * @param string
  *
  * @return 
  */
 public function runInstallation()
 {
     // Array Message
     $successInstallation = array('error' => NULL, 'message' => 'Successfully Insert in Table');
     // durchlaufe Array mit MySQL-Query Create Table
     foreach (parent::dbStrukture() as $table => $query) {
         // Lösche Tabelle
         $this->db->query('DROP TABLE IF EXISTS ' . TBL_PRFX . $table);
         // Neue Tabelle in Datenbank erstellen
         if ($this->db->query($query['create'])) {
             // durchlaufe Array mit MySQL-Query Insert Into
             $stmt = $this->db->prepare($query['insert']);
             foreach ($this->arrData[$table] as $arrExec) {
                 $insertTable = $stmt->execute($arrExec);
             }
             // Meldung Eintrag erfolgreich
             if ($insertTable) {
                 $successInstallation = array('error' => false, 'message' => $successInstallation['message'] . ' +' . $table);
             } else {
                 // Fehlermeldung Abbruch bei Tabelle ...
                 $successInstallation = array('error' => true, 'message' => 'Insert canceled at Table ' . $table);
             }
         } else {
             // Fehlermeldung Abbruch bei Tabelle ...
             $successInstallation = array('error' => true, 'message' => 'Create canceled at Table ' . $table);
             break;
         }
     }
     if (!$successInstallation['error']) {
         $robots = PROJECT_ROOT . 'robots.txt';
         if (file_exists($robots)) {
             unlink($robots);
         }
         $sitemap = URL_REWRITING ? \Controller\Helpers::getHost() . '/sitemap.xml' : \Controller\Helpers::getHost() . '/xml.php?site=sitemap';
         $datei = fopen($robots, 'w');
         fwrite($datei, "Sitemap: " . $sitemap . "\r\n\r\nUser-agent: *\r\nDisallow:", 100);
         fclose($datei);
     }
     return $successInstallation;
 }
コード例 #7
0
    public static function ViewResult($arrRequest)
    {
        $result = '
		<ol>';
        if (!empty($arrRequest)) {
            foreach ($arrRequest as $request) {
                // Inhalt auf 250 Zeichen kuerzen
                $shortcontent = $request['content'];
                $shortcontent = strip_tags($shortcontent);
                $shortcontent = preg_replace("/(?<=.{250}?\\b)(.*)/is", "&hellip;", $shortcontent);
                $result .= '
			<li>
				<a href="' . \Controller\Helpers::buildLink($request['page']) . '">' . $request['headline'] . '</a>
				<span>' . $shortcontent . '</span>
			</li>';
            }
        } else {
            $result .= '
			<li>Kein Ergebnis</li>';
        }
        $result .= '
		</ol>';
        return $result;
    }
コード例 #8
0
 /**
  * Bilder bearbeiten und speichern
  *
  * *Description* 
  * 
  * @param string, string, string
  *
  * @return boolean
  */
 public function createImage($path_tmp, $img_name, $type = 'big')
 {
     $createimage = FALSE;
     // Prüfen ob der übergeben Pfad korrekt ist
     if (file_exists($path_tmp)) {
         /* ------------- Bilderstellung ------------- */
         //Bildgröße des Original bestimmen
         $arr_image_size = getimagesize($path_tmp);
         $src_w = $arr_image_size[0];
         $src_h = $arr_image_size[1];
         $imgtype = $arr_image_size[2];
         // Bildgröße des neuen Bild berechnen
         if ($type == 'thumb') {
             // Behandlung des Thumbnails
             $directory = DIR_IMAGES_THUMBNAILS;
             // Neue Höhe und Breite ermitteln
             $dst_h = self::HEIGHT_THUMB;
             $dst_w = floor($this->format_x * self::HEIGHT_THUMB / $this->format_y);
         } else {
             // Behandlung der übrigen Bilder
             $directory = DIR_IMAGES_BIG;
             $max_w = !empty($this->settings['maxwidth']) ? $this->settings['maxwidth'] : self::MAX_WIDTH_BIG;
             $max_h = !empty($this->settings['maxheight']) ? $this->settings['maxheight'] : self::MAX_HEIGHT_BIG;
             // Neue Höhe und Breite im Verhältnis ermitteln
             if ($src_h >= $src_w and $src_h > $max_h) {
                 $dst_h = $max_h;
                 $dst_w = floor($max_h * $src_w / $src_h);
             } elseif ($src_w > $src_h and $src_w > $max_w) {
                 $dst_w = $max_w;
                 $dst_h = floor($max_w * $src_h / $src_w);
             } else {
                 $dst_w = $src_w;
                 $dst_h = $src_h;
             }
         }
         // Zielbild
         $dst_image = imagecreatetruecolor($dst_w, $dst_h);
         // Quellbild
         switch ($imgtype) {
             case IMAGETYPE_JPEG:
                 // JPEG
                 $src_image = imagecreatefromjpeg($path_tmp);
                 $filename = \Controller\Helpers::buildLinkName($img_name) . '.jpg';
                 break;
             case IMAGETYPE_PNG:
                 // PNG
                 $src_image = imagecreatefrompng($path_tmp);
                 $this->setTransparency($dst_image, $src_image);
                 $filename = \Controller\Helpers::buildLinkName($img_name) . '.png';
                 break;
             case IMAGETYPE_GIF:
                 // GIF
                 $src_image = imagecreatefromgif($path_tmp);
                 $this->setTransparency($dst_image, $src_image);
                 $filename = \Controller\Helpers::buildLinkName($img_name) . '.gif';
                 break;
         }
         /*
         ******************************************
         * $dst_image ist Resource des Zielbildes.
         *
         * $src_image ist Resource des Quellbildes.
         *
         * $dst_x ist x-coordinate vom Anfangspunkt.
         *
         * $dst_y ist y-coordinate vom Anfangspunkt. 
         *
         * $src_x ist x-coordinate vom Anfangspunkt. 
         *
         * $src_y ist y-coordinate vom Anfangspunkt.
         *
         * $dst_w ist Ziel breite.
         *
         * $dst_h ist Ziel höhe.
         *
         * $src_w ist Breite der Quelle.
         *
         * $src_h ist Höhe der Quelle.
         ******************************************
         */
         //Strings aus Array der berechneten Koordinaten
         foreach ($this->calcSize($src_w, $src_h, $dst_w, $dst_h) as $key => $value) {
             $key = trim($key);
             ${$key} = $value;
         }
         // Eigentliche Erstellung des neuen Bildes
         imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
         /* ------------- Copyright ------------- */
         /* ------------- Bildspeicherung ------------- */
         // Zielbild
         switch ($imgtype) {
             case IMAGETYPE_JPEG:
                 // JPEG
                 if (imagejpeg($dst_image, $directory . $filename, 95)) {
                     $createimage = TRUE;
                 }
                 break;
             case IMAGETYPE_PNG:
                 // PNG
                 if (imagepng($dst_image, $directory . $filename)) {
                     $createimage = TRUE;
                 }
                 break;
             case IMAGETYPE_GIF:
                 // GIF
                 if (imagegif($dst_image, $directory . $filename)) {
                     $createimage = TRUE;
                 }
                 break;
         }
         // Lösche tmp Bilder
         imagedestroy($src_image);
         imagedestroy($dst_image);
     }
     return $createimage;
 }
コード例 #9
0
 /**
  * Daten Ausgabe Userseite erzeugen
  *
  * *Description* 
  * 
  * @param string
  *
  * @return array 
  */
 public function DataUsers($user)
 {
     $data = array();
     if (!empty($this->success['User']) and $this->success['User']['error']) {
         $data['User'] = $this->request['setUser'];
     } elseif (!empty($this->success['User']) and !$this->success['User']['error']) {
         $data['User'] = $this->entries->getUserData($this->request['setUser']['username']);
     } else {
         $data['User'] = $this->entries->getUserData($user);
     }
     $data['Success'] = $this->success;
     $data['EnumUserstatus'] = $this->entries->getDBEnumSet('user', 'status');
     $data['userRole'] = $this->entries->getRole();
     $data['Action'] = DIR . '?load=user&amp;action=setuser';
     $data['Delete'] = !empty($data['User']['username']) ? DIR . '?load=setting&amp;action=deleteuser&amp;username='******'User']['username'] : '******'Aktion nicht möglich!\')';
     $data['User']['registration_date'] = !empty($data['User']['registration_date']) ? \Controller\Helpers::timestampMySQL2German($data['User']['registration_date']) : '';
     return $data;
 }
コード例 #10
0
							<label for="uploadFile">max Size: <?php 
        echo ini_get('upload_max_filesize');
        ?>
B</label>
						</div>
						<div class="small-12 large-8 columns">		
							<div class="row collapse">	
								<div class="small-8 columns">
									<input id="uploadFile" type="text" placeholder="Choose File" disabled>
								</div>
								<div class="small-4 columns">
									<div class="fileUpload button removemargin postfix">
										<span>Datei suchen</span>
										<!-- MAX_FILE_SIZE muss vor dem Dateiupload Input Feld stehen -->
										<input type="hidden" name="MAX_FILE_SIZE" value="<?php 
        echo \Controller\Helpers::maxSize('1');
        ?>
">
										<input type="file" name="uploadfile" class="upload" id="uploadBtn" accept="image/*">
									</div>
								</div>
							</div>
						</div>
				
						<div class="small-12 large-4 columns">
							<input class="button postfix" type="submit" name="upload" value="hochladen">
						</div>           
					</form>
				</div>
				<a href="#" data-reveal-id="myModal">+ Unsaved Media</a>
				<div id="myModal" class="reveal-modal" data-reveal>
コード例 #11
0
 /**
  * HTML Formulare laden
  *
  * *Description*
  *
  * @param string
  *
  * @return boolean
  */
 private function getHTMLForms($form = NULL)
 {
     switch ($form) {
         case 'Search':
             $path = PATH_PAGES . SEARCHFORM;
             $url = \Controller\Helpers::buildLink('search');
             break;
         case 'Contact':
             $path = PATH_PAGES . CONTACTFORM;
             $url = \Controller\Helpers::buildLink($this->page);
             break;
     }
     if (file_exists($path)) {
         $html = sprintf(file_get_contents($path), $url);
     } else {
         $html = '<strong>Warning:</strong> Form/' . $form . ' not found';
     }
     return $html;
 }
コード例 #12
0
 /**
  * Pruefe einzigartigen Dateiname Bild
  *
  * *Description* 
  * 
  * @param string
  *
  * @return boolean
  */
 public function checkUniqueFilename($srcPath, $dstName)
 {
     $unique = true;
     $path_parts = pathinfo($srcPath);
     $Filename = \Controller\Helpers::buildLinkName($dstName) . '.' . $path_parts['extension'];
     // Hole alle Bilder und durchlaufe Test
     foreach ($this->entries->getAllImages() as $images) {
         if ($images['basename'] == $Filename) {
             $unique = false;
             break;
         }
     }
     return $unique;
 }
コード例 #13
0
 /**
  * Daten laden
  *
  * *Description* 
  * 
  * @param string
  *
  * @return array 
  */
 private function loadData($param)
 {
     $data = array();
     switch ($param) {
         case 'image_list':
             $i = 0;
             foreach ($this->entries->getAllImages() as $images) {
                 $data[$i]['title'] = 'Thumbnail ' . $images['alt'];
                 $data[$i]['value'] = $images['thumb'];
                 $i++;
                 $data[$i]['title'] = $images['alt'];
                 $data[$i]['value'] = $images['large'];
                 $i++;
             }
             break;
         case 'link_list':
             $i = 0;
             foreach ($this->entries->getNavigation() as $navigation) {
                 $data[$i]['title'] = !empty($navigation['anchor']) ? $navigation['anchor'] : ucfirst(str_replace('-', ' ', $navigation['page']));
                 $data[$i]['value'] = \Controller\Helpers::buildLink($navigation['page']);
                 $i++;
             }
             break;
         case 'plugin':
             if (!empty($this->request['extension']) and file_exists(DIR_PLUGIN . $this->request['extension'] . '/ajax.php')) {
                 include_once DIR_PLUGIN . $this->request['extension'] . '/ajax.php';
                 if (function_exists('AjaxData')) {
                     //Funktion in Plugin aufrufen GET-Parameter als Array übergeben
                     unset($this->request['extension'], $this->request['data'], $this->request['load']);
                     $data = AjaxData($this->request);
                 } else {
                     $data = array('No data found for ' . $this->request['extension']);
                 }
             }
             break;
         default:
             $data = array('Sorry! Nothing found.');
     }
     return $data;
 }
コード例 #14
0
 /**
  * Eintrag Benutzer aendern
  *
  * *Description* 
  * 
  * @param array
  *
  * @return boolean
  */
 public function updateUser($user)
 {
     //Passwort verschlüsselt ersetzen
     if (!empty($user['password'])) {
         $pass = \Controller\Helpers::encryptPassword($user['password']);
     } else {
         // Falls leer altes Passwort aus DB holen
         $sql_request = "SELECT password FROM " . TBL_PRFX . "user WHERE username = :username";
         $stmt = $this->db->prepare($sql_request);
         $stmt->execute(array(':username' => $user['username']));
         $request = $stmt->fetch(\PDO::FETCH_ASSOC);
         $pass = $request['password'];
     }
     $sql_query = "UPDATE " . TBL_PRFX . "user \n\t\t\tSET\n\t\t\t\temail = :email,\n\t\t\t\tusername = :username,\n\t\t\t\tpassword = :password,\n\t\t\t\tstatus = :status\n\t\t\tWHERE id = :id";
     $arrExec = array(':email' => $user['email'], ':username' => $user['username'], ':password' => $pass, ':status' => $user['status'], ':id' => $user['id']);
     //Update User
     $stmt = $this->db->prepare($sql_query);
     if ($stmt->execute($arrExec)) {
         return TRUE;
     } else {
         return FALSE;
     }
 }