ukolovnik-1.4/ 0000755 0023627 0000144 00000000000 12007701277 012573 5 ustar mcihar users ukolovnik-1.4/lib/ 0000755 0023627 0000144 00000000000 12007701277 013341 5 ustar mcihar users ukolovnik-1.4/lib/toolbar.php 0000644 0023627 0000144 00000001226 12007701277 015515 0 ustar mcihar users 'index.php', _('Add') => 'index.php?cmd=add', _('Categories') => 'index.php?cmd=cat', _('Add category') => 'index.php?cmd=addcat', _('Export') => 'index.php?cmd=export', _('Stats') => 'index.php?cmd=stats', _('Settings') => 'setup.php', _('About') => 'index.php?cmd=about', _('Donate') => 'http://' . LOCALE_url('cihar.com/donate/'), )); ?> ukolovnik-1.4/lib/config.php 0000644 0023627 0000144 00000004022 12007701277 015315 0 ustar mcihar users 'localhost', 'db_user' => 'ukolovnik', 'db_password' => 'ukolovnik', 'db_database' => 'ukolovnik', 'table_prefix' => 'ukolovnik_', 'style' => 'default', 'add_list' => '1', 'add_stay' => '1', 'language' => 'en', 'version' => '0', 'main_style' => '1' ); /** * Read value from configuration. * @param string name * @param string default value * @param string parameter storage (db or file) */ function CONFIG_get($name, $source = 'db', $skip_check = false) { global $default_settings; if ($source == 'file') { if (isset($GLOBALS[$name])) { return $GLOBALS[$name]; } else { return $default_settings[$name]; } } else { $value = $default_settings[$name]; /* This might be executed with wrong database configuration */ if (!$skip_check && (!SQL_init() || count(SQL_check()) > 0)) { return $value; } $q = SQL_do('SELECT `value` FROM `' . SQL_name('settings') . '` WHERE `key`="' . $name . '"', $skip_check); if ($q === false) { return $value; } if (mysql_num_rows($q) > 0) { $row = mysql_fetch_assoc($q); $value = $row['value']; } mysql_free_result($q); return $value; } } /** * Sets value to (database) configuration. * @param string name * @param string value */ function CONFIG_set($name, $value, $skip_check = false) { if (!$skip_check && (!SQL_init() || count(SQL_check()) > 0)) { return; } SQL_do('REPLACE INTO `' . SQL_name('settings') . '` VALUES("' . $name . '", "' . addslashes($value) . '")'); } ?> ukolovnik-1.4/lib/string.php 0000644 0023627 0000144 00000003060 12007701277 015357 0 ustar mcihar users \1\3', htmlspecialchars($text)); } /** * Quoted printable encoding. */ function STRING_quoted_printable($input) { // If imap_8bit() is available, use it. if (function_exists('imap_8bit')) { return imap_8bit($input); } // Rather dumb replacment: just encode everything. $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); $output = ''; $len = strlen($input); for ($i = 0; $i < $len; ++$i) { $c = substr($input, $i, 1); $dec = ord($c); $output .= '=' . $hex[floor($dec / 16)] . $hex[floor($dec % 16)]; if (($i + 1) % 25 == 0) { $output .= "=\r\n"; } } return $output; } /** * Converts timestamp to vCalendar format. */ function STRING_format_date_vcal($value) { return sprintf('%04d%02d%02dT%02d%02d%02d', date('Y', $value), date('n', $value), date('j', $value), date('G', $value), date('i', $value), date('s', $value)); } ?> ukolovnik-1.4/lib/sql.php 0000644 0023627 0000144 00000015325 12007701277 014657 0 ustar mcihar users = 5 || ($mysql_ver[0] == 4 && $mysql_ver[1] >= 1)) { SQL_do('SET NAMES utf8'); } unset($mysql_ver); return TRUE; } function SQL_postinit() { } /** * Rename table according to configured prefix. */ function SQL_name($tbl) { return CONFIG_get('table_prefix', 'file') . $tbl; } /** * Checks whether database is correct. */ function SQL_check_db($name) { global $db; return mysql_select_db($name, $db); } $SQL_check = NULL; /** * Check for whether tables and databases are up to date. Optionally this * can also update everything to currently required state. */ function SQL_check($upgrade = false) { global $db, $required_tables, $SQL_check; // If we already did check if ($SQL_check != NULL && !$upgrade) return $SQL_check; // Connect to database $dbname = CONFIG_get('db_database', 'file'); if (!SQL_check_db($dbname)) { if ($upgrade) { SQL_do('CREATE DATABASE `' . $dbname . '`'); HTML_message('notice', sprintf(_('Database %s has been created.'), htmlspecialchars($dbname))); SQL_check_db($dbname); } else { return array('db'); } } $result = array(); // Check tables foreach ($required_tables as $tbl) { $q = SQL_do('SHOW TABLES LIKE "' . SQL_name($tbl) . '"'); if (mysql_num_rows($q) == 0) { if ($upgrade) { switch ($tbl) { case 'tasks': SQL_do('CREATE TABLE `' . SQL_name('tasks') . '` ( `id` int(11) NOT NULL auto_increment, `category` int(11) NOT NULL, `priority` int(11) NOT NULL, `title` varchar(200) collate utf8_unicode_ci NOT NULL, `description` text collate utf8_unicode_ci NOT NULL, `created` timestamp NOT NULL default CURRENT_TIMESTAMP, `updated` timestamp NULL default NULL, `closed` timestamp NULL default NULL, `update_count` bigint default 0, PRIMARY KEY (`id`), KEY `category` (`category`), KEY `priority` (`priority`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'); HTML_message('notice', sprintf(_('Table %s has been created.'), htmlspecialchars(SQL_name('tasks')))); CONFIG_set('version', '2', true); break; case 'categories': SQL_do('CREATE TABLE `' . SQL_name('categories') . '` ( `id` int(11) NOT NULL auto_increment, `name` varchar(200) collate utf8_unicode_ci NOT NULL, `personal` tinyint(1) NOT NULL, PRIMARY KEY (`id`), KEY `personal` (`personal`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'); HTML_message('notice', sprintf(_('Table %s has been created.'), htmlspecialchars(SQL_name('categories')))); break; case 'settings': SQL_do('CREATE TABLE `' . SQL_name('settings') . '` ( `key` varchar(200) collate utf8_unicode_ci NOT NULL, `value` varchar(200) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (`key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'); HTML_message('notice', sprintf(_('Table %s has been created.'), htmlspecialchars(SQL_name('categories')))); CONFIG_set('version', '1', true); break; default: HTML_die_error('Table not defined: ' . $tbl); break; } } $result[] = $tbl; } if ($q) mysql_free_result($q); } if (!in_array('settings', $result)) { // Check for settings version $ver = (int)CONFIG_get('version', 'db', true); // Set initial version information (don't care on $upgrade here, as this does not require any special privileges) if ($ver == 0) { CONFIG_set('version', '1', true); HTML_message('notice', sprintf(_('Settings database has been updated'))); } } $ver = (int)CONFIG_get('version', 'db', true); if ($ver == 1) { if ($upgrade) { // Add update_count field SQL_do('ALTER TABLE `' . SQL_name('tasks') . '` ADD `update_count` bigint default 0'); CONFIG_set('version', '2', true); HTML_message('notice', sprintf(_('Table %s updated.'), htmlspecialchars(SQL_name('tasks')))); } else { if (!isset($result['upgrade'])) { $result['upgrade'] = array(); } $result['upgrade'][] = 'tasks'; } } $SQL_check = $result; return $result; } /** * Execute SQL query and terminate script run if it fails. */ function SQL_do($query, $allowfail = false) { global $db; $q = mysql_query($query, $db); if ($q === FALSE) { if ($allowfail) return false; echo mysql_error($db); HTML_die_error(sprintf(_('SQL query failed: %s'), htmlspecialchars($query))); } return $q; } ?> ukolovnik-1.4/lib/version.php 0000644 0023627 0000144 00000000330 12007701277 015533 0 ustar mcihar users ukolovnik-1.4/lib/priority.php 0000644 0023627 0000144 00000000602 12007701277 015731 0 ustar mcihar users ukolovnik-1.4/lib/compat.php 0000644 0023627 0000144 00000001254 12007701277 015337 0 ustar mcihar users $value) { if (is_array($value)) { arrayWalkRecursive($array[$key], $function); } else { $array[$key] = $function($value); } } } ?> ukolovnik-1.4/lib/locale.php 0000644 0023627 0000144 00000003310 12007701277 015306 0 ustar mcihar users 'en'); if (!is_dir($locale_path)) { return $langs; } $d = opendir($locale_path); if ($d) { while (($file = readdir($d)) !== false) { $matches = array(); if (preg_match('/([a-zA-Z]{2,2})/', $file, $matches)) { $langs[$matches[1]] = $matches[1]; } } closedir($d); } return $langs; } /** * Returns URL to cihar.com server with locale based prefix. */ function LOCALE_url($base) { $lang = CONFIG_get('language'); if ($lang == 'cs') { return 'cz.' . $base; } return $base; } ?> ukolovnik-1.4/lib/category.php 0000644 0023627 0000144 00000003110 12007701277 015662 0 ustar mcihar users
'; } ?> ukolovnik-1.4/lib/http.php 0000644 0023627 0000144 00000001757 12007701277 015043 0 ustar mcihar users ukolovnik-1.4/lib/extensions.php 0000644 0023627 0000144 00000001100 12007701277 016241 0 ustar mcihar users 'mysql_connect', 'pcre' => 'preg_replace'); /** * Checks whethere required extensions are installed. */ function EXTENSIONS_check() { global $required_extensions; $result = array(); foreach($required_extensions as $name => $function) { if (!function_exists($function)) { $result[] = $name; } } return $result; } ?> ukolovnik-1.4/lib/html.php 0000644 0023627 0000144 00000006256 12007701277 015027 0 ustar mcihar users ' . "\n"; ?>