Esempio n. 1
0
<?php

$id = generate_id();
$now = time();
$expires = $now + intval($_POST['ttl']);
$attachment = empty($_POST['attachment']) ? null : $_POST['attachment'];
$grid->db->insert('message', array('id' => $id, 'user_id' => $grid->user->id, 'content' => $params['content'], 'parent_id' => 0, 'server_id' => $grid->meta['server_id'], 'file_id' => $attachment, 'expires' => $expires, 'created' => $now, 'updated' => $now));
blink_leds($params['content']);
update_user();
if (!empty($attachment)) {
    attach_file($id, $attachment);
}
$container = get_container();
$url = empty($container) ? GRID_URL . 'forum' : GRID_URL . "c/{$container->id}";
if (!empty($container)) {
    $grid->db->update('message', array('parent_id' => "c/{$container->id}"), $id);
    $grid->db->update('container', array('updated' => $now), $container->id);
}
$this->redirect($url);
exit;
Esempio n. 2
0
}
if (!$is_member && $config[cf_formmail_is_member]) {
    alert_close("회원만 이용하실 수 있습니다.");
}
$to = base64_decode($to);
if (substr_count($to, "@") > 1) {
    alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.');
}
$key = get_session("captcha_keystring");
if (!($key && $key == $_POST[wr_key])) {
    session_unregister("captcha_keystring");
    alert("정상적인 접근이 아닌것 같습니다.");
}
for ($i = 1; $i <= $attach; $i++) {
    if ($_FILES["file" . $i][name]) {
        $file[] = attach_file($_FILES["file" . $i][name], $_FILES["file" . $i][tmp_name]);
    }
}
$content = stripslashes($content);
if ($type == 2) {
    $type = 1;
    $content = preg_replace("/\n/", "<br>", $content);
}
// html 이면
if ($type) {
    $current_url = $g4[url];
    $mail_content = "<html><head><meta http-equiv='content-type' content='text/html; charset={$g4['charset']}'><title>메일보내기</title><link rel='stylesheet' href='{$current_url}/style.css' type='text/css'></head><body>{$content}</body></html>";
} else {
    $mail_content = $content;
}
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file);
Esempio n. 3
0
    alert('환경설정에서 "메일발송 사용"에 체크하셔야 메일을 발송할 수 있습니다.\\n\\n관리자에게 문의하시기 바랍니다.');
}
if (!$is_member && $config['cf_formmail_is_member']) {
    alert_close('회원만 이용하실 수 있습니다.');
}
$to = base64_decode($to);
if (substr_count($to, "@") > 1) {
    alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.');
}
if (!chk_captcha()) {
    alert('자동등록방지 숫자가 틀렸습니다.');
}
$file = array();
for ($i = 1; $i <= $attach; $i++) {
    if ($_FILES['file' . $i]['name']) {
        $file[] = attach_file($_FILES['file' . $i]['name'], $_FILES['file' . $i]['tmp_name']);
    }
}
$content = stripslashes($content);
if ($type == 2) {
    $type = 1;
    $content = str_replace("\n", "<br>", $content);
}
// html 이면
if ($type) {
    $current_url = G5_URL;
    $mail_content = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>메일보내기</title><link rel="stylesheet" href="' . $current_url . '/style.css"></head><body>' . $content . '</body></html>';
} else {
    $mail_content = $content;
}
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file);
Esempio n. 4
0
function check_for_import_content()
{
    global $grid;
    if (!file_exists(GRID_DIR . '/import')) {
        return;
    }
    setup_user();
    $dh = opendir(GRID_DIR . '/import');
    $now = time();
    $expires = $now + 31536000;
    while ($filename = readdir($dh)) {
        if (substr($filename, 0, 1) == '.') {
            continue;
        }
        $message_id = generate_id();
        $file_id = generate_id();
        $created = $now;
        if (substr($filename, -5, 5) == '.html') {
            $html = file_get_contents(GRID_DIR . "/import/{$filename}");
            if (preg_match('#<title>(.+)</title>#', $html, $matches)) {
                list(, $content) = $matches;
            } else {
                $content = preg_replace('#\\.\\w+$#', '', $filename);
            }
            if (preg_match('#var meta = (.+?);#', $html, $matches)) {
                list(, $meta) = $matches;
                $meta = json_decode($meta);
                if (!empty($meta->date_published)) {
                    $date_published = strtotime($meta->date_published);
                    if (!empty($date_published)) {
                        $created = $date_published;
                    }
                }
            }
        } else {
            $content = preg_replace('#\\.\\w+$#', '', $filename);
        }
        $grid->db->insert('message', array('id' => $message_id, 'user_id' => $grid->user->id, 'content' => $content, 'parent_id' => 'c/library', 'server_id' => $grid->meta['server_id'], 'file_id' => $file_id, 'expires' => $expires, 'created' => $created, 'updated' => $now));
        $path = "../import/{$filename}";
        $grid->db->insert('file', array('id' => $file_id, 'user_id' => $grid->user->id, 'server_id' => $grid->meta['server_id'], 'name' => $filename, 'path' => $path, 'created' => $now, 'updated' => $now));
        attach_file($message_id, $file_id);
    }
}
    /*$dimens = getimagesize($temp);
      if($dimens[0] != $dimens[1]){
          echo "<p>Image Dimensions should match.Photo is not updated.</p>";
          return false;
      }*/
    $name = $code . "_" . $num;
    $target = $name . $extn;
    $upload_dir = "./uploads";
    if (move_uploaded_file($temp, $upload_dir . "/" . $target)) {
        $out['error'] = "No errors!!";
        $out['status'] = "success";
        $out['link'] = $link . "?code=" . $code . "&num=" . $num;
        return $out;
    }
    $out['error'] = "Upload failed. Unknown Reason.";
    $out['status'] = "fail";
    return $out;
}
$out = [];
if (isset($_POST['code']) && isset($_POST['picnum'])) {
    $code = clean($_POST['code']);
    $num = clean($_POST['picnum']);
    $out = attach_file($_FILES['file_upload'], $code, $num);
} else {
    $out['error'] = "Failed.";
    $out['status'] = "fail";
}
echo json_encode($out);
?>