Ejemplo n.º 1
0
 function test($params, $content, &$smarty, &$repeat)
 {
     if (!$repeat) {
         $v = tpl::get($smarty, 'ask');
         return $params['ok'] . ":" . $content . $v;
     }
 }
Ejemplo n.º 2
0
        $news[] = $row;
    }
    return $news;
}
// checken, ob der nutzer eingeloggt ist
if (!loggedin()) {
    // Fehlermeldung ausgeben
    $tpl->out("please log in");
    $design->footer();
    exit;
}
$news = get_news_since($_SESSION["lastlogin"]);
// die neuen news holen
$newsout = "";
if (sizeof($news) == 0) {
    $newsout = $tpl->get("no news");
} else {
    foreach ($news as $new) {
        $newsout .= $tpl->list_get('news', array($new["id"], $new["title"]));
    }
}
// die neuen topics holen
$hottopics = get_topics_since_last_login();
$topicsout = "";
if (sizeof($hottopics) == 0) {
    $topicsout = $tpl->get("no topics");
} else {
    foreach ($hottopics as $hottopic) {
        $listar = array($hottopic["id"], $hottopic["title"], $hottopic["author"]);
        $listar[] = ceil(($hottopic['replies'] + 1) / $allgAr['Fpanz']);
        $listar[] = $hottopic["pid"];
Ejemplo n.º 3
0
/**
 * gibt den link zu einem event aus
 *
 * @param tpl $calendartpl der tpl des kalenders (zugriff auf "event link")
 * @param  $view view, was angezeigt werden soll
 * @param array $eventinfo die info des events
 * @return den link
 */
function eventlink(&$calendartpl, $view, $eventinfo)
{
    $calendartpl->set_ar($eventinfo);
    $calendartpl->set("view", $view);
    return $calendartpl->get("event link");
}
Ejemplo n.º 4
0
function user_has_admin_right(&$menu, $sl = true)
{
    if ($_SESSION['authright'] <= -8) {
        // co leader...
        return true;
    } else {
        $uri_to_check1 = $menu->get(0);
        $uri_to_check2 = $menu->get(1);
        if (count($_SESSION['authmod']) < 1 or !loggedin()) {
            if ($sl === true) {
                if (!loggedin()) {
                    $design = new design('', '', 0);
                    $menu->set_url(0, 'user');
                    load_modul_lang();
                    $tpl = new tpl('user/login.htm');
                    $design->addheader($tpl->get(0));
                    $design->header();
                    $tpl->set_out('WDLINK', 'admin.php', 1);
                    $design->footer();
                } else {
                    echo '<strong>Keine Berechtigung!</strong> <a href="index.php">Startseite</a>';
                }
            }
            return false;
        } elseif (isset($_SESSION['authmod'][$uri_to_check1]) and $_SESSION['authmod'][$uri_to_check1] == true or isset($_SESSION['authmod'][$uri_to_check1 . '-' . $uri_to_check2]) and $_SESSION['authmod'][$uri_to_check1 . '-' . $uri_to_check2] == true) {
            return true;
        } elseif (count($_SESSION['authmod']) > 0 and loggedin()) {
            if ($sl === true) {
                foreach ($_SESSION['authmod'] as $k => $v) {
                    $x = $k;
                    break;
                }
                $x = explode('-', $x);
                $menu->set_url(0, $x[0]);
                if (isset($x[1])) {
                    $menu->set_url(1, $x[1]);
                }
            }
            return true;
        }
    }
    return false;
}
Ejemplo n.º 5
0
         $msg = 'Der Name ist leider schon vorhanden!';
     } else {
         $new_pass = $_POST['pass'];
         $passwordHash = user_pw_crypt($new_pass);
         db_query("INSERT INTO prefix_user (name,pass,recht,regist,llogin,email)\r\n\t\t    VALUES('" . $_POST['name'] . "','" . $passwordHash . "'," . $_POST['recht'] . ",'" . time() . "','" . time() . "','" . $_POST['email'] . "')");
         $userid = db_last_id();
         db_query("INSERT INTO prefix_userfields (uid,fid,val) VALUES (" . $userid . ",2,'1')");
         db_query("INSERT INTO prefix_userfields (uid,fid,val) VALUES (" . $userid . ",3,'1')");
         if (isset($_POST['info'])) {
             $page = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
             $page = str_replace('admin.php', 'index.php', $page);
             $tpl = new tpl('user/new_user_email', 1);
             $tpl->set('name', $_POST['name']);
             $tpl->set('pass', $_POST['pass']);
             $tpl->set('page', $page);
             $txt = $tpl->get(0);
             unset($tpl);
             icmail($_POST['email'], 'Admin hat dich angelegt', $txt);
         }
         $msg = 'Benutzer angelegt <a href="javascript:closeThisWindow()">Fenster schließen</a>';
     }
 }
 $pass = '';
 $email = '';
 $recht = '';
 if (isset($_POST['pass'])) {
     $pass = $_POST['pass'];
 }
 if (isset($_POST['email'])) {
     $email = $_POST['email'];
 }
