예제 #1
0
파일: control.php 프로젝트: leowh/colla
 /**
  * Block Admin Page.
  * 
  * @param  int    $index 
  * @param  string $blockID 
  * @access public
  * @return void
  */
 public function admin($index = 0, $blockID = '')
 {
     $this->app->loadLang('block', 'sys');
     $title = $index == 0 ? $this->lang->block->createBlock : $this->lang->block->editBlock;
     if (!$index) {
         $index = $this->block->getLastKey('team') + 1;
     }
     if ($_POST) {
         $this->block->save($index, 'system', 'team');
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::geterror()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
     }
     $block = $this->block->getBlock($index, 'team');
     $blockID = $blockID ? $blockID : ($block ? $block->block : '');
     $blocks = json_decode($this->block->getAvailableBlocks(), true);
     $this->view->blocks = array_merge(array(''), $blocks);
     $this->view->title = $title;
     $this->view->params = $blockID ? json_decode($this->block->{'get' . ucfirst($blockID) . 'Params'}(), true) : array();
     $this->view->blockID = $blockID;
     $this->view->block = $block;
     $this->view->index = $index;
     $this->display();
 }
예제 #2
0
파일: control.php 프로젝트: leowh/colla
 /**
  * Set params when type is rss or html. 
  * 
  * @param  int    $index 
  * @param  string $type 
  * @param  int    $blockID 
  * @access public
  * @return void
  */
 public function set($index, $type, $blockID = 0)
 {
     if ($_POST) {
         $this->block->save($index, $type, 'sys', $blockID);
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::geterror()));
         }
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('index')));
     }
     $block = $blockID ? $this->block->getByID($blockID) : $this->block->getBlock($index);
     if ($block) {
         $type = $block->block;
     }
     $this->view->type = $type;
     $this->view->index = $index;
     $this->view->blockID = $blockID;
     $this->view->block = $block ? $block : array();
     $this->display();
 }
예제 #3
0
파일: model.php 프로젝트: leowh/colla
 /**
  * Save tags.
  * 
  * @param  string    $tags 
  * @access public
  * @return void
  */
 public function save($tags)
 {
     $tags = array_unique(explode(',', $tags));
     foreach ($tags as $tag) {
         if (trim($tag) == '') {
             continue;
         }
         $rank = $this->countRank($tag);
         $count = $this->dao->select('count(*) as count')->from(TABLE_TAG)->where('tag')->eq($tag)->fetch('count');
         if ($count == 0) {
             $this->dao->insert(TABLE_TAG)->data(array('tag' => $tag, 'rank' => $rank))->exec();
         } else {
             $this->dao->update(TABLE_TAG)->set('rank')->eq($rank)->where('tag')->eq($tag)->exec();
         }
     }
     if (!dao::isError()) {
         return true;
     }
     return dao::geterror();
 }
예제 #4
0
 /**
  * setStatus 
  * 
  * @param  string    $orderID 
  * @access public
  * @return void
  */
 public function finish($orderID)
 {
     $order = $this->order->getByID($orderID);
     if ($order->status == 'finished') {
         die($this->lang->order->statusList[$order->status]);
     }
     if ($order->payStatus != 'paid') {
         die($this->lang->order->statusList[$order->payStatus]);
     }
     if ($order->deliveryStatus == 'not_send') {
         die($this->lang->order->statusList[$order->deliveryStatus]);
     }
     $result = $this->order->finish($orderID);
     if ($result) {
         $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
     }
     $this->send(array('result' => 'fail', 'message' => dao::geterror()));
 }
예제 #5
0
 /**
  * Add a blacklist item. 
  * 
  * @access public
  * @return void
  */
 public function addBlacklist()
 {
     $typeList = $this->lang->guarder->blacklistModes;
     if ($_POST) {
         $item = $this->post->identity;
         $type = 'keywords';
         if (validater::checkIP($item)) {
             $type = 'ip';
         }
         if (validater::checkEmail($item)) {
             $type = 'email';
         }
         if (validater::checkAccount($item)) {
             $user = $this->loadModel('user')->getByAccount($item);
             if (!empty($user)) {
                 $type = 'account';
             }
         }
         $result = $this->guarder->punish($type, $item, $this->post->reason, $this->post->expired);
         if ($result) {
             $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('blacklist', "mode={$type}")));
         }
         $this->send(array('result' => 'fail', 'message' => dao::geterror()));
     }
     $this->view->title = $this->lang->guarder->addBlacklist;
     $this->display();
 }
예제 #6
0
파일: control.php 프로젝트: leowh/colla
 /**
  * Edit auth.
  * 
  * @param  string $code 
  * @access public
  * @return void
  */
 public function edit($code)
 {
     if (!empty($_POST)) {
         if (!$this->post->buildin and strpos($this->post->login, '/') !== 0 and !preg_match('/https?\\:\\/\\//Ui', $this->post->login)) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->entry->error->url));
         }
         $this->entry->update($code);
         if (dao::isError()) {
             $this->send(array('result' => 'fail', 'message' => dao::geterror()));
         }
         $this->send(array('result' => 'success', 'locate' => inlink('admin'), 'entries' => $this->entry->getJSONEntries()));
     }
     $entry = $this->entry->getByCode($code);
     if ($entry->size != 'max') {
         $size = json_decode($entry->size);
         $entry->size = 'custom';
         $entry->width = $size->width;
         $entry->height = $size->height;
     }
     $this->view->title = $this->lang->entry->common . $this->lang->colon . $this->lang->entry->edit;
     $this->view->entry = $entry;
     $this->view->code = $code;
     $this->display();
 }