Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2011-06-18 12:42:48

magenta
New Member
Registered: 2011-05-08
Posts: 2

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Hello. afc-torpedo.ru This site with cnk_soccer. Wellcome

Offline

#32 2019-02-26 01:24:30

arellanon
New Member
From: San Jose, CA
Registered: 2019-02-26
Posts: 7
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Hi: Thank you for this plugin. Can you give advice with installation issues?

I am using php 5.6 and I have version 1.0.2 of the plug in installed.
I go the “soccer” page and click “install” and I quickly get “Installation aborted”
I tried php 7.0 clicked install and got the following error.

Fatal error: Uncaught Error: Call to undefined function mysql_get_server_info() in /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code:2041 Stack trace: #0 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code(2025): cnk_sc_do_install() #1 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code(214): cnk_sc_install() #2 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1989): cnk_soccer(‘cnk_soccer’, ‘cnk_sc_install’) #3 /home/newsrealsanjose/public_html/textpattern/index.php(258): callback_event(‘cnk_soccer’, ‘cnk_sc_install’, 0) #4 {main} thrown in /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code on line 2041


Regards, Nick

Offline

#33 2019-02-26 08:20:39

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,292
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Hi arellanon and welcome!

That looks like the plugin is not yet updated for newer versions of PHP. It’s been a while since we saw the author here on the forum.

I don’t know what your level of knowledge is, but it may be as simple as replacing functions that use mysql_… in the plugin code with mysqli_… (note the extra i). See here for further information. That was a casualty of a change in PHP. You can edit the plugin code in the Admin › Plugins pane and look up the correct function names on php.net or here. That might resolve the installation problems, but it might also be more complicated than that.


TXP Builders – finely-crafted code, design and txp

Online

#34 2019-02-26 18:22:34

arellanon
New Member
From: San Jose, CA
Registered: 2019-02-26
Posts: 7
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

I followed the instructions (to my best) and got some progress in that the error now turns to “installation aborted”. Probably means that it read php 7.

if(@txpinterface == 'admin') 
{
	define('CNK_SC_IMG_UPLOAD_CATEGORY', 'clubs');
	define('CNK_SC_IMG_BROWSE_FOLDER', '/images/soccer/clubs/');

	add_privs('cnk_soccer','1,2,3,4');
	add_privs('cnk_soccer_admin','1,2');

	register_tab('content', 'cnk_soccer', "Soccer");
	register_callback('cnk_soccer', 'cnk_soccer');

	$club_array = NULL;
}

// ################################################################
/*
	TAG: next game <txp:cnk_next_game />
*/
// ################################################################
function cnk_next_game($atts) 
{
	global $prefs, $pretext, $s, $id, $title;

	extract(lAtts(array(
		'league_id' => '1',
		'date_pattern' => '%A %e/%m - %Y, Kl. %H:%M',
		'colon_img_filename' => 'images/soccer/colon.gif',
		'delay_hours' => '2'
	), $atts));

	$q = "select UNIX_TIMESTAMP(cnk_soccer_games.kickoff_time) as kickoff, cnk_soccer_clubs1.name as club1, cnk_soccer_clubs1.logo as club1_logo, cnk_soccer_clubs2.name as club2, cnk_soccer_clubs2.logo as club2_logo, cnk_soccer_league.name as league, cnk_soccer_league.season as season from ".safe_pfx('cnk_soccer_games')." as cnk_soccer_games, ".safe_pfx('cnk_soccer_league')." as cnk_soccer_league, ".safe_pfx('cnk_soccer_clubs')." as cnk_soccer_clubs1, ".safe_pfx('cnk_soccer_clubs')." as cnk_soccer_clubs2 where cnk_soccer_clubs1.id = cnk_soccer_games.club1_id AND cnk_soccer_clubs2.id = cnk_soccer_games.club2_id AND cnk_soccer_league.id = cnk_soccer_games.league_id AND cnk_soccer_games.league_id = ".$league_id." AND DATE_ADD(cnk_soccer_games.kickoff_time, INTERVAL ".$delay_hours." HOUR) > NOW() ORDER BY kickoff_time LIMIT 1";

	$game = getRow($q);

	$out = '<div class="cnk_next_game">';

	if ($game) {

		extract($game);

		$out .= '<p><img class="cnk_sc_club_logo_1" src="'.trim($club1_logo, '/').'" alt="'.$club1.' logo" /><img class="cnk_sc_versus" src="'.$colon_img_filename.'" alt="versus" /><img class="cnk_sc_club_logo_2" src="'.trim($club2_logo, '/').'" alt="'.$club2.' logo" /></p>'.

		'<p>'.$club1.' - '.$club2.'</p>'.

		'<p>'.strftime($date_pattern, $kickoff).'</p>';

	}
	else
	{
		$out .= 'No upcoming match!';
	}

	$out .= '</div>';

	return $out;
}

// ################################################################
/*
	TAG: table <txp:cnk_table />
*/
// ################################################################
function cnk_table($atts) 
{
	global $prefs, $pretext, $s, $id, $title;

	extract(lAtts(array(
		'league_id' => '1',
		'include_ranks' => '',
		'column_headers' => '',
		'column_display' => '',
		'follow_club' => '',
		'follow_club_padding' => 2
	), $atts));

	$rank_includes = explode(',', strtolower(str_replace(' ', '', $include_ranks)));

	$col_headers = explode(',', str_replace(' ', '', $column_headers));

	if (count($col_headers) != 9) $col_headers = explode(',', '#,club,points,goals for,goals against,goals sum,won,draw,lost');

	$col_display = explode(',', str_replace(' ', '', $column_display));

	if (count($col_display) != 9) $col_display = explode(',', '1,1,1,0,0,0,0,0,0');

	$q = "SELECT 
			cl.points AS points, 
			c.name AS club, 
			c.id AS club_id,
			cl.goals_for,
			cl.goals_against,
			(cl.goals_for - cl.goals_against) as goals_sum,
			game_won,
			game_draw,
			game_lost
			FROM 
			".safe_pfx('cnk_soccer_clubs')." AS c LEFT JOIN 
			".safe_pfx('cnk_soccer_club_to_league')." AS cl ON (c.id = cl.club_id)
			WHERE 
			cl.league_id = ".$league_id."
			ORDER BY 
			cl.points DESC,
			(cl.goals_for - cl.goals_against) DESC";

	$ranks = getRows($q);

	// add follow_club and padding clubs
	if ($follow_club)
	{
		for($i=0; $i < count($ranks); $i++)
		{			
				if ($ranks[$i]['club_id'] == $follow_club)
				{
					$p = $i - $follow_club_padding; 

					if ($p < 0) $p = 0;

					while ($p <= $i + $follow_club_padding && $p < count($ranks))
					{
						$ranks[$p]['display'] = 'yes';
						$p++;
					}

					break;
				}
		}
	}

	$out = '<div class="cnk_ranking_table"><table><tr>';

	for($c=0;$c < count($col_headers);$c++)
	{	
		if ($col_display[$c]) $out .= '<td>'.$col_headers[$c].'</td>';
	}

	$out .= '</tr>';

	for($i=0; $i < count($ranks); $i++)
	{
		$r = $ranks[$i];

		if (trim($include_ranks) == '' || in_array(($i+1), $rank_includes) || isset($r['display'])) 
		{
			$out .= '<tr'.($r['club_id']==$follow_club?' class="cnk_sc_fav"':'').'>';

			if ($col_display[0]) $out .= '<td>'.($i+1).'</td>';

			if ($col_display[1]) $out .= '<td>'.$r['club'].'</td>';

			if ($col_display[2]) $out .= '<td>'.$r['points'].'</td>';

			if ($col_display[3]) $out .= '<td>'.$r['goals_for'].'</td>';

			if ($col_display[4]) $out .= '<td>'.$r['goals_against'].'</td>';

			if ($col_display[5]) $out .= '<td>'.($r['goals_sum']>0?'+':'').$r['goals_sum'].'</td>';

			if ($col_display[6]) $out .= '<td>'.$r['game_won'].'</td>';

			if ($col_display[7]) $out .= '<td>'.$r['game_draw'].'</td>';

			if ($col_display[8]) $out .= '<td>'.$r['game_lost'].'</td>';

			$out .= '</tr>';
		}
	}

	$out .= '</table></div>';

	return $out;
}

// ################################################################
/*
	Function: Handles callbacks
*/
// ################################################################
function cnk_soccer($event, $step)
{
	global $vars;
global $DB;

	$vars = array('name', 'season', 'id', 'country', 'logo', 'logo_1', 'logo_2', 'logo_3', 'club_id', 'league_id', 'old_club_id', 'old_league_id', 'points', 'goals_for', 'goals_against', 'game_won', 'game_lost', 'game_draw', 'club1_id', 'club2_id', 'kickoff_time', 'goals_club1', 'goals_club2', 'calc_rank', 'total_rounds', 'round', 'games_per_round');

	if(!$step or !in_array($step, array('cnk_sc_config', 
										'cnk_sc_create_club', 
										'cnk_sc_create_league',
										'cnk_sc_edit_club', 
										'cnk_sc_edit_league',
										'cnk_sc_edit_ranking',
										'cnk_sc_post_league',
										'cnk_sc_post_club',
										'cnk_sc_post_ranking',
										'cnk_sc_save_league',
										'cnk_sc_save_club',
										'cnk_sc_save_ranking',
										'cnk_sc_save_round',
										'cnk_sc_install',
										'cnk_sc_deinstall',
										'cnk_sc_pageby_league',
										'cnk_sc_pageby_club',
										'cnk_sc_pageby_ranking',
										'cnk_sc_pageby_rounds',
										'cnk_sc_multi_edit_league',
										'cnk_sc_multi_edit_club',
										'cnk_sc_multi_edit_ranking',
										'cnk_sc_multi_edit_rounds',
										'cnk_sc_add_round',
										'cnk_sc_edit_round')))
	{
		cnk_sc_config();
	} 
	else
	{
		$step();
	}
}

