Ejemplo n.º 1
3
function post_comment()
{
    $post = $_POST['idpost'];
    $source = $_SESSION['id'];
    if (strlen($_POST['content']) < 2) {
        header('Location: ../index.php?r=2');
        exit;
    }
    $content = $_POST['content'];
    $content = htmlentities($content);
    include database;
    $req = $connection->prepare("INSERT INTO comments (idpost, idusercible, content, timedate) VALUES (" . $post . ", " . $source . ", '" . $content . "', NOW());");
    $req->execute();
    $message = "Vous avez un nouveau commentaire sur l'un de vos posts";
    include 'users.php';
    $login = get_login($_POST['iduser']);
    $mail = get_mail_user($login);
    mail($mail, 'Camagru - Nouveau Commentaire', $message);
    header('Location: ../index.php?r=3#' . $post);
}
Ejemplo n.º 2
2
/**
 * @return void
 * @param
 * @param
 * @desc A generic function, that can be used by all programs. Does all the basic login stuff.
 */
function initProgramlib($ctype = null)
{
    global $gbl, $sgbl, $login, $ghtml;
    // /*
    // --- solution for some scripts running well in slave
    // REVERT - back to original
    if ($sgbl->is_this_slave()) {
        print "This is a Slave Server. Operate it at the Master server.\n";
        exit;
    }
    // */
    static $var = 0;
    $var++;
    $progname = $sgbl->__var_program_name;
    lfile_put_contents($sgbl->__var_error_file, "");
    set_exception_handler("lx_exception_handler");
    //xdebug_disable();
    set_error_handler("lx_error_handler");
    //setcookie("XDEBUG_SESSION", "sess");
    if ($var >= 2) {
        dprint("initProgramlib called twice \n <br> ");
    }
    if ($ctype === 'superadmin') {
        $sgbl->__var_dbf = $sgbl->__path_supernode_db;
        $sgbl->__path_admin_pass = $sgbl->__path_super_pass;
        $sgbl->__var_admin_user = $sgbl->__var_super_user;
        $login = new SuperClient(null, null, 'superadmin', 'login', 'forced');
        $login->get();
        return;
    } else {
        if ($ctype === "guest") {
            $login = new Client(null, null, "____________", "guest");
            $login->get();
            return;
        } else {
            if ($ctype != "") {
                $login = new Client(null, null, $ctype, "login", "forced");
                $login->get();
                return;
            }
        }
    }
    $sessobj = null;
    if ($ghtml->frm_consumedlogin === 'true') {
        $clientname = $_COOKIE["{$progname}-consumed-clientname"];
        $classname = $_COOKIE["{$progname}-consumed-classname"];
        $session_id = $_COOKIE["{$progname}-consumed-session-id"];
        get_login($classname, $clientname);
        $login->__session_id = $session_id;
        $sessobj = $login->getObject('ssession');
    } else {
        if (isset($_COOKIE["{$progname}-session-id"])) {
            $clientname = $_COOKIE["{$progname}-clientname"];
            $classname = $_COOKIE["{$progname}-classname"];
            $session_id = $_COOKIE["{$progname}-session-id"];
            if ($classname === 'superclient') {
                $sgbl->__var_dbf = $sgbl->__path_supernode_db;
                $sgbl->__path_admin_pass = $sgbl->__path_super_pass;
                $sgbl->__var_admin_user = $sgbl->__var_super_user;
            }
            if ($classname === 'slave') {
                $sgbl->__var_dbf = $sgbl->__path_slave_db;
            }
            if ($classname) {
                get_login($classname, $clientname);
                $login->__session_id = $session_id;
                $sessobj = $login->getObject('ssession');
            }
        }
    }
    if (!$sessobj || $sessobj->dbaction === 'add') {
        if ($ghtml->frm_ssl) {
            $ssl = unserialize(base64_decode($ghtml->frm_ssl));
            $string = $ssl['string'];
            $ssl_param = $ssl['ssl_param'];
            $encrypted_string = base64_decode($ssl['encrypted_string']);
            if (!$string || !checkPublicKey($string, $encrypted_string)) {
                print "SSL Connection Failed <br> \n";
                exit;
            }
            $class = 'client';
            $clientname = 'admin';
            get_login($class, $clientname);
            do_login($class, $clientname, $ssl_param);
            $sessobj = $gbl->c_session;
            $sessobj->write();
            $sessobj->dbaction = 'clean';
        }
    }
    //get_savedlogin($classname, $clientname);
    //print_time('login_get', "Login Get");
    //dprintr($login);
    //avoid some php warnings
    if (isset($login)) {
        $gbl->client = $login->nname;
        $gbl->client_ttype = $login->cttype;
    }
    //dprintr($login->hpfilter);
    // This means the session object got created fresh.
    if (!$sessobj || $sessobj->dbaction === 'add') {
        dprint("Session id is empty. Clearing cookies and redirect to login.");
        clear_all_cookie();
        $ghtml->print_redirect_self("/login/");
    }
    $gbl->c_session = $sessobj;
    if ($login->getClName() !== $sessobj->parent_clname) {
        dprint_r($login->ssession_l);
        dprint(" <br> {$session_id} <br> <br> <br> ");
        print "Session error! Login again.";
        clear_all_cookie();
        $ghtml->print_redirect_self("/login/?frm_emessage=sessionname_not_client");
    }
    $gen = $login->getObject('general')->generalmisc_b;
    if (!$gen->isOn('disableipcheck') && $_SERVER['REMOTE_ADDR'] != $sessobj->ip_address) {
        $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
        log_message("An attempt to hack from {$hostname} (" . $_SERVER['REMOTE_ADDR'] . ") with sess {$sessobj->nname}, session ip: {$sessobj->ip_address}");
        if ($gen->isOn('disableipcheck')) {
        } else {
            clear_all_cookie();
            if ($gbl->c_session->ssl_param) {
                $sessobj->delete();
                $sessobj->write();
                $ghtml->print_redirect("{$gbl->c_session->ssl_param['backurl']}&frm_emessage=ipaddress_changed_amidst_session");
            } else {
                $ghtml->print_redirect_self("/login/?frm_emessage=ipaddress_changed_amidst_session");
            }
        }
    }
    if (intval($login->getSpecialObject('sp_specialplay')->ssession_timeout) <= 100) {
        $login->getSpecialObject('sp_specialplay')->ssession_timeout = 100;
        $login->setUpdateSubaction();
    }
    $timeout = $sessobj->last_access + $login->getSpecialObject('sp_specialplay')->ssession_timeout;
    $sessobj->timeout = $timeout;
    //$timeout  =  $sessobj->last_access + 4;
    $sessobj->last_access = time();
    $sessobj->setUpdateSubaction();
    if ($sessobj->auxiliary_id) {
        $aux = new Auxiliary(null, null, $sessobj->auxiliary_id);
        $aux->get();
        $login->__auxiliary_object = $aux;
    }
    if (time() > $timeout) {
        $sessobj->delete();
        $sessobj->write();
        //print("session error timeout");
        if ($gbl->c_session->ssl_param) {
            $ghtml->print_redirect("{$gbl->c_session->ssl_param['backurl']}&frm_emessage=session_timeout");
        } else {
            $ghtml->print_redirect_self("/login/?frm_emessage=session_timeout");
        }
    }
    addToUtmp($sessobj, 'update');
}
Ejemplo n.º 3
1
function show_page($page)
{
    $template = "view/templates/default_template.php";
    if (file_exists($template) && is_file($template)) {
        require_once $template;
    } else {
        require_once "view/templates/default_template.php";
    }
    echo get_document_head();
    echo get_header_start();
    if (is_logged_in()) {
        echo get_logout();
    } else {
    }
    echo get_header_end();
    if (is_logged_in()) {
        echo get_menu();
    } else {
        echo get_guest_menu();
    }
    if (is_logged_in()) {
        if ($page == "startpage") {
            echo "startpage";
        } else {
            if ($page == "fileupload") {
                echo get_fileupload();
            } else {
                if ($page == "nyheter") {
                    echo get_news();
                } else {
                    if ($page == "flowing") {
                        echo get_flowing();
                    } else {
                        if ($page == "event") {
                            echo get_event();
                        } else {
                            if ($page == "profile") {
                                $user_id = 1;
                                echo get_profile($user_id);
                            } else {
                                echo get_default("");
                            }
                        }
                    }
                }
            }
        }
    } else {
        echo get_login();
    }
    echo get_footer();
    echo get_document_end();
}
Ejemplo n.º 4
1
 function index()
 {
     if (!is_logged()) {
         redirect(base_url());
     }
     include APPPATH . "config/evote.php";
     $this->data['title'] = lang('off_vote');
     $text = icon('64x64/chart_up.png') . '<h2>Голосование на TOP EMUDEV</h2><p>После голосования нажмите получить бонус.</p><p>При простом голосовании вы получите <b>' . $config['normal'] . '</b> BP, 
     При смс голосе вы получите <b>' . $config['sms'] . '</b> BP.</p>';
     $smslink = str_replace('server', 'sms', $config['votelink']);
     $text .= icon('32x32/comment.png') . '<a href="' . $config['votelink'] . '" target="_blank">Голосовать</a>' . br(1);
     $text .= icon('32x32/sms.png') . '<a href="' . $smslink . '" target="_blank">Голосовать через SMS</a>' . br(1);
     $this->load->model('Account');
     $this->Account->login = get_login();
     $array = $this->Account->char_array();
     $form = form_dropdown('char', $array);
     $text .= form_open('evote/getbonus') . $form . form_submit('mysubmit', 'Получить бонус') . icon('32x32/note_accept.png') . form_close();
     $this->data['content'] = $text;
     compile();
 }
