Ejemplo n.º 1
0
 public static function get($id, $default, $args = [])
 {
     defined('REDIS_ACTIVE') || define('REDIS_ACTIVE', false);
     if (false === REDIS_ACTIVE) {
         return count($args) ? static::assign($default, $args) : $default;
     }
     $defaultLng = Config::get('application.language', DEFAULT_LANGUAGE);
     $lng = lng();
     $cache = redis()->get('lang.' . $lng . '.' . $id);
     $cacheEn = redis()->get('lang.en.' . $id);
     if (strlen($cache) && strlen($cacheEn)) {
         return $cache;
     }
     if ($defaultLng == $lng) {
         $translation = count($args) ? static::assign($default, $args) : $default;
         $save = $default;
     } else {
         $row = self::getDb()->where(['key', '=', $id])->where(['language', '=', $lng])->first(true);
         if ($row) {
             $translation = count($args) ? static::assign($row->translation, $args) : $row->translation;
             $save = $row->translation;
         } else {
             $translation = count($args) ? static::assign($default, $args) : $default;
             $save = $default;
             self::getDb()->create(['key' => $id, 'language' => $lng, 'translation' => $save])->save();
         }
     }
     redis()->set('lang.' . $lng . '.' . $id, $save);
     if (!strlen($cacheEn)) {
         redis()->set('lang.en.' . $id, $save);
         self::getDb()->create(['key' => $id, 'language' => 'en', 'translation' => $save])->save();
     }
     return $translation;
 }
Ejemplo n.º 2
0
 public function events()
 {
     if (!env('student')) {
         redirect('m=login');
     }
     $updisciplineId = val($_REQUEST, 'updisciplineId');
     $learningMode = val($_REQUEST, 'learningMode');
     if (empty($updisciplineId) || empty($learningMode)) {
         throw new Exception('Missed required param', 404);
     }
     $updiscipline = entry_sql('SELECT * FROM updiscipline WHERE updisciplineId=:updisciplineId', array(':updisciplineId' => $updisciplineId));
     if (empty($updiscipline)) {
         throw new Exception('Updiscipline not found', 404);
     }
     $groupPeriod = entry_sql('SELECT gp.* FROM group_history gh INNER JOIN group_period gp USING(groupPeriodId) WHERE gh.studentId=:studentId AND gp.sersemester=:sersemester', array('studentId' => studentId(), 'sersemester' => $updiscipline['sersemester']));
     if (empty($groupPeriod)) {
         throw new Exception('Cannot detect groupPeriod', 404);
     }
     $events = entries_sql('SELECT * FROM event WHERE updisciplineId=:updisciplineId AND groupPeriodId=:groupPeriodId AND learningMode=:learningMode', array('groupPeriodId' => $groupPeriod['groupPeriodId'], 'updisciplineId' => $updiscipline['updisciplineId'], 'learningMode' => $learningMode));
     array_walk($events, function (&$event, $k, $studentId) {
         $event['c'] = material::i($event['instanceType'])->c();
         $event['grade'] = material::i($event['instanceType'])->get_grade($event['instanceId'], $studentId);
     }, studentId());
     env('breadcrumbs', array(array(lng('up:disciplines'), '/?c=up'), array($updiscipline['disciplineName'], '/?c=up&m=events&updisciplineId=' . $updisciplineId . '&learningMode=' . $learningMode), lng('up:events')));
     tpl('up/events', array('updiscipline' => $updiscipline, 'events' => $events, 'result' => entry_sql('SELECT * FROM result WHERE studentId=:studentId AND updisciplineId=:updisciplineId AND learningMode=:learningMode', array('studentId' => studentId(), 'updisciplineId' => $updiscipline['updisciplineId'], 'learningMode' => $learningMode))));
 }