// ################################################################
/*
	Function: Renders Configuration Page
*/
// ################################################################
function cnk_sc_config($message = '')
{
	pagetop('Configure Soccer Plugin', $message);

	echo '<div style="margin: auto; text-align: center"><ul>';

	if (has_privs('cnk_soccer_admin')) echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_edit_league">League</a></li>';

	if (has_privs('cnk_soccer_admin')) echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_edit_club">Clubs</a></li>';

	if (has_privs('cnk_soccer_admin')) echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_edit_ranking">Table</a></li>';

	echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_add_round">Games</a></li>';

	echo '</ul>';

	echo '<ul style="margin-top: 100px">';		

	if (has_privs('cnk_soccer_admin')) echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_install">Install</a></li>';

	if (has_privs('cnk_soccer_admin')) echo '<li><a href="?event=cnk_soccer'.a.'step=cnk_sc_deinstall">Deinstall</a></li>';

	echo '</ul></div>';
}

// ################################################################
// ################################################################
// ################################################################
/*
	Club Functions
*/
// ################################################################
// ################################################################
// ################################################################

function cnk_sc_post_club()
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);
        global $DB;

	extract(doSlash($varray));

	if ($logo_1)
	{
		$logo = '/images/'.$logo_1;
	}
	else if ($logo_2)
	{
		$logo = CNK_SC_IMG_BROWSE_FOLDER.$logo_2;
	}
	else
	{
		$logo = $logo_3;
	}

	$q = @safe_insert("cnk_soccer_clubs",
	   "name    = '$name',
		country = '$country',
		logo = '$logo'"
	);
	$GLOBALS['ID'] = mysqli_insert_id( );

	if ($q)
	{
		//update lastmod due to link feeds
		update_lastmod();

		$message = 'Club created: '.$name;
	}
	else
	{
		$message = 'Could not create club';
	}

	cnk_sc_edit_club($message);	
}

function cnk_sc_save_club() 
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);

	extract(doSlash($varray));

	$id = assert_int($id);

	if ($logo_1)
	{
		$logo = '/images/'.$logo_1;
	}
	else if ($logo_2)
	{
		$logo = CNK_SC_IMG_BROWSE_FOLDER.$logo_2;
	}
	else
	{
		$logo = $logo_3;
	}

	$rs = @safe_update("cnk_soccer_clubs",
	   "name    = '$name',
		country = '$country',
		logo = '$logo'",
	   "id = $id"
	);

	if ($rs)
	{
		update_lastmod();

		$message = 'Club updated: '.doStrip($name);
	}
	else
	{
		$message = 'Could not save club';
	}

	cnk_sc_edit_club($message);	
}

function club_image_dropdown($filename = '') 
{
	$image_array = array();

	$rs = safe_rows_start("CONCAT(id, ext) as id, name as title", 'txp_image', "category = '".CNK_SC_IMG_UPLOAD_CATEGORY."' order by name asc");

	while ($r = nextRow($rs))
	{
		$image_array[$r['id']] = $r['title'];
	}

	return tda(selectInput('logo_1', $image_array, $filename, true));	
}

function club_folder_dropdown($filename = '') 
{
	$image_array = array();

	if (CNK_SC_IMG_BROWSE_FOLDER != '' && is_dir('..'.CNK_SC_IMG_BROWSE_FOLDER))
	{
		if ($handle = opendir('..'.CNK_SC_IMG_BROWSE_FOLDER)) 
		{
			while (false !== ($file = readdir($handle))) 
			{
				if ($file != "." && $file != "..") 
				{
					$image_array[$file] = $file;
				}
			}

			closedir($handle);
		}

		asort($image_array);
	}

	return tda(selectInput('logo_2', $image_array, $filename, true));	
}

function cnk_sc_edit_club($message = '')
{
	global $vars, $step;

	pagetop('Edit Club', $message);

	extract(gpsa($vars));

	if ($id && $step == 'cnk_sc_edit_club')
	{
		$id = assert_int($id);
		extract(safe_row('*', 'cnk_soccer_clubs', "id = $id"));
	}

	if ($step == 'cnk_sc_save_club' or $step == 'cnk_sc_post_club')
	{
		foreach ($vars as $var)
		{
			$$var = '';
		}
	}

	echo '<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>'.

	form(

		startTable('edit') .

		tr(
			fLabelCell('Name').
			fInputCell('name', $name, 1, 30)
		).

		tr(
			fLabelCell('Country').
			fInputCell('country', $country, 2, 30)
		).

		tr(
			fLabelCell('1. Select logo from TXP').
			club_image_dropdown($logo)
		).

		tr(
			fLabelCell('2. Select logo from folder').
			club_folder_dropdown($logo)
		).

		tr(
			fLabelCell('3. Enter logo path').
			fInputCell('logo_3', $logo, 2, 30)
		).

		tr(
			td().
			td(
				fInput('submit', '', gTxt('save'), 'publish')
			)
		).

		endTable().

		eInput('cnk_soccer').

		($id ? sInput('cnk_sc_save_club').hInput('id', $id) : sInput('cnk_sc_post_club')).

		hInput('search_method', gps('search_method')).
		hInput('crit', gps('crit'))
	, 'margin-bottom: 25px;');

	echo cnk_sc_list_club();
}

function cnk_sc_list_club($message = '') 
{
	global $step, $cnk_sc_club_list_pageby;

	extract(get_prefs());

	extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));

	$dir = ($dir == 'desc') ? 'desc' : 'asc';

	switch ($sort)
	{
		case 'id':
			$sort_sql = 'id '.$dir;
		break;

		case 'name':
			$sort_sql = 'name '.$dir.', id asc';
		break;

		case 'country':
			$sort_sql = 'country '.$dir.', name asc';
		break;

		default:
			$sort = 'country';
			$sort_sql = 'country '.$dir.', name asc';
		break;
	}

	$switch_dir = ($dir == 'desc') ? 'asc' : 'desc';

	$criteria = 1;

	if ($search_method and $crit)
	{
		$crit_escaped = doSlash($crit);

		$critsql = array(
			'id'			     => "id = '$crit_escaped'",
			'name'		     => "name like '%$crit_escaped%'",
			'country'	 => "country like '%$crit_escaped%'"
		);

		if (array_key_exists($search_method, $critsql))
		{
			$criteria = $critsql[$search_method];
			$limit = 500;
		}

		else
		{
			$search_method = '';
			$crit = '';
		}
	}

	else
	{
		$search_method = '';
		$crit = '';
	}

	$total = getCount('cnk_soccer_clubs', $criteria);  

	if ($total < 1)
	{
		if ($criteria != 1)
		{
			echo n.cnk_sc_search_form_club($crit, $search_method).
				n.graf(gTxt('no_results_found'), ' style="text-align: center;"');
		}

		else
		{
			echo n.graf('No club recorded', ' style="text-align: center;"');
		}

		return;
	}

	$limit = max(@$cnk_sc_club_list_pageby, 15);

	list($page, $offset, $numPages) = pager($total, $limit, $page);

	echo cnk_sc_search_form_club($crit, $search_method);

	$rs = safe_rows_start('*', 'cnk_soccer_clubs', "$criteria order by $sort_sql limit $offset, $limit");

	if ($rs)
	{
		echo n.n.'<form action="index.php" method="post" name="longform" onsubmit="return verify(\''.gTxt('are_you_sure').'\')">',

			startTable('list').

			n.tr(
				cnk_sc_column_head('ID', 'id', 'cnk_soccer', 'cnk_sc_edit_club', true, $switch_dir, $crit, $search_method, ('id' == $sort) ? $dir : '').
				cnk_sc_column_head('Country', 'country', 'cnk_soccer', 'cnk_sc_edit_club', true, $switch_dir, $crit, $search_method, ('country' == $sort) ? $dir : '').
				cnk_sc_column_head('name', 'name', 'cnk_soccer', 'cnk_sc_edit_club', true, $switch_dir, $crit, $search_method, ('name' == $sort) ? $dir : '').
				cnk_sc_column_head('Logo', 'logo').
				hCell()
			);

			while ($a = nextRow($rs))
			{
				extract($a);				

				$edit_url = '?event=cnk_soccer'.a.'step=cnk_sc_edit_club'.a.'id='.$id.a.'sort='.$sort.
					a.'dir='.$dir.a.'page='.$page.a.'search_method='.$search_method.a.'crit='.$crit;

				echo tr(

					n.td($id, 40).

					td(htmlspecialchars($country), 150).

					td(href(htmlspecialchars($name), $edit_url), 255).

					td('<img src="..'.$logo.'" />', 40).

					td(fInput('checkbox', 'selected[]', $id), 20)
				);
			}

		echo n.n.tr(
			tda(
				select_buttons().
				cnk_sc_multiedit_form_club($page, $sort, $dir, $crit, $search_method)
			, ' colspan="5" style="text-align: right; border: none;"')
		).

		endTable().
		'</form>'.

		n.cnk_sc_nav_form('cnk_soccer', 'cnk_sc_edit_club', $page, $numPages, $sort, $dir, $crit, $search_method).

		cnk_sc_pageby_form('cnk_soccer', 'cnk_sc_pageby_club', $cnk_sc_club_list_pageby).

		'<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>';
	}
}



function cnk_sc_search_form_club($crit, $method)
{
	$methods =	array(
		'id'				=> gTxt('ID'),
		'name'				=> gTxt('name'),
		'country' 			=> 'Country'
	);

	return search_form('cnk_soccer', 'cnk_sc_edit_club', $crit, $methods, $method, 'name');
}

function cnk_sc_multiedit_form_club($page, $sort, $dir, $crit, $search_method) 
{
	$methods = array(
		'delete' => gTxt('delete')
	);

	return cnk_sc_event_multiedit_form('cnk_soccer', 'cnk_sc_multi_edit_club', $methods, $page, $sort, $dir, $crit, $search_method);
}