Ejemplo n.º 6
0
	/**
	 * Get a variable for the view
	 *
	 * @param string $name Variable name
	 * @return mixed|null The value or null if not existing
	 */
	protected function getViewVar($name) {
		return $this->tpl->get($name);
	}
Ejemplo n.º 7
0
function bbcode_quote($s)
{
    $tpl = new tpl('zitatreplace.htm');
    $header1_quote = $tpl->get(0);
    $header2_quote = $tpl->get(1);
    $footer1_quote = $tpl->get(2);
    unset($tpl);
    $i = 0;
    while (strpos($s, "[/quote]") !== FALSE and $i < 5) {
        $i++;
        $s = preg_replace("#\\[quote\\=([^\\]]*)\\](.*)\\[\\/quote\\]#Uis", $header1_quote . "geschrieben von \\1" . $header2_quote . "\\2" . $footer1_quote, $s);
        $s = preg_replace("/\\[quote\\](.*)\\[\\/quote\\]/Usi", $header1_quote . $header2_quote . "\\1" . $footer1_quote, $s);
    }
    return $s;
}
Ejemplo n.º 8
0
 public static function loginBox($head = "", $url = "")
 {
     if (self::$user["id"]) {
         $t = tpl::get(self::$class, "logged-box");
         if (self::$c->action(self::$class . "-login")) {
             $msg = "Вы успешно авторизовались!";
         } else {
             $msg = "Вы уже авторизованы.";
         }
         $t->setVar("head", "Авторизация");
         $t->setVar("msg", $msg);
         $t->setVar("msg-go", "Перейти на главную");
         $t->_render();
         return;
     }
     if (!$head) {
         $head = "Пожалуйста, авторизуйтесь";
     }
     if ($url) {
         self::$session["login-box-returl"] = $url;
     }
     $t = tpl::get(self::$class, "login-box");
     $t->setVar("head", $head);
     $t->setVar("title-login", "Вернувшиеся покупатели: пожалуйста, войдите");
     $t->setVar("title-logname", "Логин");
     $t->setVar("title-password", "Пароль");
     $t->setVar("btn-login-title", "Войти");
     $t->setVar("btn-forgot-title", "Забыли пароль?");
     $t->setVar("login-name", self::$fields["login"]["name"]);
     $t->setVar("title-register", "Первый раз? Введите информацию о себе");
     $t->setVar("regnote", "Все поля обязательны для заполнения");
     $t->setVar("title-regname", "Логин");
     $t->setVar("title-password-retype", "Пароль еще раз");
     $t->setVar("title-regdisplay", "Ваше имя");
     $t->setVar("title-regemail", "E-mail");
     $t->setVar("btn-register-title", "Зарегистрироваться");
     $t->setVar("reg-name", self::$fields["reg"]["name"]);
     $t->setVar("reg-display", self::$fields["reg"]["display"]);
     $t->setVar("reg-email", self::$fields["reg"]["email"]);
     $t->_render();
 }
Ejemplo n.º 9
0
<?php

