Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2015-11-19 01:06:24

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 282
Website

Re: geo_vote

I’m with you in spirit xxx to all txpers.

I haven’t been designing sites lately.

Please feel free to tear it to pieces.
I’m not sure it’s great coding.
I remember some strange logic and case statements.
Also a hack that sets a ten minute expiry on the poll form?
That was put in as a security issue but I remember not being completely comfortable with the code but it worked.

To be honest the cookie and ip methods are so easily circumvented, logged in voting is the only meaningful way.

Which makes it so much easier to implement.

Please release it as your own plugin.
Good luck …

This is a great CMS good to see it still moving forward.

Last edited by geoff777 (2015-11-19 01:15:43)


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#17 2015-11-19 10:29:44

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: geo_vote

Thank you, Geoff.
I’ll do my best to be up to it.

Offline

#18 2018-02-28 14:06:27

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

Hi,

is there only this plugin for make a voting?
If yes: Could make the “Title” for the vote longer, instead 64 signs I wish to shown the question longer than 64 signs on my website.

My try to make it longer inside plugin:

$sql[] = "CREATE TABLE IF NOT EXISTS `".PFX.GEO_VOTE_META."` (
			`vote_id` int(4) NOT NULL auto_increment PRIMARY KEY,
			`vote_title` varchar(264) NULL default '', //varchar(64) NULL default '',

doesnt work. Any ideas?

Best regards
Lythande

Offline

#19 2018-03-01 11:06:54

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

lythande wrote #309527:

My try to make it longer inside plugin […] doesnt work. Any ideas?

Hi lythande, have you tried that after installing the plugin? That wouldn’t work, the table creation process is finished, then. Either edit it in ied_plugin_composer, save as a plugin file, de-install (maybe you have to delete the geo_vote tables), then re-install your version or, probably better, edit that table’s meta data immediately in the DB.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#20 2018-03-02 00:18:55

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

uli wrote #309541:

… or, probably better, edit that table’s meta data immediately in the DB.

that was a better idea and it works! I have in the line write “ Varchar 364”, but then changing the MySQL it into a “text” – this works good too! Much thanks!

But why is the Kollation from the geo_vote_.. in “latin1_swedish_ci” and not in “utf8_general_ci”? I have only installed German as Language and all other databases for the one website have “utf8_general_ci”.

Last edited by lythande (2018-03-02 00:19:40)

Offline

#21 2018-03-02 10:54:11

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

lythande wrote #309565:

But why is the Kollation from the geo_vote_.. in “latin1_swedish_ci” and not in “utf8_general_ci”?

Just speculating and voilà.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#22 2018-03-08 11:55:02

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

Much thanks, uli.

Now I have tried to install this plugin in textpattern 4.6.2 and get an Error, the Script for install the Plugin (after upload the plugin I activated it and then go to “Expansions – Vote”) would not answer… Is the Plugin for textpatter 4.6.2?
Is there an another Plugin, that would works too?

Last edited by lythande (2018-03-08 11:57:56)

Offline

#23 2018-03-08 14:55:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

I’ve quickly installed the plugin from the topmost post here in my local 4.6.2 and can’t replicate your error. I can open the Vote panel and have the usual green message “Tables installed” at the bottom of the page.

Try to visit that page with all plugins other than geo_vote de-activated. If there’s a change in behaviour, re-activate plugins. If all goes well everything might be functional, then. In case not: De-activate plugins again and re-activate one by one in order to find the culprit. Good luck!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#24 2018-03-08 23:05:12

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

I tried it and got still an 500-Error. Tomorrow I look in the MySQL-Database…

Last edited by lythande (2018-03-08 23:08:57)

Offline

#25 2018-03-09 06:42:21

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

In the Database are no new tables.
And in the File for Textpattern is drwxr-xr-x / 755. Same how my old website.

Only the MySQL-version is other:
new website: MySQL: 5.6.19-67.0-log
old website: MySQL: 4.1.22-log

Plugins:
new Website:
Aktive Plugins: com_connect-4.6.0-beta, yab_email-0.7, smd_wrap-0.20, rah_gps-0.1, soo_toc-0.1.5, rah_external_output-1.1.0, soo_image-1.0.b.9, soo_plugin_pref-0.2.3, soo_txp_obj-1.1.2