function cnk_sc_pageby_club() 
{
	event_change_pageby('cnk_sc_club');
	cnk_sc_edit_club();
}

function cnk_sc_multi_edit_club() 
{
	$deleted = cnk_sc_event_multi_edit('cnk_soccer_clubs', 'id');

	if ($deleted)
	{
		$message = 'Club deleted: '.$deleted;

		return 	cnk_sc_edit_club($message);
	}

	return 	cnk_sc_edit_club();
}

// ################################################################
// ################################################################
// ################################################################
/*
	LEAGUE Functions
*/
// ################################################################
// ################################################################
// ################################################################

function cnk_sc_post_league()
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);
global $DB;

	extract(doSlash($varray));

	$q = @safe_insert("cnk_soccer_league",
	   "name    = '$name',
		season = '$season',
		total_rounds = '$total_rounds',
		games_per_round = '$games_per_round'"
	);

	$GLOBALS['ID'] = mysqli_insert_id( );

	if ($q)
	{
		//update lastmod due to link feeds
		update_lastmod();

		$message = 'League created: '.$name;	
	}
	else
	{
		$message = 'Could not create league';
	}

	cnk_sc_edit_league($message);
}

function cnk_sc_save_league() 
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);

	extract(doSlash($varray));

	$id = assert_int($id);

	$rs = @safe_update("cnk_soccer_league",
	   "name    = '$name',
		season = '$season',
		total_rounds = '$total_rounds',
		games_per_round = '$games_per_round'",
	   "id = $id"
	);

	if ($rs)
	{
		update_lastmod();

		$message = 'League updated: '.doStrip($name);
	}
	else
	{
		$message = 'Could not save league';
	}

	cnk_sc_edit_league($message);
}

function cnk_sc_edit_league($message = '')
{
	global $vars, $step;

	pagetop('Edit League', $message);

	extract(gpsa($vars));

	if ($id && $step == 'cnk_sc_edit_league')
	{
		$id = assert_int($id);
		extract(safe_row('*', 'cnk_soccer_league', "id = $id"));
	}

	if ($step == 'cnk_sc_save_league' or $step == 'cnk_sc_post_league')
	{
		foreach ($vars as $var)
		{
			$$var = '';
		}
	}

	echo '<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>'.

	form(

		startTable('edit') .

		tr(
			fLabelCell('Name').
			fInputCell('name', $name, 1, 30)
		).

		tr(
			fLabelCell('Season').
			fInputCell('season', $season, 2, 9)
		).

		tr(
			fLabelCell('Total rounds').
			fInputCell('total_rounds', $total_rounds, 3, 2)
		).

		tr(
			fLabelCell('Games per round').
			fInputCell('games_per_round', $games_per_round, 4, 2)
		).

		tr(
			td().
			td(
				fInput('submit', '', gTxt('save'), 'publish')
			)
		).

		endTable().

		eInput('cnk_soccer').

		($id ? sInput('cnk_sc_save_league').hInput('id', $id) : sInput('cnk_sc_post_league')).

		hInput('search_method', gps('search_method')).
		hInput('crit', gps('crit'))
	, 'margin-bottom: 25px;');

	echo cnk_sc_list_league();
}

function cnk_sc_list_league($message = '') 
{
	global $step, $cnk_sc_league_list_pageby;

	extract(get_prefs());

	extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));

	$dir = ($dir == 'desc') ? 'desc' : 'asc';

	switch ($sort)
	{
		case 'id':
			$sort_sql = 'id '.$dir;
		break;

		case 'name':
			$sort_sql = 'name '.$dir.', id asc';
		break;

		case 'season':
			$sort_sql = 'season '.$dir.', id asc';
		break;

		default:
			$sort = 'name';
			$sort_sql = 'name '.$dir.', id asc';
		break;
	}

	$switch_dir = ($dir == 'desc') ? 'asc' : 'desc';

	$criteria = 1;

	if ($search_method and $crit)
	{
		$crit_escaped = doSlash($crit);

		$critsql = array(
			'id'			     => "id = '$crit_escaped'",
			'name'		     => "name like '%$crit_escaped%'",
			'season'	 => "season like '%$crit_escaped%'"
		);

		if (array_key_exists($search_method, $critsql))
		{
			$criteria = $critsql[$search_method];
			$limit = 500;
		}

		else
		{
			$search_method = '';
			$crit = '';
		}
	}

	else
	{
		$search_method = '';
		$crit = '';
	}

	$total = getCount('cnk_soccer_league', $criteria);  

	if ($total < 1)
	{
		if ($criteria != 1)
		{
			echo n.cnk_sc_search_form_league($crit, $search_method).
				n.graf(gTxt('no_results_found'), ' style="text-align: center;"');
		}

		else
		{
			echo n.graf('No league recorded', ' style="text-align: center;"');
		}

		return;
	}

	$limit = max(@$cnk_sc_league_list_pageby, 15);

	list($page, $offset, $numPages) = pager($total, $limit, $page);

	echo cnk_sc_search_form_league($crit, $search_method);

	$rs = safe_rows_start('*', 'cnk_soccer_league', "$criteria order by $sort_sql limit $offset, $limit");

	if ($rs)
	{
		echo n.n.'<form action="index.php" method="post" name="longform" onsubmit="return verify(\''.gTxt('are_you_sure').'\')">',

			startTable('list').

			n.tr(
				cnk_sc_column_head('ID', 'id', 'cnk_soccer', 'cnk_sc_edit_league', true, $switch_dir, $crit, $search_method, ('id' == $sort) ? $dir : '').
				cnk_sc_column_head('name', 'name', 'cnk_soccer', 'cnk_sc_edit_league', true, $switch_dir, $crit, $search_method, ('name' == $sort) ? $dir : '').
				cnk_sc_column_head('Season', 'season', 'cnk_soccer', 'cnk_sc_edit_league', true, $switch_dir, $crit, $search_method, ('season' == $sort) ? $dir : '').
				cnk_sc_column_head('Total rounds', 'total_rounds').
				cnk_sc_column_head('Games/ Round', 'games_per_round').
				hCell()
			);

			while ($a = nextRow($rs))
			{
				extract($a);				

				$edit_url = '?event=cnk_soccer'.a.'step=cnk_sc_edit_league'.a.'id='.$id.a.'sort='.$sort.
					a.'dir='.$dir.a.'page='.$page.a.'search_method='.$search_method.a.'crit='.$crit;

				echo tr(

					n.td($id, 40).

					td(href(htmlspecialchars($name), $edit_url), 255).

					td(htmlspecialchars($season), 150).

					td(htmlspecialchars($total_rounds), 40).

					td(htmlspecialchars($games_per_round), 40).

					td(fInput('checkbox', 'selected[]', $id), 20)
				);
			}

		echo n.n.tr(
			tda(
				select_buttons().
				cnk_sc_multiedit_form_league($page, $sort, $dir, $crit, $search_method)
			, ' colspan="6" style="text-align: right; border: none;"')
		).

		endTable().
		'</form>'.

		n.cnk_sc_nav_form('cnk_soccer', 'cnk_sc_edit_league', $page, $numPages, $sort, $dir, $crit, $search_method).

		cnk_sc_pageby_form('cnk_soccer', 'cnk_sc_pageby_league', $cnk_sc_league_list_pageby).

		'<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>';
	}
}



function cnk_sc_search_form_league($crit, $method)
{
	$methods =	array(
		'id'				=> gTxt('ID'),
		'name'				=> gTxt('name'),
		'season' 			=> 'Season'
	);

	return search_form('cnk_soccer', 'cnk_sc_edit_league', $crit, $methods, $method, 'name');
}

function cnk_sc_multiedit_form_league($page, $sort, $dir, $crit, $search_method) 
{
	$methods = array(
		'delete' => gTxt('delete')
	);

	return cnk_sc_event_multiedit_form('cnk_soccer', 'cnk_sc_multi_edit_league', $methods, $page, $sort, $dir, $crit, $search_method);
}

function cnk_sc_pageby_league() 
{
	event_change_pageby('cnk_sc_league');
	cnk_sc_edit_league();
}

function cnk_sc_multi_edit_league() 
{
	$deleted = cnk_sc_event_multi_edit('cnk_soccer_league', 'id');

	if ($deleted)
	{
		$message = 'League deleted: '.$deleted;

		return 	cnk_sc_edit_league($message);
	}

	return 	cnk_sc_edit_league();
}

// ################################################################
// ################################################################
// ################################################################
/*
	Ranking Functions
*/
// ################################################################
// ################################################################
// ################################################################

function cnk_sc_post_ranking()
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);

	extract(doSlash($varray));

	$check = getCount('cnk_soccer_club_to_league', "club_id = '$club_id' AND league_id = '$league_id'");

	if (!$check)
	{
		$q = safe_insert("cnk_soccer_club_to_league",
		   "club_id    = '$club_id',
			league_id = '$league_id'"
		);

		$GLOBALS['ID'] = $club_id;

		if ($q)
		{
			//update lastmod due to link feeds
			update_lastmod();

			$message = 'Rank created: '.$club_id.'_'.$league_id;
		}
		else
		{
			$message = 'Database Error';
		}
	}
	else
	{
		$message = 'Club is already assigned to this league.';
	}

	cnk_sc_edit_ranking($message);	
}