/**
 * Audits an important action in the global audit log
 */
function audit($action, $message)
{
    $now = new DateTime();
    $when = $now->format('Y-m-d H:i:s');
    $ip = $_SERVER["REMOTE_ADDR"];
    $user = get_login();
    if ($user == NULL) {
        $user = "******";
    }
    $db = DB::get_db();
    $sql = sprintf("INSERT INTO audit_logs (`when`, ip, user, action, message)" . "VALUES ('%s', '%s', '%s', '%s', '%s')", $db->real_escape_string($when), $db->real_escape_string($ip), $db->real_escape_string($user), $db->real_escape_string($action), $db->real_escape_string($message));
    if (!$db->query($sql)) {
        error_log("Unable to insert into audit_logs: " . $db->error . " (sql: {$sql})");
        return FALSE;
    }
    return TRUE;
}
Ejemplo n.º 6
0
function openlevel($thread, $mod, $begin, $end, $thispage, $blog_thread, $lastlink, $ord)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
    global $session;
    session_start();
    $uid = $_SESSION['uid'];
    $objResponse = new xajaxResponse();
    $blog = new blogs();
    $ret = '';
    $cur_user_msgs = array();
    list($gr_name, $gr_id, $gr_base) = $blog->GetThread($thread, $err, $mod, get_uid(false));
    $blog->GetThreeId($begin, $threearr, 0);
    $parent_login = $blog->login;
    while ($blog->GetNext()) {
        $stopwrite = true;
        foreach ($threearr as $temp) {
            if ($blog->id == $temp) {
                $stopwrite = false;
                break;
            }
        }
        if ($stopwrite) {
            continue;
        }
        $msg_num++;
        $allow_del = 0;
        if ($last_id == $blog->id) {
            print "<a name=\"post\" id=\"post\"></a>";
        }
        if ($blog->id == $edit_id && $blog->login == $_SESSION['login']) {
            print "<a name=\"edit\" id=\"edit\"></a>";
        }
        if ($blog->attach) {
            $str = viewattachLeft($blog->login, $blog->attach, "upload", $file, 1000, 600, 307200, !$blog->small, $blog->small == 2 ? 1 : 0);
        }
        $padding = $blog->level > 19 ? 380 : $blog->level * 20;
        if (in_array($blog->reply, $cur_user_msgs)) {
            $allow_del = 1;
        }
        if ($blog->login == $_SESSION['login']) {
            $cur_user_msgs[] = $blog->id;
        }
        $ret .= '<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr valign="top" ';
        $ret .= '><td style="';
        if ($blog->level) {
            $ret .= 'padding-left: ' . $padding . 'px;';
        }
        $ret .= 'padding-right: 10px;">' . view_avatar($blog->login, $blog->photo) . '
			</td>
			<td class="bl_text" width="100%">';
        if ($winner == $blog->id) {
            $ret .= '<a name="winner" id="winner"></a> ';
        }
        if ($blog->payed) {
            $ret .= view_pro();
        }
        $ret .= $session->view_online_status($blog->login);
        $ret .= '<font class="' . $blog->cnt_role . 'name11"><a href="/users/' . $blog->login . '" class="' . $blog->cnt_role . 'name11" title="' . ($blog->uname . " " . $blog->usurname) . '">' . ($blog->uname . " " . $blog->usurname) . '</a> [<a href="/users/' . $blog->login . '" class="' . $blog->cnt_role . 'name11" title="' . $blog->login . '">' . $blog->login . '</a>]</font>&nbsp;&nbsp;' . date("[d.m.Y | H:i]", strtotimeEx($blog->post_time));
        if ($blog->deleted) {
            if (isset($blog->thread) && is_array($blog->thread) && count($blog->thread) > 0) {
                $buser_id = $blog->thread;
                $buser_id = array_pop($buser_id);
                $buser_id = $buser_id['fromuser_id'];
            }
            if ($blog->deluser_id == $blog->fromuser_id) {
                $ret .= '<br><br>Комментарий удален автором ' . date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            } elseif ($blog->deluser_id == $buser_id) {
                $ret .= '<br><br>Комментарий удален автором темы ' . date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            } else {
                $ret .= '<br><br>Комментарий удален модератором';
                if (!$mod) {
                    $ret .= '( ';
                    $del_user = $user->GetName($blog->deluser_id, $err);
                    $ret .= $del_user['login'] . ' : ' . $del_user['usurname'] . ' ' . $del_user['uname'];
                    $ret .= ' ) ';
                }
                $ret .= date("[d.m.Y | H:i]", strtotimeEx($blog->deleted));
            }
            $ret .= '<br><br>';
        } else {
            if ($blog->modified) {
                $ret .= '&nbsp; &nbsp;';
                if ($blog->modified_id == $blog->fromuser_id) {
                    $ret .= '[внесены изменения: ' . date("d.m.Y | H:i]", strtotimeEx($blog->modified));
                } else {
                    $ret .= 'Отредактировано модератором';
                    if (!$mod) {
                        $ret .= '( ';
                        $mod_user = $user->GetName($blog->modified_id, $err);
                        $ret .= $mod_user['login'] . ' : ' . $mod_user['usurname'] . ' ' . $mod_user['uname'];
                        $ret .= ' ) ';
                    }
                    $ret .= ' ' . date("[d.m.Y | H:i]", strtotimeEx($blog->modified));
                }
            }
            $ret .= '<br>';
            if ($winner == $blog->id) {
                $ret .= '<font color="#000099" style="font-size:20px">Победитель</font>';
            }
            $ret .= '<br>';
            if ($blog->new == 't') {
                $ret .= '<img src="/images/ico_new_blog.gif" alt="" width="44" height="12" border="0"><br>';
            }
            if ($blog->title) {
                $ret .= ' <font class="bl_name">';
                if ($blog->login == "Anonymous") {
                    list($name, $mail) = sscanf($blog->title, "%s @@@: %s");
                    $ret .= $name . " " . $mail;
                } else {
                    $ret .= reformat($blog->title, 30);
                }
                $ret .= '</font><br>';
            }
            $ret .= reformat($blog->msgtext, 50) . '<br>';
            if ($blog->attach) {
                if ($file) {
                    $ret .= "<br>" . $str . "<br>";
                } else {
                    $ret .= "</td></tr><tr class=\"qpr\"><td colspan=\"2\"><br>" . $str;
                }
            }
            $ret .= '<br>';
            if ($gr_base == 5 && !$winner && $parent_login == $_SESSION['login']) {
                $ret .= "<input type=\"submit\" name=\"btn\" value=\"Это победитель\" onClick=\"if (warning(0)) window.location.replace('./view.php?tr=" . $thread . "&ord='.{$ord}.'&winner=" . $blog->id . "'); else return false;\">";
            }
            $ret .= '<div style="color: #D75A29;font-size:9px;';
            if ($blog->attach && !$file) {
                $ret .= ' padding-left: ' . ($padding + 60) . 'px;';
            }
            $ret .= '">';
            if ($blog->login == $_SESSION['login'] || $parent_login == $_SESSION['login'] || $allow_del || !$mod) {
                $ret .= ' <a href="' . $form_uri . '?id=' . $blog->id . '&amp;action=delete&ord=' . $ord . '" style="color: #D75A29;" onclick="return warning(1);">Удалить</a> |';
            }
            if ($blog->login == $_SESSION['login'] || !$mod) {
                $ret .= '<a href="' . $form_uri . '?id=' . $blog->id . '&amp;action=edit&ord=' . $ord . '&amp;tr=' . $thread . '" style="color: #D75A29;">Редактировать</a> |';
            }
            $ret .= "<a href=\"javascript: void(0);\" onclick=\"javascript: answer('" . $blog->id . "', '" . ($blog->attach ? $blog->attach : '') . "', '" . get_login($_SESSION["uid"]) . "'); document.getElementById('frm').olduser.value = '" . $_SESSION["uid"] . "'; \" ";
            $ret .= 'style="color: #D75A29">Комментировать</a> |
  			<a href="/blogs/view.php' . "?tr=" . $blog_thread . ($thispage ? "&pagefrom=" . $thispage : "") . "&openlevel=" . $blog->id . "&ord=" . $ord . "#o" . $blog->id . '" style="color: #D75A29">Ссылка</a> 
  			</div>
						</td>
		</tr>
		<tr';
            if (!$blog->level || $lastlink == $blog->id) {
                $ret .= ' class="qpr"';
            }
            $ret .= '><td colspan="2" ><br></td></tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr class="n_qpr"><td colspan="3" id="form' . $blog->id . '">';
            if ($blog->id == $edit_id && ($blog->login == $_SESSION['login'] || !$mod)) {
                $ret .= "\n\t\t\t<script language=\"JavaScript\" type=\"text/javascript\">\n\t\t\t<!--\n\t\t\tanswer(" . $blog->id . ", '" . ($blog->attach ? $blog->attach : '') . "', '" . get_login($_SESSION["uid"]) . "');\n\t\t\tdocument.getElementById('frm').olduser.value = '" . $_SESSION["uid"] . "';\n\t\t\tdocument.getElementById('frm').msg_name.value = '" . $error_flag ? input_ref_scr($msg_name) : input_ref_scr($blog->title) . "';\n\t\t\tdocument.getElementById('frm').msg.value = '" . $error_flag ? input_ref_scr($msg) : input_ref_scr($blog->msgtext) . "';\n\t\t\tdocument.getElementById('frm').btn.value = 'Сохранить';\n\t\t\tdocument.getElementById('frm').action.value = 'change';\n\t\t\t//-->\n\t\t\t</script>";
            }
        }
        $ret .= "</td></tr>\n\t\t</table>";
    }
    $objResponse->assign($begin, "innerHTML", $ret);
    return $objResponse;
}
Ejemplo n.º 7
0
$is_adm = false;
// чтобы админ мог редактировать предложения по проектам
if (hasPermissions('projects') && InGetPost('uid')) {
    $uid = InGetPost('uid');
    $is_pro = payed::checkProByUid($uid);
    $is_adm = true;
}
$error = false;
$err = '';
$pict_added = false;
//die ("DUMP: " . var_export($_FILES, true));
if (isset($_POST['action']) && $_POST['action'] == 'add_pic' && is_array($_FILES['ps_attach'])) {
    $prj_id = isset($_POST['pid']) ? intval($_POST['pid']) : 0;
    $img = new CFile($_FILES['ps_attach']);
    if ($img->size > 0) {
        $dir = get_login($uid);
        // чтобы админ мог редактировать предложения по проектам
        if ($is_adm) {
            require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
            $user = new users();
            $user->GetUserByUID($uid);
            $dir = $user->login;
        }
        $img->max_size = 2097152;
        $img->proportional = 1;
        $pictname = $img->MoveUploadedFile($dir . "/upload");
        $mid = $img->id;
        if (!isNulArray($img->error)) {
            if ($img->size > $img->max_size) {
                $err = 'Недопустимый размер файла';
            }
Ejemplo n.º 8
0
<?php

const USER = '******';
const PASS = '******';
session_start();
switch ($_SERVER["REQUEST_METHOD"]) {
    case 'GET':
        get_login();
        break;
    case 'POST':
        post_login();
        break;
    case 'DELETE':
        delete_login();
        break;
    default:
        http_response_code(405);
        die;
}
function get_login()
{
    if ($_SESSION["loggedin"] == true) {
        echo json_encode(array('loggedin' => true, 'status' => 'logged in'));
    } else {
        echo json_encode(array('loggedin' => false, 'status' => 'not logged in'));
    }
}
function post_login()
{
    $data = json_decode(file_get_contents('php://input'));
    if (isset($data->user) && $data->user == USER && isset($data->password) && $data->password == PASS) {
Ejemplo n.º 9
0
 * ### NB per ora check non e' implementato ###
 * 
 */
if ($_GET['type'] === "student") {
    $alunni = array();
    // file di log
    $log_file = fopen("../tmp/studenti" . date("Ymd"), "w+");
    $index = 0;
    $incompleti = 0;
    $sel = "SELECT id_alunno, nome, cognome, username, password FROM alunni WHERE attivo = 1";
    $res = $db->execute($sel);
    while ($_alunno = $res->fetch_assoc()) {
        if ($_alunno['username'] == '') {
            $al = new Alunno($_alunno);
            $incompleti++;
            $al->username = get_login($db, $al->nome, $al->cognome);
            $al->password = get_password($al->nome, $al->cognome, &$al->clean_pwd);
            //print ($al->username).":".$al->password."<br/>";
            $upd = "UPDATE alunni SET username = '******', password = '******' WHERE id_alunno = " . $al->id_alunno;
            $r = $db->execute($upd);
            $str_log = $al->nome . " " . $al->cognome . ":" . $al->username . ":" . $al->password . ":" . $al->clean_pwd . "\n";
            fwrite($log_file, $str_log);
        }
    }
} else {
}
?>

<html>
<head>
<title>Creazione account</title>
Ejemplo n.º 10
0
<div class="b-layout__right b-layout__right_width_72ps b-layout__right_float_right">
        <h1 class="b-page__title b-page__title_padbot_30">Добро пожаловать на Free-lance.ru</h1>
</div>
<div class="b-layout__right b-layout__right_width_72ps b-layout__right_float_right">
    <div class="b-fon b-fon_inline-block b-fon_padbot_20">
            <div class="b-fon__body b-fon__body_pad_15  b-fon__body_padleft_30 b-fon__body_lineheight_18 b-fon__body_padright_40 b-fon__body_fontsize_13 b-fon__body_bg_f0ffdf">
            <span class="b-icon b-icon_sbr_gok b-icon_margleft_-25"></span>Вы успешно зарегистрированы, и теперь вам доступны все бесплатные функции сайта.
        </div>
    </div>

    <div class="b-layout__txt b-layout__txt_fontsize_22">&mdash; Перейти на <a class="b-layout__link" href="/">главную страницу</a></div>
    <div class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_padleft_30 b-layout__txt_padbot_40">и начать самостоятельный поиск работы.</div>
    <div class="b-layout__txt b-layout__txt_fontsize_22">&mdash; Перейти в <a class="b-layout__link" href="/users/<?php 
echo get_login(get_uid(0));
?>
/">личный кабинет</a></div>
    <div class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_padleft_30 b-layout__txt_padbot_40">указать профессиональную информацию и заполнить портфолио.</div>
</div>

<?php 
if (!empty($_SESSION['is_new_user'])) {
    unset($_SESSION['is_new_user']);
    ?>
<script language="javascript" src="http://www.everestjs.net/static/st.v2.js"></script>
<script language="javascript">
var ef_event_type="transaction";
var ef_transaction_properties = "ev_reg_worker=1&ev_reg_employer=0&ev_reg_worker_master=0&ev_reg_employer_master=0&ev_transid=<?php 
    echo md5($_SESSION['uid']);
    ?>
";
/*
Ejemplo n.º 11
0
session_start();
$masssending = new masssending();
if (empty($_SESSION['masssending_total_filesize'])) {
    $_SESSION['masssending_total_filesize'] = 0;
}
if (empty($_SESSION['masssending']['files'])) {
    $_SESSION['masssending']['files'] = array();
}
if (count($_SESSION['masssending']['files']) >= masssending::MAX_FILES) {
    $error = 'Максимальное кол-во прикрепленных файлов - ' . masssending::MAX_FILES;
} else {
    if ($_SESSION['masssending_total_filesize'] + $_FILES['attach']['size'] > masssending::MAX_FILE_SIZE) {
        $error = 'Максимальный объем прикрепленных файлов - ' . masssending::MAX_FILE_SIZE / (1024 * 1024) . ' Mб';
    } else {
        if ($uid = get_uid(false)) {
            $login = get_login($uid);
            $file = new CFile($_FILES['attach']);
            $file->table = 'file';
            $file->max_size = masssending::MAX_FILE_SIZE;
            $filename = $file->MoveUploadedFile("{$login}/contacts");
            $filetype = $file->getext();
            $error = $file->error;
        } else {
            $error = 'Вы не авторизованы';
        }
        if (!$file->id && !$error) {
            $error = 'Ошибка при загрузке файла. Пожалуйста, попробуйте еще раз.';
        }
        $masssending->AddFile($file->id, session_id());
    }
}
/****************************************************************/
// $Id$
if (!defined('AT_INCLUDE_PATH')) { exit; }

global $db;
global $_base_href, $msg, $_config;
$link_limit = 3;		// Number of links to be displayed on "detail view" box

require_once("bbb_api_conf.php");
require_once("bbb_api.php");

$bbb_joinURL;
$_moderatorPassword="******";
$_attendeePassword="******";   
$_logoutUrl= $_base_href.'index.php';
$username=get_login(intval($_SESSION["member_id"]));
$meetingID=$_SESSION['course_id'];
$bbb_welcome = _AT('bbb_welcome');
$salt = $_config['bbb_salt'];
$url = $_config['bbb_url']."/bigbluebutton/";

$response = BigBlueButton::createMeetingArray($username,$meetingID,$bbb_welcome, $_moderatorPassword,$_attendeePassword, $salt, $url,$_logoutUrl);

//Analyzes the bigbluebutton server's response
if(!$response){//If the server is unreachable
		$msg->addError("UNABLE_TO_CONNECT_TO_BBB");
}
else if( $response['returncode'] == 'FAILED' ) { //The meeting was not created
	if($response['messageKey'] == 'checksumError'){
		$msg->addError("CHECKSUM_ERROR_BBB");
	}
Ejemplo n.º 13
0
 /**
  * Добавить новую рассылку
  *
  * @param    string  $subject        тема email
  * @param    string  $message        текст email
  * @param    array   $attaches       прикрепленные файлы
  * @param    string  $contact_ids    идентификаторы получателей
  */
 function AddMail($subject, $message, $attaches, $contact_ids)
 {
     global $DB;
     $files = '';
     $fs = array();
     if ($attaches['file']) {
         $f = new CFile($attaches['file']);
         $f->max_size = 2097152;
         $dir = get_login(get_uid(false));
         $f_name = $f->MoveUploadedFile($dir . "/upload");
         array_push($fs, $f_name);
     }
     for ($i = 1; $i <= 5; $i++) {
         if ($attaches['file_' . $i]) {
             $f = new CFile($attaches['file_' . $i]);
             $f->max_size = 2097152;
             $dir = get_login(get_uid(false));
             $f_name = $f->MoveUploadedFile($dir . "/upload");
             array_push($fs, $f_name);
         }
     }
     if ($fs) {
         foreach ($fs as $v) {
             $files .= $v . ',';
         }
         $files = preg_replace("/,\$/", "", $files);
     }
     $sql = "INSERT INTO contacts_mails(subject,message,attaches,contact_ids,user_id) VALUES(?, ?, ?,? , ?i)";
     $DB->query($sql, pg_escape_string($subject), pg_escape_string(nl2br($message)), $files, $contact_ids, get_uid(false));
 }
Ejemplo n.º 14
0
    }
}
function logout()
{
    setcookie("auth", '', 0, "/");
    echo "Logged out";
}
if (!init_db(get_server_config())) {
    error_page("can't open DB");
}
$action = get_str("action", true);
if ($action == "login") {
    login_action();
    exit;
}
$source = get_login();
if (!$source) {
    login_page();
    exit;
}
switch ($action) {
    case 'edit_store_action':
        edit_store_action();
        break;
    case 'edit_store_form':
        edit_store_form();
        break;
    case 'file_search_action':
        file_search_action();
        break;
    case 'file_search_form':
Ejemplo n.º 15
0
 /**
  * Обновление логотипа пользователя.
  *
  * @param integer $fid ИД пользователя
  * @param object  $logo CFile, @see class CFile();
  * @param integer $del  Удалить либо обновить (1,0)
  *
  * @return string $error Сообщение об ошибке
  */
 public function UpdateLogo($fid, $logo, $del)
 {
     // если юзер меняет логотип пока предыдущий еще не отмодерирован - будет история изменений
     $aChange = $GLOBALS['DB']->row("SELECT id, old_val, new_val FROM users_change WHERE user_id = ?i AND ucolumn = 'logo'", $fid);
     $aDelFile = array();
     // файлы которые нужно будет удалять сразу
     $dir = get_login($fid);
     $err = '';
     if (!$dir) {
         $error = 'Имя пользователя не определено';
     }
     $this->logo = $this->GetField($fid, $err, 'logo');
     $old_logo = $this->logo;
     $error .= $err;
     if ($del == 1) {
         $this->logo = '';
     } else {
         if ($logo && !$error) {
             $logo->max_size = 50000;
             $logo->max_image_size = array('width' => 150, 'height' => 100);
             $logo->resize = 0;
             $logo->proportional = 1;
             $logo->topfill = 1;
             $logo->allowed_ext = $GLOBALS['graf_array'];
             $this->logo = $logo->MoveUploadedFile($dir . '/logo');
             $error .= $logo->StrError('<br />');
             if (!$error && !$logo->img_to_small('sm_' . $this->logo, array('width' => 50, 'height' => 50))) {
                 $error .= 'Невозможно уменьшить картинку.';
             }
         }
     }
     if (!$error) {
         $error .= $this->Update($fid, $res);
         // определяемся какие файлы нужно удалить
         if ($del == 1) {
             // удаляем логотип
             if ($aChange) {
                 // если хранили версии логотипа на случай возврата - то грохаем обе
                 if ($aChange['old_val']) {
                     $aDelFile[] = $aChange['old_val'];
                 }
                 $aDelFile[] = $aChange['new_val'];
             } else {
                 // иначе просто грохаем логотип
                 $aDelFile[] = $old_logo;
             }
         } elseif ($logo) {
             // меняем логотип
             if ($aChange && $aChange['new_val']) {
                 // грохаем только промежуточную версию, если была
                 $aDelFile[] = $aChange['new_val'];
             }
         }
     }
     // удаление не нужных файлов (если нет ошибок при сохранении разумеется)
     if ($aDelFile && !$error) {
         foreach ($aDelFile as $file) {
             $logo->Delete(0, 'users/' . substr($dir, 0, 2) . '/' . $dir . '/logo/', $file);
             $logo->Delete(0, 'users/' . substr($dir, 0, 2) . '/' . $dir . '/logo/', 'sm_' . $file);
         }
     }
     return $error;
 }
Ejemplo n.º 16
0
 /**
  * Взять заявки по определенному тарифу
  *
  * @param integer $bill_id  	   ИД оплаты
  * @param integer $gift_id  	   ИД подарка
  * @param integer $gid      	   ИД подарка
  * @param integer $fid      	   ИД пользователя
  * @param integer $transaction_id  ИД транзакции
  * @param integer $time            Время
  * @param integer $comments        Комментарий оплаты
  * @param integer $tarif           ИД Тарифа (см. таблицу op_codes)
  * @return array Данные выборки
  */
 function GiftOrderedTarif(&$bill_id, &$gift_id, $gid, $fid, $transaction_id, $time, $comments = "Аккаунт PRO  в подарок", $tarif = 52)
 {
     global $DB;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
     $account = new account();
     $error = $account->Gift($bill_id, $gift_id, $transaction_id, $tarif, $fid, $gid, "Все разделы", $comments, 10 * ($tarif == 52 || $tarif == 16 ? $time : 1));
     if (!$error) {
         $sql = "INSERT INTO orders (from_id, to_date, tarif, ordered, billing_id, payed) VALUES (?, ?, ?, true, ?, true)";
         if ($DB->query($sql, $gid, is_numeric($time) ? "{$time} month" : $time, $tarif, $bill_id)) {
             $login = get_login($gid);
             if ($gid == $_SESSION['uid'] && !is_pro()) {
                 $_SESSION['is_pro_new'] = 't';
             }
             if ($gid == $_SESSION['uid']) {
                 $pro_last = payed::ProLast($login);
                 $_SESSION['pro_last'] = $pro_last['freeze_to'] ? false : $pro_last['cnt'];
             } else {
                 $session = new session();
                 $session->UpdateProEndingDate($login);
             }
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 17
0
$date2 = date('Y-m-d', strtotime($date2));
echo "<span class='heure'>" . $date2 . "</span>";
echo "<span class='texte'>" . $post['content'] . "</span>";
echo "<img src='" . $post['link'] . "'/>";
echo "<img class='pp' src='upload/profilpictures/" . get_pp($login) . "'/>";
echo "<a href='profile?login="******"'><span class='login'>" . $login . "</span></a>";
//echo "<span class='heure'> report content(" . $post['report'] .") </span>";
echo "<span class='like'>" . get_nblike($post['id']) . " likes - <span class='opencomments'>";
echo get_nb_comments($post['id']) . " comments </span></span>";
$comments = get_comments($post['id']);
echo "<div class='comments active'>";
foreach ($comments as $com) {
    $date = $com['timedate'];
    $date = date('d/m/Y', strtotime($date));
    echo "<div class='com'>";
    $user = get_login($com['idusercible']);
    echo "<div class='userinfos'><img class='pp' src='upload/profilpictures/" . get_pp($user) . "'/>";
    echo "<a href='profile?login="******"'><span class='login'> Par " . $user . " le " . $date . "</span></a> </div>";
    echo "<div class='texte'>" . $com['content'] . "</div>";
    echo "</div>";
}
if (isset($_SESSION['login'])) {
    ?>
    <form action="model/comments.php" name="commenter" method="post">
      <input type="hidden" name="idpost" value="<?php 
    echo $post['id'];
    ?>
"/>
      <input type="hidden" name="iduser" value="<?php 
    echo $post['iduser'];
    ?>
Ejemplo n.º 18
0
 /**
  * Обновляет фото пользователя
  *
  * @param integer $fid               id пользователя
  * @param object $foto               файл фотографии
  * @param integer $del               флаг удаления фото (1 - удалить, 0 - перезакачаь)
  * @return string                    текст ошибки в случае неуспеха
  */
 function UpdateFoto($fid, $foto, $del)
 {
     // если юзер меняет аватар пока предыдущий еще не отмодерирован - будет история изменений
     $aChange = $GLOBALS['DB']->row("SELECT id, old_val, new_val FROM users_change WHERE user_id = ?i AND ucolumn = 'photo'", $fid);
     $aDelFile = array();
     // файлы которые нужно будет удалять сразу
     $dir = get_login($fid);
     $err = "";
     if (!$dir) {
         $error = "Имя пользователя не определено";
     }
     $this->photo = $this->GetField($fid, $err, "photo");
     $old_foto = $this->photo;
     $error .= $err;
     if ($del == 1) {
         $this->photo = "";
     } else {
         if ($foto && !$error) {
             $foto->max_size = 102400000;
             $foto->max_image_size = array('width' => 100, 'height' => 100, 'less' => 0);
             $foto->resize = 1;
             $foto->proportional = 1;
             $foto->topfill = 1;
             $cFile->crop = 1;
             $foto->allowed_ext = array_diff($GLOBALS['graf_array'], array('swf', 'gif'));
             $this->photo = $foto->MoveUploadedFile($dir . "/foto");
             $error .= $foto->StrError('<br />');
             if (!$error && !$foto->img_to_small("sm_" . $this->photo, array('width' => 50, 'height' => 50))) {
                 $error .= "Невозможно уменьшить картинку.";
             }
         }
     }
     if (!$error) {
         $error .= $this->Update($fid, $res);
         // определяемся какие файлы нужно удалить
         if ($del == 1) {
             // удаляем аватар
             if ($aChange) {
                 // если хранили версии аватара на случай возврата - то грохаем обе
                 if ($aChange['old_val']) {
                     $aDelFile[] = $aChange['old_val'];
                 }
                 $aDelFile[] = $aChange['new_val'];
             } else {
                 // иначе просто грохаем аватар
                 $aDelFile[] = $old_foto;
             }
         } elseif ($foto) {
             // меняем аватар
             if ($aChange && $aChange['new_val']) {
                 // грохаем только промежуточную версию, если была
                 $aDelFile[] = $aChange['new_val'];
             }
         }
     }
     // удаление не нужных файлов (если нет ошибок при сохранении разумеется)
     if ($aDelFile && !$error) {
         foreach ($aDelFile as $file) {
             $foto->Delete(0, "users/" . substr($dir, 0, 2) . "/" . $dir . "/foto/", $file);
             $foto->Delete(0, "users/" . substr($dir, 0, 2) . "/" . $dir . "/foto/", "sm_" . $file);
         }
     }
     return $error;
 }
Ejemplo n.º 19
0
function print_index()
{
    global $gbl, $sgbl, $ghtml, $login;
    ob_start();
    print_time('index');
    $cgi_clientname = $ghtml->frm_clientname;
    Htmllib::checkForScript($cgi_clientname);
    $cgi_class = $ghtml->frm_class;
    if (!$cgi_class) {
        $cgi_class = getClassFromName($cgi_clientname);
    }
    $cgi_password = $ghtml->frm_password;
    $cgi_forgotpwd = $ghtml->frm_forgotpwd;
    $cgi_email = $ghtml->frm_email;
    $cgi_key = $ghtml->frm_login_key;
    if (!$cgi_password || !$cgi_clientname) {
        $ghtml->print_redirect("/login/?frm_emessage=login_error");
    }
    $cgi_classname = 'client';
    if ($cgi_class) {
        $cgi_classname = $cgi_class;
    }
    if ($cgi_clientname == "" || $cgi_password == "" && $cgi_key == "") {
        $cgi_forgotpwd = $ghtml->frm_forgotpwd;
        return;
    }
    $ip = $_SERVER['REMOTE_ADDR'];
    if (!check_login_success($cgi_classname, $cgi_clientname, $cgi_password, $cgi_key)) {
        return;
    }
    log_log("login_success", "Successful Login to {$cgi_clientname} from " . $_SERVER['REMOTE_ADDR']);
    /*
    	try {
    		$att = $gbl->g->getFromList("loginattempt", $ip);
    		$att->delete();
    } catch (Exception $e) {
    }
    */
    if (check_disable_admin($cgi_clientname)) {
        $ghtml->print_redirect("/login/?frm_emessage=login_error");
        exit;
    }
    if (get_login($cgi_classname, $cgi_clientname)) {
        do_login($cgi_classname, $cgi_clientname);
        $login->was();
        check_blocked_ip();
        $ghtml->print_redirect("/");
    } else {
        $ghtml->cgiset("frm_emessage", "login_error");
    }
    $cgi_forgotpwd = $ghtml->frm_forgotpwd;
}
Ejemplo n.º 20
0
function chararray($login = '')
{
    if ($login == '') {
        $login = get_login();
    }
    $CI =& get_instance();
    $char = array();
    $query = $CI->MSSQL->query("SELECT Serial,Name FROM " . get_world() . ".dbo.tbl_base WHERE Account='{$login}' AND DCK=0");
    if ($query->num_rows() > 0) {
        foreach ($query->result() as $row) {
            $char[$row->Serial] = $row->Name;
        }
        //for
    } else {
        return false;
    }
    //if
    return $char;
}
Ejemplo n.º 21
0
function AddDialogueMessage($form)
{
    global $session;
    session_start();
    $objResponse = new xajaxResponse();
    $offerIsBlocked = projects_offers::isOfferBlocked(false, get_uid(), $form['prj_id']);
    if ($offerIsBlocked) {
        $objResponse->alert('Ваше предложение заблокировано, вы не можете отправить это сообщение');
        return $objResponse;
    }
    $prj = new projects();
    $project = $prj->GetPrjCust(intval($form['prj_id']));
    $is_pro = is_pro();
    if ($project['pro_only'] == 't' && !$is_pro && !is_emp() && !hasPermissions('projects')) {
        if ($project['kind'] == 7) {
            if (contest::IsContestOfferExists($project['id'], get_uid(false))) {
                $is_pro = true;
            }
        } else {
            if (projects_offers::IsPrjOfferExists($project['id'], get_uid(false))) {
                $is_pro = true;
            }
        }
    }
    if ($project['pro_only'] == 't' && !$is_pro && $project['user_id'] != get_uid() && !hasPermissions('projects')) {
        $objResponse->alert('Данная функция доступна только пользователям с аккаунтом PRO.');
        $objResponse->script("\$('savebtn').set('disabled', false);");
        return $objResponse;
    } elseif ($project['verify_only'] == 't' && !($_SESSION['is_verify'] == 't') && $project['user_id'] != get_uid() && !hasPermissions('projects')) {
        $objResponse->alert('Данная функция доступна только верифицированным пользователям.');
        $objResponse->script("\$('savebtn').set('disabled', false);");
        return $objResponse;
    }
    if (!trim($form['po_text'])) {
        $objResponse->alert('Невозможно отправить пустое сообщение.');
        $objResponse->script("\n            \$('savebtn').set('disabled', false);\n        ");
        return $objResponse;
    }
    if (!is_emp() && $form['from'] == 'emp') {
        $objResponse->script("\n            \$('savebtn').set('disabled', false);\n        ");
        $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта работодателя.');
        return $objResponse;
    } elseif (is_emp() && $form['from'] == 'frl') {
        $objResponse->script("\n            \$('savebtn').set('disabled', false);\n        ");
        $objResponse->alert('Невозможно отправить сообщение. Вы вышли из аккаунта фрилансера.');
        return $objResponse;
    }
    //Не позволяем производить действия с заблокированным проектом
    if (projects::CheckBlocked(intval($form['prj_id']))) {
        $objResponse->script("document.location.href='/projects/index.php?pid=" . intval($form['prj_id']) . "'");
    } elseif (intval($_SESSION['uid'])) {
        $po_id = intval($form['po_id']);
        //$po_text = substr(change_q_x($form['po_text'], false), 0, 1000);
        $po_text = antispam(trim($form['po_text']));
        $po_text = preg_replace("/(\r\n|\r|\n){3,100}/i", "\r\n\r\n", $po_text);
        $po_commentid = intval($form['po_commentid']);
        $user_id = get_uid(false);
        $user = new users();
        $user_name = $user->GetName($user_id, $error);
        $pod = new projects_offers_dialogue();
        $project_dialogue = $pod->GetDialogueForOffer($po_id);
        $project = $pod->GetProjectFromDialogue($po_id);
        if (count($project_dialogue)) {
            for ($i = count($project_dialogue) - 1; $i >= 0; --$i) {
                if ($project_dialogue[$i]['user_id'] != $user_id) {
                    $to_user_name = $project_dialogue[$i]['login'];
                    break;
                }
            }
        }
        if (is_emp()) {
            $emp_read = true;
            $frl_read = false;
        } else {
            $emp_read = false;
            $frl_read = true;
        }
        if (!$po_commentid) {
            $error = $pod->AddDialogueMessage($po_id, $user_id, $po_text, $frl_read, $emp_read);
            $last_comment = $pod->GetLastDialogueMessage($user_id, $po_id);
            $objResponse->script("last_commentid={$last_comment};");
            $objResponse->script("edit_block[{$po_id}] = '&nbsp;&nbsp;<span><a href=\"javascript:void(null)\" onClick=\"answer({$po_id}, {$last_comment});markRead(\\'{$po_id}\\');\" class=\"internal\">Редактировать</a></span>';");
            //		$objResponse->script("alert(last_commentid);");
            //		$objResponse->script("alert(edit_block);");
        } else {
            $error = $pod->SaveDialogueMessage($user_id, $po_text, $po_commentid, $po_id, false);
            if ($error == 1) {
                $objResponse->alert('Вы не можете редактировать комментарий, так как на него уже ответили.');
                return $objResponse;
            }
        }
        $po_text = rtrim(ltrim($po_text, "\r\n"));
        $po_text = substr(change_q_x($po_text, false, true, '', false, false), 0, 1000);
        $po_text = stripslashes($po_text);
        if ($error == '') {
            $sPostText = $po_text;
            if ($project['kind'] != 4) {
                $sId = $po_commentid ? $po_commentid : $last_comment;
                $aComment = $pod->getDialogueMessageById($sId);
                if ($aComment['moderator_status'] === '0') {
                    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stop_words.php';
                    $stop_words = new stop_words(hasPermissions('projects'));
                    $sPostText = $stop_words->replace($sPostText);
                }
            }
            if (!$po_commentid) {
                $objResponse->append('po_dialogue_talk_' . $po_id, 'innerHTML', '<div style="margin-bottom:8px;font-size:100%;"><span class="' . (is_emp() ? 'emp' : 'frl') . 'name11"><a href="/users/' . get_login($user_id) . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['uname'] . ' ' . $user_name['usurname'] . '">' . $user_name['uname'] . ' ' . $user_name['usurname'] . '</a> [<a href="/users/' . $user_name['login'] . '/" class="' . (is_emp() ? 'emp' : 'frl') . 'name11" title="' . $user_name['login'] . '">' . $user_name['login'] . '</a>]</span> <span id="po_date_' . $last_comment . '">[' . strftime('%d.%m.%Y | %H:%M', time()) . ']</span><br /><div id="po_comment_' . $last_comment . '">' . reformat($sPostText, 50, 0, 0, 1) . '</div><div id="po_comment_original_' . $last_comment . '" style="display:none;">' . str_replace(' ', '&nbsp;', reformat($po_text, 1000, 0, 1)) . '</div></div>');
                //			$objResponse->call('resetfld', $po_id);
                $objResponse->script('dialogue_count[' . $po_id . '] = ' . (count($project_dialogue) + 1));
            } else {
                $objResponse->assign('po_comment_' . $po_commentid, 'innerHTML', reformat($sPostText, 50, 0, 0, 1));
                $objResponse->assign('po_comment_original_' . $po_commentid, 'innerHTML', str_replace(' ', '&nbsp;', reformat($po_text, 1000, 0, 1)));
                $objResponse->assign('po_date_' . $po_commentid, 'innerHTML', dateFormat('[d.m.Y | H:i]', date('Y-m-d H:i:s')));
            }
            $objResponse->call('answer', $po_id);
            if ($to_user_name && $project['id'] && $project['name'] && !$po_commentid) {
                /*require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php");
                		$smail = new smail();
                		if ($project['user_id'] == $user_id) {
                               $error = $smail->NewPrjMessageOnOfferFrl($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text);
                		} else {
                               $error = $smail->NewPrjMessageOnOfferEmp($user_name['login'], $project['id'], $project['name'], $to_user_name, $po_text);
                		}*/
            }
        } else {
            $objResponse->alert('Ошибка сохранения.');
        }
    } else {
        $objResponse->alert('Ошибка сохранения. Авторизируйтесь на сайте.');
    }
    return $objResponse;
}
Ejemplo n.º 22
0
 /**
  * Редактировать сообщение(комментарий).
  *
  * @param integer $fid      	 UID
  * @param integer $edit_id  	 ИД Сообщения
  * @param string  $msg      	 Текст Сообщения 
  * @param string  $name     	 Название сообщения(Заголовок)
  * @param string  $attach   	 Вложенные файлы
  * @param string  $ip       	 ИП пользователя создавшего сообщения 
  * @param mixed   $error    	 ОШибки
  * @param boolean $mod      	 Модификации
  * @param boolean $deleteattach  Удалить вложения
  * @param boolean $olduserlogin  Старый логин
  *
  * @return integer $thread_id    Ид темы
  */
 public function Edit($fid, $edit_id, $msg, $name, $attach, $ip, &$error, $mod = 1, $deleteattach = false, $olduserlogin = false)
 {
     global $DB;
     $curname = get_class($this);
     list($file, $alert, $error_flag) = $this->UploadFiles($attach, array('width' => 600, 'height' => 1000, 'less' => 0));
     $sql = "SELECT {$curname}.fromuser_id, {$curname}.attach, {$curname}.item_id, users.login FROM {$curname} LEFT JOIN users ON users.uid={$curname}.fromuser_id  WHERE {$curname}.id = ?i";
     $res = $DB->query($sql, $edit_id);
     list($from_id, $last_attach, $thread_id, $oldlogin) = pg_fetch_row($res);
     if ($olduserlogin) {
         $oldlogin = $olduserlogin;
     }
     if ($from_id != $fid && $mod == 1) {
         return 'Вы не можете править чужие сообщения!';
     }
     $login = get_login($fid);
     if ($last_attach && ($attach || $deleteattach)) {
         $cfile = new CFile();
         $cfile->Delete('/users/' . substr($oldlogin, 0, 2) . '/' . $oldlogin . '/upload/', $last_attach);
     }
     if (intval($attach->id) > 0 || $deleteattach) {
         $sql = "UPDATE {$curname} SET from_ip = '{$ip}', msgtext = '{$msg}', modified=NOW(), modified_id={$fid},\n                        title = '{$name}', attach = '" . ($deleteattach ? 'null' : $file['f_name']) . "', small='" . ($deleteattach ? 'null' : $file['tn']) . "' WHERE id = ?i";
     } else {
         $sql = "UPDATE {$curname} SET from_ip = '{$ip}', msgtext = '{$msg}', modified=NOW(), modified_id={$fid},\n                        title = '{$name}' WHERE id = ?i";
     }
     $res = $DB->query($sql, $edit_id);
     $error = $DB->error;
     return $thread_id;
 }
Ejemplo n.º 23
0
 /**
  * Сохраняет файл с резюме
  * @param    integer   $fid           uid фрилансера
  * @param    CFile     $resume        объект CFile с данными о файле с резюме. Если резюме уже существует, то оно будет перезаписано
  * @param    boolean   $del_resume    удалить резюме? В случае удаления новое резюме загужено не будет, в независимости от переменной $resume
  * @param    integer   $file_error    1 - если произошла ошибка при загрузке файла
  * @return   string                   возможная ошибка
  */
 function UpdateInform($fid, $resume, $del_resume, &$file_error)
 {
     // если юзер меняет файл резюме пока предыдущий еще не отмодерирован - будет история изменений
     $aChange = $GLOBALS['DB']->row("SELECT id, old_val, new_val FROM users_change WHERE user_id = ?i AND ucolumn = 'resume_file'", $fid);
     $aDelFile = array();
     // файлы которые нужно будет удалять сразу
     while (strlen($this->blocks) < $GLOBALS['blockssize']) {
         $this->blocks .= '1';
     }
     $dir = get_login($fid);
     $err = '';
     $old = $this->GetField($fid, $err, "resume_file");
     $error .= $err;
     if ($del_resume) {
         $this->resume_file = '';
     } elseif ($resume->name) {
         $resume->max_size = 5242880;
         $this->resume_file = $resume->MoveUploadedFile($dir . "/resume");
         $error .= $resume->StrError('<br />');
         if ($error) {
             $file_error = 1;
         }
     }
     if (!$error) {
         $error .= $this->Update($fid, $res);
         // определяемся какие файлы нужно удалить
         if ($del_resume == 1) {
             // удаляем файл резюме
             if ($aChange) {
                 // если хранили версии файла резюме на случай возврата - то грохаем обе
                 if ($aChange['old_val']) {
                     $aDelFile[] = $aChange['old_val'];
                 }
                 $aDelFile[] = $aChange['new_val'];
             } else {
                 // иначе просто грохаем файл резюме
                 $aDelFile[] = $old;
             }
         } elseif ($resume->name) {
             // меняем файл резюме
             if ($aChange && $aChange['new_val']) {
                 // грохаем только промежуточную версию, если была
                 $aDelFile[] = $aChange['new_val'];
             }
         }
     }
     // удаление не нужных файлов (если нет ошибок при сохранении разумеется)
     if ($aDelFile && !$error) {
         foreach ($aDelFile as $file) {
             $resume->Delete(0, "users/" . substr($dir, 0, 2) . "/" . $dir . "/resume/", $file);
         }
     }
     return $error;
 }
Ejemplo n.º 24
0
<?php

include "../../lib/start.php";
check_session();
check_permission(ADM_PERM);
header("Content-type: text/plain");
$names = array();
$sel_names = "SELECT username FROM alunni ";
try {
    $res = $db->executeQuery($sel_names);
} catch (MySQLException $ex) {
    print $ex->getMessage();
    exit;
} catch (Exception $e) {
    print $e->getMessage();
    exit;
}
while ($us = $res->fetch_assoc()) {
    array_push($names, $us['username']);
}
$res->free();
$login = get_login($names, $_POST['nome'], $_POST['cognome']);
print $login;
Ejemplo n.º 25
0
				{
					work3.innerHTML  = '<a href="/users/<?php 
    echo get_login($uid);
    ?>
/viewproj.php?prjid=' + work_id_value + '" target="_blank" class="blue" title="' + work_name_value + '"><div align="left"><img src="<?php 
    echo WDCPREFIX;
    ?>
/users/<?php 
    echo get_login($uid);
    ?>
/upload/' + work_prev_value + '" alt="" border="0"></div></a><div style="margin-top:6px; font-size:100%;"><a href="javascript:clear_work(3, ' + work_id_value + ');"><img src="/images/ico_close.gif" alt="удалить" width="9" height="9" border="0" style="margin-right: 6px" />Удалить</a></div>';
				}
				else
				{
					work3.innerHTML  = '<div align="left" style="font-size:100%;"><a href="/users/<?php 
    echo get_login($uid);
    ?>
/viewproj.php?prjid=' + work_id_value + '" target="_blank" class="blue" title="' + work_name_value + '">' + work_pict_value + '</a></div><div style="margin-top:6px; font-size:100%;"><a href="javascript:clear_work(3, ' + work_id_value + ');"><img src="/images/ico_close.gif" alt="удалить" width="9" height="9" border="0" style="margin-right: 6px" />Удалить</a></div>';
				}
			}
			work3_id.value   = work_id_value;
			work3_pict.value = work_pict_value;
			work3_prev.value = work_prev_value;
			work3_link.value = work_link_value;
			work3_name.value = work_name_value;
		}
	}
}

function dialogue_toggle(num) {
	el_top = $('toggle_dialogue_' + num);
Ejemplo n.º 26
0
    <p class="file-return"></p>
  </form>
  <div id="upload"> <img src=""/></div>



</div>


  <script type="text/javascript" src="assets/js/script.js"> </script>

<div id="preview_gallery">
<?php 
$user = $_SESSION['login'];
$posts = get_userpost($user);
foreach ($posts as $post) {
    $login = get_login($post['iduser']);
    echo "<div class='post user'>";
    echo "<a href='post.php?p=" . $post['id'] . "'> <img src='" . $post['link'] . "'/></a>";
    //echo "<span class='heure'> report content(" . $post['report'] .") </span>";
    echo "<span class='delete'><a href='model/posts.php?supp=" . $post['id'] . "'> X </a> </span>";
    echo "</div>";
}
?>
</div>

</div>
</div>

<?php 
include 'view/footer.php';
Ejemplo n.º 27
0
<?php

/*
	[Office 515158] (C) 2009-2012 天生创想 Inc.
	$Id: user_count.php 1209087 2012-01-08 08:58:28Z baiwei.jiang $
*/
define('IN_ADMIN', True);
require_once '../include/common.php';
get_login($_USER->id);
//更新在线数据到数据库中
$blog = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "online where uid='" . $_USER->id . "'  ");
if ($blog["uid"] != '') {
    $online = array('startdate' => get_date('Y-m-d H:i:s', PHP_TIME), 'enddate' => get_date('Y-m-d H:i:s', PHP_TIME + 600));
    update_db('online', $online, array('uid' => $_USER->id));
} else {
    $online = array('uid' => $_USER->id, 'startdate' => get_date('Y-m-d H:i:s', PHP_TIME), 'enddate' => get_date('Y-m-d H:i:s', PHP_TIME + 600));
    insert_db('online', $online);
}
//更新在线状态
global $db;
$query = $db->query("SELECT * FROM " . DB_TABLEPRE . "online   order by id desc");
while ($row = $db->fetch_array($query)) {
    $uid = $row['uid'];
    if ($row["enddate"] >= get_date('Y-m-d H:i:s', PHP_TIME)) {
        $user = array('online' => 1);
        update_db('user', $user, array('id' => $uid));
    } else {
        $user = array('online' => 0);
        update_db('user', $user, array('id' => $uid));
    }
}
Ejemplo n.º 28
0
 function _last_ip()
 {
     $new_vote = $this->limit;
     $query = $this->MYSQL->query("\n        SELECT realtime \n        FROM \n        \tvote_logip \n        WHERE \n        \taccname<>'" . get_login() . "'\n        AND\n        \tip='" . $this->session->userdata('ip_address') . "'\t\n        AND\n        \t" . time() . "-realtime<{$new_vote}\n        ");
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $last = time() - $row->realtime;
             if ($last >= $this->limit) {
                 return 0;
             } else {
                 return $last;
             }
         }
     } else {
         return 0;
     }
 }
Ejemplo n.º 29
0
if (isset($_POST['submit_yes'])) {
    foreach ($ids as $id) {
        delete_user(intval($id));
    }
    $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
    if (isset($_POST['ml']) && $_REQUEST['ml']) {
        header('Location: ' . AT_BASE_HREF . 'mods/_core/users/master_list.php');
    } else {
        header('Location: ' . AT_BASE_HREF . 'mods/_core/users/users.php');
    }
    exit;
} else {
    if (isset($_POST['submit_no'])) {
        $msg->addFeedback('CANCELLED');
        if (isset($_POST['ml']) && $_REQUEST['ml']) {
            header('Location: ' . AT_BASE_HREF . 'mods/_core/users/master_list.php');
        } else {
            header('Location: ' . AT_BASE_HREF . 'mods/_core/users/users.php');
        }
        exit;
    }
}
require AT_INCLUDE_PATH . 'header.inc.php';
$names = get_login($ids);
$names_html = '<ul>' . html_get_list($names) . '</ul>';
$hidden_vars['id'] = implode(',', array_keys($names));
$hidden_vars['ml'] = intval($_REQUEST['ml']);
$confirm = array('DELETE_USER', $names_html);
$msg->addConfirm($confirm, $hidden_vars);
$msg->printConfirm();
require AT_INCLUDE_PATH . 'footer.inc.php';
	require_once(AT_INCLUDE_PATH . '/classes/Message/Message.class.php');
	//global $savant;
	$msg->addConfirm("BBB_DELETE_CONFIRM"); 
	$msg->printConfirm();
}

// Set some variables

$bbb_joinURL;
$_courseId=$_SESSION['course_id'];
$_courseTiming=$_POST['course_timing'];
$_courseMessage=$_POST['course_message'];
$_moderatorPassword="******";
$_attendeePassword="******";   
$_logoutUrl= $_base_href.'mods/bigbluebutton/index_instructor.php';
$username=get_login(intval($_SESSION['member_id']));
$meetingID=$_SESSION['course_id'];
$bbb_welcome = _AT('bbb_welcome');
$salt = $_config['bbb_salt'];
$url = $_config['bbb_url']."/bigbluebutton/";

$response = BigBlueButton::createMeetingArray($username,$meetingID,$bbb_welcome,$_moderatorPassword,$_attendeePassword, $salt, $url,$_logoutUrl);

//Analyzes the bigbluebutton server's response

if(!$response){//If the server is unreachable

	$msg->addError("UNABLE_TO_CONNECT_TO_BBB");
	
}else if( $response['returncode'] == 'FAILED' ) { //The meeting was not created