/**
  * Render single feed item
  *
  * @param Angie_Feed_Item $item
  * @return string
  */
 private function renderItem(Angie_Feed_Item $item)
 {
     $result = "<item>\n";
     $result .= '<title>' . clean($item->getTitle()) . "</title>\n";
     $link = externalUrl(clean($item->getLink()));
     $result .= '<link>' . $link . "</link>\n";
     //$result .= '<guid>' . $link . "</guid>\n";
     if ($description = trim($item->getDescription())) {
         $description = "empty";
     }
     // if
     $result .= '<description>' . clean($description) . "</description>\n";
     $author = $item->getAuthor();
     if ($author instanceof Angie_Feed_Author) {
         $result .= '<author>' . clean($author->getEmail()) . ' (' . clean($author->getName()) . ")</author>\n";
     }
     // if
     $timestamp = NULL;
     $pubdate = $item->getPublicationDate();
     if ($pubdate instanceof DateTimeValue) {
         $result .= '<pubDate>' . $pubdate->toRSS() . "</pubDate>\n";
         $timestamp = $pubdate->getTimestamp();
     }
     // if
     $result .= '<guid>' . $this->buildGuid(clean($item->getLink()), $timestamp) . "</guid>\n";
     $result .= '</item>';
     return $result;
 }
Beispiel #2
0
/**
 * Replaces wiki links in format [wiki:{PAGE_ID}] with a textile link to the page
 * 
 * @param mixed $content
 * @return
 */
function wiki_replace_link_callback($matches)
{
    //print_r($matches);
    if (count($matches) >= 2) {
        if (is_numeric($matches[1])) {
            $object_id = $matches[1];
            $object = Wiki::instance()->findById($object_id);
            if ($object instanceof WikiPage) {
                if ($matches[2] == ',content') {
                    $revision = $object->getLatestRevision();
                    return do_textile(plugin_manager()->apply_filters('wiki_text', $revision->getContent()));
                }
                return '<a href="' . externalUrl($object->getViewUrl()) . '" title="' . lang('wiki page') . "({$object_id})" . '">' . $object->getObjectName() . '</a>';
            }
        }
    }
    return '<del>' . lang('invalid reference', $matches[0]) . '</del>';
}
Beispiel #3
0
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;} 
}

function audioPlayer(url) { 
  window.open(url, 'audio_player', 'width=200,height=240,scrollbars=no,toolbar=no,location=no,menubar=no');
}