function cnk_sc_save_ranking() 
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);

	extract(doSlash($varray));

	$club_id = assert_int($club_id);
	$league_id = assert_int($league_id);
	$goals_for = assert_int($goals_for);
	$goals_against = assert_int($goals_against);
	$game_won = assert_int($game_won);
	$game_lost = assert_int($game_lost);
	$game_draw = assert_int($game_draw);

	if ($club_id != $old_club_id || $league_id != $old_league_id)
	{
		$check = getCount('cnk_soccer_club_to_league', "club_id = '$club_id' AND league_id = '$league_id'");
	}
	else
	{
		$check = false;
	}

	if (!$check)
	{
		$rs = safe_update("cnk_soccer_club_to_league",
		   "points    = '$points',
		    goals_for = '$goals_for',
		    goals_against = '$goals_against',
		    game_won = '$game_won',
		    game_draw = '$game_draw',
		    game_lost = '$game_lost',
			club_id = '$club_id',
			league_id = '$league_id'",
		   "club_id = $club_id AND league_id = $league_id"
		);

		if ($rs)
		{
			update_lastmod();

			$message = 'Rank updated: '.doStrip($name);
		}
		else
		{
			$message = 'Database Error';
		}
	}
	else
	{
		$message = 'Club is already assigned to this league.';
	}

	cnk_sc_edit_ranking($message);	
}

// TODO: redundant functions

function ranking_club_dropdown($club_id = '', $help = '') 
{
	$club_array = array();

	$rs = safe_rows_start("id, CONCAT(country, ' - ', name) as title", 'cnk_soccer_clubs', "1=1 order by country asc, name asc");

	while ($r = nextRow($rs))
	{
		$club_array[$r['id']] = $r['title'];
	}

	return tda(selectInput('club_id', $club_array, $club_id).$help);	
}

function ranking_league_dropdown($league_id = '', $help = '') 
{
	$league_array = array();

	$rs = safe_rows_start("id, CONCAT(name, ' - ', season) as title", 'cnk_soccer_league', "1=1 order by name asc, season asc");

	while ($r = nextRow($rs))
	{
		$league_array[$r['id']] = $r['title'];
	}

	return tda(selectInput('league_id', $league_array, $league_id).$help);	
}

function cnk_sc_edit_ranking($message = '')
{
	global $vars, $step;

	pagetop('Edit Rank', $message);

	extract(gpsa($vars));

	if ($club_id && $league_id && $step == 'cnk_sc_edit_ranking')
	{
		$club_id = assert_int($club_id);
		$league_id = assert_int($league_id);
		extract(safe_row('*', 'cnk_soccer_club_to_league', "club_id = $club_id AND league_id = $league_id"));
	}

	if ($step == 'cnk_sc_save_ranking' or $step == 'cnk_sc_post_ranking')
	{
		foreach ($vars as $var)
		{
			$$var = '';
		}
	}

	echo '<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>'.

	form(

		startTable('edit') .

		tr(
			fLabelCell('Club').
			ranking_club_dropdown($club_id, ' ['.eLink('cnk_soccer', 'cnk_sc_edit_club', '', '', gTxt('edit')).']')
		).

		tr(
			fLabelCell('League').
			ranking_league_dropdown($league_id, ' ['.eLink('cnk_soccer', 'cnk_sc_edit_league', '', '', gTxt('edit')).']')
		).

		($club_id?
			tr(
				fLabelCell('Points').
				fInputCell('points', $points, 3, 3)
			).

			tr(
				fLabelCell('Goals for').
				fInputCell('goals_for', $goals_for, 4, 3)
			).

			tr(
				fLabelCell('Goals against').
				fInputCell('goals_against', $goals_against, 5, 3)
			).

			tr(
				fLabelCell('Games won').
				fInputCell('game_won', $game_won, 6, 3)
			).

			tr(
				fLabelCell('Games draw').
				fInputCell('game_draw', $game_draw, 7, 3)
			).

			tr(
				fLabelCell('Games lost').
				fInputCell('game_lost', $game_lost, 8, 3)
			)
		:'').

		tr(
			td().
			td(
				fInput('submit', '', gTxt('save'), 'publish')
			)
		).

		endTable().

		eInput('cnk_soccer').

		($club_id ? sInput('cnk_sc_save_ranking').hInput('old_club_id', $club_id).hInput('old_league_id', $league_id) : sInput('cnk_sc_post_ranking')).

		hInput('search_method', gps('search_method')).
		hInput('crit', gps('crit'))
	, 'margin-bottom: 25px;');

	echo cnk_sc_list_ranking();
}

function cnk_sc_list_ranking($message = '') 
{
	global $step, $cnk_sc_ranking_list_pageby;

	extract(get_prefs());

	extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));

	$dir = ($dir == 'desc') ? 'desc' : 'asc';

	switch ($sort)
	{
		case 'club':
			$sort_sql = 'cnk_soccer_clubs.name '.$dir.', cnk_soccer_league.name asc, cnk_soccer_league.season asc';
		break;

		case 'league':
			$sort_sql = 'cnk_soccer_league.name '.$dir.', cnk_soccer_league.season asc, cnk_soccer_clubs.name asc';
		break;

		default:
			$sort = 'club';
			$sort_sql = 'cnk_soccer_clubs.name '.$dir.', cnk_soccer_league.name asc, cnk_soccer_league.season asc';
		break;
	}

	$switch_dir = ($dir == 'desc') ? 'asc' : 'desc';

	$criteria = 1;

	if ($search_method and $crit)
	{
		$crit_escaped = doSlash($crit);

		$critsql = array(
			'club'			     => "cnk_soccer_clubs.name like '%$crit_escaped%'",
			'league'		     => "cnk_soccer_league.name like '%$crit_escaped%'"
		);

		if (array_key_exists($search_method, $critsql))
		{
			$criteria = $critsql[$search_method];
			$limit = 500;
		}

		else
		{
			$search_method = '';
			$crit = '';
		}
	}

	else
	{
		$search_method = '';
		$crit = '';
	}

	$total = getCount('cnk_soccer_club_to_league,cnk_soccer_clubs,cnk_soccer_league', "cnk_soccer_club_to_league.club_id = cnk_soccer_clubs.id AND cnk_soccer_club_to_league.league_id = cnk_soccer_league.id AND ".$criteria);  

	if ($total < 1)
	{
		if ($criteria != 1)
		{
			echo n.cnk_sc_search_form_ranking($crit, $search_method).
				n.graf(gTxt('no_results_found'), ' style="text-align: center;"');
		}

		else
		{
			echo n.graf('No rank recorded', ' style="text-align: center;"');
		}

		return;
	}

	$limit = max(@$cnk_sc_ranking_list_pageby, 15);

	list($page, $offset, $numPages) = pager($total, $limit, $page);

	echo cnk_sc_search_form_ranking($crit, $search_method);

	$rs = safe_rows_start("cnk_soccer_club_to_league.*, cnk_soccer_clubs.name as club, CONCAT(cnk_soccer_league.name, ' - ', cnk_soccer_league.season) as league", 'cnk_soccer_club_to_league,cnk_soccer_clubs,cnk_soccer_league', "cnk_soccer_club_to_league.club_id = cnk_soccer_clubs.id AND cnk_soccer_club_to_league.league_id = cnk_soccer_league.id AND $criteria order by $sort_sql limit $offset, $limit");

	if ($rs)
	{
		echo n.n.'<form action="index.php" method="post" name="longform" onsubmit="return verify(\''.gTxt('are_you_sure').'\')">',

			startTable('list').

			n.tr(
				cnk_sc_column_head('Club', 'name', 'cnk_soccer', 'cnk_sc_edit_ranking', true, $switch_dir, $crit, $search_method, ('club' == $sort) ? $dir : '').
				cnk_sc_column_head('League - Season', 'league', 'cnk_soccer', 'cnk_sc_edit_ranking', true, $switch_dir, $crit, $search_method, ('league' == $sort) ? $dir : '').
				cnk_sc_column_head('Points', 'points').
				cnk_sc_column_head('Goals for', 'goals_for').
				cnk_sc_column_head('Goals against', 'goals_against').
				cnk_sc_column_head('Games won', 'game_won').
				cnk_sc_column_head('Games draw', 'game_draw').
				cnk_sc_column_head('Games lost', 'game_lost').
				hCell()
			);

			while ($a = nextRow($rs))
			{
				extract($a);				

				$edit_url = '?event=cnk_soccer'.a.'step=cnk_sc_edit_ranking'.a.'club_id='.$club_id.a.'league_id='.$league_id.a.'sort='.$sort.
					a.'dir='.$dir.a.'page='.$page.a.'search_method='.$search_method.a.'crit='.$crit;

				echo tr(

					n.td(href(htmlspecialchars($club), $edit_url), 255).

					td($league, 255).

					td('<strong>'.$points.'</strong>', 20).

					td('<strong>'.$goals_for.'</strong>', 20).

					td('<strong>'.$goals_against.'</strong>', 20).

					td('<strong>'.$game_won.'</strong>', 20).

					td('<strong>'.$game_draw.'</strong>', 20).

					td('<strong>'.$game_lost.'</strong>', 20).

					td(fInput('checkbox', 'selected[]', $club_id.'_'.$league_id), 20)
				);
			}

		echo n.n.tr(
			tda(
				select_buttons().
				cnk_sc_multiedit_form_ranking($page, $sort, $dir, $crit, $search_method)
			, ' colspan="4" style="text-align: right; border: none;"')
		).

		endTable().
		'</form>'.

		n.cnk_sc_nav_form('cnk_soccer', 'cnk_sc_edit_ranking', $page, $numPages, $sort, $dir, $crit, $search_method).

		cnk_sc_pageby_form('cnk_soccer', 'cnk_sc_pageby_ranking', $cnk_sc_ranking_list_pageby).

		'<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>';
	}
}



function cnk_sc_search_form_ranking($crit, $method)
{
	$methods =	array(
		'club'				=> 'Club',
		'league'			=> 'League'
	);

	return search_form('cnk_soccer', 'cnk_sc_edit_ranking', $crit, $methods, $method, 'name');
}

function cnk_sc_multiedit_form_ranking($page, $sort, $dir, $crit, $search_method) 
{
	$methods = array(
		'delete' => gTxt('delete')
	);

	return cnk_sc_event_multiedit_form('cnk_soccer', 'cnk_sc_multi_edit_ranking', $methods, $page, $sort, $dir, $crit, $search_method);
}