/**
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL)
 * @copyright (C) 2000-2010 ilch.de
 * @version $Id$
 */
defined('main') or die('no direct access');
$title = $allgAr['title'] . ' :: ' . $lang['login'];
$hmenu = $extented_forum_menu . $lang['login'] . $extented_forum_menu_sufix;
$tpl = new tpl('user/login.htm');
if (loggedin()) {
    $design = new design($title, $hmenu, 0);
    $design->header();
    if (isset($_POST['wdlink'])) {
        $wd = $_POST['wdlink'];
    } else {
        $wd = 'index.php?' . $allgAr['smodul'];
    }
    wd($wd, $lang['yourareloged']);
    $design->footer();
} else {
    $design = new design($title, $hmenu);
    $design->addheader($tpl->get(0));
    $design->header();
    $tpl = new tpl('user/login.htm');
    $tpl->set_out('WDLINK', 'index.php?' . $allgAr['smodul'], 1);
    $design->footer();
}
Ejemplo n.º 10
0
 protected static final function tplGet($tplSection = "", $tplFile = "", $useTemplatesSet = "")
 {
     $class = str_replace(__NAMESPACE__ . "\\", "", @get_called_class());
     return tpl::get($class, $tplSection = "", $tplFile = "", $useTemplatesSet = "");
 }
