예제 #1
0
 public function getSpeakers(string $id_slug)
 {
     if (!$id_slug) {
         return redirect(act('speaker'));
     }
     list($id, $theme) = explode('-', $id_slug);
     $themes = explode(' ', 'PHP MySQL JavaScript Design WebDesign WebDevelopment UserExperience Agile WebOperations SinglePageApps');
     return view('user.speakers', compact('theme', 'themes'));
 }
예제 #2
0
 protected function loginAfterSignUp(User $user, string $provider = '')
 {
     if ($provider) {
         $path = act('auth@login');
         $path = substr($path, 0, strrpos($path, '/'));
         setcookie('last_login_provider', $provider, null, $path);
     }
     Auth::login($user);
     return $this->handleUserWasAuthenticated(request(), $this->isUsingThrottlesLoginsTrait());
 }
예제 #3
0
/**
 * Generates a link inside a parent element (li?). That parent will include the "active" class if the action passed is
 * the same that was called (found by the "globals" created by {@link \App\Listener\Route}).
 * @param string $title What will become the link
 * @param string $act The link action, as used by {@link act{})
 * @param array  $params Action params
 * @param string $wrapper What will wrap the link and receive the 'active' class
 * @param array $attributes Attributes for both the wrapper and the link.
 *                          Specify like `['wrap' => ['class' => 'presentation'], 'link' => ['data-block' => 'xxx']]`.
 * @return string
 * @see act()
 */
function activableLink($title, $act, array $params = [], $wrapper = 'li', array $attributes = []) : string
{
    $final_attrs = [];
    foreach (['wrap', 'link'] as $el) {
        $attrs = $attributes[$el] ?? [];
        //separates the class and removes it from the standard attributes array, so we can include the needed class
        $classes = $attrs['class'] ?? '';
        unset($attrs['class']);
        if ($el == 'wrap' && $act == app()['controller'] . '@' . app()['action']) {
            $classes .= ' active';
            $title .= ' <span class="sr-only">(current)</span>';
        }
        $attrs = ['class' => $classes];
        foreach ($attrs as $attr => $value) {
            $final_attrs[$el][] = "{$attr}='{$value}'";
        }
        $final_attrs[$el] = join(' ', $final_attrs[$el]);
    }
    $action = act($act, $params);
    return "<{$wrapper} {$final_attrs['wrap']}><a href='{$action}' {$final_attrs['link']}>{$title}</a></{$wrapper}>";
}
예제 #4
0
파일: Staff.php 프로젝트: konato-events/web
 public function handle(Request $request, callable $next)
 {
     $forbidden = function ($id) use($request) {
         if ($request->ajax()) {
             return response('Forbidden', 403);
         } else {
             $path = $id ? 'event@details' : 'site@index';
             return redirect(act($path, $id))->with('error', _('Sorry, but it seems you don\'t have permission to edit this event...'));
         }
     };
     $path = $request->getPathInfo();
     $param = substr($path, strrpos($path, '/') + 1, strrpos($path, '-') ?: strlen($path) + 1);
     if (!$param) {
         //should never arrive here
         \Log::warning('Tried to search for event ID in Staff middleware, but it was not found: ' . $path);
         return $forbidden($param);
     } else {
         if (!Auth::check() || !EventStaff::where('user_id', Auth::user()->id)->where('event_id', $param)->count()) {
             return $forbidden($param);
         }
     }
     return $next($request);
 }