function cnk_sc_pageby_ranking() 
{
	event_change_pageby('cnk_sc_ranking');
	cnk_sc_edit_ranking();
}

function cnk_sc_multi_edit_ranking() 
{
	$deleted = cnk_sc_event_multi_edit('cnk_soccer_club_to_league', 'club_id|league_id');

	if ($deleted)
	{
		$message = 'Rank deleted: '.$deleted;

		return 	cnk_sc_edit_ranking($message);
	}

	return 	cnk_sc_edit_ranking();
}

// ################################################################
// ################################################################
// ################################################################
/*
	Round Functions
*/
// ################################################################
// ################################################################
// ################################################################

function cnk_sc_save_round()
{
	global $txpcfg,$vars;
	$varray = gpsa($vars);
	$wrong_games = array();
	$wrong_ids = array();

	extract(doSlash($varray));

	$i = 0;

	while ($i < $games_per_round)
	{
		$i++;

		$club1_id = gps('club1_id_'.$i);
		$club2_id = gps('club2_id_'.$i);
		$kickoff_time = gps('kickoff_time_'.$i);
		$goals_club1 = gps('goals_club1_'.$i); 
		$goals_club2 = gps('goals_club2_'.$i);
		$id = gps('id_'.$i);

		$game = array
		(
			'id' => $id,
			'club1_id' => $club1_id,
			'club2_id' => $club2_id,
			'kickoff_time' => $kickoff_time,
			'goals_club1' => $goals_club1,
			'goals_club2' => $goals_club2		
		);

		if (trim($goals_club1) == '') $goals_club1 = 'NULL';
		if (trim($goals_club2) == '') $goals_club2 = 'NULL';

		if ((is_numeric($goals_club1) || $goals_club1 == 'NULL') && (is_numeric($goals_club2) || $goals_club2 == 'NULL'))
		{						
			// check if clubs are set

			if ($club1_id && $club2_id && $club1_id != $club2_id)
			{
				// check if club is already assigned to a game in this round

				$c = getCount('cnk_soccer_games', "id <> '".$id."' AND league_id = ".$league_id." AND round = ".$round." AND (club1_id in (".$club1_id.", ".$club2_id.") OR club2_id in (".$club1_id.", ".$club2_id."))");

				if (!$c)
				{
					$rs = false;
					$goals = false;

					if (has_privs('cnk_soccer_admin'))
					{
						if ($id)
						{
							// get previous goals
							$goals = safe_row('club1_id, club2_id, goals_club1, goals_club2', 'cnk_soccer_games', 'id = '.$id);

							$rs = safe_update("cnk_soccer_games",
							   "club1_id    = '$club1_id',
								club2_id    = '$club2_id',
								goals_club1    = $goals_club1,
								goals_club2    = $goals_club2,
								kickoff_time    = '$kickoff_time',
								status = '1'",
							   "id = $id"
							);
						}
						else
						{
							$rs = safe_insert("cnk_soccer_games",
							   "club1_id    = '$club1_id',
								club2_id    = '$club2_id',
								goals_club1    = $goals_club1,
								goals_club2    = $goals_club2,
								kickoff_time    = '$kickoff_time',
								league_id = '$league_id',
								status = '1',
								round = '$round'"
							);
						}
					}
					else
					{
						if ($id)
						{
							// get previous goals
							$goals = safe_row('club1_id, club2_id, goals_club1, goals_club2', 'cnk_soccer_games', 'id = '.$id);

							$rs = safe_update("cnk_soccer_games",
							   "goals_club1    = $goals_club1,
								goals_club2    = $goals_club2,
								status = '1'",
							   "id = $id AND status IS NULL"
							);
						}
					}

					if ($rs)
					{				
						// correct stats
						if ($goals && $goals['goals_club1'] != '' && $goals['goals_club2'] != '')
						{
							if ($goals['goals_club1'] > $goals['goals_club2'])
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points - 3,
									goals_for = goals_for - ".$goals['goals_club1'].",
									goals_against = goals_against - ".$goals['goals_club2'].",
									game_won = game_won - 1",
									"club_id = ".$goals['club1_id']." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"goals_for = goals_for - ".$goals['goals_club2'].",
									goals_against = goals_against - ".$goals['goals_club1'].",
									game_lost = game_lost - 1",
									"club_id = ".$goals['club2_id']." AND league_id = $league_id");
							} 
							else if ($goals['goals_club1'] < $goals['goals_club2'])
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points - 3,
									goals_for = goals_for - ".$goals['goals_club2'].",
									goals_against = goals_against - ".$goals['goals_club1'].",
									game_won = game_won - 1",
									"club_id = ".$goals['club2_id']." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"goals_for = goals_for - ".$goals['goals_club1'].",
									goals_against = goals_against - ".$goals['goals_club2'].",
									game_lost = game_lost - 1",
									"club_id = ".$goals['club1_id']." AND league_id = $league_id");
							}
							else if ($goals['goals_club1'] == $goals['goals_club2'])
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points - 1,
									goals_for = goals_for - ".$goals['goals_club1'].",
									goals_against = goals_against - ".$goals['goals_club2'].",
									game_draw = game_draw - 1",
									"club_id = ".$goals['club1_id']." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points - 1,
									goals_for = goals_for - ".$goals['goals_club2'].",
									goals_against = goals_against - ".$goals['goals_club1'].",
									game_draw = game_draw - 1",
									"club_id = ".$goals['club2_id']." AND league_id = $league_id");
							}
						}

						if ($goals_club1 != 'NULL' && $goals_club2 != 'NULL')
						{				
							if ($goals_club1 > $goals_club2)
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points + 3,
									goals_for = goals_for + ".$goals_club1.",
									goals_against = goals_against + ".$goals_club2.",
									game_won = game_won + 1",
									"club_id = ".$club1_id." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"goals_for = goals_for + ".$goals_club2.",
									goals_against = goals_against + ".$goals_club1.",
									game_lost = game_lost + 1",
									"club_id = ".$club2_id." AND league_id = $league_id");
							} 
							else if ($goals_club1 < $goals_club2)
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points + 3,
									goals_for = goals_for + ".$goals_club2.",
									goals_against = goals_against + ".$goals_club1.",
									game_won = game_won + 1",
									"club_id = ".$club2_id." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"goals_for = goals_for + ".$goals_club1.",
									goals_against = goals_against + ".$goals_club2.",
									game_lost = game_lost + 1",
									"club_id = ".$club1_id." AND league_id = $league_id");
							}
							else if ($goals_club1 == $goals_club2)
							{
								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points + 1,
									goals_for = goals_for + ".$goals_club1.",
									goals_against = goals_against + ".$goals_club2.",
									game_draw = game_draw + 1",
									"club_id = ".$club1_id." AND league_id = $league_id");

								$rs = safe_update("cnk_soccer_club_to_league",
									"points = points + 1,
									goals_for = goals_for + ".$goals_club2.",
									goals_against = goals_against + ".$goals_club1.",
									game_draw = game_draw + 1",
									"club_id = ".$club2_id." AND league_id = $league_id");
							}
						}
					}
				}
				else
				{
					$game['error'] = 'One of the clubs is already assigned to a game in this round.';
					array_push($wrong_games, $game);
					if ($id) $wrong_ids[$id] = true;
				}
			}
			else if ($club1_id || $club2_id || $id || $kickoff_time)
			{
				$game['error'] = 'Something is wrong with your club selections.';
				array_push($wrong_games, $game);
				if ($id) $wrong_ids[$id] = true;
			}
		}
		else
		{
			$game['error'] = 'Goals only accept numeric values.';
			array_push($wrong_games, $game);
			if ($id) $wrong_ids[$id] = true;
		}
	}

	//update lastmod due to link feeds
	update_lastmod();

	cnk_sc_edit_round('', $wrong_games, $wrong_ids);			
}

function cnk_sc_edit_round($message = '', $wrong_games = array(), $wrong_ids = array())
{
	global $vars, $step;

	pagetop('Edit Round', $message);

	extract(gpsa($vars));

	echo '<p class="prev-next"><a href="?event=cnk_soccer'.a.'step=cnk_sc_add_round">< Back to Rounds</a></p>';

	if ($round)
	{
		$round = assert_int($round);

		echo '<p class="prev-next">Round No. '.$round.'</p>'. // TODO: add league name

		n.n.'<form action="index.php" method="post" name="longform">',

			startTable('list').

				n.tr(
					cnk_sc_column_head('Home Team', 'club_1').
					cnk_sc_column_head('Away Team', 'club_2').
					cnk_sc_column_head('Kickoff (YYYY-MM-DD HH:MM)', 'kickoff_time').
					cnk_sc_column_head('Goals Home', 'goals_club1').
					cnk_sc_column_head('Goals Away', 'goals_club2')
				//	cnk_sc_column_head('Add points', 'goals_club2')
				);

				$games = safe_rows('*', 'cnk_soccer_games', "round = $round ORDER BY KICKOFF_TIME ASC");

				$i = 0;
				$a = 0;

				$games_per_round = has_privs('cnk_soccer_admin')?getThing('SELECT games_per_round FROM '.safe_pfx('cnk_soccer_league').' WHERE id = '.$league_id):count($games);

				while ($i < $games_per_round)
				{				
					if (isset($games[$i]) && !isset($wrong_ids[$games[$i]['id']]))
					{ 
						extract($games[$i]);
						$error = '';
					}
					else if (isset($wrong_games[$a]))
					{
						extract($wrong_games[$a]);
						$a++;
					}
					else
					{
						$club1_id = NULL;
						$club2_id = NULL;
						$kickoff_time = '';
						$goals_club1 = ''; 
						$goals_club2 = '';
					//	$status = '';
						$id = '';
						$error = '';
					}

					$i++;

					echo tr(

						round_club_dropdown($club1_id, 'club1_id_'.$i, $league_id, !has_privs('cnk_soccer_admin')).

						round_club_dropdown($club2_id, 'club2_id_'.$i, $league_id, !has_privs('cnk_soccer_admin')).

						(has_privs('cnk_soccer_admin')?tda(fInput('text', 'kickoff_time_'.$i, $kickoff_time, 'edit', '', '', 16, 1)):tda($kickoff_time.hInput('club1_id_'.$i, $club1_id).hInput('club2_id_'.$i, $club2_id))).

						tda(fInput('text', 'goals_club1_'.$i, $goals_club1, 'edit', '', '', 2, 2)).

						tda(fInput('text', 'goals_club2_'.$i, $goals_club2, 'edit', '', '', 2, 3).hInput('id_'.$i, $id))

					//	td(($status==''?fInput('checkbox', 'add_points_'.$i, '1'):'added').hInput('id_'.$i, $id), 120)
					, $error?' style="background-color:red" title="'.$error.'"':'');
				}

		//	if (has_privs('cnk_soccer_admin'))

				echo tr(
					td().
					td().
					td().
					td().
				//	td().
					td(
						fInput('submit', '', gTxt('save'), 'publish')
					)
				).

			endTable().

		eInput('cnk_soccer').

		sInput('cnk_sc_save_round').

		hInput('round', $round).
		hInput('league_id', $league_id).
		hInput('games_per_round', $games_per_round).

		'</form>';
	}
}