old website:
Aktive Plugins: hak_article_image-0.6.3, rss_thumbpop-0.7m, glx_image_count-0.2, wet_thumbfilter-0.6, asy_wondertag-0.5, zem_contact_reborn-4.0.3.20m, zem_contact_lang-de-4.0.3.6m, pap_contact_cleaner-0.1, smd_if-0.81, chh_if_data-0.10, smd_gallery-0.52, mg_setheader-0.1, dtj_obfuscated_email-0.3, wet_slimpattern-0.4.1, soo_toc-0.1.4, wyn_recent_comments-0.1, smd_wrap-0.20, rah_gps-0.1, stm_article_order-0.2, upm_image-0.6.2, soo_image-1.0.b.8, upm_textile-0.3, rah_external_output-1.1.0, geo_vote-0.1.4m, smd_lib-0.36, soo_plugin_pref-0.2.2, soo_txp_obj-1.1.0
(not all Plugins i need – i have tried many ways for images… and zem contact reborn is not work in the new website. dtj_obfuscated_email too.)

Edit: in the Diagnose I found a little bit difference:
new website:

#php_value register_globals 0
<IfModule mod_mime.c>
    AddType image/svg+xml  svg svgz
    AddEncoding gzip       svgz
</IfModule>
# END Textpattern
------------------------
Charset (default/config): latin1/utf8mb4
character_set_client: utf8mb4
character_set_connection: utf8mb4
character_set_database: utf8
character_set_filesystem: binary
character_set_results: utf8mb4
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/charsets/
17 Tables: OK

old Website:

#php_value register_globals 0
------------------------
Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: latin1
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
17 Tables: OK

Last edited by lythande (2018-03-09 08:00:58)

Offline

#26 2018-03-09 13:28:01

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

Hm. You could try a brand new installation, install geo_vote there as the only plugin, and ex-/import that installation’s geo_vote table(s?) into your existing 4.6.2 instance.

But I just tried installing the plugin on the 4.7.0beta and there wasn’t even an extension tab to visit (the plugin was active and I tried it from another tab than Plugins, i.e. the menu should have been visible.). So chances are you can’t update your 4.6.2 later on, once 4.7.0 stable becomes available.

I can’t tell whether Claire/cebe’s cbe_helpful would do what you need, but maybe it causes you less hassle to find that out than the steps I outlined above.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#27 2018-03-10 13:10:25

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

lythande, also have a look at yab_review_rating. The topic came up today, totally forgot about that plugin.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#28 2018-03-20 11:15:47

lythande
Member
Registered: 2009-09-08
Posts: 202
Website

Re: geo_vote

Much thanks Uli,
sorry for the long rest.
I have look around the other plugins, but there are not a survey, only to rating somethings e.g. an article.
So I have try at first your idea to make an clear Install of Textpattern and tried to install the geo_vote-Plugin. But same error as before. So then I exporting the tables from the working Textpattern and importing it to the new Textpattern-Tables in MySQL (and before I importing set the txpprefix).
Then does work in the new Textpattern. :-)

So I have tried it to expanse with a subtitle (because I need it) and have solution it too. :-)
(I insert a “vote_subtitle” inside the plugin-php and set a new table-line in the Table “geo_vote_meta”.)

And then I using the title-class to set an title for the vote_title, but in the first time this doesnt works. But I found an error in the original-plugin and changing it (see below).