$(function() {
  $( "#memo>.content" ).resizable({ 
     handles: 'se',
     alsoResize: '#memotext',
     stop: function(event, ui) { 
       $( "#memo>.header" ).width(ui.size.width);
       viewdata = '' + ui.size.width + ',' + ui.size.height;
       post('<?php 
echo externalUrl(get_url('user', 'saveprojectnoteview', null, null, true, '&'));
?>
', viewdata );
     }
  });
});

function autosaveFormInputs(prefix) {
  $(':input').each(function(index){
      // event handler to catch onblur events
      // it sets the cookie values each time you move out of an input field
      this.onblur = function() {
        var name = this.name;
        var value = this.value;
        $.cookie( prefix + name, value);
        //alert('setCookie: '+name + ' = '+value);
 /**
  * Sets up a new Gdn_Email object with a test email.
  *
  * @param string $image The img src of the previewed image
  * @param string $textColor The hex color code of the text.
  * @param string $backGroundColor The hex color code of the background color.
  * @param string $containerBackgroundColor The hex color code of the container background color.
  * @param string $buttonTextColor The hex color code of the link color.
  * @param string $buttonBackgroundColor The hex color code of the button background.
  * @return Gdn_Email The email object with the test colors set.
  */
 public function getTestEmail($image = '', $textColor = '', $backGroundColor = '', $containerBackgroundColor = '', $buttonTextColor = '', $buttonBackgroundColor = '')
 {
     $emailer = new Gdn_Email();
     $email = $emailer->getEmailTemplate();
     if ($image) {
         $email->setImage($image);
     }
     if ($textColor) {
         $email->setTextColor($textColor);
     }
     if ($backGroundColor) {
         $email->setBackgroundColor($backGroundColor);
     }
     if ($backGroundColor) {
         $email->setContainerBackgroundColor($containerBackgroundColor);
     }
     if ($buttonTextColor) {
         $email->setDefaultButtonTextColor($buttonTextColor);
     }
     if ($buttonBackgroundColor) {
         $email->setDefaultButtonBackgroundColor($buttonBackgroundColor);
     }
     $message = t('Test Email Message');
     $email->setMessage($message)->setTitle(t('Test Email'))->setButton(externalUrl('/'), t('Check it out'));
     $emailer->setEmailTemplate($email);
     return $emailer;
 }
Beispiel #5
0
 /**
  * Send password email.
  *
  * @param $UserID
  * @param $Password
  * @throws Exception
  */
 public function sendPasswordEmail($UserID, $Password)
 {
     $Session = Gdn::session();
     $Sender = $this->getID($Session->UserID);
     $User = $this->getID($UserID);
     $AppTitle = Gdn::config('Garden.Title');
     $Email = new Gdn_Email();
     $Email->subject('[' . $AppTitle . '] ' . t('Reset Password'));
     $Email->to($User->Email);
     $greeting = formatString(t('Hello %s!'), val('Name', $User));
     $message = '<p>' . $greeting . ' ' . sprintf(t('%s has reset your password at %s.'), val('Name', $Sender), $AppTitle) . ' ' . t('Find your account information below.') . '<br></p>' . '<p>' . sprintf(t('%s: %s'), t('Email'), val('Email', $User)) . '<br>' . sprintf(t('%s: %s'), t('Password'), $Password) . '</p>';
     $emailTemplate = $Email->getEmailTemplate()->setTitle(t('Reset Password'))->setMessage($message)->setButton(externalUrl('/'), t('Access the Site'));
     $Email->setEmailTemplate($emailTemplate);
     $Email->send();
 }
Beispiel #6
0
 /**
  * The callback helper for {@link formatString()}.
  *
  * @param array $Match Either the array of arguments or the regular expression match.
  * @param bool $SetArgs Whether this is a call to initialize the arguments or a matching callback.
  * @return mixed Returns the matching string or nothing when setting the arguments.
  * @access private
  */
 function _formatStringCallback($Match, $SetArgs = false)
 {
     static $Args = array(), $ContextUserID = null;
     if ($SetArgs) {
         $Args = $Match;
         if (isset($Args['_ContextUserID'])) {
             $ContextUserID = $Args['_ContextUserID'];
         } else {
             $ContextUserID = Gdn::session() && Gdn::session()->isValid() ? Gdn::session()->UserID : null;
         }
         return '';
     }
     $Match = $Match[1];
     if ($Match == '{') {
         return $Match;
     }
     // Parse out the field and format.
     $Parts = explode(',', $Match);
     $Field = trim($Parts[0]);
     $Format = trim(val(1, $Parts, ''));
     $SubFormat = strtolower(trim(val(2, $Parts, '')));
     $FormatArgs = val(3, $Parts, '');
     if (in_array($Format, array('currency', 'integer', 'percent'))) {
         $FormatArgs = $SubFormat;
         $SubFormat = $Format;
         $Format = 'number';
     } elseif (is_numeric($SubFormat)) {
         $FormatArgs = $SubFormat;
         $SubFormat = '';
     }
     $Value = valr($Field, $Args, null);
     if ($Value === null && !in_array($Format, array('url', 'exurl', 'number', 'plural'))) {
         $Result = '';
     } else {
         switch (strtolower($Format)) {
             case 'date':
                 switch ($SubFormat) {
                     case 'short':
                         $Result = Gdn_Format::date($Value, '%d/%m/%Y');
                         break;
                     case 'medium':
                         $Result = Gdn_Format::date($Value, '%e %b %Y');
                         break;
                     case 'long':
                         $Result = Gdn_Format::date($Value, '%e %B %Y');
                         break;
                     default:
                         $Result = Gdn_Format::date($Value);
                         break;
                 }
                 break;
             case 'html':
             case 'htmlspecialchars':
                 $Result = htmlspecialchars($Value);
                 break;
             case 'number':
                 if (!is_numeric($Value)) {
                     $Result = $Value;
                 } else {
                     switch ($SubFormat) {
                         case 'currency':
                             $Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2);
                             break;
                         case 'integer':
                             $Result = (string) round($Value);
                             if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) {
                                 $Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result;
                             }
                             break;
                         case 'percent':
                             $Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0);
                             break;
                         default:
                             $Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0);
                             break;
                     }
                 }
                 break;
             case 'plural':
                 if (is_array($Value)) {
                     $Value = count($Value);
                 } elseif (StringEndsWith($Field, 'UserID', true)) {
                     $Value = 1;
                 }
                 if (!is_numeric($Value)) {
                     $Result = $Value;
                 } else {
                     if (!$SubFormat) {
                         $SubFormat = rtrim("%s {$Field}", 's');
                     }
                     if (!$FormatArgs) {
                         $FormatArgs = $SubFormat . 's';
                     }
                     $Result = Plural($Value, $SubFormat, $FormatArgs);
                 }
                 break;
             case 'rawurlencode':
                 $Result = rawurlencode($Value);
                 break;
             case 'text':
                 $Result = Gdn_Format::text($Value, false);
                 break;
             case 'time':
                 $Result = Gdn_Format::date($Value, '%l:%M%p');
                 break;
             case 'url':
                 if (strpos($Field, '/') !== false) {
                     $Value = $Field;
                 }
                 $Result = Url($Value, $SubFormat == 'domain');
                 break;
             case 'exurl':
                 if (strpos($Field, '/') !== false) {
                     $Value = $Field;
                 }
                 $Result = externalUrl($Value);
                 break;
             case 'urlencode':
                 $Result = urlencode($Value);
                 break;
             case 'gender':
                 // Format in the form of FieldName,gender,male,female,unknown[,plural]
                 if (is_array($Value) && count($Value) == 1) {
                     $Value = array_shift($Value);
                 }
                 $Gender = 'u';
                 if (!is_array($Value)) {
                     $User = Gdn::userModel()->getID($Value);
                     if ($User) {
                         $Gender = $User->Gender;
                     }
                 } else {
                     $Gender = 'p';
                 }
                 switch ($Gender) {
                     case 'm':
                         $Result = $SubFormat;
                         break;
                     case 'f':
                         $Result = $FormatArgs;
                         break;
                     case 'p':
                         $Result = val(5, $Parts, val(4, $Parts));
                         break;
                     case 'u':
                     default:
                         $Result = val(4, $Parts);
                 }
                 break;
             case 'user':
             case 'you':
             case 'his':
             case 'her':
             case 'your':
                 //                    $Result = print_r($Value, true);
                 $ArgsBak = $Args;
                 if (is_array($Value) && count($Value) == 1) {
                     $Value = array_shift($Value);
                 }
                 if (is_array($Value)) {
                     if (isset($Value['UserID'])) {
                         $User = $Value;
                         $User['Name'] = formatUsername($User, $Format, $ContextUserID);
                         $Result = userAnchor($User);
                     } else {
                         $Max = c('Garden.FormatUsername.Max', 5);
                         // See if there is another count.
                         $ExtraCount = valr($Field . '_Count', $Args, 0);
                         $Count = count($Value);
                         $Result = '';
                         for ($i = 0; $i < $Count; $i++) {
                             if ($i >= $Max && $Count > $Max + 1) {
                                 $Others = $Count - $i + $ExtraCount;
                                 $Result .= ' ' . t('sep and', 'and') . ' ' . plural($Others, '%s other', '%s others');
                                 break;
                             }
                             $ID = $Value[$i];
                             if (is_array($ID)) {
                                 continue;
                             }
                             if ($i == $Count - 1) {
                                 $Result .= ' ' . T('sep and', 'and') . ' ';
                             } elseif ($i > 0) {
                                 $Result .= ', ';
                             }
                             $Special = array(-1 => T('everyone'), -2 => T('moderators'), -3 => T('administrators'));
                             if (isset($Special[$ID])) {
                                 $Result .= $Special[$ID];
                             } else {
                                 $User = Gdn::userModel()->getID($ID);
                                 if ($User) {
                                     $User->Name = formatUsername($User, $Format, $ContextUserID);
                                     $Result .= userAnchor($User);
                                 }
                             }
                         }
                     }
                 } else {
                     $User = Gdn::userModel()->getID($Value);
                     if ($User) {
                         // Store this name separately because of special 'You' case.
                         $Name = formatUsername($User, $Format, $ContextUserID);
                         // Manually build instead of using userAnchor() because of special 'You' case.
                         $Result = anchor(htmlspecialchars($Name), userUrl($User));
                     } else {
                         $Result = '';
                     }
                 }
                 $Args = $ArgsBak;
                 break;
             default:
                 $Result = $Value;
                 break;
         }
     }
     return $Result;
 }
Beispiel #7
0
<?php

trace(__FILE__, 'begin');
/**
 * @author Alex Mayhew
 * @copyright 2008
 */
set_page_title(!$iscurrev ? lang('viewing revision of', $revision->getRevision(), $revision->getName()) : $revision->getName() . ' [' . $revision->getPageId() . ']');
project_tabbed_navigation();
project_crumbs(array(array(lang('wiki'), get_url('wiki')), array($revision->getName())));
if ($page->canAdd(logged_user(), active_project())) {
    add_page_action(lang('add wiki page'), $page->getAddUrl());
}
// if
if ($page->canEdit(logged_user(), active_project()) && !$page->isNew()) {
    add_page_action(lang('edit wiki page'), $page->getEditUrl());
    add_page_action(lang('view page history'), $page->getViewHistoryUrl());
}
// if
if ($page->canDelete(logged_user(), active_project()) && !$page->isNew() && $iscurrev) {
    add_page_action(lang('delete wiki page'), $page->getDeleteUrl());
}
add_page_action(lang('wiki public wiki'), externalUrl(ROOT_URL . '/' . PUBLIC_FOLDER . '/wiki'));
?>

<div id="wiki-page-content"><?php 
echo do_textile(plugin_manager()->apply_filters('wiki_text', do_textile($revision->getContent())));
?>
</div>
 /**
  * Prompts new admins how to get started using new install.
  *
  * @since 2.0.0
  * @access public
  */
 public function gettingStarted()
 {
     $this->permission('Garden.Settings.Manage');
     $this->setData('Title', t('Getting Started'));
     $this->addSideMenu('dashboard/settings/gettingstarted');
     $this->TextEnterEmails = t('TextEnterEmails', 'Type email addresses separated by commas here');
     if ($this->Form->authenticatedPostBack()) {
         // Do invitations to new members.
         $Message = $this->Form->getFormValue('InvitationMessage');
         $Message = trim($Message);
         $Recipients = $this->Form->getFormValue('Recipients');
         if ($Recipients == $this->TextEnterEmails) {
             $Recipients = '';
         }
         $Recipients = explode(',', $Recipients);
         $CountRecipients = 0;
         foreach ($Recipients as $Recipient) {
             if (trim($Recipient) != '') {
                 $CountRecipients++;
                 if (!validateEmail($Recipient)) {
                     $this->Form->addError(sprintf(t('%s is not a valid email address'), $Recipient));
                 }
             }
         }
         if ($CountRecipients == 0) {
             $this->Form->addError(t('You must provide at least one recipient'));
         }
         if ($this->Form->errorCount() == 0) {
             $Email = new Gdn_Email();
             $Email->subject(t('Check out my new community!'));
             $emailTemplate = $Email->getEmailTemplate();
             $emailTemplate->setMessage($Message, true)->setButton(externalUrl('/'), t('Check it out'));
             $Email->setEmailTemplate($emailTemplate);
             foreach ($Recipients as $Recipient) {
                 if (trim($Recipient) != '') {
                     $Email->to($Recipient);
                     try {
                         $Email->send();
                     } catch (Exception $ex) {
                         $this->Form->addError($ex);
                     }
                 }
             }
         }
         if ($this->Form->errorCount() == 0) {
             $this->informMessage(t('Your invitations were sent successfully.'));
         }
     }
     $this->render();
 }
  /**
   *Make Mn
   *@return string
   */        
  function MakeMindMap(){
      // header xml data freemind
      $content = "<map version=\"0.9.0\">\n";
      $content .= "<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->\n";
      $mytime = time();

      // is logged ?     
      if (!logged_user()->isProjectUser(active_project())) {
        echo $content;
        echo "<node CREATED=\"$mytime\" ID=\"Freemind_Link_558888646\" MODIFIED=\"$mytime\" STYLE=\"bubble\" TEXT=\"Disconnected\">\n";
        echo "</node>\n";
        echo "</map>\n";
        die; 
      } // if
      // is user can view this project ??
      if (!ProjectFile::canView(logged_user(), active_project())) {
        echo $content;
        echo "<node CREATED=\"$mytime\" ID=\"Freemind_Link_558888646\" MODIFIED=\"$mytime\" STYLE=\"bubble\" TEXT=\"Not Allowed\">\n";
        echo "</node>\n";
        echo "</map>\n";
        die;
      } //if
      
      /*
      * xml data construction freemind for project
      */    
      $project = active_project();
      $project_name = $project->getName();
      $this->epure($project_name);
      //Project title
      $url = externalUrl(get_url('task','index'));
      $content .= "<node CREATED=\"$mytime\" LINK=\"$url\" MODIFIED=\"$mytime\" STYLE=\"bubble\" TEXT=\"$project_name\">\n";

      //milestones
      $milestones = $project->getMilestones();
      $mymilestone = array();
      if (is_array($milestones)) {
        foreach($milestones as $milestone){
	  $url = externalUrl(get_url('milestone','view',array('id' => $milestone->getId())));
	  $content .= "<node CREATED=\"$mytime\" LINK=\"$url\" POSITION=\"right\" MODIFIED=\"$mytime\" TEXT=\"  [" . $milestone->getName() . ' ' . Localization::instance()->formatDate($milestone->getDueDate()) . "]\">\n";
	  $content .= "<font NAME=\"SansSerif\" BOLD=\"true\" SIZE=\"12\"/>";
          $content .= "<icon BUILTIN=\"messagebox_warning\"/>\n";
          $content .= "<icon BUILTIN=\"messagebox_warning\"/>\n";
          $content .= "</node>\n";
        }
      }

      $task_lists = $project->getTaskLists();
      if (is_array($task_lists)) {
        //Tasks lists
        $positions = array('right','left');
        $actualpos = 0;
        foreach ($task_lists as $task_list) {
          /*
          * security access
          */      
          //security access User can view this task_list ?
          if (!ProjectTaskList::canView(logged_user(), $task_list->getId())) continue;
          
          // task list name
          $task_list_name=$task_list->getName();
	  //Complete or not complete
	  $progress = $this->progress($task_list);
	  $icon = null;
	  $tasklistComplete = false;
	  if ($progress[0] == '100'){
	    $icon .= "<icon BUILTIN=\"button_ok\"/>\n";
	    $tasklistComplete = true;
	  }
	  $kt_tl_var = 'tl:' . $task_list_name;
      $this->epure($kt_tl_var);
	  if (strlen($task_list_name) > 40) $task_list_name = substr($task_list_name,0,40) . "...";
          $position = $positions[$actualpos];
          $url = externalUrl(get_url('task','view_list',array('id' => $task_list->getId())));
          $content .= "<node CREATED=\"$mytime\" LINK=\"$url\" MODIFIED=\"$mytime\" POSITION=\"$position\" TEXT=\"$task_list_name\">\n";
	  $content .= "$icon";
          if ($actualpos == 0){
            $actualpos =1;            
          }else{
            $actualpos =0;            
          } //if
          //tasks
          $tasks = $task_list->getTasks();
          if (is_array($tasks)) {
            foreach($tasks as $task) {
              /*
              * security access
              */      
              //security access User can view this task ?
              if (!ProjectTask::canView(logged_user(), $task->getId())) continue;

              // icon freeming ok | cancel              
              $icon = null;
	      if (!$tasklistComplete){
		if ($task->isCompleted()) {          
		  //complete : icon ok
		  $icon .= "<icon BUILTIN=\"button_ok\"/>\n";
		  $dateclose = " []";
		}else{
		  //incomplete : icon cancel
		  $icon .= "<icon BUILTIN=\"button_cancel\"/>\n";
		  $dateclose = " []";
		} //if
	      } //if
              //task name
              $task_text = $task->getText();
	      $this->epure($task_text);
	      if (strlen($task_text) > 40) $task_text = substr($task_text,0,40) . "...";
              $url = externalUrl(get_url('task','view_task',array('id' => $task->getId())));
              $content .= "<node CREATED=\"$mytime\" LINK=\"$url\" MODIFIED=\"$mytime\" TEXT=\"" . $task_text . "\">\n";
              $content .= $icon;
              $content .= "</node>\n";
            }
          }
          $content .= "</node>\n";
        } // if
      } // if

    //footer xml data freemind  
    $content .= "</node>\n";
    $content .= "</map>";

    //send data
    $type = "x-freemind/mm";
    $name = "projectpier.mm";
    $size = strlen($content);
    header("Content-Type: $type");
    header("Content-Disposition: attachment; filename=\"$name\"");
    header("Content-Length: " . (string) $size);
    echo $content;
    die; //end process do not send other informations
  }  //MakeMm
 /**
  * Render icalendar from milestones
  *
  * @param string $calendar_name
  * @param array $milestones
  * @return null
  */
 private function renderCalendar(User $user, $calendar_name, $milestones, $user_active_projects)
 {
     $calendar = new iCalendar_Calendar();
     $calendar->setPropertyValue('VERSION', '2.0');
     $calendar->setPropertyValue('PRODID', '-//Apple Computer\\, Inc//iCal 1.5//EN');
     $calendar->setPropertyValue('X-WR-CALNAME', $calendar_name);
     $calendar->setPropertyValue('X-WR-TIMEZONE', 'GMT');
     if (is_array($user_active_projects)) {
         foreach ($user_active_projects as $project) {
             $assigned_tasks = $project->getUsersTasks(logged_user());
             if (is_array($assigned_tasks)) {
                 foreach ($assigned_tasks as $task) {
                     $todo = new iCalendar_Todo();
                     $todo->setPropertyValue('SUMMARY', $project->getName() . ": " . $task->getText());
                     $todo->setPropertyValue('UID', 'a9idfv00fd99q344o' . rand() . '*****@*****.**');
                     $date = $task->getDueDate();
                     if (!is_null($date)) {
                         $todo->setPropertyValue('DTSTART', $date->format('Ymd'), array('VALUE' => 'DATE'));
                     }
                     $priority = $task->getTaskList()->getPriority();
                     $priority = $priority ? $priority : 1;
                     $todo->setPropertyValue('PRIORITY', $priority);
                     $todo->setPropertyValue('STATUS', "NEEDS-ACTION");
                     $todo->setPropertyValue('URL', externalUrl($task->getCompleteUrl()));
                     $todo->setPropertyValue('DESCRIPTION', 'Bla Bla Bla');
                     // seting an alarm
                     $alarm = new iCalendar_Alarm();
                     $alarm->setPropertyValue('ACTION', 'DISPLAY');
                     $alarm->setPropertyValue('TRIGGER', '-P7D');
                     $alarm->setPropertyValue('DESCRIPTION', $project->getName() . ": " . $task->getText());
                     $todo->addComponent($alarm);
                     // end alarm
                     $calendar->addComponent($todo);
                 }
             }
         }
     }
     if (is_array($milestones)) {
         foreach ($milestones as $milestone) {
             if (!$user->isMemberOfOwnerCompany() && $milestone->isPrivate()) {
                 continue;
                 // hide private milestone
             }
             if (!$milestone->isCompleted()) {
                 $event = new iCalendar_Event();
                 $date = $milestone->getDueDate();
                 $event->setPropertyValue('DTSTART', $date->format('Ymd'), array('VALUE' => 'DATE'));
                 $date->advance(24 * 60 * 60);
                 $event->setPropertyValue('DTEND', $date->format('Ymd'), array('VALUE' => 'DATE'));
                 $event->setPropertyValue('UID', 'a9idfv00fd99q344o' . rand() . '*****@*****.**');
                 $event->setPropertyValue('SUMMARY', $milestone->getName() . ' (' . $milestone->getProject()->getName() . ')');
                 $event->setPropertyValue('DESCRIPTION', $desc = $milestone->getDescription());
                 $event->setPropertyValue('URL', externalUrl($milestone->getViewUrl()));
                 // setting an alarm
                 $alarm = new iCalendar_Alarm();
                 $alarm->setPropertyValue('ACTION', 'DISPLAY');
                 $alarm->setPropertyValue('TRIGGER', '-P7D');
                 $alarm->setPropertyValue('DESCRIPTION', $milestone->getName() . ' (' . $milestone->getProject()->getName() . ')');
                 $event->addComponent($alarm);
                 // end alarm
                 /* pre_var_dump($desc); */
                 $calendar->addComponent($event);
             }
             // if
         }
         // foreach
     }
     // if
     header('Content-Disposition: inline; filename=calendar.ics');
     $this->renderText(iCalendar::render($calendar), true);
     session_write_close();
     die;
 }
Beispiel #11
0
 /**
  * Queue a notification for sending.
  *
  * @since 2.0.17
  * @access public
  * @param int $ActivityID
  * @param string $Story
  * @param string $Position
  * @param bool $Force
  */
 public function queueNotification($ActivityID, $Story = '', $Position = 'last', $Force = false)
 {
     $Activity = $this->getID($ActivityID);
     if (!is_object($Activity)) {
         return;
     }
     $Story = Gdn_Format::text($Story == '' ? $Activity->Story : $Story, false);
     // If this is a comment on another activity, fudge the activity a bit so that everything appears properly.
     if (is_null($Activity->RegardingUserID) && $Activity->CommentActivityID > 0) {
         $CommentActivity = $this->getID($Activity->CommentActivityID);
         $Activity->RegardingUserID = $CommentActivity->RegardingUserID;
         $Activity->Route = '/activity/item/' . $Activity->CommentActivityID;
     }
     $User = Gdn::userModel()->getID($Activity->RegardingUserID, DATASET_TYPE_OBJECT);
     //$this->SQL->select('UserID, Name, Email, Preferences')->from('User')->where('UserID', $Activity->RegardingUserID)->get()->firstRow();
     if ($User) {
         if ($Force) {
             $Preference = $Force;
         } else {
             //            $Preferences = Gdn_Format::Unserialize($User->Preferences);
             $ConfigPreference = c('Preferences.Email.' . $Activity->ActivityType, '0');
             if ($ConfigPreference !== false) {
                 $Preference = val('Email.' . $Activity->ActivityType, $User->Preferences, $ConfigPreference);
             } else {
                 $Preference = false;
             }
         }
         if ($Preference) {
             $ActivityHeadline = Gdn_Format::text(Gdn_Format::activityHeadline($Activity, $Activity->ActivityUserID, $Activity->RegardingUserID), false);
             $Email = new Gdn_Email();
             $Email->subject(sprintf(t('[%1$s] %2$s'), Gdn::config('Garden.Title'), $ActivityHeadline));
             $Email->to($User);
             $url = externalUrl(val('Route', $Activity) == '' ? '/' : val('Route', $Activity));
             $emailTemplate = $Email->getEmailTemplate()->setButton($url, t('Check it out'))->setTitle(Gdn_Format::plainText(val('Headline', $Activity)));
             if ($message = val('Story', $Activity)) {
                 $emailTemplate->setMessage($message, true);
             }
             $Email->setEmailTemplate($emailTemplate);
             if (!array_key_exists($User->UserID, $this->_NotificationQueue)) {
                 $this->_NotificationQueue[$User->UserID] = array();
             }
             $Notification = array('ActivityID' => $ActivityID, 'User' => $User, 'Email' => $Email, 'Route' => $Activity->Route, 'Story' => $Story, 'Headline' => $ActivityHeadline, 'Activity' => $Activity);
             if ($Position == 'first') {
                 $this->_NotificationQueue[$User->UserID] = array_merge(array($Notification), $this->_NotificationQueue[$User->UserID]);
             } else {
                 $this->_NotificationQueue[$User->UserID][] = $Notification;
             }
         }
     }
 }
Beispiel #12
0
/**
 * Call back function for user link
 * 
 * @param mixed $matches
 * @return
 */
function replace_link_link_callback($matches)
{
    if (count($matches) < 2) {
        return null;
    }
    // if
    if (!logged_user()->isMemberOfOwnerCompany()) {
        $object = ProjectLinks::findOne(array('conditions' => array('`id` = ? AND `project_id` = ? AND `is_private` = 0 ', $matches[1], active_project()->getId())));
    } else {
        $object = ProjectLinks::findOne(array('conditions' => array('`id` = ? AND `project_id` = ?', $matches[1], active_project()->getId())));
    }
    // if
    if (!$object instanceof ProjectLink) {
        return '<del>' . lang('invalid reference', $matches[0]) . '</del>';
    } else {
        return '<a href="' . externalUrl($object->getViewUrl()) . '" title="' . lang('link') . '">' . $object->getObjectName() . '</a>';
    }
    // if
}
Beispiel #13
0
<!--  
	testing with java applet - dont works
	The problem is the param browsemode_initial_map which only accep stricly file and not php generation !!!

 -->
<div id="mn-page-content" style="height:<?php 
echo $ObjHeight;
?>
;display:none">
  <applet code="freemind.main.FreeMindApplet.class" archive="<?php 
echo externalUrl('/application/plugins/reports/freemindbrowser.jar');
?>
" width="100%" height="100%">
    <param name="type" value="application/x-java-applet;version=1.4" />
    <param name="scriptable" value="false" />
    <param name="modes" value="freemind.modes.browsemode.BrowseMode" />
    <param name="browsemode_initial_map" value="<?php 
echo $urlMindMapFile;
?>
" />
    <param name="initial_mode" value="Browse" />
    <param name="selection_method" value="selection_method_direct" />
  </applet>
</div
Beispiel #14
0
. 
<?php 
/* Send the task text body unless the configuration file specifically says not to:
** to prevent sending the body of email messages add the following to config.php
** For config.php:  define('SHOW_MILESTONE_BODY', false);
*/
if (!defined('SHOW_MILESTONE_BODY') or SHOW_MILESTONE_BODY == true) {
    echo "\n----------------\n";
    echo $task->getText();
    echo "\n----------------\n\n";
}
echo lang('view assigned tasks');
?>
:
<?php 
echo str_replace('&amp;', '&', externalUrl($task_assigned->getViewUrl()));
?>
 

Company: <?php 
echo owner_company()->getName();
?>
 
Project: <?php 
echo $task_assigned->getProject()->getName();
?>
 
--
<?php 
echo lang('login') . ': ' . externalUrl(ROOT_URL);
 function send_reports()
 {
     $company = Companies::findById(1);
     $lTime = time() + 60 * 60 * $company->getTimezone();
     $dayOfWeek = date("l", $lTime);
     $footer = '<a href="' . externalUrl(ROOT_URL) . '">' . externalUrl(ROOT_URL) . "</a>";
     $people = Reminders::findAll(array('conditions' => 'reports_enabled = 1 and report_day = "' . $dayOfWeek . '"'));
     if (is_array($people) && count($people)) {
         foreach ($people as $person) {
             tpl_assign('settings', $person);
             $user = Users::findById($person->getUserId());
             tpl_assign('user', $user);
             $offset = 60 * 60 * $user->getTimezone();
             tpl_assign('offset', $offset);
             $allProjects = $user->getProjects();
             $emailBody = '';
             $recipient = Notifier::prepareEmailAddress($user->getEmail(), $user->getDisplayName());
             foreach ($allProjects as $project) {
                 if ($project->isActive() || $project->getCompletedOn()->getLeftInDays() > -7) {
                     tpl_assign('project', $project);
                     $condition = 'project_id = ' . $project->getId();
                     $condition .= " and is_private = 0 and is_silent = 0";
                     if (!$person->getReportsIncludeEveryone()) {
                         $condition .= ' and taken_by_id = ' . $user->getId();
                     }
                     $logs = array();
                     if ($person->getReportsIncludeActivity()) {
                         $condition .= " and created_on > Interval -7 day + now()";
                         $logs = ApplicationLogs::findAll(array('conditions' => $condition));
                     }
                     tpl_assign('logs', $logs);
                     $taskLists = $project->getAllTaskLists();
                     $emailTaskLists = array();
                     if (is_array($taskLists) && count($taskLists)) {
                         foreach ($taskLists as $taskList) {
                             $condition = 'task_list_id = ' . $taskList->getId();
                             if (!$person->getReportsIncludeEveryone()) {
                                 $condition .= " and assigned_to_user_id = " . $user->getId();
                             }
                             $condition .= " and completed_on > Interval -7 day + now()";
                             $tasks = ProjectTasks::findAll(array('conditions' => $condition));
                             if (is_array($tasks) && count($tasks)) {
                                 $emailTaskLists[] = $taskList;
                             }
                         }
                     }
                     if (count($emailTaskLists) || count($logs)) {
                         tpl_assign('taskLists', $emailTaskLists);
                         $emailBody .= tpl_fetch(get_template_path('report_per_project', 'reminders'));
                         if ($person->getReportsSummarizedBy()) {
                             try {
                                 Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Project Report - " . $project->getObjectName(), $emailBody . $footer, 'text/html');
                                 // send
                                 $emailBody = '';
                             } catch (Exception $e) {
                                 echo $e;
                             }
                         }
                     }
                 }
             }
             if (strlen($emailBody) && !$person->getReportsSummarizedBy()) {
                 $time = time() + 60 * 60 * $user->getTimezone();
                 try {
                     Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Activity Report - " . gmdate('Y/m/d', $time), $emailBody . $footer, 'text/html');
                     // send
                     $emailBody = '';
                 } catch (Exception $e) {
                     echo $e;
                 }
             }
         }
     }
 }
<?php

echo lang('hi john doe', $new_account->getContact()->getDisplayName());
?>
,
<?php 
echo lang('user created your account', $new_account->getCreatedBy()->getContact()->getDisplayName());
?>
.
<?php 
echo lang('visit and login', externalUrl(ROOT_URL));
?>
:
<?php 
echo lang('username');
?>
: <?php 
echo $new_account->getUsername();
echo lang('password');
?>
: <?php 
echo $raw_password;
?>
--
<?php 
echo externalUrl(ROOT_URL);
Beispiel #17
0
<?php

/**
 * @author ALBATROS INFORMATIQUE SARL - CARQUEFOU FRANCE - Damien HENRY
 * @licence Honest Public License
 * @package ProjectPier Gantt
 * @version $Id$
 * @access public
 */
set_page_title(lang('reports'));
project_tabbed_navigation(PROJECT_TAB_REPORTS);
project_crumbs(array(array(lang('reports'))));
//object height
$ObjHeight = '500px';
$urlMindMap = externalUrl(html_entity_decode(get_url('reports', 'mindmap')));
$urlGantt = externalUrl(html_entity_decode(get_url('reports', 'Gantt_Chart')));
//$urlMindMap = html_entity_decode('http://freemind.sourceforge.net/wiki/images/a/a5/FreemindFlash.mm&startCollapsedToLevel=5&mm_title=FreemindFlash.mm');
add_page_action(lang('gantt'), 'javascript:show_gantt();');
add_page_action(lang('mindmap'), 'javascript:show_mindmap();');
?>
<script>
show_gantt = function() {
  document.getElementById('MM').style.display = 'none';
  document.getElementById('GANTT').style.display = 'block';
  document.getElementById('GRAPH').style.display = 'block';
  var now = new Date();
  document.getElementById('GRAPH').src = '<?php 
echo $urlGantt;
?>
&'+ now.valueOf();
}
Beispiel #18
0
?>
")
  .jPlayer({
    ready: function () {
     $(this).jPlayer("setMedia", {
      <?php 
echo $extension;
?>
: "<?php 
echo externalUrl($file->getDownloadUrl() . '&inline=1');
?>
",
     });
    },
    swfPath: "<?php 
echo externalUrl(get_javascript_url('jplayer'));
?>
",
    supplied: "<?php 
echo $extension;
?>
"
  })
  .bind($.jPlayer.event.play, function() { // Using a jPlayer event to avoid both jPlayers playing together.
    $(this).jPlayer("pauseOthers");
  });
});
</script>
<div class="jp-video jp-video-270p">
 <div class="jp-type-single">
   <div id="jplayer_<?php 