function round_league_dropdown($league_id = '', $help = '') 
{
	$league_array = array();

	$rs = safe_rows_start("id, CONCAT(name, ' - ', season) as title", 'cnk_soccer_league', "1=1 order by name asc, season asc");

	while ($r = nextRow($rs))
	{
		$league_array[$r['id']] = $r['title'];
	}

	return tda(selectInput('league_id', $league_array, $league_id).$help);	
}

function round_club_dropdown($club_id = '', $name, $league_id, $readonly = false) 
{
	global $club_array;

	if ($club_array === NULL)
	{
		$club_array = array();

		$rs = safe_rows_start("cnk_soccer_clubs.id, cnk_soccer_clubs.name as title", 'cnk_soccer_clubs,cnk_soccer_club_to_league', "cnk_soccer_clubs.id = cnk_soccer_club_to_league.club_id AND cnk_soccer_club_to_league.league_id = $league_id order by cnk_soccer_clubs.name asc");

		while ($r = nextRow($rs))
		{
			$club_array[$r['id']] = $r['title'];
		}
	}

	if ($readonly)
	{
		return tda($club_array[$club_id]);
	}
	else
	{
		return tda(selectInput($name, $club_array, $club_id, true));	
	}
}

function cnk_sc_add_round($message = '')
{
	global $vars, $step;

	pagetop('Add round', $message);

	echo '<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>';

	if (has_privs('cnk_soccer_admin'))
	{
		echo form(

			startTable('edit') .

			tr(
				fLabelCell('League').
				round_league_dropdown('', ' ['.eLink('cnk_soccer', 'cnk_sc_edit_league', '', '', gTxt('edit')).']')
			).

			tr(
				fLabelCell('Round #').
				fInputCell('round', '', 2, 2)
			).

			tr(
				td().
				td(
					fInput('submit', '', 'Add', 'publish')
				)
			).

			endTable().

			eInput('cnk_soccer').

			sInput('cnk_sc_edit_round').

			hInput('search_method', gps('search_method')).
			hInput('crit', gps('crit'))
		, 'margin-bottom: 25px;');
	}

	echo cnk_sc_list_rounds();
}

function cnk_sc_list_rounds($message = '') 
{
	global $step, $cnk_sc_rounds_list_pageby;

	extract(get_prefs());

	extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));

	$dir = ($dir == 'desc') ? 'desc' : 'asc';

	switch ($sort)
	{
		case 'league':
			$sort_sql = 'cnk_soccer_league.name '.$dir.', cnk_soccer_league.season asc, cnk_soccer_games.round desc';
		break;

		case 'season':
			$sort_sql = 'cnk_soccer_league.season '.$dir.', cnk_soccer_league.name asc, cnk_soccer_games.round desc';
		break;

		case 'round':
			$sort_sql = 'cnk_soccer_games.round '.$dir.', cnk_soccer_league.name asc, cnk_soccer_league.season asc';
		break;

		default:
			$sort = 'league';
			$sort_sql = 'cnk_soccer_league.name '.$dir.', cnk_soccer_league.season asc, cnk_soccer_games.round desc';
		break;
	}

	$switch_dir = ($dir == 'desc') ? 'asc' : 'desc';

	$criteria = 1;

	if ($search_method and $crit)
	{
		$crit_escaped = doSlash($crit);

		$critsql = array(
			'league'		     => "cnk_soccer_league.name like '%$crit_escaped%'",
			'season'	 => "cnk_soccer_league.season like '%$crit_escaped%'",
			'round'		     => "cnk_soccer_games.round = '$crit_escaped'"
		);

		if (array_key_exists($search_method, $critsql))
		{
			$criteria = $critsql[$search_method];
			$limit = 500;
		}

		else
		{
			$search_method = '';
			$crit = '';
		}
	}

	else
	{
		$search_method = '';
		$crit = '';
	}

	$total = getCount('cnk_soccer_games,cnk_soccer_league', "cnk_soccer_league.id = cnk_soccer_games.league_id AND ".$criteria." GROUP BY league_id");

	if ($total < 1)
	{
		if ($criteria != 1)
		{
			echo n.cnk_sc_search_form_league($crit, $search_method).
				n.graf(gTxt('no_results_found'), ' style="text-align: center;"');
		}

		else
		{
			echo n.graf('No round recorded', ' style="text-align: center;"');
		}

		return;
	}

	$limit = max(@$cnk_sc_rounds_list_pageby, 15);

	list($page, $offset, $numPages) = pager($total, $limit, $page);

	echo cnk_sc_search_form_rounds($crit, $search_method);

	$rs = safe_rows_start("cnk_soccer_games.round, cnk_soccer_games.league_id, cnk_soccer_league.name as league, cnk_soccer_league.season as season", 'cnk_soccer_games,cnk_soccer_league', "cnk_soccer_games.league_id = cnk_soccer_league.id AND $criteria group by $sort_sql limit $offset, $limit");

	if ($rs)
	{
		echo n.n.'<form action="index.php" method="post" name="longform" onsubmit="return verify(\''.gTxt('are_you_sure').'\')">',

			startTable('list').

			n.tr(
				cnk_sc_column_head('League', 'league', 'cnk_soccer', 'cnk_sc_add_round', true, $switch_dir, $crit, $search_method, ('league' == $sort) ? $dir : '').
				cnk_sc_column_head('Season', 'season', 'cnk_soccer', 'cnk_sc_add_round', true, $switch_dir, $crit, $search_method, ('season' == $sort) ? $dir : '').
				cnk_sc_column_head('Round #', 'round', 'cnk_soccer', 'cnk_sc_add_round', true, $switch_dir, $crit, $search_method, ('round' == $sort) ? $dir : '').
				hCell().
				hCell()
			);

			while ($a = nextRow($rs))
			{
				extract($a);				

				$edit_url = '?event=cnk_soccer'.a.'step=cnk_sc_edit_round'.a.'round='.$round.a.'league_id='.$league_id.a.'sort='.$sort.
					a.'dir='.$dir.a.'page='.$page.a.'search_method='.$search_method.a.'crit='.$crit;

				echo tr(

					td(htmlspecialchars($league), 255).

					td(htmlspecialchars($season), 150).

					td(htmlspecialchars($round), 150).

					td(href(gTxt('edit'), $edit_url), 40).

					td(has_privs('cnk_soccer_admin')?fInput('checkbox', 'selected[]', $round.'_'.$league_id):'', 20)
				);
			}

		if (has_privs('cnk_soccer_admin'))
		{
			echo n.n.tr(
				tda(
					select_buttons().
					cnk_sc_multiedit_form_rounds($page, $sort, $dir, $crit, $search_method)
				, ' colspan="4" style="text-align: right; border: none;"')
			);
		}

		echo endTable().
		'</form>'.

		n.cnk_sc_nav_form('cnk_soccer', 'cnk_sc_add_round', $page, $numPages, $sort, $dir, $crit, $search_method).

		cnk_sc_pageby_form('cnk_soccer', 'cnk_sc_pageby_rounds', $cnk_sc_rounds_list_pageby).

		'<p class="prev-next"><a href="?event=cnk_soccer">< Back to Soccer Menu</a></p>';
	}
}



function cnk_sc_search_form_rounds($crit, $method)
{
	$methods =	array(
		'league'				=> 'League',
		'round'				=> 'Round',
		'season' 			=> 'Season'
	);

	return search_form('cnk_soccer', 'cnk_sc_add_round', $crit, $methods, $method, 'name');
}

function cnk_sc_multiedit_form_rounds($page, $sort, $dir, $crit, $search_method) 
{
	$out = '';

	$methods = array(
		'delete' => gTxt('delete')
	);

	return cnk_sc_event_multiedit_form('cnk_soccer', 'cnk_sc_multi_edit_rounds', $methods, $page, $sort, $dir, $crit, $search_method);
}

function cnk_sc_pageby_rounds() 
{
	event_change_pageby('cnk_sc_rounds');
	cnk_sc_add_round();
}

function cnk_sc_multi_edit_rounds() 
{
	$deleted = cnk_sc_event_multi_edit('cnk_soccer_games', 'round|league_id');

	if ($deleted && has_privs('cnk_soccer_admin'))
	{
		$message = 'Rounds deleted: '.$deleted;

		return 	cnk_sc_add_round($message);
	}

	return 	cnk_sc_add_round();
}

