コード例 #1
0
 function destroy()
 {
     #    @issue_count = @category.issues.size
     #    if @issue_count == 0
     #      # No issue assigned to this category
     #      @category.destroy
     #      redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories'
     #    elsif params[:todo]
     #      reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) if params[:todo] == 'reassign'
     #      @category.destroy(reassign_to)
     #      redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories'
     #    end
     App::import('model', 'Issue');
     $Issue = new Issue();
     $issue_count = $Issue->find('count', aa('conditions', aa('category_id', $this->params['id'])));
     if ($issue_count == 0) {
         $this->IssueCategory->del($this->params['id']);
         $this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories'));
     } elseif ($this->data) {
         $reassgin_to = null;
         if ($this->data['IssueCategory']['todo'] == 'reassgin_to') {
             $reassgin_to = $this->data['IssueCategory']['reassign_to_id'];
         }
         $this->IssueCategory->del_with_reassgin($this->params['id'], $reassgin_to);
         $this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories'));
     }
     $issue_category_data = $this->IssueCategory->find('first', aa('conditions', aa('IssueCategory.id', $this->params['id'])));
     $this->set('issue_category_data', $issue_category_data);
     $this->set('issue_count', $issue_count);
 }
コード例 #2
0
 function destroy()
 {
     if ($this->data && isset($this->data['Wiki']['confirm'])) {
         $this->Project->Wiki->del($this->_project['Wiki']['id']);
         $this->redirect(aa('controller', 'projects', 'action', 'settings', 'id', $this->params['project_id'], '?', 'tab=wiki'));
     }
 }
コード例 #3
0
ファイル: enumeration.php プロジェクト: predominant/candycane
 function destroy($row, $reassign_to = null)
 {
     #    if reassign_to && reassign_to.is_a?(Enumeration)
     $model = ClassRegistry::init($this->OPTIONS[$row['Enumeration']['opt']]['model']);
     $model->updateAll(aa($this->OPTIONS[$row['Enumeration']['opt']]['foreign_key'], $reassign_to), aa($this->OPTIONS[$row['Enumeration']['opt']]['foreign_key'], $row['Enumeration']['id']));
     #    end
     $this->del($row['Enumeration']['id']);
 }
コード例 #4
0
 function _prepareSettingTabMembers()
 {
     $members = $this->Member->find('all', aa('conditions', aa('project_id', $this->_project['Project']['id']), 'order', 'Role.position'));
     $this->set('members', $members);
     $roles = $this->Member->Role->find_all_givable();
     $this->set('roles_data', $roles);
     $users = $this->Member->User->find('all', aa('conditions', aa('status', USER_STATUS_ACTIVE), 'recursive', -1));
     $this->set('users_data', $users);
 }
コード例 #5
0
ファイル: candy.php プロジェクト: nachtschatt3n/candycane
 function defaults($model)
 {
     $results = aa($model->name, a());
     foreach ($model->_schema as $k => $v) {
         $results[$model->name][$k] = $v['default'];
     }
     $results = $model->afterFind(array($results), true);
     return $results[0][$model->name];
 }
コード例 #6
0
 function show()
 {
     #  def show
     #    @comments = @news.comments
     #    @comments.reverse! if User.current.wants_comments_in_reverse_order?
     #  end
     //$this->data = $this->News->read(null, $this->params['news_id']);
     $this->data = $this->News->find('first', aa('conditions', aa('News.id', $this->params['id']), 'recursive', 3));
     $this->set('news', $this->data);
 }
コード例 #7
0
 function _prepareSettingTabs()
 {
     $tabs = array(aa('name', 'general', 'partial', 'settings/general', 'label', __('General', true)), aa('name', 'authentication', 'partial', 'settings/authentication', 'label', __('Authentication', true)), aa('name', 'projects', 'partial', 'settings/projects', 'label', __('Projects', true)), aa('name', 'issues', 'partial', 'settings/issues', 'label', __('Issue tracking', true)), aa('name', 'notifications', 'partial', 'settings/notifications', 'label', __('Email notifications', true)));
     $this->set('settings_tabs', $tabs);
     $selected_tab = $tabs[0]['name'];
     if (isset($this->params['url']['tab'])) {
         $selected_tab = $this->params['url']['tab'];
     }
     $this->set('selected_tab', $selected_tab);
 }
コード例 #8
0
ファイル: posts_controller.php プロジェクト: kaz29/matsutter
 function index()
 {
     $post_data = $this->paginate('Post');
     $param = array('fields' => a('count(*)'), 'conditions' => aa('Post.user_id', 1));
     $my_count = $this->Post->find('all', $param);
     $param = array('fields' => a('count(*)'));
     $all_count = $this->Post->find('all', $param);
     $this->set('my_count', $my_count[0][0]['count(*)']);
     $this->set('all_count', $all_count[0][0]['count(*)']);
     $this->set('post_data', $post_data);
     $this->render('index');
 }
コード例 #9
0
 function _detectProjectId()
 {
     $project_id = null;
     if (isset($this->controller->params['project_id'])) {
         $project_id = $this->controller->params['project_id'];
     }
     if ($this->controller->name == 'Versions') {
         $version_id = $this->controller->params['pass'][0];
         App::import('model', 'Version');
         $version = new Version();
         $bind = array('belongsTo' => array('Project' => array('className' => 'Project')));
         $version->bindModel($bind);
         $version_row = $version->find('first', aa('condtions', aa('id', $version_id)));
         $project_id = $version_row['Project']['identifier'];
     }
     return $project_id;
 }
コード例 #10
0
ファイル: wiki.php プロジェクト: nachtschatt3n/candycane
 function find_page($title, $options = array())
 {
     $param = array();
     if ($title === "") {
         $title = $this->field('start_page');
     }
     $title = Wiki::titleize($title);
     $page = $this->WikiPage->find('first', aa('conditions', aa('WikiPage.wiki_id', $this->id, 'WikiPage.title', $title)));
     if (isset($page['WikiPage']['id'])) {
         $this->WikiPage->id = $page['WikiPage']['id'];
     }
     //    if !page && !(options[:with_redirect] == false)
     //      # search for a redirect
     //      redirect = redirects.find_by_title(title)
     //      page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
     //    end
     return $page;
 }
コード例 #11
0
ファイル: bootstrap.php プロジェクト: hiromi2424/cake_base
 function __debug()
 {
     $argc = func_num_args();
     $args = func_get_args();
     if ($argc == 0) {
         return false;
     }
     global $__session;
     if (Configure::read() == 0) {
         return false;
     }
     $class = 'CakeSession';
     if ($__session === null) {
         if (ClassRegistry::isKeySet($class)) {
             $__session =& ClassRegistry::getObject($class);
         } else {
             if (!class_exists($class)) {
                 App::import('Core', $class);
             }
             $__session =& new $class();
             ClassRegistry::addObject($class, $__session);
         }
     }
     $session =& $__session;
     if (!$session->started()) {
         $session->start();
     }
     $debugs = array();
     if ($session->check('debug.printable')) {
         $debugs = $session->read('debug.printable');
     }
     $debugger =& Debugger::getInstance();
     $trace = $debugger->trace(aa('start', 2, 'format', 'array'));
     while ($trace[0]['function'] === __FUNCTION__ || false !== strpos($trace[0]['function'], 'call_user_func')) {
         array_shift($trace);
     }
     $debug = compact('args', 'trace');
     $debugs = array_merge($debugs, array($debug));
     // debug(compact('prints','args'));
     $session->write('debug.printable', $debugs);
     return true;
 }
コード例 #12
0
 function show($id)
 {
     $this->Version->id = $id;
     $this->data = $this->Version->read();
     $issues = $this->Version->FixedIssue->find('all', aa('conditions', aa('fixed_version_id', $id)));
     foreach ($issues as $key => $issue) {
         $issues[$key]['Issue'] = $issue['FixedIssue'];
     }
     $this->set('issues', $issues);
     // @FIXME
     $fixed_issue_count = count($issues);
     $this->set('fixed_issue_count', $fixed_issue_count);
     $wiki_content = $this->Wiki->WikiPage->find('first', aa('conditions', aa('WikiPage.title', $this->data['Version']['wiki_page_title'])));
     $this->set('wiki_content', $wiki_content);
     /*
     <% issues = @version.fixed_issues.find(:all,
                                       :include => [:status, :tracker],
                                       :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") %>
     */
 }
コード例 #13
0
ファイル: a.php プロジェクト: nhchoi/toy
<?php

function abc()
{
    return md();
}
function aa()
{
    return 1;
}
//더 쓸모 없는 주석
echo "===> " . abc() . aa();
コード例 #14
0
 /**
  * Constructs associative array from pairs of arguments.
  */
 public function testAa()
 {
     $result = aa('a', 'b', 'c');
     $expect = array('a' => 'b', 'c' => null);
     $this->assertEquals($expect, $result);
 }
コード例 #15
0
 function del_with_reassgin($id, $reassgin_to = null)
 {
     $this->bindModel(array('hasMany' => array('Issue' => array('foreignKey' => 'category_id'))));
     $this->Issue->updateAll(aa('category_id', $reassgin_to), aa('category_id', $id));
     $this->del($id);
 }
コード例 #16
0
 function update_options()
 {
     $this->User->id = $id = $this->data['User']['id'];
     $this->User->save($this->data);
     if (CUR_USER_ID == $id) {
         $u = $this->User->find(aa('id', $id));
         $this->Session->write('User', $u['User']);
     }
     exit;
 }
コード例 #17
0
 function _prepareThemes()
 {
     //TODO; scan real status on tehemes
     $themes = aa('Alternate', 'Alternate', 'Classic', 'Classic');
     $this->set('themes', $themes);
 }
コード例 #18
0
ファイル: wiki_page.php プロジェクト: nachtschatt3n/candycane
 function _isUniqueTitle($check)
 {
     $conditions = a();
     if (!empty($this->id) && $this->field('wiki_id')) {
         $conditions[] = aa("WikiPage.id <>", $this->id);
         $conditions[] = aa("WikiPage.wiki_id", $this->field('wiki_id'));
     } elseif (isset($this->data['WikiPage']['wiki_id'])) {
         $conditions[] = aa("WikiPage.wiki_id", $this->data['WikiPage']['wiki_id']);
     }
     $conditions[] = aa("LOWER(WikiPage.title)", strtolower($check["title"]));
     $count = $this->find('count', aa('conditions', $conditions, 'recursive', -1));
     return $count === 0;
 }
コード例 #19
0
ファイル: user.php プロジェクト: nachtschatt3n/candycane
 function find_by_id_logged($id)
 {
     $cond = aa('User.id', $id);
     $user = $this->find('first', aa('recursive', 2, 'conditions', $cond));
     if (empty($user)) {
         return false;
     }
     $user['User']['logged'] = true;
     // @todo fixme
     $user['User']['name'] = $user['User']['login'];
     // @todo fixme
     $user['User']['memberships'] = $user['Membership'];
     $user['User']['RssToken'] = $user['RssToken'];
     $user['User']['UserPreference'] = $user['UserPreference'];
     return $user['User'];
 }
コード例 #20
0
ファイル: 1202.php プロジェクト: phototech/sailvenice
<?php

if (!defined('MIGRATE')) {
    exit;
}
App::import('Model', 'Image');
$this->Image =& new Image();
$images = $this->Image->find('all', array('conditions' => aa('created_on', null), 'fields' => 'Image.id, Image.modified, Image.created, Image.created_on', 'recursive' => '-1'));
foreach ($images as $image) {
    if (empty($image['Image']['created_on'])) {
        $created = strtotime($image['Image']['created']);
        $created_gmt = $created - date('Z', $created);
        $modified = strtotime($image['Image']['modified']);
        $modified_gmt = $modified - date('Z', $modified);
        $this->_query("UPDATE {$itbl} SET created_on = {$created_gmt}, modified_on = {$modified_gmt} WHERE id = {$image['Image']['id']}");
    }
}
コード例 #21
0
ファイル: candy.php プロジェクト: hiromi2424/candycane
 function _replaceCandycaneLinks($already_matched)
 {
     /* Redmine links
      *
      * Examples:
      *   Issues:
      *     #52 -> Link to issue #52
      *   Changesets:
      *     r52 -> Link to revision 52
      *     commit:a85130f -> Link to scmid starting with a85130f
      *   Documents:
      *     document#17 -> Link to document with id 17
      *     document:Greetings -> Link to the document with title "Greetings"
      *     document:"Some document" -> Link to the document with title "Some document"
      *   Versions:
      *     version#3 -> Link to version with id 3
      *     version:1.0.0 -> Link to version named "1.0.0"
      *     version:"1.0 beta 2" -> Link to version named "1.0 beta 2"
      *   Attachments:
      *     attachment:file.zip -> Link to the attachment of the current object named file.zip
      *   Source files:
      *     source:some/file -> Link to the file located at /some/file in the project's repository
      *     source:some/file@52 -> Link to the file's revision 52
      *     source:some/file#L120 -> Link to line 120 of the file
      *     source:some/file@52#L120 -> Link to line 120 of the file's revision 52
      *     export:some/file -> Force the download of the file
      *  Forum messages:
      *     message#1218 -> Link to message with id 1218
      */
     $view =& ClassRegistry::getObject('view');
     $project = isset($view->viewVars['main_project']['Project']['identifier']) ? $view->viewVars['main_project']['Project']['identifier'] : null;
     list($all, $leading, $esc, $prefix, , $sep, $oid) = $already_matched;
     if ($sep === "" && $oid === "") {
         $sep = $already_matched[7];
         $oid = $already_matched[8];
     }
     $link = "";
     if ($esc === "") {
         if ($prefix === "" && $sep === 'r') {
             if ($project !== "") {
                 $link = $this->Html->link("r{$oid}", array('controller' => 'repositories', 'action' => 'revision', 'id' => $project, 'rev' => $oid), aa('class', 'changeset', 'title', ''));
             }
         } elseif ($sep === '#') {
             $oid = (int) $oid;
             switch ($prefix) {
                 case '':
                     $issue = true;
                     /*$issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current))*/
                     if ($issue) {
                         $class = false ? 'issue closed' : 'issue';
                         $link = $this->Html->link("#{$oid}", array('controller' => 'issues', 'action' => 'show', 'id' => $oid), aa('class', $class, 'title', ''));
                         if (false) {
                             $link = $this->Html->tag('del', $link);
                         }
                     }
                     break;
                 case 'document':
                     $document = 1;
                     /*document =Document.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current))*/
                     if ($document) {
                         $link = $this->Html->link($oid, array('controller' => 'documents', 'action' => 'show', 'id' => $document), aa('class', 'document'));
                     }
                     break;
                 case 'version':
                     break;
                 case 'message':
                     break;
             }
         } elseif ($sep === ':') {
             // removes the double quotes if any
             $name = preg_replace('{^"(.*)"$}', '\\1', $oid);
             switch ($prefix) {
                 case 'document':
                     $document = 1;
                     /*document = project.documents.find_by_title(name)*/
                     if ($project !== "" && $document !== "") {
                         $link = $this->Html->link($name, array('controller' => 'documents', 'action' => 'show', 'id' => $document), aa('class', 'document'));
                     }
                     break;
                 case 'version':
                     break;
                 case 'commit':
                     break;
                 case 'source':
                 case 'export':
                     break;
                 case 'attachment':
                     break;
             }
         }
     }
     $result = $leading;
     if ($link !== "") {
         $result .= $link;
     } else {
         $result .= "{$prefix}{$sep}{$oid}";
     }
     return $result;
 }
コード例 #22
0
 function data($gid = 'no', $album = 0, $specs = null)
 {
     header('Pragma: no-cache');
     header("Cache-Control: no-cache, must-revalidate");
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     // Load gallery model, everything else will work off of this
     $this->loadModel('Gallery');
     list($account, $users) = $this->Director->fetchAccount();
     if (date('mdY', $account['Account']['last_schedule_check']) != date('mdY', time())) {
         $this->Director->scheduling();
         App::import('Model', 'Account');
         $this->Account =& new Account();
         $this->Account->id = $account['Account']['id'];
         $this->Account->saveField('last_schedule_check', time());
     }
     $this->set('controller', $this);
     if (is_null($specs) || empty($specs)) {
         $this->pageTitle = __('Error', true);
         $this->set('account', $account);
         $this->render('xml_error', 'simple');
     } else {
         if (function_exists('set_time_limit')) {
             set_time_limit(0);
         }
         // Start building path to cache file
         $path_to_cache = XML_CACHE . DS . 'images';
         // Decide whether to serve a gallery, individual album, or full feed
         if ($album != 0) {
             $id = $album;
             $path_to_cache .= '_album_' . $id;
             $albums = $this->Gallery->Tag->Album->findAll(aa("Album.id", explode(',', $id)), null, "FIELD(Album.id, {$id})");
             if (count($albums) == 1) {
                 $gallery['Gallery']['name'] = $albums[0]['Album']['name'];
                 $gallery['Gallery']['description'] = $albums[0]['Album']['description'];
             } else {
                 $gallery = array();
             }
         } else {
             if (is_numeric($gid)) {
                 $id = $gid;
                 $path_to_cache .= '_gallery_' . $id;
                 $this->Gallery->contain('Tag');
                 $gallery = $this->Gallery->read(null, $id);
                 if ($gallery['Gallery']['smart'] && !$gallery['Gallery']['main']) {
                     list($conditions, $order, $limit) = $this->Gallery->smartConditions(unserialize($gallery['Gallery']['smart_query']));
                     $albums = $this->Gallery->Tag->Album->find('all', array('conditions' => $conditions, 'limit' => $limit, 'order' => $order));
                 } else {
                     $albums = $this->Gallery->members($gallery);
                 }
             }
         }
         $sp = explode('_', $specs);
         $w = $sp[0];
         $h = $sp[1];
         $s = $sp[2];
         $q = $sp[3];
         $sh = $sp[4];
         $tw = $sp[5];
         $th = $sp[6];
         $ts = $sp[7];
         $tq = $sp[8];
         $tsh = $sp[9];
         $pw = $sp[10];
         $ph = $sp[11];
         $ps = $sp[12];
         $tlw = $sp[13];
         $tlh = $sp[14];
         $local = $sp[15];
         $cache_tail = "_{$w}_{$h}_{$s}_{$q}_{$sh}_{$tw}_{$th}_{$ts}_{$tq}_{$tsh}_{$pw}_{$ph}_{$ps}_{$tlw}_{$tlh}_{$local}";
         $path_to_cache .= $cache_tail;
         if ($local == 'l' && RELATIVE_XML_PATHS) {
             $this->set('relative', true);
             $this->set('data_host', DIR_REL_HOST);
         } else {
             $this->set('relative', false);
             $this->set('data_host', DIR_HOST);
         }
         $this->set('specs', $sp);
         $this->set('albums', $albums);
         $this->set('gallery', $gallery);
         $this->loadModel('Watermark');
         $watermarks = $this->Watermark->find('all');
         if (empty($watermarks)) {
             $watermark_arr = array();
         } else {
             $watermark_arr = array();
             foreach ($watermarks as $w) {
                 $watermark_arr[$w['Watermark']['id']] = $w['Watermark'];
             }
         }
         $this->set('watermarks', $watermark_arr);
         // Finish up xml_cache path
         $path_to_cache .= '.xml';
         $this->set('path_to_cache', $path_to_cache);
         $this->set('cache_tail', $cache_tail);
         // Render w/o layout
         $this->render('data', 'ajax');
     }
 }
コード例 #23
0
ファイル: setting.php プロジェクト: predominant/candycane
 /**
  * instead of self.[] method of ruby version
  *
  * @param string $name
  * @param mixed $value
  */
 function store($name, $value)
 {
     $cond = aa('name', $name);
     $data = $this->find('all', aa('conditions', $cond));
     $id = null;
     if (isset($data[0]['Setting']['id'])) {
         $id = $data[0]['Setting']['id'];
     }
     //convert array value
     if (is_array($value)) {
         $tmp_value = "---\n";
         foreach ($value as $v) {
             $tmp_value .= '- ' . $v . "\n";
         }
         $value = $tmp_value;
     }
     $arr = array('id' => $id, 'name' => $name, 'value' => $value);
     $this->save($arr);
     #    setting = find_or_default(name)
     #    setting.value = (v ? v : "")
     #    @cached_settings[name] = nil
     #    setting.save
     #    setting.value
 }
コード例 #24
0
ファイル: 1404.php プロジェクト: phototech/sailvenice
<?php

if (!defined('MIGRATE')) {
    exit;
}
@$this->_query("ALTER TABLE {$atbl} ADD video_count INT(11) DEFAULT 0");
App::import('Model', 'Album');
$this->Album =& new Album();
$albums = $this->Album->find('all', array('conditions' => aa('smart', 0), 'fields' => 'Album.id', 'recursive' => -1));
$this->Album->begin();
foreach ($albums as $album) {
    $count = $this->Album->Image->find('count', array('conditions' => array('aid' => $album['Album']['id'], 'is_video' => 1), 'recursive' => -1));
    if ($count > 0) {
        $this->Album->id = $album['Album']['id'];
        $this->Album->saveField('video_count', $count);
    }
}
$this->Album->commit();
コード例 #25
0
 /**
  * account
  *
  * Edit user's account
  */
 function account()
 {
     #    @user = User.current
     #    @pref = @user.pref
     if ($this->data) {
         #      @user.attributes = params[:user]
         #      @user.mail_notification = (params[:notification_option] == 'all')
         #      @user.pref.attributes = params[:pref]
         $this->data['UserPreference']['pref']['no_self_notified'] = $this->data['UserPreference']['pref']['no_self_notified'] == '1';
         $this->data['User']['id'] = $this->current_user['id'];
         if ($this->User->save($this->data)) {
             $this->data['UserPreference']['user_id'] = $this->User->id;
             if (isset($this->current_user['UserPreference']['id'])) {
                 $this->data['UserPreference']['id'] = $this->current_user['UserPreference']['id'];
             }
             $this->User->UserPreference->save($this->data);
             $notified_project_ids = array();
             if ($this->data['User']['notification_option'] === 'selected') {
                 $notified_project_ids = array_filter($this->data['User']['notified_project_ids']);
             }
             $this->User->set_notified_project_ids($notified_project_ids, $this->current_user['id']);
             #        set_language_if_valid @user.language
             $this->Session->setFlash(__('Successful update.', true), 'default', array('class' => 'flash flash_notice'));
             $this->redirect('account');
             #        return
         }
     } else {
         $this->data = $this->User->find('first', aa('conditions', aa('User.id', $this->current_user['id'])));
     }
     $notification_options = array();
     $notification_options['all'] = __("\"For any event on all my projects\"", true);
     if (!empty($this->current_user['memberships'])) {
         $notification_options['selected'] = __("\"For any event on the selected projects only...\"", true);
     }
     $notification_options['none'] = __("\"Only for things I watch or I'm involved in\"", true);
     $project_ids = $this->User->notified_projects_ids($this->current_user['id']);
     $this->data['User']['notified_project_ids'] = $project_ids;
     $notification_option = empty($project_ids) ? 'none' : 'selected';
     $this->set('notification_options', $notification_options);
     $this->set('notification_option', $notification_option);
 }
コード例 #26
0
 function _getProjectMenu()
 {
     return array('overview' => aa('controller', 'projects', 'action', 'show', 'class', '', 'caption', 'Overview', 'params', 'project_id'), 'activity' => aa('controller', 'projects', 'action', 'activity', 'class', '', 'caption', 'Activity', 'params', 'project_id'), 'roadmap' => aa('controller', 'projects', 'action', 'roadmap', 'class', '', 'caption', 'Roadmap', 'params', 'project_id'), 'issues' => aa('controller', 'issues', 'action', 'index', 'class', '', 'caption', 'Issues', 'params', 'project_id'), 'new_issue' => aa('controller', 'issues', 'action', 'add', 'class', '', 'caption', 'New issue', 'params', 'project_id'), 'news' => aa('controller', 'news', 'action', 'index', 'class', '', 'caption', 'News', 'params', 'project_id'), 'wiki' => aa('controller', 'wiki', 'action', 'index', 'class', '', 'caption', 'Wiki', 'params', 'project_id'), 'settings' => aa('controller', 'projects', 'action', 'settings', 'class', '', 'caption', 'Preferences', 'params', 'project_id'));
 }
コード例 #27
0
ファイル: index.php プロジェクト: hanisaharun/NTUC-API
<?php

define('APIKEYS_DB_PATH', '../apikeys/apikeys.csv');
require '../vendor/autoload.php';
$app = new \Slim\Slim();
$app->get('/hello/:name/:surname', function ($p1, $p2) {
    echo "What, " . $p1 . " " . $p2 . "<br>";
    echo hash('sha256', 'test');
});
$app->get('/hello/:name', function ($p1) use(&$aa) {
    echo "hello, " . $p1 . " <br>";
    echo hash('sha256', 'Test.');
    $tt = aa();
    echo $tt;
});
$app->get('/api/getcurrenttime', 'aa');
function aa()
{
    $date = time();
    echo $date;
}
function retrieveUserInfo($apikey)
{
    $fh = fopen(APIKEYS_DB_PATH, 'r');
    try {
        do {
            $csv = fgetcsv($fh);
            if (!strcmp($apikey, $csv[0])) {
                return $csv;
            }
        } while ($csv !== FALSE);
コード例 #28
0
ファイル: project.php プロジェクト: nachtschatt3n/candycane
 function latest($user = array(), $count = 5)
 {
     #  def self.latest(user=nil, count=5)
     return $this->find('all', aa('limit', $count));
     #    find(:all, :limit => count, :conditions => visible_by(user), :order => "created_on DESC")
     #  end
 }
コード例 #29
0
 /**
  * Test aa()
  *
  * @access public
  * @return void
  */
 function testAa()
 {
     $result = aa('a', 'b', 'c', 'd');
     $expected = array('a' => 'b', 'c' => 'd');
     $this->assertEqual($expected, $result);
     $result = aa('a', 'b', 'c', 'd', 'e');
     $expected = array('a' => 'b', 'c' => 'd', 'e' => null);
     $this->assertEqual($result, $expected);
 }
コード例 #30
0
ファイル: query.php プロジェクト: nachtschatt3n/candycane
 function available_columns()
 {
     #    return @available_columns if @available_columns
     #    @available_columns = Query.available_columns
     #    @available_columns += (project ?
     #                            project.all_issue_custom_fields :
     #                            IssueCustomField.find(:all, :conditions => {:is_for_all => true})
     #                           ).collect {|cf| QueryCustomFieldColumn.new(cf) }
     #  @@available_columns = [
     #    QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
     #    QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
     #    QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
     #    QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
     #    QueryColumn.new(:author),
     #    QueryColumn.new(:assigned_to, :sortable => "#{User.table_name}.lastname"),
     #    QueryColumn.new(:updated_on, :sortable => "#{Issue.table_name}.updated_on", :default_order => 'desc'),
     #    QueryColumn.new(:category, :sortable => "#{IssueCategory.table_name}.name"),
     #    QueryColumn.new(:fixed_version, :sortable => "#{Version.table_name}.effective_date", :default_order => 'desc'),
     #    QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
     #    QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
     #    QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
     #    QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio"),
     #    QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
     #  ]
     $columns = array(aa('name', 'tracker', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('tracker', true)), aa('name', 'status', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('status', true)), aa('name', 'priority', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('priority', true)), aa('name', 'subject', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('subject', true)), aa('name', 'author', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('author', true)), aa('name', 'assigned_to', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('assigned_to', true)), aa('name', 'updated_on', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('updated_on', true)), aa('name', 'category', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('category', true)), aa('name', 'fixed_version', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('fixed_version', true)), aa('name', 'start_date', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('start_date', true)), aa('name', 'due_date', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('due_date', true)), aa('name', 'estimated_hours', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('estimated_hours', true)), aa('name', 'done_ratio', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('done_ratio', true)), aa('name', 'created_on', 'sortable', 'Tracker.postion', 'default_order', '', 'caption', __('created_on', true)));
     return $columns;
 }