本文整理汇总了PHP中db_query_one函数的典型用法代码示例。如果您正苦于以下问题:PHP db_query_one函数的具体用法?PHP db_query_one怎么用?PHP db_query_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_query_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_new_template
/**
*
* Function sort out paramaters
* This function creates folders needed when duplicating a template
* @param number $folder_name_id - the id of this template
* @param number $tutorial_id_from_post - the parent template name for the new tutorial
* @version 1.0
* @author Patrick Lockley
*/
function create_new_template($folder_name_id, $parent_template_name)
{
global $dir_path, $new_path, $temp_dir_path, $temp_new_path, $xerte_toolkits_site;
$row_framework = db_query_one("SELECT template_framework from {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails WHERE template_name = ?", array($parent_template_name));
// I think this is wrong, currently looking like : /home/david/src/xerteonlinetoolkits/modules//templates/0 should presumably be home/david/src/xerteonlinetoolkits/modules/xerte/templates/Nottingham
$dir_path = $xerte_toolkits_site->basic_template_path . $row_framework['template_framework'] . "/templates/" . $parent_template_name;
/**
* Get the id of the folder we are looking to copy into
*/
_debug("Creating new template : {$folder_name_id}, {$parent_template_name}");
$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name;
$path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $parent_template_name;
if (is_dir($path)) {
_debug("Trying to create new template at location - {$path} - it's already in use. Aborting");
die("Template directory already exists; will not overwrite/re-create.");
}
if (mkdir($path)) {
_debug("Created {$path} ok");
if (@chmod($path, 0777)) {
$ok = copy_r($dir_path, $path);
_debug("Copy_r returned " . print_r($ok, true));
return $ok;
} else {
_debug("Failed to set rights ");
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set rights on parent folder for template", "Failed to set rights on parent folder " . $path);
return false;
}
} else {
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICAL", "Failed to create parent folder for template", "Failed to create parent folder " . $path);
return false;
}
}
示例2: get_user_id
/**
*
* Function get user id
* get the user's database ID
* @author Patrick Lockley
* @version 1.0
* @return number - The user's database id
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
function get_user_id()
{
global $xerte_toolkits_site;
$row = db_query_one("SELECT login_id FROM {$xerte_toolkits_site->database_table_prefix}logindetails WHERE username = ?", array($_SESSION['toolkits_logon_username']));
if (!empty($row)) {
return $row['login_id'];
} else {
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Failed to get users ID", "Failed to get users ID");
}
}
示例3: xerte_session_write
function xerte_session_write($id, $data)
{
global $xerte_toolkits_site;
$access = time();
$response = db_query_one('SELECT * FROM user_sessions WHERE id = ?', array($id));
if (empty($response)) {
db_query_one("INSERT INTO user_sessions VALUES(?,?,?)", array($id, $access, $data));
} else {
db_query("UPDATE user_sessions SET data = ?, access = ? WHERE id = ?", array($data, $access, $id));
}
}
示例4: get_default_engine
function get_default_engine($template_id)
{
global $xerte_toolkits_site;
$row = db_query_one("SELECT td.extra_flags FROM {$xerte_toolkits_site->database_table_prefix}templatedetails td WHERE td.template_id = ?", array($template_id));
if ($row == false) {
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Failed to get default template engine", "Failed to get the default template engine");
} else {
$engine = 'javascript';
$extra_flags = explode(";", $row['extra_flags']);
foreach ($extra_flags as $flag) {
$parameter = explode("=", $flag);
switch ($parameter[0]) {
case 'engine':
$engine = $parameter[1];
break;
}
}
return $engine;
}
}
示例5: _load_language_file
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* folder properties template page, used by the site to display the default panel for the properties page
*
* @author Patrick Lockley
* @version 1.0
* @package
*/
require_once "../../../config.php";
_load_language_file("/website_code/php/folderproperties/folderproperties_template.inc");
include "../url_library.php";
//connect to the database
if (is_numeric($_POST['folder_id'])) {
$database_connect_id = database_connect("Folder name database connect success", "Folder name database connect failed");
$prefix = $xerte_toolkits_site->database_table_prefix;
$query_for_folder_name = "select folder_name from {$prefix}folderdetails where folder_id=?";
$params = array($_POST['folder_id']);
$row_template_name = db_query_one($query_for_folder_name, $params);
echo "<p class=\"header\"><span>" . FOLDER_PROPERTIES_PROPERTIES . "</span></p>";
echo "<p>" . FOLDER_PROPERTIES_CALLED . " " . str_replace("_", " ", $row_template_name['folder_name']) . "</p>";
echo "<p>" . FOLDER_PROPERTIES_CHANGE . "</p>";
echo "<p><form id=\"rename_form\" action=\"javascript:rename_folder('" . $_POST['folder_id'] . "', 'rename_form')\">" . "<input style=\"padding-bottom:5px\" type=\"text\" value=\"" . str_replace("_", " ", $row_template_name['folder_name']) . "\" " . "name=\"newfoldername\" /><button type=\"submit\" class=\"xerte_button\" " . "align=\"top\" style=\"padding-left:5px\">" . FOLDER_PROPERTIES_BUTTON_SAVE . "</button></form>";
}
示例6: output_editor_code
/**
*
* Function create folder loop
* This function outputs the xerte editor code
* @param array $row_edit - the mysql query for this folder
* @param number $xerte_toolkits_site - a number to make sure that we enter and leave each folder correctly
* @param bool $read_status - a read only flag for this template
* @param number $version_control - a setting to handle the delettion of lock files when the window is closed
* @version 1.0
* @author Patrick Lockley
*/
function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $version_control)
{
require_once "config.php";
_load_language_file("/modules/xerte/edit.inc");
$row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row_edit['user_id']));
if (empty($row_username)) {
die("Invalid user id ?");
}
/**
* create the preview xml used for editing
*/
$preview = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/preview.xml";
$data = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/data.xml";
if (!file_exists($preview) && file_exists($data)) {
copy($data, $preview);
chmod($preview, 0777);
}
/**
* set up the strings used in the flash vars
*/
$string_for_flash_xml = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/preview.xml";
$string_for_flash_media = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/media/";
$string_for_flash_xwd = "modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
/**
* sort of the screen sies required for the preview window
*/
$temp = explode("~", get_template_screen_size($row_edit['template_name'], $row_edit['template_framework']));
$edit_site_logo = $xerte_toolkits_site->site_logo;
$pos = strrpos($edit_site_logo, '/') + 1;
$edit_site_logo = substr($edit_site_logo, 0, $pos) . "edit_" . substr($edit_site_logo, $pos);
$edit_organisational_logo = $xerte_toolkits_site->organisational_logo;
$pos = strrpos($edit_organisational_logo, '/') + 1;
$edit_organisational_logo = substr($edit_organisational_logo, 0, $pos) . "edit_" . substr($edit_organisational_logo, $pos);
/**
* set up the onunload function used in version control
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php
echo XERTE_EDIT_TITLE;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
<link rel="icon" href="favicon_edit.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon_edit.ico" type="image/x-icon" />
<script src="modules/xerte/js/swfobject.js"></script>
<script src="website_code/scripts/opencloseedit.js"></script>
<script src="website_code/scripts/template_management.js"></script>
<script src="website_code/scripts/ajax_management.js"></script>
<script type="text/javascript" language="javascript">
function getSessionID(){
var id;
var auth = '<?php
echo strtolower($xerte_toolkits_site->authentication_method);
?>
';
var browser = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 'firefox' :
((navigator.userAgent.toLowerCase().indexOf('safari') > -1) ? 'safari' :
'other');
//Pass data to upload (Firefox Flash Cookie Bug) which we are
//It first checks moodle, then defaults
if (auth == 'moodle') {
//Its Moodle integration so we need the whole cookie
return 'BROWSER=' + browser + '&AUTH=moodle&COOKIE=' + escape(document.cookie);
}
else if ((id = document.cookie.match(/PHPSESSID=[^;]+/))) {
// Its Default authentication so we only need session id
return 'BROWSER=' + browser + '&AUTH=xerte&' + id;
}
return null;
}
function setunload(){
window.onbeforeunload = bunload;
}
function hideunload(){
window.onbeforeunload = function(){};
//.........这里部分代码省略.........
示例7: output_editor_code
/**
*
* Function output_editor_code
* This function outputs the xerte editor code
* @param array $row_edit - the mysql query for this folder
* @param number $xerte_toolkits_site - a number to make sure that we enter and leave each folder correctly
* @param bool $read_status - a read only flag for this template
* @param number $version_control - a setting to handle the delettion of lock files when the window is closed
* @version 1.0
* @author Patrick Lockley
*/
function output_editor_code($row_edit, $xerte_toolkits_site, $read_status, $version_control)
{
require_once "config.php";
require_once "website_code/php/language_library.php";
_load_language_file("/modules/xerte/edit.inc");
$row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row_edit['user_id']));
if (empty($row_username)) {
die("Invalid user id ?");
}
/**
* create the preview xml used for editing
*/
$preview_filename = "preview.xml";
$rlo_path = $xerte_toolkits_site->users_file_area_full . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'];
$media_path = $rlo_path . "/media/";
$preview = $rlo_path . "/preview.xml";
$data = $rlo_path . "/data.xml";
if (!file_exists($preview) && file_exists($data)) {
copy($data, $preview);
chmod($preview, 0777);
}
$preview_url = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/" . $preview_filename;
$data_url = $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'] . "/data.xml";
$rlo_url = $xerte_toolkits_site->site_url . $xerte_toolkits_site->users_file_area_short . $row_edit['template_id'] . "-" . $row_username['username'] . "-" . $row_edit['template_name'];
$xwd_url = "modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
$xwd_path = $xerte_toolkits_site->root_file_path . "/modules/" . $row_edit['template_framework'] . "/parent_templates/" . $row_edit['template_name'] . "/";
if (file_exists($xwd_path . "wizards/" . $_SESSION['toolkits_language'] . "/data.xwd")) {
$xwd_file_url = $xwd_url . "wizards/" . $_SESSION['toolkits_language'] . "/data.xwd";
} else {
if (file_exists($xwd_path . "wizards/en-GB/data.xwd")) {
$xwd_file_url = $xwd_url . "wizards/en-GB/data.xwd";
} else {
if (file_exists($xwd_path . "data.xwd")) {
$xwd_file_url = $xwd_url . "data.xwd";
}
}
}
$module_url = "modules/" . $row_edit['template_framework'] . "/";
$jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-en.js";
$jqgridlangcode = strtolower($_SESSION['toolkits_language']);
if (file_exists($xerte_toolkits_site->root_file_path . "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js")) {
$jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js";
} else {
$jqgridlangcode = substr($jqgridlangcode, 0, 2);
if (file_exists($xerte_toolkits_site->root_file_path . "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js")) {
$jqgridlangfile = "editor/js/vendor/jqgrid/js/i18n/grid.locale-" . $jqgridlangcode . ".js";
}
}
/**
* build an array of available themes for this template
*/
$theme_folder = $xerte_toolkits_site->root_file_path . "themes/" . $row_edit['template_name'] . "/";
$ThemeList = array();
// Add default theme
$ThemeList[] = array('name' => "default", 'display_name' => "Xerte Online Toolkits", 'description' => "Xerte Online Toolkits", 'preview' => "");
if (file_exists($theme_folder)) {
$d = opendir($theme_folder);
while ($f = readdir($d)) {
if (is_dir($theme_folder . $f)) {
if (file_exists($theme_folder . $f . "/" . $f . ".info")) {
$info = file($theme_folder . $f . "/" . $f . ".info", FILE_SKIP_EMPTY_LINES);
$themeProperties = new StdClass();
foreach ($info as $line) {
$attr_data = explode(":", $line, 2);
if (empty($attr_data) || sizeof($attr_data) != 2) {
continue;
}
switch (trim(strtolower($attr_data[0]))) {
case "name":
$themeProperties->name = trim($attr_data[1]);
break;
case "display name":
$themeProperties->display_name = trim($attr_data[1]);
break;
case "description":
$themeProperties->description = trim($attr_data[1]);
break;
case "enabled":
$themeProperties->enabled = strtolower(trim($attr_data[1]));
break;
case "preview":
$themeProperties->preview = $xerte_toolkits_site->site_url . "themes/" . $row_edit['template_name'] . "/" . $f . "/" . trim($attr_data[1]);
break;
}
}
if (substr($themeProperties->enabled, 0, 1) == "y") {
$ThemeList[] = array('name' => $themeProperties->name, 'display_name' => $themeProperties->display_name, 'description' => $themeProperties->description, 'preview' => $themeProperties->preview);
}
}
//.........这里部分代码省略.........
示例8: dirname
require_once dirname(__FILE__) . '/library/autoloader.php';
if (!isset($xerte_toolkits_site)) {
// create new generic object to hold all our config stuff in....
$xerte_toolkits_site = new StdClass();
/**
* Access the database to get the variables
*/
if (!is_file(dirname(__FILE__) . '/database.php')) {
header("Location: " . $_SERVER['REQUEST_URI'] . "setup/");
}
require_once dirname(__FILE__) . '/database.php';
require_once dirname(__FILE__) . '/website_code/php/database_library.php';
if (!database_connect("", "")) {
die("database.php isn't correctly configured; cannot connect to database; have you run /setup?");
}
$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}sitedetails");
/**
* Access the database to get the variables
* @version 1.0
* @author Patrick Lockley
* @copyright 2008,2009 University of Nottingham
*/
/**
* Include any script that is used for configuration - for moodle this might be e.g. '/xampp/htdocs/moodle/config.php'.
*/
if ($row['integration_config_path'] != "") {
require_once $row['integration_config_path'];
}
unset($row['integration_config_path']);
foreach ($row as $key => $value) {
$xerte_toolkits_site->{$key} = $value;
示例9: db_query_one
require $xerte_toolkits_site->php_library_path . "screen_size_library.php";
require $xerte_toolkits_site->php_library_path . "template_status.php";
require $xerte_toolkits_site->php_library_path . "user_library.php";
/*
* Check the ID is numeric
*/
if (isset($_SESSION['toolkits_logon_id'])) {
if (is_numeric($_GET['template_id'])) {
$safe_template_id = (int) $_GET['template_id'];
/*
* Standard query
*/
$query_for_preview_content = "select otd.template_name, ld.username, otd.template_framework, tr.user_id, tr.folder, tr.template_id, td.access_to_whom, td.extra_flags";
$query_for_preview_content .= " from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails otd, " . $xerte_toolkits_site->database_table_prefix . "templaterights tr, " . $xerte_toolkits_site->database_table_prefix . "templatedetails td, " . $xerte_toolkits_site->database_table_prefix . "logindetails ld";
$query_for_preview_content .= " where td.template_type_id = otd.template_type_id and td.creator_id = ld.login_id and tr.template_id = td.template_id and tr.template_id=" . $safe_template_id . " and role='creator'";
$row = db_query_one($query_for_preview_content);
if (!empty($row)) {
// get their username from the db which matches their login_id from the $_SESSION
// ???? This is just the same user as in the previous query, NOT from the session. WHY?
//$row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row['user_id']));
require $xerte_toolkits_site->root_file_path . "modules/" . $row['template_framework'] . "/preview.php";
// is there a matching template?
// if they're an admin or have rights to see the template, then show it.
if (is_user_admin() || has_rights_to_this_template($row['template_id'], $_SESSION['toolkits_logon_id'])) {
show_preview_code($row);
exit(0);
}
}
} else {
echo PREVIEW_RESOURCE_FAIL;
}
示例10: mysql_query
die;
}
/*
* Take the query from site variable and alter it to suit this request
*/
$query_for_play_content = "select otd.template_name, ld.username, otd.template_framework, tr.user_id, tr.folder, tr.template_id, td.access_to_whom, td.extra_flags";
$query_for_play_content .= " from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails otd, " . $xerte_toolkits_site->database_table_prefix . "templaterights tr, " . $xerte_toolkits_site->database_table_prefix . "templatedetails td, " . $xerte_toolkits_site->database_table_prefix . "logindetails ld";
$query_for_play_content .= " where td.template_type_id = otd.template_type_id and td.creator_id = ld.login_id and tr.template_id = td.template_id and tr.template_id=" . $safe_template_id . " and role='creator'";
$query_for_play_content_response = mysql_query($query_for_play_content);
$row_play = mysql_fetch_array($query_for_play_content_response);
$query_to_find_out_if_in_recycle_bin = "select folder_name from " . $xerte_toolkits_site->database_table_prefix . "folderdetails where folder_id =\"" . $row_play['folder'] . "\"";
$query_for_recycle_bin_response = mysql_query($query_to_find_out_if_in_recycle_bin);
/*
* Is the file in the recycle bin?
*/
$row_recycle = db_query_one("SELECT folder_name FROM {$xerte_toolkits_site->database_table_prefix}folderdetails WHERE folder_id = ?", array($row_play['folder']));
if ($row_recycle['folder_name'] == "recyclebin") {
echo file_get_contents($xerte_toolkits_site->website_code_path . "error_top") . " " . PLAY_RESOURCE_FAIL . " </div></div></body></html>";
exit(0);
}
require_once $xerte_toolkits_site->php_library_path . "screen_size_library.php";
/*
* Ge show template functions for this 'module' / 'template framework'
*/
require_once $xerte_toolkits_site->root_file_path . "modules/" . $row_play['template_framework'] . "/play.php";
/*
* Fix for NULL number_of_uses
*/
db_query("UPDATE {$xerte_toolkits_site->database_table_prefix}templatedetails SET number_of_uses = 0 WHERE ISNULL(number_of_uses)");
/*
* Start to check the access_to_whom settings from templatedetails for this template
示例11: trim
$template_object['requires'] = trim($attr_data[1]);
break;
}
}
if (isset($template_object['requires'])) {
$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails where template_framework=?", array($template_object['requires']));
if (isset($row)) {
$continue = true;
} else {
$continue = false;
}
} else {
$continue = true;
}
if ($continue) {
$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails where template_framework=? and template_name=?", array($_POST['name'], $template));
if (isset($row)) {
if (is_array($row)) {
db_query("update {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails set display_name=?, description=?, access_rights=?, active=? where template_type_id=?", array($template_object['display_name'], $template_object['description'], $row['template_type_id'], "*", 1));
echo "<p>" . $_POST['name'] . "/" . $template . " " . EXTEND_MODULE_UPDATE . "</p>";
}
} else {
db_query("insert into {$xerte_toolkits_site->database_table_prefix}originaltemplatesdetails (template_framework,template_name,display_name,description,date_uploaded,access_rights,active)values(?,?,?,?,?,?,?)", array($_POST['name'], $template, $template_object['display_name'], $template_object['description'], date("Y-m-d", time()), "*", 1));
echo "<p>" . $_POST['name'] . "/" . $template . " " . EXTEND_MODULE_INSTALL . "</p>";
}
} else {
echo "<p>" . $_POST['name'] . "/" . $template . " <span style='color:#f00'>" . EXTEND_MODULE_REQUIRES . "</span> <strong>" . $template_object['requires'] . "</strong></p>";
}
}
}
}
示例12: mysql_real_escape_string
* @package
*/
require_once "../../../config.php";
include "../template_status.php";
include "../screen_size_library.php";
include "../url_library.php";
include "../user_library.php";
include "properties_library.php";
if (is_numeric($_POST['template_id'])) {
$template_id = mysql_real_escape_string($_POST['template_id']);
$engine = mysql_real_escape_string($_POST['engine']);
if ($engine != 'flash' && $engine != 'javascript') {
$engine = 'javascript';
}
// Get extra flags
$row = db_query_one("SELECT td.extra_flags FROM {$xerte_toolkits_site->database_table_prefix}templatedetails td WHERE td.template_id = ?", array($template_id));
$extra_flags = explode(";", $row['extra_flags']);
$found = false;
for ($i = 0; $i < count($extra_flags); $i++) {
$parameter = explode("=", $extra_flags[$i]);
if ($parameter[0] == 'engine') {
$extra_flags[$i] = "engine=" . $engine;
$found = true;
break;
}
}
if (!$found) {
$extra_flags[] = "engine=" . $engine;
}
$db_entry = join(";", $extra_flags);
$query = "update " . $xerte_toolkits_site->database_table_prefix . "templatedetails SET extra_flags =\"" . str_replace(" ", "_", mysql_real_escape_string($db_entry)) . "\" WHERE template_id =\"" . $template_id . "\"";
示例13: db_query
require_once "../../../config.php";
include "../template_status.php";
include "../url_library.php";
include "../user_library.php";
include "properties_library.php";
if (is_numeric($_POST['template_id'])) {
if (is_user_creator($_POST['template_id']) || is_user_admin()) {
$query_for_rss_status = "select rss from {$xerte_toolkits_site->database_table_prefix}templatesyndication where template_id=?";
$rows = db_query($query_for_rss_status, array($_POST['template_id']));
$status = false;
if (sizeof($rows) == 0) {
$query_to_change_rss_status = "Insert into {$xerte_toolkits_site->database_table_prefix}templatesyndication (template_id,rss,export,description) VALUES (?,?,?,?)";
$status = db_query($query_to_change_rss_status, array($_POST['template_id'], $_POST['rss'], $_POST['export'], $_POST['desc']));
} else {
$query_to_change_rss_status = "update {$xerte_toolkits_site->database_table_prefix}templatesyndication \n set rss=?, export=?, description=? WHERE template_id = ?";
$status = db_query($query_to_change_rss_status, array($_POST['rss'], $_POST['export'], $_POST['desc'], $_POST['template_id']));
}
if ($status === false) {
echo "<p class='error'>Error saving change to template.</p>";
}
if (template_access_settings($_POST['template_id']) == "Public") {
$query_for_name = "select firstname,surname from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?";
$row_name = db_query_one($query_for_name, array($_SESSION['toolkits_logon_id']));
rss_display($xerte_toolkits_site, $_POST['template_id'], true);
} else {
rss_display_public();
}
} else {
rss_display_fail();
}
}
示例14: ini_set
$prefix = $xerte_toolkits_site->database_table_prefix;
ini_set('max_execution_time', 300);
if (is_numeric($_GET['template_id'])) {
$_GET['template_id'] = (int) $_GET['template_id'];
$proceed = false;
if (is_template_exportable($_GET['template_id'])) {
$proceed = true;
} else {
if (is_user_creator($_GET['template_id']) || is_user_admin()) {
$proceed = true;
}
}
if ($proceed) {
$fullArchive = false;
if (isset($_GET['full'])) {
if ($_GET['full'] == "true") {
$fullArchive = true;
}
}
_debug("Full archive: " . $fullArchive);
/*
* Get the file path
*/
$query = "select {$prefix}templatedetails.template_name as zipname, {$prefix}templaterights.template_id, " . "{$prefix}logindetails.username, {$prefix}originaltemplatesdetails.template_name," . "{$prefix}originaltemplatesdetails.template_framework from {$prefix}templaterights, {$prefix}logindetails, " . "{$prefix}originaltemplatesdetails, {$prefix}templatedetails WHERE " . "{$prefix}templatedetails.template_type_id = {$prefix}originaltemplatesdetails.template_type_id and " . "{$prefix}templaterights.template_id = {$prefix}templatedetails.template_id and " . "{$prefix}templatedetails.creator_id = {$prefix}logindetails.login_id and {$prefix}templaterights.template_id= ? AND role= ?";
$params = array($_GET['template_id'], 'creator');
$row = db_query_one($query, $params);
if (file_exists($xerte_toolkits_site->root_file_path . "modules/" . $row['template_framework'] . "/export.php")) {
require_once $xerte_toolkits_site->root_file_path . "modules/" . $row['template_framework'] . "/export.php";
}
}
}
示例15: upgrade_6
function upgrade_6()
{
$table = table_by_key('originaltemplatesdetails');
db_query_one("insert into " . $table . " (`template_type_id`,`template_framework`,`template_name`,`description`,`date_uploaded`,`display_name`,`display_id`,`access_rights`,`active`) values (17,'decision','decision','A template for presenting a series of questions to reach a solution to a problem.','2009-01-01','Decision Tree Template',0,'*',1)");
return true;
}