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


PHP cot_error_found函数代码示例

本文整理汇总了PHP中cot_error_found函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_error_found函数的具体用法?PHP cot_error_found怎么用?PHP cot_error_found使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: cot_poll_save

/**
 * Save Poll form
 *
 * @param string $type Poll type
 * @param int $code Poll Code
 * @return bool
 * @global CotDB $db
 */
function cot_poll_save($type = 'index', $code = '')
{
    global $db, $sys, $db_polls, $db_polls_options, $poll_id, $poll_text, $poll_multiple, $poll_state, $poll_options;
    if (isset($poll_id) && !cot_error_found() && $poll_options) {
        if ((int) $poll_id > 0) {
            $db->update($db_polls, array('poll_state' => (int) $poll_state, 'poll_text' => $poll_text, 'poll_multiple' => (int) $poll_multiple), "poll_id = " . (int) $poll_id);
            $newpoll_id = (int) $poll_id;
        } else {
            $db->insert($db_polls, array('poll_type' => $type, 'poll_state' => (int) 0, 'poll_creationdate' => (int) $sys['now'], 'poll_text' => $poll_text, 'poll_multiple' => (int) $poll_multiple, 'poll_code' => (int) $code));
            $newpoll_id = $db->lastInsertId();
        }
        foreach ($poll_options as $key => $val) {
            if (!empty($val)) {
                $key = mb_substr($key, 2);
                if ((int) $key > 0 && (int) $poll_id > 0) {
                    $db->update($db_polls_options, array('po_text' => $val), "po_id = '" . (int) $key . "'");
                    $ids[] = $key;
                } else {
                    $db->insert($db_polls_options, array('po_pollid' => $newpoll_id, 'po_text' => $val, 'po_count' => 0));
                    $ids[] = $db->lastInsertId();
                }
            }
        }
        if ((int) $poll_id > 0 && count($ids) > 0) {
            $sql = $db->delete($db_polls_options, "po_pollid = '" . (int) $newpoll_id . "' AND po_id NOT IN ('" . implode("','", $ids) . "')");
        }
        return $newpoll_id;
    }
    return false;
}
开发者ID:Logodeveloper,项目名称:valencia,代码行数:38,代码来源:polls.functions.php

示例2: defined

<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.register.add.validate
 * [END_COT_EXT]
 */