Ejemplo n.º 3
0
 public function Show($modal_mode = true)
 {
     if (!$this->user) {
         return false;
     }
     $statistic = $this->user->getStatistic();
     $main_info['name'] = $this->user->name();
     $tmpParam = $this->user->getStatisticTime('active_last');
     $main_info['active_last'] = $tmpParam ? self::TimeFrom($tmpParam) : 'Никогда';
     // toDo show Online \ Offline
     $main_info['skin'] = $this->user->getSkinLink(false, '&', true);
     $main_info['female'] = $this->user->isFemale() ? 1 : 0;
     $user_info['group'] = array($this->user->getGroupName(), 'Группа');
     $user_info['play_times'] = array((int) $statistic['play_times'], 'Проведенных игр');
     $tmpParam = $this->user->gameLoginLast();
     $user_info['play_last'] = array($tmpParam ? self::TimeFrom($tmpParam) : 'Никогда', 'Вход в игру');
     $tmpParam = $this->user->getStatisticTime('create_time');
     $user_info['create_time'] = array($tmpParam ? $tmpParam : 'Неизвестно', 'Дата регистрации');
     $user_info['comments_num'] = array((int) $statistic['comments_num'], 'Комментарии');
     $user_info['undress_times'] = array((int) $statistic['undress_times'], 'Перевоплощения');
     if ($this->admin_mode && !$this->self_ignore) {
         $tmpParam = $this->user->email();
         $user_info['email'] = array($tmpParam ? $tmpParam : lng('NOT_SET'), 'Почта');
         $user_info['money'] = array($this->user->getMoney() . ' руб.', 'Баланс');
         $user_info['ip'] = array($this->user->ip(), 'IP');
     }
     ob_start();
     include $this->GetView('common_profile.html');
     return ob_get_clean();
 }
Ejemplo n.º 4
0
 protected function _up_breadcrumbs($event)
 {
     $updiscipline = entry_sql('SELECT * FROM updiscipline WHERE updisciplineId=:updisciplineId', array(':updisciplineId' => $event['updisciplineId']));
     if (empty($updiscipline)) {
         throw new Exception('Cannot fetch updiscipline "' . $event['updisciplineId'] . '"', 500);
     }
     return array(array(lng('up:disciplines'), '/?c=up'), array($updiscipline['disciplineName'], '/?c=up&m=events&updisciplineId=' . $event['updisciplineId'] . '&learningMode=' . $event['learningMode']), lng('up:events'), array($event['name'], '/?c=' . material::i($event['instanceType'])->c() . '&eventId=' . $event['eventId'] . '&id=' . $event['instanceId']));
 }
Ejemplo n.º 5
0
 public function get($key, $lng = null, $default = null, $args = [])
 {
     $lng = is_null($lng) ? lng() : $lng;
     $keyT = $key . '.' . $lng;
     $val = array_get($this->data, $keyT, $default);
     if (!empty($args) && fnmatch('##*##', $val)) {
         foreach ($args as $k => $v) {
             $val = str_replace("##{$k}##", $v, $val);
         }
     }
     return $val;
 }
Ejemplo n.º 6
0
    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
CREATE TABLE
    {$pdo->prefix}flood