예제 #5
0
파일: admin.php 프로젝트: xarrper/cms
            header("Location: " . PATH . "/enter.php");
        }
    }
}
function exits()
{
    @session_start();
    session_destroy();
    header("Location: " . PATH);
}
switch ($action) {
    case 'exit':
        exits();
        break;
    case 'act':
        act($section);
        break;
    default:
        admin($section);
}
function info($section)
{
    $data = Sections::getIdSection($section);
    return $data;
}
function tree($data, $parent_id)
{
    //объеденить с деревом index.php
    if (is_array($data) and isset($data[$parent_id])) {
        $tree = '<ul>';
        foreach ($data[$parent_id] as $d) {
예제 #6
0
                                </div>
                            </div>
                        <?php 
}
?>

                        <div class="row thumbnails events">

                            <?php 
$columns = ['lg' => 3, 'md' => 4, 'sm' => 6, 'xs' => 6];
?>
                            <?php 
foreach ($speakers as $id => $speaker) {
    ?>
                            <?php 
    $link = act('user@profile', $speaker->slug);
    ?>
 <?php 
    //FIXME: user@speaker is not working
    ?>
                                <div class="<?php 
    foreach ($columns as $sign => $size) {
        echo "col-{$sign}-{$size} ";
    }
    ?>
 isotype-item festival">
                                    <div class="thumbnail no-border no-padding">
                                        <div class="media">
                                            {{--<a href="#" class="like"><i class="fa fa-heart-o"></i></a>--}}
                                            <img src="<?php 
    echo $speaker->picture;
예제 #7
0
                -->

                <?php 
    if ($theme->speakers) {
        ?>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="panel-title"><?php 
        echo _('Popular speakers');
        ?>
</h4>
                        </div>
                        <div class="panel-body">
                            @include('components.speakers_list', ['speakers' => $theme->speakers])
                            <a href="<?php 
        echo act('speaker@theme', $theme->slug);
        ?>
" class="see-more"><?php 
        echo _r('See all speakers on %s', $theme->name);
        ?>
</a>
                        </div>
                    </div>
                <?php 
    }
    ?>
            </div>
        </div>
        <?php 
}
?>
예제 #8
0
 public function deleteLink(int $id)
 {
     $user = \Auth::user();
     if ($user->links()->where('id', $id)->delete()) {
         return redirect(act('user@editLinks'));
     } else {
         //TODO: log error and warn someone
         return redirect()->back()->with('error', _('We were unable to delete this link... Would you try again, or contact us?'));
     }
 }
예제 #9
0
 public function postEditThemesSpeakers(Request $req)
 {
     $event_id = $req->id;
     $speakers = array_filter(explode(',', $req->speaker_ids));
     $themes = array_filter(explode(',', $req->theme_ids));
     foreach ($speakers as $user_id) {
         EventSpeaker::create(compact('event_id', 'user_id'));
     }
     foreach ($themes as $theme) {
         $theme_id = Theme::firstOrCreate(['name' => ['ilike', $theme]])->id;
         //TODO: usar ilike
         try {
             EventTheme::create(compact('event_id', 'theme_id'));
         } catch (QueryException $e) {
             if ($e->getCode() != EventTheme::ERR_UNIQUE_VIOLATION) {
                 //the relation already existed, so it's fine
                 throw $e;
             }
         }
     }
     return redirect(act('event@editThemesSpeakers', $req->id));
 }
예제 #10
0
            <?php 
if (\Auth::check() && \Auth::user()->following_events()->where('event_id', $id)->count()) {
    ?>
                <a href="<?php 
    echo act('event@unfollow', $event->slug);
    ?>
" class="btn btn-theme btn-wrap btn-sm">
                    <i class="fa fa-remove"></i> <?php 
    echo _('Unfollow this event');
    ?>
                </a>
            <?php 
} else {
    ?>
                <a href="<?php 
    echo act('event@follow', $event->slug);
    ?>
" class="btn btn-theme btn-wrap btn-sm">
                    <i class="fa fa-mail-forward"></i> <?php 
    echo _('Follow this event');
    ?>
                </a>
            <?php 
}
?>
            <!--
                <a class="note" href="#"><?php 
echo _('See my following preferences');
?>
</a>
            -->
예제 #11
0
@include('auth._providers_list')

<?php 
echo Form::model(new \App\Models\User(), ['action' => 'AuthController@postLogin', 'novalidate' => true]);
?>
    @include('components.form_errors')
    <?php 
echo Form::labelInput('email', _('Username') . ' / ' . _('E-mail'), 'email', null, ['help' => _('Here you can use either your username or your e-mail: both works!')]);
?>
    <?php 
echo Form::labelInput('password', _('Password'), 'password');
?>

    <div id="buttons-row">
        <a href="<?php 
echo act('auth@signUp');
?>
" class="pull-left"><?php 
echo _('I don\'t have an account');
?>
</a>
        <?php 
echo Form::submit(_('Let me in'), ['class' => 'btn btn-theme btn-theme-lg pull-right']);
?>
    </div>

<?php 
echo Form::close();
?>
@endsection
        $filter = $_GET['filter_target'];
        $t_functionName = 'print_filter_' . substr($filter, 0, -7);
        echo "<!-- {$filter} -->";
        if (function_exists($t_functionName)) {
            call_user_func($t_functionName);
        } elseif ('custom_field' == substr($filter, 0, 12)) {
            # custom function
            $t_custom_id = substr($filter, 13, -7);
            print_filter_custom_field($t_custom_id);
        } else {
            # error - no function to populate the target (e.g., print_filter_foo)
            ?>
				<span style="color:red;weight:bold;">
					unknown filter (<?php 
            echo $filter;
            ?>
)
				</span>
				<?php 
        }
    } else {
        # error - no filter given
        ?>
			<span style="color:red;weight:bold;">
				no filter selected
			</span>
			<?php 
    }
}
act();
예제 #13
0
if ($user->most_visited) {
    ?>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="panel-title"><?php 
    echo _('Most visited places');
    ?>
</h4>
                        </div>
                        <div class="panel-body">
                            <ul>
                                <?php 
    foreach ($user->most_visited as $location => $count) {
        ?>
                                    <li><a href="<?php 
        echo act('event@search', ['location' => $location]);
        ?>
"><?php 
        echo $location;
        ?>
</a></li>
                                <?php 
    }
    ?>
                            </ul>
                        </div>
                    </div>
                <?php 
}
?>
            </div>