// ################################################################
// ################################################################
// ################################################################
/*
	Soccer installation / deinstallation
*/
// ################################################################
// ################################################################
// ################################################################
function cnk_sc_install()
{
	pagetop('Soccer Plugin Installation', '');

	echo '<div style="margin:auto; text-align:center">';

	// check if tables already installed
	$test = getThing('SELECT name FROM '.safe_pfx('txp_prefs')." WHERE name = 'cnk_sc_league_list_pageby'");

	if ($test)
	{
		echo '<p>Plugin already installed</p>';
	}
	else
	{	
		if (cnk_sc_do_install())
		{
			echo '<p>Installation was successful</p>';
		}
		else
		{
			echo '<p>Installation aborted</p>';
		}
	}

	echo '</div>';
}

function cnk_sc_do_install()
{
global $DB;
$version = mysqli_get_server_info();
//Use "ENGINE" if version of MySQL > (4.0.18 or 4.1.2)
$tabletype = ( intval($version[0]) >= 5 || preg_match('#^4\.(0\.[2-9]|(1[89]))|(1\.[2-9])#',$version)) 
	? " ENGINE=MyISAM " 
	: " TYPE=MyISAM ";

// On 4.1 or greater use utf8-tables
if (intval($version[0]) >= 5 || preg_match('#^4\.[1-9]#',$version)) 
{
global $DB;
	$tabletype .= " CHARACTER SET = utf8 ";
	$tabletype .= " COLLATE utf8_general_ci ";
	mysqli_query("SET NAMES ".$dbcharset);
}

// insert tables and test data

$sql = "CREATE TABLE ".safe_pfx('cnk_soccer_clubs')." (
  id int(11) NOT NULL auto_increment,
  country varchar(255) NOT NULL default 'default',
  `name` varchar(255) NOT NULL,
  logo varchar(255) default NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY `name` (`name`),
  KEY country (country)
) ".$tabletype.";

CREATE TABLE ".safe_pfx('cnk_soccer_club_to_league')." (
  club_id int(11) NOT NULL,
  league_id int(11) NOT NULL,
  points tinyint(4) NOT NULL default '0',
  goals_for tinyint(4) NOT NULL default '0',
  goals_against tinyint(4) NOT NULL default '0',
  game_won tinyint(4) NOT NULL default '0',
  game_draw tinyint(4) NOT NULL default '0',
  game_lost tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (club_id,league_id)
) ".$tabletype.";

CREATE TABLE ".safe_pfx('cnk_soccer_games')." (
  id int(11) NOT NULL auto_increment,
  league_id int(11) NOT NULL,
  round TINYINT NOT NULL,
  club1_id int(11) NOT NULL,
  club2_id int(11) NOT NULL,
  kickoff_time datetime NOT NULL,
  goals_club1 tinyint(4) default NULL,
  goals_club2 tinyint(4) default NULL,
  `status` char(1) default NULL,
  PRIMARY KEY  (id),
  KEY kickoff_time (kickoff_time),
  KEY league_id (league_id),
  KEY club1_id (club1_id),
  KEY club2_id (club2_id),
  KEY `status` (`status`)
) ".$tabletype.";

CREATE TABLE ".safe_pfx('cnk_soccer_league')." (
  id int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  season varchar(9) default NULL,
  total_rounds TINYINT NOT NULL DEFAULT '36',
  games_per_round TINYINT NOT NULL DEFAULT '10',
  PRIMARY KEY  (id),
  UNIQUE KEY `name` (`name`,`season`)
) ".$tabletype.";";

if (!cnk_sc_batch_query($sql)) return false;

// insert prefs

$sql = "INSERT INTO ".safe_pfx('txp_prefs')." (`prefs_id`, `name`, `val`, `type`, `event`, `html`, `position`) VALUES 
('1', 'cnk_sc_league_list_pageby', '15', '2', 'publish', 'text_input', '0'),
('1', 'cnk_sc_club_list_pageby', '15', '2', 'publish', 'text_input', '0'),
('1', 'cnk_sc_ranking_list_pageby', '15', '2', 'publish', 'text_input', '0'),
('1', 'cnk_sc_rounds_list_pageby', '15', '2', 'publish', 'text_input', '0');";

if (!cnk_sc_batch_query($sql)) return false;

return true;

}

function cnk_sc_deinstall()
{
	pagetop('Soccer Plugin Deinstallation', '');

	echo '<div style="margin:auto; text-align:center">';

	// check if tables already installed
	$test = getThing('SELECT name FROM '.safe_pfx('txp_prefs')." WHERE name = 'cnk_sc_league_list_pageby'");

	if (!$test)
	{
		echo '<p>Plugin not installed</p>';
	}
	else
	{	
		if (gps('do_deinstall'))
		{
			if (cnk_sc_do_deinstall())
			{
				echo '<p>Deinstallation was successful</p>';
			}
			else
			{
				echo '<p>Deinstallation aborted</p>';
			}
		}
		else
		{
			echo '<a href="?event=cnk_soccer'.a.'step=cnk_sc_deinstall'.a.'do_deinstall=1">Yes, I really want to deinstall</a>';
		}
	}

	echo '</div>';
}

function cnk_sc_do_deinstall()
{

// drop tables

$sql = "DROP TABLE ".safe_pfx('cnk_soccer_clubs').";
DROP TABLE ".safe_pfx('cnk_soccer_club_to_league').";
DROP TABLE ".safe_pfx('cnk_soccer_games').";
DROP TABLE ".safe_pfx('cnk_soccer_league');

if (!cnk_sc_batch_query($sql)) return false;

// delete prefs

$sql = "DELETE FROM ".safe_pfx('txp_prefs')." WHERE name IN ('cnk_sc_league_list_pageby', 'cnk_sc_club_list_pageby', 'cnk_sc_ranking_list_pageby', 'cnk_sc_rounds_list_pageby')";

if (!cnk_sc_batch_query($sql)) return false;

return true;

}

function cnk_sc_batch_query ($p_query, $p_transaction_safe = true) 
{
	if ($p_transaction_safe) 
	{
		$p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
	}

	$query_split = preg_split ("/[;]+/", $p_query);

	foreach ($query_split as $command_line) 
	{
		$command_line = trim($command_line);

		if ($command_line != '') 
		{
			$query_result = safe_query($command_line);

			if ($query_result === false) 
			{
				break;
			}
		}
	}

	return $query_result;
}

// ################################################################
// ################################################################
// ################################################################
/*
	Custom TXP Functions
*/
// ################################################################
// ################################################################
// ################################################################

function cnk_sc_column_head($value, $sort = '', $event = '', $step = '', $is_link = '', $dir = '', $crit = '', $method = '', $class = '')
{
	return cnk_sc_column_multi_head( array(
				array ('value' => $value, 'sort' => $sort, 'event' => $event, 'is_link' => $is_link,
					   'dir' => $dir, 'crit' => $crit, 'method' => $method, 'step' => $step)
			), $class);
}

function cnk_sc_column_multi_head($head_items, $class='')
{
	$o = n.t.'<th'.($class ? ' class="'.$class.'"' : '').'>';
	$first_item = true;
	foreach ($head_items as $item)
	{
		if (empty($item)) continue;
		extract(lAtts(array(
			'value'		=> '',
			'sort'		=> '',
			'event'		=> '',
			'step'		=> '',
			'is_link'	=> '',
			'dir'		=> '',
			'crit'		=> '',
			'method'	=> '',
		),$item));

		$o .= ($first_item) ? '' : ', '; $first_item = false;

		if ($is_link)
		{
			$o .= '<a href="index.php?';

			$o .= ($step) ? a."step=$step" : '';
			$o .= ($event) ? a."event=$event" : '';
			$o .= ($sort) ? a."sort=$sort" : '';
			$o .= ($dir) ? a."dir=$dir" : '';
			$o .= ($crit) ? a."crit=$crit" : '';
			$o .= ($method) ? a."search_method=$method" : '';

			$o .= '">';
		}

		$o .= gTxt($value);

		if ($is_link)
		{
			$o .= '</a>';
		}
	}
	$o .= '</th>';

	return $o;
}

function cnk_sc_pageby_form($event, $step, $val)
{
	$vals = array(
		15  => 15,
		25  => 25,
		50  => 50,
		100 => 100
	);

	$select_page = selectInput('qty', $vals, $val,'', 1);

	// proper localisation
	$page = str_replace('{page}', $select_page, gTxt('view_per_page'));

	return form(
		'<div style="margin: auto; text-align: center;">'.
			$page.
			eInput($event).
			sInput($step).
			'<noscript> <input type="submit" value="'.gTxt('go').'" class="smallerbox" /></noscript>'.
		'</div>'
	);
}

function cnk_sc_event_multiedit_form($name, $step, $methods = null, $page, $sort, $dir, $crit, $search_method)
{
	$method = ps('edit_method');

	if ($methods === NULL)
	{
		$methods = array(
			'delete' => gTxt('delete')
		);
	}

	return '<label for="withselected">'.gTxt('with_selected').'</label>'.sp.
		selectInput('edit_method', $methods, $method, 1,
			( ($name == 'list') ? ' id="withselected" onchange="poweredit(this); return false;"' : ' id="withselected"' )
		).
		n.eInput($name).
		n.sInput($step).
		n.hInput('page', $page).
		( $sort ? n.hInput('sort', $sort).n.hInput('dir', $dir) : '' ).
		( $crit ? n.hInput('crit', $crit).n.hInput('search_method', $search_method) : '' ).
		n.fInput('submit', '', gTxt('go'), 'smallerbox');
}

function cnk_sc_PrevNextLink($event, $step, $page, $label, $type, $sort = '', $dir = '', $crit = '', $search_method = '')
{
	return '<a href="?event='.$event.a.'step='.$step.a.'page='.$page.
		($sort ? a.'sort='.$sort : '').
		($dir ? a.'dir='.$dir : '').
		($crit ? a.'crit='.$crit : '').
		($search_method ? a.'search_method='.$search_method : '').
		'" class="navlink">'.
		($type == 'prev' ? '&#8249;'.sp.$label : $label.sp.'&#8250;').
		'</a>';
}

