Пример #1
0
 /**
  * 提交信息
  */
 public function actionModified()
 {
     $Links = new Links();
     $data = $this->Common->getFilter($_POST);
     $id = (int) $data['lid'];
     unset($data['lid']);
     if ($id == 0) {
         $Links->insert($data);
     } else {
         $Links->update($data, array('lid' => $id));
     }
     $this->jumpBox('成功!', Wave::app()->homeUrl . 'links', 1);
 }
Пример #2
0
function insertProcess()
{
    $send = Request::get('send');
    $valid = Validator::make(array('send.title' => 'required|min:1|slashes', 'send.parentid' => 'slashes', 'send.url' => 'required|min:1|slashes'));
    if (!$valid) {
        throw new Exception("Error Processing Request: " . Validator::getMessage());
    }
    $loadData = Links::get(array('where' => "where url='" . String::encode($send['url']) . "'"));
    if (isset($loadData[0]['url'])) {
        throw new Exception("This link exists in database.");
    }
    if (!($id = Links::insert($send))) {
        throw new Exception("Error. " . Database::$error);
    }
    $updateData = array('sort_order' => $id);
    Links::update($id, $updateData);
}
Пример #3
0
 /**
  * Updates Links into database.
  *
  * @param Links $links
  * @param array $input
  *
  * @return Links
  */
 public function update($links, $input)
 {
     $input['external'] = isset($input['external']) ? $input['external'] : 0;
     return $links->update($input);
 }