Exemplo n.º 1
0
 public function notifyAuthor($ctype_name, $item)
 {
     $users_model = cmsCore::getModel('users');
     $author = $users_model->getUser($item['user_id']);
     $messenger = cmsCore::getController('messages');
     $to = array('email' => $author['email'], 'name' => $author['nickname']);
     $letter = array('name' => 'moderation_refused');
     $messenger->sendEmail($to, $letter, array('nickname' => $author['nickname'], 'page_title' => $item['title'], 'date' => html_date_time()));
 }
Exemplo n.º 2
0
function grid_scheduler($controller)
{
    $options = array('show_id' => false, 'is_filter' => false);
    $columns = array('id' => array(), 'title' => array('title' => LANG_CP_SCHEDULER_TASK), 'controller' => array('title' => LANG_CP_SCHEDULER_TASK_CONTROLLER, 'width' => 150), 'hook' => array('title' => LANG_CP_SCHEDULER_TASK_HOOK, 'width' => 150), 'is_active' => array('title' => LANG_IS_ENABLED, 'flag' => true, 'width' => 60), 'period' => array('title' => LANG_CP_SCHEDULER_TASK_PERIOD, 'width' => 150), 'date_last_run' => array('title' => LANG_CP_SCHEDULER_TASK_LAST_RUN, 'width' => 150, 'handler' => function ($value) {
        return empty($value) ? '—' : html_date_time($value);
    }));
    $actions = array(array('title' => LANG_CP_SCHEDULER_TASK_RUN, 'class' => 'play', 'href' => href_to($controller->name, 'settings', array('scheduler', 'run', '{id}'))), array('title' => LANG_EDIT, 'class' => 'edit', 'href' => href_to($controller->name, 'settings', array('scheduler', 'edit', '{id}'))), array('title' => LANG_DELETE, 'class' => 'delete', 'href' => href_to($controller->name, 'settings', array('scheduler', 'delete', '{id}')), 'confirm' => LANG_CP_SCHEDULER_TASK_DELETE_CONFIRM));
    return array('options' => $options, 'columns' => $columns, 'actions' => $actions);
}
Exemplo n.º 3
0
 public function run($id = false)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $task = $this->model->getSchedulerTask($id);
     // Проверяем существование контроллера
     if (!cmsCore::isControllerExists($task['controller'])) {
         cmsUser::addSessionMessage(sprintf(LANG_CP_SCHEDULER_TASK_RUN_FAIL, $task['title']), 'error');
         $this->redirectBack();
     }
     $controller = cmsCore::getController($task['controller']);
     // Выполняем хук
     $controller->runHook("cron_{$task['hook']}");
     // Обновляем время последнего запуска задачи
     $this->model->updateSchedulerTaskDate($task['id']);
     cmsUser::addSessionMessage(sprintf(LANG_CP_SCHEDULER_TASK_RAN, $task['title'], html_date_time()));
     $this->redirectBack();
 }
Exemplo n.º 4
0
 public function requestModeration($ctype_name, $item, $is_new_item = true)
 {
     $moderator_id = $this->model->getNextModeratorId($ctype_name);
     $users_model = cmsCore::getModel('users');
     $moderator = $users_model->getUser($moderator_id);
     $author = $users_model->getUser($item['user_id']);
     // добавляем задачу модератору
     $this->model->addModeratorTask($ctype_name, $moderator_id, $is_new_item, $item);
     // отправляем письмо модератору
     $messenger = cmsCore::getController('messages');
     $to = array('email' => $moderator['email'], 'name' => $moderator['nickname']);
     $letter = array('name' => 'moderation');
     $messenger->sendEmail($to, $letter, array('moderator' => $moderator['nickname'], 'author' => $author['nickname'], 'author_url' => href_to_abs('users', $author['id']), 'page_title' => $item['title'], 'page_url' => href_to_abs($ctype_name, $item['slug'] . ".html"), 'date' => html_date_time()));
     cmsUser::addSessionMessage(sprintf(LANG_MODERATION_IDLE, $moderator['nickname']), 'info');
 }
Exemplo n.º 5
0
            if (!$value) {
                continue;
            }
            ?>
                    <div class="field search_field_<?php 
            echo $field;
            ?>
"><?php 
            echo mb_strlen($value) > 280 ? string_short($value, 280) : $value;
            ?>
</div>
                <?php 
        }
        ?>
                <div class="info"><span class="date"><?php 
        echo html_date_time($item['date_pub']);
        ?>
</span></div>
            </div>
        <?php 
    }
    ?>
    </div>
    <?php 
    if ($search_data['count'] > $perpage) {
        ?>
        <?php 
        echo html_pagebar($page, $perpage, $search_data['count'], $page_url, $uri_query);
        ?>
    <?php 
    }
Exemplo n.º 6
0
" class="message <?php 
    if ($message['user']['id'] == $user->id) {
        ?>
message-my<?php 
    }
    ?>
">
        <div class="title">
            <span class="author"><?php 
    echo $message['user']['nickname'];
    ?>
</span>
            <span class="date<?php 
    if ($message['is_new']) {
        ?>
-new<?php 
    }
    ?>