예제 #14
0
?>
            </ul>

            <?php 
echo Form::model($event, ['id' => FORM_ID, 'files' => true]);
?>

                <?php 
echo Form::hidden('id');
?>

                @yield('form_content')

                <div class="row buttons-row text-center">
                    <a href="<?php 
echo act('event@details', $event->id);
?>
" class="btn btn-theme btn-theme-lg btn-theme-grey-dark"><?php 
echo _('Go back');
?>
</a>
                    <?php 
echo Form::submit(_('Save'), ['class' => 'btn btn-theme btn-theme-lg']);
?>
                </div>

            <?php 
echo Form::close();
?>

        </div>
예제 #15
0
        <hr class="page-divider transparent visible-xs"/>

        <aside id="sidebar-info" class="sidebar col-sm-12 col-md-4 col-lg-3">

            <div class="widget">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title"><?php 
echo _('Schedule file');
?>
</h4>
                    </div>
                    <div class="panel-body">
                        <a class="btn btn-theme" href="<?php 
echo act('event@scheduleTemplateFile');
?>
">
                            <span class="fa fa-download"></span>
                            <?php 
echo _('Get the template');
?>
                        </a>
                    </div>
                </div>
            </div>

        </aside>

    </div>
@endsection
예제 #16
0
                <?php 
if (!$compact) {
    ?>
                    <p class="caption-text"><?php 
    echo Str::words($event->description, 15, ' [...]');
    ?>
</p>

                    <div class="caption-more">
                        <ul class="piped">
                            <?php 
    foreach ($event->themes as $ev_theme) {
        ?>
                                <li>
                                    <a href="<?php 
        echo act('theme@events', $ev_theme->slug);
        ?>
">{{$ev_theme->name}}</a>
                                </li>
                            <?php 
    }
    ?>
                        </ul>
                        <a href="{{$link}}" class="btn btn-theme"><?php 
    echo _('See more details');
    ?>
</a>
                    </div>
                <?php 
}
?>
예제 #17
0
<form action="3.php" method="post">
    <label><input type="text" name="number"></label>
    <input type="submit" value="Удалить слова меньше стольки символов">