(
    userid INT(10) NOT NULL DEFAULT 0,
    type TINYINT(1) DEFAULT NULL,
    time TIMESTAMP(6) NOT NULL,
    ip VARCHAR(16) NOT NULL DEFAULT ''
) ENGINE = HEAP
SQL
);
        $pdo->exec(<<<SQL
INSERT INTO
    {$pdo->prefix}registrygroup
VALUES
    (8, 'Flood Protection', 7),
    (9, 'Error Reporting', 8)
SQL
);
        $pdo->exec(<<<SQL
INSERT INTO
    {$pdo->prefix}registry
VALUES
    ('flood_login_count', '3', 'integer', 'Login failure count', 'Number of failed logins before the account gets locked for specific IP.<br>(0 to disable)', 8, 1),
    ('flood_login_timeout', '15', 'integer', 'Login failure timeout', 'Time (in minutes) for which an account gets locked after several failed logins.', 8, 2),
    ('flood_register_count', '5', 'integer', 'Registration count', 'Number of registrations before register gets locked for specific IP.<br>(0 to disable)', 8, 3),
    ('flood_register_timeout', '15', 'integer', 'Registration timeout', 'Time (in minutes) for which an IP gets locked after several registrations.', 8, 4),
    ('flood_mail_count', '3', 'integer', 'Mail count', 'Number of sent mails before mail function gets locked for specific user.<br>(0 to disable)', 8, 5),
    ('flood_mail_timeout', '15', 'integer', 'Mail timeout', 'Time (in minutes) for which mail function gets locked after several sent mails.', 8, 6),
    ('debug_what', '0', 'integer', 'Error Reporting', '0 - Disabled<br>1 - PHP only<br>2 - SQL only<br>3 - both', 9, 0),
    ('debug_mail', '0', 'boolean', 'Error Mails', 'Send error reports as email? This requires &quot;Use eMail Functions&quot; and &quot;Board Admin/Tech eMail&quot;.', 9, 1),
    ('debug_do_log', '0', 'boolean', 'Log errors?', 'Log errors to file?<br>In order to use this feature, you must create a directory with the correct permissions and set the path below.<br><strong>It is highly recommended that this directory be secured by a .htaccess</strong>.', 9, 2),
    ('debug_log_path', 'logs/thwb_err', 'string', 'Log file path', 'path to the log file and log file prefix.<br><strong>See above</strong>.', 9, 3)
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
Ejemplo n.º 7
0
    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
ALTER TABLE
    {$pdo->prefix}user
ADD COLUMN
    usernoipcheck TINYINT(1) UNSIGNED NOT NULL DEFAULT 0
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    boardimage = './templates/default/images/space.png'
WHERE
    boardimage = './templates/default/images/space.gif'
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    boardimage = './templates/default/images/newtopic.png'
WHERE
    boardimage = './templates/default/images/newtopic.gif'
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    stdfont = 'Verdana, Helevetica'
WHERE
    stdfont = 'Verdana'
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
Ejemplo n.º 8
0
function tryExit()
{
    global $rcodes;
    $message = '';
    $rnum = sizeof($rcodes);
    if (!$rnum) {
        return;
    }
    for ($i = 0; $i < $rnum; $i++) {
        $modifed = true;
        switch ($rcodes[$i]) {
            case 2:
                $message .= lng('INCORRECT') . '. (' . lng('LOGIN') . ')';
                break;
            case 3:
                $message .= lng('INCORRECT') . '. (' . lng('PASS') . ')';
                break;
            case 4:
                $message .= lng('INCORRECT') . '. (' . lng('REPASS') . ')';
                break;
            case 12:
                $message .= lng('INCORRECT') . '. (' . lng('EMAIL') . ')';
                break;
            case 6:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('LOGIN') . ')';
                break;
            case 7:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('PASS') . ')';
                break;
            case 8:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('REPASS') . ')';
                break;
            case 9:
                $message .= lng('REPASSVSPASS');
                break;
            case 13:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('EMAIL') . ')';
                break;
            default:
                $modifed = false;
                break;
        }
        if ($modifed) {
            $message .= "<br />";
        }
    }
    aExit(2, $message);
}
Ejemplo n.º 9
0
function CaptchaCheck($exit_mess = 2, $ajaxExit = true, $post_name = 'antibot')
{
    if (!isset($_SESSION)) {
        session_start();
    }
    $input = Filter::input($post_name, 'post', 'int', true);
    if (empty($_SESSION['code']) or $input === false or $_SESSION['code'] != $input) {
        if (isset($_SESSION['code'])) {
            unset($_SESSION['code']);
        }
        if ($ajaxExit) {
            aExit($exit_mess, lng('CAPTCHA_FAIL'));
        }
        return false;
    }
    unset($_SESSION['code']);
    return true;
}
Ejemplo n.º 10
0
 public function login()
 {
     if (studentId()) {
         redirect('c=up');
     }
     $login = val($_REQUEST, 'login');
     $passw = val($_REQUEST, 'passw');
     if (!empty($passw)) {
         $studentId = field_sql('SELECT studentId FROM student WHERE login=:login AND passw=:passw', array('login' => $login, 'passw' => md5($passw)));
         if (empty($studentId)) {
             env('warning', lng('main:loginfailed'));
         } else {
             $_SESSION['studentId'] = $studentId;
             redirect('c=up');
         }
     }
     env('breadcrumbs', array(lng('main:loginpage')));
     tpl('login_form', array('login' => $login, 'passw' => ''));
 }
Ejemplo n.º 11
0
 public function get($key, $default, $args = [])
 {
     $translation = $default;
     $locale = session('web')->getLanguage();
     if (!$locale) {
         $locale = lng();
         session('web')->setLanguage($locale);
     }
     if (fnmatch('*_*', $locale)) {
         list($locale, $d) = explode('_', $locale, 2);
     }
     $locale = strtolower($locale);
     if (false !== $this->mustTranslate) {
         $row = $this->db->where(['key', '=', $key])->first();
         if ($row) {
             if (!isset($row[$locale])) {
                 $translate = $this->db->find((int) $row['id']);
                 $setter = setter($locale);
                 $translate->{$setter}('')->save();
             }
             $translation = isAke($row, $locale, $default);
             if (!strlen($translation)) {
                 $translation = $default;
             }
         } else {
             $default = preg_replace('~[\\r\\n]+~', '', $default);
             $translate = $this->db->firstOrCreate(['key' => $key]);
             $setter = setter(DEFAULT_LANGUAGE);
             $translate->{$setter}($default);
             $setter = setter($locale);
             $translate->{$setter}('')->save();
         }
     }
     if (!empty($args)) {
         foreach ($args as $k => $v) {
             $translation = str_replace('%' . $k . '%', $v, $translation);
         }
     }
     return $translation;
 }
Ejemplo n.º 12
0
 public function SaveAction()
 {
     global $CONFIG;
     #special case login
     if (req('save_type') == 'facebook') {
         $this->SaveFacebook();
         return;
     }
     try {
         $login = trim($_REQUEST['item']['login']);
         $pwd = $_REQUEST['item']['pwdh'];
         if ($_REQUEST["item"]["chpwd"] == "1") {
             $pwd = $_REQUEST['item']['pwd'];
         }
         $pwd = substr(trim($pwd), 0, 32);
         if (!strlen($login) || !strlen($pwd)) {
             $this->ferr("REGISTER", True);
             throw new ApplicationException("");
         }
         $hU = db_row("select * from users where email=" . dbq($login) . " and pwd=" . dbq($pwd));
         if (!isset($hU['access_level']) || $hU['status'] != 0) {
             throw new ApplicationException(lng("User Authentication Error"));
         }
         $this->model->do_login($hU['id']);
         $gourl = reqs('gourl');
         if ($gourl && !preg_match("/^http/i", $gourl)) {
             #if url set and not external url (hack!) given
             fw::redirect($gourl);
         } else {
             fw::redirect($CONFIG['LOGGED_DEFAULT_URL']);
         }
     } catch (ApplicationException $ex) {
         $this->fw->G['err_ctr'] = reqi('err_ctr') + 1;
         $this->set_form_error($ex->getMessage());
         $this->route_redirect("Index");
     }
 }
Ejemplo n.º 13
0
    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
ALTER TABLE
    {$pdo->prefix}calendar
ADD COLUMN
    userid INT(10) UNSIGNED NOT NULL
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
Ejemplo n.º 14
0
<?php

if (!defined('MCR')) {
    exit;
}
loadTool('catalog.class.php');
$category = Filter::input('cid', 'get', 'int');
if ($category) {
    $news_manager = new NewsManager($category, 'news/', 'index.php?cid=' . $category . '&');
} else {
    $news_manager = new NewsManager(-1, 'news/');
}
/* Default vars */
$page = lng('PAGE_NEWS');
/* Get \ Post options */
$curlist = Filter::input('l', 'get', 'int');
if ($curlist <= 0) {
    $curlist = 1;
}
$menu->SetItemActive('main');
$content_main .= $news_manager->ShowNewsListing($curlist);
$content_main .= $news_manager->ShowCategorySelect();
$news_manager->destroy();
unset($news_manager);
Ejemplo n.º 15
0
 public function ShowThemeSelectorOpt()
 {
     global $config;
     if (!$this->isThemesEnabled()) {
         return '<option value="-1">' . lng('NOT_SET') . '</option>';
     }
     $theme_list = $this->GetThemeList();
     $html_list = '';
     for ($i = 0; $i < sizeof($theme_list); $i++) {
         $html_list .= '<option value="' . $theme_list[$i]['id'] . '" ' . ($theme_list[$i]['id'] === $config['s_theme'] ? 'selected' : '') . '>' . $theme_list[$i]['name'] . '</option>';
     }
     return $html_list;
 }
Ejemplo n.º 16
0
	<form action="" method="post">
		<div class="row clearfix">
			<div class="label"><label for="login"><?php 
echo lng('main:login');
?>
</label></div>
			<div class="field"><input type="text" id="login" name="login" value="<?php 
echo $login;
?>
"></div>
		</div>
		<div class="row clearfix">
			<div class="label"><label for="passw"><?php 
echo lng('main:passw');
?>
</label></div>
			<div class="field"><input type="password" id="passw" name="passw" value="<?php 
echo $passw;
?>
"></div>
		</div>
		<div class="row clearfix">
			<div class="label">&nbsp;</div>
			<div class="field"><input type="submit" value="<?php 
echo lng('main:dologin');
?>
"></div>
		</div>
	</form>
</div>
<?tpl('layout/footer')?>
Ejemplo n.º 17
0
 public function aCreate($message, $fUser, $item_id, $item_type)
 {
     global $ajax_message, $config;
     if ($this->id) {
         return 0;
     }
     $this->parent_id = (int) $item_id;
     $this->parent_type = (int) $item_type;
     if (!$this->initParent()) {
         aExit(2, lng('MESS_NOT_FOUND'));
     }
     loadTool('ajax.php');
     if (!$fUser->id()) {
         aExit(1, lng('MESS_FAIL'));
     }
     if (!$fUser->canPostComment()) {
         aExit(1, lng('MESS_TIMEOUT'));
     }
     $rcode = $this->Create($message, $fUser->id(), $item_id, $item_type);
     if ($rcode == 1701) {
         aExit(1, lng('MESS_SHORT'));
     } elseif ($rcode == 1702 or $rcode == 1703) {
         aExit(2, lng('MESS_NOT_FOUND'));
     } elseif ($rcode == 1) {
         $ajax_message['comment_html'] = $this->Show($fUser);
         $ajax_message['comment_revers'] = $config['comm_revers'];
         $fUser->setStatistic('comments_num', 1);
         aExit(0, lng('MESS_COMPLITE'));
     } else {
         aExit(3, lng('MESS_FAIL'));
     }
 }
Ejemplo n.º 18
0
<?php

$this->layout('install-frame', ['about_handler' => $about_handler]);
?>
<b><?php 
echo $title;
?>
</b><br>
<br>
<?php 
echo $message;
?>
<br>
<br>
<?php 
if (!empty($back_url)) {
    ?>
<a href="<?php 
    echo htmlspecialchars($back_url);
    ?>
"><?php 
    echo lng('back');
    ?>
</a>
<?php 
}
Ejemplo n.º 19
0
function CanAccess($ban_type = 1)
{
    global $bd_names;
    $ip = GetRealIp();
    $ban_type = (int) $ban_type;
    $line = getDB()->fetchRow("SELECT COUNT(*) FROM `{$bd_names['ip_banning']}` " . "WHERE `IP`=:ip AND `ban_type`='" . $ban_type . "' " . "AND `ban_until` <> '0000-00-00 00:00:00' AND `ban_until` > NOW()", array('ip' => $ip), 'num');
    $num = (int) $line[0];
    if ($num) {
        getDB()->close();
        if ($ban_type == 2) {
            exit('(-_-)zzZ <br>' . lng('IP_BANNED'));
        }
        return false;
    }
    return true;
}
Ejemplo n.º 20
0
                    p_errormsg(lng('error'), lng('noadmincredentialserror'), '?step=login');
                    exit;
                }
                $stmt = $pdo->prepare(<<<SQL
SELECT
    userid
FROM
    {$pref}user
WHERE
    username = :username AND
    userpassword = :password AND
    userisadmin = 1
SQL
);
                $stmt->bindValue(':username', $_POST['login-username'], PDO::PARAM_STR);
                $stmt->bindValue(':password', md5($_POST['login-password']), PDO::PARAM_STR);
                $stmt->execute();
                if (!$stmt->rowCount()) {
                    p_errormsg(lng('error'), lng('wrongadmincredentialserror'), '?step=login');
                    exit;
                }
                $_SESSION['authenticated'] = true;
                header('Location: ' . $_SERVER['PHP_SELF'] . '?step=update-select');
                exit;
            }
            echo $template->render('update-login', ['about_handler' => 'install.php?step=about', 'languages' => $a_lang, 'step' => 'login']);
            break;
    }
} catch (PDOException $e) {
    p_errormsg(lng('error'), sprintf(lng('queryerror'), '', $e->getMessage()));
}
Ejemplo n.º 21
0
</div>
		<div class="recbooknum"><?php 
