当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsCore::strToURL方法代码示例

本文整理汇总了PHP中cmsCore::strToURL方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::strToURL方法的具体用法?PHP cmsCore::strToURL怎么用?PHP cmsCore::strToURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsCore的用法示例。


在下文中一共展示了cmsCore::strToURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateBlogSeoLink

 /**
  * Генерирует ссылку на блог
  * @param array $blog
  * @return str $seolink
  */
 public function generateBlogSeoLink($blog)
 {
     $seolink = cmsCore::strToURL($blog['title']);
     if (@$blog['id']) {
         $where = ' AND id<>' . $blog['id'];
     } else {
         $where = '';
     }
     $is_exists = $this->inDB->rows_count('cms_blogs', "seolink='{$seolink}'" . $where, 1);
     if ($is_exists) {
         $seolink .= '-' . (@$blog['id'] ? $blog['id'] : date("d-i"));
     }
     return $seolink;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:19,代码来源:blog.class.php

示例2: mb_substr

 if (!$ext) {
     continue;
 }
 if (in_array($ext, array('php', 'htm', 'html', 'htaccess'), true)) {
     cmsCore::addSessionMessage($_LANG['ERROR_TYPE_FILE'] . ': ' . $model->config['filestype'], 'error');
     cmsCore::redirectBack();
 }
 if (!in_array($ext, $maytypes, true)) {
     cmsCore::addSessionMessage($_LANG['ERROR_TYPE_FILE'] . ': ' . $model->config['filestype'], 'error');
     cmsCore::redirectBack();
 }
 // Переводим имя файла в транслит
 // отделяем имя файла от расширения
 $name = mb_substr($name, 0, mb_strrpos($name, '.'));
 // транслитируем
 $name = cmsCore::strToURL(preg_replace('/\\.+\\//', '', $name)) . uniqid();
 // присоединяем расширения файла
 $name .= '.' . $ext;
 // Обрабатываем получившееся имя файла для записи в БД
 $name = cmsCore::strClear($name);
 // Проверяем свободное место
 if ($size_mb > $free_mb && $model->config['filessize']) {
     cmsCore::addSessionMessage($_LANG['YOUR_FILE_LIMIT'] . ' (' . $max_mb . ' ' . $_LANG['MBITE'] . ') ' . $_LANG['IS_OVER_LIMIT'] . '<br>' . $_LANG['FOR_NEW_FILE_DEL_OLD'], 'error');
     cmsCore::redirectBack();
 }
 // Загружаем файл
 if ($inCore->moveUploadedFile($data_array['tmp_name'], PATH . '/upload/userfiles/' . $usr['id'] . '/' . $name, $data_array['error'])) {
     // если загрузили фото, проверяем его
     if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png', 'bmp'), true)) {
         $size = getimagesize(PATH . '/upload/userfiles/' . $usr['id'] . '/' . $name);
         if ($size === false) {
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:files.php

示例3: getCatSeoLink

 public function getCatSeoLink($title = '', $id = 0)
 {
     $seolink = cmsCore::strToURL($title);
     if ($id) {
         $where = ' AND id<>' . $id;
     } else {
         $where = '';
     }
     $is_exists = $this->inDB->rows_count('cms_forum_cats', "seolink='{$seolink}'" . $where, 1);
     if ($is_exists) {
         $seolink .= '-' . $id;
     }
     return $seolink;
 }
开发者ID:r2git,项目名称:icms1,代码行数:14,代码来源:model.php

示例4: clear

 public function clear($component=false, $target=false, $only_old=false) {
     if ($only_old) { return true; }
     
     $prefix = cmsCore::strToURL(cmsCore::c('config')->host) .'_'. $component .'_'. (!empty($target) ? $target .'_' : '');
     $prefix_length = strlen($prefix);
     
     $results = $this->memcached->fetchAll();
     foreach ($results as $result) {
         if (substr($result['key'], 0, $prefix_length) == $prefix) {
             $this->memcached->delete($result['key']);
         }
     }
     
     return true;
 }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:15,代码来源:cache.class.php

示例5: FileUpload

function FileUpload($resourceType, $currentFolder, $sCommand)
{
    if (!isset($_FILES)) {
        global $_FILES;
    }
    $sErrorNumber = '0';
    $sFileName = '';
    if (isset($_FILES['NewFile']) && !is_null($_FILES['NewFile']['tmp_name'])) {
        global $Config;
        $oFile = $_FILES['NewFile'];
        // Map the virtual path to the local server path.
        $sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand);
        // Get the uploaded file name.
        $sFileName = $oFile['name'];
        $sFileName = SanitizeFileName($sFileName);
        $sFileNameName = mb_substr($sFileName, 0, mb_strrpos($sFileName, '.'));
        // Get the extension.
        $path_parts = pathinfo($sFileName);
        $sExtension = mb_strtolower($path_parts['extension']);
        $sFileName = cmsCore::strToURL($sFileNameName) . '.' . $sExtension;
        $sOriginalFileName = $sFileName;
        if (stristr($sExtension, 'php') || stristr($sExtension, 'htm')) {
            $sErrorNumber = '202';
        }
        if (isset($Config['SecureImageUploads'])) {
            if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) {
                $sErrorNumber = '202';
            }
        }
        if (isset($Config['HtmlExtensions'])) {
            if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) && ($detectHtml = DetectHtml($oFile['tmp_name'])) === true) {
                $sErrorNumber = '202';
            }
        }
        // Check if it is an allowed extension.
        if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) {
            $iCounter = 0;
            while (true) {
                $sFilePath = $sServerDir . $sFileName;
                if (is_file($sFilePath)) {
                    $iCounter++;
                    $sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension;
                    $sErrorNumber = '201';
                } else {
                    move_uploaded_file($oFile['tmp_name'], $sFilePath);
                    if (is_file($sFilePath)) {
                        if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
                            break;
                        }
                        $permissions = 0777;
                        if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) {
                            $permissions = $Config['ChmodOnUpload'];
                        }
                        $oldumask = umask(0);
                        chmod($sFilePath, $permissions);
                        umask($oldumask);
                    }
                    break;
                }
            }
            if (file_exists($sFilePath)) {
                //previous checks failed, try once again
                if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) {
                    @unlink($sFilePath);
                    $sErrorNumber = '202';
                } else {
                    if (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) {
                        @unlink($sFilePath);
                        $sErrorNumber = '202';
                    }
                }
            }
        } else {
            $sErrorNumber = '202';
        }
    } else {
        $sErrorNumber = '202';
    }
    $sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
    $sFileUrl = CombinePaths($sFileUrl, $sFileName);
    SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
    exit;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:83,代码来源:commands.php