</form>
<?php 
function act($number)
{
    $text = explode(" ", file_get_contents('3-text.txt'));
    foreach ($text as $key => $item) {
        if (mb_strlen($text[$key]) < $number) {
            unset($text[$key]);
        }
    }
    $open = fopen('3-text.txt', 'w+');
    $textFormatted = implode(" ", $text);
    fwrite($open, $textFormatted);
    fclose($open);
    echo "<pre>";
    print_r($text);
}
if (isset($_POST['number'])) {
    act($_POST['number']);
} else {
    echo "no input";
}
/*Есть текстовый файл. Необходимо удалить из него все слова, длина которых превыщает N символов. Значение N задавать через форму. Проверить работу на кириллических строках - найти ошибку, найти решение.*/
예제 #18
0
?>
        </td>
    </tr>
    <tr>
        <td>18</td><td>Mengirim hasil Umpan Balik ke Renbang</td>
        <td>
            <?php 
echo act($activity['act20']);
?>
        </td>
    </tr>
    <tr>
        <td>19</td><td>Pertanggungjawaban (Copy SPD, copy Daftar Hadir Peserta dan Pengajar, Copy Kuitansi, Copy Surat Perintah, Berita Acara & Invoice, dll) - (bila ada)</td>
        <td>
            <?php 
echo act($activity['act21']);
?>
        </td>
    </tr>
</table>

<p>
    <a href="course/index" class="btn"><i class="icon-hand-left"></i> Kembali ke list</a>
    <!--
    <a href="activity/delete/<?php 
echo $activity['plc_course_id'];
?>
" class="btn btn-warning" onclick="return confirm('Apakah Anda yakin akan menghapus data?')"><i class="icon-remove icon-white"></i> Hapus Dokumen</a>
    -->
</p>
예제 #19
0
&nbsp;&copy;&nbsp;<?php 
echo date('Y');
?>
</span>
            <small>
                <?php 
echo sprintf(_('%sHard work (and poutine!)%s made this real @ Rio&nbsp;de&nbsp;Janeiro'), '<a href="https://about.me/igorsantos07" target="_blank">', '</a>');
?>
                <img src="/img/sugar-loaf-icon.png" title="<?php 
echo _('Marvelous City, place of the Sugar Loaf');
?>
">
            </small>
            <ul>
                <li><a href="<?php 
echo act('site@about');
?>
"><?php 
echo _('About us');
?>
</a></li>
                <li><a href="#"><?php 
echo _('Get in touch');
?>
</a></li>
                <li><a href="https://bitbucket.org/konato/web"><?php 
echo _('We &#9829; open source');
?>
</a></li>
                <li><a target="_blank" href="http://igorsantos.com.br"><?php 
echo _('by igorsantos07');
예제 #20
0
                            <a href="{{$link->url}}">
                                <i class="<?php 
    echo strtr($link->icon, ['-square' => '']);
    ?>
 fa-3x"></i>
                                <span title="<?php 
    echo _('network');
    ?>
" class="sr-only">{{$link->name}}</span>
                                <span title="<?php 
    echo _('username');
    ?>
">{{ltrim($link->username,'://')}}</span>
                            </a>
                            <a href="<?php 
    echo act('user@deleteLink', [$link->id]);
    ?>
" class="text-muted social-link-remove"
                               data-method="delete" data-token="{{csrf_token()}}">
                                <i class="fa fa-times"></i> <span class="sr-only"><?php 
    echo _('Remove this link');
    ?>
</span>
                            </a>
                        </div>
                    </div>
                <?php 
}
?>
            </div>
        </div>
예제 #21
0
$link_speakers = $link_speakers ?? false;
$gender = $gender ?? 'M';
$count = $count ?? 0;
$route = $link_speakers ? 'user@speakers' : 'theme@events';
$tooltip = _r('How many times %s has spoken about this subject', $gender == 'M' ? _('he') : _('she'));
?>
<ul class="themes">
    <?php 
foreach ($themes as $theme) {
    ?>
        <li<?php 
    echo $link_speakers && $count ? ' class="composed"' : '';
    ?>
>
            <a href="<?php 
    echo act($route, $theme->slug);
    ?>
">
                {{$theme->name}}
                <?php 
    if ($link_speakers && $count) {
        ?>
                    <span title="{{$tooltip}}" data-toggle="tooltip"><?php 
        echo $count;
        ?>
</span>
                <?php 
    }
    ?>
            </a>
        </li>
예제 #22
0
                            <hr class="page-divider half"/>
                        @empty
                            <div class="text-center empty-block">
                                <p>
                                    <i class="fa fa-calendar-o"></i>
                                    <?php 
echo _('We found no event with the criteria you gave us. Maybe you could try to be a little broader?');
?>
                                </p>

                                <p><?php 
echo _('If the event really doesn\'t exist, and you know a few details, you can easily create it:');
?>
</p>
                                <a href="<?php 
echo act('event@submit');
?>
" class="btn btn-theme">
                                    <i class="fa fa-calendar-plus-o"></i> <?php 
echo _('Submit a new event');
?>
                                </a>
                            </div>
                        @endforelse
                    </div>

                    <!-- Pagination
                    <div class="pagination-wrapper">
                        <ul class="pagination">
                            <?php 
//TODO: improve styling for disabled buttons
예제 #23
0
    }
    ?>
            <i class="fa fa-ellipsis-h"></i>
        <?php 
}
?>
        <span class="caret"></span>
    </button>

    <ul class="dropdown-menu">
        <?php 
foreach (Arr::except($providers, array_merge($used_providers, (array) $default)) as $provider => $data) {
    ?>
        <li>
            <a href="<?php 
    echo act('auth@provider', compact('provider'));
    ?>
">
                <i class="fa fa-fw fa-<?php 
    echo $size;
    ?>
 fa-<?php 
    echo $data[0];
    ?>
 <?php 
    echo $provider;
    ?>
-color"></i>
                <?php 
    echo $data[1];
    ?>
예제 #24
0
<?php

/** @var bool $signup */
/** @var \App\Models\User $user */
$signup = $signup ?? false;
Form::model($user);
//TODO: find a better way to share form fields
?>

<?php 
echo Form::labelInput('name', _('Name'), 'text', null, ['input' => ['autofocus']]);
?>

<?php 
echo Form::labelInput('email', _('E-mail'), 'email');
?>

<?php 
echo Form::labelInput('username', _('Username'), 'text', null, ['input' => ['data-unset' => 'true', 'prefix' => preg_replace('|https?://|', '', act('user@profile', ['id_slug' => '123']) . '-')], 'help' => _('Use a uniquely identifying name for you. This will also help you to be found in the search. Use only letters, numbers and underlines, from 4 to 30 chars.')]);
?>

<?php 
if ($signup) {
    ?>
    <?php 
    echo Form::labelInput('password', _('Choose a password'), 'password', null, ['help' => _('Use at least 6 chars here. Preferably, with numbers and letters! Bonus points if you include lower-case and upper-case letters, as well as symbols.')]);
    ?>

    <?php 
    echo Form::labelInput('password_confirmation', _('Confirm the password'), 'password', null, ['help' => _('Just to be sure there\'s no typo, could you please repeat that password?')]);
}
예제 #25
0
    if ($columns) {
        ?>
class="col-md-6"<?php 
    }
    ?>
>
            <img src="<?php 
    echo $speaker->avatar;
    ?>
" alt="<?php 
    echo _r('%s on Konato', $speaker->name);
    ?>
" />
            <div>
                <a href="<?php 
    echo act('user@profile', $speaker->slug);
    ?>
"><?php 
    echo $speaker->name;
    ?>
</a>
                <?php 
    //=eval($details)
    ?>
                <?php 
    echo $details;
    ?>
          </div>
        </li>
        <?php 
}