"><?php 
    echo html_date_time($message['date_pub']);
    ?>
</span>
        </div>
        <div class="content"><?php 
    echo $message['content'];
    ?>
</div>
    </div>

<?php 
}
Exemplo n.º 7
0
 private function buildPhotoDetails($photo, $album, $ctype)
 {
     $first_img = current($photo['image']);
     $details = array(array('name' => LANG_PHOTOS_FORMAT, 'value' => strtoupper(pathinfo($first_img, PATHINFO_EXTENSION))), array('name' => LANG_PHOTOS_SIZE, 'value' => $photo['width'] . '×' . $photo['height']));
     if ($photo['date_photo']) {
         $details[] = array('name' => LANG_PHOTOS_DATE, 'value' => html_date_time($photo['date_photo']));
     }
     if (!empty($this->options['types'][$photo['type']])) {
         $details[] = array('name' => LANG_PHOTOS_O_TYPE1, 'value' => $this->options['types'][$photo['type']]);
     }
     $details[] = array('name' => LANG_PHOTOS_ALBUM, 'value' => $album['title'], 'link' => href_to($ctype['name'], $album['slug']) . '.html');
     $details[] = array('name' => LANG_HITS, 'value' => html_spellcount($photo['hits_count'], LANG_HITS_SPELL));
     $details[] = array('name' => LANG_PHOTOS_DOWNLOADS, 'value' => $photo['downloads_count']);
     list($details, $photo, $album, $ctype) = cmsEventsManager::hook('build_photo_details', array($details, $photo, $album, $ctype));
     return $details;
 }
Exemplo n.º 8
0
echo href_to('users', $photo['user']['id']);
?>
" title="<?php 
echo LANG_AUTHOR;
?>
">
                <?php 
echo $photo['user']['nickname'];
?>
            </a>
            <span class="album_date" title="<?php 
echo LANG_DATE_PUB;
?>
">
                <?php 
echo html_date_time($photo['date_pub']);
?>
            </span>
        </div>

        <div class="like_buttons info_bar">
        <?php 
if (!empty($photo['rating_widget'])) {
    ?>
            <div class="bar_item bi_rating">
                <?php 
    echo $photo['rating_widget'];
    ?>
            </div>
        <?php 
}
Exemplo n.º 9
0
            echo $target_url;
            ?>
"><?php 
            html($entry['target_title']);
            ?>
</a>
            <?php 
        }
        ?>
        </div>
        <div class="date">
            <span class="<?php 
        echo $no_approved_class;
        ?>
"><?php 
        echo html_date_time($entry['date_pub']);
        ?>
</span>
            <?php 
        if ($no_approved_class) {
            ?>
                <span class="hide_approved"><?php 
            echo html_bool_span(LANG_CONTENT_NOT_APPROVED, false);
            ?>
</span>
            <?php 
        }
        ?>
        </div>
        <?php 
        if ($is_controls) {
Exemplo n.º 10
0
                <?php 
    if ($notice['options']['is_closeable']) {
        ?>
                    <div class="close-button"><a href="#close" onclick="return icms.messages.noticeAction(<?php 
        echo $notice['id'];
        ?>
, 'close')" title="<?php 
        echo LANG_CLOSE;
        ?>
"></a></div>
                <?php 
    }
    ?>

                <div class="date"><?php 
    echo html_date_time($notice['date_pub']);
    ?>
</div>
                <div class="content"><?php 
    echo $notice['content'];
    ?>
</div>

                <?php 
    if ($notice['actions']) {
        ?>
                    <div class="buttons">
                        <?php 
        foreach ($notice['actions'] as $name => $action) {
            ?>
                            <?php 
Exemplo n.º 11
0
?>

<?php 
if ($item['is_approved'] && $item['approved_by'] && ($user->is_admin || $user->id == $item['user_id'])) {
    ?>
    <div class="content_moderator_info">
        <?php 
    echo LANG_MODERATION_APPROVED_BY;
    ?>
        <a href="<?php 
    echo href_to('users', $item['approved_by']['id']);
    ?>
"><?php 
    echo $item['approved_by']['nickname'];
    ?>
</a>
        <span class="date"><?php 
    echo html_date_time($item['date_approved']);
    ?>
</span>
    </div>
<?php 
}
?>

<?php 
if (!empty($item['comments_widget'])) {
    ?>
    <?php 
    echo $item['comments_widget'];
}
Exemplo n.º 12
0
    echo $message['id'];
    ?>
">
            <div class="title">
                <span class="author"><?php 
    echo $message['user']['nickname'];
    ?>
</span>
                <span class="date<?php 
    if ($message['is_new']) {
        ?>
-new<?php 
    }
    ?>
"><?php 
    echo $is_today ? html_time($message['date_pub']) : html_date_time($message['date_pub']);
    ?>
</span>
            </div>
            <div class="message_text"><?php 
    echo $message['content'];
    ?>
</div>
        </div>
    </div>

<?php 
}
?>
<script type="text/javascript">
    icms.messages.setMsgLastDate('<?php