On the Line function geo_vote_show_ballot($rs, $message){

$out[] = '<div class= "$vote_title_class"><h2>'.doSpecial($vote_title).'</h2></div>'; 

—> doesn’t set a class!

it should be:

$out[] = '<div class= "'.$vote_title_class.'"><h2>'.doSpecial($vote_title).'</h2></div>'; 

—> then would be set a class (which set in the form)

is only need a '. .' outside the $vote_title_class.

Separated text from code to make it easier to compare the two versions. —Uli

Last edited by uli (2018-03-20 11:33:49)

Offline

#29 2018-03-20 11:32:44

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: geo_vote

Great that you could make everything work, congratulations!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#30 2018-03-20 11:38:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,476
Website GitHub

Re: geo_vote

Long shot: installation success probably depends on your version of PHP. If it’s 7+ then the plugin will spectacularly fail to install. Band-aid using mysqli_* function calls:

function geo_vote_install($message) {
	global $DB;
	$version = mysqli_get_server_info($DB->link);
	$GLOBALS['txp_err_count'] = 0;
	if ($version < "4.1.2") {
		$GLOBALS['txp_err_count']++;
		trigger_error("geo_vote requires MySQL v4.1.2 or greater.");
	} else {
		$ret = '';
		$sql = array();
		$sql[] = "CREATE TABLE IF NOT EXISTS `".PFX.GEO_VOTE_CHEAT."` (
						`pk` int(4) NOT NULL auto_increment PRIMARY KEY,
			`vote_id` int(4) NOT NULL default 0,
			`option` int(4) NOT NULL default 0,
			`cookie_ip_login` varchar(64) NULL default '',
			INDEX (vote_id)
						) ENGINE=MyISAM PACK_KEYS=1 AUTO_INCREMENT=1";

		$sql[] = "CREATE TABLE IF NOT EXISTS `".PFX.GEO_VOTE_FORM."` (
			`hash_key` varchar(32) NOT NULL PRIMARY KEY,
			`t_stamp` TIMESTAMP NOT NULL default CURRENT_TIMESTAMP
						) ENGINE=MyISAM PACK_KEYS=1";

		$sql[] = "CREATE TABLE IF NOT EXISTS `".PFX.GEO_VOTE_META."` (
			`vote_id` int(4) NOT NULL auto_increment PRIMARY KEY,
			`vote_title` varchar(64) NULL default '',
			`option_title_1` varchar(64) NULL default '',
			`option_title_2` varchar(64) NULL default '',
			`option_title_3` varchar(64) NULL default '',
			`option_title_4` varchar(64) NULL default '',
			`option_title_5` varchar(64) NULL default '',
			`option_title_6` varchar(64) NULL default '',
			`option_title_7` varchar(64) NULL default '',
			`option_title_8` varchar(64) NULL default '',
			`option_title_9` varchar(64) NULL default '',
			`option_title_10` varchar(64) NULL default '',
			`option_1` int(4) NOT NULL default 0,
			`option_2` int(4) NOT NULL default 0,
			`option_3` int(4) NOT NULL default 0,
			`option_4` int(4) NOT NULL default 0,
			`option_5` int(4) NOT NULL default 0,
			`option_6` int(4) NOT NULL default 0,
			`option_7` int(4) NOT NULL default 0,
			`option_8` int(4) NOT NULL default 0,
			`option_9` int(4) NOT NULL default 0,
			`option_10` int(4) NOT NULL default 0,
			`total_votes` int(4) NOT NULL default 0,
			`show_results` varchar(3) NOT NULL default '',
			`cheat_method` varchar(6) NOT NULL default '',
			`end_date_time` DATETIME NOT NULL default '0000-00-00 00:00:00',
			`vote_bar_colour` varchar(32) NOT NULL default '',
			`vote_title_class` varchar(64) NOT NULL default '',
			`option_title_class` varchar(64) NOT NULL default '',
			`end_date_time_class` varchar(64) NOT NULL default '',
			`vote_button_class` varchar(64) NOT NULL default ''
							) ENGINE=MyISAM PACK_KEYS=1 AUTO_INCREMENT=1";

		if(gps('debug')) {
			dmp($sql);
		}

		foreach ($sql as $qry) {
			$ret = safe_query($qry);
			if ($ret===false) {
				$GLOBALS['txp_err_count']++;
				echo "<b>".$GLOBALS['txp_err_count'].".</b> ".mysqli_error($DB->link)."<br />\n";
				echo "<!--\n $qry \n-->\n";
			}
		}
	}

	if ($GLOBALS['txp_err_count'] == 0) {
		$message = geo_vote_gTxt('tbl_installed');
		geo_vote_config($message);
	} else {
		$message = geo_vote_gTxt('tbl_not_installed');
		geo_vote_config($message);
	}
}

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB