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


PHP Draft类代码示例

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


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

示例1: takeChildFromDOM

 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('app') . ':' . 'draft':
             $draft = new Draft();
             $draft->transferFromDOM($child);
             $this->_draft = $draft;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:14,代码来源:Control.php

示例2: destroy

 public static function destroy($id)
 {
     self::check_logged_in();
     $hero = new Hero(array('id' => $id));
     $yhteys = new Yhteys(array('hero_id' => $id));
     $draftids = Yhteys::findDraftID($id);
     $yhteys->destroy();
     while ($draftids != NULL) {
         $draft = new Draft(array('id' => $draftids->draft_id));
         $draft->destroy();
         $draftids = Yhteys::findDraftID($id);
     }
     $hero->destroy();
     Redirect::to('/hero', array('message' => 'Hero on poistettu onnistuneesti!'));
 }
开发者ID:sasumaki,项目名称:Tsoha-Bootstrap,代码行数:15,代码来源:heroes_controller.php

示例3: execute

 /**
  * Executes special page rendering and data processing
  *
  * @param $sub Mixed: MediaWiki supplied sub-page path
  * @throws PermissionsError
  */
 public function execute($sub)
 {
     $out = $this->getOutput();
     $user = $this->getUser();
     $request = $this->getRequest();
     // Begin output
     $this->setHeaders();
     // Make sure the user is logged in
     if (!$user->isLoggedIn()) {
         throw new PermissionsError('read');
     }
     // Handle discarding
     $draft = Draft::newFromID($request->getIntOrNull('discard'));
     if ($draft->exists()) {
         // Discard draft
         $draft->discard();
         // Redirect to the article editor or view if returnto was set
         $section = $request->getIntOrNull('section');
         $urlSection = $section !== null ? "&section={$section}" : '';
         switch ($request->getText('returnto')) {
             case 'edit':
                 $title = Title::newFromDBKey($draft->getTitle());
                 $out->redirect(wfExpandURL($title->getEditURL() . $urlSection));
                 break;
             case 'view':
                 $title = Title::newFromDBKey($draft->getTitle());
                 $out->redirect(wfExpandURL($title->getFullURL() . $urlSection));
                 break;
         }
     }
     // Show list of drafts, or a message that there are none
     if (Drafts::display() == 0) {
         $out->addWikiMsg('drafts-view-nonesaved');
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:41,代码来源:SpecialDrafts.php

示例4: destroy

 public function destroy($id)
 {
     if ($deleted = Draft::whereId($id)->delete()) {
         return Response::json(['success' => 'Draft successfully deleted'], 200);
     } else {
         return Response::json(['flash' => 'Server error'], 500);
     }
 }
开发者ID:shinichi81,项目名称:Nifty-Newsletter,代码行数:8,代码来源:DraftResourceController.php

示例5: index

 function index()
 {
     list($params, $id) = $this->parse_params(func_get_args());
     $theme = new Theme();
     $themes = $theme->read(true);
     if ($this->method == 'post' && isset($_POST['theme'])) {
         $t = $_POST['theme'];
         if (isset($themes[$t])) {
             $d = new Draft();
             $d->where('draft', 1)->update('draft', 0);
             $d->where('path', $t)->get();
             $d->path = $t;
             $d->draft = 1;
             if (isset($_POST['refresh'])) {
                 $d->init_draft_nav($_POST['refresh']);
             }
             $d->save();
             $this->redirect('/drafts');
         } else {
             // error
         }
     } else {
         if ($this->method == 'delete' && isset($_POST['theme'])) {
             $d = new Draft();
             $d->where('path', $_POST['theme'])->get();
             if ($d->exists()) {
                 $d->delete();
             }
             exit;
         }
     }
     $final = array();
     $d = new Draft();
     $drafts = $d->get_iterated();
     foreach ($drafts as $d) {
         if (isset($themes[$d->path])) {
             $final[] = array('id' => $d->id, 'theme' => $themes[$d->path], 'published' => (bool) $d->current, 'active' => (bool) $d->draft, 'created_on' => (int) $d->created_on, 'modified_on' => (int) $d->modified_on);
         }
     }
     $this->set_response_data($final);
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:41,代码来源:drafts.php

示例6: form_urls

 public function form_urls()
 {
     if ($this->urls) {
         return $this->urls;
     }
     $d = new Draft();
     $context = defined('DRAFT_CONTEXT') ? DRAFT_CONTEXT : false;
     $path = '';
     if (!$context) {
         $d->where('current', 1)->get();
         $path = $d->path;
     } else {
         if (is_numeric(DRAFT_CONTEXT)) {
             $d->get_by_id(DRAFT_CONTEXT);
             $path = $d->path;
         } else {
             $path = DRAFT_CONTEXT;
         }
     }
     list($this->urls, $this->url_data, , $this->segments) = $d->setup_urls(FCPATH . 'storage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR);
     return $this->urls;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:22,代码来源:koken.php

示例7: execute

 public function execute()
 {
     if ($this->getUser()->isAnon()) {
         $this->dieUsage('You must be logged in to save drafts.', 'notloggedin');
     }
     $params = $this->extractRequestParams();
     $draft = Draft::newFromID($params['id']);
     $draft->setToken($params['drafttoken']);
     $draft->setTitle(Title::newFromText($params['title']));
     $draft->setSection($params['section'] == '' ? null : $params['section']);
     $draft->setStartTime($params['starttime']);
     $draft->setEditTime($params['edittime']);
     $draft->setSaveTime(wfTimestampNow());
     $draft->setScrollTop($params['scrolltop']);
     $draft->setText($params['text']);
     $draft->setSummary($params['summary']);
     $draft->setMinorEdit($params['minoredit']);
     $draft->save();
     $this->getResult()->addValue(null, $this->getModuleName(), array('id' => $draft->getID()));
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:20,代码来源:ApiSaveDrafts.php

示例8: execute

 /**
  * Executes special page rendering and data processing
  *
  * @param $sub Mixed: MediaWiki supplied sub-page path
  */
 public function execute($sub)
 {
     global $wgRequest, $wgOut, $wgUser;
     // Begin output
     $this->setHeaders();
     // Make sure the user is logged in
     if (!$wgUser->isLoggedIn()) {
         // If not, let them know they need to
         $wgOut->loginToUse();
         // Continue
         return true;
     }
     // Handle discarding
     $draft = Draft::newFromID($wgRequest->getIntOrNull('discard'));
     if ($draft->exists()) {
         // Discard draft
         $draft->discard();
         // Redirect to the article editor or view if returnto was set
         $section = $wgRequest->getIntOrNull('section');
         $urlSection = $section !== null ? "&section={$section}" : '';
         switch ($wgRequest->getText('returnto')) {
             case 'edit':
                 $title = Title::newFromDBKey($draft->getTitle());
                 $wgOut->redirect(wfExpandURL($title->getEditURL() . $urlSection));
                 break;
             case 'view':
                 $title = Title::newFromDBKey($draft->getTitle());
                 $wgOut->redirect(wfExpandURL($title->getFullURL() . $urlSection));
                 break;
         }
     }
     // Show list of drafts, or a message that there are none
     if (Drafts::display() == 0) {
         $wgOut->addHTML(wfMsgHTML('drafts-view-nonesaved'));
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:41,代码来源:Drafts.pages.php

示例9: elseif

     }
     break;
 case 'create':
     if ($id = Canned::create($_POST, $errors)) {
         $msg = 'Canned response added successfully';
         $_REQUEST['a'] = null;
         //Upload attachments
         if ($_FILES['attachments'] && ($c = Canned::lookup($id)) && ($files = AttachmentFile::format($_FILES['attachments']))) {
             $c->attachments->upload($files);
         }
         // Attach inline attachments from the editor
         if (isset($_POST['draft_id']) && ($draft = Draft::lookup($_POST['draft_id']))) {
             $c->attachments->upload($draft->getAttachmentIds($_POST['response']), true);
         }
         // Delete this user's drafts for new canned-responses
         Draft::deleteForNamespace('canned', $thisstaff->getId());
     } elseif (!$errors['err']) {
         $errors['err'] = 'Unable to add canned response. Correct error(s) below and try again.';
     }
     break;
 case 'mass_process':
     if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
         $errors['err'] = 'You must select at least one canned response';
     } else {
         $count = count($_POST['ids']);
         switch (strtolower($_POST['a'])) {
             case 'enable':
                 $sql = 'UPDATE ' . CANNED_TABLE . ' SET isenabled=1 ' . ' WHERE canned_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
                 if (db_query($sql) && ($num = db_affected_rows())) {
                     if ($num == $count) {
                         $msg = 'Selected canned responses enabled';
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:31,代码来源:canned.php

示例10: sendDraft

function sendDraft($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $issue_id = XML_RPC_decode($p->getParam(2));
    $draft_id = XML_RPC_decode($p->getParam(3));
    $draft = Draft::getDraftBySequence($issue_id, $draft_id);
    createFakeCookie($email, Issue::getProjectID($issue_id));
    if (count($draft) < 1 || !is_array($draft)) {
        return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Draft #" . $draft_id . " does not exist for issue #{$issue_id}");
    }
    $res = Draft::send($draft["emd_id"]);
    if ($res == 1) {
        return new XML_RPC_Response(XML_RPC_Encode("Draft #" . $draft_id . " sent successfully.\n"));
    } else {
        return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Error sending Draft #" . $draft_id . "\n");
    }
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:22,代码来源:xmlrpc.php

示例11: add

 function add($vars, &$errors)
 {
     $inst = self::lookup(self::create($vars, $errors));
     // Inline images (attached to the draft)
     if ($inst) {
         $inst->attachments->upload(Draft::getAttachmentIds($inst->getBody()), true);
     }
     return $inst;
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:9,代码来源:class.template.php

示例12: loadDefaultData

 /**
  * Loads data from the I18N_DIR for the target language into the
  * database. This is intended to be done at the time of installation;
  * however, care should be taken in this process to ensure that the
  * process could be repeated if an administrator wanted to change the
  * system language and reload the data.
  */
 function loadDefaultData()
 {
     # notrans -- do not translate the contents of this array
     $models = array('department.yaml' => 'Dept::create', 'sla.yaml' => 'SLA::create', 'form.yaml' => 'DynamicForm::create', 'list.yaml' => 'DynamicList::create', 'help_topic.yaml' => 'Topic::create', 'filter.yaml' => 'Filter::create', 'team.yaml' => 'Team::create', 'organization.yaml' => 'Organization::__create', 'ticket_status.yaml' => 'TicketStatus::__create', 'group.yaml' => 'Group::create', 'file.yaml' => 'AttachmentFile::create', 'sequence.yaml' => 'Sequence::__create');
     $errors = array();
     foreach ($models as $yaml => $m) {
         if ($objects = $this->getTemplate($yaml)->getData()) {
             foreach ($objects as $o) {
                 if ($m && is_callable($m)) {
                     @call_user_func_array($m, array($o, &$errors));
                 }
                 // TODO: Add a warning to the success page for errors
                 //       found here
                 $errors = array();
             }
         }
     }
     // Priorities
     $priorities = $this->getTemplate('priority.yaml')->getData();
     foreach ($priorities as $name => $info) {
         $sql = 'INSERT INTO ' . PRIORITY_TABLE . ' SET priority=' . db_input($name) . ', priority_id=' . db_input($info['priority_id']) . ', priority_desc=' . db_input($info['priority_desc']) . ', priority_color=' . db_input($info['priority_color']) . ', priority_urgency=' . db_input($info['priority_urgency']);
         db_query($sql);
     }
     // Configuration
     require_once INCLUDE_DIR . 'class.config.php';
     if (($tpl = $this->getTemplate('config.yaml')) && ($data = $tpl->getData())) {
         foreach ($data as $section => $items) {
             $_config = new Config($section);
             foreach ($items as $key => $value) {
                 $_config->set($key, $value);
             }
         }
     }
     // Load core config
     $_config = new OsticketConfig();
     // Determine reasonable default max_file_size
     $max_size = Format::filesize2bytes(strtoupper(ini_get('upload_max_filesize')));
     $val = (int) $max_size / 2;
     $po2 = 1;
     while ($po2 < $val) {
         $po2 <<= 1;
     }
     $_config->set('max_file_size', $po2);
     // Pages and content
     foreach (array('landing', 'thank-you', 'offline', 'registration-staff', 'pwreset-staff', 'banner-staff', 'registration-client', 'pwreset-client', 'banner-client', 'registration-confirm', 'registration-thanks', 'access-link') as $type) {
         $tpl = $this->getTemplate("templates/page/{$type}.yaml");
         if (!($page = $tpl->getData())) {
             continue;
         }
         $sql = 'INSERT INTO ' . PAGE_TABLE . ' SET type=' . db_input($type) . ', name=' . db_input($page['name']) . ', body=' . db_input($page['body']) . ', lang=' . db_input($tpl->getLang()) . ', notes=' . db_input($page['notes']) . ', created=NOW(), updated=NOW(), isactive=1';
         if (db_query($sql) && ($id = db_insert_id()) && in_array($type, array('landing', 'thank-you', 'offline'))) {
             $_config->set("{$type}_page_id", $id);
         }
     }
     // Default Language
     $_config->set('system_language', $this->langs[0]);
     // content_id defaults to the `id` field value
     db_query('UPDATE ' . PAGE_TABLE . ' SET content_id=id');
     // Canned response examples
     if (($tpl = $this->getTemplate('templates/premade.yaml')) && ($canned = $tpl->getData())) {
         foreach ($canned as $c) {
             if (($id = Canned::create($c, $errors)) && isset($c['attachments'])) {
                 $premade = Canned::lookup($id);
                 foreach ($c['attachments'] as $a) {
                     $premade->attachments->save($a, false);
                 }
             }
         }
     }
     // Email templates
     // TODO: Lookup tpl_id
     if ($objects = $this->getTemplate('email_template_group.yaml')->getData()) {
         foreach ($objects as $o) {
             $o['lang_id'] = $this->langs[0];
             $tpl = EmailTemplateGroup::create($o, $errors);
         }
     }
     // This shouldn't be necessary
     $tpl = EmailTemplateGroup::lookup(1);
     foreach ($tpl::$all_names as $name => $info) {
         if (($tp = $this->getTemplate("templates/email/{$name}.yaml")) && ($t = $tp->getData())) {
             $t['tpl_id'] = $tpl->getId();
             $t['code_name'] = $name;
             $id = EmailTemplate::create($t, $errors);
             if ($id && ($template = EmailTemplate::lookup($id)) && ($ids = Draft::getAttachmentIds($t['body']))) {
                 $template->attachments->upload($ids, true);
             }
         }
     }
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:97,代码来源:class.i18n.php

示例13: __

    if (!$_POST['email_id'] || !($email = Email::lookup($_POST['email_id']))) {
        $errors['email_id'] = __('Select from email address');
    }
    if (!$_POST['email'] || !Validator::is_email($_POST['email'])) {
        $errors['email'] = __('To email address required');
    }
    if (!$_POST['subj']) {
        $errors['subj'] = __('Subject required');
    }
    if (!$_POST['message']) {
        $errors['message'] = __('Message required');
    }
    if (!$errors && $email) {
        if ($email->send($_POST['email'], $_POST['subj'], Format::sanitize($_POST['message']), null, array('reply-tag' => false))) {
            $msg = Format::htmlchars(sprintf(__('Test email sent successfully to <%s>'), $_POST['email']));
            Draft::deleteForNamespace('email.diag');
        } else {
            $errors['err'] = __('Error sending email - try again.');
        }
    } elseif ($errors['err']) {
        $errors['err'] = __('Error sending email - try again.');
    }
}
$info = Format::htmlchars($errors && $_POST ? $_POST : $info);
$nav->setTabActive('emails');
$ost->addExtraHeader('<meta name="tip-namespace" content="emails.diagnostic" />', "\$('#content').data('tipNamespace', '" . $tip_namespace . "');");
require STAFFINC_DIR . 'header.inc.php';
?>
<form action="emailtest.php" method="post" id="save">
 <?php 
csrf_token();
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:31,代码来源:emailtest.php

示例14: elseif

    } elseif($cfg->isCaptchaEnabled()) {
        if(!$_POST['captcha'])
            $errors['captcha']=__('Enter text shown on the image');
        elseif(strcmp($_SESSION['captcha'], md5(strtoupper($_POST['captcha']))))
            $errors['captcha']=__('Invalid - try again!');
    }

    $tform = TicketForm::objects()->one()->getForm($vars);
    $messageField = $tform->getField('message');
    $attachments = $messageField->getWidget()->getAttachments();
    if (!$errors && $messageField->isAttachmentsEnabled())
        $vars['cannedattachments'] = $attachments->getClean();

    // Drop the draft.. If there are validation errors, the content
    // submitted will be displayed back to the user
    Draft::deleteForNamespace('ticket.client.'.substr(session_id(), -12));
    //Ticket::create...checks for errors..
    if(($ticket=Ticket::create($vars, $errors, SOURCE))){
        $msg=__('Support ticket request created');
        // Drop session-backed form data
        unset($_SESSION[':form-data']);
        //Logged in...simply view the newly created ticket.
        if($thisclient && $thisclient->isValid()) {
            session_write_close();
            session_regenerate_id();
            @header('Location: tickets.php?id='.$ticket->getId());
        }
    }else{
        $errors['err']=$errors['err']?$errors['err']:__('Unable to create a ticket. Please correct errors below and try again!');
    }
}
开发者ID:KingsleyGU,项目名称:osticket,代码行数:31,代码来源:open.php

示例15: draftActivity

 private function draftActivity()
 {
     $sql = "SELECT\n                    {{%email_draft}}.*,\n                    iss_summary,\n                    sta_color\n                FROM\n                    {{%email_draft}},\n                    {{%issue}},\n                    {{%status}}\n                WHERE\n                    iss_sta_id = sta_id AND\n                    emd_iss_id = iss_id AND\n                    iss_prj_id = ? AND\n";
     $params = array($this->prj_id);
     $this->createWhereClause($sql, $params, 'emd_updated_date', 'emd_usr_id');
     $res = DB_Helper::getInstance()->getAll($sql, $params);
     $this->processResult($res, 'emd_updated_date', 'emd_iss_id');
     foreach ($res as &$draft) {
         if (!empty($draft['emd_unknown_user'])) {
             $draft['from'] = $draft['emd_unknown_user'];
         } else {
             $draft['from'] = User::getFromHeader($draft['emd_usr_id']);
         }
         list($draft['to']) = Draft::getEmailRecipients($draft['emd_id']);
         if (empty($draft['to'])) {
             $draft['to'] = 'Notification List';
         }
     }
     return $res;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:20,代码来源:RecentActivity.php


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