Ejemplo n.º 11
0
 public static function _on3render()
 {
     if (self::$_step < 2) {
         return;
     }
     $siteName = self::config("", "siteName");
     switch (self::$section["id"]) {
         case ADMIN_SECTION_LOGIN:
             self::_renderLoginBox($siteName . " Admin: " . _t("доступ ограничен"));
             return;
         case ADMIN_SECTION_MODULES:
             $sectionTitle = "<span class=\"root\"" . (self::$section["mode"] == ADMIN_MODE_EDIT ? " onclick=\"render.pluginGet('" . self::$section["name"] . "').list()\"" : "") . ">Модули</span>" . (self::$section["mode"] == ADMIN_MODE_EDIT ? " :: " . (self::$module["id"] ? self::$module["title"] : "Новый модуль") : "");
             break;
         default:
             $sectionTitle = self::$section["title"];
     }
     $t = tpl::get(self::$class, "main");
     $t->setVar("siteName", $siteName);
     $t->setVar("userName", self::accessData("name"));
     $t->setVar("sectId", self::$section["id"]);
     $t->setVar("sectHasMode", self::$section["hasmode"] ? " hasmode" : "");
     $t->setVar("sectMode", self::$section["mode"]);
     $t->setVar("sectName", self::$section["name"]);
     $t->setVar("sectTitle", $sectionTitle);
     $t->setVar("sectIntroAct", self::$sections[ADMIN_SECTION_INTRO]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectContentAct", self::$sections[ADMIN_SECTION_CONTENT]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectMediaAct", self::$sections[ADMIN_SECTION_MEDIA]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectModulesAct", self::$sections[ADMIN_SECTION_MODULES]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectSettingsAct", self::$sections[ADMIN_SECTION_SETTINGS]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectStatAct", self::$sections[ADMIN_SECTION_STAT]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectSystemAct", self::$sections[ADMIN_SECTION_SYSTEM]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectHelpAct", self::$sections[ADMIN_SECTION_HELP]["name"] == self::$section["name"] ? " act" : "");
     $t->setVar("sectIntroTitle", self::$sections[ADMIN_SECTION_INTRO]["title"]);
     $t->setVar("sectContentTitle", self::$sections[ADMIN_SECTION_CONTENT]["title"]);
     $t->setVar("sectMediaTitle", self::$sections[ADMIN_SECTION_MEDIA]["title"]);
     $t->setVar("sectModulesTitle", self::$sections[ADMIN_SECTION_MODULES]["title"]);
     $t->setVar("sectSettingsTitle", self::$sections[ADMIN_SECTION_SETTINGS]["title"]);
     $t->setVar("sectStatTitle", self::$sections[ADMIN_SECTION_STAT]["title"]);
     $t->setVar("sectSystemTitle", self::$sections[ADMIN_SECTION_SYSTEM]["title"]);
     $t->setVar("sectHelpTitle", self::$sections[ADMIN_SECTION_HELP]["title"]);
     $t->setVar("sectIntroName", self::$sections[ADMIN_SECTION_INTRO]["name"]);
     $t->setVar("sectContentName", self::$sections[ADMIN_SECTION_CONTENT]["name"]);
     $t->setVar("sectMediaName", self::$sections[ADMIN_SECTION_MEDIA]["name"]);
     $t->setVar("sectModulesName", self::$sections[ADMIN_SECTION_MODULES]["name"]);
     $t->setVar("sectSettingsName", self::$sections[ADMIN_SECTION_SETTINGS]["name"]);
     $t->setVar("sectStatName", self::$sections[ADMIN_SECTION_STAT]["name"]);
     $t->setVar("sectSystemName", self::$sections[ADMIN_SECTION_SYSTEM]["name"]);
     $t->setVar("sectHelpName", self::$sections[ADMIN_SECTION_HELP]["name"]);
     $t->setVar("sectIntro", ADMIN_SECTION_INTRO);
     $t->setVar("sectContent", ADMIN_SECTION_CONTENT);
     $t->setVar("sectMedia", ADMIN_SECTION_MEDIA);
     $t->setVar("sectModules", ADMIN_SECTION_MODULES);
     $t->setVar("sectSettings", ADMIN_SECTION_SETTINGS);
     $t->setVar("sectStat", ADMIN_SECTION_STAT);
     $t->setVar("sectSystem", ADMIN_SECTION_SYSTEM);
     $t->setVar("sectHelp", ADMIN_SECTION_HELP);
     ob_start();
     switch (self::$section["id"]) {
         case ADMIN_SECTION_CONTENT:
             self::_renderContent();
             break;
         case ADMIN_SECTION_MEDIA:
             self::_renderMedia();
             break;
         case ADMIN_SECTION_MODULES:
             self::_renderModules();
             break;
         case ADMIN_SECTION_SETTINGS:
             self::_renderSettings();
             break;
         case ADMIN_SECTION_STAT:
             echo "Модуль статистики не установлен.";
             break;
         case ADMIN_SECTION_SYSTEM:
             self::_renderSystem();
             break;
         default:
             self::_renderIntro();
     }
     $section = ob_get_contents();
     ob_end_clean();
     $t->setVar("section", $section);
     $t->_render();
 }
Ejemplo n.º 12
0
     $tpl->out("no_such_post");
 } else {
     // PM Versenden
     $getmodids = getmod_ids(get_forum_id($topicId));
     if (empty($getmodids)) {
         // An den Admin schicken
         if (isset($_SESSION["authid"])) {
             $fromUser = $_SESSION["authid"];
         } else {
             $fromUser = 0;
         }
         $tpl->set("NAME", get_n($fromUser));
         $tpl->set("BEITRAG", get_topic_title($topicId));
         $tpl->set("PID", $postId);
         $tpl->set("TID", $topicId);
         sendpm($fromUser, 1, $tpl->get("pm_betreff"), $tpl->get("pm_content"), 0);
         // weiterleitung
         wd("index.php?forum-showposts-" . $topicId, $tpl->get("weiterleitung"));
     } else {
         // An die Mods schicken
         foreach ($getmodids as $userid) {
             if (isset($_SESSION["authid"])) {
                 $fromUser = $_SESSION["authid"];
             } else {
                 $fromUser = 0;
             }
             $tpl->set("NAME", get_n($fromUser));
             $tpl->set("BEITRAG", get_topic_title($topicId));
             $tpl->set("PID", $postId);
             $tpl->set("TID", $topicId);
             sendpm($fromUser, $userid, $tpl->get("pm_betreff"), $tpl->get("pm_content"), 0);
Ejemplo n.º 13
0
    public function get_url($w = '')
    {
        global $allgAr;
        if ($w != '') {
            $this->type = $w;
        }
        // startwert und pfad zum pruefen raustuefteln.
        if ($this->type == 'contents') {
            $pfad = 'include/contents';
            $smod = $allgAr['smodul'];
        } elseif ($this->type == 'box') {
            $file = 'include/boxes/' . $this->get(0) . '.php';
            return (file_exists($file) and $this->check_rights()) ? $file : false;
        } else {
            $pfad = 'include/admin';
            $smod = 'admin';
        }
        // wennes also leer is wird das startmodul genommen
        if (empty($this->menu_ar[0])) {
            $this->set_url(0, $smod);
        }
        // diverse sachen geprueft zum zurueck geben,
        // is halt so dings wegen selfpages usw...
        if (!file_exists($pfad . '/' . $this->get(0) . '.php') and file_exists($pfad . '/selfbp/selfp/' . $this->get(0) . '.php')) {
            $this->set_url(1, $this->get(0));
            $this->set_url(0, 'self');
        } elseif (!file_exists($pfad . '/' . $this->get(0) . '.php')) {
            if (substr($smod, 0, 5) == 'self-') {
                $this->set_url(1, substr($smod, 5));
                $this->set_url(0, 'self');
            } elseif (file_exists($pfad . '/selfbp/selfp/' . $smod . '.php')) {
                $this->set_url(1, $smod);
                $this->set_url(0, 'self');
            } else {
                $this->set_url(0, $smod);
            }
        }
        // pruefen ob der client die noetigen rechte hat
        // das modul zu sehen.. bzw. den menupunkt zu sehen
        $exit = !$this->check_rights();
        // das usermodul kann aus eigener sicherheit nicht
        // gesperrt werden, sonst koennen sich member
        // usw. nicht mehr einloggen, bzw. es kann
        // sich sonst keiner registrieren. deshalb is das
        // user modul immer frei geschaltet
        $alwaysallowed = array('regist', 'login', '1', '2', 'confirm', 'remind', '13', '3', 'logout');
        if ($exit === true and $this->get(0) == 'user' and in_array($this->get(1), $alwaysallowed)) {
            $exit = false;
            debug('o');
        }
        if ($exit) {
            $title = $allgAr['title'] . ' :: Keine Berechtigung';
            $hmenu = 'Keine Berechtigung';
            $design = new design($title, $hmenu);
            if (loggedin()) {
                $design->header();
                if (is_coadmin()) {
                    echo 'Entweder diese Seite ist nicht in der Navigation verlinkt und die Option
<strong>Zugriff auf nicht im Menü verlinkte Module für alle?</strong> steht auf <strong>nein</strong> oder aber du hast kein Recht sie zu betrachten, deswegen kommt diese Meldung.<br />
Also entweder die Seite <strong>' . $this->get(0) . '</strong> in der <a href="admin.php?menu">Navigation</a> verlinken, oder die Option umstellen, ersteres wird empfohlen.';
                } else {
                    echo 'Du hast leider nicht die n&ouml;tigen Rechte, um diese Seite zu betrachten.';
                }
            } else {
                $tpl = new tpl('user/login');
                $design->addheader($tpl->get(0));
                $design->header();
                $tpl->set_out('WDLINK', 'index.php', 1);
            }
            $design->footer();
            exit;
        }
        return $this->get(0) . '.php';
    }
 public static function _render()
 {
     $menu = func_get_arg(0);
     /*
     временный билдер меню
     if($menu==1)
     {
     	$ar=serialize(array("class"=>"phpbb","method"=>"menuGen"));
     	db::q("UPDATE ".db::tnm(self::$class."_entries")." SET `ext`='".addslashes($ar)."' WHERE `id` IN (5,6)",false);
     }
     $ar=serialize(array("class"=>"blog","method"=>"menuGen"));
     db::q("UPDATE ".db::tnm(self::$class."_entries")." SET `extchilds`='{$extdata}' WHERE `id` in (3, 4, 5, 6)",true);
     */
     if (is_null($menu)) {
         return;
     }
     $menu = 0 + $menu;
     /*
     $cache=cache::get(self::$class,"menu".$menu,self::$cacheTTL,false);
     if($cache!==false)
     {
     	self::$items[$menu]=@unserialize($cache);
     	if(!is_array(self::$items[$menu]))unset(self::$items[$menu]);
     }
     */
     if (!isset(self::$items[$menu])) {
         $q = "SELECT `cache`,`lvls`,`showtitle`,`alias`,`title` FROM " . db::tnm(self::$class) . " WHERE `id`=" . $menu . " AND `act`=1";
         $r = db::q($q, true);
         $row = @mysql_fetch_assoc($r);
         if (!$row) {
             return;
         }
         self::$items[$menu]["cache"] = 0 + $row["cache"];
         self::$items[$menu]["lvls"] = 0 + $row["lvls"];
         self::$items[$menu]["showtitle"] = 0 + $row["showtitle"];
         self::$items[$menu]["alias"] = $row["alias"];
         self::$items[$menu]["title"] = $row["title"];
         self::$items[$menu]["lvlcur"] = 0;
         self::$items[$menu]["map"] = array();
         self::$items[$menu]["pathcur"] = array();
         self::$items[$menu]["entries"] = array();
         self::_entriesLoad($menu, self::$items[$menu]);
     }
     $cnt = count(self::$items[$menu]["entries"]);
     $t = tpl::get(self::$class, self::$items[$menu]["alias"]);
     if (self::$items[$menu]["showtitle"]) {
         $t->setVar("menu-show", "show");
         $t->setVar("menu-title", self::$items[$menu]["title"]);
     }
     if (!$cnt) {
         $t->setArrayCycle("entries", array());
         $t->_echo();
         if (self::$items[$menu]["cache"]) {
             cache::set(self::$class, "menu" . $menu, self::$cacheTTL, @serialize(self::$items[$menu]));
         }
         return;
     }
     $data = array();
     $cur = 0;
     $itemAct = false;
     $itemAct1 = false;
     self::$uriSimbolic = self::$c->path("simbolic");
     foreach (self::$items[$menu]["entries"] as $key => $props) {
         $cur++;
         $item = array();
         $item["alias"] = $props["alias"];
         $item["link"] = $props["link"];
         $item["title"] = $props["title"];
         $item["par1"] = $props["par1"];
         $item["par2"] = $props["par2"];
         $item["par3"] = $props["par3"];
         $act = self::pathHasNode($menu, $props);
         $item["class"] = "";
         if ($act) {
             $item["class"] = " act";
             $itemAct = $item["title"];
         }
         if ($cur == $cnt) {
             $item["class"] .= " last";
         }
         $item["nochilds"] = " nochilds";
         if (self::$items[$menu]["lvls"] > 0) {
             $item["childs"] = array();
             if (isset($props["entries"])) {
                 $cur1 = 0;
                 $cnt1 = count($props["entries"]);
                 foreach ($props["entries"] as $key1 => $props1) {
                     $cur1++;
                     $subitem = array();
                     $subitem["child-alias"] = $props1["alias"];
                     $subitem["child-link"] = $props1["link"];
                     $subitem["child-title"] = $props1["title"];
                     $subitem["child-par1"] = $props1["par1"];
                     $subitem["child-par2"] = $props1["par2"];
                     $subitem["child-par3"] = $props1["par3"];
                     $act1 = self::pathHasNode($menu, $props1);
                     $subitem["child-class"] = "";
                     if ($act1) {
                         $subitem["child-class"] = " act";
                         $itemAct1 = $subitem["child-title"];
                     }
                     if ($cur1 == $cnt1) {
                         $subitem["child-class"] .= " last";
                     }
                     $item["childs"][] = $subitem;
                 }
                 if ($cur1 > 0) {
                     $item["nochilds"] = " haschilds";
                 }
             }
         }
         $data[] = $item;
     }
     if ($itemAct) {
         $t->setVar("section-cur-title", $itemAct);
     }
     $t->setArrayCycle("entries", $data);
     $t->_echo();
     if (self::$items[$menu]["cache"]) {
         cache::set(self::$class, "menu" . $menu, self::$cacheTTL, @serialize(self::$items[$menu]));
     }
 }