/**
 * 格式化表单校验消息,并进行json数组化预处理
 *
 * @param  array $messages 未格式化之前数组
 * @param array $json 原始json数组数据
 * @return array
 */
function format_json_message($messages, $json)
{
    $reason = format_message($messages);
    $info = '失败原因为:' . $reason;
    $json = array_replace($json, ['info' => $info]);
    return $json;
}
Example #2
0
 /**
  * Parses the comments for display with the template
  * @param string &$comment_text Comment message text
  * @param string &$comment_author Name of the comment's author
  * @param string $comment_email Email address of the author
  */
 function parse_comments(&$comment_text, &$comment_author, $comment_email)
 {
     global $cbwordwrap, $wwwidth, $bbc, $htc, $wfcom, $comallowbr, $smilcom;
     $comment_text = str_replace('&br;', $comallowbr ? '<br />' : '', $comment_text);
     $comment_text = format_message($comment_text, $htc, $bbc, $smilcom, $wfcom);
     if (!empty($comment_email)) {
         $comment_author = '<a href="mailto:' . $comment_email . '">' . $comment_author . '</a>';
     }
 }
Example #3
0
$r = fetch_queue($NICKNAME, $window, TRUE);
foreach ($r as $row) {
    out(format_message($row));
    if ($row['type'] == 'quit') {
        print "Connection closed: " . $row['data'];
        exit;
    }
}
while (!$quit) {
    $r = fetch_queue($NICKNAME, $window, FALSE, 0);
    foreach ($r as $row) {
        if ($row['type'] == 'quit') {
            out("Connection closed: " . $row['data']);
            $quit = TRUE;
        }
        out(format_message($row));
    }
    //$quit = TRUE;
    usleep(1000000);
}
print "<br /><a href='" . purlencode($PHP_SELF) . "'>Refresh</a>\n";
function format_message($row)
{
    $msg = irc_split_message($row['data']);
    extract($msg);
    switch ($command) {
        case 'PRIVMSG':
            if ($message[0] == "") {
                $o = "* " . format_nick($origin) . " " . str_replace("ACTION", '', $message);
            } else {
                $o = "&lt;" . format_nick($origin) . "&gt; {$message}";
Example #4
0
 /**
  * Returns error messages for last validation as a single string.
  *
  * @static
  * @return string
  */
 public function getLastValidationMessages()
 {
     if (!empty($this->_lastValidationErrorMessages)) {
         $messages = $this->_lastValidationErrorMessages;
         $this->_lastValidationErrorMessages = array();
         return format_message($messages);
     } else {
         return '';
     }
 }
Example #5
0
/**
 * Check correction of input data
 * @param EasySCP_TemplateEngine $tpl
 */
function check_data_iscorrect($tpl)
{
    global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup;
    global $hpid;
    global $price, $setup_fee;
    global $hp_backup, $hp_dns;
    $ahp_error = array();
    $hp_name = clean_input($_POST['hp_name']);
    $hp_sub = clean_input($_POST['hp_sub']);
    $hp_als = clean_input($_POST['hp_als']);
    $hp_mail = clean_input($_POST['hp_mail']);
    $hp_ftp = clean_input($_POST['hp_ftp']);
    $hp_sql_db = clean_input($_POST['hp_sql_db']);
    $hp_sql_user = clean_input($_POST['hp_sql_user']);
    $hp_traff = clean_input($_POST['hp_traff']);
    $hp_disk = clean_input($_POST['hp_disk']);
    $price = clean_input($_POST['hp_price']);
    $setup_fee = clean_input($_POST['hp_setupfee']);
    if (isset($_SESSION['hpid'])) {
        $hpid = $_SESSION['hpid'];
    } else {
        $ahp_error[] = tr('Undefined reference to data!');
    }
    // put hosting plan id into session value
    $_SESSION['hpid'] = $hpid;
    // Get values from previous page and check him correction
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ahp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ahp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ahp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ahp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ahp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_db == -1 && $hp_sql_user != -1) {
            $ahp_error[] = tr('SQL databases limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ahp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ahp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ahp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ahp_error[] = tr('Incorrect disk quota limit!');
    }
    if (!is_numeric($price)) {
        $ahp_error[] = tr('Price must be a number!');
    }
    if (!is_numeric($setup_fee)) {
        $ahp_error[] = tr('Setup fee must be a number!');
    }
    if (empty($ahp_error)) {
        return true;
    } else {
        set_page_message(format_message($ahp_error), 'error');
        return false;
    }
}
Example #6
0
echo SITE_TITLE . ' - ' . __('Qchan Image Hosting');
?>
</title>
	
	<link rel="stylesheet" type="text/css" href="<?php 
echo get_url() . theme_path();
?>
style.css">
	<link rel="icon" type="image/png" href="<?php 
echo get_url();
?>
site-img/favicon.png">
	
	<script type="application/javascript">
		ui_msg = <?php 
echo format_message();
?>
;
		// Some parameters
		prop = {
			size_limit: <?php 
echo get_size_limit();
?>
,
			upload_count: <?php 
echo get_upload_count();
?>
,
			error_image: '<?php 
echo theme_path();
?>
Example #7
0
/**
 * Check validity of input data
 */
function check_user_data()
{
    global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup, $hp_dmn, $hp_backup, $hp_dns;
    //$sql = EasySCP_Registry::get('Db');
    $ehp_error = array();
    // Get data for fields from previous page
    if (isset($_POST['template'])) {
        $hp_name = $_POST['template'];
    }
    if (isset($_POST['nreseller_max_domain_cnt'])) {
        $hp_dmn = clean_input($_POST['nreseller_max_domain_cnt']);
    }
    if (isset($_POST['nreseller_max_subdomain_cnt'])) {
        $hp_sub = clean_input($_POST['nreseller_max_subdomain_cnt']);
    }
    if (isset($_POST['nreseller_max_alias_cnt'])) {
        $hp_als = clean_input($_POST['nreseller_max_alias_cnt']);
    }
    if (isset($_POST['nreseller_max_mail_cnt'])) {
        $hp_mail = clean_input($_POST['nreseller_max_mail_cnt']);
    }
    if (isset($_POST['nreseller_max_ftp_cnt']) || $hp_ftp == -1) {
        $hp_ftp = clean_input($_POST['nreseller_max_ftp_cnt']);
    }
    if (isset($_POST['nreseller_max_sql_db_cnt'])) {
        $hp_sql_db = clean_input($_POST['nreseller_max_sql_db_cnt']);
    }
    if (isset($_POST['nreseller_max_sql_user_cnt'])) {
        $hp_sql_user = clean_input($_POST['nreseller_max_sql_user_cnt']);
    }
    if (isset($_POST['nreseller_max_traffic'])) {
        $hp_traff = clean_input($_POST['nreseller_max_traffic']);
    }
    if (isset($_POST['nreseller_max_disk'])) {
        $hp_disk = clean_input($_POST['nreseller_max_disk']);
    }
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    // Begin checking...
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ehp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ehp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ehp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ehp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ehp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user != -1 && $hp_sql_db == -1) {
            $ehp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ehp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ehp_error[] = tr('SQL databases limit is not <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ehp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ehp_error[] = tr('Incorrect disk quota limit!');
    }
    if (empty($ehp_error) && empty($_SESSION['user_page_message'])) {
        // send data through session
        return true;
    } else {
        set_page_message(format_message($ehp_error), 'error');
        return false;
    }
}
Example #8
0
        $empty = 1;
        // 1 for no tweet to display
    } else {
        $empty = $t->http_code == 429 ? 2 : 0;
    }
}
if ($empty == 1) {
    echo "<div id=\"empty\">No message to display.</div>";
} else {
    if ($empty == 2) {
        echo "<div id=\"empty\">API quota is used out, please wait for a moment before next refresh.</div>";
    } else {
        include 'lib/timeline_format.php';
        $output = '<ol class="timeline" id="allMessage">';
        foreach ($messages as $message) {
            $output .= format_message($message, $isSentPage);
        }
        $output .= "</ol><div id=\"pagination\">";
        $firstmsg = $messages[0]->id_str;
        $lastmsg = bcsub($messages[count($messages) - 1]->id_str, "1");
        if ($isSentPage) {
            $output .= "<a id=\"less\" class=\"btn btn-white\" style=\"float: left;\" href=\"message.php?t=sent&since_id=" . $firstmsg . "\">Back</a>";
            $output .= "<a id=\"more\" class=\"btn btn-white\" style=\"float: right;\" href=\"message.php?t=sent&max_id=" . $lastmsg . "\">Next</a>";
        } else {
            $output .= "<a id=\"less\" class=\"btn btn-white\" style=\"float: left;\" href=\"message.php?since_id=" . $firstmsg . "\">Back</a>";
            $output .= "<a id=\"more\" class=\"btn btn-white\" style=\"float: right;\" href=\"message.php?max_id=" . $lastmsg . "\">Next</a>";
        }
        $output .= "</div>";
        echo $output;
    }
}
Example #9
0
     // We're not looking for this author
     continue;
 }
 // Check if the file exists last as this takes the largest chunk of time.
 if (!file_exists(FNEWS_ROOT_PATH . 'news/news.' . $toc['news_id'] . '.php')) {
     continue;
 }
 $result = 0;
 $news_file = file(FNEWS_ROOT_PATH . 'news/news.' . $toc['news_id'] . '.php');
 $article = get_line_data('news', $news_file[1]);
 $shortnews = $article['shortnews'];
 $fullnews = $article['fullnews'];
 $shortnews = str_replace('&br;', '<br />', $shortnews);
 $fullnews = str_replace('&br;', '<br />', $fullnews);
 $shortnews = format_message($shortnews, false, $bb, $smilies, $wfpost, true);
 $fullnews = format_message($fullnews, false, $bb, $smilies, $wfpost, true);
 // Check if current post is:
 // - Included in the list of categories selected
 // - After the requested date
 // - Created by the correct author
 if (preg_match_all($regex, $shortnews, $m)) {
     ++$result;
 }
 if (preg_match_all($regex, $fullnews, $n)) {
     ++$result;
 }
 if (preg_match_all($regex, $toc['headline'], $o)) {
     ++$result;
 }
 if (preg_match_all($regex, $article['description'], $p)) {
     ++$result;
Example #10
0
/**
 * Parses news text or news data so that it is displayed along with its template.
 * @param string|array $news_string News text to parse, or the array from the required news file.
 * @param array $settings Override settings when parsing.
 * @return Parsed news text
 */
function parse_news_to_view($news_string, $settings = array())
{
    assert(is_array($settings));
    global $fsnw, $wfpost, $ht, $smilies, $bb, $stfpop, $compop, $furl, $fullnewsh, $fullnewsw, $fullnewss, $fullnewsz, $fslink, $datefor, $stflink, $stfheight, $stfwidth, $stfscrolls, $stfresize, $pclink, $datefor, $link_headline_fullstory, $hurl, $comheight, $comwidth, $comscrolls, $comresize;
    $news_text = array();
    if (!empty($news_string)) {
        $icon = '';
        $email = '';
        $writer = '';
        $link_full_news = '';
        $link_comments = '';
        $link_tell_friend = '';
        $article = $news_string;
        if (!is_array($news_string)) {
            $article = get_line_data('news', $news_string);
        }
        // Get the template HTML
        $news_tmpl = get_template((isset($settings['template']) ? $settings['template'] : 'news_temp') . '.php', false);
        $other_qs = clean_query_string();
        $news_url = isset($settings['news_url']) ? $settings['news_url'] : '';
        $sep = strpos($news_url, '?') === false ? '?' : '&amp;';
        // Create the 'read more...' link
        if ($article['fullnews'] != '') {
            if ($fsnw) {
                $link_full_news = '<a href="' . $furl . '/fullnews.php?fn_id=' . $article['news_id'] . '" onclick="window.open(this.href,\'\',\'height=' . $fullnewsh . ',width=' . $fullnewsw . ',toolbar=no,menubar=no,scrollbars=' . $fullnewss . ',resizable=' . $fullnewsz . '\'); return false">' . $fslink . '</a>';
            } else {
                $link_full_news = '<a href="' . $news_url . $sep . 'fn_mode=fullnews&amp;fn_id=' . $article['news_id'] . $other_qs . '">' . $fslink . '</a>';
            }
        }
        // Create the comments link
        if ($compop) {
            $link_comments = '<a href="' . $furl . '/comments.php?fn_id=' . $article['news_id'] . '" onclick="window.open(this.href,\'\',\'height=' . $comheight . ',width=' . $comwidth . ',toolbar=no,menubar=no,scrollbars=' . $comscrolls . ',resizable=' . $comresize . '\'); return false">' . $pclink . '</a>';
        } else {
            $link_comments = '<a href="' . $news_url . $sep . 'fn_mode=comments&amp;fn_id=' . $article['news_id'] . $other_qs . '">' . $pclink . '</a>';
        }
        // Create the tell a friend link
        if ($stfpop) {
            $link_tell_friend = '<a href="' . $furl . '/send.php?fn_id=' . $article['news_id'] . '" onclick="window.open(this.href,\'\',\'height=' . $stfheight . ',width=' . $stfwidth . ',toolbar=no,menubar=no,scrollbars=' . $stfscrolls . ',resizable=' . $stfresize . '\'); return false">' . $stflink . '</a>';
        } else {
            $link_tell_friend = '<a href="' . $news_url . $sep . 'fn_mode=send&amp;fn_id=' . $article['news_id'] . $other_qs . '">' . $stflink . '</a>';
        }
        // Make sure the number of comments is 0 or above.
        $num_comments = max((int) $article['numcomments'], 0);
        // Get author information
        $author = get_author($article['author']);
        if ($author === false) {
            $author = array('showemail' => false, 'nick' => $article['author']);
        }
        // Create the icon
        if (strpos($news_tmpl, '{icon}') !== false && !empty($author['icon'])) {
            $icon = '<img src="' . $author['icon'] . '" alt="" />';
        }
        // Put the writer's name with his email as a link, or in some cases not.
        $email = $author['showemail'] ? $author['email'] : '';
        if (!$email) {
            $writer = $author['nick'];
        } else {
            $writer = '<a href="mailto:' . $author['email'] . '">' . $author['nick'] . '</a>';
        }
        // Get our new lines back
        $article['shortnews'] = str_replace('&br;', $ht ? '' : '<br />', $article['shortnews']);
        $article['fullnews'] = str_replace('&br;', $ht ? '' : '<br />', $article['fullnews']);
        $article['headline'] = format_message($article['headline'], $ht, $bb, $smilies, $wfpost);
        $article['shortnews'] = format_message($article['shortnews'], $ht, $bb, $smilies, $wfpost);
        $article['fullnews'] = format_message($article['fullnews'], $ht, $bb, $smilies, $wfpost);
        $file = file(FNEWS_ROOT_PATH . 'categories.php');
        array_shift($file);
        $categories = explode(',', $article['categories']);
        $cat_icon = '';
        $cat_id = 0;
        $cat_name = '';
        $category_filter = isset($settings['category']) ? $settings['category'] : array();
        $num_category_filter = sizeof($category_filter);
        foreach ($file as $category) {
            $category = get_line_data('categories', $category);
            if ($num_category_filter > 0 && in_array($category['category_id'], $category_filter) || $num_category_filter == 0 && in_array($category['category_id'], $categories)) {
                $cat_icon = $category['icon'] != '' ? '<img src="' . $category['icon'] . '" alt="" />' : '';
                $cat_id = $category['category_id'];
                $cat_name = $category['name'];
                break;
            }
        }
        $news_text = array('post_id' => $article['news_id'], 'link_tell_friend' => $link_tell_friend, 'link_full_news' => $link_full_news, 'subject' => $article['headline'], 'description' => $article['description'], 'writer' => $writer, 'email' => $email, 'date' => date($datefor, (int) $article['timestamp']), 'icon' => $icon, 'news' => $article['shortnews'], 'fullnews' => $article['fullnews'], 'cat_icon' => $cat_icon, 'cat_id' => $cat_id, 'cat_name' => $cat_name);
        if (strpos($news_tmpl, '{comments}') !== false) {
            $news_text += array('nrc' => $num_comments, 'link_comments' => $link_comments);
        } else {
            $news_text += array('nrc' => '', 'link_comments' => '');
        }
        // Replace in the values!
        $news_tmpl = replace_masks($news_tmpl, array('post_id' => $news_text['post_id'], 'user' => $news_text['writer'], 'date' => $news_text['date'], 'icon' => $news_text['icon'], 'send' => $news_text['link_tell_friend'], 'nrc' => $news_text['nrc'], 'cat_id' => $news_text['cat_id'], 'cat_name' => $news_text['cat_name'], 'cat_icon' => $news_text['cat_icon'], 'fullstory' => $news_text['link_full_news'], 'comments' => $news_text['link_comments'], 'subject' => '<a id="fus_' . $news_text['post_id'] . '"></a>' . $news_text['subject'], 'news' => $news_text['news'], 'description' => $news_text['description']));
        $news_text += array('display' => $news_tmpl);
    }
    return $news_text;
}
Example #11
0
\t\t\t\t\t\t<th style="width:20%">{$ind96}</th>
\t\t\t\t\t\t<th style="width:5%">{$ind278}</th>
\t\t\t\t\t</tr>
html;
                                                                                                                                $file = file(FNEWS_ROOT_PATH . 'news/news.' . $rand . '.php');
                                                                                                                                array_shift($file);
                                                                                                                                array_shift($file);
                                                                                                                                $found = false;
                                                                                                                                foreach ($file as $value) {
                                                                                                                                    $comment = get_line_data('comments', $value);
                                                                                                                                    if (!$comment['validated']) {
                                                                                                                                        continue;
                                                                                                                                    }
                                                                                                                                    $com_datum = date('Y-m-d H:i:s T', $comment['timestamp']);
                                                                                                                                    $com_post = str_replace('&br;', $comallowbr ? '<br />' : '', $comment['message']);
                                                                                                                                    $com_post = format_message($com_post, $htc, $bbc, $smilcom, $wfcom);
                                                                                                                                    $ban_text = is_ip_banned($comment['ip']) ? $ind396 : '';
                                                                                                                                    echo <<<html
\t<tr>
\t\t<td style="text-align:center">
\t\t\t<input type="checkbox" class="post" id="delpost_{$comment['comment_id']}" name="delpost[{$comment['comment_id']}]" value="{$comment['comment_id']}" onclick="check_if_selected ('comments');">
\t\t</td>
\t\t<td>{$com_post}</td>
\t\t<td>
\t\t\t{$comment['author']}<br />
\t\t\t<b>{$comment['ip']}</b> {$ban_text}
\t\t</td>
\t\t<td>{$com_datum}</td>
\t\t<td style="text-align:center">
\t\t\t[<a href="?id=editcomment&amp;comment_id={$comment['comment_id']}&amp;news_id={$rand}">{$ind30b}</a>]
\t\t</td>
Example #12
0
function make_popup_list($result)
{
    $conf_popup_task = $result['popup-task'];
    $conf_users = $result['users'];
    $conf_messages = $result['messages'];
    $conf_keywords = $result['keywords'];
    $conf_positions = $result['positions'];
    $result = array();
    foreach ($conf_popup_task as $name => $task) {
        $target_users = @$task['目标人群'];
        $target_messages = @$task['消息集合'];
        if (empty($target_messages)) {
            continue;
        }
        $new_target = get_user_selected($conf_users, $target_users);
        $pick_message = get_user_selected($conf_messages, $target_messages);
        foreach ($pick_message as $name => $msg) {
            if ($msg['消息形式'] === '弹出显示') {
                continue;
            }
            unset($pick_message[$name]);
        }
        $task['目标人群'] = format_targets($new_target, $conf_keywords);
        $task['消息集合'] = format_message($pick_message, $conf_positions);
        $task['运行状态'] = task_status($task['运行状态']);
        $task['消息样式'] = pop_style($task['消息样式']);
        $task['开始时间'] = trans_time($task['开始时间']);
        $task['结束时间'] = trans_time($task['结束时间']);
        $task['执行次数'] = intval($task['执行次数']);
        $task['间隔模式'] = internal_mode($task['间隔模式']);
        $task['每次间隔'] = intval($task['每次间隔']);
        $task['前距时间'] = intval($task['前距时间']);
        $task['消息顺序'] = pop_sequence($task['消息顺序']);
        $task['任务互斥'] = pop_repel($task['任务互斥']);
        $result[$name] = $task;
    }
    return $result;
}
Example #13
0
        }
        $output .= "</ol>";
        echo $output;
    }
}
$messages = $t->directMessages();
if ($messages === false) {
    header('location: error.php?code=' . $t->http_code);
    exit;
}
$empty = count($messages) == 0 ? true : false;
if ($empty) {
    echo "<div id=\"empty\">No tweet to display</div>";
} else {
    if ($t->http_code == 429) {
        echo "<div id=\"empty\">API quota is used out, please wait for a moment before next refresh.</div>";
    } else {
        $output = '<ol class="timeline" id="allMessage">';
        foreach ($messages as $message) {
            $output .= format_message($message);
        }
        $output .= "</ol>";
        echo $output;
    }
}
?>
</div>