/**
 * plugin User Group Selector for Cotonti Siena
 * 
 * @package usergroupselector
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('usergroupselector', 'plug');
$usergroup = cot_import('usergroup', 'G', 'ALP');
if (cot_error_found() && !empty($usergroup)) {
    cot_redirect(cot_url('users', 'm=register&usergroup=' . $usergroup, '', true));
}
开发者ID:Andreyjktl,项目名称:cot-freelance,代码行数:22,代码来源:usergroupselector.users.register.add.validate.php

示例3: cot_shield_protect

    exit;
}
if ($a == 'addpost') {
    cot_shield_protect();
    $offer_post['post_pid'] = (int) $id;
    $offer_post['post_oid'] = (int) cot_import('oid', 'G', 'INT');
    $offer_post['post_userid'] = (int) $usr['id'];
    $offer_post['post_date'] = (int) $sys['now'];
    $offer_post['post_text'] = cot_import('posttext', 'P', 'TXT');
    $offer = $db->query("SELECT * FROM {$db_projects_offers} AS o \n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=o.offer_userid\n\t\tWHERE offer_id=" . $offer_post['post_oid'] . " LIMIT 1")->fetch();
    /* === Hook === */
    foreach (cot_getextplugins('projects.offers.addpost.error') as $pl) {
        include $pl;
    }
    /* ===== */
    if (!empty($offer_post['post_text']) && (in_array($usr['id'], array($offer['offer_userid'], $item['item_userid'])) || $usr['isadmin']) && !cot_error_found()) {
        $db->insert($db_projects_posts, $offer_post);
        if ($usr['id'] == $offer['offer_userid']) {
            $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
            $rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $item['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
            cot_mail($item['user_email'], $rsubject, $rbody);
        } else {
            $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
            $rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
            cot_mail($offer['user_email'], $rsubject, $rbody);
        }
        cot_message($L['offers_add_post'], 'ok');
        /* === Hook === */
        foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
开发者ID:ASDAFF,项目名称:cot-freelance,代码行数:31,代码来源:projects.offers.php

示例4: defined

/**
 * [BEGIN_COT_EXT]
 * Hooks=search.list
 * [END_COT_EXT]
 */
/**
 * projects module
 *
 * @package projects
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['projects']['prjsearch'] && ($tab == 'projects' || empty($tab)) && cot_module_active('projects') && !cot_error_found()) {
    if ($rs['projectssub'][0] != 'all' && count($rs['projectssub']) > 0) {
        if ($rs['projectssubcat']) {
            $tempcat = array();
            foreach ($rs['projectssub'] as $scat) {
                $tempcat = array_merge(cot_structure_children('projects', $scat), $tempcat);
            }
            $tempcat = array_unique($tempcat);
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        } else {
            $tempcat = array();
            foreach ($rs['projectssub'] as $scat) {
                $tempcat[] = $db->prep($scat);
            }
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        }
开发者ID:Andreyjktl,项目名称:cot-freelance,代码行数:31,代码来源:projects.search.list.php

示例5: cot_page_update

/**
 * Updates a page in the CMS.
 * @param  integer $id    Page ID
 * @param  array   $rpage Page data
 * @param  array   $auth  Permissions array
 * @return boolean        TRUE on success, FALSE on error
 */
function cot_page_update($id, &$rpage, $auth = array())
{
    global $cache, $cfg, $db, $db_pages, $db_structure, $structure, $L;
    if (cot_error_found()) {
        return false;
    }
    if (count($auth) == 0) {
        $auth = cot_page_auth($rpage['page_cat']);
    }
    if (!empty($rpage['page_alias'])) {
        $page_count = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE page_alias = ? AND page_id != ?", array($rpage['page_alias'], $id))->fetchColumn();
        if ($page_count > 0) {
            $rpage['page_alias'] = $rpage['page_alias'] . rand(1000, 9999);
        }
    }
    $row_page = $db->query("SELECT * FROM {$db_pages} WHERE page_id = ?", $id)->fetch();
    if ($row_page['page_cat'] != $rpage['page_cat'] && $row_page['page_state'] == 0) {
        $db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_code = ? AND structure_area = 'page'", $row_page['page_cat']);
    }
    //$usr['isadmin'] = cot_auth('page', $rpage['page_cat'], 'A');
    if ($rpage['page_state'] == 0) {
        if ($auth['isadmin'] && $cfg['page']['autovalidate']) {
            if ($row_page['page_state'] != 0 || $row_page['page_cat'] != $rpage['page_cat']) {
                $db->query("UPDATE {$db_structure} SET structure_count=structure_count+1 WHERE structure_code = ? AND structure_area = 'page'", $rpage['page_cat']);
            }
        } else {
            $rpage['page_state'] = 1;
        }
    }
    if ($rpage['page_state'] != 0 && $row_page['page_state'] == 0) {
        $db->query("UPDATE {$db_structure} SET structure_count=structure_count-1 WHERE structure_code = ?", $rpage['page_cat']);
    }
    $cache && $cache->db->remove('structure', 'system');
    if (!$db->update($db_pages, $rpage, 'page_id = ?', $id)) {
        return false;
    }
    cot_extrafield_movefiles();
    /* === Hook === */
    foreach (cot_getextplugins('page.edit.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    if (($rpage['page_state'] == 0 || $rpage['page_cat'] != $row_page['page_cat']) && $cache) {
        if ($cfg['cache_page']) {
            $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$rpage['page_cat']]['path']));
            if ($rpage['page_cat'] != $row_page['page_cat']) {
                $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$row_page['page_cat']]['path']));
            }
        }
        if ($cfg['cache_index']) {
            $cache->page->clear('index');
        }
    }
    return true;
}
开发者ID:CrazyFreeMan,项目名称:Cotonti,代码行数:62,代码来源:page.functions.php