示例6: applet_cats

function applet_cats() {
    $inCore = cmsCore::getInstance();

    global $_LANG;

    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');

    $do = cmsCore::request('do', 'str', 'add');
    $id = cmsCore::request('id', 'int', -1);

    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) { cmsCore::loadClass('billing'); }

    if ($do == 'delete') {
        $is_with_content = cmsCore::inRequest('content');
        cmsCore::m('content')->deleteCategory($id, $is_with_content);
        
        cmsCore::addSessionMessage(($is_with_content ? $_LANG['AD_CATEGORY_REMOVED'] : $_LANG['AD_CATEGORY_REMOVED_NOT_ARTICLE']), 'success');
        cmsCore::redirect('?view=tree');
    }

    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
        
        if (cmsCore::inRequest('id')) {
            $category['id']          = cmsCore::request('id', 'int', 0);
            $category['title']       = cmsCore::request('title', 'str', $_LANG['AD_SECTION_UNTITLED']);
            $category['parent_id']   = cmsCore::request('parent_id', 'int');
            $category['description'] = cmsCore::request('description', 'html', '');
            $category['description'] = cmsCore::c('db')->escape_string($category['description']);
            $category['published']   = cmsCore::request('published', 'int', 0);
            $category['showdate']    = cmsCore::request('showdate', 'int', 0);
            $category['showcomm']    = cmsCore::request('showcomm', 'int', 0);
            $category['orderby']     = cmsCore::request('orderby', 'str', '');
            $category['orderto']     = cmsCore::request('orderto', 'str', '');
            $category['modgrp_id']   = cmsCore::request('modgrp_id', 'int', 0);
            $category['maxcols']     = cmsCore::request('maxcols', 'int', 0);
            $category['showtags']    = cmsCore::request('showtags', 'int', 0);
            $category['showrss']     = cmsCore::request('showrss', 'int', 0);
            $category['showdesc']    = cmsCore::request('showdesc', 'int', 0);
            $category['is_public']   = cmsCore::request('is_public', 'int', 0);
            $category['url']         = cmsCore::request('url', 'str', '');
            $category['pagetitle']   = cmsCore::request('pagetitle', 'str', '');
            $category['meta_desc']   = cmsCore::request('meta_desc', 'str', '');
            $category['meta_keys']   = cmsCore::request('meta_keys', 'str', '');
            
            if (!empty($category['url'])) {
                $category['url'] = cmsCore::strToURL($category['url'], cmsCore::m('content')->config['is_url_cyrillic']);
            }
            $category['tpl']         = cmsCore::request('tpl', 'str', 'com_content_view');
            
            $category['cost']        = cmsCore::request('cost', 'str', '');
            if (!is_numeric($category['cost'])) { $category['cost'] = ''; }

            $album = array();
            $album['id']      = cmsCore::request('album_id', 'int', 0);
            $album['header']  = cmsCore::request('album_header', 'str', '');
            $album['orderby'] = cmsCore::request('album_orderby', 'str', '');
            $album['orderto'] = cmsCore::request('album_orderto', 'str', '');
            $album['maxcols'] = cmsCore::request('album_maxcols', 'int', 0);
            $album['max']     = cmsCore::request('album_max', 'int', 0);

            if ($album['id']) {
                $category['photoalbum'] = serialize($album);
            } else {
                $category['photoalbum'] = '';
            }

            // получаем старую категорию
            $old = cmsCore::c('db')->get_fields('cms_category', "id='". $category['id'] ."'", '*');
            if (!$old) { cmsCore::error404(); } 
            
            // если сменили категорию
            if ($old['parent_id'] != $category['parent_id']) {
                // перемещаем ее в дереве
                $inCore->nestedSetsInit('cms_category')->MoveNode($category['id'], $category['parent_id']);
                // обновляем сеолинки категорий
                cmsCore::c('db')->updateNsCategorySeoLink('cms_category', $category['id'], cmsCore::m('content')->config['is_url_cyrillic']);
                // Обновляем ссылки меню на категории
                cmsCore::m('content')->updateCatMenu();
                // обновляем сеолинки всех вложенных статей
                cmsCore::m('content')->updateArticlesSeoLink($category['id']);
                cmsCore::addSessionMessage($_LANG['AD_CATEGORY_NEW_URL'], 'info');
            }

            cmsCore::c('db')->update('cms_category', $category, $category['id']);

            // если пришел запрос на обновление ссылок
            // и категория не менялась - если менялась, мы выше все обновили
            if (cmsCore::inRequest('update_seolink') && ($old['parent_id'] == $category['parent_id'])) {
                // обновляем сеолинки категорий
                cmsCore::c('db')->updateNsCategorySeoLink('cms_category', $category['id'], cmsCore::m('content')->config['is_url_cyrillic']);
                // Обновляем ссылки меню на категории
                cmsCore::m('content')->updateCatMenu();
                // обновляем сеолинки всех вложенных статей
                cmsCore::m('content')->updateArticlesSeoLink($category['id']);
                cmsCore::addSessionMessage($_LANG['AD_SECTION_AND_ARTICLES_NEW_URL'], 'info');
            }

//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:cats.php

示例7: createUser

 private function createUser($profile)
 {
     $inCore = cmsCore::getInstance();
     $inDB = cmsDatabase::getInstance();
     $inUser = cmsUser::getInstance();
     cmsCore::loadClass('actions');
     $nickname = $email = $birthdate = '';
     $advanced = array();
     // для вконтакте поолучаем большой аватар, статус и город
     if (strstr($profile->identity, '//vk.com')) {
         $vk = $this->callVk($profile->uid);
         if ($vk) {
             $advanced = array('city' => $vk->city->title, 'status' => $vk->status, 'photo' => $vk->photo_max_orig);
         }
     }
     if (!empty($profile->name->full_name)) {
         // указано полное имя
         $nickname = $profile->name->full_name;
     } elseif (!empty($profile->name->first_name)) {
         // указано имя и фамилия по-отдельности
         $nickname = $profile->name->first_name;
         if (!empty($profile->name->last_name)) {
             $nickname .= ' ' . $profile->name->last_name;
         }
     } elseif (preg_match('/^(http:\\/\\/)([a-zA-Z0-9\\-_]+)\\.([a-zA-Z0-9\\-_]+)\\.([a-zA-Z]{2,6})([\\/]?)$/i', $profile->identity)) {
         // не указано имя, но передан идентификатор в виде домена
         $nickname = parse_url($profile->identity, PHP_URL_HOST);
     }
     $nickname = cmsCore::strClear($nickname);
     $login = substr(str_replace('-', '', cmsCore::strToURL($nickname)), 0, 15);
     if (!$nickname || !$login) {
         // не указано вообще ничего
         $max = $inDB->get_fields('cms_users', 'id>0', 'id', 'id DESC');
         $nickname = $login = 'user' . ($max['id'] + 1);
     }
     // генерируем пароль
     $pass = md5(substr(md5(microtime() . uniqid()), 0, 8));
     if (!empty($profile->email)) {
         $email = cmsCore::strClear($profile->email);
         $already_email = $inDB->get_field('cms_users', "email='{$email}' AND is_deleted=0", 'email');
         if ($already_email == $email) {
             cmsCore::redirect('/auth/error.html');
         }
     }
     if (!empty($profile->dob)) {
         $birthdate = cmsCore::strClear($profile->dob);
     }
     // проверяем занятость логина
     if ($inDB->get_field('cms_users', "login='{$login}' AND is_deleted=0", 'login') == $login) {
         // если логин занят, добавляем к нему ID
         $max = $inDB->get_fields('cms_users', 'id>0', 'id', 'id DESC');
         $login .= $max['id'] + 1;
     }
     $user_array = cmsCore::callEvent('USER_BEFORE_REGISTER', array('status' => !empty($advanced['status']) ? $advanced['status'] : '', 'status_date' => date('Y-m-d H:i:s'), 'login' => $login, 'nickname' => $nickname, 'password' => $pass, 'email' => $email, 'birthdate' => $birthdate, 'group_id' => $this->reg_model->config['default_gid'], 'regdate' => date('Y-m-d H:i:s'), 'logdate' => date('Y-m-d H:i:s'), 'invited_by' => 0, 'openid' => md5($profile->identity)));
     $user_array['id'] = $user_id = $inDB->insert('cms_users', $user_array);
     // создаем профиль пользователя
     if ($user_id) {
         $filename = 'nopic.jpg';
         // если есть аватар, пробуем скачать
         if (!empty($profile->photo) || !empty($advanced['photo'])) {
             $photo_path = $this->downloadAvatar(!empty($advanced['photo']) ? $advanced['photo'] : $profile->photo);
             if ($photo_path) {
                 cmsCore::includeGraphics();
                 $uploaddir = PATH . '/images/users/avatars/';
                 $filename = md5($photo_path . '-' . $user_id . '-' . time()) . '.jpg';
                 $uploadavatar = $uploaddir . $filename;
                 $uploadthumb = $uploaddir . 'small/' . $filename;
                 $cfg = $inCore->loadComponentConfig('users');
                 @img_resize($photo_path, $uploadavatar, $cfg['medw'], $cfg['medh']);
                 @img_resize($photo_path, $uploadthumb, $cfg['smallw'], $cfg['smallw']);
                 @unlink($photo_path);
             }
         }
         $inUser->loadUserGeo();
         $inDB->insert('cms_user_profiles', array('city' => !empty($advanced['city']) ? $advanced['city'] : $inUser->city, 'user_id' => $user_id, 'imageurl' => $filename, 'gender' => !empty($profile->gender) ? strtolower($profile->gender) : 'm'));
         cmsCore::callEvent('USER_REGISTER', $user_array);
         cmsActions::log('add_user', array('object' => '', 'user_id' => $user_id, 'object_url' => '', 'object_id' => $user_id, 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => ''));
         if ($this->reg_model->config['send_greetmsg']) {
             $this->reg_model->sendGreetsMessage($user_id);
         }
         return $user_id;
     }
     return false;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:84,代码来源:plugin.php

示例8: updateArticle

 /**
  * Обновляет статью
  * @return bool
  */
 public function updateArticle($id, $article, $not_upd_seo = false)
 {
     $article['id'] = $id;
     if (!$not_upd_seo) {
         if (@$article['url']) {
             $article['url'] = cmsCore::strToURL($article['url'], $this->config['is_url_cyrillic']);
         }
         $article['seolink'] = $this->getSeoLink($article);
     } else {
         unset($article['seolink']);
         unset($article['url']);
     }
     if (!$article['user_id']) {
         $article['user_id'] = cmsUser::getInstance()->id;
     }
     $article = cmsCore::callEvent('UPDATE_ARTICLE', $article);
     $this->inDB->update('cms_content', $article, $id);
     if (!$not_upd_seo) {
         $this->updateContentCommentsLink($id);
     }
     cmsInsertTags($article['tags'], 'content', $id);
     return true;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:27,代码来源:model.php

示例9: applet_cats

function applet_cats()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    $GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $do = cmsCore::request('do', 'str', 'add');
    $id = cmsCore::request('id', 'int', -1);
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    if ($do == 'delete') {
        $is_with_content = cmsCore::inRequest('content');
        $model->deleteCategory($id, $is_with_content);
        cmsCore::addSessionMessage($is_with_content ? $_LANG['AD_CATEGORY_REMOVED'] : $_LANG['AD_CATEGORY_REMOVED_NOT_ARTICLE'], 'success');
        cmsCore::redirect('?view=tree');
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $category['id'] = cmsCore::request('id', 'int', 0);
        $category['title'] = cmsCore::request('title', 'str', $_LANG['AD_SECTION_UNTITLED']);
        $category['parent_id'] = cmsCore::request('parent_id', 'int');
        $category['description'] = cmsCore::request('description', 'html');
        $category['description'] = $inDB->escape_string($category['description']);
        $category['published'] = cmsCore::request('published', 'int', 0);
        $category['showdate'] = cmsCore::request('showdate', 'int', 0);
        $category['showcomm'] = cmsCore::request('showcomm', 'int', 0);
        $category['orderby'] = cmsCore::request('orderby', 'str');
        $category['orderto'] = cmsCore::request('orderto', 'str');
        $category['modgrp_id'] = cmsCore::request('modgrp_id', 'int', 0);
        $category['maxcols'] = cmsCore::request('maxcols', 'int', 0);
        $category['showtags'] = cmsCore::request('showtags', 'int', 0);
        $category['showrss'] = cmsCore::request('showrss', 'int', 0);
        $category['showdesc'] = cmsCore::request('showdesc', 'int', 0);
        $category['is_public'] = cmsCore::request('is_public', 'int', 0);
        $category['url'] = cmsCore::request('url', 'str');
        $category['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
        $category['meta_desc'] = cmsCore::request('meta_desc', 'str');
        $category['meta_keys'] = cmsCore::request('meta_keys', 'str');
        if ($category['url']) {
            $category['url'] = cmsCore::strToURL($category['url'], $model->config['is_url_cyrillic']);
        }
        $category['tpl'] = cmsCore::request('tpl', 'str', 'com_content_view.tpl');
        $category['cost'] = cmsCore::request('cost', 'str', '');
        if (!is_numeric($category['cost'])) {
            $category['cost'] = '';
        }
        $album = array();
        $album['id'] = cmsCore::request('album_id', 'int', 0);
        $album['header'] = cmsCore::request('album_header', 'str', '');
        $album['orderby'] = cmsCore::request('album_orderby', 'str', '');
        $album['orderto'] = cmsCore::request('album_orderto', 'str', '');
        $album['maxcols'] = cmsCore::request('album_maxcols', 'int', 0);
        $album['max'] = cmsCore::request('album_max', 'int', 0);
        if ($album['id']) {
            $category['photoalbum'] = serialize($album);
        } else {
            $category['photoalbum'] = '';
        }
        // получаем старую категорию
        $old = $inDB->get_fields('cms_category', "id='{$category['id']}'", '*');
        if (!$old) {
            cmsCore::error404();
        }
        // если сменили категорию
        if ($old['parent_id'] != $category['parent_id']) {
            // перемещаем ее в дереве
            $inCore->nestedSetsInit('cms_category')->MoveNode($category['id'], $category['parent_id']);
            // обновляем сеолинки категорий
            $inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
            // Обновляем ссылки меню на категории
            $model->updateCatMenu();
            // обновляем сеолинки всех вложенных статей
            $model->updateArticlesSeoLink($category['id']);
            cmsCore::addSessionMessage($_LANG['AD_CATEGORY_NEW_URL'], 'info');
        }
        $inDB->update('cms_category', $category, $category['id']);
        // если пришел запрос на обновление ссылок
        // и категория не менялась - если менялась, мы выше все обновили
        if (cmsCore::inRequest('update_seolink') && $old['parent_id'] == $category['parent_id']) {
            // обновляем сеолинки категорий
            $inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
            // Обновляем ссылки меню на категории
            $model->updateCatMenu();
            // обновляем сеолинки всех вложенных статей
            $model->updateArticlesSeoLink($category['id']);
            cmsCore::addSessionMessage($_LANG['AD_SECTION_AND_ARTICLES_NEW_URL'], 'info');
        }
        if (!cmsCore::request('is_access', 'int', 0)) {
            $showfor = $_REQUEST['showfor'];
            cmsCore::setAccess($category['id'], $showfor, 'category');
        } else {
            cmsCore::clearAccess($category['id'], 'category');
        }
//.........这里部分代码省略.........
开发者ID:r2git,项目名称:icms1,代码行数:101,代码来源:cats.php

示例10: cms_clubs

                $cfg['watermark'] = 0;
            }
            @img_resize($uploadphoto, $uploadthumb, $cfg['thumb1'], $cfg['thumb1'], $cfg['thumbsqr']);
            @img_resize($uploadphoto, $uploadphoto, $cfg['thumb2'], $cfg['thumb2'], $cfg['thumbsqr']);
        } else {
            $msg = $inCore->uploadError();
        }
    } else {
        $filename = '';
    }
    //insert into db
    $sql = "INSERT INTO cms_clubs (admin_id, title, description, imageurl, pubdate, clubtype, published, maxsize, enabled_blogs, enabled_photos)\r\n                    VALUES ({$admin_id}, '{$title}', '{$description}', '{$filename}', '{$pubdate}', '{$clubtype}', '{$published}', '{$maxsize}', '{$enabled_blogs}', '{$enabled_photos}')";
    dbQuery($sql);
    $id = dbLastId('cms_clubs');
    //create blog
    $blog_seolink = cmsCore::strToURL($title);
    $sql = "INSERT INTO cms_blogs (user_id, title, pubdate, allow_who, view_type, showcats, ownertype, premod, forall, owner, seolink)\r\n                    VALUES ('{$id}', 'Блог', NOW(), 'all', 'list', 1, 'multi', 0, 0, 'club', '{$blog_seolink}')";
    dbQuery($sql);
    $moders = $_POST['moderslist'];
    $members = $_POST['memberslist'];
    if (array_search($admin_id, $moders)) {
        unset($moders[array_search($admin_id, $moders)]);
    }
    if (array_search($admin_id, $members)) {
        unset($members[array_search($admin_id, $members)]);
    }
    clubSaveUsers($id, $moders, 'moderator');
    clubSaveUsers($id, $members, 'member');
    header('location:?view=components&do=config&opt=list&id=' . $_REQUEST['id']);
}
if ($opt == 'update') {
开发者ID:ratmir-by,项目名称:icms-calendar,代码行数:31,代码来源:backend.php

示例11: getFieldsInputValues

 /**
  * Проверяет значения формы
  * @param int $form_id ID формы
  * @return array
  */
 public static function getFieldsInputValues($form_id)
 {
     // Получаем данные без mysqli_real_escape_string
     $form_array = cmsCore::request('field', 'array');
     if (!$form_array) {
         return array();
     }
     $formObj = new self($form_id, $form_array);
     if (!$formObj->form || !$formObj->form_fields) {
         return array();
     }
     global $_LANG;
     $inUser = cmsUser::getInstance();
     $output = array();
     // Заполняем выходной массив значений
     // $output['values'] массив значений полей
     // $output['errors'] массив ошибок полей
     foreach ($formObj->form_fields as $field) {
         // Значение поля
         $field_value = array_key_exists($field['id'], $formObj->values) ? $formObj->values[$field['id']] : '';
         $error = '';
         // проверяем заполненность текстового поля если нужно
         if ($field['mustbe'] && !$field_value && $field['kind'] != 'file') {
             $error = $_LANG['FIELD'] . ' "' . $field['title'] . '" ' . $_LANG['MUST_BE_FILLED'];
         } else {
             cmsUser::sessionPut('form_last_' . $formObj->form_id . '_' . $field['id'], htmlspecialchars($field_value));
         }
         // Загружаем файл если он есть в форме
         if ($field['kind'] == 'file') {
             // старые значения если есть
             $old_url = $field_value['url'];
             $old_name = $field_value['name'];
             $output['values'][$field['id']] = array();
             if (!$_FILES['field']['name'][$field['id']]) {
                 // Поле обязательно для заполнения?
                 if ($field['mustbe'] && !$old_url) {
                     $error = $_LANG['FIELD'] . ' "' . $field['title'] . '" ' . $_LANG['MUST_BE_FILLED'];
                 } else {
                     // если пришел флаг на удаление
                     if (isset($field_value['delete'])) {
                         $formObj->deleteFile($old_url);
                         $old_url = '';
                         $old_name = '';
                     }
                     $output['values'][$field['id']] = array('name' => $old_name, 'url' => $old_url);
                 }
             } else {
                 // директория загрузки
                 $upload_dir = PATH . '/upload/forms/' . $form_id . '/' . $inUser->id;
                 @mkdir($upload_dir, 0777, true);
                 @chmod($upload_dir, 0777);
                 // проверяем расширение файла
                 $maytypes = explode(',', $field['config']['ext']);
                 $ext = mb_strtolower(pathinfo($_FILES['field']['name'][$field['id']], PATHINFO_EXTENSION));
                 if (!in_array($ext, $maytypes)) {
                     $error = $_LANG['ERROR_TYPE_FILE'] . $field['config']['ext'];
                 }
                 // имя файла
                 $file_name = cmsCore::strToURL(pathinfo($_FILES['field']['name'][$field['id']], PATHINFO_FILENAME));
                 $dest = $upload_dir . '/' . $file_name . uniqid() . '.' . $ext;
                 if (!$error) {
                     if (!cmsCore::moveUploadedFile($_FILES['field']['tmp_name'][$field['id']], $dest, $_FILES['field']['error'][$field['id']])) {
                         $error = cmsCore::uploadError();
                     } else {
                         $formObj->deleteFile($old_url);
                         $output['values'][$field['id']] = array('name' => $file_name, 'url' => str_replace(PATH, '', $dest));
                     }
                 }
             }
         } else {
             // Заполняем массив значений полей, ключи массива id поля
             $output['values'][$field['id']] = $field['config']['max'] ? mb_substr(strip_tags($field_value), 0, $field['config']['max']) : strip_tags($field_value);
         }
         // Заполняем массив ошибок
         $output['errors'][$field['id']] = $error;
     }
     // если были ошибки, удаляем загруженный файл, если он есть
     if (!empty($dest)) {
         foreach ($output['errors'] as $field_error) {
             if ($field_error) {
                 @unlink($dest);
                 break;
             }
         }
     }
     return $output;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:92,代码来源:form.class.php

示例12: updateArticle

    /**
     * Обновляет статью
     * @return bool
     */
    public function updateArticle($id, $article, $not_upd_seo = false) {
        $article['id'] = $id;
        
        cmsCore::setIdUploadImage('', $article['id'], 'content');
        cmsCore::requestUploadImgTitles($article['id'], 'content');
        cmsCore::updateComImages($article['id'], 'content', '', 'cms_content', 'images');

        if (!$not_upd_seo) {
            if (@$article['url']) {
                $article['url'] = cmsCore::strToURL($article['url'], $this->config['is_url_cyrillic']);
            }

            $article['seolink'] = $this->getSeoLink($article);
        } else {
            unset($article['seolink']);
            unset($article['url']);
        }

        if (!$article['user_id']) {
            $article['user_id'] = cmsCore::c('user')->id;
        }

        $article = cmsCore::callEvent('UPDATE_ARTICLE', $article);

        cmsCore::c('db')->update('cms_content', $article, $id);

        if (!$not_upd_seo) {
            $this->updateContentCommentsLink($id);
        }

        cmsInsertTags($article['tags'], 'content', $id);

        return true;
    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:38,代码来源:model.php

示例13: iframeVkAuth

    private function iframeVkAuth($user_id = 0) {
        $iframe_user_id = cmsCore::request('viewer_id', 'int', 0, 'get');

        if ($user_id != 0) {
            if ($_SESSION['user']['iframe_user_id'] == $iframe_user_id) {
                return true;
            }
        }
        
        if (!empty($iframe_user_id)) {
            $user = $this->loadUser(0, "u.iframe_provider = 'vk' and u.iframe_user_id = '". $iframe_user_id ."'");

            if ($user) {
                $_SESSION['user'] = $user;
                cmsCore::callEvent('USER_LOGIN', $_SESSION['user']);
                self::setUserLogdate($user['id']);
            } else {
                $opt = $options = array();
                
                $options['user_ids'] = $iframe_user_id;
                $options['fields'] = 'city,country,screen_name,bdate,sex,photo_max_orig,photo_400_orig,photo_200_orig,photo_100';
                $options['v'] = '5.8';
                $options['lang'] = 'ru';
                ksort($options);

                foreach ($options as $k => $v){
                    $opt[] = $k .'='. urlencode($v);
                }
                
                $response = cmsCore::c('curl')->request('get', 'https://api.vk.com/method/users.get?'. implode('&', $opt))->json();
                
                if (!empty($response) && !empty($response['response'][0]['id'])) {
                    $response = $response['response'][0];
                    
                    $new_user = array(
                        'nickname' => cmsCore::c('db')->escape_string($response['last_name'] .' '. $response['first_name']),
                        'login' => preg_match('#^[0-9]+$#is', $response['screen_name']) ? cmsCore::strToURL($response['last_name'] .' '. $response['first_name']) : $response['screen_name']
                    );
                    
                    if (isset($response['bdate']) && preg_match('#([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})#is', $response['bdate'], $bd)) {
                        $new_user['birthdate'] = $bd[3] .'-'. (mb_strlen($bd[2])<2 ? '0'. $bd[2] : $bd[2]) .'-'. (mb_strlen($bd[1])<2 ? '0'. $bd[1] : $bd[1]);
                    }
                    
                    $new_user['gender'] = ($response['sex'] == 2 ? 'm' : ($response['sex'] == 1 ? 'f' : 0));
                    
                    $new_user['city'] = '';
                    if (isset($response['city'])) {
                        $new_user['city'] = cmsCore::c('db')->escape_string($response['city']['title']);
                    }
                    
                    $new_user['iframe_provider'] = 'vk';
                    $new_user['iframe_user_id'] = $iframe_user_id;
                    $new_user['regdate'] = date('Y-m-d H:i:s');
                    $new_user['photo'] = isset($response['photo_max_orig']) ? $response['photo_max_orig'] : (isset($response['photo_400_orig']) ? $response['photo_400_orig'] : (isset($response['photo_200_orig']) ? $response['photo_200_orig'] : $response['photo_100']));
                    
                    $new_user['id'] = cmsCore::c('db')->insert('cms_users', $new_user);
                    
                    if (!$new_user['id']) { return false; }
                    
                    if (!empty($new_user['photo'])) {
                        $d1 = ceil($new_user['id']/10000);
                        $d2 = ceil($new_user['id']/100);
                        
                        if (!is_dir(PATH .'/images/users/avatars/'. $d1)) {
                            mkdir(PATH .'/images/users/avatars/'. $d1, 0777, true);
                        }
                        if (!is_dir(PATH .'/images/users/avatars/'. $d1 .'/'. $d2)) {
                            mkdir(PATH .'/images/users/avatars/'. $d1 .'/'. $d2, 0777, true);
                        }
                        if (!is_dir(PATH .'/images/users/avatars/small/'. $d1)) {
                            mkdir(PATH .'/images/users/avatars/small/'. $d1, 0777, true);
                        }
                        if (!is_dir(PATH .'/images/users/avatars/small/'. $d1 .'/'. $d2)) {
                            mkdir(PATH .'/images/users/avatars/small/'. $d1 .'/'. $d2, 0777, true);
                        }

                        cmsCore::c('images')->mresize_type = 'auto';
                        cmsCore::c('images')->small_type = 'exact';
                        
                        cmsCore::c('images')->medium_dir = PATH .'/images/users/avatars/'. $d1 .'/'. $d2 .'/';
                        cmsCore::c('images')->small_dir = PATH .'/images/users/avatars/small/'. $d1 .'/'. $d2 .'/';
                        
                        cmsCore::c('images')->new_mw = cmsCore::m('users')->config['medw'];
                        cmsCore::c('images')->new_mh = cmsCore::m('users')->config['medh'];
                        
                        cmsCore::c('images')->new_sw = cmsCore::m('users')->config['smallw'];
                        cmsCore::c('images')->new_sh = cmsCore::m('users')->config['smallw'];
                        
                        $new_user['imageurl'] = $d1 .'/'. $d2 .'/'. cmsCore::c('images')->resize($new_user['photo']);
                    }
                    
                    $new_user['user_id'] = $new_user['id'];
                    cmsCore::c('db')->insert('cms_user_profiles', $new_user);
                    
                    $user = $this->loadUser($new_user['id']);
                    
                    $_SESSION['user'] = $user;
                    
                    cmsCore::callEvent('USER_LOGIN', $_SESSION['user']);
                    
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:user.class.php

示例14: applet_cats

function applet_cats()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    global $_LANG;
    $GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $small = $model->config['img_small_w'];
    $big = $model->config['img_big_w'];
    $do = cmsCore::request('do', 'str', 'add');
    $id = cmsCore::request('id', 'int', -1);
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    if ($do == 'delete') {
        $is_with_content = cmsCore::inRequest('content');
        $model->deleteCategory($id, $is_with_content);
        cmsCore::addSessionMessage($is_with_content ? $_LANG['AD_CATEGORY_REMOVED'] : $_LANG['AD_CATEGORY_REMOVED_NOT_ARTICLE'], 'success');
        cmsCore::redirect('?view=tree');
    }
    //update from categories table
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $category['id'] = cmsCore::request('id', 'int', 0);
        $category['title'] = cmsCore::request('title', 'str', $_LANG['AD_SECTION_UNTITLED']);
        $category['parent_id'] = cmsCore::request('parent_id', 'int');
        $category['description'] = cmsCore::request('description', 'html');
        $category['description'] = $inDB->escape_string($category['description']);
        $category['published'] = cmsCore::request('published', 'int', 0);
        $category['showdate'] = cmsCore::request('showdate', 'int', 0);
        $category['showcomm'] = cmsCore::request('showcomm', 'int', 0);
        $category['orderby'] = cmsCore::request('orderby', 'str');
        $category['orderto'] = cmsCore::request('orderto', 'str');
        $category['modgrp_id'] = cmsCore::request('modgrp_id', 'int', 0);
        $category['maxcols'] = cmsCore::request('maxcols', 'int', 0);
        $category['showtags'] = cmsCore::request('showtags', 'int', 0);
        $category['showrss'] = cmsCore::request('showrss', 'int', 0);
        $category['showdesc'] = cmsCore::request('showdesc', 'int', 0);
        $category['is_public'] = cmsCore::request('is_public', 'int', 0);
        $category['url'] = cmsCore::request('url', 'str');
        $category['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
        $category['meta_desc'] = cmsCore::request('meta_desc', 'str');
        $category['meta_keys'] = cmsCore::request('meta_keys', 'str');
        $category['redirect_url'] = cmsCore::request('redirect_url', 'str');
        //new
        $category['show_in_main'] = cmsCore::request('show_in_main', 'int', 0);
        //new
        $category['perpage_item'] = cmsCore::request('perpage_item', 'str');
        //new
        if ($category['url']) {
            $category['url'] = cmsCore::strToURL($category['url'], $model->config['is_url_cyrillic']);
        }
        $category['tpl'] = cmsCore::request('tpl', 'str', 'com_content_view.tpl');
        $category['cost'] = cmsCore::request('cost', 'str', '');
        if (!is_numeric($category['cost'])) {
            $category['cost'] = '';
        }
        $album = array();
        $album['id'] = cmsCore::request('album_id', 'int', 0);
        $album['header'] = cmsCore::request('album_header', 'str', '');
        $album['orderby'] = cmsCore::request('album_orderby', 'str', '');
        $album['orderto'] = cmsCore::request('album_orderto', 'str', '');
        $album['maxcols'] = cmsCore::request('album_maxcols', 'int', 0);
        $album['max'] = cmsCore::request('album_max', 'int', 0);
        if ($album['id']) {
            $category['photoalbum'] = serialize($album);
        } else {
            $category['photoalbum'] = '';
        }
        // получаем старую категорию
        $old = $inDB->get_fields('cms_category', "id='{$category['id']}'", '*');
        if (!$old) {
            cmsCore::error404();
        }
        // если сменили категорию
        if ($old['parent_id'] != $category['parent_id']) {
            // перемещаем ее в дереве
            $inCore->nestedSetsInit('cms_category')->MoveNode($category['id'], $category['parent_id']);
            // обновляем сеолинки категорий
            $inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
            // Обновляем ссылки меню на категории
            $model->updateCatMenu();
            // обновляем сеолинки всех вложенных статей
            $model->updateArticlesSeoLink($category['id']);
            cmsCore::addSessionMessage($_LANG['AD_CATEGORY_NEW_URL'], 'info');
        }
        $inDB->update('cms_category', $category, $category['id']);
        // если пришел запрос на обновление ссылок
        // и категория не менялась - если менялась, мы выше все обновили
        if (cmsCore::inRequest('update_seolink') && $old['parent_id'] == $category['parent_id']) {
            // обновляем сеолинки категорий
            $inDB->updateNsCategorySeoLink('cms_category', $category['id'], $model->config['is_url_cyrillic']);
            // Обновляем ссылки меню на категории
            $model->updateCatMenu();
            // обновляем сеолинки всех вложенных статей
//.........这里部分代码省略.........
开发者ID:vityapro,项目名称:cms,代码行数:101,代码来源:cats.php

示例15: applet_cats

function applet_cats()
{
    $inCore = cmsCore::getInstance();
    global $_LANG;
    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    $do = cmsCore::request('do', 'str', 'add');
    $id = cmsCore::request('id', 'int', -1);
    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) {
        cmsCore::loadClass('billing');
    }
    if ($do == 'delete') {
        $is_with_content = cmsCore::inRequest('content');
        cmsCore::m('content')->deleteCategory($id, $is_with_content);
        cmsCore::addSessionMessage($is_with_content ? $_LANG['AD_CATEGORY_REMOVED'] : $_LANG['AD_CATEGORY_REMOVED_NOT_ARTICLE'], 'success');
        cmsCore::redirect('?view=tree');
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        if (cmsCore::inRequest('id')) {
            $category['id'] = cmsCore::request('id', 'int', 0);
            $category['title'] = cmsCore::request('title', 'str', $_LANG['AD_SECTION_UNTITLED']);
            $category['parent_id'] = cmsCore::request('parent_id', 'int');
            $category['description'] = cmsCore::request('description', 'html', '');
            $category['description'] = cmsCore::c('db')->escape_string($category['description']);
            $category['published'] = cmsCore::request('published', 'int', 0);
            $category['showdate'] = cmsCore::request('showdate', 'int', 0);
            $category['showcomm'] = cmsCore::request('showcomm', 'int', 0);
            $category['orderby'] = cmsCore::request('orderby', 'str', '');
            $category['orderto'] = cmsCore::request('orderto', 'str', '');
            $category['modgrp_id'] = cmsCore::request('modgrp_id', 'int', 0);
            $category['maxcols'] = cmsCore::request('maxcols', 'int', 0);
            $category['showtags'] = cmsCore::request('showtags', 'int', 0);
            $category['showrss'] = cmsCore::request('showrss', 'int', 0);
            $category['showdesc'] = cmsCore::request('showdesc', 'int', 0);
            $category['is_public'] = cmsCore::request('is_public', 'int', 0);
            $category['url'] = cmsCore::request('url', 'str', '');
            $category['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
            $category['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
            $category['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
            if (!empty($category['url'])) {
                $category['url'] = cmsCore::strToURL($category['url'], cmsCore::m('content')->config['is_url_cyrillic']);
            }
            $category['tpl'] = cmsCore::request('tpl', 'str', 'com_content_view');
            $category['cost'] = cmsCore::request('cost', 'str', '');
            if (!is_numeric($category['cost'])) {
                $category['cost'] = '';
            }
            $album = array();
            $album['id'] = cmsCore::request('album_id', 'int', 0);
            $album['header'] = cmsCore::request('album_header', 'str', '');
            $album['orderby'] = cmsCore::request('album_orderby', 'str', '');
            $album['orderto'] = cmsCore::request('album_orderto', 'str', '');
            $album['maxcols'] = cmsCore::request('album_maxcols', 'int', 0);
            $album['max'] = cmsCore::request('album_max', 'int', 0);
            if ($album['id']) {
                $category['photoalbum'] = serialize($album);
            } else {
                $category['photoalbum'] = '';
            }
            // получаем старую категорию
            $old = cmsCore::c('db')->get_fields('cms_category', "id='" . $category['id'] . "'", '*');
            if (!$old) {
                cmsCore::error404();
            }
            // если сменили категорию
            if ($old['parent_id'] != $category['parent_id']) {
                // перемещаем ее в дереве
                $inCore->nestedSetsInit('cms_category')->MoveNode($category['id'], $category['parent_id']);
                // обновляем сеолинки категорий
                cmsCore::c('db')->updateNsCategorySeoLink('cms_category', $category['id'], cmsCore::m('content')->config['is_url_cyrillic']);
                // Обновляем ссылки меню на категории
                cmsCore::m('content')->updateCatMenu();
                // обновляем сеолинки всех вложенных статей
                cmsCore::m('content')->updateArticlesSeoLink($category['id']);
                cmsCore::addSessionMessage($_LANG['AD_CATEGORY_NEW_URL'], 'info');
            }
            cmsCore::c('db')->update('cms_category', $category, $category['id']);
            // если пришел запрос на обновление ссылок
            // и категория не менялась - если менялась, мы выше все обновили
            if (cmsCore::inRequest('update_seolink') && $old['parent_id'] == $category['parent_id']) {
                // обновляем сеолинки категорий
                cmsCore::c('db')->updateNsCategorySeoLink('cms_category', $category['id'], cmsCore::m('content')->config['is_url_cyrillic']);
                // Обновляем ссылки меню на категории
                cmsCore::m('content')->updateCatMenu();
                // обновляем сеолинки всех вложенных статей
                cmsCore::m('content')->updateArticlesSeoLink($category['id']);
                cmsCore::addSessionMessage($_LANG['AD_SECTION_AND_ARTICLES_NEW_URL'], 'info');
            }
            if (!cmsCore::request('is_access', 'int', 0)) {
                $showfor = cmsCore::request('showfor', 'array_int');
                cmsCore::setAccess($category['id'], $showfor, 'category');
            } else {
                cmsCore::clearAccess($category['id'], 'category');
            }
            cmsCore::addSessionMessage($_LANG['AD_CATEGORY_SAVED'], 'success');
            if (!isset($_SESSION['editlist']) || @sizeof($_SESSION['editlist']) == 0) {
//.........这里部分代码省略.........
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:101,代码来源:cats.php


注:本文中的cmsCore::strToURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。