Пример #1
0
 function getValidLogTypes()
 {
     $cache = new cache($this->getCacheId());
     if ($cache->exist() == false) {
         return array();
     }
     // if ($cache->allowLog() == false)
     //	 return array();
     // Logic Error - log types are still valid when no NEW logs are allowed for the cache.
     // (Would e.g. block admin logs and log-type restoring for locked caches.)
     return get_cache_log_types($this->getCacheId(), $this->getType());
     // depends on userid
 }
Пример #2
0
function logtype_ok($cache_id, $logtype_id, $old_logtype)
{
    return in_array($logtype_id, get_cache_log_types($cache_id, $old_logtype));
}
Пример #3
0
             //      for the rating, e.g. when logging a second found on a recycled or
             //      renewed cache [listing].
         } else {
             sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']);
         }
     }
     // do not use slave server for the next time ...
     db_slave_exclude();
     //display cache page
     tpl_redirect('viewcache.php?cacheid=' . urlencode($log_record['cache_id']) . '&log=A#log' . urlencode($log_id));
     exit;
 }
 // build logtype options
 $disable_statuschange = $log_record['cache_user_id'] == $login->userid && !is_latest_log($log_record['cache_id'], $log_record['log_id']);
 $logtype_names = get_logtype_names();
 $allowed_logtypes = get_cache_log_types($log_record['cache_id'], $log_record['logtype'], !$disable_statuschange);
 $logtypeoptions = '';
 foreach ($allowed_logtypes as $logtype) {
     $selected = $log_record['logtype'] == $logtype ? ' selected="selected"' : '';
     $logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>';
     $logtypeoptions .= htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8');
     $logtypeoptions .= '</option>' . "\n";
 }
 $disable_typechange = $disable_statuschange && $log_record['is_status_log'];
 tpl_set_var('type_edit_disabled', $disable_typechange ? $type_edit_disabled : '');
 // TODO: Enforce the 'diables' when processing the posted data.
 // It's not that urgent, because nothing can be broken by changing
 // past status log types (it was even allowed up to OC 3.0.17);
 // just the log history may look weird.
 if (teamcomment_allowed($log_record['cache_id'], 3, $log_record['oc_team_comment'])) {
     tpl_set_var('teamcommentoption', mb_ereg_replace('{chk_sel}', $oc_team_comment ? 'checked' : '', $teamcomment_field));
Пример #4
0
 function getUserLogTypes($userLogType, $oldLogType = 0)
 {
     global $translate, $login;
     $logTypes = array();
     $logtypeNames = get_logtype_names();
     $allowedLogtypes = get_cache_log_types($this->getCacheId(), $oldLogType);
     $defaultLogType = $userLogType;
     if (!logtype_ok($this->getCacheId(), $defaultLogType, $oldLogType)) {
         $defaultLogType = $allowedLogtypes[0];
     }
     // prepare array
     $i = 0;
     foreach ($allowedLogtypes as $logtype) {
         $logTypes[$i]['selected'] = $logtype == $defaultLogType ? true : false;
         $logTypes[$i]['name'] = $logtypeNames[$logtype];
         $logTypes[$i]['id'] = $logtype;
         $i++;
     }
     // return
     return $logTypes;
 }
Пример #5
0
             //   2. It can be used as a tweak to control which log's date is relevant
             //      for the rating, e.g. when logging a second found on a recycled or
             //      renewed cache [listing].
         } else {
             sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']);
         }
     }
     // do not use slave server for the next time ...
     db_slave_exclude();
     //display cache page
     tpl_redirect('viewcache.php?cacheid=' . urlencode($log_record['cache_id']) . '&log=A#log' . urlencode($log_id));
     exit;
 }
 // build logtype options
 $logtype_names = get_logtype_names();
 $allowed_logtypes = get_cache_log_types($log_record['cache_id'], $log_record['logtype']);
 $logtypeoptions = '';
 foreach ($allowed_logtypes as $logtype) {
     $selected = $log_record['logtype'] == $logtype ? ' selected="selected"' : '';
     $logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>' . htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
 }
 if (teamcomment_allowed($log_record['cache_id'], 3, $log_record['oc_team_comment'])) {
     tpl_set_var('teamcommentoption', mb_ereg_replace('{chk_sel}', $oc_team_comment ? 'checked' : '', $teamcomment_field));
 } else {
     tpl_set_var('teamcommentoption', '');
 }
 //set template vars
 tpl_set_var('cachename', htmlspecialchars($cache_name, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logtypeoptions', $logtypeoptions);
 tpl_set_var('logday', htmlspecialchars($log_date_day, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logmonth', htmlspecialchars($log_date_month, ENT_COMPAT, 'UTF-8'));
Пример #6
0
             } else {
                 sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $cache_id);
             }
         }
         //call eventhandler
         require_once $rootpath . 'lib/eventhandler.inc.php';
         event_new_log($cache_id, $usr['userid'] + 0);
     }
     //redirect to viewcache
     $no_tpl_build = true;
     //include('viewcache.php');
     tpl_redirect('viewcache.php?cacheid=' . $cache_id);
 } else {
     // build logtype options
     $logtype_names = get_logtype_names();
     $allowed_logtypes = get_cache_log_types($cache_id, 0);
     $default_log_type = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] + 0 : 0;
     if (!logtype_ok($cache_id, $default_log_type, 0)) {
         $default_log_type = $allowed_logtypes[0];
     }
     $logtypeoptions = '';
     foreach ($allowed_logtypes as $logtype) {
         $selected = $logtype == $default_log_type ? ' selected="selected"' : '';
         $logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>' . htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
     }
     //set tpl vars
     tpl_set_var('cachename', htmlspecialchars($cachename, ENT_COMPAT, 'UTF-8'));
     tpl_set_var('cacheid', htmlspecialchars($cache_id, ENT_COMPAT, 'UTF-8'));
     tpl_set_var('logday', htmlspecialchars($log_date_day, ENT_COMPAT, 'UTF-8'));
     tpl_set_var('logmonth', htmlspecialchars($log_date_month, ENT_COMPAT, 'UTF-8'));
     tpl_set_var('logyear', htmlspecialchars($log_date_year, ENT_COMPAT, 'UTF-8'));