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


PHP common_node::getShared方法代码示例

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


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

示例1: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if (is_numeric($this->GET['id'])) {
         $delete_id = $this->GET['id'];
     } else {
         return false;
     }
     //delete
     if ($this->GET['delete'] && is_numeric($delete_id)) {
         $id_map = $Node->getIdMap();
         /**
          * create confirmation code
          */
         $confirmation_code = md5($delete_id . session_id());
         $this->tpl->assign('CONFIRMATION_CODE', $confirmation_code);
         /**
          * safety check we are not trying to delete some core page
          */
         if (!array_search($delete_id, $id_map)) {
             $node_data = $Node->detail($delete_id);
             if (!is_array($node_data)) {
                 msg("Content ID {$delete_id} does not exists", 'error');
                 return false;
             }
             if ($this->GET['confirm']) {
                 //delete only if confirmation code match
                 if ($this->GET['confirm'] === $confirmation_code) {
                     if ($Node->moveToBin($delete_id)) {
                         msg("{$node_data['node_group']} \"{$node_data['title']}\" (id={$node_data['id']}) has been deleted");
                         //if it was a "page", than go to parent page
                         if ($this->GET['ajax'] == 0) {
                             if ($node_data['node_group'] == 'page') {
                                 onxshopGoTo("/page/{$node_data['parent']}");
                             } else {
                                 onxshopGoTo($_SESSION['last_diff'], 2);
                             }
                         }
                     } else {
                         msg("Can't delete!", 'error');
                     }
                 } else {
                     msg("node_delete: incorrect confirmation code", 'error');
                 }
             } else {
                 //get children
                 $children = $Node->listing("parent = {$delete_id}");
                 foreach ($children as $child) {
                     $this->tpl->assign("CHILD", $child);
                     $this->tpl->parse('content.confirm.children.item');
                 }
                 if (count($children) > 0) {
                     $this->tpl->parse('content.confirm.children');
                 }
                 //get linked as shared content
                 $node_data = $Node->detail($delete_id);
                 $this->tpl->assign("NODE", $node_data);
                 $shared_linked = $Node->getShared($delete_id);
                 foreach ($shared_linked as $linked) {
                     $this->tpl->assign("LINKED", $linked);
                     $this->tpl->parse('content.confirm.linked.item');
                 }
                 if (count($shared_linked) > 0) {
                     $this->tpl->parse('content.confirm.linked');
                 }
                 $this->tpl->parse('content.confirm');
             }
         } else {
             msg("This can't be deleted", 'error');
         }
     }
     return true;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:77,代码来源:node_delete.php


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