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


PHP Jaws_Utils::Delete方法代码示例

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


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

示例1: Run

 /**
  * Does any actions required to finish the stage.
  *
  * @access  public
  * @return  bool|Jaws_Error  Either true on success, or a Jaws_Error
  *                          containing the reason for failure.
  */
 function Run()
 {
     $cleanup_error = false;
     $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/folders.txt');
     $cleanup_items = array_filter(explode("\n", $cleanup_items));
     foreach ($cleanup_items as $item) {
         if (file_exists(JAWS_PATH . $item)) {
             if (!Jaws_Utils::Delete(JAWS_PATH . $item)) {
                 $cleanup_error = true;
             }
         }
     }
     $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/files.txt');
     $cleanup_items = array_filter(explode("\n", $cleanup_items));
     foreach ($cleanup_items as $item) {
         if (file_exists(JAWS_PATH . $item)) {
             if (!Jaws_Utils::Delete(JAWS_PATH . $item)) {
                 $cleanup_error = true;
             }
         }
     }
     if ($cleanup_error) {
         return Jaws_Error::raiseError(_t('UPGRADE_CLEANUP_ERROR_PERMISSION'), 0, JAWS_ERROR_WARNING);
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:33,代码来源:Cleanup.php

示例2: Backup

 /**
  * Returns downloadable backup file
  *
  * @access  public
  * @return void
  */
 function Backup()
 {
     $this->gadget->CheckPermission('Backup');
     $tmpDir = sys_get_temp_dir();
     $domain = preg_replace("/^(www.)|(:{$_SERVER['SERVER_PORT']})\$|[^a-z0-9\\-\\.]/", '', strtolower($_SERVER['HTTP_HOST']));
     $nameArchive = $domain . '-' . date('Y-m-d') . '.tar.gz';
     $pathArchive = $tmpDir . DIRECTORY_SEPARATOR . $nameArchive;
     //Dump database data
     $dbFileName = 'dbdump.xml';
     $dbFilePath = $tmpDir . DIRECTORY_SEPARATOR . $dbFileName;
     Jaws_DB::getInstance()->Dump($dbFilePath);
     $files = array();
     require_once PEAR_PATH . 'File/Archive.php';
     $files[] = File_Archive::read(JAWS_DATA);
     $files[] = File_Archive::read($dbFilePath, $dbFileName);
     File_Archive::extract($files, File_Archive::toArchive($pathArchive, File_Archive::toFiles()));
     Jaws_Utils::Delete($dbFilePath);
     // browser must download file from server instead of cache
     header("Expires: 0");
     header("Pragma: public");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     // force download dialog
     header("Content-Type: application/force-download");
     // set data type, size and filename
     header("Content-Disposition: attachment; filename=\"{$nameArchive}\"");
     header("Content-Transfer-Encoding: binary");
     header('Content-Length: ' . @filesize($pathArchive));
     @readfile($pathArchive);
     Jaws_Utils::Delete($pathArchive);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Backup.php

示例3: DeleteEmblem

 /**
  * Deletes the emblem
  *
  * @access  public
  * @return  array   Response array (notice or error)
  */
 function DeleteEmblem()
 {
     @(list($id) = jaws()->request->fetchAll('post'));
     $model = $this->gadget->model->load('Emblems');
     $emblem = $model->GetEmblem($id);
     $model = $this->gadget->model->loadAdmin('Emblems');
     $res = $model->DeleteEmblem($id);
     if (Jaws_Error::IsError($res)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_QUERY_FAILED'), RESPONSE_ERROR);
         return new Jaws_Error($res->getMessage());
     }
     // delete the file
     if (!empty($emblem['image'])) {
         Jaws_Utils::Delete(JAWS_DATA . 'emblems/' . $emblem['image']);
     }
     $GLOBALS['app']->Session->PushLastResponse(_t('EMBLEMS_DELETED'), RESPONSE_NOTICE);
     return $GLOBALS['app']->Session->PopLastResponse();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:24,代码来源:Ajax.php

示例4: SaveEditEntry

 /**
  * Save changes on an edited blog entry and shows the entries list on admin section
  *
  * @access  public
  */
 function SaveEditEntry()
 {
     $names = array('id', 'edit_timestamp:array', 'pubdate', 'categories:array', 'title', 'fasturl', 'meta_keywords', 'meta_desc', 'tags', 'deleteImage', 'allow_comments:array', 'published', 'trackback_to');
     $post = jaws()->request->fetch($names, 'post');
     $content = jaws()->request->fetch(array('summary_block', 'text_block'), 'post', 'strip_crlf');
     $post['trackback_to'] = str_replace("\r\n", "\n", $post['trackback_to']);
     $pModel = $this->gadget->model->loadAdmin('Posts');
     $tModel = $this->gadget->model->loadAdmin('Trackbacks');
     $id = (int) $post['id'];
     $pubdate = null;
     if (isset($post['edit_timestamp']) && $post['edit_timestamp'][0] == 'yes') {
         $pubdate = $post['pubdate'];
     }
     $post['categories'] = !empty($post['categories']) ? $post['categories'] : array();
     foreach ($post['categories'] as $cat) {
         if (!$this->gadget->GetPermission('CategoryManage', $cat)) {
             return Jaws_HTTPError::Get(403);
         }
     }
     // Upload blog image
     $image = false;
     if ($post['deleteImage'] == 'false') {
         $image = null;
         if (count($_FILES) > 0 && !empty($_FILES['image_file']['name'])) {
             $targetDir = JAWS_DATA . 'blog' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
             $res = Jaws_Utils::UploadFiles($_FILES, $targetDir, 'jpg,gif,png,jpeg,bmp', false);
             if (Jaws_Error::IsError($res)) {
                 $GLOBALS['app']->Session->PushLastResponse($res->getMessage(), RESPONSE_ERROR);
             } elseif (empty($res)) {
                 $GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_UPLOAD_4'), RESPONSE_ERROR);
             } else {
                 $image = $res['image_file'][0]['host_filename'];
                 // Delete old image
                 $model = $this->gadget->model->load('Posts');
                 $blogEntry = $model->GetEntry($id);
                 if (!empty($blogEntry['image'])) {
                     Jaws_Utils::Delete($targetDir . $blogEntry['image']);
                 }
             }
         }
     } else {
         // Delete old image
         $model = $this->gadget->model->load('Posts');
         $blogEntry = $model->GetEntry($id);
         if (!empty($blogEntry['image'])) {
             $targetDir = JAWS_DATA . 'blog' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
             Jaws_Utils::Delete($targetDir . $blogEntry['image']);
         }
     }
     $pModel->UpdateEntry($id, $post['categories'], $post['title'], $content['summary_block'], $content['text_block'], $image, $post['fasturl'], $post['meta_keywords'], $post['meta_desc'], $post['tags'], isset($post['allow_comments'][0]), $post['trackback_to'], $post['published'], $pubdate);
     if (!Jaws_Error::IsError($id)) {
         if ($this->gadget->registry->fetch('trackback') == 'true') {
             $to = explode("\n", $post['trackback_to']);
             $link = $this->gadget->urlMap('SingleView', array('id' => $id), true);
             $title = $post['title'];
             $text = $content['text_block'];
             if (Jaws_UTF8::strlen($text) > 250) {
                 $text = Jaws_UTF8::substr($text, 0, 250) . '...';
             }
             $tModel->SendTrackback($title, $text, $link, $to);
         }
     }
     Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=EditEntry&id=' . $id);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:69,代码来源:Entries.php

示例5: SendEmail

 /**
  * Sends the Email
  *
  * @access  public
  * @param   string  $target     JSON decoded array ([to, cc, bcc] or [user, group])
  * @param   string  $subject    Subject of the Email
  * @param   string  $message    Message body of the Email
  * @param   string  $attachment Attachment
  * @return  string  XHTML template content
  */
 function SendEmail($target, $subject, $message, $attachment)
 {
     $this->gadget->CheckPermission('AccessToMailer');
     $mail = Jaws_Mail::getInstance();
     $mail->SetFrom();
     $mail->SetSubject(Jaws_XSS::defilter($subject));
     // To, Cc, Bcc
     if (isset($target['to'])) {
         if (!empty($target['to'])) {
             $recipients = explode(',', $target['to']);
             foreach ($recipients as $recpt) {
                 $mail->AddRecipient($recpt, 'To');
             }
         }
         if (!empty($target['cc'])) {
             $recipients = explode(',', $target['cc']);
             foreach ($recipients as $recpt) {
                 $mail->AddRecipient($recpt, 'Cc');
             }
         }
         if (!empty($target['bcc'])) {
             $recipients = explode(',', $target['bcc']);
             foreach ($recipients as $recpt) {
                 $mail->AddRecipient($recpt, 'Bcc');
             }
         }
     } else {
         $userModel = new Jaws_User();
         if ($target['user'] != 0) {
             $user = $userModel->GetUser((int) $target['user']);
             if (!Jaws_Error::IsError($user)) {
                 $mail->AddRecipient($user['nickname'] . ' <' . $user['email'] . '>', 'To');
             }
         } else {
             if ($target['group'] == 0) {
                 $target['group'] = false;
             }
             $users = $userModel->GetUsers($target['group'], null, true);
             foreach ($users as $user) {
                 $mail->AddRecipient($user['nickname'] . ' <' . $user['email'] . '>', 'Bcc');
             }
         }
     }
     $message = $this->PrepareMessage($message);
     $format = $this->gadget->registry->fetch('email_format');
     $mail->SetBody($message, $format);
     if (!empty($attachment)) {
         $attachment = Jaws_Utils::upload_tmp_dir() . '/' . $attachment;
         if (file_exists($attachment)) {
             $mail->SetBody($attachment, 'file');
             Jaws_Utils::Delete($attachment);
         }
     }
     $result = $mail->send();
     if (Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('CONTACT_ERROR_EMAIL_NOT_SENT'), RESPONSE_ERROR);
         return false;
     }
     $GLOBALS['app']->Session->PushLastResponse(_t('CONTACT_NOTICE_EMAIL_SENT'), RESPONSE_NOTICE);
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:71,代码来源:Mailer.php

示例6: UpdatePersonal

 /**
  * Update personal information of a user such as fname, lname, gender, etc..
  *
  * @access  public
  * @param   int     $id     User's ID
  * @param   array   $pData  Personal information data
  * @return  bool    Returns true on success, false on failure
  */
 function UpdatePersonal($id, $pData)
 {
     // unset invalid keys
     $invalids = array_diff(array_keys($pData), array('fname', 'lname', 'gender', 'ssn', 'dob', 'url', 'signature', 'about', 'experiences', 'occupations', 'interests', 'avatar', 'privacy'));
     foreach ($invalids as $invalid) {
         unset($pData[$invalid]);
     }
     if (array_key_exists('avatar', $pData)) {
         // get user information
         $user = Jaws_User::GetUser((int) $id, true, true);
         if (Jaws_Error::IsError($user) || empty($user)) {
             return false;
         }
         if (!empty($user['avatar'])) {
             Jaws_Utils::Delete(AVATAR_PATH . $user['avatar']);
         }
         if (!empty($pData['avatar'])) {
             $fileinfo = pathinfo($pData['avatar']);
             if (isset($fileinfo['extension']) && !empty($fileinfo['extension'])) {
                 if (!in_array($fileinfo['extension'], array('gif', 'jpg', 'jpeg', 'png', 'svg'))) {
                     return false;
                 } else {
                     $new_avatar = $user['username'] . '.' . $fileinfo['extension'];
                     @rename(Jaws_Utils::upload_tmp_dir() . '/' . $pData['avatar'], AVATAR_PATH . $new_avatar);
                     $pData['avatar'] = $new_avatar;
                 }
             }
         }
     }
     $pData['last_update'] = time();
     $usersTable = Jaws_ORM::getInstance()->table('users');
     $result = $usersTable->update($pData)->where('id', $id)->exec();
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     if (isset($GLOBALS['app']->Session) && $GLOBALS['app']->Session->GetAttribute('user') == $id) {
         foreach ($pData as $k => $v) {
             if ($k == 'avatar') {
                 $GLOBALS['app']->Session->SetAttribute($k, $this->GetAvatar($v, $user['email'], 48, $pData['last_update']));
             } else {
                 $GLOBALS['app']->Session->SetAttribute($k, $v);
             }
         }
     }
     // Let everyone know a user has been updated
     $res = $GLOBALS['app']->Listener->Shout('Users', 'UpdateUser', $id);
     if (Jaws_Error::IsError($res)) {
         return false;
     }
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:59,代码来源:User.php

示例7: SetLangData


//.........这里部分代码省略.........
                 $orig_file = JAWS_PATH . "upgrade/Resources/translates.ini";
             } else {
                 $orig_file = JAWS_PATH . "languages/{$langTo}/Upgrade.ini";
             }
             $data_file = JAWS_DATA . "languages/{$langTo}/Upgrade.ini";
             break;
         default:
             if ($langTo == 'en') {
                 $orig_file = JAWS_PATH . "include/Jaws/Resources/translates.ini";
             } else {
                 $orig_file = JAWS_PATH . "languages/{$langTo}/Global.ini";
             }
             $data_file = JAWS_DATA . "languages/{$langTo}/Global.ini";
     }
     $update_default_lang = $this->gadget->registry->fetch('update_default_lang') == 'true';
     $strings = array();
     if (file_exists($orig_file)) {
         $strings = parse_ini_file($orig_file, false, INI_SCANNER_RAW);
     }
     // user translation
     $tpl = $this->gadget->template->loadAdmin('FileTemplate.html');
     $tpl->SetBlock('template');
     $tpl->SetVariable('project', $module_name);
     $tpl->SetVariable('language', strtoupper($langTo));
     // orig translation
     $tpl2 = $this->gadget->template->loadAdmin('FileTemplate.html');
     $tpl2->SetBlock('template');
     $tpl2->SetVariable('project', $module_name);
     $tpl2->SetVariable('language', strtoupper($langTo));
     // Meta
     foreach ($data['meta'] as $k => $v) {
         // user translation
         $tpl->SetBlock('template/meta');
         $tpl->SetVariable('key', $k);
         $tpl->SetVariable('value', $v);
         $tpl->ParseBlock('template/meta');
         // orig translation
         $tpl2->SetBlock('template/meta');
         $tpl2->SetVariable('key', $k);
         $tpl2->SetVariable('value', $v);
         $tpl2->ParseBlock('template/meta');
     }
     // Strings
     $change_detected = false;
     foreach ($data['strings'] as $k => $v) {
         if ($v == '') {
             continue;
         } elseif ($v === $this->_EMPTY_STRING) {
             $v = '';
         }
         $v = preg_replace("\$\r\n|\n\$", '\\n', $v);
         $changed = !isset($strings[$k]) || $strings[$k] !== $v;
         if ($changed) {
             $change_detected = true;
             $tpl->SetBlock('template/string');
             $tpl->SetVariable('key', $k);
             $tpl->SetVariable('value', $v);
             $tpl->ParseBlock('template/string');
         }
         // orig translation
         $tpl2->SetBlock('template/string');
         $tpl2->SetVariable('key', $k);
         $tpl2->SetVariable('value', $v);
         $tpl2->ParseBlock('template/string');
     }
     $tpl->ParseBlock('template');
     $tpl2->ParseBlock('template');
     // update original translation
     if ($update_default_lang) {
         // update default language translation,
         // so we can delete customized language's file
         if (Jaws_Utils::file_put_contents($orig_file, $tpl2->Get())) {
             $change_detected = false;
         }
     }
     // Writable
     if (file_exists($data_file)) {
         $writeable = Jaws_Utils::is_writable($data_file);
     } else {
         Jaws_Utils::mkdir(dirname($data_file), 3);
         $writeable = Jaws_Utils::is_writable(dirname($data_file));
     }
     if (!$writeable) {
         $GLOBALS['app']->Session->PushLastResponse(_t('LANGUAGES_NOT_PERMISSION'), RESPONSE_ERROR);
         return false;
     }
     if ($change_detected) {
         if (Jaws_Utils::file_put_contents($data_file, $tpl->Get())) {
             $GLOBALS['app']->Session->PushLastResponse(_t('LANGUAGES_UPDATED', $module), RESPONSE_NOTICE);
             return true;
         } else {
             $GLOBALS['app']->Session->PushLastResponse(_t('LANGUAGES_NOT_UPDATED', $module), RESPONSE_ERROR);
             return false;
         }
     } else {
         Jaws_Utils::Delete($data_file);
         $GLOBALS['app']->Session->PushLastResponse(_t('LANGUAGES_UPDATED', $module), RESPONSE_NOTICE);
         return true;
     }
 }
开发者ID:juniortux,项目名称:jaws,代码行数:101,代码来源:Languages.php

示例8: DeleteEntry

 /**
  * Delete an entry
  *
  * @access  public
  * @param   int     $post_id    The entry ID
  * @return  mixed   True if entry was successfully deleted, Jaws_Error on failure
  */
 function DeleteEntry($post_id)
 {
     $model = $this->gadget->model->load('Posts');
     $e = $model->GetEntry($post_id);
     if (Jaws_Error::IsError($e)) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if ($GLOBALS['app']->Session->GetAttribute('user') != $e['user_id'] && !$this->gadget->GetPermission('ModifyOthersEntries')) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if (is_array($e['categories']) && count($e['categories']) > 0) {
         foreach ($e['categories'] as $k => $v) {
             $this->DeleteCategoryInEntry($post_id, $v['id']);
         }
     }
     $result = Jaws_ORM::getInstance()->table('blog')->delete()->where('id', $post_id)->exec();
     if (Jaws_Error::IsError($result)) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if ($this->gadget->registry->fetch('generate_xml') == 'true') {
         $model = $this->gadget->model->load('Feeds');
         $model->MakeAtom(true);
         $model->MakeRSS(true);
     }
     // Remove comment entries..
     $model = $this->gadget->model->loadAdmin('Comments');
     $model->DeleteCommentsIn($post_id);
     // Remove entry image
     if (!empty($e['image'])) {
         $imageDir = JAWS_DATA . 'blog' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
         Jaws_Utils::Delete($imageDir . $e['image']);
     }
     if (Jaws_Gadget::IsGadgetInstalled('Tags')) {
         $model = Jaws_Gadget::getInstance('Tags')->model->loadAdmin('Tags');
         $res = $model->DeleteReferenceTags('Blog', 'post', $post_id);
         if (Jaws_Error::IsError($res)) {
             $GLOBALS['app']->Session->PushLastResponse(_t('BLOG_ERROR_TAGS_NOT_DELETED'), RESPONSE_ERROR);
             return $res;
         }
     }
     //FIXME: add shoutAll method in core for increase performance
     // shout subscriptions event - delete old notifications!
     // generate a key for reference - shout subscription
     $key = crc32('Post' . $post_id);
     if (is_array($e['categories']) && count($e['categories']) > 0) {
         foreach ($e['categories'] as $category) {
             // [Category] action
             $subscriptionParams = array('action' => 'Category', 'reference' => $category['id'], 'key' => $key, 'publish_time' => -1);
             $this->gadget->event->shout('Subscription', $subscriptionParams);
         }
     }
     return true;
 }
开发者ID:uda,项目名称:jaws,代码行数:60,代码来源:Posts.php

示例9: delete

 /**
  * Delete cached data of given component/section
  *
  * @access  public
  * @param   string  $component
  * @param   string  $section
  * @param   string  $params
  * @return  bool
  */
 function delete($component = null, $section = null, $params = null)
 {
     if (!is_null($params)) {
         $params = is_array($params) ? implode('_', $params) : $params;
     } else {
         $params = '';
     }
     require_once PEAR_PATH . 'File/Find.php';
     $match = is_null($component) ? '' : $component;
     $match .= '.' . (is_null($section) ? '' : $section);
     $match .= empty($params) ? '' : '.' . $params;
     $files =& File_Find::search('/' . $match . '/i', $this->_path, 'perl', false, 'files');
     foreach ($files as $file) {
         Jaws_Utils::Delete($file);
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:26,代码来源:File.php

示例10: DeleteAddressSection

 /**
  * Delete many address
  *
  * @access  public
  * @returns array of Address Books or Jaws_Error on error
  */
 function DeleteAddressSection($addresses, $user)
 {
     // TODO: Use transaction
     $agModel = $this->gadget->model->load('AddressBookGroup');
     $agModel->DeleteGroupForAddresses($addresses, $user);
     $aTable = Jaws_ORM::getInstance()->table('address_book');
     $result = $aTable->delete()->where('user', (int) $user)->and()->where('id', $addresses, 'in')->exec();
     if (!Jaws_Error::IsError($result) && !empty($adrInfo['image']) && trim($adrInfo['image']) != '') {
         $targetDir = JAWS_DATA . 'addressbook' . DIRECTORY_SEPARATOR . 'image' . DIRECTORY_SEPARATOR;
         Jaws_Utils::Delete($targetDir . $adrInfo['image']);
     }
     return $result;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:19,代码来源:AddressBook.php

示例11: UpdateMenu

 /**
  * Updates the menu
  *
  * @access  public
  * @param    int     $mid        menu ID
  * @param    int     $pid
  * @param    int     $gid        group ID
  * @param    string  $type
  * @param    string  $acl
  * @param    string  $title
  * @param    string  $url
  * @param    string  $url_target
  * @param    string  $rank
  * @param    bool    $published     Published status
  * @param    string  $image
  * @return   bool    True on success or False on failure
  */
 function UpdateMenu($mid, $pid, $gid, $type, $acl, $title, $url, $url_target, $rank, $published, $image)
 {
     $model = $this->gadget->model->load('Menu');
     $oldMenu = $model->GetMenu($mid);
     if (Jaws_Error::IsError($oldMenu)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('MENU_ERROR_GET_MENUS'), RESPONSE_ERROR);
         return false;
     }
     $mData['pid'] = $pid;
     $mData['gid'] = $gid;
     $mData['menu_type'] = $type;
     $mData['title'] = $title;
     $mData['url'] = $url;
     $mData['url_target'] = $url_target;
     $mData['rank'] = $rank;
     $mData['published'] = (bool) $published;
     if ($image !== 'true') {
         if (empty($image)) {
             $mData['image'] = null;
         } else {
             $image = preg_replace("/[^[:alnum:]_\\.\\-]*/i", "", $image);
             $filename = Jaws_Utils::upload_tmp_dir() . '/' . $image;
             $mData['image'] = array('File://' . $filename, 'blob');
         }
     }
     // ACL
     if (!empty($acl)) {
         $aclInfo = explode(':', $acl);
         $mData['acl_key_name'] = $aclInfo[0];
         $mData['acl_key_subkey'] = $aclInfo[1];
     } else {
         $mData['acl_key_name'] = null;
         $mData['acl_key_subkey'] = null;
     }
     $menusTable = Jaws_ORM::getInstance()->table('menus');
     $res = $menusTable->update($mData)->where('id', $mid)->exec();
     if (Jaws_Error::IsError($res)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_QUERY_FAILED'), RESPONSE_ERROR);
         return false;
     }
     if (isset($filename)) {
         Jaws_Utils::Delete($filename);
     }
     $this->MoveMenu($mid, $gid, $oldMenu['gid'], $pid, $oldMenu['pid'], $rank, $oldMenu['rank']);
     $GLOBALS['app']->Session->PushLastResponse(_t('MENU_NOTICE_MENU_UPDATED'), RESPONSE_NOTICE);
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:64,代码来源:Menu.php

示例12: DeleteEntry

 /**
  * Delete an entry
  *
  * @access  public
  * @param   int     $post_id    The entry ID
  * @return  mixed   True if entry was successfully deleted, Jaws_Error on failure
  */
 function DeleteEntry($post_id)
 {
     $model = $this->gadget->model->load('Posts');
     $e = $model->GetEntry($post_id);
     if (Jaws_Error::IsError($e)) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if ($GLOBALS['app']->Session->GetAttribute('user') != $e['user_id'] && !$this->gadget->GetPermission('ModifyOthersEntries')) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if (is_array($e['categories']) && count($e['categories']) > 0) {
         foreach ($e['categories'] as $k => $v) {
             $this->DeleteCategoryInEntry($post_id, $v['id']);
         }
     }
     $result = Jaws_ORM::getInstance()->table('blog')->delete()->where('id', $post_id)->exec();
     if (Jaws_Error::IsError($result)) {
         return new Jaws_Error(_t('BLOG_ERROR_ENTRY_NOT_DELETED'));
     }
     if ($this->gadget->registry->fetch('generate_xml') == 'true') {
         $model = $this->gadget->model->load('Feeds');
         $model->MakeAtom(true);
         $model->MakeRSS(true);
     }
     // Remove comment entries..
     $model = $this->gadget->model->loadAdmin('Comments');
     $model->DeleteCommentsIn($post_id);
     // Remove entry image
     if (!empty($e['image'])) {
         $imageDir = JAWS_DATA . 'blog' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
         Jaws_Utils::Delete($imageDir . $e['image']);
     }
     if (Jaws_Gadget::IsGadgetInstalled('Tags')) {
         $model = Jaws_Gadget::getInstance('Tags')->model->loadAdmin('Tags');
         $res = $model->DeleteReferenceTags('Blog', 'post', $post_id);
         if (Jaws_Error::IsError($res)) {
             $GLOBALS['app']->Session->PushLastResponse(_t('BLOG_ERROR_TAGS_NOT_DELETED'), RESPONSE_ERROR);
             return $res;
         }
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:49,代码来源:Posts.php

示例13: DeleteBanner

 /**
  * Delete a banner
  *
  * @access  public
  * @param   int     $bid     The banner ID that will be deleted
  * @return  bool    True if query was successful and Jaws_Error on error
  */
 function DeleteBanner($bid)
 {
     $model = $this->gadget->model->load('Banners');
     $banner = $model->GetBanner($bid);
     if (Jaws_Error::IsError($banner)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_QUERY_FAILED'), RESPONSE_ERROR);
         return false;
     }
     if (!isset($banner['id'])) {
         $GLOBALS['app']->Session->PushLastResponse(_t('BANNER_BANNERS_ERROR_DOES_NOT_EXISTS'), RESPONSE_ERROR);
         return false;
     }
     $bannersTable = Jaws_ORM::getInstance()->table('banners');
     $res = $bannersTable->delete()->where('id', $bid)->exec();
     if (Jaws_Error::IsError($res)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_QUERY_FAILED'), RESPONSE_ERROR);
         return false;
     }
     $GLOBALS['app']->Session->PushLastResponse(_t('BANNER_BANNERS_DELETED', $banner['title']), RESPONSE_NOTICE);
     if (!empty($banner['banner'])) {
         Jaws_Utils::Delete(JAWS_DATA . $this->gadget->DataDirectory . $banner['banner']);
     }
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:31,代码来源:Banners.php

示例14: DeletePostAttachments

 /**
  * Delete all attachments of one post
  *
  * @access  public
  * @param   aid         $pid      post ID
  * @return  boolean     If complete true else Jaws_Error on error
  */
 function DeletePostAttachments($pid)
 {
     $attachmentsInfo = $this->GetAttachments($pid);
     $attachTable = Jaws_ORM::getInstance()->table('forums_attachments');
     $result = $attachTable->delete()->where('post', $pid)->exec();
     if ($result) {
         foreach ($attachmentsInfo as $attachment) {
             if (!empty($attachment['filename'])) {
                 Jaws_Utils::Delete(JAWS_DATA . 'forums/' . $attachment['filename']);
             }
         }
     }
     return $result;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:21,代码来源:Attachments.php


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