'; } $optionen = unserialize(get_option('arne_riddle')); if (intval($optionen['zielpunktzahl']) == 0) $optionen['zielpunktzahl'] = 100; print '

'.htmlspecialchars(__('Guild-Wars-2-Screenshotriddle','arne_raetsel')).'

'; // restart if (isset($_POST['reset-game'])) { $optionen['solved'] = $optionen['origin']; $optionen['tipps'] = array(); copy(plugin_dir_path( __FILE__ ).'pic/default.jpg',$basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); $mich = get_userdata(get_current_user_id()); $dich = get_userdata($optionen['solved']); $message = sprintf(__('%s cancels actual round. %s should upload a new picture.','arne_raetsel'),$mich->display_name,$dich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } // change uploader if (isset($_POST['set-origin'])) { $uid = intval($_POST['user']); if ($uid != 0) { $optionen['start'] = 1; $optionen['solved'] = $uid; $optionen['tipps'] = array(); copy(plugin_dir_path( __FILE__ ).'pic/default.jpg',$basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); $mich = get_userdata(get_current_user_id()); $dich = get_userdata($optionen['solved']); $message = sprintf(__('%s cancels actual round and asks %s to upload the next picture.','arne_raetsel'),$mich->display_name,$dich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } } // remove from highscores if (isset($_POST['remove-player'])) { $uid = intval($_POST['user']); if ($uid != 0) { unset($optionen['userlist'][$uid]); $mich = get_userdata(get_current_user_id()); $dich = get_userdata($uid); $message = sprintf(__('%s removes %s from the highscore table.','arne_raetsel'),$mich->display_name,$dich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } } // start new game if (isset($_POST['start-new-round'])) { copy(plugin_dir_path( __FILE__ ).'pic/default.jpg',$basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); $optionen['start'] = 0; $optionen['solved'] = 0; $optionen['origin'] = 0; $optionen['tipps'] = array(); $optionen['logbuch'] = array(); unset($optionen['start']); unset($optionen['order']); unset($optionen['solved']); unset($optionen['origin']); unset($optionen['last']); unset($optionen['solution']); unset($optionen['userlist']); $mich = get_userdata(get_current_user_id()); $message = sprintf(__('%s starts a new round.','arne_raetsel'),$mich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } // set target points if (isset($_POST['set-target'])) { $z = intval($_POST['points']); if ($z > 0) { $optionen['zielpunktzahl'] = $z; $message = sprintf(__('%s sets the target points to %d','arne_raetsel'),$mich->display_name,$optionen['zielpunktzahl']); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } } // set program to execute when new entry added to logbuch if (isset($_POST['set-exec'])) { $p = trim(stripslashes($_POST['programm'])); if (strlen($p) > 0) { $optionen['programm'] = $p; update_option("arne_riddle", serialize($optionen)); } } // set gallery settings if (isset($_POST['set-gallery'])) { $optionen['dogallery'] = intval($_POST['do-gallery']); update_option("arne_riddle", serialize($optionen)); if ($optionen['dogallery'] && (!file_exists($basedir.'/arne_riddle/gallery/thumbs'))) { @mkdir($basedir.'/arne_riddle/gallery'); @mkdir($basedir.'/arne_riddle/gallery/thumbs'); } } // display option page print '
    '; print '

    '.htmlspecialchars(__('Shortcodes','arne_raetsel')).'

    '; print '

    '.sprintf(htmlspecialchars(__('The riddle can be embedded with %s. A detailed explaination with %s.','arne_raetsel')),'[gw2_riddle]','[gw2_riddle_explain]').'

    '; print '

    '.htmlspecialchars(__('Gamemanagement','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('Reset Actual Round','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('A player uploaded an inappropriate picture. Stop the actual round, nobody earns points. The according player has to upload a new picture.','arne_raetsel')).'

    '; print ''; print '
    '; print '
    '; print '

    '.htmlspecialchars(__('Change Uploader','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('You want another player to start the next round. Cancels actual round, nobody earns points and the selected player has to upload a new picture.','arne_raetsel')).'

    '; $possible_players = get_users(array('fields'=>'all')); if ((sizeof($possible_players) > 0) && (is_array($possible_players))) { print ''; } else { print '

    '.htmlspecialchars(__('No possible players with rights...','arne_raetsel')).'

    '; } print ''; print '
    '; print '
    '; print '

    '.htmlspecialchars(__('Delete Player','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('Selected player will be removed from the highscore table.','arne_raetsel')).'

    '; if ((sizeof($optionen['userlist']) > 0) && (is_array($optionen['userlist']))) { print ''; print ''; } else { print '

    '.htmlspecialchars(__('No players in highscore table...','arne_raetsel')).'

    '; } print '
    '; print '
    '; print '

    '.htmlspecialchars(__('Start New Round','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('Deletes logbook and highscores. After that any player can upload a new picture. (You can change the uploader after that if you want a specific player to start the new round.)','arne_raetsel')).'

    '; print ''; print '
    '; print '

    '.htmlspecialchars(__('Main Settings','arne_raetsel')).'

    '; print '
    '; print '

    '.htmlspecialchars(__('Target Points','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('When a player reaches at least this amount of points, he wins the game.','arne_raetsel')).' ('.htmlspecialchars(__('Default','arne_raetsel')).': 100)

    '; print ''; print ''; print '
    '; print '
    '; print '

    '.htmlspecialchars(__('Keep Gallery Of Screenshots','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('When a riddle is solved the screenshot is copied to a gallery path path.','arne_raetsel')).'

    '; print '


    '; print ''; print '

    '; print '
    '; print '

    '.htmlspecialchars(__('Program Execution','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('Execute a program when a new entry to the logbook is added. The program gets the entry in BB-Code as a parameter.','arne_raetsel')).'

    '; print '

    '.htmlspecialchars(__('Example','arne_raetsel')).': sudo /opt/tssaysudo /opt/tssay "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.htmlspecialchars(__('Peter earns 10 points for the correct answer!','arne_raetsel')).'"

    '; print '

    ('.htmlspecialchars(__('Leave field empty to execute no program.','arne_raetsel')).')

    '; print ''; print ''; print '
    '; } /* * DO I HAVE TO UNCOVER A NEW PART? */ function arne_raetsel_update_image() { $upload_dir = wp_upload_dir(); $basedir = $upload_dir['basedir']; $baseurl = $upload_dir['baseurl']; $optionen = unserialize(get_option('arne_riddle')); if ($optionen['start'] == 0) { if (!file_exists($basedir.'/arne_riddle/riddle.jpg')) { copy(plugin_dir_path( __FILE__ ).'pic/default.jpg',$basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); } } else { if (($optionen['solved'] == 0) && (time() >= $optionen['start'])) { $days = ceil( (time() - $optionen['start']) / (24 * 60 * 60) ); if ($days != $optionen['last']) { $source = new Imagick(); $source->readImage($basedir.'/arne_riddle/source/upload.jpg'); $overlay = array(); for ($i=$days;$i<=15;$i++) { $overlay[$i] = new Imagick(); try { $overlay[$i]->readImage(plugin_dir_path( __FILE__ ).'pic/'.$optionen['order'][$i].'.png'); } catch (Exception $e) { } try { $source->compositeImage($overlay[$i], Imagick::COMPOSITE_DEFAULT, 0, 0); } catch (Exception $e) { } } if ($days < 17) { $overlay[0] = new Imagick(); $overlay[0]->readImage(plugin_dir_path( __FILE__ ).'pic/0.png'); $source->compositeImage($overlay[0], Imagick::COMPOSITE_DEFAULT, 0, 0); } $source->flattenImages(); $source->writeImage($basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); if ($optionen['origin'] != 0) { $optionen['last'] = $days; update_option("arne_riddle", serialize($optionen)); } } } } } /* * AJAX */ function arne_raetsel_ajax() { global $region; $selected = stripslashes($_POST['zone']); $optionen = unserialize(get_option('arne_riddle')); if (!isset($region[$selected][1])) return; $zone = array(); $zone[] = (__('Select Waypoint','arne_raetsel')); asort($region[$selected][1]); foreach ($region[$selected][1] as $waypoint) { $found = 0; if (!is_array($optionen['tipps'])) $optionen['tipps'] = array(); foreach ($optionen['tipps'] as $tipp) { if (($tipp[0] == $selected) && ($tipp[1] == $waypoint)) $found = 1; } if (!$found) $zone[] = $waypoint; } print json_encode($zone); die(); } function arne_raetsel_scripts() { wp_enqueue_script('arne_raetsel_script',plugins_url('arne_raetsel.js', __FILE__), array('jquery')); wp_localize_script( 'arne_raetsel_script', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); } /* * DISPLAY RIDDLE IN THE FRONTEND INCLUDING MANAGMENT OF UPLOADS AND GUESSES */ function arne_raetsel_display( $attributes ) { $upload_dir = wp_upload_dir(); $basedir = $upload_dir['basedir']; $baseurl = $upload_dir['baseurl']; include_once ABSPATH . 'wp-admin/includes/file.php'; $galleryvalue = intval($_POST['arne_raetsel_to_gallery']); if ($galleryvalue == 1) $_SESSION['arne_raetsel_gallery'] = 'true'; if ($galleryvalue == 2) $_SESSION['arne_raetsel_gallery'] = 'false'; if ($_SESSION['arne_raetsel_gallery'] == 'true') { return arne_raetsel_gallery( $attributes ); } global $region; $nothing = false; try { $optionen = unserialize(get_option('arne_riddle')); } catch (exception $e) { $nothing = true; } if (intval($optionen['zielpunktzahl']) == 0) $optionen['zielpunktzahl'] = 100; if (!is_array($optionen['logbuch'])) $optionen['logbuch'] = array(); $ersteller = get_userdata( $optionen['origin'] ); $ausgabe = '

    ...'.htmlspecialchars($ersteller->display_name).'

    '; $ich = get_current_user_id(); arne_raetsel_update_image(); // User allowed to guess? -> $aguess if ( isset( $_POST['arne-riddle-guess'] ) ) { $aguess = false; if ( ($ich != $optionen['origin']) && ($optionen['solved'] == 0) && (time() >= $optionen['start']) && (current_user_can('upload_files')) ) { if (is_array($optionen['userlist'])) { $meinedaten = $optionen['userlist'][$ich]; if (is_array($meinedaten)) { if (time() > $meinedaten[1] + (10*60*60)) { $aguess = true; $meinedaten[1] = time(); } } else { $aguess = true; $meinedaten = array(0,time()); } } else { $aguess = true; $meinedaten = array(0,time()); } } // User is allowed to guess: analysis of tipp if ($aguess && (($_POST["zone"] == "0") || ($_POST["waypoint"] == "0")) ) { $ausgabe .= ''.htmlspecialchars(__('You didn\'t select a waypoint!','arne_raetsel')).''; $aguess = false; } if ($aguess) { $guessed_zone = stripslashes($_POST['zone']); if ( ((!is_array($optionen['solution'])) && (stripslashes($_POST['waypoint']) == $optionen['solution'])) || ((is_array($optionen['solution']) && (stripslashes($_POST['zone']) == $optionen['solution'][0]) && (stripslashes($_POST['waypoint']) == $optionen['solution'][1]))) ) { // guessed right. how many points? $days = floor((time() - $optionen['start']) / (24*60*60)); $punkte = 17 - $days; if ($punkte < 1) $punkte = 1; $meinedaten[0]+=$punkte; $mich = get_userdata($ich); $points = sprintf( _n( '1 point', '%s points', $punkte, 'arne_raetsel'), $punkte ); /* translators: leave '[USER]' and others untranslated, it will be replaced with actual values */ $message = __('[USER] earns with the correct answer [ANSWER] [POINTS].','arne_raetsel'); $message = str_replace('[USER]', $mich->display_name, $message); $message = str_replace('[ANSWER]', '»'.$guessed_zone.'«, »'.stripslashes($_POST['waypoint']).'«', $message); $message = str_replace('[POINTS]', $points, $message); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); /* translators: leave '[POINTS]' untranslated, it will be replaced with actual values */ $ausgabe .= '

    '.htmlspecialchars(str_replace('[POINTS]',$points,__('Yes, correct! You earned [POINTS] for this solution!','arne_raetsel'))).'

    '; $optionen['solved'] = $ich; if ($meinedaten[0] >= $optionen['zielpunktzahl']) { $optionen['solved'] = -1; $optionen['origin'] = -1; $mich = get_userdata($ich); $message = sprintf(__('%s has won the game and asks for payment.','arne_raetsel'),$mich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); } else { $mich = get_userdata($ich); $message = sprintf(__('%s is the next one to upload a new picture.','arne_raetsel'),$mich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); } $optionen['last'] = 0; $optionen['tipps'] = array(); copy($basedir.'/arne_riddle/source/upload.jpg',$basedir.'/arne_riddle/riddle.jpg'); @unlink($basedir.'/arne_riddle/riddle-klein.jpg'); if ($optionen['dogallery']) { @copy($basedir.'/arne_riddle/source/upload.jpg',$basedir.'/arne_riddle/gallery/'.date('Y-m-d',time()+(get_option('gmt_offset')*3600)).'.jpg'); } } else { // tipp is not matching solution. why? $myguess = array($guessed_zone, stripslashes($_POST['waypoint'])); $legitimate = 0; if (sizeof($region[$myguess[0]]) > 0){ // zone exists if (in_array($myguess[1], $region[$myguess[0]][1])) { // waypoint exists $legitimate = 1; $found = 0; foreach ($optionen['tipps'] as $tipp) { if (($tipp[0] == $myguess[0]) && ($tipp[1] == $myguess[1])) $found = 1; } if ($found) { $ausgabe .= '

    '.htmlspecialchars(__('Meanwhile this waypoint has been guessed and it\'s not correct. You can try again now.','arne_raetsel')).'

    '; } else { // player is guessing a new and legitimate waypoint, but is of course wrong $ausgabe .= '

    '.htmlspecialchars(__('Unfortunatley that\'s not correct!','arne_raetsel')).'

    '; $optionen['tipps'][] = $myguess; $mich = get_userdata($ich); $message = sprintf(__('%s is guessing %s but that\'s not correct.','arne_raetsel'),$mich->display_name,'»'.htmlspecialchars($guessed_zone).'«, »'.htmlspecialchars(stripslashes($_POST['waypoint'])).'«'); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } } } if (!$legitimate) { $ausgabe .= '

    '.htmlspecialchars(__('That\'s not a legitimate waypoint.','arne_raetsel')).'

    '; } } $optionen['userlist'][$ich] = $meinedaten; update_option("arne_riddle", serialize($optionen)); } } // User uploaded new picture if ( isset( $_POST['riddle-upload'] ) ) { // Only JPG and PNG. Not even annoying GIFs. if (($ich == $optionen['solved']) || ($optionen['start'] == 0) || ( ($optionen['origin'] == $ich) && ($optionen['solved'] == 0) && (time() < $optionen['start']) ) && ($_POST["zone"] != "0") && ($_POST["waypoint"] != "0") ) { if ( ! empty( $_FILES['picture']['name'] ) ) { $mimes = array( 'jpg|jpeg' => 'image/jpeg', 'png' => 'image/png' ); $riddlefile = wp_handle_upload( $_FILES['picture'], array( 'mimes' => $mimes, 'test_form' => false ) ); if ( ! empty ( $riddlefile['file'] ) ) { $picture_file = $riddlefile['file']; rename ($picture_file,$basedir.'/arne_riddle/source/upload.jpg'); $image = wp_get_image_editor($basedir.'/arne_riddle/source/upload.jpg'); if ( ! is_wp_error( $image ) ) { $image->resize(1024,768,true); $image->save($basedir.'/arne_riddle/source/upload.jpg'); // check whether too small $image = new Imagick($basedir.'/arne_riddle/source/upload.jpg'); $d = $image->getImageGeometry(); $w = $d['width']; $h = $d['height']; if (($w != 1024) || ($h != 768)) { $nw = 1024; $nh = intval((1024 / $w) * $h); if ($nh < 768) { $nh = 768; $nw = intval((768 / $h) * $w); } $image->resizeImage($nw,$nh,Imagick::FILTER_LANCZOS,1); $x = 0; $y = 0; if ($nw > 1024) $x = intval(($nw - 1024) / 2); if ($nh > 768) $y = intval(($nh - 768) / 2); $image->cropImage(1024,768,$x,$y); $image->writeImage($basedir.'/arne_riddle/source/upload.jpg'); } $optionen['order'] = array(); for ($i=1;$i<=16;$i++) $optionen['order'][]=$i; for ($i=1;$i<=100;$i++) { $optionen['order'] = array_merge(array_splice($optionen['order'],rand(0,15),1),$optionen['order']); } // Time: 0600 localtime $optionen['start'] = mktime(6,0,0,date('n',time()+(get_option('gmt_offset')*3600)),date('j',time()+(get_option('gmt_offset')*3600)),date('y',time()+(get_option('gmt_offset')*3600))); if (date('H',time()+(get_option('gmt_offset')*3600)) >= 6) $optionen['start'] += (24*60*60); // pendant in UTC $optionen['start'] -= get_option('gmt_offset')*3600; $optionen['origin'] = get_current_user_id(); $optionen['solution'] = array(stripslashes($_POST['zone']),stripslashes($_POST['waypoint'])); $optionen['last'] = 0; $optionen['solved'] = 0; $optionen['tipps'] = array(); $mich = get_userdata($ich); $message = sprintf(__('%s uploaded a new picture. New round starts tomorrow.','arne_raetsel'),$mich->display_name); $optionen['logbuch'][] = '
  • ['.date('Y-m-d H:i',time()+(get_option('gmt_offset')*3600)).'] '.htmlspecialchars($message).'
  • '; if (sizeof($optionen['logbuch']) > 5) array_shift($optionen['logbuch']); update_option("arne_riddle", serialize($optionen)); if ($optionen['programm']) @exec($optionen['programm'].' "[b]'.htmlspecialchars(__('Guild Riddle','arne_raetsel')).':[/b] '.$message.'"'); } unset($image); } } } if (($_POST["zone"] == "0") || ($_POST["waypoint"] == "0")) { $ausgabe .= ''.htmlspecialchars(__('You didn\'t select a waypoint!','arne_raetsel')).''; } } ksort($region); // create clickable preview picture if (!file_exists($basedir.'/arne_riddle/riddle-klein.jpg')) { $image = wp_get_image_editor($basedir.'/arne_riddle/riddle.jpg'); if ( ! is_wp_error( $image ) ) { $image->resize(400,300,true); $image->save($basedir.'/arne_riddle/riddle-klein.jpg'); } } $datum = date('Ymd',time()+(get_option('gmt_offset')*3600)).($optionen['solved'] ? '-solved' : ''); if (date('H',time()+(get_option('gmt_offset')*3600)) < 6) { $datum = date('Ymd', time() - (7*60*60) + (get_option('gmt_offset')*3600)).($optionen['solved'] ? '-solved' : ''); } $ausgabe .= 'aktuelles Rätsel'; // display hint (after some time) $vierzehn = ((time() - $optionen['start']) > ( 15 * 24 * 60 * 60 ) ? true : false ); $sieben = ((time() - $optionen['start']) > ( 7 * 24 * 60 * 60 ) ? true : false); if ($optionen['start'] == 0) $vierzehn = false; if ( $sieben && ($optionen['solved'] == 0) && ($optionen['start'] != 0)) { $ausgabe .= '

    '.htmlspecialchars(__('Hint','arne_raetsel')).' '.($vierzehn ? '2' : '1').'

    '; } /* * fill in zone automatically as soon as hint reveals right one * and remove zones that don't fit the hint or are empty * (all waypoints have already been guessed) */ $zone = ''; $zone .= ''; // display game elements (upload, waypoints or hints) if (!current_user_can('upload_files')) { $ausgabe .= '

    '.htmlspecialchars(__('To participate in this game, you have to be registered to this site and the administrator must have given you the right to upload files.','arne_raetsel')).'

    '; } else { $upload = '
    1.
    2. '.htmlspecialchars(__('Which waypoint is the nearest to your picture','arne_raetsel')).':
    '.$zone.'

    3.

    ' . "\n"; $ausgabe .= '
    '."\n"; $raten = $zone . '

    '; if ($nothing || ($optionen['start'] == 0)) { $ausgabe .= '

    '.htmlspecialchars(__('Never played before. Please upload a picture.','arne_raetsel')).'

    '; $ausgabe .= $upload; } else { if ($optionen['solved']) { if ($optionen['solved'] == $ich) { $ausgabe .= '

    '.htmlspecialchars(__('You have solved the riddle and now you have to upload a picture for the next round.','arne_raetsel')).'

    '; $ausgabe .= $upload; } else { if ($optionen['solved'] == -1) { $ausgabe .= '

    '.htmlspecialchars(__('The game is over. Now everybody has to pay the winner, then the administrator can start a new round.','arne_raetsel')).'

    '; } else { $solver = get_userdata( $optionen['solved'] ); $message = sprintf(__('%s has solved the ridde and has to upload a picture for the next round now.','arne_raetsel'),$solver->display_name); $ausgabe .= '

    '.htmlspecialchars($message).'

    '; } } } else { if (time() >= $optionen['start']) { if ($ich == $optionen['origin']) { $ausgabe .= '

    '.htmlspecialchars(__('You created this riddle and cannot participate in this round.','arne_raetsel')).'

    '; } else { $optionen['last'] = $optionen['userlist'][$ich][1]; if (!isset($optionen['last']) || (time() >= $optionen['last'] + (10*60*60)) ){ $ausgabe .= '

    '.htmlspecialchars(__('Select the waypoint nearest to this place.','arne_raetsel')).'

    '; $ausgabe .= $raten; } else { $minutes = ceil((($optionen['last']+(10*60*60)) - time()) / 60); if ($minutes >= 60) { $hours = floor($minutes / 60); $minutes -= ($hours * 60); } else { $hours = 0; } $zeitstring = $minutes . ' ' . ($minutes == 1 ? __('minute','arne_raetsel') : __('minutes','arne_raetsel')); if ($hours > 0) { $zeitstring = $hours . ' ' . ($hours == 1 ? __('hour','arne_raetsel') : __('hours','arne_raetsel')) . ', ' . $zeitstring; } $message = sprintf(__('You already made a guess and have to wait %s before the next guess.','arne_raetsel'),$zeitstring); $ausgabe .= '

    '.htmlspecialchars($message).'

    '; } } } else { if ($ich == $optionen['origin']) { $ausgabe .= '

    '.htmlspecialchars(__('You already uploaded a new picture, but because the new round hasn\'t started yet, you can upload another one.','arne_raetsel')).'

    '; $ausgabe .= $upload; } else { $ausgabe .= '

    '.htmlspecialchars(__('A new picutre has been uploaded an the new round starts tomorrow.','arne_raetsel')).'

    '; } } } } $ausgabe .= '
    '."\n"; } // Logbook: display last 5 actions if (sizeof($optionen['logbuch'])>0) { $ausgabe .= '

    '.htmlspecialchars(__('Logbook','arne_raetsel')).'

    '; } // display highscores (and this way all players who ever participated in this round) if (is_array($optionen['userlist'])) { $ausgabe .= '

    '.htmlspecialchars(__('Highscores','arne_raetsel')).'

    '; } // display gallery if ($optionen['dogallery']) { $pics = glob( $basedir.'/arne_riddle/gallery/*.jpg' ); if (sizeof($pics) > 0) { $ausgabe .= '
    '.htmlspecialchars(__('Show gallery of prior images','arne_raetsel')).'
    '; } } return $ausgabe; } function arne_raetsel_gallery( $attributes ) { $upload_dir = wp_upload_dir(); $basedir = $upload_dir['basedir']; $baseurl = $upload_dir['baseurl']; $ausgabe = '

    '.htmlspecialchars(__('Gallery','arne_raetsel')).'

    '; $ausgabe .= '
    '.htmlspecialchars(__('Back to the riddle','arne_raetsel')).'
    '; $pics = glob( $basedir.'/arne_riddle/gallery/*.jpg' ); arsort($pics); $ausgabe .= "\n".''; $ausgabe .= '
    '.htmlspecialchars(__('Back to the riddle','arne_raetsel')).'
    '; return $ausgabe; } function arne_raetsel_explain() { $optionen = unserialize(get_option('arne_riddle')); if (intval($optionen['zielpunktzahl']) == 0) $optionen['zielpunktzahl'] = 100; return '

    '.htmlspecialchars(__('Game','arne_raetsel')).'

    '.htmlspecialchars(__('The game works as follows: one player uploads a screenshot. This will be displayed only covered. Every day one part will be removed so you can see every day more of the screenshot.','arne_raetsel')).'

    '.htmlspecialchars(__('The other players have to guess where the screenshot was taken by selecting the nearest waypoint. Once a player guessed right he earns points, the more points the more parts are still covered. So a player can earn between 1 and 17 points. A player can guess every 10 hours at most.','arne_raetsel')).'

    '.htmlspecialchars(__('The player who guessed right has to upload the picture for the next round.','arne_raetsel')).'

    '.htmlspecialchars(sprintf(__('The player who reaches %d points first, wins the game.','arne_raetsel'),$optionen['zielpunktzahl'])).'

    '.htmlspecialchars(__('Winnings','arne_raetsel')).'

    '.htmlspecialchars(sprintf(__('Every player who ever guessed counts as participant of the game, even if he never guessed right. When a player reached at least %d points every participant has to pay the winner the amount of one gold. So the winnings are the higher the more players take part.','arne_raetsel'),$optionen['zielpunktzahl'])).'

    '.htmlspecialchars(__('Take Part','arne_raetsel')).'

    '.htmlspecialchars(__('You have to be registered to this site and the administrator must give you the right to upload files.','arne_raetsel')).'

    '.htmlspecialchars(__('Rules For Screenshots','arne_raetsel')).'

    '.htmlspecialchars(__('It\'s only allowed to take screenshots in not instanciated regions, so not in dungeons or in the personal story quest and things like that. And of course a player has to be able to solve the riddle when he sees the whole screenshot. So just don\'t make close-ups of daisies or the sky but include enough of the environment so that the players get enough hints for the correct solution.','arne_raetsel')).'

    '.htmlspecialchars(__('Screenshots','arne_raetsel')).'

    '.htmlspecialchars(__('If you have won a round you have to upload your own screenshot. To do so, press [Ctrl] + [Shift] + [H] in the game to fade out the interface. This is important so that nobody can see your minimap and other hints. After that press [prtscr] (over [ins]) and the screenshot is done. You can find it in your home directory in the subfolder Documents\GUILD WARS 2\Screens. (e. g. C:\Users\Arne\Documents\GUILD WARS 2\Screens) Please do not resize or convert the images to another format before the upload. Don\'t forget to select the nearest waypoint, so the winner can be determined automatically.','arne_raetsel')).'

    '; } ?>