本文整理汇总了PHP中TPL::message方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::message方法的具体用法?PHP TPL::message怎么用?PHP TPL::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::message方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
if (isset($_GET['do'])) {
switch ($_GET['do']) {
case "general":
TPL::render("v_settings/settings_general");
break;
case "security":
TPL::render("v_settings/settings_security");
break;
case "seo":
TPL::render("v_settings/settings_seo");
break;
case "maintenance":
if (isset($_POST['save_changes'])) {
OPTIONS::set("website", "maintenance_mode", $_POST['maintenance_mode']);
TPL::message("Actualizarile au fost efectuate cu succes.", "success");
}
TPL::assign("maintenance_mode", OPTIONS::website("maintenance_mode"));
TPL::render("v_settings/settings_maintenance");
break;
case "backend":
if (isset($_POST['new_background'])) {
// change image
$new_image = replace_cards($_POST['new_background'], array(), true);
OPTIONS::set('admin', 'background', $new_image, USER::get('id'));
// return result
die('ok');
}
if (isset($_POST['new_color'])) {
// change color scheme
$color_scheme = substr(substr($_POST['new_color'], 5), 0, -1);
示例2: redirect
// check if already logged
if (USER::is_logged()) {
redirect(LINKS::get("admin_home"));
}
// check if sent data
if (isset($_POST['username'], $_POST['password'])) {
if (USER::login($_POST['username'], $_POST['password'])) {
TPL::message("Perfect! You'll be redirected in 2 seconds..", "success");
redirect(isset($_GET['redirect']) ? urldecode($_GET['redirect']) : LINKS::get("admin_home"), 2);
} else {
switch (LOGS::get_error()['log_text']) {
case "wrong_username":
TPL::message("You entered a wrong username..");
break;
case "wrong_password":
TPL::message("You entered a wrong password..");
break;
}
}
}
// set render
TPL::render("v_login/login");
break;
/*
* logout user
*/
/*
* logout user
*/
case "logout":
// sign out user
示例3: implode
}
}
if (CONTENT::get("content_attachment") != '') {
$produs_attash = CONTENT::get("content_attachment") . "," . implode(",", $produs_attash);
} else {
$produs_attash = implode(",", $produs_attash);
}
// create text
$produs_text = array("caracteristici" => $produs_caracteristici, "descriere" => $produs_descriere);
// create produs
$produs = array("content_title" => $produs_denumire, "content_text" => json_encode($produs_text), "content_slug" => $produs_slug, "content_attachment" => $produs_attash);
// update
if (CONTENT::set_content($produs, CONTENT::get("content_id"))) {
TPL::message("Actualizarile au fost efectuate cu success.", "success");
} else {
TPL::message("S-au intampinat niste erori. Va rugam reincercati!");
}
// update content
CONTENT::get_content(CONTENT::get("content_id"));
}
CONTENT::$current['content_text'] = object2array(json_decode(CONTENT::$current['content_text']));
if (isset(CONTENT::$current['content_text']['caracteristici'])) {
CONTENT::$current['content_text']['caracteristici'] = stripslashes(implode("\r\n", CONTENT::$current['content_text']['caracteristici']));
} else {
CONTENT::$current['content_text']['caracteristici'] = '';
}
if (!isset(CONTENT::$current['content_text']['descriere'])) {
CONTENT::$current['content_text']['descriere'] = '';
} else {
CONTENT::$current['content_text']['descriere'] = stripslashes(CONTENT::$current['content_text']['descriere']);
}
示例4: str_replace
*/
case "templates_list":
TPL::assign("templates_list", DRAWLINE::templates_list());
TPL::render('v_design/templates_list');
break;
/*
* install a template
*/
/*
* install a template
*/
case "template_install":
if (isset($_GET['package'])) {
$package = str_replace(array("/", ".."), "", $_GET['package']);
if (file_exists(FOLDER_EXTENDER . "templates" . DS . $package . DS . "index.php")) {
if (OPTIONS::set("website", "frontend_template", $package)) {
TPL::message("The template was changed successfuly.", "success");
} else {
TPL::message("We encounted an error. Please try again!");
}
} else {
TPL::message("I can't find this template on the server.");
}
} else {
redirect(ADMIN_URL);
}
TPL::assign("templates_list", DRAWLINE::templates_list());
TPL::render('v_design/templates_list');
break;
}
}
示例5: array
TPL::message("Please don't provide a blank name for this group.");
}
// if no errors - try to insert in database
if (empty(TPL::get_messages('error'))) {
$upd = $db->query(" UPDATE dl_users_groups \n SET group_name = '" . $group_name . "',\n group_permissions = '" . $p_list . "'\n WHERE group_id = '" . $group_id . "'");
// on error
if (!$upd) {
// write to logs [fail]
// show message
TPL::message("There is a problem. Please try again.");
}
}
// if no errors - success message
if (empty(TPL::get_messages('error'))) {
// show success message
TPL::message("Changes to this group was applied successfully.", 'success');
// clear post data
$_POST = array();
}
}
// select details about this group
$sel = $db->query("SELECT * FROM dl_users_groups WHERE group_id = '" . $group_id . "'");
// if group doesn't exist
if ($db->num_rows($sel) == 0) {
redirect(ADMIN_URL);
}
$group_infos = $db->fetch_array($sel);
$persmissions_list = array();
if ($group_id != 1) {
$group_infos['group_permissions'] = explode(",", $group_infos['group_permissions']);
$sel = $db->query("SELECT * FROM dl_users_permissions ORDER BY permission_module ASC");
示例6: redirect
// if page doesn't exist
if (empty(CONTENT::get())) {
redirect(LINKS::get("admin_pages"));
}
EVENTS::add_action("edit_page_page_text", function () {
if (isset($_POST['btn_submit'])) {
// filter
$page['content_title'] = strip_tags($_POST['page_title']);
$page['content_text'] = $_POST['page_content'];
$page['content_category'] = $_POST['page_category'];
$page['content_slug'] = $_POST['page_slug'] == '' ? slugify($_POST['page_title']) : $_POST['page_slug'];
$page['content_visible'] = $_POST['page_visible'];
// update content
if (CONTENT::set_content($page, $_GET['id']) !== false) {
// show success message
TPL::message('Continutul a fost actualizat cu succes!', 'success');
}
}
// assign data
TPL::assign("content", CONTENT::get());
TPL::assign('categories', CONTENT::get_categories());
// set render
TPL::render('v_pages/page_types/page_text');
});
EVENTS::add_action("before_render", function () {
EVENTS::do_action("edit_page_" . CONTENT::get('content_type'));
});
break;
/*
* delete page
*/
示例7: object2array
$upd = $db->query("UPDATE dl_menus SET menu_title = '{$menu_title}' WHERE menu_id = '{$menu_id}'");
$data = object2array(json_decode($item_order));
function recurse_update($array, $parent = 0)
{
global $db;
foreach ($array as $pos => $val) {
$upd = $db->query(" UPDATE dl_menus_items \n SET item_parent = '" . $db->real_escape($parent) . "', \n item_sort = '" . $db->real_escape($pos) . "' \n WHERE item_id = '" . $db->real_escape($val['id']) . "'");
if (isset($val['children'])) {
recurse_update($val['children'], $val['id']);
}
}
}
if (!empty($data)) {
recurse_update($data);
}
TPL::message("Modificarile au fost actualizate cu succes.", "success");
}
// select all menus
$current_menus = $db->query_fetch("SELECT * FROM dl_menus ORDER BY menu_title ASC");
// select current menu infos
$menu = $db->query_fetch("SELECT * FROM dl_menus WHERE menu_id = '{$menu_id}'")[0];
$menu['items'] = $db->query_fetch("SELECT * FROM dl_menus_items WHERE item_menu = '{$menu_id}' ORDER BY item_parent, item_sort ASC");
// generate tree
$menu['items'] = generate_tree($menu['items']);
// assign data
TPL::assign("current_menus", $current_menus);
TPL::assign("c_menu", $menu);
// set render
TPL::render('v_content/content_menus');
break;
case "menu_item_edit":
示例8: set_content
public static function set_content($options, $content_id = 0)
{
// include database
global $db;
// get columns and values
$columns = array_keys($options);
$values = array();
foreach ($options as $opt) {
$values[] = "'" . $db->real_escape($opt) . "'";
}
// update content
if ($content_id > 0) {
// check for date modified
if (!isset($options['content_date_modified'])) {
$columns[] = 'content_date_modified';
$values[] = "'" . date("Y-m-d H:i:s", time()) . "'";
}
$query = array();
for ($i = 0; $i < count($values); $i++) {
$query[] = $columns[$i] . "=" . $values[$i];
}
$query = implode(",", $query);
$upd = $db->query("UPDATE dl_content SET " . $query . " WHERE content_id = '{$content_id}'");
if (!$upd) {
// log errors and show message
LOGS::write("Error sql insert into database.");
//TPL::message("S-a intampinat o eroare la actualizarea datelor! Va rugam reincercati.");
// return
return false;
} else {
// return
return true;
}
} else {
// check for date published
if (!isset($options['content_date_published'])) {
$columns[] = 'content_date_published';
$values[] = "'" . date("Y-m-d H:i:s", time()) . "'";
}
// check for auhor
if (!isset($options['content_author'])) {
$columns[] = 'content_author';
$values[] = "'" . USER::get("id") . "'";
}
// check for category
if (!isset($options['content_category'])) {
$columns[] = 'content_category';
$values[] = "'0'";
}
// check for visible
if (!isset($options['content_visible'])) {
$columns[] = 'content_visible';
$values[] = "'1'";
}
// implode
$columns = implode(",", $columns);
$values = implode(",", $values);
// run query
$ins = $db->query("INSERT INTO dl_content (" . $columns . ") VALUES (" . $values . ")");
// check on sql error
if (!$ins) {
// log errors and show message
LOGS::write("Error sql insert into database.");
TPL::message("S-a intampinat o eroare la adaugarea in baza de date! Va rugam reincercati.");
// return
return false;
} else {
// return
return $db->insert_id();
}
}
}
示例9:
* uninstall plugins
*/
/*
* uninstall plugins
*/
case "plugin_uninstall":
$package = $_GET['package'];
if (DRAWLINE::plugin_installed($package)) {
if (DRAWLINE::uninstall_plugin($package)) {
TPL::message("The plugin " . $package . " was succesfully uninstalled!", "success");
} else {
if (empty(TPL::get_messages('error'))) {
TPL::message("We encounted some errors during the uninstallition of " . $package . ". Please try again!");
}
}
} else {
TPL::message("This plugin is not installed. You can't uninstall an uninstalled plugin :)");
}
TPL::assign("plugins", DRAWLINE::plugins_list());
TPL::render('v_extender/extender_plugins');
break;
/*
* drawline marketplace
*/
/*
* drawline marketplace
*/
case "marketplace":
break;
}
}