Beispiel #19
0
    ?>
:</b> <?php 
    echo $taskList->getName() . "<br>\n";
    ?>
<ol>
<?php 
    $condition = 'task_list_id = ' . $taskList->getId();
    if (!$settings->getIncludeEveryone()) {
        $condition .= " and assigned_to_user_id = " . $user->getId();
    }
    $condition .= " and completed_on is null";
    $condition .= " and due_date < Interval " . $settings->getRemindersFuture() . " day + now()";
    $tasks = ProjectTasks::findAll(array('conditions' => $condition));
    foreach ($tasks as $task) {
        echo "<li>";
        echo "<a href='" . str_replace('&amp;', '&', externalUrl($task->getViewUrl())) . "'>";
        echo $task->getText();
        echo "</a> ";
        if ($settings->getIncludeEveryone() && $task->getAssignedTo() && $task->getAssignedTo()->getObjectName() != $user->getObjectName()) {
            echo " - <i>assigned to " . $task->getAssignedTo()->getObjectName() . "</i> - ";
        } else {
            if (!$task->getAssignedTo()) {
                echo " - <i>assigned to anyone</i> - ";
            }
        }
        if ($task->getDueDate()->isUpcoming()) {
            echo format_days('is future', $task->getDueDate()->getLeftInDays());
        } elseif ($task->getDueDate()->isToday()) {
            echo "<b>" . lang('is today') . "</b>";
        } else {
            echo "<font color=red>" . format_days('is late', $task->getDueDate()->getLeftInDays()) . "</font>";
Beispiel #20
0
	  Activate both and reload to view the mind map
</div>
	
<script type="text/javascript">
	// <![CDATA[
	// for allowing using http://.....?mindmap.mm mode
	function getMap(map){
	  var result=map;
	  var loc=document.location+'';
	  if(loc.indexOf(".mm")>0 && loc.indexOf("?")>0){
		result=loc.substring(loc.indexOf("?")+1);
	  }
	  return result;
	}
	var fo = new FlashObject("<?php 
echo externalUrl(ROOT_URL . 'application/plugins/reports/visorFreemind.swf');
?>
", "visorFreeMind", "100%", "100%", 6, "#9999ff");
	fo.addParam("quality", "high");
	fo.addParam("bgcolor", "#a0a0f0");
	fo.addVariable("openUrl", "_blank");
	fo.addVariable("startCollapsedToLevel","3");
	fo.addVariable("maxNodeWidth","200");
	//
	fo.addVariable("mainNodeShape","elipse");
	fo.addVariable("justMap","false");
	fo.addVariable("initLoadFile",getMap("<?php 
echo $urlMindMap;
?>
"));
	fo.addVariable("defaultToolTipWordWrap",200);
Beispiel #21
0
<?php

$style = '';
if (isset($_SESSION['memostate']) && $_SESSION['memostate'] == 'max') {
    $style = 'style="display:block;"';
}
?>
<div id="memo" class="block">
<div class="header"><?php 
echo lang('memo');
?>
</div>
<div class="content" <?php 
echo $style;
?>
><textarea id="memotext" onblur="post('<?php 
echo externalUrl(get_url('user', 'saveprojectnote'));
?>
', this.value);" rows="15" cols="20"><?php 
echo logged_user()->getProjectNote(active_project());
?>
</textarea></div>
</div>
Beispiel #22
0
 /**
  * Send forgot password email.
  *
  * @param string $Email
  * @return bool
  */
 public function passwordRequest($Email)
 {
     if (!$Email) {
         return false;
     }
     $Users = $this->getWhere(['Email' => $Email])->resultObject();
     if (count($Users) == 0) {
         // Check for the username.
         $Users = $this->getWhere(['Name' => $Email])->resultObject();
     }
     $this->EventArguments['Users'] =& $Users;
     $this->EventArguments['Email'] = $Email;
     $this->fireEvent('BeforePasswordRequest');
     if (count($Users) == 0) {
         $this->Validation->addValidationResult('Name', "Couldn't find an account associated with that email/username.");
         return false;
     }
     $NoEmail = true;
     foreach ($Users as $User) {
         if (!$User->Email) {
             continue;
         }
         $Email = new Gdn_Email();
         // Instantiate in loop to clear previous settings
         $PasswordResetKey = betterRandomString(20, 'Aa0');
         $PasswordResetExpires = strtotime('+1 hour');
         $this->saveAttribute($User->UserID, 'PasswordResetKey', $PasswordResetKey);
         $this->saveAttribute($User->UserID, 'PasswordResetExpires', $PasswordResetExpires);
         $AppTitle = c('Garden.Title');
         $Email->subject('[' . $AppTitle . '] ' . t('Reset Your Password'));
         $Email->to($User->Email);
         $emailTemplate = $Email->getEmailTemplate()->setTitle(t('Reset Your Password'))->setMessage(sprintf(t('We\'ve received a request to change your password.'), $AppTitle))->setButton(externalUrl('/entry/passwordreset/' . $User->UserID . '/' . $PasswordResetKey), t('Change My Password'));
         $Email->setEmailTemplate($emailTemplate);
         try {
             $Email->send();
         } catch (Exception $e) {
             if (debug()) {
                 throw $e;
             }
         }
         $NoEmail = false;
     }
     if ($NoEmail) {
         $this->Validation->addValidationResult('Name', 'There is no email address associated with that account.');
         return false;
     }
     return true;
 }
Beispiel #23
0
}
$discussionID = $this->data('Plugin.Flagging.DiscussionID');
$flag = $this->data('Plugin.Flagging.Data');
$report = $this->data('Plugin.Flagging.Report');
$reason = $this->data('Plugin.Flagging.Reason');
echo t('Discussion');
?>
: <?php 
echo val('DiscussionName', $report);
?>


<?php 
echo externalUrl($flag['URL']);
?>


<?php 
echo t('Reason') . ": {$reason}";
?>


<?php 
echo t('FlaggedBy', 'Reported by:') . " {$flag['UserName']}";
?>


<?php 
if ($discussionID) {
    echo t('FlagDiscuss', 'Discuss it') . ': ' . externalUrl('discussion/' . $DiscussionID);
}