<?php /*************************************************************************** * For license information see doc/license.txt * * Unicode Reminder メモ * * Returns a list of all caches which have been hidden after publish. * This allows an easier synchronization of this information on a * replicated system than the XML interface. ***************************************************************************/ $opt['rootpath'] = '../'; require $opt['rootpath'] . 'lib2/web.inc.php'; header('Content-type: text/plain; charset=utf-8'); $rs = sql("SELECT `wp_oc`\n FROM `caches`\n JOIN `cache_status` ON `cache_status`.`id`=`caches`.`status`\n WHERE `cache_status`.`allow_user_view`= 0 \n AND `caches`.`status` != 5\n ORDER BY `cache_id`"); $wp_ocs = sql_fetch_column($rs); foreach ($wp_ocs as $wp_oc) { echo $wp_oc . "\n"; }
while ($r = sql_fetch_assoc($rs)) { echo "."; sql("DELETE FROM `user` WHERE `user_id`='&1'", $r['user_id']); } echo "\n"; mysql_free_result($rs); echo "clearing OKAPI data\n"; if (sql_table_exists('okapi_vars')) { echo "clearing OKAPI data\n"; sql('TRUNCATE `okapi_authorizations`'); sql('TRUNCATE `okapi_cache_logs`'); sql('TRUNCATE `okapi_cache_reads`'); sql('TRUNCATE `okapi_consumers`'); sql('TRUNCATE `okapi_nonces`'); sql('TRUNCATE `okapi_search_results`'); sql('TRUNCATE `okapi_search_sets`'); sql('TRUNCATE `okapi_stats_hourly`'); sql('TRUNCATE `okapi_stats_monthly`'); sql('TRUNCATE `okapi_stats_temp`'); sql('TRUNCATE `okapi_tile_caches`'); sql('TRUNCATE `okapi_tile_status`'); sql('TRUNCATE `okapi_tokens`'); } echo "clearing other nonpublic data\n"; sql('TRUNCATE `news`'); $rs = sql("SHOW TABLES WHERE `Tables_in_" . $opt['db']['placeholder']['db'] . "` LIKE '\\_%'"); $tables = sql_fetch_column($rs); foreach ($tables as $table) { sql('DROP TABLE ' . $table); } echo "done.\n";
} // get cache_id if not given $cacheId = 0; if (isset($_REQUEST['wp'])) { $cacheId = cache::cacheIdFromWP($_REQUEST['wp']); } elseif (isset($_REQUEST['cacheid'])) { // Ocprop $cacheId = $_REQUEST['cacheid']; } // check adminstatus of user $useradmin = $login->hasAdminPriv() ? 1 : 0; // prepare array to indicate errors in template $validate = array(); // log and cache type which can be combined with maintenance state flags $rs = sql("SELECT `id` FROM `log_types` WHERE `maintenance_logs`"); $logtype_allows_nm = sql_fetch_column($rs); // proceed loggable, if valid cache_id $validate['logAllowed'] = true; if ($cacheId != 0) { // get cache object $cache = new cache($cacheId); // check log allowed, depending on cache state and logged in user $validate['logAllowed'] = $cache->allowLog(); // get user object $user = new user($login->userid); // is user cache owner $isOwner = $user->getUserId() == $cache->getUserId(); // assing ratings to template $tpl->assign('ratingallowed', $user->allowRatings()); $tpl->assign('givenratings', $user->getGivenRatings()); $tpl->assign('maxratings', $user->getMaxRatings());
function process_log_watch($user_id, $log_id) { global $opt, $dblink, $logwatch_text, $translate; // echo "process_log_watch($user_id, $log_id)\n"; $rsLog = sql("SELECT\n\t\t\t`cache_logs`.`cache_id`,\n\t\t\t`cache_logs`.`type`,\n\t\t\t`cache_logs`.`text`,\n\t\t\t`cache_logs`.`text_html`,\n\t\t\t`cache_logs`.`date` `logdate`,\n\t\t\t`cache_logs`.`needs_maintenance`,\n\t\t\t`cache_logs`.`listing_outdated`,\n\t\t\t`user`.`username`,\n\t\t\t`caches`.`name` `cachename`,\n\t\t\t`caches`.`wp_oc`\n\t\tFROM\n\t\t\t`cache_logs`,\n\t\t\t`user`,\n\t\t\t`caches`\n\t\tWHERE\n\t\t\t`cache_logs`.`user_id`=`user`.`user_id` AND\n\t\t\t`cache_logs`.`cache_id`=`caches`.`cache_id` AND\n\t\t\t`cache_logs`.`id` = '&1'", $log_id); $rLog = sql_fetch_array($rsLog); mysql_free_result($rsLog); $logtext = html2plaintext($rLog['text'], $rLog['text_html'] == 0, EMAIL_LINEWRAP); $language = sqlValue("SELECT `language` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); if (!$language) { $language = $opt['template']['default']['locale']; } if (strpos($rLog['logdate'], '00:00:00') > 0) { $dateformat = $opt['locale'][$language]['format']['phpdate']; } else { $dateformat = $opt['locale'][$language]['format']['phpdatetime']; } $watchtext = '{date} ' . $translate->t('{user} has logged the cache "{cachename}":', '', basename(__FILE__), __LINE__, '', 1, $language) . ' {action}{maintenance_flags}' . "\n" . '{shortlink_url}{wp_oc}' . "\n{cachelists}\n" . '{text}' . "\n\n\n\n"; $watchtext = mb_ereg_replace('{date}', date($dateformat, strtotime($rLog['logdate'])), $watchtext); $watchtext = mb_ereg_replace('{wp_oc}', $rLog['wp_oc'], $watchtext); $watchtext = mb_ereg_replace('{text}', $logtext, $watchtext); $watchtext = mb_ereg_replace('{user}', $rLog['username'], $watchtext); $watchtext = mb_ereg_replace('{cachename}', $rLog['cachename'], $watchtext); $watchtext = mb_ereg_replace('{action}', get_logtype_name($rLog['type'], $language), $watchtext); $watchtext = insert_maintenance_flags($rLog, $language, $watchtext); $rsLists = sql("SELECT `name` FROM `cache_lists` cl\n\t\tJOIN `cache_list_watches` clw ON clw.`cache_list_id`=cl.`id` AND clw.`user_id`='&1'\n\t\tJOIN `cache_list_items` cli ON cli.`cache_list_id`=cl.`id` AND cli.`cache_id`='&2'\n\t\tORDER BY `name`", $user_id, $rLog['cache_id']); $cachelist_names = sql_fetch_column($rsLists); switch (count($cachelist_names)) { case 0: $cachelists = ''; break; case 1: $cachelists = $translate->t('Cache list:', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . $cachelist_names[0] . "\n"; break; default: $cachelists = $translate->t('Cache lists:', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . implode(', ', $cachelist_names) . "\n"; } $watchtext = mb_ereg_replace('{cachelists}', $cachelists, $watchtext); $domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null); $urls = get_site_urls($domain); if ($urls['shortlink_url']) { $watchtext = mb_ereg_replace("{shortlink_url}", $urls['shortlink_url'], $watchtext); } else { $watchtext = mb_ereg_replace("{shortlink_url}", $urls['site_url'], $watchtext); } sql("INSERT IGNORE INTO watches_waiting \n (`user_id`, `object_id`, `object_type`, `date_created`, `watchtext`, `watchtype`) \n VALUES ('&1', '&2', 1, NOW(), '&3', 2)", $user_id, $log_id, $watchtext); }
static function getListsByCacheId($cacheid, $all) { global $login; $cache_owner_id = sql_value("\n\t\t\tSELECT `user_id`\n\t\t\tFROM `caches`\n\t\t\tWHERE `cache_id`='" . sql_escape($cacheid) . "'", 0); $my_watches = sql_fetch_column(sql("SELECT `cache_list_id` FROM `cache_list_watches` WHERE `user_id`='&1'", $login->userid)); return cachelist::getLists("\n\t\t\t`id` IN\n\t\t\t\t(SELECT `cache_list_id`\n\t\t\t\t FROM `cache_list_items`\n\t\t\t\t WHERE `cache_id`='" . sql_escape($cacheid) . "')\n\t\t\tAND\n\t\t\t(\n\t\t\t\t`cache_lists`.`user_id`='" . sql_escape($login->userid) . "' " . ($all ? "OR `is_public`= 3 " : "") . "OR (`is_public`> 0 AND\n\t\t\t `cache_lists`.`id` IN ('" . implode("','", array_map('sql_escape', $my_watches)) . "'))\n\t\t\t)", "`cache_lists`.`user_id`<>'" . sql_escape($cache_owner_id) . "'"); }