Commit 611acf54 authored by changi67's avatar changi67
parent 12aca4a5
......@@ -37,16 +37,16 @@ if (!isset($_REQUEST["image_type"])) {
switch ($_REQUEST["image_type"]) {
case "article":
$image_cache_prefix="article";
break;
break;
case "submission":
$image_cache_prefix="article_submission";
break;
break;
case "topic":
$image_cache_prefix="article_topic";
break;
break;
case "preview":
$image_cache_prefix="article_preview";
break;
break;
default:
die;
}
......@@ -62,17 +62,17 @@ if ( isset($_REQUEST["reload"]) || !$useCache || !is_file($cachefile) ) {
switch ($_REQUEST["image_type"]) {
case "article":
$storedData = $artlib->get_article_image($_REQUEST["id"]);
break;
break;
case "submission":
$storedData = $artlib->get_submission($_REQUEST["id"]);
break;
break;
case "topic":
$storedData = $artlib->get_topic_image($_REQUEST["id"]);
break;
break;
case "preview":
// We can't get the data from the database. No fallback solution.
// No image displayed
break;
break;
default:
// Invalid value
die;
......@@ -93,8 +93,8 @@ if ( isset($_REQUEST["reload"]) || !$useCache || !is_file($cachefile) ) {
if (empty($data)) die;
}
if ($useCache && $data) {
$fp = fopen($cachefile,"wb");
fputs($fp,$data);
$fp = fopen($cachefile, "wb");
fputs($fp, $data);
fclose($fp);
}
echo $data;
......
......@@ -51,8 +51,8 @@ if (is_file($bannercachefile) and (!isset($_REQUEST["reload"]))) {
$type = $data["imageType"];
$data = $data["imageData"];
if ($data) {
$fp = fopen($bannercachefile,"wb");
fputs($fp,$data);
$fp = fopen($bannercachefile, "wb");
fputs($fp, $data);
fclose($fp);
}
}
......
......@@ -7,18 +7,18 @@
require_once('tiki-setup.php');
$access = TikiLib::lib('access');
$access->check_script($_SERVER["SCRIPT_NAME"],basename(__FILE__));
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
$smarty = TikiLib::lib('smarty');
global $prefs;
$catobjperms = Perms::get( array( 'type' => $cat_type, 'object' => $cat_objid ) );
$catobjperms = Perms::get(array( 'type' => $cat_type, 'object' => $cat_objid ));
if ($prefs['feature_categories'] == 'y' && $catobjperms->modify_object_categories ) {
$categlib = TikiLib::lib('categ');
if (isset($_REQUEST['import']) and isset($_REQUEST['categories'])) {
$_REQUEST["cat_categories"] = explode(',',$_REQUEST['categories']);
$_REQUEST["cat_categories"] = explode(',', $_REQUEST['categories']);
$_REQUEST["cat_categorize"] = 'on';
}
......
......@@ -7,14 +7,14 @@
require_once('tiki-setup.php');
$access = TikiLib::lib('access');
$access->check_script($_SERVER["SCRIPT_NAME"],basename(__FILE__));
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
$userlib = TikiLib::lib('user');
$smarty = TikiLib::lib('smarty');
global $prefs;
$catobjperms = Perms::get( array( 'type' => $cat_type, 'object' => $cat_objid ) );
$catobjperms = Perms::get(array( 'type' => $cat_type, 'object' => $cat_objid ));
$smarty->assign('mandatory_category', '-1');
if ($prefs['feature_categories'] == 'y' && isset($cat_type) && isset($cat_objid)) {
......@@ -46,7 +46,7 @@ if ($prefs['feature_categories'] == 'y' && isset($cat_type) && isset($cat_objid)
$can = $catobjperms->modify_object_categories;
foreach ($categories as &$category) {
$catperms = Perms::get( array( 'type' => 'category', 'object' => $category['categId'] ) );
$catperms = Perms::get(array( 'type' => 'category', 'object' => $category['categId'] ));
if (in_array($category["categId"], $cats)) {
$category["incat"] = 'y';
......
......@@ -27,11 +27,11 @@ $id = $data["bannerId"];
switch ($data["which"]) {
case 'useHTML':
$raw = $data["HTMLData"];
break;
break;
case 'useImage':
$raw = "<img border=\"0\" src=\"banner_image.php?id=" . $id . "\" />";
break;
break;
case 'useFixedURL':
$fp = fopen($data["fixedURLData"], "r");
......@@ -43,10 +43,10 @@ switch ($data["which"]) {
}
fclose($fp);
break;
break;
case 'useText':
$raw = $data["textData"];
break;
break;
}
print ($raw);
......@@ -8,7 +8,7 @@
//this script may only be included - so its better to err & die if called directly.
//smarty is not there - we need setup
require_once('tiki-setup.php');
$access->check_script($_SERVER["SCRIPT_NAME"],basename(__FILE__));
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
global $prefs;
global $tiki_p_view_freetags;
......@@ -32,7 +32,7 @@ if ($prefs['feature_freetags'] == 'y' and $tiki_p_view_freetags == 'y') {
}
}
$smarty->assign('taglist',$taglist);
$smarty->assign('taglist', $taglist);
} else {
$taglist = '';
}
......@@ -40,7 +40,7 @@ if ($prefs['feature_freetags'] == 'y' and $tiki_p_view_freetags == 'y') {
if ( !isset($cat_lang))
$cat_lang = null;
$suggestion = $freetaglib->get_tag_suggestion($taglist,$prefs['freetags_browse_amount_tags_suggestion'],$cat_lang);
$suggestion = $freetaglib->get_tag_suggestion($taglist, $prefs['freetags_browse_amount_tags_suggestion'], $cat_lang);
$smarty->assign('tag_suggestion',$suggestion);
$smarty->assign('tag_suggestion', $suggestion);
}
......@@ -18,6 +18,6 @@ if (!empty($re['usersTrackerId']) && !empty($re['registrationUsersFieldIds'])) {
$json_data['debug'] = $re;
}
header( 'Content-Type: application/json' );
header('Content-Type: application/json');
$access->output_serialized($json_data);
......@@ -41,7 +41,7 @@ foreach (array(
'bcc'
) as $dest) {
if (is_array($_REQUEST[$dest])) {
$sep = strstr(implode('',$_REQUEST[$dest]), ',') === false?', ': '; ';
$sep = strstr(implode('', $_REQUEST[$dest]), ',') === false?', ': '; ';
$_REQUEST[$dest] = implode($sep, $_REQUEST[$dest]);
}
}
......@@ -87,13 +87,13 @@ if (isset($_REQUEST['send'])) {
if (($messulib->count_messages($a_user) < $prefs['messu_mailbox_size']) || ($prefs['messu_mailbox_size'] == 0)) {
$users[] = $a_user;
} else {
$message.= sprintf(tra("User %s can not receive messages, mailbox is full") ,htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages, mailbox is full"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("User %s can not receive messages") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("Invalid user: %s") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("Invalid user: %s"), htmlspecialchars($a_user)) . "<br />";
}
}
}
......@@ -107,13 +107,13 @@ if (isset($_REQUEST['send'])) {
if (($messulib->count_messages($a_user) < $prefs['messu_mailbox_size']) || ($prefs['messu_mailbox_size'] == 0)) {
$users[] = $a_user;
} else {
$message.= sprintf(tra("User %s can not receive messages, mailbox is full") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages, mailbox is full"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("User %s can not receive messages") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("Invalid user: %s") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("Invalid user: %s"), htmlspecialchars($a_user)) . "<br />";
}
}
}
......@@ -127,13 +127,13 @@ if (isset($_REQUEST['send'])) {
if (($messulib->count_messages($a_user) < $prefs['messu_mailbox_size']) || ($prefs['messu_mailbox_size'] == 0)) {
$users[] = $a_user;
} else {
$message.= sprintf(tra("User %s can not receive messages, mailbox is full") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages, mailbox is full"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("User %s can not receive messages") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("User %s can not receive messages"), htmlspecialchars($a_user)) . "<br />";
}
} else {
$message.= sprintf(tra("Invalid user: %s") , htmlspecialchars($a_user)) . "<br />";
$message.= sprintf(tra("Invalid user: %s"), htmlspecialchars($a_user)) . "<br />";
}
}
}
......@@ -152,8 +152,17 @@ if (isset($_REQUEST['send'])) {
}
// Insert the message in the inboxes of each user
foreach ($users as $a_user) {
$result = $messulib->post_message($a_user, $user, $_REQUEST['to'], $_REQUEST['cc'], $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority'], $_REQUEST['replyto_hash'],
isset($_REQUEST['replytome']) ? 'y' : '', isset($_REQUEST['bccme']) ? 'y' : '');
$result = $messulib->post_message(
$a_user,
$user,
$_REQUEST['to'],
$_REQUEST['cc'],
$_REQUEST['subject'],
$_REQUEST['body'],
$_REQUEST['priority'],
$_REQUEST['replyto_hash'],
isset($_REQUEST['replytome']) ? 'y' : '', isset($_REQUEST['bccme']) ? 'y' : ''
);
if ($result) {
if ($prefs['feature_score'] == 'y') {
$tikilib->score_event($user, 'message_send');
......
......@@ -55,19 +55,18 @@ $date_field = $_REQUEST['date_field'];
require_once 'lib/cache/pagecache.php';
$pageCache = Tiki_PageCache::create()
->requiresPreference( 'metrics_cache_output' )
->addKeys( $_REQUEST, array( 'tab_id', 'range', 'date_from', 'date_to', 'date_field' ) )
->requiresPreference('metrics_cache_output')
->addKeys($_REQUEST, array( 'tab_id', 'range', 'date_from', 'date_to', 'date_field' ))
->applyCache();
$metrics_notify = '';
if (empty($date_field)) {
$date_field = 'date_field';
}
else {
} else {
/**
* strip ` and limit column length
*/
$date_field = preg_replace('/[`\/\\\<>"\']/','', $date_field);
$date_field = preg_replace('/[`\/\\\<>"\']/', '', $date_field);
$date_field = substr($date_field, 0, COLUMN_MAXLEN);
}
if (!is_numeric($tab_id)) {
......@@ -82,7 +81,7 @@ if (!empty($converted_range['msg'])) {
}
$tab_info = $metricslib->getTabById($tab_id);
$ret = $metricslib->getMetricsData( $tab_info, $range, $converted_range, $date_field );
$ret = $metricslib->getMetricsData($tab_info, $range, $converted_range, $date_field);
$tab_content = $tab_info['tab_content'];
$m = $ret['data'];
$m_id = $ret['ids'];
......
......@@ -41,33 +41,36 @@ $commands=array('help' => array(),
// 'republish' => array(),
);
function tikimods_feedback_listener($num, $err) {
function tikimods_feedback_listener($num, $err)
{
switch($num) {
case -1:
echo $err."\n";
break;
break;
case 0:
echo "! ".$err."\n";
break;
break;
case 1:
echo "*** ".$err."\n";
break;
break;
}
}
$modslib->add_feedback_listener('tikimods_feedback_listener');
function ask($str) {
function ask($str)
{
echo $str;
$res=fgets(STDIN, 1024);
return trim($res);
}
function command_help($goption, $coption, $cparams) {
function command_help($goption, $coption, $cparams)
{
usage(0);
}
function command_install($goption, $coption, $cparams) {
function command_install($goption, $coption, $cparams)
{
global $modslib;
global $prefs;
global $mods_server;
......@@ -122,7 +125,8 @@ function command_install($goption, $coption, $cparams) {
$modslib->install_with_deps($prefs['mods_dir'], $mods_server, $deps);
}
function command_remove($goption, $coption, $cparams) {
function command_remove($goption, $coption, $cparams)
{
global $modslib;
global $prefs;
global $mods_server;
......@@ -153,7 +157,8 @@ function command_remove($goption, $coption, $cparams) {
$modslib->remove_with_deps($prefs['mods_dir'], $mods_server, $deps);
}
function command_list($goption, $coption, $cparams) {
function command_list($goption, $coption, $cparams)
{
global $repos;
global $modslib;
$merged=array();
......@@ -190,7 +195,8 @@ function command_list($goption, $coption, $cparams) {
}
}
function command_show($goption, $coption, $cparams) {
function command_show($goption, $coption, $cparams)
{
global $repos;
global $modslib;
......@@ -340,12 +346,14 @@ function command_show($goption, $coption, $cparams) {
}
function failure($errstr) {
function failure($errstr)
{
fprintf(STDERR, "%s\n", $errstr);
exit(1);
}
function usage($err) {
function usage($err)
{
global $goptions;
global $commands;
......@@ -368,7 +376,8 @@ function usage($err) {
exit($err);
}
function readargs($argv) {
function readargs($argv)
{
global $goptions;
global $commands;
......
......@@ -8,9 +8,9 @@
//this script may only be included - so its better to err & die if called directly.
//smarty is not there - we need setup
require_once('tiki-setup.php');
$access->check_script($_SERVER["SCRIPT_NAME"],basename(__FILE__));
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
global $wikilib; include_once('lib/wiki/wikilib.php');
$plugins = $wikilib->list_plugins( true );
$plugins = $wikilib->list_plugins(true);
$smarty->assign_by_ref('plugins', $plugins);
......@@ -8,7 +8,7 @@
//this script may only be included - so its better to err & die if called directly.
//smarty is not there - we need setup
require_once('tiki-setup.php');
$access->check_script($_SERVER["SCRIPT_NAME"],basename(__FILE__));
$access->check_script($_SERVER["SCRIPT_NAME"], basename(__FILE__));
global $prefs;
if ($prefs['feature_polls'] == 'y') {
......@@ -16,7 +16,9 @@ if ($prefs['feature_polls'] == 'y') {
#echo '<div>hier</div>';
if (!is_object($categlib)) include_once('lib/categories/categlib.php');
if (!is_object($polllib)) include_once('lib/polls/polllib.php');
if (!isset($_REQUEST['poll_title'])) { $_REQUEST['poll_title'] = 'rate it!'; }
if (!isset($_REQUEST['poll_title'])) {
$_REQUEST['poll_title'] = 'rate it!';
}
if (isset($_REQUEST["poll_template"]) and $_REQUEST["poll_template"]) {
$catObjectId = $categlib->is_categorized($cat_type, $cat_objid);
......@@ -34,6 +36,6 @@ if ($prefs['feature_polls'] == 'y') {
$catObjectId = $categlib->add_categorized_object($cat_type, $cat_objid, $cat_desc, $cat_name, $cat_href);
}
$olpoll = $polllib->get_poll($_REQUEST["olpoll"]);
$polllib->poll_categorize($catObjectId,$_REQUEST["olpoll"], $olpoll['title']);
$polllib->poll_categorize($catObjectId, $_REQUEST["olpoll"], $olpoll['title']);
}
}
......@@ -50,10 +50,10 @@ header('Cache-Control: no-cache');
header('Content-type: image/gif');
header('Content-length: 85');
print base64_decode(
'R0lGODlhAQABALMAAAAAAIAAAACAA'.
'ICAAAAAgIAAgACAgMDAwICAgP8AAA'.
'D/AP//AAAA//8A/wD//wBiZCH5BAE'.
'AAA8ALAAAAAABAAEAAAQC8EUAOw=='
'R0lGODlhAQABALMAAAAAAIAAAACAA'.
'ICAAAAAgIAAgACAgMDAwICAgP8AAA'.
'D/AP//AAAA//8A/wD//wBiZCH5BAE'.
'AAA8ALAAAAAABAAEAAAQC8EUAOw=='
);
flush();
exit;
......@@ -6,7 +6,7 @@
// $Id$
if (!isset($_REQUEST["nocache"]))
session_cache_limiter ('private_no_expire');
session_cache_limiter('private_no_expire');
//include_once ("tiki-setup_base.php");
include_once ("tiki-setup.php");
......@@ -32,7 +32,7 @@ if (isset($_REQUEST["name"])) {
} elseif (isset($_REQUEST["id"])) {
$id=$_REQUEST["id"];
} elseif (isset($_REQUEST["galleryId"])) {
$id=$imagegallib->get_gallery_image($_REQUEST["galleryId"],'default');
$id=$imagegallib->get_gallery_image($_REQUEST["galleryId"], 'default');
}
if (!$id) {
......@@ -41,7 +41,7 @@ if (!$id) {
}
$galleryId = $imagegallib->get_gallery_from_image($id);
$galperms = Perms::get( array( 'type' => 'image gallery', 'object' => $galleryId ) );
$galperms = Perms::get(array( 'type' => 'image gallery', 'object' => $galleryId ));
if ( ! $galperms->view_image_gallery ) {
header("HTTP/1.0 404 Not Found");
......@@ -66,7 +66,7 @@ if (isset($_REQUEST["thumb"])) {
} else {
$itype = 's';
$scalesize = $galdef;
}
}
}
if ($imagegallib->get_etag($id, $itype, $scalesize)!==false) {
......@@ -75,7 +75,7 @@ if ($imagegallib->get_etag($id, $itype, $scalesize)!==false) {
# Etag value is based on the md5 hash of the image. It should change everytime the image changes. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19
#if the client sends the HTTP_IF_NONE_MATCH header(because it received the etag for this image the first time he saw it) we check that the received etag is the same as the actual etag (this is, the image haven't changed) and if it's equal, we send the "Not modified" header(304)
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imagegallib->etag){
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imagegallib->etag) {
header("HTTP/1.0 304 Not Modified");
exit();
}
......
......@@ -11,7 +11,7 @@ require_once ('tiki-setup.php');
include_once ('lib/rankings/ranklib.php');
$access->check_feature( array('feature_wiki', 'feature_wiki_rankings') );
$access->check_feature(array('feature_wiki', 'feature_wiki_rankings'));
$access->check_permission('tiki_p_view');
if (!isset($_REQUEST["limit"])) {
......@@ -22,11 +22,11 @@ if (!isset($_REQUEST["limit"])) {
if (isset($_REQUEST["categId"]) && $_REQUEST["categId"] > 0) {
$smarty->assign('categIdstr', $_REQUEST["categId"]);
$categs = explode(",",$_REQUEST["categId"]);
$categs = explode(",", $_REQUEST["categId"]);
} else {
$categs = array();
}
$smarty->assign('categId',$categs);
$smarty->assign('categId', $categs);
$allrankings = array(
array(
......
......@@ -36,6 +36,6 @@ if (!in_array($_REQUEST['validator'], $validatorslib->available)) {
$validatorslib->setInput($_REQUEST["input"]);
$result = $validatorslib->validateInput($_REQUEST["validator"], $_REQUEST["parameter"], $_REQUEST["message"]);
header( 'Content-Type: application/json' );
echo json_encode( $result );
header('Content-Type: application/json');
echo json_encode($result);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment