コード例 #1
0
 $output .= "<p class='bborder'>" . $_lang['admin.content.redir.p'] . "</p>\n<p>\n    <a href='index.php?p=content-redir&amp;new'><img src='images/icons/new.png' alt='new' class='icon' /> " . $_lang['admin.content.redir.act.new'] . "</a>&nbsp;\n    <a href='index.php?p=content-redir&amp;wipe'><img src='images/icons/delete.png' alt='wipe' class='icon' /> " . $_lang['admin.content.redir.act.wipe'] . "</a>\n</p>\n";
 // akce - uprava / vytvoreni
 if (isset($_GET['new']) || isset($_GET['edit'])) {
     do {
         // priprava
         $new = isset($_GET['new']);
         if (!$new) {
             $edit_id = intval($_GET['edit']);
         }
         // zpracovani
         if (isset($_POST['old'])) {
             // nacteni dat
             $q = array();
             $q['old'] = _anchorStr(trim($_POST['old']), true, array('/' => 0));
             $q['new'] = _anchorStr(trim($_POST['new']), true, array('/' => 0));
             $q['active'] = _checkboxLoad('act');
             // kontrola
             if ($q['old'] === '' || $q['new'] === '') {
                 $message = _formMessage(2, $_lang['admin.content.redir.emptyidt']);
             } elseif ($new) {
                 // vytvoreni
                 DB::query('INSERT INTO `' . _mysql_prefix . '-redir` (old,new,active) VALUES (\'' . DB::esc($q['old']) . '\',\'' . DB::esc($q['new']) . '\',' . $q['active'] . ')');
                 $new = false;
                 $message = _formMessage(1, $_lang['global.created']);
                 break;
             } else {
                 // ulozeni
                 DB::query('UPDATE `' . _mysql_prefix . '-redir` SET old=\'' . DB::esc($q['old']) . '\',new=\'' . DB::esc($q['new']) . '\',active=' . $q['active'] . ' WHERE id=' . $edit_id);
                 $message = _formMessage(1, $_lang['global.saved']);
             }
         }
コード例 #2
0
ファイル: login.php プロジェクト: sunlight-cms/sunlight-cms-7
    $_POST['username'] = '';
}
if (!isset($_POST['password'])) {
    $_POST['password'] = '';
}
$result = 0;
$username = "";
$ipbound = isset($_POST['ipbound']);
if (!_loginindicator) {
    if (_xsrfCheck()) {
        if (_iplogCheck(1)) {
            // nacteni promennych
            $username = DB::esc($_POST['username']);
            $email = strpos($_POST['username'], '@') !== false;
            $password = $_POST['password'];
            $persistent = _checkboxLoad('persistent');
            // nalezeni uzivatele
            $query = DB::query("SELECT * FROM `" . _mysql_prefix . "-users` WHERE `" . ($email ? 'email' : 'username') . "`='" . $username . "'" . (!$email && $username !== '' ? ' OR publicname=\'' . $username . '\'' : ''));
            if (DB::size($query) != 0) {
                $query = DB::row($query);
                if (empty($username)) {
                    $username = $query['username'];
                }
                $groupblock = DB::query_row("SELECT blocked FROM `" . _mysql_prefix . "-groups` WHERE id=" . $query['group']);
                if ($query['blocked'] == 0 and $groupblock['blocked'] == 0) {
                    if (_md5Salt($password, $query['salt']) == $query['password']) {
                        // navyseni poctu prihlaseni
                        DB::query("UPDATE `" . _mysql_prefix . "-users` SET logincounter=logincounter+1 WHERE id=" . $query['id']);
                        // zaslani cookie pro stale prihlaseni
                        if ($persistent) {
                            $persistent_cookie_data = array();
コード例 #3
0
            // zprava
            if ($done != 0) {
                $output .= _formMessage(1, str_replace(array("*done*", "*total*"), array($done, $item_total), $_lang['admin.other.massemail.send']));
            } else {
                $output .= _formMessage(2, $_lang['admin.other.massemail.noreceiversfound']);
            }
        } else {
            // vypis emailu
            $emails_total = DB::size($query);
            if ($emails_total != 0) {
                $emails = '';
                $email_counter = 0;
                while ($item = DB::row($query)) {
                    ++$email_counter;
                    $emails .= $item['email'];
                    if ($email_counter !== $emails_total) {
                        $emails .= ',';
                    }
                }
                $output .= _formMessage(1, "<textarea class='areasmallwide' rows='9' cols='33' name='list'>" . $emails . "</textarea>");
            } else {
                $output .= _formMessage(2, $_lang['admin.other.massemail.noreceiversfound']);
            }
        }
    } else {
        $output .= _formMessage(2, _eventList($errors, 'errors'));
    }
}
/* ---  vystup  --- */
$output .= "\n<br />\n<form class='cform' action='index.php?p=other-massemail' method='post'>\n<table class='formtable'>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.other.massemail.sender'] . "</strong></td>\n<td><input type='text' name='sender'" . _restorePostValue("sender", _sysmail) . " class='inputbig' /></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['posts.subject'] . "</strong></td>\n<td><input type='text' name='subject' class='inputbig'" . _restorePostValue("subject") . " /></td>\n</tr>\n\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['admin.other.massemail.receivers'] . "</strong></td>\n<td>" . _admin_authorSelect("receivers", -1, "1", "selectbig", null, true, 4) . "</td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.other.massemail.ctype'] . "</strong></td>\n<td>\n  <select name='ctype' class='selectbig'>\n  <option value='1'>" . $_lang['admin.other.massemail.ctype.1'] . "</option>\n  <option value='2'" . ((isset($_POST['ctype']) and $_POST['ctype'] == 2) ? " selected='selected'" : '') . ">" . $_lang['admin.other.massemail.ctype.2'] . "</option>\n  </select>\n</td>\n</tr>\n\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['admin.other.massemail.text'] . "</strong></td>\n<td><textarea name='text' class='areabig' rows='9' cols='94'>" . _restorePostValue("text", null, true) . "</textarea></td>\n</tr>\n\n<tr><td></td>\n<td><input type='submit' value='" . $_lang['global.send'] . "' />&nbsp;&nbsp;<label><input type='checkbox' name='maillist' value='1'" . _checkboxActivate(_checkboxLoad("maillist")) . " /> " . $_lang['admin.other.massemail.maillist'] . "</label></td>\n</tr>\n\n</table>\n" . _xsrfProtect() . "</form>\n";
コード例 #4
0
     $picOpts = array('file_path' => $_FILES['picture']['tmp_name'], 'file_name' => $_FILES['picture']['name'], 'target_path' => _indexroot . 'pictures/articles/', 'target_format' => 'jpg', 'resize' => array('mode' => 'fit', 'keep_smaller' => true, 'pad' => false, 'x' => _article_pic_w, 'y' => _article_pic_h));
     _extend('call', 'admin.article.picture', array('opts' => &$picOpts));
     // zpracovani
     $picUid = _pictureProcess($picOpts, $picError);
     if (false !== $picUid) {
         // uspech
         if (isset($query['picture_uid'])) {
             // odstraneni stareho
             @unlink(_pictureStorageGet(_indexroot . 'pictures/articles/', null, $query['picture_uid'], 'jpg'));
         }
         $newdata['picture_uid'] = $picUid;
     } else {
         // chyba
         $error_log[] = $_lang['admin.content.form.picture'] . ' - ' . $picError;
     }
 } elseif (isset($query['picture_uid']) && _checkboxLoad('picture-delete')) {
     // smazani obrazku
     @unlink(_pictureStorageGet(_indexroot . 'pictures/articles/', null, $query['picture_uid'], 'jpg'));
     $newdata['picture_uid'] = null;
 }
 // ulozeni
 if (count($error_log) == 0) {
     if (!$new) {
         // data
         DB::query("UPDATE `" . _mysql_prefix . "-articles` SET title='" . $newdata['title'] . "',title_seo='" . $newdata['title_seo'] . "',keywords='" . $newdata['keywords'] . "',description='" . $newdata['description'] . "',home1=" . $newdata['home1'] . ",home2=" . $newdata['home2'] . ",home3=" . $newdata['home3'] . ",author=" . $newdata['author'] . ",perex='" . $newdata['perex'] . "',picture_uid=" . (isset($newdata['picture_uid']) ? '\'' . DB::esc($newdata['picture_uid']) . '\'' : 'NULL') . ",content='" . $newdata['content'] . "',infobox='" . $newdata['infobox'] . "',public=" . $newdata['public'] . ",visible=" . $newdata['visible'] . ",confirmed=" . $newdata['confirmed'] . ",comments=" . $newdata['comments'] . ",commentslocked=" . $newdata['commentslocked'] . ",rateon=" . $newdata['rateon'] . ",showinfo=" . $newdata['showinfo'] . ",time=" . $newdata['time'] . " WHERE id=" . $id);
         // smazani komentaru
         if ($newdata['delcomments'] == 1) {
             DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=2 AND home=" . $id);
         }
         // vynulovani poctu precteni
         if ($newdata['resetread'] == 1) {
コード例 #5
0
ファイル: index.php プロジェクト: sunlight-cms/sunlight-cms-7
<?php

/* --  inicializace jadra  -- */
require '../require/load.php';
SL::init('../', null, true, true);
$msg = "";
/* --  instalace databaze  -- */
if (isset($_POST['license'])) {
    // nacteni promennych
    $url = _removeSlashesFromEnd($_POST['url']);
    $pass = $_POST['pass'];
    $pass2 = $_POST['pass2'];
    $email = $_POST['email'];
    $rewrite = _checkboxLoad("rewrite");
    $title = DB::esc(_htmlStr($_POST['title']));
    $descr = DB::esc(_htmlStr($_POST['descr']));
    $keywords = DB::esc(_htmlStr($_POST['kwrds']));
    // kontrola promennych
    $errors = array();
    if ($url == "" or $url == "http://") {
        $errors[] = "Nebyla zadána adresa serveru.";
    }
    if ($pass == "" or $pass2 == "") {
        $errors[] = "Nebylo vyplněno heslo.";
    }
    if ($pass != $pass2) {
        $errors[] = "Zadaná hesla nejsou shodná.";
    }
    if (!_validateEmail($email)) {
        $errors[] = "E-mailová adresa není platná.";
    }
コード例 #6
0
                     if ($var === 'class' && $val === '') {
                         $val = null;
                     }
                     break;
                 case "column":
                     $val = strval($val);
                     break;
                 case "ord":
                     $val = floatval($val);
                     break;
                 case "content":
                     $val = _filtrateHCM($val);
                     break;
                 case "visible":
                 case "public":
                     $val = _checkboxLoad($id . '-' . $var . 'new');
                     break;
                 default:
                     continue 2;
             }
             // pridat do pole
             if (!isset($update[$id])) {
                 $update[$id] = array();
             }
             $update[$id][$var] = $val;
         }
     }
 }
 // aktualizace v db
 if (!empty($update)) {
     foreach ($update as $id => $changes) {
コード例 #7
0
             break;
         }
         $message = "<br /><ul>\n";
         foreach ($prev_count as $key => $val) {
             $message .= "<li><strong>" . $_lang[$key] . ":</strong> <code>" . $val . "</code></li>\n";
         }
         $message .= "</ul>";
     } else {
         $message = _formMessage(1, $_lang['global.done']);
     }
     break;
     // deinstalace
 // deinstalace
 case 2:
     $pass = $_POST['pass'];
     $confirm = _checkboxLoad("confirm");
     if ($confirm) {
         $right_pass = DB::query_row("SELECT password,salt FROM `" . _mysql_prefix . "-users` WHERE id=0");
         if (_md5Salt($pass, $right_pass['salt']) == $right_pass['password']) {
             // ziskani tabulek
             $tables = array();
             $q = DB::query('SHOW TABLES LIKE \'' . _mysql_prefix . '-%\'');
             while ($r = DB::rown($q)) {
                 $tables[] = $r[0];
             }
             // odstraneni tabulek
             foreach ($tables as $table) {
                 DB::query("DROP TABLE `" . $table . "`");
             }
             // zprava
             _userLogout();
コード例 #8
0
 $answers = @explode("\n", $_POST['answers']);
 $answers_new = array();
 foreach ($answers as $answer) {
     $answers_new[] = _htmlStr(trim($answer));
 }
 $answers = _arrayRemoveValue($answers_new, "");
 $answers_count = count($answers);
 $answers = @implode("\n", $answers);
 $query['answers'] = $answers;
 if (_loginright_adminpollall) {
     $author = intval($_POST['author']);
 } else {
     $author = _loginid;
 }
 $locked = _checkboxLoad("locked");
 $reset = _checkboxLoad("reset");
 // kontrola promennych
 $errors = array();
 if ($question == "") {
     $errors[] = $_lang['admin.content.polls.edit.error1'];
 }
 if ($answers_count == 0) {
     $errors[] = $_lang['admin.content.polls.edit.error2'];
 }
 if ($answers_count > 20) {
     $errors[] = $_lang['admin.content.polls.edit.error3'];
 }
 if (_loginright_adminpollall and DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-users` WHERE id=" . $author . " AND (id=" . _loginid . " OR (SELECT level FROM `" . _mysql_prefix . "-groups` WHERE id=`" . _mysql_prefix . "-users`.`group`)<" . _loginright_level . ")"), 0) == 0) {
     $errors[] = $_lang['admin.content.articles.edit.error3'];
 }
 // ulozeni
コード例 #9
0
                        if (null === $backlink) {
                            $module .= _formMessage(3, sprintf($_lang['plugin.error'], $query['flag']));
                            return;
                        }
                        break;
                    default:
                        $backlink = _indexroot;
                        break;
                }
            }
        }
    }
}
/* ---  ulozeni  --- */
if (isset($_POST['text']) and $continue) {
    if (!_checkboxLoad("delete")) {
        /* -  uprava  - */
        // nacteni promennych
        // jmeno hosta
        if ($query['guest'] != "") {
            $guest = $_POST['guest'];
            if (mb_strlen($guest) > 24) {
                $guest = mb_substr($guest, 0, 24);
            }
            $guest = _anchorStr($guest, false);
        } else {
            $guest = "";
        }
        $text = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['text'], $query['type'] != 4 ? 16384 : 255, false))));
        if ($query['xhome'] == -1 and $query['type'] != 4) {
            $subject = DB::esc(_htmlStr(_wsTrim(_cutStr($_POST['subject'], $query['type'] == 5 ? 48 : 22, false))));
コード例 #10
0
     if (isset($item[3])) {
         $_POST[$item[0]] = trim($_POST[$item[0]]);
     }
     switch ($item[2]) {
         case 0:
             $val = DB::esc($_POST[$item[0]]);
             break;
         case 1:
             $val = DB::esc(_htmlStr($_POST[$item[0]]));
             break;
         case 2:
             $val = intval($_POST[$item[0]]);
             break;
     }
 } else {
     $val = _checkboxLoad($item[0]);
 }
 // individualni akce
 switch ($item[0]) {
     case "url":
         $val = _removeSlashesFromEnd($val);
         break;
     case "defaultgroup":
         if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-groups` WHERE id=" . $val), 0) == 0) {
             $val = 3;
         }
         break;
     case "showpages":
         $val = intval(abs($val - 1) / 2);
         if ($val == 0) {
             $val = 1;
コード例 #11
0
     $group = intval($_POST['group']);
     $group_test = DB::query("SELECT level FROM `" . _mysql_prefix . "-groups` WHERE id=" . $group . " AND id!=2 AND level<" . _loginright_level);
     if (DB::size($group_test) != 0) {
         $group_test = DB::row($group_test);
         if ($group_test['level'] > _loginright_level) {
             $errors[] = $_lang['global.badinput'];
         }
     } else {
         $errors[] = $_lang['global.badinput'];
     }
 } else {
     $group = $query['group'];
 }
 // levelshift
 if (_loginid == 0) {
     $levelshift = _checkboxLoad("levelshift");
 } else {
     $levelshift = $query['levelshift'];
 }
 // ulozeni / vytvoreni anebo seznam chyb
 if (count($errors) == 0) {
     if ($id != null) {
         // ulozeni
         DB::query("UPDATE `" . _mysql_prefix . "-users` SET email='" . $email . "',avatar=" . (isset($avatar) ? '\'' . $avatar . '\'' : 'NULL') . ",web='" . $web . "',skype='" . $skype . "',msn='" . $msn . "',jabber='" . $jabber . "',icq=" . $icq . ",note='" . $note . "',publicname='" . $publicname . "',`group`=" . $group . ",blocked=" . $blocked . ",levelshift=" . $levelshift . " WHERE id=" . $query['id']);
         if ($passwordchange == true) {
             DB::query("UPDATE `" . _mysql_prefix . "-users` SET password='******', salt='" . $password[1] . "' WHERE id=" . $query['id']);
         }
         if ($usernamechange == true) {
             DB::query("UPDATE `" . _mysql_prefix . "-users` SET username='******' WHERE id=" . $query['id']);
         }
         _extend('call', 'user.edit', array('id' => $query['id'], 'username' => $username));
コード例 #12
0
<?php

/* ---  kontrola jadra  --- */
if (!defined('_core')) {
    exit;
}
/* ---  priprava promennych  --- */
$message = "";
/* ---  akce  --- */
if (isset($_POST['source'])) {
    // nacteni promennych
    $source = intval($_POST['source']);
    $target = intval($_POST['target']);
    $fullmove = _checkboxLoad("fullmove");
    // kontrola promennych
    $error_log = array();
    if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-root` WHERE id=" . $source . " AND type=2"), 0) == 0) {
        $error_log[] = $_lang['admin.content.movearts.badsource'];
    }
    if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-root` WHERE id=" . $target . " AND type=2"), 0) == 0) {
        $error_log[] = $_lang['admin.content.movearts.badtarget'];
    }
    if ($source == $target) {
        $error_log[] = $_lang['admin.content.movearts.samecats'];
    }
    // aplikace
    if (count($error_log) == 0) {
        if (!$fullmove) {
            $query = DB::query("SELECT id,home1,home2,home3 FROM `" . _mysql_prefix . "-articles` WHERE home1=" . $source . " OR home2=" . $source . " OR home3=" . $source);
            $counter = 0;
            while ($item = DB::row($query)) {
コード例 #13
0
     }
     if (!$skip) {
         $cond .= " AND ";
     }
 }
 // vycisteni podminky
 if ($cond == "") {
     $cond = 1;
 } else {
     $cond = mb_substr($cond, 0, mb_strlen($cond) - 5);
 }
 // vyhledani clanku
 $query = DB::query("SELECT art.id,art.title,art.title_seo,cat.title_seo AS cat_title_seo FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE " . $cond);
 $found = DB::size($query);
 if ($found != 0) {
     if (!_checkboxLoad("_process")) {
         $infopage = true;
     } else {
         $boolparams = array("public", "visible", "comments", "rateon", "showinfo");
         if (_loginright_adminconfirm) {
             $boolparams[] = "confirmed";
         }
         while ($item = DB::row($query)) {
             // smazani komentaru
             if ($new_delcomments or $new_delete) {
                 DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=2 AND home=" . $item['id']);
             }
             // smazani clanku
             if ($new_delete) {
                 DB::query("DELETE FROM `" . _mysql_prefix . "-articles` WHERE id=" . $item['id']);
                 continue;
コード例 #14
0
         $newdata['level'] = _loginright_level - 1;
     }
     if ($newdata['level'] >= 10000) {
         $newdata['level'] = 9999;
     }
     if ($newdata['level'] < 0) {
         $newdata['level'] = 0;
     }
 }
 // prava
 if ($id != 1) {
     foreach ($rights_array as $item) {
         if ($id == 2 and !in_array($item, $unregistered_useable) or _userHasNotRight($item)) {
             continue;
         }
         $newdata[$item] = _checkboxLoad($item);
     }
 }
 // ulozeni
 $sql = '';
 $last = sizeof($newdata) - 1;
 $counter = 0;
 foreach ($newdata as $col => $val) {
     $sql .= '`' . $col . '`=\'' . $val . '\'';
     if ($counter !== $last) {
         $sql .= ',';
     }
     ++$counter;
 }
 DB::query('UPDATE `' . _mysql_prefix . '-groups` SET ' . $sql . ' WHERE id=' . $id);
 // reload stranky
コード例 #15
0
ファイル: reg.php プロジェクト: sunlight-cms/sunlight-cms-7
     $errors[] = $_lang['admin.users.edit.emailexists'];
 }
 if (!_captchaCheck()) {
     $errors[] = $_lang['captcha.failure'];
 }
 $massemail = _checkboxLoad('massemail');
 if (_registration_grouplist and isset($_POST['group'])) {
     $group = intval($_POST['group']);
     $groupdata = DB::query("SELECT id FROM `" . _mysql_prefix . "-groups` WHERE id=" . $group . " AND blocked=0 AND reglist=1");
     if (DB::size($groupdata) == 0) {
         $errors[] = $_lang['global.badinput'];
     }
 } else {
     $group = _defaultgroup;
 }
 if (SL::$settings['rules'] != "" and !_checkboxLoad("agreement")) {
     $errors[] = $_lang['mod.reg.rules.disagreed'];
 }
 // vlozeni do databaze nebo seznam chyb
 if (count($errors) == 0) {
     _iplogUpdate(5);
     $code = _tmpRegister(_registration_confirm, $group, $username, $password, $massemail, _userip, $email);
     if (isset($code)) {
         // poslat potvrzeni
         $phase = 2;
         $domain = _getDomain();
         $mail = _mail($email, str_replace('*domain*', $domain, $_lang['mod.reg.confirm.subject']), str_replace(array('*username*', '*domain*', '*url*', '*ip*', '*date*', '*code*'), array($username, $domain, _url, _userip, _formatTime(time()), $code), $_lang['mod.reg.confirm.text']), "Content-Type: text/plain; charset=UTF-8\n" . _sysMailHeader());
     } else {
         // registrace ok
         $phase = 1;
     }
コード例 #16
0
                 // zprava
                 $message = _formMessage(1, $_lang['global.done']);
             } else {
                 $message = _formMessage(2, $_lang['admin.content.manageimgs.moveimgs.nokit']);
             }
         } else {
             $message = _formMessage(2, $_lang['global.badinput']);
         }
     } else {
         $message = _formMessage(2, $_lang['admin.content.manageimgs.moveimgs.samegal']);
     }
     break;
     /* -  odstraneni vsech obrazku  - */
 /* -  odstraneni vsech obrazku  - */
 case 6:
     if (_checkboxLoad("confirm")) {
         _tmpGalStorageCleanOnDel('home=' . $g);
         DB::query("DELETE FROM `" . _mysql_prefix . "-images` WHERE home=" . $g);
         $message = _formMessage(1, $_lang['global.done']);
     }
     break;
     /* -  upload obrazku  - */
 /* -  upload obrazku  - */
 case 7:
     // prepare vars
     $done = array();
     $total = 0;
     // prepare and check image storage
     $stor_a = 'pictures/galleries/' . $g . '/';
     $stor = _indexroot . $stor_a;
     if (($nostor = !is_dir($stor)) || !is_writeable($stor)) {
コード例 #17
0
 $jabber = DB::esc($jabber);
 // web
 $web = _htmlStr(trim($_POST['web']));
 if (mb_strlen($web) > 255) {
     $web = mb_substr($web, 0, 255);
 }
 if ($web != "" and !_validateURL("http://" . $web)) {
     $web = "";
 } else {
     $web = DB::esc($web);
 }
 // avatar
 $avatar = $query['avatar'];
 if (_uploadavatar) {
     // smazani avataru
     if (_checkboxLoad("removeavatar") && isset($avatar)) {
         @unlink(_indexroot . 'pictures/avatars/' . $avatar . '.jpg');
         $avatar = null;
     }
     // upload avataru
     if (isset($_FILES['avatar']) && is_uploaded_file($_FILES['avatar']['tmp_name'])) {
         // zpracovani
         $avatarUid = _pictureProcess(array('file_path' => $_FILES['avatar']['tmp_name'], 'file_name' => $_FILES['avatar']['name'], 'limit' => array('filesize' => 1048576, 'dimensions' => array('x' => 1400, 'y' => 1400)), 'resize' => array('mode' => 'zoom', 'x' => 96, 'y' => 128), 'target_path' => _indexroot . 'pictures/avatars/', 'target_format' => 'jpg', 'jpg_quality' => 95), $avatarError);
         if (false !== $avatarUid) {
             // smazani stareho avataru
             if (null !== $avatar) {
                 @unlink(_indexroot . 'pictures/avatars/' . $avatar . '.jpg');
             }
             // ok
             $avatar = $avatarUid;
         } else {
コード例 #18
0
}
/* ---  priprava  --- */
if (isset($_GET['c'])) {
    $c = _get('c');
    $returntolist = true;
} else {
    $c = '1';
    $returntolist = false;
}
/* ---  ulozeni  --- */
if (isset($_POST['title'])) {
    // nacteni promennych
    $title = DB::esc(_htmlStr($_POST['title']));
    $column = _post('column');
    $ord = floatval($_POST['ord']);
    $content = DB::esc(_filtrateHCM($_POST['content']));
    $visible = _checkboxLoad('visible');
    $public = _checkboxLoad('public');
    $class = trim($_POST['class']);
    if ($class === '') {
        $class = null;
    } else {
        $class = DB::esc(_htmlStr($class));
    }
    // vlozeni
    DB::query("INSERT INTO `" . _mysql_prefix . "-boxes` (ord,title,content,visible,public,`column`,class) VALUES (" . $ord . ",'" . $title . "','" . $content . "'," . $visible . "," . $public . ",'" . DB::esc($column) . "'," . (isset($class) ? '\'' . $class . '\'' : 'NULL') . ")");
    define('_redirect_to', 'index.php?p=content-boxes-edit&c=' . urlencode($column) . '&created');
    return;
}
/* ---  vystup  --- */
$output .= "\n<a href='index.php?p=" . ($returntolist ? "content-boxes-edit&amp;c=" . urlencode($c) : "content-boxes") . "' class='backlink'>&lt; " . $_lang['global.return'] . "</a>\n<h1>" . $_lang['admin.content.boxes.new.title'] . "</h1>\n<p class='bborder'></p>\n\n<form class='cform' action='index.php?p=content-boxes-new&amp;c=" . urlencode($c) . "' method='post'>\n\n<table class='formtable'>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.title'] . "</strong></td>\n<td><input type='text' name='title' class='inputmedium' maxlength='96' /></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.boxes.column'] . "</strong></td>\n<td><input type='text' maxlength='64' name='column' value='" . _htmlStr($c) . "' class='inputmedium' /></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.ord'] . "</strong></td>\n<td><input type='text' name='ord' value='1' class='inputmedium' /></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.class'] . "</strong></td>\n<td><input type='text' name='class' class='inputmedium' maxlength='24' /></td>\n</tr>\n\n<tr class='valign-top'>\n<td class='rpad'><strong>" . $_lang['admin.content.form.content'] . "</strong></td>\n<td><textarea name='content' class='areasmall_100pwidth codemirror' rows='9' cols='33'></textarea></td>\n</tr>\n\n<tr>\n<td class='rpad'><strong>" . $_lang['admin.content.form.settings'] . "</strong></td>\n<td>\n<label><input type='checkbox' name='visible' value='1' checked='checked' /> " . $_lang['admin.content.form.visible'] . "</label>&nbsp;&nbsp;\n<label><input type='checkbox' name='public' value='1' checked='checked' /> " . $_lang['admin.content.form.public'] . "</label>\n</td>\n</tr>\n\n<tr>\n<td></td>\n<td><input type='submit' value='" . $_lang['global.create'] . "' /></td>\n</tr>\n\n</table>\n\n" . _xsrfProtect() . "</form>\n\n";
コード例 #19
0
     $lastid = $id;
 }
 $quotes = "'";
 $skip = false;
 switch ($var) {
     case "title":
         $val = DB::esc(_htmlStr(trim($val)));
         break;
     case "lockedtrigger":
         $var = "locked";
         $val = _checkboxLoad("s" . $id . "_locked");
         $quotes = '';
         break;
     case "publictrigger":
         $var = "public";
         $val = _checkboxLoad("s" . $id . "_public");
         $quotes = '';
         break;
     case "delposts":
         $skip = true;
         DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE home=" . $id . " AND type=4");
         break;
     default:
         $skip = true;
         break;
 }
 // ukladani a cachovani
 if (!$skip) {
     // ulozeni
     if ($lastid != $id) {
         $sql = trim($sql, ",");