<?php 
include 'inc/sidebar.php';
include 'inc/footer.php';
Example #14
0
    $auth = iMSCP_Authentication::getInstance();
    switch ($_REQUEST['action']) {
        case 'logout':
            if ($auth->hasIdentity()) {
                $adminName = $auth->getIdentity()->admin_name;
                $auth->unsetIdentity();
                set_page_message(tr('You have been successfully logged out.'), 'success');
                write_log(sprintf("%s logged out", decode_idna($adminName)), E_USER_NOTICE);
            }
            break;
        case 'login':
            $authResult = $auth->authenticate();
            if ($authResult->isValid()) {
                write_log(sprintf("%s logged in", $authResult->getIdentity()->admin_name), E_USER_NOTICE);
            } elseif ($messages = $authResult->getMessages()) {
                $messages = format_message($messages);
                set_page_message($messages, 'error');
                write_log(sprintf("Authentication failed. Reason: %s", $messages), E_USER_NOTICE);
            }
    }
}
redirectToUiLevel();
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/simple.tpl', 'page_message' => 'layout', 'lostpwd_button' => 'page'));
$tpl->assign(array('productLongName' => tr('internet Multi Server Control Panel'), 'productLink' => 'http://www.i-mscp.net', 'productCopyright' => tr('© 2010-2015 i-MSCP Team<br/>All Rights Reserved')));
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if ($cfg['MAINTENANCEMODE'] && !isset($_GET['admin'])) {
    $tpl->define_dynamic('page', 'message.tpl');
    $tpl->assign(array('TR_PAGE_TITLE' => tr('i-MSCP - Multi Server Control Panel / Maintenance'), 'HEADER_BLOCK' => '', 'BOX_MESSAGE_TITLE' => tr('System under maintenance'), 'BOX_MESSAGE' => isset($cfg['MAINTENANCEMODE_MESSAGE']) ? preg_replace('/\\s\\s+/', '', nl2br(tohtml($cfg['MAINTENANCEMODE_MESSAGE']))) : tr("We are sorry, but the system is currently under maintenance.\nPlease try again later."), 'TR_BACK' => tr('Administrator login'), 'BACK_BUTTON_DESTINATION' => '/index.php?admin=1'));
} else {
Example #15
0
/**
 * Check correction of input data
 * @param EasySCP_TemplateEngine $tpl
 */
function check_data_correction($tpl)
{
    global $hp_name, $description, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup;
    global $price, $setup_fee, $value, $payment, $status;
    global $hp_backup, $hp_dns;
    global $tos;
    $ahp_error = array();
    $hp_name = clean_input($_POST['hp_name']);
    $hp_sub = clean_input($_POST['hp_sub']);
    $hp_als = clean_input($_POST['hp_als']);
    $hp_mail = clean_input($_POST['hp_mail']);
    $hp_ftp = clean_input($_POST['hp_ftp']);
    $hp_sql_db = clean_input($_POST['hp_sql_db']);
    $hp_sql_user = clean_input($_POST['hp_sql_user']);
    $hp_traff = clean_input($_POST['hp_traff']);
    $hp_disk = clean_input($_POST['hp_disk']);
    $value = clean_input($_POST['hp_value']);
    $payment = clean_input($_POST['hp_payment']);
    $status = $_POST['status'];
    $description = clean_input($_POST['hp_description']);
    $tos = clean_input($_POST['hp_tos']);
    if (empty($_POST['hp_price'])) {
        $price = 0;
    } else {
        $price = clean_input($_POST['hp_price']);
    }
    if (empty($_POST['hp_setupfee'])) {
        $setup_fee = 0;
    } else {
        $setup_fee = clean_input($_POST['hp_setupfee']);
    }
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    if ($hp_name == '') {
        $ahp_error[] = tr('Incorrect template name length!');
    }
    if ($description == '') {
        $ahp_error[] = tr('Incorrect template description length!');
    }
    if (!is_numeric($price)) {
        $ahp_error[] = tr('Price must be a number!');
    }
    if (!is_numeric($setup_fee)) {
        $ahp_error[] = tr('Setup fee must be a number!');
    }
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ahp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ahp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ahp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ahp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ahp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_user != -1 && $hp_sql_db == -1) {
            $ahp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ahp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ahp_error[] = tr('SQL databases limit is not <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ahp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ahp_error[] = tr('Incorrect disk quota limit!');
    }
    if (empty($ahp_error)) {
        return true;
    } else {
        set_page_message(format_message($ahp_error), 'error');
        return false;
    }
}