示例6: cot_market_update

/**
 * Updates a product in the CMS.
 * @param  integer $id    Product ID
 * @param  array   $ritem Product data
 * @param  array   $auth  Permissions array
 * @return boolean        TRUE on success, FALSE on error
 */
function cot_market_update($id, &$ritem, $auth = array())
{
    global $cache, $cfg, $db, $db_market, $db_structure, $structure, $L;
    if (cot_error_found()) {
        return false;
    }
    if (count($auth) == 0) {
        $auth = cot_market_auth($ritem['item_cat']);
    }
    if (!empty($ritem['item_alias'])) {
        $prd_count = $db->query("SELECT COUNT(*) FROM {$db_market} WHERE item_alias = ? AND item_id != ?", array($ritem['item_alias'], $id))->fetchColumn();
        if ($prd_count > 0) {
            $ritem['item_alias'] = $ritem['item_alias'] . rand(1000, 9999);
        }
    }
    $item = $db->query("SELECT * FROM {$db_market} WHERE item_id = ?", $id)->fetch();
    if (!$cfg['market']['preview']) {
        $ritem['item_state'] = !$cfg['market']['prevalidate'] || $auth['isadmin'] ? 0 : 2;
    } else {
        $ritem['item_state'] = 1;
    }
    if (!$db->update($db_market, $ritem, 'item_id = ?', $id)) {
        return false;
    }
    cot_market_sync($item['item_cat']);
    cot_market_sync($ritem['item_cat']);
    cot_extrafield_movefiles();
    /* === Hook === */
    foreach (cot_getextplugins('market.edit.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    return true;
}
开发者ID:ASDAFF,项目名称:cot-freelance,代码行数:41,代码来源:market.functions.php

示例7: defined

/**
 * [BEGIN_COT_EXT]
 * Hooks=search.list
 * [END_COT_EXT]
 */
/**
 * market module
 *
 * @package market
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['market']['marketsearch'] && ($tab == 'market' || empty($tab)) && cot_module_active('market') && !cot_error_found()) {
    if ($rs['marketsub'][0] != 'all' && count($rs['marketsub']) > 0) {
        if ($rs['marketsubcat']) {
            $tempcat = array();
            foreach ($rs['marketsub'] as $scat) {
                $tempcat = array_merge(cot_structure_children('market', $scat), $tempcat);
            }
            $tempcat = array_unique($tempcat);
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        } else {
            $tempcat = array();
            foreach ($rs['marketsub'] as $scat) {
                $tempcat[] = $db->prep($scat);
            }
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        }
开发者ID:Andreyjktl,项目名称:cot-freelance,代码行数:31,代码来源:market.search.list.php

示例8: defined

<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=forums.editpost.update.done
[END_COT_EXT]
==================== */
/**
 * Polls
 *
 * @package Polls
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($poll) && $poll_id && $is_first_post && !cot_error_found()) {
    $number = cot_poll_save();
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:18,代码来源:polls.forums.editpost.done.php

示例9: editAction

 /**
  * Редактирование рассылки
  * @return string
  * @throws Exception
  */
 public function editAction()
 {
     global $cot_extrafields, $admintitle, $adminpath;
     $id = cot_import('id', 'G', 'INT');
     // id Рассылки
     $act = cot_import('act', 'G', 'ALP');
     if (empty($act)) {
         $act = cot_import('act', 'P', 'ALP');
     }
     $adminpath[] = array(cot_url('admin', array('m' => 'subscribe')), cot::$L['subscribe_subscribes']);
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.admin.edit.first') as $pl) {
         include $pl;
     }
     /* ===== */
     if (!$id) {
         $item = new subscribe_model_Subscribe();
         $admintitle = cot::$L['subscribe_add_new'];
         $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit')), $admintitle);
     } else {
         $item = subscribe_model_Subscribe::getById($id);
         if (!$item) {
             cot_error(cot::$L['subscribe_err_not_found']);
             cot_redirect(cot_url('admin', array('m' => 'subscribe'), '', true));
         }
         if ($act == 'clone') {
             $id = null;
             $item = clone $item;
             $admintitle = cot::$L['subscribe_add_new'];
             $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit')), $admintitle);
         } else {
             $admintitle = $item->title . " [" . cot::$L['Edit'] . "]";
             $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit', 'id' => $item->id)), $admintitle);
         }
     }
     // Сохранение
     if ($act == 'save') {
         unset($_POST['id'], $_POST['user'], $_POST['x'], $_POST['act']);
         /* === Hook === */
         foreach (cot_getextplugins('subscribe.admin.save.first') as $pl) {
             include $pl;
         }
         /* ===== */
         $data = $_POST;
         $data['next_run'] = cot_import_date('next_run');
         if (!empty($data['next_run'])) {
             $data['next_run'] = date('Y-m-d H:i:s', $data['next_run']);
         }
         $item->setData($data);
         /* === Hook === */
         foreach (cot_getextplugins('subscribe.admin.save.validate') as $pl) {
             include $pl;
         }
         /* ===== */
         // There is some errors
         if (!$item->validate() || cot_error_found()) {
             $urlParams = array('m' => 'subscribe', 'a' => 'edit');
             if ($item->id > 0) {
                 $urlParams['id'] = $item->id;
             }
             cot_redirect(cot_url('admin', $urlParams, '', true));
         }
         $isNew = $item->id == 0;
         // Перерасчет времени следующего запуска
         // Делать это в админке при редактировании рассылки и при выполнении рассылки
         // А то могут быть коллизии
         $recalculate = true;
         if (!empty($item->next_run)) {
             $tmp = strtotime($item->next_run);
             if ($tmp > cot::$sys['now']) {
                 $recalculate = false;
             }
         }
         if ($recalculate) {
             $item->next_run = $item->getNextRunDate();
         }
         // Сохранение
         if ($item->save()) {
             cot_message(cot::$L['Saved']);
             $urlParams = array('m' => 'subscribe', 'a' => 'edit', 'id' => $item->id);
             $redirectUrl = cot_url('admin', $urlParams, '', true);
             /* === Hook === */
             foreach (cot_getextplugins('subscribe.admin.save.done') as $pl) {
                 include $pl;
             }
             /* ===== */
             // Редирект на станицу рассылки
             cot_redirect($redirectUrl);
         }
     }
     // 'input_textarea_editor', 'input_textarea_medieditor', 'input_textarea_minieditor', ''
     $editor = 'input_textarea_editor';
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.admin.edit.main') as $pl) {
         include $pl;
//.........这里部分代码省略.........
开发者ID:Alex300,项目名称:subscribe,代码行数:101,代码来源:AdminMain.php

示例10: defined

<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=admin.extensions.install.tags
[END_COT_EXT]
==================== */
/**
 * Adds i18n support to tags when installing the tags plugin after i18n
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($code == 'tags' && $result && !cot_error_found()) {
    include $cfg['plugins_dir'] . '/i18n/setup/i18n.install.php';
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:18,代码来源:i18n.admin.extensions.php

示例11: editAction


//.........这里部分代码省略.........
                 }
             }
         }
         $advert->setData($_POST);
         $advert->begin = $begin;
         $advert->expire = $expire;
         if (!cot::$usr['isadmin']) {
             if (!cot::$cfg['advboard']['cat_' . $c]['allowSticky']) {
                 $advert->sticky = 0;
             }
             if (cot::$usr['id'] == 0) {
                 $advert->sticky = 0;
             }
             // гости не дают срочных объявлений
         }
         $advert->category = $c;
         if (empty($advert->user) || !cot::$usr['isadmin']) {
             $advert->user = cot::$usr['id'];
         }
         $published = cot_import('published', 'P', 'BOL');
         if (!$published) {
             $advert->state = advboard_model_Advert::DRAFT;
         } elseif (cot::$usr['isadmin'] || cot_auth('advboard', $c, '2')) {
             $advert->state = advboard_model_Advert::PUBLISHED;
         } else {
             $advert->state = advboard_model_Advert::AWAITING_MODERATION;
         }
         /* === Hook === */
         foreach (cot_getextplugins('advboard.save.validate') as $pl) {
             include $pl;
         }
         /* ===== */
         // There is some errors
         if (!$advert->validate() || cot_error_found()) {
             $urlParams = array('c' => $c, 'a' => 'edit');
             if ($advert->id > 0) {
                 $urlParams['id'] = $advert->id;
             }
             cot_redirect(cot_url('advboard', $urlParams, '', true));
         }
         if (empty($advert->sort)) {
             $advert->sort = cot::$sys['now'];
         }
         $isNew = $advert->id == 0;
         // Сохранение
         if ($advert->save()) {
             // Для незарега запомним id страницы для чтого, чтобы он мог ее отредактировать в пределах сесии
             if ($isNew) {
                 if (cot::$usr['id'] == 0) {
                     if (empty($_SESSION['advboard'])) {
                         $_SESSION['advboard'] = array();
                     }
                     if (!in_array($id, $_SESSION['advboard'])) {
                         $_SESSION['advboard'][] = $advert->id;
                     }
                 }
                 if ($advert->state == advboard_model_Advert::PUBLISHED) {
                     cot_message(cot::$L['advboard_created']);
                 }
             } else {
                 if ($advert->state == advboard_model_Advert::PUBLISHED) {
                     cot_message(cot::$L['advboard_updated']);
                 }
             }
             if ($advert->state == advboard_model_Advert::AWAITING_MODERATION) {
                 cot_message(cot::$L['advboard_awaiting_moderation']);
开发者ID:ASDAFF,项目名称:advboard,代码行数:67,代码来源:Main.php

示例12: elseif

         } elseif ($ret === false) {
             cot_error(cot_rc('ext_update_error', array('type' => $L['Module'], 'name' => $code)));
         }
     }
 }
 if (count($cot_plugins_enabled) > 0) {
     foreach ($cot_plugins_enabled as $code => $plug) {
         $ret = cot_extension_install($code, false, true);
         if ($ret === true) {
             $updated_ext = true;
         } elseif ($ret === false) {
             cot_error(cot_rc('ext_update_error', array('type' => $L['Plugin'], 'name' => $code)));
         }
     }
 }
 if ($new_rev === false || cot_error_found()) {
     // Display error message
     $t->assign('UPDATE_TITLE', $L['install_update_error']);
 } elseif ($new_rev === true && !$updated_config && !$updated_ext) {
     $t->assign('UPDATE_TITLE', $L['install_update_nothing']);
     $t->assign('UPDATE_COMPLETED_NOTE', '');
     $t->parse('MAIN.COMPLETED');
 } else {
     if ($new_rev === true) {
         $new_rev = $rev;
     } else {
         $db->update($db_updates, array('upd_value' => $new_rev), "upd_param = 'revision'");
     }
     $t->assign('UPDATE_TITLE', cot_rc('install_update_success', array('rev' => $new_rev)));
     $t->assign('UPDATE_COMPLETED_NOTE', $L['install_complete_note']);
     $t->parse('MAIN.COMPLETED');
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:31,代码来源:install.update.php

示例13: defined

/**
 * [BEGIN_COT_EXT]
 * Hooks=search.list
 * [END_COT_EXT]
 */
/**
 * folio module
 *
 * @package folio
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['folio']['foliosearch'] && ($tab == 'folio' || empty($tab)) && cot_module_active('folio') && !cot_error_found()) {
    if ($rs['foliosub'][0] != 'all' && count($rs['foliosub']) > 0) {
        if ($rs['foliosubcat']) {
            $tempcat = array();
            foreach ($rs['foliosub'] as $scat) {
                $tempcat = array_merge(cot_structure_children('folio', $scat), $tempcat);
            }
            $tempcat = array_unique($tempcat);
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        } else {
            $tempcat = array();
            foreach ($rs['foliosub'] as $scat) {
                $tempcat[] = $db->prep($scat);
            }
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        }
开发者ID:Andreyjktl,项目名称:cot-freelance,代码行数:31,代码来源:folio.search.list.php

示例14: cot_error

 $rstructure['structure_title'] || cot_error('adm_structure_title_required', 'rstructuretitle');
 if (!empty($rtplquick)) {
     $rstructure['structure_tpl'] = $rtplquick;
 } elseif ($rtplmode == 3) {
     $rstructure['structure_tpl'] = cot_import('rtplforced', 'P', 'TXT');
 } elseif ($rtplmode == 2) {
     $rstructure['structure_tpl'] = 'same_as_parent';
 } else {
     $rstructure['structure_tpl'] = '';
 }
 /* === Hook === */
 foreach (cot_getextplugins('admin.structure.add.first') as $pl) {
     include $pl;
 }
 /* ===== */
 if (!cot_error_found()) {
     $res = cot_structure_add($n, $rstructure, $is_module);
     if ($res === true) {
         cot_extrafield_movefiles();
         /* === Hook === */
         foreach (cot_getextplugins('admin.structure.add.done') as $pl) {
             include $pl;
         }
         /* ===== */
         cot_message('Added');
     } elseif (is_array($res)) {
         cot_error($res[0], $res[1]);
     } else {
         cot_error('Error');
     }
 }
开发者ID:Logodeveloper,项目名称:valencia,代码行数:31,代码来源:admin.structure.php

示例15: cot_redirect

/**
 * Displays redirect page
 *
 * @param string $url Target URI
 */
function cot_redirect($url)
{
    global $cfg, $env, $error_string, $sys;
    if (cot_error_found() && $_SERVER['REQUEST_METHOD'] == 'POST') {
        // Save the POST data
        if (!empty($error_string)) {
            // Message should not be lost
            cot_error($error_string);
        }
        cot_import_buffer_save();
    }
    if (!cot_url_check($url)) {
        // No redirects to foreign domains
        if ($url == '/' || $url == $sys['site_uri']) {
            $url = COT_ABSOLUTE_URL;
        } else {
            if ($url[0] === '/') {
                $url = mb_substr($url, 1);
            }
            $url = COT_ABSOLUTE_URL . $url;
        }
    }
    if (defined('COT_AJAX') && COT_AJAX) {
        // Save AJAX state, some browsers loose it after redirect (e.g. FireFox 3.6)
        $sep = strpos($url, '?') === false ? '?' : '&';
        $url .= $sep . '_ajax=1';
    }
    if (isset($env['status'])) {
        $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
        header($protocol . ' ' . $env['status']);
    }
    if ($cfg['redirmode']) {
        $output = $cfg['doctype'] . <<<HTM
\t\t<html>
\t\t<head>
\t\t<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
\t\t<meta http-equiv="refresh" content="0; url={$url}" />
\t\t<title>Redirecting...</title></head>
\t\t<body>Redirecting to <a href="{$url}">{$url}</a>
\t\t</body>
\t\t</html>
HTM;
        header('Refresh: 0; URL=' . $url);
        echo $output;
        exit;
    } else {
        header('Location: ' . $url);
        exit;
    }
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:55,代码来源:functions.php


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