Пример #1
0
    $c = $msg->count_sended();
    echo $layout->subtitle(txt('messager_sended_title'), MY_RESOURCES_URL . 'msg_sended.png');
    echo $layout->txtdesc(txt('messager_sended_desc'));
    echo $layout->tbl_start();
    echo $layout->head(array('' => '5%', txt('messager_tbl_message') => '40%', '<img style="display:inline-block; vertical-align:middle" src="' . MY_RESOURCES_URL . 'time_icon.png" /> ' . txt('messager_tbl_sended') => '15%', '<img style="display:inline-block; vertical-align:middle" src="' . MY_RESOURCES_URL . 'time_icon.png" /> ' . txt('messager_tbl_readed') => '15%', '<img style="display:inline-block; vertical-align:middle" src="' . MY_RESOURCES_URL . 'user_icon.png" />' . txt('messager_tbl_to') => '15%', txt('messager_tbl_actions') => '15%'));
    if ($c != 0) {
        $records = $msg->get_sended();
        foreach ($records as $row) {
            $icon = MY_RESOURCES_URL . 'readed_icon.png';
            $readed = date('Y.m.d H:i', $row['readed_at']);
            $title = $row['title'];
            if (!$msg->is_readed($row['id'])) {
                $icon = MY_RESOURCES_URL . 'unreaded_icon.png';
                $title = '<b>' . $row['title'] . '</b>';
                $readed = txt('messager_tbl_not_yet');
            }
            $delete_action = "\n\t\t\t\$.messager.confirm('" . txt('delete') . "', '" . txt('delete_confirm') . "?', function(r){\n\t\t\tif (r){\n\t\t\t\t" . helper_reload(array('delete_sended_id' => $row['id'])) . "\n\t\t\t}\n\t\t\t});\t";
            //helper_reload(array('delete_sended_id' => $row['id']));
            $u = new phpos_users();
            $u->set_id_user($row['id_user_to']);
            $u->get_user_by_id();
            $row_items = array('<img src="' . $icon . '" />', '<a href="javascript:void(0);" onclick="' . helper_reload(array('msg_id' => $row['id'])) . '">' . $title . '</a>', date('Y.m.d H:i', $row['sended_at']), $readed, $u->get_user_login(), $layout->button(txt('delete'), $delete_action, 'cancel'));
            echo $layout->row($row_items, string_cut(strip_tags($row['msg'], '<br>'), 100));
        }
    } else {
        echo $layout->empty_list();
    }
    echo $layout->tbl_end();
} else {
    include MY_APP_DIR . 'views/view_message.php';
}
Пример #2
0
 $group_user = new phpos_users();
 $group_user->set_id_user($shared_id_user);
 $group_user->get_user_by_id();
 $title = '<img src="' . ICONS . 'server/workgroup.png' . '" style="width:30px; display:inline-block; vertical-align:middle" /> <span style="color:black">' . txt('workgroup') . ':</span> ' . $group_name;
 $html['icons'] .= $layout->area_start($title);
 $html['icons'] .= $layout->txtdesc(txt('st_shared'));
 $html['icons'] .= $layout->subtitle($group_user->get_user_login(), ICONS . 'user.png');
 foreach ($records as $row) {
     $tmp_usr = new phpos_users();
     $user_info = $tmp_usr->get_user_by_id($row['id_user']);
     $action_open = link_action('index', 'reset_shared:0,shared_id:' . $row['id'] . ',in_shared:1,fs:local_files');
     $contextMenu_shared_folders = array('open::' . txt('open') . '::' . $action_open . '::folder_open');
     $apiWindow->setContextMenu($contextMenu_shared_folders);
     $js .= $apiWindow->contextMenuRender('groups_shared_folders_' . $row['id'] . WIN_ID, 'img');
     $apiWindow->resetContextMenu();
     $html['icons'] .= '<div id="groups_shared_folders_' . $row['id'] . WIN_ID . '" title="<b>' . $row['title'] . '</b> ' . $row['desc'] . '" class="phpos_server_icon"><a href="javascript:void(0);" ondblclick="' . $action_open . '"><img src="' . ICONS . 'server/shared1.png" /></a><p><b>' . $row['title'] . '</b><br />' . string_cut($row['description'], 20) . '<br /><span class="desc">' . $user_info['user_login'] . '</span></p></div>';
 }
 $html['icons'] .= $layout->area_end();
 // right items
 $html['right_items_title'] = txt('explorer_right_group_users');
 $html['right_items_desc'] = txt('explorer_right_group_users_desc');
 $html['right_items_img'] = 'shared1.png';
 //$group->get_group();
 $users_in_group = $group->get_users_in_group();
 $k = count($users_in_group);
 if ($k != 0) {
     foreach ($users_in_group as $grp_user) {
         $usr_data = new phpos_users();
         $usr_data->set_id_user($grp_user['id_user']);
         $usr_data->get_user_by_id();
         $right_item['name'] = $usr_data->get_user_login();
Пример #3
0
function manage_text($name, $text, $target)
{
    // Various types
    global $manacost, $boost, $boosts, $cardtypes, $colors;
    // Workarounds
    $text = trim($text);
    $text = str_replace('—', '-', $text);
    // Causes bugs in regex parsing
    $text = str_replace('comes into play', 'enters the battlefield', $text);
    // Old style CIP
    $text = preg_replace('/\\(.*?\\)/', '', $text);
    // Remove reminder texts as they can interfere in parsing (vanishing reminder has text for upkeep trigger for exemple)
    // Card attributes
    // In hand
    if (preg_match('/Cycling (' . $manacost . ')/', $text, $matches)) {
        $target->cycling = manacost($matches[1]);
    }
    if (preg_match('/Morph (' . $manacost . ')/', $text, $matches)) {
        $target->morph = manacost($matches[1]);
    }
    if (preg_match('/Megamorph (' . $manacost . ')/', $text, $matches)) {
        $target->morph = manacost($matches[1]);
        $target->megamorph = true;
    }
    if (preg_match('/Suspend (\\d+)\\s*-\\s*(' . $manacost . ')/', $text, $matches)) {
        $target->suspend = intval($matches[1]);
        $target->suspend_cost = manacost($matches[2]);
    }
    if (preg_match('/Forecast - (' . $manacost . ')/', $text, $matches)) {
        $target->forecast = manacost($matches[1]);
    }
    // In grave
    if (preg_match('/Flashback (' . $manacost . ')/', $text, $matches)) {
        $target->flashback = manacost($matches[1]);
    }
    if (stripos($text, 'Retrace') !== false) {
        $target->retrace = true;
    }
    if (preg_match('/Dredge (\\d+)/', $text, $matches)) {
        $target->dredge = intval($matches[1]);
    }
    if (preg_match('/Scavenge (' . $manacost . ')/', $text, $matches)) {
        $target->scavenge = manacost($matches[1]);
    }
    // Permanents attributes
    if (preg_match('/Vanishing (\\d+)/', $text, $matches)) {
        $target->vanishing = true;
        $target->counter = intval($matches[1]);
    }
    if (preg_match('/Fading (\\d+)/', $text, $matches)) {
        $target->fading = true;
        $target->counter = intval($matches[1]);
    }
    if (preg_match('/Echo (' . $manacost . ')/', $text, $matches)) {
        $target->echo = manacost($matches[1]);
    }
    if (preg_match('/Modular (\\d+)/', $text, $matches)) {
        $target->counter += intval($matches[1]);
        $target->note = '+1/+1';
    }
    if (preg_match('/Graft (\\d+)/', $text, $matches)) {
        $target->counter += intval($matches[1]);
        $target->note = '+1/+1';
    }
    // Hideaway
    if (stripos($text, 'Hideaway') !== false) {
        $target->tapped = true;
    }
    // Spell effect
    if (stripos($text, 'Manifest') !== false) {
        $target->manifester = true;
    }
    // Devoid
    if (stripos($text, 'Devoid') !== false) {
        global $allcolorscode;
        $target->color = $allcolorscode[1];
    }
    // Without keyword
    // Untap
    if (stripos($text, $name . ' doesn\'t untap during your untap step') !== false) {
        $target->no_untap = true;
    }
    // Upkeep trigger
    if (preg_match('/^(?<keyword>.*? - )?At the beginning of (?<step>.*?)( or (?<alt>.*?))?, (?<action>.*)/', $text, $matches)) {
        //if ( $matches['alt'] != '' )
        //	echo 'Alternative : '.$matches['alt']."\n" ;
        $words = explode(' ', $matches['step']);
        // Filter words useless for parsing
        $words = array_filter($words, function ($k) {
            $filter = array('step', 'phase', 'precombat', 'next');
            return !in_array($k, $filter);
        });
        $player = null;
        // Self, opponent, both
        $step = '';
        switch ($words[0]) {
            // Read first word and try to guess player
            case 'each':
                array_shift($words);
                switch ($words[0]) {
                    case "opponent's":
                        $player = -1;
                        array_shift($words);
                        break;
                    case "player's":
                        $player = 0;
                        array_shift($words);
                        break;
                    case "other":
                        $player = -1;
                        array_shift($words);
                        if ($words[0] == "player's") {
                            array_shift($words);
                        }
                        break;
                    case "of":
                        array_shift($words);
                        $sent = implode(' ', $words);
                        if ($sent == 'that player\'s upkeeps') {
                            $player = -1;
                            $step = 'upkeep';
                        } else {
                            if ($sent == 'your main phases') {
                                $player = 1;
                                $step = 'main';
                            }
                        }
                    default:
                        $player = 0;
                        //echo 'Unknown step : '.$name.' : '.implode(' ', $words)."\n" ;
                }
                if ($step == '') {
                    if (count($words) == 1) {
                        $step = $words[0];
                    } else {
                        echo 'Multiple words left : ' . $name . ' : ' . implode(' ', $words) . ' / ' . $matches['step'] . "\n";
                    }
                }
                break;
            case 'your':
                $player = 1;
                array_shift($words);
                if (count($words) == 1) {
                    $step = $words[0];
                } else {
                    echo 'Multiple words left : ' . $name . ' : ' . implode(' ', $words) . ' / ' . $matches['step'] . "\n";
                }
                break;
            case 'the':
                array_shift($words);
                if ($words[0] == 'first') {
                    continue;
                } else {
                    if ($matches['step'] == 'the chosen player\'s upkeep') {
                        $player = -1;
                        $step = 'upkeep';
                    } else {
                        if (count($words) == 1) {
                            $step = $words[0];
                            $player = 1;
                        } else {
                            if ($words[1] == 'of') {
                                $step = $words[0];
                                $player = 2;
                            } else {
                                echo 'Unknown step : ' . $name . ' : ' . $matches['step'] . "\n";
                            }
                        }
                    }
                }
                break;
            case 'combat':
                $step = 'combat';
                switch ($matches['step']) {
                    case 'combat on your turn':
                        $player = 1;
                        break;
                    case 'combat on each opponent\'s turn':
                        $player = 0;
                        break;
                    default:
                        echo 'Unknown step : ' . $name . ' : ' . $matches['step'] . "\n";
                }
                break;
            case 'enchanted':
                $player = -1;
                $step = 'upkeep';
                break;
            default:
                echo 'Unknown step : ' . $name . ' : ' . $matches['step'] . "\n";
        }
        if (!in_array($step, array('upkeep', 'draw', 'main', 'combat', 'end', ''))) {
            echo "Unknown step : {$name} - {$step} {$player}\n";
        }
    }
    /*else if ( preg_match('/At the beginning of (?<step>.*?), (?<action>.*)/', $text, $matches) )
    		echo "[$text]\n" ;*/
    if (preg_match('/At the beginning of your( next)? upkeep, (.*)/', $text, $matches)) {
        $target->trigger_upkeep = stripslashes($matches[2]);
    }
    if (preg_match('/At the beginning of the upkeep of (\\w*) (\\w*)\'s controller, (.*)/', $text, $matches)) {
        if (!isset($target->bonus)) {
            $target->bonus = new stdClass();
        }
        $target->bonus->trigger_upkeep = stripslashes($matches[3]);
    }
    // Add mana
    global $basic_lands;
    if (property_exists($target, 'subtypes')) {
        // Basic land types in subtypes
        foreach ($basic_lands as $color => $basic_land) {
            if (in_array($basic_land, $target->subtypes)) {
                $target->addmana($color);
            }
        }
    }
    if (preg_match('/^(?<beforecost>.*")?(?<cost>.*?): Add (?<manas>.*?) to your mana pool/', $text, $matches)) {
        $cost = explode(', ', $matches['cost']);
        $idx = array_search('{T}', $cost);
        if ($idx > -1) {
            // {
            array_splice($cost, $idx, 1);
        }
        if ($matches['manas'] == 'one mana of any color') {
            $target->addmana('W');
            $target->addmana('U');
            $target->addmana('B');
            $target->addmana('R');
            $target->addmana('G');
        } else {
            $manas = preg_split('/( or )|(, )/', $matches['manas']);
            foreach ($manas as $mana) {
                if (preg_match_all('/\\{(.*?)\\}/', $mana, $matches)) {
                    for ($i = 1; $i < count($matches); $i++) {
                        foreach ($matches[$i] as $color) {
                            if (method_exists($target, 'addmana')) {
                                $target->addmana($color);
                            }
                        }
                    }
                }
            }
        }
        //}
    }
    // CIP
    if (preg_match('/' . addcslashes($name, '\'"\\/') . ' enters the battlefield (or (?<alt>[^,]*),)?(?<act>.*)/', $text, $matches)) {
        /* Alternate trigger ('or attacks', 'or leaves play' ...)
        		if ( $matches['alt'] != '' )
        			echo $name.' : '.$matches['alt']."\n" ;
        		*/
        $txts = explode(' and ', $matches['act']);
        foreach ($txts as $txt) {
            $txt = trim($txt, '.');
            if (preg_match('/^tapped ?(.*)/', $txt, $matches)) {
                $target->tapped = true;
                if ($matches[1] != '') {
                    $words = explode(' ', $matches[1]);
                    switch ($words[0]) {
                        case 'unless':
                            unset($target->tapped);
                            // A condition will replace hard tapped
                            if ($matches[1] == 'unless you control two or fewer other lands') {
                                $target->ciptc = 'this.zone.player.controls({"types": "land"})>3';
                            } elseif ($matches[1] == 'unless you control two or more basic lands') {
                                $target->ciptc = '(this.zone.player.controls({"supertypes": "basic"})<2)';
                            } elseif (preg_match('/^unless you control an? (.*) or an? (.*)$/', $matches[1], $matches)) {
                                $target->ciptc = '(this.zone.player.controls({"subtypes": "' . strtolower($matches[1]) . '"})==0)';
                                $target->ciptc .= '&&(this.zone.player.controls({"subtypes": "' . strtolower($matches[2]) . '"})==0)';
                            } else {
                                // Unmanaged
                                echo $name . ' : ' . $words[0] . ' : ' . $matches[1] . "\n";
                            }
                            break;
                        case 'with':
                            // Don't display message because it will be managed later
                            $txt = trim($matches[1]);
                            break;
                        default:
                            // Unmanaged
                            echo $name . ' : ' . $words[0] . ' : ' . $matches[1] . "\n";
                    }
                }
            }
            if ($txt == 'does not untap during its controller\'s untap phase' || $txt == 'doesn\'t untap during its controller\'s untap phase' || $txt == 'doesn\'t untap during your untap step') {
                $target->no_untap = true;
            }
            if (preg_match('/^with (.*) (.*) counters? on it(.*)/', $txt, $matches)) {
                $target->counter = text2number($matches[1]);
                if ($matches[2] != 'charge') {
                    // Basic counter type, no use to let the user know. +1/-1 will be removed later while parsing pow/tou
                    $target->note = $matches[2];
                }
            }
        }
    }
    // Creature attributes (permanent attributes for exalt)
    global $creat_attrs;
    foreach ($creat_attrs as $creat_attr) {
        apply_creat_attrs($text, $creat_attr, $target);
    }
    // Type-specific
    // Planeswalkers are managed in "all lines"
    // Creatures : pow, thou, lifelink ...
    global $conds;
    if (is_array($target->types) && array_search('creature', $target->types) !== false) {
        if (isset($target->note) && is_string($target->note) && preg_match('/^' . $boosts . '$/', $target->note, $matches)) {
            unset($target->note);
            $target->pow += $target->counter * intval($matches['pow']);
            $target->thou += $target->counter * intval($matches['tou']);
        }
        // Conditionnal pow and tou (*/*)
        if (preg_match('/(.*)' . $name . '.{0,3} power (?<both>.*) equal to the number of (?<next>.*)/', $text, $m)) {
            if (preg_match('/^(?<type>.*) named (?<name>.*) (?<cond>' . implode('|', $conds) . ')/', $m['next'], $matches) || preg_match('/^(?<type>.*) (?<cond>' . implode('|', $conds) . ')/', $m['next'], $matches)) {
                $target->powtoucond = new stdClass();
                $target->powtoucond->what = 'cards';
                $target->powtoucond->from = array_search($matches['cond'], $conds);
                if (array_key_exists('name', $matches)) {
                    $target->powtoucond->cond = 'name=' . $matches['name'];
                } else {
                    switch ($matches['type']) {
                        case 'cards':
                            break;
                        case 'card types among cards':
                            // Tarmogoyf
                            $target->powtoucond->what = 'types';
                            break;
                        case 'snow permanents':
                            $target->powtoucond->cond = 'stype=snow';
                            break;
                        case 'creatures':
                        case 'lands':
                        case 'artifacts':
                            $target->powtoucond->cond = 'type=' . substr($matches['type'], 0, -1);
                            break;
                        case 'creature cards':
                        case 'land cards':
                        case 'artifact cards':
                        case 'sorcery cards':
                            $target->powtoucond->cond = 'type=' . substr($matches['type'], 0, -6);
                            break;
                            // zombies on the battlefield plus the number of zombie card
                            // red creatures
                            // green mana symbols in the mana costs of permanent
                            // basic land types among land
                            // untapped artifacts, creatures, and land
                            // creatures named plague rat
                            // other rat
                            // face-down creature
                        // zombies on the battlefield plus the number of zombie card
                        // red creatures
                        // green mana symbols in the mana costs of permanent
                        // basic land types among land
                        // untapped artifacts, creatures, and land
                        // creatures named plague rat
                        // other rat
                        // face-down creature
                        default:
                            // Let's consider default is creature types (basic land types as considered as ones)
                            $type = substr(strtolower($matches['type']), 0, -1);
                            if ($type == 'elve') {
                                $type = 'elf';
                            }
                            $target->powtoucond->cond = 'ctype=' . $type;
                    }
                }
            }
        }
        // Conditionnal mono boost (+1/+2 as long as ...)
        if (preg_match('/' . $name . ' gets ' . $boosts . ' as long as (?<what>.*)/', $text, $matches)) {
            // Single
            $what = strtolower($matches['what']);
            if ($what == 'seven or more cards are in your graveyard') {
            } elseif (preg_match('/(?<who>.*) controls? (?<what>.*)/', $what, $m)) {
                switch ($m['who']) {
                    case 'you':
                        // Kird ape
                        $target->powtoucond = new stdClass();
                        $target->powtoucond->what = 'card';
                        $target->powtoucond->pow = intval($matches['pow']);
                        $target->powtoucond->thou = intval($matches['tou']);
                        $target->powtoucond->from = 'battlefield';
                        if (preg_match('/an? (.*)/', $m['what'], $mm)) {
                            if (array_search($mm[1], $cardtypes) != false) {
                                $target->powtoucond->cond = 'type=' . $mm[1];
                            } else {
                                $target->powtoucond->cond = 'ctype=' . $mm[1];
                            }
                        }
                        break;
                    case 'an opponent':
                    case 'no opponent':
                        break;
                    default:
                        //msg($name.' : '.$m['who'].' -> '.$m['what']) ;
                }
                //} elseif ( preg_match('/(?<who>.*) [has|have] (?<what>.*)/', $what, $m) ) {
            }
            /*else
            		msg(' * '.$name.' : '.$matches['pow'].'/'.$matches['tou'].' : '.$matches['what']) ;*/
        }
        // Conditionnal poly boost (+1/+1 for each ...)
        if (preg_match('/' . $name . ' gets ' . $boosts . ' for each (?<what>.*)/', $text, $matches)) {
            conditionnal_poly_boost($target, $matches, $matches['what']);
        }
    }
    // Attach/Equip-boost
    if (preg_match('/(Equipped|Enchanted) creature gets ' . $boosts . '(?<after>.*)/', $text, $matches)) {
        if (strpos($matches['after'], 'until end of turn') === FALSE) {
            // Umezawa's Jitte
            if (preg_match('/for each (?<what>.*)/', $matches['after'], $matches_after)) {
                conditionnal_poly_boost($target, $matches, $matches_after['what']);
            } else {
                if (!isset($target->bonus)) {
                    $target->bonus = new stdClass();
                }
                $target->bonus->pow = intval($matches['pow']);
                $target->bonus->tou = intval($matches['tou']);
                global $creat_attrs;
                foreach ($creat_attrs as $creat_attr) {
                    // Also parse keywords such as vigilance, lifelink ...
                    apply_creat_attrs($matches[4], $creat_attr, $target->bonus);
                }
            }
        }
    }
    if (preg_match('/(Equipped|Enchanted) creature doesn\'t untap during its controller\'s untap step/', $text, $matches)) {
        if (!isset($target->bonus)) {
            $target->bonus = new stdClass();
        }
        $target->bonus->no_untap = true;
    }
    // Living weapon
    if (strpos($text, 'Living weapon') !== false) {
        $target->living_weapon = true;
    }
    // Token creation
    //if ( preg_match_all('/[Pp]uts? (?<number>\w+)( (?<pow>\d|X|\*+)\/(?<tou>\d|X|\*+))? (?<color>\w+)( and (?<color2>\w+))* (?<name>[\w| ]+ creature) token/', $text, $all_matches, PREG_SET_ORDER) ) {
    if (preg_match_all('/(?<number>\\w+) (?<pow>\\d*|X|\\*+)\\/(?<tou>\\d*|X|\\*+) (?<color>\\w+)( and (?<color2>\\w+))* (?<name>[\\w| ]+ creature) token/', $text, $all_matches, PREG_SET_ORDER)) {
        foreach ($all_matches as $matches) {
            $token = new stdClass();
            $token->nb = text2number($matches['number'], 1);
            // Override X value with 1 to put at least 1 token
            if ($token->nb < 1) {
                $token->nb = 1;
            }
            $token->attrs = new stdClass();
            // Token name -> types / subtypes -> name
            $types = explode(' ', $matches['name']);
            $nameparts = array();
            foreach ($types as $type) {
                if (array_search($type, $cardtypes) !== false) {
                    $token->attrs->types[] = strtolower($type);
                } else {
                    $token->attrs->subtypes[] = strtolower($type);
                    $nameparts[] = $type;
                }
            }
            $token->name = implode($nameparts, ' ');
            // Recompose token name from its subtypes
            // Other attrs
            $token->attrs->pow = text2number($matches['pow'], 0);
            // 0 for image
            $token->attrs->thou = text2number($matches['tou'], 0);
            $token->attrs->color = array_search($matches['color'], $colors) . array_search($matches['color2'], $colors);
            $target->tokens[] = $token;
        }
    }
    // Distinct activated from static abilities
    /*$parts = preg_split('/\s*:\s*'.'/', $text) ;
    	if ( count($parts) == 2 ) {
    		$cost = $parts[0] ;
    		$text = $parts[1] ;
    		if ( ! isset($target->activated) )
    			$target->activated = new Simple_object() ;
    		$target = $target->activated ;
    	}*/
    // All creatures booster (crusade like)
    if (preg_match_all('#(?<self>' . strtolower($name) . ' and )?(?<other>other )?(?<cond>\\w*? )?creature(?<token> token)?s (?<control>(you|your opponents) control )?get (?<pow>' . $boost . ')\\/(?<tou>' . $boost . ')(?<attrs>.*)?#', strtolower($text), $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            $boost_bf = new stdClass();
            // Main params : amount boosted
            $boost_bf->pow = intval($match['pow']);
            $boost_bf->tou = intval($match['tou']);
            // Secondary params :boost self, boost only creatures controled by its controler
            $boost_bf->self = $match['self'] != '' || $match['other'] != 'other ';
            $boost_bf->control = 0;
            // Default : No "control" indication : crusade, lord of atlantis ...
            if ($match['control'] == 'you control ') {
                // Only creatures you control
                $boost_bf->control = 1;
            }
            if ($match['control'] == 'your opponents control ') {
                // Just opponent's ones
                $boost_bf->control = -1;
            }
            // Conditions (creature type, color ...)
            if ($match['token'] != '') {
                $boost_bf->cond = 'class=token';
            }
            $cond = trim($match['cond']);
            if ($cond != '') {
                $ci = array_search($cond, $colors);
                if ($ci !== false) {
                    $boost_bf->cond = "color={$ci}";
                } else {
                    $types = explode(' and ', $cond);
                    foreach ($types as $i => $type) {
                        if ($type == 'artifact') {
                            $types[$i] = "type={$type}";
                        } else {
                            $types[$i] = "ctype={$type}";
                        }
                    }
                    $boost_bf->cond = implode('|', $types);
                }
            }
            $eot = false;
            if (array_key_exists('attrs', $match)) {
                $eot = preg_match('/ until end of turn/', $match['attrs']);
                global $creat_attrs;
                foreach ($creat_attrs as $creat_attr) {
                    apply_creat_attrs($match['attrs'], $creat_attr, $boost_bf);
                }
            }
            $boost_bf->eot = $eot;
            if (!isset($target->permanent) || $target->permanent) {
                // On permanents, boost_bf_eot are activated (ex: Garruk)
                $boost_bf->enabled = !$boost_bf->eot;
            } else {
                // On spells (ex: Overrun)
                $boost_bf->enabled = true;
            }
            // enabled by default
            $target->boost_bf[] = $boost_bf;
        }
    }
    // Animate
    if (preg_match('/((?<cost>.*)\\s*:\\s*)?(?<eot>Until end of turn, )?' . addcslashes($name, '/') . ' (.* it )?becomes an? (?<pow>\\d)\\/(?<tou>\\d) (?<rest>.*)/', $text, $matches)) {
        $animated = new stdClass();
        if ($matches['cost'] != '') {
            $animated->cost = manacost($matches['cost']);
        }
        $animated->pow = intval($matches['pow']);
        $animated->tou = intval($matches['tou']);
        if ($matches['eot'] != '') {
            $animated->eot = true;
        }
        $rest = $matches['rest'];
        if ($m = string_cut($rest, 'until end of turn')) {
            $animated->eot = true;
            $rest = $m['before'];
            // $m['after'] contains "it's still a land", special conditions or rules
        }
        if ($m = string_cut($rest, 'creature')) {
            // TODO : better parsing (color are lowercase then creatrue types are upercase then 'artifact'
            // Color, types, subtypes
            $ct = explode(' ', $m['before']);
            foreach ($ct as $cot) {
                if ($cot == 'and' || $cot == '') {
                    continue;
                }
                if ($cot == 'artifact') {
                    $animated->types[] = $cot;
                    continue;
                }
                $i = array_search($cot, $colors);
                if ($i !== false) {
                    $animated->color .= $i;
                    continue;
                }
                $animated->subtypes[] = strtolower($cot);
            }
            // Creature attributes
            $rest = $m['after'];
            if ($ch = string_cut($rest, 'all creature types ')) {
                $animated->changeling = true;
                $rest = $ch['before'] . $ch['after'];
            }
            global $creat_attrs;
            foreach ($creat_attrs as $creat_attr) {
                apply_creat_attrs($m['after'], $creat_attr, $animated);
            }
            $target->animate[] = $animated;
        }
        // else // Figure of destiny (is already a creature)
        //echo '['.$rest.']<br>' ;
    }
}
Пример #4
0
 
**********************************
*/
if (!defined('PHPOS')) {
    die;
}
if (APP_ACTION == 'ftp') {
    $address_icon = ICONS . 'server/ftp.png';
    $ftp = new phpos_ftp();
    $records = $ftp->get_my_ftp();
    $html['right_items_title'] = txt('explorer_right_ftp');
    $html['right_items_desc'] = txt('explorer_right_ftp_desc');
    $html['right_items_img'] = 'ftp.png';
    if (count($records) != 0) {
        $html['icons'] .= $layout->area_start(txt('ftp_folders'));
        $html['icons'] .= $layout->txtdesc(txt('st_ftp'));
        foreach ($records as $row) {
            $action_open = link_action('index', 'ftp_id:' . $row['id'] . ',fs:ftp');
            $action_edit = winopen(txt('dsc_ftp_a_edit'), 'cp', 'app_id:ftp@index', 'section:edit_account,ftp_id:' . $row['id']);
            $action_delete = "\n\t\t\t\t\t\$.messager.confirm('" . txt('delete') . "', '" . txt('delete_confirm') . "?', function(r){\n\t\t\t\t\tif (r){\n\t\t\t\t\t\n\t\t\t\t\t\t" . winopen(txt('dsc_ftp_a_edit'), 'cp', 'app_id:ftp@index', 'section:list,after_refresh:' . WIN_ID . ',action:delete,ftp_id:' . $row['id'] . ',delete_id:' . $row['id']) . "\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t});";
            $contextMenu_ftp = array('open::' . txt('open') . '::' . $action_open . '::folder_open', 'edit::' . txt('dsc_ftp_a_edit') . '::' . $action_edit . '::edit', 'delete::' . txt('delete') . '::' . $action_delete . '::cancel');
            $apiWindow->setContextMenu($contextMenu_ftp);
            $js .= $apiWindow->contextMenuRender('ftp_list_' . $row['id'] . WIN_ID, 'img');
            $apiWindow->resetContextMenu();
            $html['icons'] .= '<div id="ftp_list_' . $row['id'] . WIN_ID . '" ondblclick="' . $action_open . '" class="phpos_server_icon" title="<b>' . $row['title'] . '</b> ' . $row['host'] . '"><img src="' . ICONS . 'server/ftp.png" /><p><b>' . string_cut($row['title'], 30) . '</b><br />' . string_cut($row['description'], 30) . '<br /><span class="desc">' . string_cut($row['host'], 30) . '</span></p></div>';
        }
        $html['icons'] .= $layout->area_end();
    } else {
        $html['icons'] .= $layout->area_start(txt('ftp_folders')) . txt('ftp_no_accounts') . $layout->txtdesc(txt('st_ftp')) . $layout->area_end();
    }
}
	GitHUB: https://github.com/phpos/
	File version: 1.0.0, 2013.10.08
 
**********************************
*/
if (!defined('PHPOS')) {
    die;
}
$server_item_title = txt('workgroups');
$groups = new phpos_groups();
$records = $groups->get_my_groups();
if (count($records) != 0) {
    foreach ($records as $row) {
        $action_open = link_action('workgroup', 'shared_id:0,workgroup_id:' . $row['id'] . ',fs:ftp');
        $action_edit = winopen(txt('group_section_edit_group'), 'cp', 'app_id:groups@groups_admin', 'section:edit_group,group_id:' . $row['id']);
        $action_users = winopen(txt('group_section_group_users'), 'cp', 'app_id:groups@groups_admin', 'section:group_users,group_id:' . $row['id']);
        $action_delete = "\n\t\t\t\$.messager.confirm('" . txt('delete') . "', '" . txt('delete_confirm') . "?', function(r){\n\t\t\tif (r){\n\t\t\t\n\t\t\t\t" . winopen(txt('dsc_ftp_a_edit'), 'cp', 'app_id:groups@groups_admin', 'section:list,after_refresh:' . WIN_ID . ',action:delete,group_id:' . $row['id'] . ',delete_id:' . $row['id']) . "\t\t\t\t\n\t\t\t}\n\t\t\t});";
        $contextMenu_ftp = array('open::' . txt('open') . '::' . $action_open . '::folder_open', 'edit::' . txt('group_section_edit_group') . '::' . $action_edit . '::edit', 'users::' . txt('group_section_group_users') . '::' . $action_users . '::user', 'delete::' . txt('delete') . '::' . $action_delete . '::cancel');
        $apiWindow->setContextMenu($contextMenu_ftp);
        $js .= $apiWindow->contextMenuRender('groups_list_' . $row['id'] . WIN_ID, 'img');
        $apiWindow->resetContextMenu();
        $groups->set_id($row['id']);
        $c = $groups->count_users();
        $tmp_html .= '<div id="groups_list_' . $row['id'] . WIN_ID . '" class="phpos_server_icon"  title="<b>' . $row['title'] . '</b> ' . $row['description'] . '" ondblclick="' . $action_open . '"><img src="' . ICONS . 'server/workgroup.png" /><p><b>' . $row['title'] . '</b><br />' . txt('workgroup_users') . ': ' . $c . '<br /><span class="desc">' . string_cut($row['description'], 20) . '</span></p></div>';
    }
} else {
    $tmp_html = txt('workgroups_empty');
}
?>
 			
				
	PHPOS Web Operating system
	MIT License
	(c) 2013 Marcin Szczyglinski
	szczyglis83@gmail.com
	GitHUB: https://github.com/phpos/
	File version: 1.0.0, 2013.10.08
 
**********************************
*/
if (!defined('PHPOS')) {
    die;
}
$server_item_title = txt('shared_folders');
$shared = new phpos_shared();
$records = $shared->get_my_shared();
if (count($records) != 0) {
    foreach ($records as $row) {
        $action_open = link_action('index', 'workgroup_id:0,reset_shared:0,shared_id:' . $row['id'] . ',in_shared:1,fs:local_files');
        $contextMenu_shared_folders = array('open::' . txt('open') . '::' . $action_open . '::folder_open');
        $apiWindow->setContextMenu($contextMenu_shared_folders);
        $js .= $apiWindow->contextMenuRender('groups_shared_folders_' . $row['id'] . WIN_ID, 'img');
        $apiWindow->resetContextMenu();
        $tmp_html .= '<div id="groups_shared_folders_' . $row['id'] . WIN_ID . '" ondblclick="' . $action_open . '" class="phpos_server_icon" title="<b>' . $row['title'] . '</b> ' . $row['description'] . '"><img src="' . ICONS . 'server/shared1.png" /><p><b>' . string_cut($row['title'], 30) . '</b><br />' . string_cut(basename(base64_decode($row['folder_id'])), 30) . '<br /><span class="desc">' . string_cut($row['description'], 30) . '</span></p></div>';
    }
} else {
    $tmp_html = txt('shared_no_folders');
}
?>
			
Пример #7
0
function ResponderPulldownSpecial($field, $selected = false)
{
    global $DB_LinkID, $table_prefix;
    $infresponders = $table_prefix . 'InfResp_responders';
    $menu_query = "SELECT * FROM " . $infresponders . " ORDER BY ResponderID";
    $menu_result = mysql_query($menu_query, $DB_LinkID) or die("Invalid query: " . mysql_error());
    print "<select id=\"respselect\" name=\"{$field}\" class=\"fields\" onchange=\"showresponder();\">\n";
    while ($menu_row = mysql_fetch_assoc($menu_result)) {
        $DB_ResponderID = $menu_row['ResponderID'];
        $DB_RespEnabled = $menu_row['Enabled'];
        $DB_ResponderName = $menu_row['Name'];
        $DB_ResponderDesc = $menu_row['ResponderDesc'];
        $DB_OwnerEmail = $menu_row['OwnerEmail'];
        $DB_OwnerName = $menu_row['OwnerName'];
        $DB_ReplyToEmail = $menu_row['ReplyToEmail'];
        $DB_MsgList = $menu_row['MsgList'];
        $DB_OptMethod = $menu_row['OptMethod'];
        $DB_OptInRedir = $menu_row['OptInRedir'];
        $DB_OptOutRedir = $menu_row['OptOutRedir'];
        $DB_OptInDisplay = $menu_row['OptInDisplay'];
        $DB_OptOutDisplay = $menu_row['OptOutDisplay'];
        $DB_NotifyOnSub = $menu_row['NotifyOwnerOnSub'];
        $PullDown_String = string_cut($DB_ResponderName, 3);
        print "<option value=\"{$DB_ResponderID}\"";
        if ($DB_ResponderID == $selected) {
            echo " selected=\"selected\"";
        }
        print ">{$PullDown_String}</option>\n";
        if ($DB_ResponderID == 1) {
            $responder_details .= "<div id=\"responder" . $DB_ResponderID . "\">";
        } else {
            $responder_details .= "<div id=\"responder" . $DB_ResponderID . "\" style=\"display:none;\">";
        }
        $responder_details .= "Optin Method: " . $DB_OptMethod . "<br>";
        $responder_details .= "Description: " . $DB_ResponderDesc . "<br>";
        $responder_details .= "From Name: " . $DB_OwnerName . "<br>";
        $responder_details .= "From Email: " . $DB_OwnerEmail . "<br>";
        $responder_details .= "Reply-to Email: " . $DB_ReplyToEmail . "<br>";
        $responder_details .= "</div>";
        $javascript .= "document.getElementById('responder" . $DB_ResponderID . "').style.display = 'none';\n";
    }
    print "</select>\n";
    print "<script language=\"javascript\" type=\"text/javascript\">";
    print "function showresponder() {\n";
    print $javascript;
    print "var responderid = 'responder'+document.getElementById('respselect').value;\n";
    print "document.getElementById(responderid).style.display = '';\n";
    print "} </script>";
    print $responder_details;
}