function cnk_sc_nav_form($event, $step, $page, $numPages, $sort, $dir, $crit, $search_method)
{
	if ($numPages > 1)
	{
		$option_list = array();

		for ($i = 1; $i <= $numPages; $i++)
		{
			if ($i == $page)
			{
				$option_list[] = '<option value="'.$i.'" selected="selected">'."$i/$numPages".'</option>';
			}

			else
			{
				$option_list[] = '<option value="'.$i.'">'."$i/$numPages".'</option>';
			}
		}

		$nav = array();

		$nav[] = ($page > 1) ?
			cnk_sc_PrevNextLink($event, $step, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method).sp :
			tag('&#8249; '.gTxt('prev'), 'span', ' class="navlink-disabled"').sp;

		$nav[] = '<select name="page" class="list" onchange="submit(this.form);">';
		$nav[] = n.join(n, $option_list);
		$nav[] = n.'</select>';
		$nav[] = '<noscript> <input type="submit" value="'.gTxt('go').'" class="smallerbox" /></noscript>';

		$nav[] = ($page != $numPages) ?
			sp.cnk_sc_PrevNextLink($event, $step, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method) :
			sp.tag(gTxt('next').' &#8250;', 'span', ' class="navlink-disabled"');

		return '<form class="prev-next" method="get" action="index.php">'.
			n.eInput($event).
			n.sInput($step).
			( $sort ? n.hInput('sort', $sort).n.hInput('dir', $dir) : '' ).
			( $crit ? n.hInput('crit', $crit).n.hInput('search_method', $search_method) : '' ).
			join('', $nav).
			'</form>';
	}

	else
	{
		return graf($page.'/'.$numPages, ' class="prev-next"');
	}
}

function cnk_sc_event_multi_edit($table, $id_key) // TODO: replace $id_key with array
{
	$method = ps('edit_method');
	$selected = ps('selected');

	$id_keys = explode('|', $id_key);

	if ($selected)
	{
		if ($method == 'delete')
		{
			foreach ($selected as $id)
			{
				$where = array();
				$id_arr = explode('_', $id);

				for ($i=0; $i < count($id_keys); $i++)
				{
					array_push($where, $id_keys[$i].' = '.$id_arr[$i]);
				}

				if (safe_delete($table, implode(' AND ', $where)))
				{
					$ids[] = $id;
				}
			}

			return join(', ', $ids);
		}
	}

	return '';
}

Regards, Nick

Offline

#35 2019-02-26 22:55:44

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,292
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Hi arellanon,

Have a go with this one. All I’ve looked at for the time being is the install and deinstall routine. They now use txp’s own create/remove table and prefs functions but you still have to go through the Content › Soccer tab to install and deinstall. In my tests installation works as do the panels afterwards (PHP 7.2 and Textpattern 4.7.3), though I’ve not entered any details. I don’t know anything about the plugin (or that much about football leagues) so you’ll still need to figure out how to use the rest of the plugin.

Oh, and I also added the public tags to the registry so you don’t get an error further down the line.

EDIT: see below for an updated version:


TXP Builders – finely-crafted code, design and txp

Online

#36 2019-02-27 04:16:31

arellanon
New Member
From: San Jose, CA
Registered: 2019-02-26
Posts: 7
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

It installed! Using (PHP 7.0 and Textpattern 4.7.3). I upgraded the PHP to 7.2 after installation because I got the following error. I got this when I populated the database using the forms provided.

Fatal error: Uncaught Error: Call to undefined function select_buttons() in /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code:589 Stack trace: #0 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code(460): cnk_sc_list_club() #1 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code(348): cnk_sc_edit_club(‘Club updated: R…’) #2 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code(221): cnk_sc_save_club() #3 /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1989): cnk_soccer(‘cnk_soccer’, ‘cnk_sc_save_clu…’) #4 /home/newsrealsanjose/public_html/textpattern/index.php(258): callback_event(‘cnk_soccer’, ‘cnk_sc_save_clu…’, 0) #5 {main} thrown in /home/newsrealsanjose/public_html/textpattern/lib/txplib_misc.php(1870) : eval()’d code on line 589


Regards, Nick

Offline

#37 2019-02-27 10:02:37

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,292
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Hmm, the function select_buttons no longer exists in txp but was previously part of the multi-edit options. For the moment I simply removed it and silenced another error that showed after adding a club or league. It seems to now add items when you input them and show the table.

Try this update:

# Name: cnk_soccer v1.2 (compressed)
# Type: Admin/Public plugin
# Manages football league, clubs and games and displays statistics
# Author: Christian Nowak / edits jcr
# URL: http://www.cnowak.de
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA+19+1vbxtLwz/BXbFQnsk8cGTshbQGTQ4E0fCWQl5BzTp80jx9hC9AbY7mS
DOHr6f/+zmVvuvlCIKQX+jSW9jI7Ozs7O7szO/LX2qtrvyVrz9ackX8ROOvJWntlzemPPvaS
qN8PYkz5ds25DOIkjEb49nTNaXsdfPpuzYmDy1BlQD38eb7m+JP0PKKqHai7fR6HSRr6I3EQ
XfkfRUsEgzBNxP/2Y9UeV+hN4pAqQcp5mo7XWq2rqyuvP8Jq3oCxa685gyDpx+E4le0+B+Rf
+yP/LEjEaRSlJ/5wKIaBfzYJmqI/nJwkwh8NxBn0j58GYTIe+teJSFI/RdT6CcJZXXOieMBd
hlZW8RdAp9fjQCa1ZbHToX+WyLQVSYk0+JSO/f5HixLYs2HkD3plYM+D4Zgen30PbxtJej0M
Npc9pHzqny3/tnwCwM7iaDIaPOlHwyheOxlCyvoyv1ydh2mwvjz2B4NwdLa2Ov60vnzhx2fh
6EkajaFpTPid4Q2ikZ8GZSC/2d3dyQH5XeFwMsQqQpwQ9lhh6I+TYE09ZIuKdGCVXmuPP4lB
lKbBQHzz9OnTdchRrYhn3MxGS/Z5eeO8vQkEiKPR2eb2wU+9t4fb27tHmE9Jou2teCsbLSgF
RTubO2b4IbEDieNNHn9xHU3imTzgbbTGVGnrNA1irCPO/ctAhCPgh+EQUE7PAzEeToCY4jSO
Lui9H43SYJSKTcETQ0C3m1T5wr8WVz5kpRFxtl39PPCBHFB5AHhAfhKkwhfjOBpDaniBOI/9
9BxwjglNMYzOIsYVSkObp+HZJIZCQXwRJjjToFeXwTDxxM/RxIVOnoZQ9hTGJLoC6opnYhiO
kM8ZjZMAsBhhRnRq44UIrTEd8HFzYxzDSCwNAgA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D7hf+6BgfrUiBXs69dqXbpkqHWPknSmhMD
3TydF9gf0qldnYOuZ8tOSoWWIcFGqMcIqfsEcu3prvDKo0I3yZ40zPKjgxVlAt9ho7qDFGAJ
5pD8+AS2bIVckvGCsLP2obYaqPBCIkh3fRBJAt5oZL+Eg2GfKPZAOFBgNWzJUsyGTcEdTRqW
VURNVdQFnPVk7emaczFYpafOmnPaP1n9dvX7b4PTp89Pnj5/Omh/3z8dnAT+0+DZt4NvO876
7/8HGJR7W9kAAQA=

Otherwise, I think the plugin is definitely in need of some love as much of the way it does things is very old or custom. The table display mechanisms are quite old and in my opinion, the entire soccer item should be its own menu item with the panels as individual entries in the drop-down rather than the current tier arrangement.

The author has since gone on to much bigger things and last visited the forum 6 years ago, so I suspect you won’t get any help there. The plugin is quite specific so I’m not how many people are interested in an update. If it’s very important to you – or others also using it – you might want to post in the developers wanted thread for (potentially paid) assistance in updating the plugin.


TXP Builders – finely-crafted code, design and txp

Online

#38 2019-02-27 15:46:12

arellanon
New Member
From: San Jose, CA
Registered: 2019-02-26
Posts: 7
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Thank you for helping. I am finding out quickly that most plugins are out of date. So far I tried this one, a store, and will try a calendar next. Now that all the databases are in place, I will try to hack around and see if I can make work for my specific needs. realsanjose.net is my site. I am also trying to find a way to reorder the navigation buttons of the sections. I tried a plugin for that and sort of got it to work but it will require me to figure out how to make look the same as the one I have.


Regards, Nick

Offline

#39 2019-02-27 16:02:23

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,292
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

arellanon wrote #316778:

Thank you for helping. I am finding out quickly that most plugins are out of date.

It varies. A lot are no longer necessary but specific cases such as this are definitely plugin territory and people come and go…

I am also trying to find a way to reorder the navigation buttons of the sections. I tried a plugin for that and sort of got it to work but it will require me to figure out how to make look the same as the one I have.

If you don’t mind explicitly naming the sections you want, you can use the sections attribute in txp:section_list and enter the section names separated by commas in the order you want them (remove any sort attribute you might have). That’s normally fine for a site you control as you can update that should you add new sections at some later date.

If you need to build it flexibly, you could try esq_sectionsort. That allows you to drag and drop the sections in the Presentation › Sections pane. In your section_list tag, you then add sort="sectionsort desc" (or asc as you need it) to make the sections sort according to their position on the sections pane. Here you should leave out the sections attribute (i.e. don’t mix it with the above tip). If you don’t want all the sections to show, then use the exclude attribute.


TXP Builders – finely-crafted code, design and txp

Online

#40 2019-02-27 19:10:05

arellanon
New Member
From: San Jose, CA
Registered: 2019-02-26
Posts: 7
Website

Re: [plugin] [ORPHAN] cnk_soccer - A football plugin

Got the nav going using esq_sectionsort. Thank You!


Regards, Nick

Offline

Board footer

Powered by FluxBB