示例#1
0
                $third = $thirdAccount->getByType($type_arr[0], $type_arr[1]);
                $api = Factory::CreateAPI2($type_arr[0], $type_arr[1], $third);
                $ret = $api->publish($_POST['title'], $content);
                if ($ret !== true && str_contains($ret, '已过期')) {
                    $thirdAccount->fail($third, $ret);
                }
                $TEMPLATE['report'][$type] = array('status' => $ret === true, 'msg' => $ret === true ? '发送成功!' . ($third['url'] ? '<a href="' . $third['url'] . '" target="_blank">查看</a>' : '') : '发送失败:' . $ret . ' <a href="list_err.php">重新发送</a>');
                $task->AddTask($type, $content, time(), NULL, $ret === true ? Task::OK : Task::ERROR, $ret, 'blog', $_POST['title']);
            }
            $watch->Stop();
            $TEMPLATE['report']['watch'] = array('status' => true, 'msg' => "总耗时:{$watch->getElapsedSeconds()} 秒");
        }
    }
}
$TEMPLATE['title'] = '发博客';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['blog'] = 'current';
$TEMPLATE['target_list'] = $wt_open->getBlogList();
$TEMPLATE['platform_list'] = $wt_open->getPlatformList();
foreach ($TEMPLATE['platform_list'] as &$item) {
    $item['list'] = $wt_open->getBlogList($item['id']);
    unset($item);
}
$smarty = new Template();
echo $smarty->r('blog');
function validate()
{
    global $TEMPLATE;
    $check = true;
    if (strlen($_POST['title']) == 0 || strlen($_POST['content']) == 0) {
        $TEMPLATE['report']['check_cont'] = array('status' => false, 'msg' => '标题和内容均不能为空!');