<?php
/* Save default options */
$askme_admin_options = new askme_admin_options;
if (!get_option(askme_options) || !get_option(askme_mobile_options)) {
	if (!get_option(askme_options)) {
		$default_options = $askme_admin_options->get_default_values("options");
		add_option(askme_options,$default_options);
	}
	if (!get_option(askme_mobile_options)) {
		$default_options = $askme_admin_options->get_default_values("mobile");
		add_option(askme_mobile_options,$default_options);
	}
}
/* Theme old version */
if (askme_theme_version >= 6.4) {
	if (get_option("askme_old_version_done") == "") {
		update_option("askme_old_version",get_option(askme_options));
		update_option("askme_old_version_done",true);
	}
}
add_action('init','askme_update_theme');
function askme_update_theme() {
	$askme_custom_queries = get_option("askme_custom_queries");
	$askme_custom_queries = (is_array($askme_custom_queries) && !empty($askme_custom_queries)?$askme_custom_queries:array());
	/* askme_6.9.5 */
	if (!isset($askme_custom_queries["6.9.5_added_new_options"])) {
		$askme_custom_queries["5_added_new_options"] = true;
		update_option("askme_custom_queries",$askme_custom_queries);
		$askme_options = get_option(askme_options);
		update_option(askme_mobile_options,$askme_options);
	}
	/* askme_6.9.6 */
	$askme_options = get_option(askme_options);
	if (!isset($askme_custom_queries[askme_theme_version."_added_new_options"])) {
		$askme_custom_queries[askme_theme_version."_added_new_options"] = true;
		update_option("askme_custom_queries",$askme_custom_queries);
		update_option(askme_theme_version."_".askme_options,$askme_options);
		$askme_mobile_options = get_option(askme_mobile_options);
		update_option(askme_theme_version."_".askme_mobile_options,$askme_mobile_options);
	}
	if (!isset($askme_custom_queries["6_9_6_added_new_options"])) {
		$askme_custom_queries["6_9_6_added_new_options"] = true;
		update_option("askme_custom_queries",$askme_custom_queries);
		if (isset($askme_options["payment_methodes"])) {
			$askme_options["payment_methods"] = $askme_options["payment_methodes"];
			update_option(askme_options,$askme_options);
		}
	}
}?>