本文整理汇总了PHP中smail::CorporativeBlogNewComment方法的典型用法代码示例。如果您正苦于以下问题:PHP smail::CorporativeBlogNewComment方法的具体用法?PHP smail::CorporativeBlogNewComment怎么用?PHP smail::CorporativeBlogNewComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smail
的用法示例。
在下文中一共展示了smail::CorporativeBlogNewComment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addComment
/**
* Добавление Комментария/Сообщения
*
*/
function addComment()
{
$DB = new DB('master');
if ($_SESSION['last_comment_add'] + 5 > time()) {
return false;
}
$_SESSION['last_comment_add'] = time();
/* Данные комментария */
$blog = $_POST['blogID'];
$user = get_uid();
$parent = $_POST['parent'];
$alert = array();
if (strlen($_POST['msg']) > blogs::MAX_DESC_CHARS) {
$error_flag = 1;
$alert[2] = "Максимальный размер сообщения " . blogs::MAX_DESC_CHARS . " символов!";
$msg =& $_POST['msg'];
} else {
$msg = $_POST['msg'];
$msg = preg_replace("/<ul.*>/Ui", "<ul>", $msg);
$msg = preg_replace("/<li.*>/Ui", "<li>", $msg);
$msg = change_q_x_a(antispam($msg), false, false);
}
$msg_name = substr(change_q_x(antispam($_POST['title']), true), 0, 96);
$yt_link = substr(change_q_x(antispam(str_replace('watch?v=', 'v/', $_POST['yt_link'])), true), 0, 128);
if ($yt_link != '') {
if (strpos($yt_link, 'http://ru.youtube.com/v/') !== 0 && strpos($yt_link, 'http://youtube.com/v/') !== 0 && strpos($yt_link, 'http://www.youtube.com/v/') !== 0) {
$error_flag = 1;
$alert[4] = "Неверная ссылка.";
}
}
if (is_empty_html($msg)) {
$msg = '';
}
// загрузка файлов
$attach = $_FILES['attach'];
if (is_array($attach) && sizeof($attach) <= 10) {
if (is_array($attach) && !empty($attach['name'])) {
foreach ($attach['name'] as $key => $v) {
if (!$attach['name'][$key]) {
continue;
}
$files[] = new CFile(array('name' => $attach['name'][$key], 'type' => $attach['type'][$key], 'tmp_name' => $attach['tmp_name'][$key], 'error' => $attach['error'][$key], 'size' => $attach['size'][$key]));
}
}
if ($group == 7) {
$max_image_size = array('width' => 400, 'height' => 600, 'less' => 0);
} else {
$max_image_size = array('width' => 470, 'height' => 1000, 'less' => 0);
}
list($files, $alert_, $error_flag___) = self::uploadFile($files, $max_image_size);
$error_flag = max($error_flag___, $error_flag);
if (is_array($alert_)) {
$alert = array_merge($alert, $alert_);
}
} else {
if (is_array($attach) && !empty($attach['name'])) {
$error_flag = 1;
$alert[2] = "Файлов не должно быть больше 10";
}
}
if (!$msg && !count($files)) {
$error_flag = 1;
$alert[2] = "Поле заполнено некорректно";
}
if (($msg || $files['f_name'][0]) && get_uid() && !$error_flag) {
//if($files['f_name'][0])
//error_reporting(E_ALL);
$eUser = $DB->row("SELECT email, uid FROM corporative_blog LEFT JOIN users ON users.uid = corporative_blog.id_user WHERE corporative_blog.id = ?", $parent);
$e_user = new users();
$e_user->GetUser($e_user->GetField($eUser['uid'], $ee, 'login'));
$sql = "INSERT INTO corporative_blog (title, yt_link, msg, id_blog, id_user, id_reply) VALUES(?, ?, ?, ?, ?, ?) RETURNING id;";
$res = $DB->row($sql, $msg_name, $yt_link, $msg, $blog, $user, $parent);
$idCom = $res['id'];
// $idCom = front::og("db")->select("SELECT id FROM corporative_blog WHERE title = ? AND msg = ? AND id_blog = ? AND id_user = ?", $msg_name, $msg, $blog, $user)->fetchOne();
if (substr($e_user->subscr, 2, 1) == '1' && $idCom && $eUser['uid'] != $user) {
$p_user = new users();
$p_user->GetUser($p_user->GetField($user, $ee, 'login'));
$smail = new smail();
$link = "http://free-lance.ru/about/corporative/post/{$blog}/link/{$idCom}/#c{$idCom}";
$smail->CorporativeBlogNewComment(array("title" => $msg_name, "msgtext" => $msg), $p_user, $e_user, $link);
}
if (is_array($files)) {
$asql = '';
for ($i = 0; $i < count($files['f_name']); $i++) {
if ($files['f_name'][$i]) {
$asql .= ", (currval('corporative_blog_id_seq'), '{$files['f_name'][$i]}', '{$files['tn'][$i]}')";
}
}
if ($asql) {
$asql = substr($asql, 2);
}
}
if ($asql) {
$DB->squery("INSERT INTO corporative_blog_attach(msg_id, \"name\", small) VALUES {$asql}");
}
$tags = $_POST['tags'];
//.........这里部分代码省略.........