echo $student['recbooknum'];
?>
</div>
		<div class="actions">
			<a class="logout" href="/?m=logout"><span><?php 
echo lng('main:logout');
?>
</span></a>
		</div>
	</div>
<?}?>
</div>
<?if($breadcrumbs=env('breadcrumbs')) {?>
	<?array_unshift($breadcrumbs,array(lng('main:frontpage'),'/'))?>
<div class="breadcrumbs">
	<ul class="clearfix">
	<?foreach($breadcrumbs as $k=>$bc) {?>
		<?if(!is_array($bc)) { $bc=array($bc); }?>
		<li class="item-<?php 
echo $k;
?>
">
		<?if(!empty($bc[1])) {?>
			<a href="<?php 
echo $bc[1];
?>
"><?php 
echo $bc[0];
?>
Ejemplo n.º 22
0
				<a class="anchor" name="q<?php 
echo $qsess['num'];
?>
">&nbsp;</a>
			</h4>
			<?php 
echo $qsess['qhtml'];
?>
		</div>
<?}?>
		<div class="question-action">
<?if($lastQuestionNum==count($questions)) {?>
			<input type="submit" name="complete" value="<?php 
echo lng('quiz:actionComplete');
?>
">
<?} else {?>
			<input type="hidden" name="page" value="<?php 
echo $page + 1;
?>
">
			<input type="submit" name="next" value="<?php 
echo lng('quiz:actionNextPage');
?>
">
<?}?>
		</div>
		<?tpl('quiz/question_navig',array('attempt'=>$attempt,'questions'=>$questions,'page'=>$page))?>
	</form>
</div>
<?tpl('layout/footer')?>
Ejemplo n.º 23
0
 public static function price($field)
 {
     if (Request::param($field) === null) {
         return;
     }
     if (strval(floatval(Request::param($field))) != Request::param($field) || Request::param($field) >= 1000000000) {
         Request::error(lng("wrong_price_format"), $field);
     }
 }
Ejemplo n.º 24
0
 public function ShowById($id, $list = 1)
 {
     $mode_txt = 'Отдельный образ';
     $gender_txt = lng('NOT_SET');
     $skins = '';
     $skins_count = 1;
     $skin = new SPItem($id, $this->st_subdir);
     if (!$skin->Exist()) {
         $html_skin_list = 'Скин удален';
     } else {
         $skins = $skin->Show(false, $full_info = true);
         ob_start();
         include $this->GetView('skin_container.html');
         $html_skin_list = ob_get_clean();
         if ($this->discus) {
             loadTool('comment.class.php');
             $comments = new CommentList($skin, $this->base_url . '&cid=' . $id, 'news/comments/');
             $html_skin_list .= $comments->Show($list);
             $html_skin_list .= $comments->ShowAddForm();
         }
     }
     ob_start();
     include $this->GetView('main.html');
     return ob_get_clean();
 }
Ejemplo n.º 25
0
function app($cname, $method, array $extra = null)
{
    global $CFG;
    static $cache = array();
    if (!key_exists($cname, $cache)) {
        if (!preg_match('/^[a-z0-9\\-_]+$/ius', $cname)) {
            throw new Exception(lng('main:violationerror'), 500);
        }
        $classFile = $CFG->dirroot . '/c/' . $cname . '.php';
        $className = $cname . 'Controller';
        if (!is_file($classFile)) {
            throw new Exception(lng('main:controller_notfound'), 404);
        }
        require_once $classFile;
        if (!class_exists($className)) {
            throw new Exception(lng('main:deverror'), 404);
        }
        $cache[$cname] = new $className($extra);
    }
    if (!method_exists($cache[$cname], $method)) {
        throw new Exception(lng('main:controller_method_notfound'), 404);
    }
    return $cache[$cname]->{$method}();
}
Ejemplo n.º 26
0
function replace_lang($matches)
{
    return lng($matches[1]);
}
Ejemplo n.º 27
0
            }
            if (!$skin_def) {
                include View::Get('profile_del_skin.html', $st_subdir . 'profile/');
            }
            if ($cloak_exist) {
                include View::Get('profile_del_cloak.html', $st_subdir . 'profile/');
            }
            if ($bd_names['iconomy']) {
                include View::Get('profile_money.html', $st_subdir . 'profile/');
            }
            include View::Get('profile_footer.html', $st_subdir . 'profile/');
        case 'delete_banip':
            $ip = Filter::input('ip', 'get');
            if (!empty($ip) and preg_match("/[0-9.]+\$/", $ip)) {
                getDB()->ask("DELETE FROM {$bd_names['ip_banning']} WHERE IP=:ip", array('ip' => $ip));
                $info .= lng('IP_UNBANNED') . ' ( ' . $ip . ') ';
            }
            break;
    }
    $html .= ob_get_clean();
}
if ($do == 'sign') {
    $data = file_get_contents(View::Get('edit.png', 'img/'));
    if (!$data) {
        exit;
    }
    $data = explode("IEND�B`", $data);
    if (sizeof($data) != 2) {
        exit;
    }
    $data[1] = str_replace(array("\r\n", "\n", "\r"), '<br />', gzinflate($data[1]));
Ejemplo n.º 28
0
                case 1902:
                    $message .= lng('AUTH_EXIST_EMAIL');
                    break;
                default:
                    $modifed = false;
                    break;
            }
            if ($modifed) {
                $message .= "\n";
            }
        }
        $ajax_message['name'] = $mod_user->name();
        $ajax_message['group'] = $mod_user->getGroupName();
        $ajax_message['id'] = $mod_user->id();
        $ajax_message['skin_link'] = $mod_user->getSkinLink(false, '&', true);
        $ajax_message['mskin_link'] = $mod_user->getSkinLink(true, '&', true);
        if (file_exists($mod_user->getCloakFName())) {
            $ajax_message['cloak'] = 1;
        }
        if ($mod_user->defaultSkinTrigger()) {
            $ajax_message['skin'] = 1;
        }
        if ($message) {
            aExit(2, $message);
        } elseif (!$rnum) {
            aExit(100, $message);
        } else {
            aExit(0, lng('PROFILE_COMPLITE'));
        }
        break;
}
Ejemplo n.º 29
0
 public function ShowById($id)
 {
     $mode_txt = 'Отдельный образ';
     $gender_txt = lng('NOT_SET');
     $html_skin_list = '';
     $skins_count = 1;
     $skin = new SPItem($id, $this->st_subdir);
     if (!$skin->Exist()) {
         $html_skin_list .= 'Скин удален';
     } else {
         $gender_txt = $skin->isFemaleSkin() ? lng('FEMALE') : lng('MALE');
         $html_skin_list = $skin->Show();
     }
     ob_start();
     include $this->GetView('skinposer/main.html');
     return ob_get_clean();
 }
Ejemplo n.º 30
0
 public function session($k, $v = 'dummyget', $e = null)
 {
     $user = session('front')->getUser();
     $isLogged = !is_null($user);
     $key = $isLogged ? sha1(lng() . '.' . forever() . '1.' . $k) : sha1(lng() . '.' . forever() . '0.' . $k);
     return 'dummyget' == $v ? $this->get($key) : $this->set($key, $v, $e);
 }